app.js 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987
  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 = 8);
  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__(17);
  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, __webpack_require__) {
  348. "use strict";
  349. /* WEBPACK VAR INJECTION */(function(process) {
  350. var utils = __webpack_require__(0);
  351. var normalizeHeaderName = __webpack_require__(20);
  352. var DEFAULT_CONTENT_TYPE = {
  353. 'Content-Type': 'application/x-www-form-urlencoded'
  354. };
  355. function setContentTypeIfUnset(headers, value) {
  356. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  357. headers['Content-Type'] = value;
  358. }
  359. }
  360. function getDefaultAdapter() {
  361. var adapter;
  362. if (typeof XMLHttpRequest !== 'undefined') {
  363. // For browsers use XHR adapter
  364. adapter = __webpack_require__(4);
  365. } else if (typeof process !== 'undefined') {
  366. // For node use HTTP adapter
  367. adapter = __webpack_require__(4);
  368. }
  369. return adapter;
  370. }
  371. var defaults = {
  372. adapter: getDefaultAdapter(),
  373. transformRequest: [function transformRequest(data, headers) {
  374. normalizeHeaderName(headers, 'Content-Type');
  375. if (utils.isFormData(data) ||
  376. utils.isArrayBuffer(data) ||
  377. utils.isBuffer(data) ||
  378. utils.isStream(data) ||
  379. utils.isFile(data) ||
  380. utils.isBlob(data)
  381. ) {
  382. return data;
  383. }
  384. if (utils.isArrayBufferView(data)) {
  385. return data.buffer;
  386. }
  387. if (utils.isURLSearchParams(data)) {
  388. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  389. return data.toString();
  390. }
  391. if (utils.isObject(data)) {
  392. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  393. return JSON.stringify(data);
  394. }
  395. return data;
  396. }],
  397. transformResponse: [function transformResponse(data) {
  398. /*eslint no-param-reassign:0*/
  399. if (typeof data === 'string') {
  400. try {
  401. data = JSON.parse(data);
  402. } catch (e) { /* Ignore */ }
  403. }
  404. return data;
  405. }],
  406. timeout: 0,
  407. xsrfCookieName: 'XSRF-TOKEN',
  408. xsrfHeaderName: 'X-XSRF-TOKEN',
  409. maxContentLength: -1,
  410. validateStatus: function validateStatus(status) {
  411. return status >= 200 && status < 300;
  412. }
  413. };
  414. defaults.headers = {
  415. common: {
  416. 'Accept': 'application/json, text/plain, */*'
  417. }
  418. };
  419. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  420. defaults.headers[method] = {};
  421. });
  422. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  423. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  424. });
  425. module.exports = defaults;
  426. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19)))
  427. /***/ }),
  428. /* 2 */
  429. /***/ (function(module, exports) {
  430. var g;
  431. // This works in non-strict mode
  432. g = (function() {
  433. return this;
  434. })();
  435. try {
  436. // This works if eval is allowed (see CSP)
  437. g = g || Function("return this")() || (1,eval)("this");
  438. } catch(e) {
  439. // This works if the window reference is available
  440. if(typeof window === "object")
  441. g = window;
  442. }
  443. // g can still be undefined, but nothing to do about it...
  444. // We return undefined, instead of nothing here, so it's
  445. // easier to handle this case. if(!global) { ...}
  446. module.exports = g;
  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, __webpack_require__) {
  463. "use strict";
  464. var utils = __webpack_require__(0);
  465. var settle = __webpack_require__(21);
  466. var buildURL = __webpack_require__(23);
  467. var parseHeaders = __webpack_require__(24);
  468. var isURLSameOrigin = __webpack_require__(25);
  469. var createError = __webpack_require__(5);
  470. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(26);
  471. module.exports = function xhrAdapter(config) {
  472. return new Promise(function dispatchXhrRequest(resolve, reject) {
  473. var requestData = config.data;
  474. var requestHeaders = config.headers;
  475. if (utils.isFormData(requestData)) {
  476. delete requestHeaders['Content-Type']; // Let the browser set it
  477. }
  478. var request = new XMLHttpRequest();
  479. var loadEvent = 'onreadystatechange';
  480. var xDomain = false;
  481. // For IE 8/9 CORS support
  482. // Only supports POST and GET calls and doesn't returns the response headers.
  483. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  484. if ("development" !== 'test' &&
  485. typeof window !== 'undefined' &&
  486. window.XDomainRequest && !('withCredentials' in request) &&
  487. !isURLSameOrigin(config.url)) {
  488. request = new window.XDomainRequest();
  489. loadEvent = 'onload';
  490. xDomain = true;
  491. request.onprogress = function handleProgress() {};
  492. request.ontimeout = function handleTimeout() {};
  493. }
  494. // HTTP basic authentication
  495. if (config.auth) {
  496. var username = config.auth.username || '';
  497. var password = config.auth.password || '';
  498. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  499. }
  500. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  501. // Set the request timeout in MS
  502. request.timeout = config.timeout;
  503. // Listen for ready state
  504. request[loadEvent] = function handleLoad() {
  505. if (!request || (request.readyState !== 4 && !xDomain)) {
  506. return;
  507. }
  508. // The request errored out and we didn't get a response, this will be
  509. // handled by onerror instead
  510. // With one exception: request that using file: protocol, most browsers
  511. // will return status as 0 even though it's a successful request
  512. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  513. return;
  514. }
  515. // Prepare the response
  516. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  517. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  518. var response = {
  519. data: responseData,
  520. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  521. status: request.status === 1223 ? 204 : request.status,
  522. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  523. headers: responseHeaders,
  524. config: config,
  525. request: request
  526. };
  527. settle(resolve, reject, response);
  528. // Clean up request
  529. request = null;
  530. };
  531. // Handle low level network errors
  532. request.onerror = function handleError() {
  533. // Real errors are hidden from us by the browser
  534. // onerror should only fire if it's a network error
  535. reject(createError('Network Error', config, null, request));
  536. // Clean up request
  537. request = null;
  538. };
  539. // Handle timeout
  540. request.ontimeout = function handleTimeout() {
  541. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  542. request));
  543. // Clean up request
  544. request = null;
  545. };
  546. // Add xsrf header
  547. // This is only done if running in a standard browser environment.
  548. // Specifically not if we're in a web worker, or react-native.
  549. if (utils.isStandardBrowserEnv()) {
  550. var cookies = __webpack_require__(27);
  551. // Add xsrf header
  552. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  553. cookies.read(config.xsrfCookieName) :
  554. undefined;
  555. if (xsrfValue) {
  556. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  557. }
  558. }
  559. // Add headers to the request
  560. if ('setRequestHeader' in request) {
  561. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  562. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  563. // Remove Content-Type if data is undefined
  564. delete requestHeaders[key];
  565. } else {
  566. // Otherwise add header to the request
  567. request.setRequestHeader(key, val);
  568. }
  569. });
  570. }
  571. // Add withCredentials to request if needed
  572. if (config.withCredentials) {
  573. request.withCredentials = true;
  574. }
  575. // Add responseType to request if needed
  576. if (config.responseType) {
  577. try {
  578. request.responseType = config.responseType;
  579. } catch (e) {
  580. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  581. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  582. if (config.responseType !== 'json') {
  583. throw e;
  584. }
  585. }
  586. }
  587. // Handle progress if needed
  588. if (typeof config.onDownloadProgress === 'function') {
  589. request.addEventListener('progress', config.onDownloadProgress);
  590. }
  591. // Not all browsers support upload events
  592. if (typeof config.onUploadProgress === 'function' && request.upload) {
  593. request.upload.addEventListener('progress', config.onUploadProgress);
  594. }
  595. if (config.cancelToken) {
  596. // Handle cancellation
  597. config.cancelToken.promise.then(function onCanceled(cancel) {
  598. if (!request) {
  599. return;
  600. }
  601. request.abort();
  602. reject(cancel);
  603. // Clean up request
  604. request = null;
  605. });
  606. }
  607. if (requestData === undefined) {
  608. requestData = null;
  609. }
  610. // Send the request
  611. request.send(requestData);
  612. });
  613. };
  614. /***/ }),
  615. /* 5 */
  616. /***/ (function(module, exports, __webpack_require__) {
  617. "use strict";
  618. var enhanceError = __webpack_require__(22);
  619. /**
  620. * Create an Error with the specified message, config, error code, request and response.
  621. *
  622. * @param {string} message The error message.
  623. * @param {Object} config The config.
  624. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  625. * @param {Object} [request] The request.
  626. * @param {Object} [response] The response.
  627. * @returns {Error} The created error.
  628. */
  629. module.exports = function createError(message, config, code, request, response) {
  630. var error = new Error(message);
  631. return enhanceError(error, config, code, request, response);
  632. };
  633. /***/ }),
  634. /* 6 */
  635. /***/ (function(module, exports, __webpack_require__) {
  636. "use strict";
  637. module.exports = function isCancel(value) {
  638. return !!(value && value.__CANCEL__);
  639. };
  640. /***/ }),
  641. /* 7 */
  642. /***/ (function(module, exports, __webpack_require__) {
  643. "use strict";
  644. /**
  645. * A `Cancel` is an object that is thrown when an operation is canceled.
  646. *
  647. * @class
  648. * @param {string=} message The message.
  649. */
  650. function Cancel(message) {
  651. this.message = message;
  652. }
  653. Cancel.prototype.toString = function toString() {
  654. return 'Cancel' + (this.message ? ': ' + this.message : '');
  655. };
  656. Cancel.prototype.__CANCEL__ = true;
  657. module.exports = Cancel;
  658. /***/ }),
  659. /* 8 */
  660. /***/ (function(module, exports, __webpack_require__) {
  661. __webpack_require__(9);
  662. module.exports = __webpack_require__(40);
  663. /***/ }),
  664. /* 9 */
  665. /***/ (function(module, exports, __webpack_require__) {
  666. /**
  667. * First we will load all of this project's JavaScript dependencies which
  668. * includes Vue and other libraries. It is a great starting point when
  669. * building robust, powerful web applications using Vue and Laravel.
  670. */
  671. __webpack_require__(10);
  672. window.Vue = __webpack_require__(35);
  673. /**
  674. * Next, we will create a fresh Vue application instance and attach it to
  675. * the page. Then, you may begin adding components to this application
  676. * or customize the JavaScript scaffolding to fit your unique needs.
  677. */
  678. Vue.component('example', __webpack_require__(36));
  679. var app = new Vue({
  680. el: '#app'
  681. });
  682. /***/ }),
  683. /* 10 */
  684. /***/ (function(module, exports, __webpack_require__) {
  685. window._ = __webpack_require__(11);
  686. /**
  687. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  688. * for JavaScript based Bootstrap features such as modals and tabs. This
  689. * code may be modified to fit the specific needs of your application.
  690. */
  691. try {
  692. window.$ = window.jQuery = __webpack_require__(13);
  693. __webpack_require__(14);
  694. } catch (e) {}
  695. /**
  696. * We'll load the axios HTTP library which allows us to easily issue requests
  697. * to our Laravel back-end. This library automatically handles sending the
  698. * CSRF token as a header based on the value of the "XSRF" token cookie.
  699. */
  700. window.axios = __webpack_require__(15);
  701. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  702. /**
  703. * Next we will register the CSRF Token as a common header with Axios so that
  704. * all outgoing HTTP requests automatically have it attached. This is just
  705. * a simple convenience so we don't have to attach every token manually.
  706. */
  707. var token = document.head.querySelector('meta[name="csrf-token"]');
  708. if (token) {
  709. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  710. } else {
  711. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  712. }
  713. /**
  714. * Echo exposes an expressive API for subscribing to channels and listening
  715. * for events that are broadcast by Laravel. Echo and event broadcasting
  716. * allows your team to easily build robust real-time web applications.
  717. */
  718. // import Echo from 'laravel-echo'
  719. // window.Pusher = require('pusher-js');
  720. // window.Echo = new Echo({
  721. // broadcaster: 'pusher',
  722. // key: 'your-pusher-key'
  723. // });
  724. /***/ }),
  725. /* 11 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  728. * @license
  729. * Lodash <https://lodash.com/>
  730. * Copyright JS Foundation and other contributors <https://js.foundation/>
  731. * Released under MIT license <https://lodash.com/license>
  732. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  733. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  734. */
  735. ;(function() {
  736. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  737. var undefined;
  738. /** Used as the semantic version number. */
  739. var VERSION = '4.17.4';
  740. /** Used as the size to enable large array optimizations. */
  741. var LARGE_ARRAY_SIZE = 200;
  742. /** Error message constants. */
  743. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  744. FUNC_ERROR_TEXT = 'Expected a function';
  745. /** Used to stand-in for `undefined` hash values. */
  746. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  747. /** Used as the maximum memoize cache size. */
  748. var MAX_MEMOIZE_SIZE = 500;
  749. /** Used as the internal argument placeholder. */
  750. var PLACEHOLDER = '__lodash_placeholder__';
  751. /** Used to compose bitmasks for cloning. */
  752. var CLONE_DEEP_FLAG = 1,
  753. CLONE_FLAT_FLAG = 2,
  754. CLONE_SYMBOLS_FLAG = 4;
  755. /** Used to compose bitmasks for value comparisons. */
  756. var COMPARE_PARTIAL_FLAG = 1,
  757. COMPARE_UNORDERED_FLAG = 2;
  758. /** Used to compose bitmasks for function metadata. */
  759. var WRAP_BIND_FLAG = 1,
  760. WRAP_BIND_KEY_FLAG = 2,
  761. WRAP_CURRY_BOUND_FLAG = 4,
  762. WRAP_CURRY_FLAG = 8,
  763. WRAP_CURRY_RIGHT_FLAG = 16,
  764. WRAP_PARTIAL_FLAG = 32,
  765. WRAP_PARTIAL_RIGHT_FLAG = 64,
  766. WRAP_ARY_FLAG = 128,
  767. WRAP_REARG_FLAG = 256,
  768. WRAP_FLIP_FLAG = 512;
  769. /** Used as default options for `_.truncate`. */
  770. var DEFAULT_TRUNC_LENGTH = 30,
  771. DEFAULT_TRUNC_OMISSION = '...';
  772. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  773. var HOT_COUNT = 800,
  774. HOT_SPAN = 16;
  775. /** Used to indicate the type of lazy iteratees. */
  776. var LAZY_FILTER_FLAG = 1,
  777. LAZY_MAP_FLAG = 2,
  778. LAZY_WHILE_FLAG = 3;
  779. /** Used as references for various `Number` constants. */
  780. var INFINITY = 1 / 0,
  781. MAX_SAFE_INTEGER = 9007199254740991,
  782. MAX_INTEGER = 1.7976931348623157e+308,
  783. NAN = 0 / 0;
  784. /** Used as references for the maximum length and index of an array. */
  785. var MAX_ARRAY_LENGTH = 4294967295,
  786. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  787. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  788. /** Used to associate wrap methods with their bit flags. */
  789. var wrapFlags = [
  790. ['ary', WRAP_ARY_FLAG],
  791. ['bind', WRAP_BIND_FLAG],
  792. ['bindKey', WRAP_BIND_KEY_FLAG],
  793. ['curry', WRAP_CURRY_FLAG],
  794. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  795. ['flip', WRAP_FLIP_FLAG],
  796. ['partial', WRAP_PARTIAL_FLAG],
  797. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  798. ['rearg', WRAP_REARG_FLAG]
  799. ];
  800. /** `Object#toString` result references. */
  801. var argsTag = '[object Arguments]',
  802. arrayTag = '[object Array]',
  803. asyncTag = '[object AsyncFunction]',
  804. boolTag = '[object Boolean]',
  805. dateTag = '[object Date]',
  806. domExcTag = '[object DOMException]',
  807. errorTag = '[object Error]',
  808. funcTag = '[object Function]',
  809. genTag = '[object GeneratorFunction]',
  810. mapTag = '[object Map]',
  811. numberTag = '[object Number]',
  812. nullTag = '[object Null]',
  813. objectTag = '[object Object]',
  814. promiseTag = '[object Promise]',
  815. proxyTag = '[object Proxy]',
  816. regexpTag = '[object RegExp]',
  817. setTag = '[object Set]',
  818. stringTag = '[object String]',
  819. symbolTag = '[object Symbol]',
  820. undefinedTag = '[object Undefined]',
  821. weakMapTag = '[object WeakMap]',
  822. weakSetTag = '[object WeakSet]';
  823. var arrayBufferTag = '[object ArrayBuffer]',
  824. dataViewTag = '[object DataView]',
  825. float32Tag = '[object Float32Array]',
  826. float64Tag = '[object Float64Array]',
  827. int8Tag = '[object Int8Array]',
  828. int16Tag = '[object Int16Array]',
  829. int32Tag = '[object Int32Array]',
  830. uint8Tag = '[object Uint8Array]',
  831. uint8ClampedTag = '[object Uint8ClampedArray]',
  832. uint16Tag = '[object Uint16Array]',
  833. uint32Tag = '[object Uint32Array]';
  834. /** Used to match empty string literals in compiled template source. */
  835. var reEmptyStringLeading = /\b__p \+= '';/g,
  836. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  837. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  838. /** Used to match HTML entities and HTML characters. */
  839. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  840. reUnescapedHtml = /[&<>"']/g,
  841. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  842. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  843. /** Used to match template delimiters. */
  844. var reEscape = /<%-([\s\S]+?)%>/g,
  845. reEvaluate = /<%([\s\S]+?)%>/g,
  846. reInterpolate = /<%=([\s\S]+?)%>/g;
  847. /** Used to match property names within property paths. */
  848. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  849. reIsPlainProp = /^\w*$/,
  850. reLeadingDot = /^\./,
  851. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  852. /**
  853. * Used to match `RegExp`
  854. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  855. */
  856. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  857. reHasRegExpChar = RegExp(reRegExpChar.source);
  858. /** Used to match leading and trailing whitespace. */
  859. var reTrim = /^\s+|\s+$/g,
  860. reTrimStart = /^\s+/,
  861. reTrimEnd = /\s+$/;
  862. /** Used to match wrap detail comments. */
  863. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  864. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  865. reSplitDetails = /,? & /;
  866. /** Used to match words composed of alphanumeric characters. */
  867. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  868. /** Used to match backslashes in property paths. */
  869. var reEscapeChar = /\\(\\)?/g;
  870. /**
  871. * Used to match
  872. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  873. */
  874. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  875. /** Used to match `RegExp` flags from their coerced string values. */
  876. var reFlags = /\w*$/;
  877. /** Used to detect bad signed hexadecimal string values. */
  878. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  879. /** Used to detect binary string values. */
  880. var reIsBinary = /^0b[01]+$/i;
  881. /** Used to detect host constructors (Safari). */
  882. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  883. /** Used to detect octal string values. */
  884. var reIsOctal = /^0o[0-7]+$/i;
  885. /** Used to detect unsigned integer values. */
  886. var reIsUint = /^(?:0|[1-9]\d*)$/;
  887. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  888. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  889. /** Used to ensure capturing order of template delimiters. */
  890. var reNoMatch = /($^)/;
  891. /** Used to match unescaped characters in compiled string literals. */
  892. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  893. /** Used to compose unicode character classes. */
  894. var rsAstralRange = '\\ud800-\\udfff',
  895. rsComboMarksRange = '\\u0300-\\u036f',
  896. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  897. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  898. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  899. rsDingbatRange = '\\u2700-\\u27bf',
  900. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  901. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  902. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  903. rsPunctuationRange = '\\u2000-\\u206f',
  904. 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',
  905. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  906. rsVarRange = '\\ufe0e\\ufe0f',
  907. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  908. /** Used to compose unicode capture groups. */
  909. var rsApos = "['\u2019]",
  910. rsAstral = '[' + rsAstralRange + ']',
  911. rsBreak = '[' + rsBreakRange + ']',
  912. rsCombo = '[' + rsComboRange + ']',
  913. rsDigits = '\\d+',
  914. rsDingbat = '[' + rsDingbatRange + ']',
  915. rsLower = '[' + rsLowerRange + ']',
  916. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  917. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  918. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  919. rsNonAstral = '[^' + rsAstralRange + ']',
  920. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  921. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  922. rsUpper = '[' + rsUpperRange + ']',
  923. rsZWJ = '\\u200d';
  924. /** Used to compose unicode regexes. */
  925. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  926. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  927. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  928. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  929. reOptMod = rsModifier + '?',
  930. rsOptVar = '[' + rsVarRange + ']?',
  931. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  932. rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
  933. rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
  934. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  935. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  936. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  937. /** Used to match apostrophes. */
  938. var reApos = RegExp(rsApos, 'g');
  939. /**
  940. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  941. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  942. */
  943. var reComboMark = RegExp(rsCombo, 'g');
  944. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  945. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  946. /** Used to match complex or compound words. */
  947. var reUnicodeWord = RegExp([
  948. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  949. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  950. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  951. rsUpper + '+' + rsOptContrUpper,
  952. rsOrdUpper,
  953. rsOrdLower,
  954. rsDigits,
  955. rsEmoji
  956. ].join('|'), 'g');
  957. /** 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/). */
  958. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  959. /** Used to detect strings that need a more robust regexp to match words. */
  960. 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 ]/;
  961. /** Used to assign default `context` object properties. */
  962. var contextProps = [
  963. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  964. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  965. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  966. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  967. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  968. ];
  969. /** Used to make template sourceURLs easier to identify. */
  970. var templateCounter = -1;
  971. /** Used to identify `toStringTag` values of typed arrays. */
  972. var typedArrayTags = {};
  973. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  974. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  975. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  976. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  977. typedArrayTags[uint32Tag] = true;
  978. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  979. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  980. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  981. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  982. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  983. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  984. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  985. typedArrayTags[weakMapTag] = false;
  986. /** Used to identify `toStringTag` values supported by `_.clone`. */
  987. var cloneableTags = {};
  988. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  989. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  990. cloneableTags[boolTag] = cloneableTags[dateTag] =
  991. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  992. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  993. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  994. cloneableTags[numberTag] = cloneableTags[objectTag] =
  995. cloneableTags[regexpTag] = cloneableTags[setTag] =
  996. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  997. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  998. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  999. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1000. cloneableTags[weakMapTag] = false;
  1001. /** Used to map Latin Unicode letters to basic Latin letters. */
  1002. var deburredLetters = {
  1003. // Latin-1 Supplement block.
  1004. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1005. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1006. '\xc7': 'C', '\xe7': 'c',
  1007. '\xd0': 'D', '\xf0': 'd',
  1008. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1009. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1010. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1011. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1012. '\xd1': 'N', '\xf1': 'n',
  1013. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1014. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1015. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1016. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1017. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1018. '\xc6': 'Ae', '\xe6': 'ae',
  1019. '\xde': 'Th', '\xfe': 'th',
  1020. '\xdf': 'ss',
  1021. // Latin Extended-A block.
  1022. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1023. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1024. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1025. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1026. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1027. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1028. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1029. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1030. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1031. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1032. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1033. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1034. '\u0134': 'J', '\u0135': 'j',
  1035. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1036. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1037. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1038. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1039. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1040. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1041. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1042. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1043. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1044. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1045. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1046. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1047. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1048. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1049. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1050. '\u0174': 'W', '\u0175': 'w',
  1051. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1052. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1053. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1054. '\u0132': 'IJ', '\u0133': 'ij',
  1055. '\u0152': 'Oe', '\u0153': 'oe',
  1056. '\u0149': "'n", '\u017f': 's'
  1057. };
  1058. /** Used to map characters to HTML entities. */
  1059. var htmlEscapes = {
  1060. '&': '&amp;',
  1061. '<': '&lt;',
  1062. '>': '&gt;',
  1063. '"': '&quot;',
  1064. "'": '&#39;'
  1065. };
  1066. /** Used to map HTML entities to characters. */
  1067. var htmlUnescapes = {
  1068. '&amp;': '&',
  1069. '&lt;': '<',
  1070. '&gt;': '>',
  1071. '&quot;': '"',
  1072. '&#39;': "'"
  1073. };
  1074. /** Used to escape characters for inclusion in compiled string literals. */
  1075. var stringEscapes = {
  1076. '\\': '\\',
  1077. "'": "'",
  1078. '\n': 'n',
  1079. '\r': 'r',
  1080. '\u2028': 'u2028',
  1081. '\u2029': 'u2029'
  1082. };
  1083. /** Built-in method references without a dependency on `root`. */
  1084. var freeParseFloat = parseFloat,
  1085. freeParseInt = parseInt;
  1086. /** Detect free variable `global` from Node.js. */
  1087. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1088. /** Detect free variable `self`. */
  1089. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1090. /** Used as a reference to the global object. */
  1091. var root = freeGlobal || freeSelf || Function('return this')();
  1092. /** Detect free variable `exports`. */
  1093. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  1094. /** Detect free variable `module`. */
  1095. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  1096. /** Detect the popular CommonJS extension `module.exports`. */
  1097. var moduleExports = freeModule && freeModule.exports === freeExports;
  1098. /** Detect free variable `process` from Node.js. */
  1099. var freeProcess = moduleExports && freeGlobal.process;
  1100. /** Used to access faster Node.js helpers. */
  1101. var nodeUtil = (function() {
  1102. try {
  1103. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1104. } catch (e) {}
  1105. }());
  1106. /* Node.js helper references. */
  1107. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1108. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1109. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1110. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1111. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1112. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1113. /*--------------------------------------------------------------------------*/
  1114. /**
  1115. * Adds the key-value `pair` to `map`.
  1116. *
  1117. * @private
  1118. * @param {Object} map The map to modify.
  1119. * @param {Array} pair The key-value pair to add.
  1120. * @returns {Object} Returns `map`.
  1121. */
  1122. function addMapEntry(map, pair) {
  1123. // Don't return `map.set` because it's not chainable in IE 11.
  1124. map.set(pair[0], pair[1]);
  1125. return map;
  1126. }
  1127. /**
  1128. * Adds `value` to `set`.
  1129. *
  1130. * @private
  1131. * @param {Object} set The set to modify.
  1132. * @param {*} value The value to add.
  1133. * @returns {Object} Returns `set`.
  1134. */
  1135. function addSetEntry(set, value) {
  1136. // Don't return `set.add` because it's not chainable in IE 11.
  1137. set.add(value);
  1138. return set;
  1139. }
  1140. /**
  1141. * A faster alternative to `Function#apply`, this function invokes `func`
  1142. * with the `this` binding of `thisArg` and the arguments of `args`.
  1143. *
  1144. * @private
  1145. * @param {Function} func The function to invoke.
  1146. * @param {*} thisArg The `this` binding of `func`.
  1147. * @param {Array} args The arguments to invoke `func` with.
  1148. * @returns {*} Returns the result of `func`.
  1149. */
  1150. function apply(func, thisArg, args) {
  1151. switch (args.length) {
  1152. case 0: return func.call(thisArg);
  1153. case 1: return func.call(thisArg, args[0]);
  1154. case 2: return func.call(thisArg, args[0], args[1]);
  1155. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1156. }
  1157. return func.apply(thisArg, args);
  1158. }
  1159. /**
  1160. * A specialized version of `baseAggregator` for arrays.
  1161. *
  1162. * @private
  1163. * @param {Array} [array] The array to iterate over.
  1164. * @param {Function} setter The function to set `accumulator` values.
  1165. * @param {Function} iteratee The iteratee to transform keys.
  1166. * @param {Object} accumulator The initial aggregated object.
  1167. * @returns {Function} Returns `accumulator`.
  1168. */
  1169. function arrayAggregator(array, setter, iteratee, accumulator) {
  1170. var index = -1,
  1171. length = array == null ? 0 : array.length;
  1172. while (++index < length) {
  1173. var value = array[index];
  1174. setter(accumulator, value, iteratee(value), array);
  1175. }
  1176. return accumulator;
  1177. }
  1178. /**
  1179. * A specialized version of `_.forEach` for arrays without support for
  1180. * iteratee shorthands.
  1181. *
  1182. * @private
  1183. * @param {Array} [array] The array to iterate over.
  1184. * @param {Function} iteratee The function invoked per iteration.
  1185. * @returns {Array} Returns `array`.
  1186. */
  1187. function arrayEach(array, iteratee) {
  1188. var index = -1,
  1189. length = array == null ? 0 : array.length;
  1190. while (++index < length) {
  1191. if (iteratee(array[index], index, array) === false) {
  1192. break;
  1193. }
  1194. }
  1195. return array;
  1196. }
  1197. /**
  1198. * A specialized version of `_.forEachRight` for arrays without support for
  1199. * iteratee shorthands.
  1200. *
  1201. * @private
  1202. * @param {Array} [array] The array to iterate over.
  1203. * @param {Function} iteratee The function invoked per iteration.
  1204. * @returns {Array} Returns `array`.
  1205. */
  1206. function arrayEachRight(array, iteratee) {
  1207. var length = array == null ? 0 : array.length;
  1208. while (length--) {
  1209. if (iteratee(array[length], length, array) === false) {
  1210. break;
  1211. }
  1212. }
  1213. return array;
  1214. }
  1215. /**
  1216. * A specialized version of `_.every` for arrays without support for
  1217. * iteratee shorthands.
  1218. *
  1219. * @private
  1220. * @param {Array} [array] The array to iterate over.
  1221. * @param {Function} predicate The function invoked per iteration.
  1222. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1223. * else `false`.
  1224. */
  1225. function arrayEvery(array, predicate) {
  1226. var index = -1,
  1227. length = array == null ? 0 : array.length;
  1228. while (++index < length) {
  1229. if (!predicate(array[index], index, array)) {
  1230. return false;
  1231. }
  1232. }
  1233. return true;
  1234. }
  1235. /**
  1236. * A specialized version of `_.filter` for arrays without support for
  1237. * iteratee shorthands.
  1238. *
  1239. * @private
  1240. * @param {Array} [array] The array to iterate over.
  1241. * @param {Function} predicate The function invoked per iteration.
  1242. * @returns {Array} Returns the new filtered array.
  1243. */
  1244. function arrayFilter(array, predicate) {
  1245. var index = -1,
  1246. length = array == null ? 0 : array.length,
  1247. resIndex = 0,
  1248. result = [];
  1249. while (++index < length) {
  1250. var value = array[index];
  1251. if (predicate(value, index, array)) {
  1252. result[resIndex++] = value;
  1253. }
  1254. }
  1255. return result;
  1256. }
  1257. /**
  1258. * A specialized version of `_.includes` for arrays without support for
  1259. * specifying an index to search from.
  1260. *
  1261. * @private
  1262. * @param {Array} [array] The array to inspect.
  1263. * @param {*} target The value to search for.
  1264. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1265. */
  1266. function arrayIncludes(array, value) {
  1267. var length = array == null ? 0 : array.length;
  1268. return !!length && baseIndexOf(array, value, 0) > -1;
  1269. }
  1270. /**
  1271. * This function is like `arrayIncludes` except that it accepts a comparator.
  1272. *
  1273. * @private
  1274. * @param {Array} [array] The array to inspect.
  1275. * @param {*} target The value to search for.
  1276. * @param {Function} comparator The comparator invoked per element.
  1277. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1278. */
  1279. function arrayIncludesWith(array, value, comparator) {
  1280. var index = -1,
  1281. length = array == null ? 0 : array.length;
  1282. while (++index < length) {
  1283. if (comparator(value, array[index])) {
  1284. return true;
  1285. }
  1286. }
  1287. return false;
  1288. }
  1289. /**
  1290. * A specialized version of `_.map` for arrays without support for iteratee
  1291. * shorthands.
  1292. *
  1293. * @private
  1294. * @param {Array} [array] The array to iterate over.
  1295. * @param {Function} iteratee The function invoked per iteration.
  1296. * @returns {Array} Returns the new mapped array.
  1297. */
  1298. function arrayMap(array, iteratee) {
  1299. var index = -1,
  1300. length = array == null ? 0 : array.length,
  1301. result = Array(length);
  1302. while (++index < length) {
  1303. result[index] = iteratee(array[index], index, array);
  1304. }
  1305. return result;
  1306. }
  1307. /**
  1308. * Appends the elements of `values` to `array`.
  1309. *
  1310. * @private
  1311. * @param {Array} array The array to modify.
  1312. * @param {Array} values The values to append.
  1313. * @returns {Array} Returns `array`.
  1314. */
  1315. function arrayPush(array, values) {
  1316. var index = -1,
  1317. length = values.length,
  1318. offset = array.length;
  1319. while (++index < length) {
  1320. array[offset + index] = values[index];
  1321. }
  1322. return array;
  1323. }
  1324. /**
  1325. * A specialized version of `_.reduce` for arrays without support for
  1326. * iteratee shorthands.
  1327. *
  1328. * @private
  1329. * @param {Array} [array] The array to iterate over.
  1330. * @param {Function} iteratee The function invoked per iteration.
  1331. * @param {*} [accumulator] The initial value.
  1332. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1333. * the initial value.
  1334. * @returns {*} Returns the accumulated value.
  1335. */
  1336. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1337. var index = -1,
  1338. length = array == null ? 0 : array.length;
  1339. if (initAccum && length) {
  1340. accumulator = array[++index];
  1341. }
  1342. while (++index < length) {
  1343. accumulator = iteratee(accumulator, array[index], index, array);
  1344. }
  1345. return accumulator;
  1346. }
  1347. /**
  1348. * A specialized version of `_.reduceRight` for arrays without support for
  1349. * iteratee shorthands.
  1350. *
  1351. * @private
  1352. * @param {Array} [array] The array to iterate over.
  1353. * @param {Function} iteratee The function invoked per iteration.
  1354. * @param {*} [accumulator] The initial value.
  1355. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1356. * the initial value.
  1357. * @returns {*} Returns the accumulated value.
  1358. */
  1359. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1360. var length = array == null ? 0 : array.length;
  1361. if (initAccum && length) {
  1362. accumulator = array[--length];
  1363. }
  1364. while (length--) {
  1365. accumulator = iteratee(accumulator, array[length], length, array);
  1366. }
  1367. return accumulator;
  1368. }
  1369. /**
  1370. * A specialized version of `_.some` for arrays without support for iteratee
  1371. * shorthands.
  1372. *
  1373. * @private
  1374. * @param {Array} [array] The array to iterate over.
  1375. * @param {Function} predicate The function invoked per iteration.
  1376. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1377. * else `false`.
  1378. */
  1379. function arraySome(array, predicate) {
  1380. var index = -1,
  1381. length = array == null ? 0 : array.length;
  1382. while (++index < length) {
  1383. if (predicate(array[index], index, array)) {
  1384. return true;
  1385. }
  1386. }
  1387. return false;
  1388. }
  1389. /**
  1390. * Gets the size of an ASCII `string`.
  1391. *
  1392. * @private
  1393. * @param {string} string The string inspect.
  1394. * @returns {number} Returns the string size.
  1395. */
  1396. var asciiSize = baseProperty('length');
  1397. /**
  1398. * Converts an ASCII `string` to an array.
  1399. *
  1400. * @private
  1401. * @param {string} string The string to convert.
  1402. * @returns {Array} Returns the converted array.
  1403. */
  1404. function asciiToArray(string) {
  1405. return string.split('');
  1406. }
  1407. /**
  1408. * Splits an ASCII `string` into an array of its words.
  1409. *
  1410. * @private
  1411. * @param {string} The string to inspect.
  1412. * @returns {Array} Returns the words of `string`.
  1413. */
  1414. function asciiWords(string) {
  1415. return string.match(reAsciiWord) || [];
  1416. }
  1417. /**
  1418. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  1419. * without support for iteratee shorthands, which iterates over `collection`
  1420. * using `eachFunc`.
  1421. *
  1422. * @private
  1423. * @param {Array|Object} collection The collection to inspect.
  1424. * @param {Function} predicate The function invoked per iteration.
  1425. * @param {Function} eachFunc The function to iterate over `collection`.
  1426. * @returns {*} Returns the found element or its key, else `undefined`.
  1427. */
  1428. function baseFindKey(collection, predicate, eachFunc) {
  1429. var result;
  1430. eachFunc(collection, function(value, key, collection) {
  1431. if (predicate(value, key, collection)) {
  1432. result = key;
  1433. return false;
  1434. }
  1435. });
  1436. return result;
  1437. }
  1438. /**
  1439. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1440. * support for iteratee shorthands.
  1441. *
  1442. * @private
  1443. * @param {Array} array The array to inspect.
  1444. * @param {Function} predicate The function invoked per iteration.
  1445. * @param {number} fromIndex The index to search from.
  1446. * @param {boolean} [fromRight] Specify iterating from right to left.
  1447. * @returns {number} Returns the index of the matched value, else `-1`.
  1448. */
  1449. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1450. var length = array.length,
  1451. index = fromIndex + (fromRight ? 1 : -1);
  1452. while ((fromRight ? index-- : ++index < length)) {
  1453. if (predicate(array[index], index, array)) {
  1454. return index;
  1455. }
  1456. }
  1457. return -1;
  1458. }
  1459. /**
  1460. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1461. *
  1462. * @private
  1463. * @param {Array} array The array to inspect.
  1464. * @param {*} value The value to search for.
  1465. * @param {number} fromIndex The index to search from.
  1466. * @returns {number} Returns the index of the matched value, else `-1`.
  1467. */
  1468. function baseIndexOf(array, value, fromIndex) {
  1469. return value === value
  1470. ? strictIndexOf(array, value, fromIndex)
  1471. : baseFindIndex(array, baseIsNaN, fromIndex);
  1472. }
  1473. /**
  1474. * This function is like `baseIndexOf` except that it accepts a comparator.
  1475. *
  1476. * @private
  1477. * @param {Array} array The array to inspect.
  1478. * @param {*} value The value to search for.
  1479. * @param {number} fromIndex The index to search from.
  1480. * @param {Function} comparator The comparator invoked per element.
  1481. * @returns {number} Returns the index of the matched value, else `-1`.
  1482. */
  1483. function baseIndexOfWith(array, value, fromIndex, comparator) {
  1484. var index = fromIndex - 1,
  1485. length = array.length;
  1486. while (++index < length) {
  1487. if (comparator(array[index], value)) {
  1488. return index;
  1489. }
  1490. }
  1491. return -1;
  1492. }
  1493. /**
  1494. * The base implementation of `_.isNaN` without support for number objects.
  1495. *
  1496. * @private
  1497. * @param {*} value The value to check.
  1498. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1499. */
  1500. function baseIsNaN(value) {
  1501. return value !== value;
  1502. }
  1503. /**
  1504. * The base implementation of `_.mean` and `_.meanBy` without support for
  1505. * iteratee shorthands.
  1506. *
  1507. * @private
  1508. * @param {Array} array The array to iterate over.
  1509. * @param {Function} iteratee The function invoked per iteration.
  1510. * @returns {number} Returns the mean.
  1511. */
  1512. function baseMean(array, iteratee) {
  1513. var length = array == null ? 0 : array.length;
  1514. return length ? (baseSum(array, iteratee) / length) : NAN;
  1515. }
  1516. /**
  1517. * The base implementation of `_.property` without support for deep paths.
  1518. *
  1519. * @private
  1520. * @param {string} key The key of the property to get.
  1521. * @returns {Function} Returns the new accessor function.
  1522. */
  1523. function baseProperty(key) {
  1524. return function(object) {
  1525. return object == null ? undefined : object[key];
  1526. };
  1527. }
  1528. /**
  1529. * The base implementation of `_.propertyOf` without support for deep paths.
  1530. *
  1531. * @private
  1532. * @param {Object} object The object to query.
  1533. * @returns {Function} Returns the new accessor function.
  1534. */
  1535. function basePropertyOf(object) {
  1536. return function(key) {
  1537. return object == null ? undefined : object[key];
  1538. };
  1539. }
  1540. /**
  1541. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  1542. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  1543. *
  1544. * @private
  1545. * @param {Array|Object} collection The collection to iterate over.
  1546. * @param {Function} iteratee The function invoked per iteration.
  1547. * @param {*} accumulator The initial value.
  1548. * @param {boolean} initAccum Specify using the first or last element of
  1549. * `collection` as the initial value.
  1550. * @param {Function} eachFunc The function to iterate over `collection`.
  1551. * @returns {*} Returns the accumulated value.
  1552. */
  1553. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  1554. eachFunc(collection, function(value, index, collection) {
  1555. accumulator = initAccum
  1556. ? (initAccum = false, value)
  1557. : iteratee(accumulator, value, index, collection);
  1558. });
  1559. return accumulator;
  1560. }
  1561. /**
  1562. * The base implementation of `_.sortBy` which uses `comparer` to define the
  1563. * sort order of `array` and replaces criteria objects with their corresponding
  1564. * values.
  1565. *
  1566. * @private
  1567. * @param {Array} array The array to sort.
  1568. * @param {Function} comparer The function to define sort order.
  1569. * @returns {Array} Returns `array`.
  1570. */
  1571. function baseSortBy(array, comparer) {
  1572. var length = array.length;
  1573. array.sort(comparer);
  1574. while (length--) {
  1575. array[length] = array[length].value;
  1576. }
  1577. return array;
  1578. }
  1579. /**
  1580. * The base implementation of `_.sum` and `_.sumBy` without support for
  1581. * iteratee shorthands.
  1582. *
  1583. * @private
  1584. * @param {Array} array The array to iterate over.
  1585. * @param {Function} iteratee The function invoked per iteration.
  1586. * @returns {number} Returns the sum.
  1587. */
  1588. function baseSum(array, iteratee) {
  1589. var result,
  1590. index = -1,
  1591. length = array.length;
  1592. while (++index < length) {
  1593. var current = iteratee(array[index]);
  1594. if (current !== undefined) {
  1595. result = result === undefined ? current : (result + current);
  1596. }
  1597. }
  1598. return result;
  1599. }
  1600. /**
  1601. * The base implementation of `_.times` without support for iteratee shorthands
  1602. * or max array length checks.
  1603. *
  1604. * @private
  1605. * @param {number} n The number of times to invoke `iteratee`.
  1606. * @param {Function} iteratee The function invoked per iteration.
  1607. * @returns {Array} Returns the array of results.
  1608. */
  1609. function baseTimes(n, iteratee) {
  1610. var index = -1,
  1611. result = Array(n);
  1612. while (++index < n) {
  1613. result[index] = iteratee(index);
  1614. }
  1615. return result;
  1616. }
  1617. /**
  1618. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1619. * of key-value pairs for `object` corresponding to the property names of `props`.
  1620. *
  1621. * @private
  1622. * @param {Object} object The object to query.
  1623. * @param {Array} props The property names to get values for.
  1624. * @returns {Object} Returns the key-value pairs.
  1625. */
  1626. function baseToPairs(object, props) {
  1627. return arrayMap(props, function(key) {
  1628. return [key, object[key]];
  1629. });
  1630. }
  1631. /**
  1632. * The base implementation of `_.unary` without support for storing metadata.
  1633. *
  1634. * @private
  1635. * @param {Function} func The function to cap arguments for.
  1636. * @returns {Function} Returns the new capped function.
  1637. */
  1638. function baseUnary(func) {
  1639. return function(value) {
  1640. return func(value);
  1641. };
  1642. }
  1643. /**
  1644. * The base implementation of `_.values` and `_.valuesIn` which creates an
  1645. * array of `object` property values corresponding to the property names
  1646. * of `props`.
  1647. *
  1648. * @private
  1649. * @param {Object} object The object to query.
  1650. * @param {Array} props The property names to get values for.
  1651. * @returns {Object} Returns the array of property values.
  1652. */
  1653. function baseValues(object, props) {
  1654. return arrayMap(props, function(key) {
  1655. return object[key];
  1656. });
  1657. }
  1658. /**
  1659. * Checks if a `cache` value for `key` exists.
  1660. *
  1661. * @private
  1662. * @param {Object} cache The cache to query.
  1663. * @param {string} key The key of the entry to check.
  1664. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1665. */
  1666. function cacheHas(cache, key) {
  1667. return cache.has(key);
  1668. }
  1669. /**
  1670. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  1671. * that is not found in the character symbols.
  1672. *
  1673. * @private
  1674. * @param {Array} strSymbols The string symbols to inspect.
  1675. * @param {Array} chrSymbols The character symbols to find.
  1676. * @returns {number} Returns the index of the first unmatched string symbol.
  1677. */
  1678. function charsStartIndex(strSymbols, chrSymbols) {
  1679. var index = -1,
  1680. length = strSymbols.length;
  1681. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1682. return index;
  1683. }
  1684. /**
  1685. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  1686. * that is not found in the character symbols.
  1687. *
  1688. * @private
  1689. * @param {Array} strSymbols The string symbols to inspect.
  1690. * @param {Array} chrSymbols The character symbols to find.
  1691. * @returns {number} Returns the index of the last unmatched string symbol.
  1692. */
  1693. function charsEndIndex(strSymbols, chrSymbols) {
  1694. var index = strSymbols.length;
  1695. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1696. return index;
  1697. }
  1698. /**
  1699. * Gets the number of `placeholder` occurrences in `array`.
  1700. *
  1701. * @private
  1702. * @param {Array} array The array to inspect.
  1703. * @param {*} placeholder The placeholder to search for.
  1704. * @returns {number} Returns the placeholder count.
  1705. */
  1706. function countHolders(array, placeholder) {
  1707. var length = array.length,
  1708. result = 0;
  1709. while (length--) {
  1710. if (array[length] === placeholder) {
  1711. ++result;
  1712. }
  1713. }
  1714. return result;
  1715. }
  1716. /**
  1717. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  1718. * letters to basic Latin letters.
  1719. *
  1720. * @private
  1721. * @param {string} letter The matched letter to deburr.
  1722. * @returns {string} Returns the deburred letter.
  1723. */
  1724. var deburrLetter = basePropertyOf(deburredLetters);
  1725. /**
  1726. * Used by `_.escape` to convert characters to HTML entities.
  1727. *
  1728. * @private
  1729. * @param {string} chr The matched character to escape.
  1730. * @returns {string} Returns the escaped character.
  1731. */
  1732. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  1733. /**
  1734. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  1735. *
  1736. * @private
  1737. * @param {string} chr The matched character to escape.
  1738. * @returns {string} Returns the escaped character.
  1739. */
  1740. function escapeStringChar(chr) {
  1741. return '\\' + stringEscapes[chr];
  1742. }
  1743. /**
  1744. * Gets the value at `key` of `object`.
  1745. *
  1746. * @private
  1747. * @param {Object} [object] The object to query.
  1748. * @param {string} key The key of the property to get.
  1749. * @returns {*} Returns the property value.
  1750. */
  1751. function getValue(object, key) {
  1752. return object == null ? undefined : object[key];
  1753. }
  1754. /**
  1755. * Checks if `string` contains Unicode symbols.
  1756. *
  1757. * @private
  1758. * @param {string} string The string to inspect.
  1759. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  1760. */
  1761. function hasUnicode(string) {
  1762. return reHasUnicode.test(string);
  1763. }
  1764. /**
  1765. * Checks if `string` contains a word composed of Unicode symbols.
  1766. *
  1767. * @private
  1768. * @param {string} string The string to inspect.
  1769. * @returns {boolean} Returns `true` if a word is found, else `false`.
  1770. */
  1771. function hasUnicodeWord(string) {
  1772. return reHasUnicodeWord.test(string);
  1773. }
  1774. /**
  1775. * Converts `iterator` to an array.
  1776. *
  1777. * @private
  1778. * @param {Object} iterator The iterator to convert.
  1779. * @returns {Array} Returns the converted array.
  1780. */
  1781. function iteratorToArray(iterator) {
  1782. var data,
  1783. result = [];
  1784. while (!(data = iterator.next()).done) {
  1785. result.push(data.value);
  1786. }
  1787. return result;
  1788. }
  1789. /**
  1790. * Converts `map` to its key-value pairs.
  1791. *
  1792. * @private
  1793. * @param {Object} map The map to convert.
  1794. * @returns {Array} Returns the key-value pairs.
  1795. */
  1796. function mapToArray(map) {
  1797. var index = -1,
  1798. result = Array(map.size);
  1799. map.forEach(function(value, key) {
  1800. result[++index] = [key, value];
  1801. });
  1802. return result;
  1803. }
  1804. /**
  1805. * Creates a unary function that invokes `func` with its argument transformed.
  1806. *
  1807. * @private
  1808. * @param {Function} func The function to wrap.
  1809. * @param {Function} transform The argument transform.
  1810. * @returns {Function} Returns the new function.
  1811. */
  1812. function overArg(func, transform) {
  1813. return function(arg) {
  1814. return func(transform(arg));
  1815. };
  1816. }
  1817. /**
  1818. * Replaces all `placeholder` elements in `array` with an internal placeholder
  1819. * and returns an array of their indexes.
  1820. *
  1821. * @private
  1822. * @param {Array} array The array to modify.
  1823. * @param {*} placeholder The placeholder to replace.
  1824. * @returns {Array} Returns the new array of placeholder indexes.
  1825. */
  1826. function replaceHolders(array, placeholder) {
  1827. var index = -1,
  1828. length = array.length,
  1829. resIndex = 0,
  1830. result = [];
  1831. while (++index < length) {
  1832. var value = array[index];
  1833. if (value === placeholder || value === PLACEHOLDER) {
  1834. array[index] = PLACEHOLDER;
  1835. result[resIndex++] = index;
  1836. }
  1837. }
  1838. return result;
  1839. }
  1840. /**
  1841. * Converts `set` to an array of its values.
  1842. *
  1843. * @private
  1844. * @param {Object} set The set to convert.
  1845. * @returns {Array} Returns the values.
  1846. */
  1847. function setToArray(set) {
  1848. var index = -1,
  1849. result = Array(set.size);
  1850. set.forEach(function(value) {
  1851. result[++index] = value;
  1852. });
  1853. return result;
  1854. }
  1855. /**
  1856. * Converts `set` to its value-value pairs.
  1857. *
  1858. * @private
  1859. * @param {Object} set The set to convert.
  1860. * @returns {Array} Returns the value-value pairs.
  1861. */
  1862. function setToPairs(set) {
  1863. var index = -1,
  1864. result = Array(set.size);
  1865. set.forEach(function(value) {
  1866. result[++index] = [value, value];
  1867. });
  1868. return result;
  1869. }
  1870. /**
  1871. * A specialized version of `_.indexOf` which performs strict equality
  1872. * comparisons of values, i.e. `===`.
  1873. *
  1874. * @private
  1875. * @param {Array} array The array to inspect.
  1876. * @param {*} value The value to search for.
  1877. * @param {number} fromIndex The index to search from.
  1878. * @returns {number} Returns the index of the matched value, else `-1`.
  1879. */
  1880. function strictIndexOf(array, value, fromIndex) {
  1881. var index = fromIndex - 1,
  1882. length = array.length;
  1883. while (++index < length) {
  1884. if (array[index] === value) {
  1885. return index;
  1886. }
  1887. }
  1888. return -1;
  1889. }
  1890. /**
  1891. * A specialized version of `_.lastIndexOf` which performs strict equality
  1892. * comparisons of values, i.e. `===`.
  1893. *
  1894. * @private
  1895. * @param {Array} array The array to inspect.
  1896. * @param {*} value The value to search for.
  1897. * @param {number} fromIndex The index to search from.
  1898. * @returns {number} Returns the index of the matched value, else `-1`.
  1899. */
  1900. function strictLastIndexOf(array, value, fromIndex) {
  1901. var index = fromIndex + 1;
  1902. while (index--) {
  1903. if (array[index] === value) {
  1904. return index;
  1905. }
  1906. }
  1907. return index;
  1908. }
  1909. /**
  1910. * Gets the number of symbols in `string`.
  1911. *
  1912. * @private
  1913. * @param {string} string The string to inspect.
  1914. * @returns {number} Returns the string size.
  1915. */
  1916. function stringSize(string) {
  1917. return hasUnicode(string)
  1918. ? unicodeSize(string)
  1919. : asciiSize(string);
  1920. }
  1921. /**
  1922. * Converts `string` to an array.
  1923. *
  1924. * @private
  1925. * @param {string} string The string to convert.
  1926. * @returns {Array} Returns the converted array.
  1927. */
  1928. function stringToArray(string) {
  1929. return hasUnicode(string)
  1930. ? unicodeToArray(string)
  1931. : asciiToArray(string);
  1932. }
  1933. /**
  1934. * Used by `_.unescape` to convert HTML entities to characters.
  1935. *
  1936. * @private
  1937. * @param {string} chr The matched character to unescape.
  1938. * @returns {string} Returns the unescaped character.
  1939. */
  1940. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  1941. /**
  1942. * Gets the size of a Unicode `string`.
  1943. *
  1944. * @private
  1945. * @param {string} string The string inspect.
  1946. * @returns {number} Returns the string size.
  1947. */
  1948. function unicodeSize(string) {
  1949. var result = reUnicode.lastIndex = 0;
  1950. while (reUnicode.test(string)) {
  1951. ++result;
  1952. }
  1953. return result;
  1954. }
  1955. /**
  1956. * Converts a Unicode `string` to an array.
  1957. *
  1958. * @private
  1959. * @param {string} string The string to convert.
  1960. * @returns {Array} Returns the converted array.
  1961. */
  1962. function unicodeToArray(string) {
  1963. return string.match(reUnicode) || [];
  1964. }
  1965. /**
  1966. * Splits a Unicode `string` into an array of its words.
  1967. *
  1968. * @private
  1969. * @param {string} The string to inspect.
  1970. * @returns {Array} Returns the words of `string`.
  1971. */
  1972. function unicodeWords(string) {
  1973. return string.match(reUnicodeWord) || [];
  1974. }
  1975. /*--------------------------------------------------------------------------*/
  1976. /**
  1977. * Create a new pristine `lodash` function using the `context` object.
  1978. *
  1979. * @static
  1980. * @memberOf _
  1981. * @since 1.1.0
  1982. * @category Util
  1983. * @param {Object} [context=root] The context object.
  1984. * @returns {Function} Returns a new `lodash` function.
  1985. * @example
  1986. *
  1987. * _.mixin({ 'foo': _.constant('foo') });
  1988. *
  1989. * var lodash = _.runInContext();
  1990. * lodash.mixin({ 'bar': lodash.constant('bar') });
  1991. *
  1992. * _.isFunction(_.foo);
  1993. * // => true
  1994. * _.isFunction(_.bar);
  1995. * // => false
  1996. *
  1997. * lodash.isFunction(lodash.foo);
  1998. * // => false
  1999. * lodash.isFunction(lodash.bar);
  2000. * // => true
  2001. *
  2002. * // Create a suped-up `defer` in Node.js.
  2003. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2004. */
  2005. var runInContext = (function runInContext(context) {
  2006. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2007. /** Built-in constructor references. */
  2008. var Array = context.Array,
  2009. Date = context.Date,
  2010. Error = context.Error,
  2011. Function = context.Function,
  2012. Math = context.Math,
  2013. Object = context.Object,
  2014. RegExp = context.RegExp,
  2015. String = context.String,
  2016. TypeError = context.TypeError;
  2017. /** Used for built-in method references. */
  2018. var arrayProto = Array.prototype,
  2019. funcProto = Function.prototype,
  2020. objectProto = Object.prototype;
  2021. /** Used to detect overreaching core-js shims. */
  2022. var coreJsData = context['__core-js_shared__'];
  2023. /** Used to resolve the decompiled source of functions. */
  2024. var funcToString = funcProto.toString;
  2025. /** Used to check objects for own properties. */
  2026. var hasOwnProperty = objectProto.hasOwnProperty;
  2027. /** Used to generate unique IDs. */
  2028. var idCounter = 0;
  2029. /** Used to detect methods masquerading as native. */
  2030. var maskSrcKey = (function() {
  2031. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2032. return uid ? ('Symbol(src)_1.' + uid) : '';
  2033. }());
  2034. /**
  2035. * Used to resolve the
  2036. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2037. * of values.
  2038. */
  2039. var nativeObjectToString = objectProto.toString;
  2040. /** Used to infer the `Object` constructor. */
  2041. var objectCtorString = funcToString.call(Object);
  2042. /** Used to restore the original `_` reference in `_.noConflict`. */
  2043. var oldDash = root._;
  2044. /** Used to detect if a method is native. */
  2045. var reIsNative = RegExp('^' +
  2046. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2047. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2048. );
  2049. /** Built-in value references. */
  2050. var Buffer = moduleExports ? context.Buffer : undefined,
  2051. Symbol = context.Symbol,
  2052. Uint8Array = context.Uint8Array,
  2053. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2054. getPrototype = overArg(Object.getPrototypeOf, Object),
  2055. objectCreate = Object.create,
  2056. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2057. splice = arrayProto.splice,
  2058. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2059. symIterator = Symbol ? Symbol.iterator : undefined,
  2060. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2061. var defineProperty = (function() {
  2062. try {
  2063. var func = getNative(Object, 'defineProperty');
  2064. func({}, '', {});
  2065. return func;
  2066. } catch (e) {}
  2067. }());
  2068. /** Mocked built-ins. */
  2069. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2070. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2071. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2072. /* Built-in method references for those with the same name as other `lodash` methods. */
  2073. var nativeCeil = Math.ceil,
  2074. nativeFloor = Math.floor,
  2075. nativeGetSymbols = Object.getOwnPropertySymbols,
  2076. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2077. nativeIsFinite = context.isFinite,
  2078. nativeJoin = arrayProto.join,
  2079. nativeKeys = overArg(Object.keys, Object),
  2080. nativeMax = Math.max,
  2081. nativeMin = Math.min,
  2082. nativeNow = Date.now,
  2083. nativeParseInt = context.parseInt,
  2084. nativeRandom = Math.random,
  2085. nativeReverse = arrayProto.reverse;
  2086. /* Built-in method references that are verified to be native. */
  2087. var DataView = getNative(context, 'DataView'),
  2088. Map = getNative(context, 'Map'),
  2089. Promise = getNative(context, 'Promise'),
  2090. Set = getNative(context, 'Set'),
  2091. WeakMap = getNative(context, 'WeakMap'),
  2092. nativeCreate = getNative(Object, 'create');
  2093. /** Used to store function metadata. */
  2094. var metaMap = WeakMap && new WeakMap;
  2095. /** Used to lookup unminified function names. */
  2096. var realNames = {};
  2097. /** Used to detect maps, sets, and weakmaps. */
  2098. var dataViewCtorString = toSource(DataView),
  2099. mapCtorString = toSource(Map),
  2100. promiseCtorString = toSource(Promise),
  2101. setCtorString = toSource(Set),
  2102. weakMapCtorString = toSource(WeakMap);
  2103. /** Used to convert symbols to primitives and strings. */
  2104. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2105. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2106. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2107. /*------------------------------------------------------------------------*/
  2108. /**
  2109. * Creates a `lodash` object which wraps `value` to enable implicit method
  2110. * chain sequences. Methods that operate on and return arrays, collections,
  2111. * and functions can be chained together. Methods that retrieve a single value
  2112. * or may return a primitive value will automatically end the chain sequence
  2113. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2114. * with `_#value`.
  2115. *
  2116. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2117. * enabled using `_.chain`.
  2118. *
  2119. * The execution of chained methods is lazy, that is, it's deferred until
  2120. * `_#value` is implicitly or explicitly called.
  2121. *
  2122. * Lazy evaluation allows several methods to support shortcut fusion.
  2123. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2124. * the creation of intermediate arrays and can greatly reduce the number of
  2125. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2126. * fusion if the section is applied to an array and iteratees accept only
  2127. * one argument. The heuristic for whether a section qualifies for shortcut
  2128. * fusion is subject to change.
  2129. *
  2130. * Chaining is supported in custom builds as long as the `_#value` method is
  2131. * directly or indirectly included in the build.
  2132. *
  2133. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2134. *
  2135. * The wrapper `Array` methods are:
  2136. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2137. *
  2138. * The wrapper `String` methods are:
  2139. * `replace` and `split`
  2140. *
  2141. * The wrapper methods that support shortcut fusion are:
  2142. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2143. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2144. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2145. *
  2146. * The chainable wrapper methods are:
  2147. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2148. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2149. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2150. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2151. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2152. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2153. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2154. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2155. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2156. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2157. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2158. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2159. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2160. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2161. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2162. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2163. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2164. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2165. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2166. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2167. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2168. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2169. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2170. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2171. *
  2172. * The wrapper methods that are **not** chainable by default are:
  2173. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2174. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2175. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2176. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2177. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2178. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2179. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2180. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2181. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2182. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2183. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2184. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2185. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2186. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2187. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2188. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2189. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2190. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2191. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2192. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2193. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2194. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2195. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2196. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2197. * `upperFirst`, `value`, and `words`
  2198. *
  2199. * @name _
  2200. * @constructor
  2201. * @category Seq
  2202. * @param {*} value The value to wrap in a `lodash` instance.
  2203. * @returns {Object} Returns the new `lodash` wrapper instance.
  2204. * @example
  2205. *
  2206. * function square(n) {
  2207. * return n * n;
  2208. * }
  2209. *
  2210. * var wrapped = _([1, 2, 3]);
  2211. *
  2212. * // Returns an unwrapped value.
  2213. * wrapped.reduce(_.add);
  2214. * // => 6
  2215. *
  2216. * // Returns a wrapped value.
  2217. * var squares = wrapped.map(square);
  2218. *
  2219. * _.isArray(squares);
  2220. * // => false
  2221. *
  2222. * _.isArray(squares.value());
  2223. * // => true
  2224. */
  2225. function lodash(value) {
  2226. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2227. if (value instanceof LodashWrapper) {
  2228. return value;
  2229. }
  2230. if (hasOwnProperty.call(value, '__wrapped__')) {
  2231. return wrapperClone(value);
  2232. }
  2233. }
  2234. return new LodashWrapper(value);
  2235. }
  2236. /**
  2237. * The base implementation of `_.create` without support for assigning
  2238. * properties to the created object.
  2239. *
  2240. * @private
  2241. * @param {Object} proto The object to inherit from.
  2242. * @returns {Object} Returns the new object.
  2243. */
  2244. var baseCreate = (function() {
  2245. function object() {}
  2246. return function(proto) {
  2247. if (!isObject(proto)) {
  2248. return {};
  2249. }
  2250. if (objectCreate) {
  2251. return objectCreate(proto);
  2252. }
  2253. object.prototype = proto;
  2254. var result = new object;
  2255. object.prototype = undefined;
  2256. return result;
  2257. };
  2258. }());
  2259. /**
  2260. * The function whose prototype chain sequence wrappers inherit from.
  2261. *
  2262. * @private
  2263. */
  2264. function baseLodash() {
  2265. // No operation performed.
  2266. }
  2267. /**
  2268. * The base constructor for creating `lodash` wrapper objects.
  2269. *
  2270. * @private
  2271. * @param {*} value The value to wrap.
  2272. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2273. */
  2274. function LodashWrapper(value, chainAll) {
  2275. this.__wrapped__ = value;
  2276. this.__actions__ = [];
  2277. this.__chain__ = !!chainAll;
  2278. this.__index__ = 0;
  2279. this.__values__ = undefined;
  2280. }
  2281. /**
  2282. * By default, the template delimiters used by lodash are like those in
  2283. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2284. * following template settings to use alternative delimiters.
  2285. *
  2286. * @static
  2287. * @memberOf _
  2288. * @type {Object}
  2289. */
  2290. lodash.templateSettings = {
  2291. /**
  2292. * Used to detect `data` property values to be HTML-escaped.
  2293. *
  2294. * @memberOf _.templateSettings
  2295. * @type {RegExp}
  2296. */
  2297. 'escape': reEscape,
  2298. /**
  2299. * Used to detect code to be evaluated.
  2300. *
  2301. * @memberOf _.templateSettings
  2302. * @type {RegExp}
  2303. */
  2304. 'evaluate': reEvaluate,
  2305. /**
  2306. * Used to detect `data` property values to inject.
  2307. *
  2308. * @memberOf _.templateSettings
  2309. * @type {RegExp}
  2310. */
  2311. 'interpolate': reInterpolate,
  2312. /**
  2313. * Used to reference the data object in the template text.
  2314. *
  2315. * @memberOf _.templateSettings
  2316. * @type {string}
  2317. */
  2318. 'variable': '',
  2319. /**
  2320. * Used to import variables into the compiled template.
  2321. *
  2322. * @memberOf _.templateSettings
  2323. * @type {Object}
  2324. */
  2325. 'imports': {
  2326. /**
  2327. * A reference to the `lodash` function.
  2328. *
  2329. * @memberOf _.templateSettings.imports
  2330. * @type {Function}
  2331. */
  2332. '_': lodash
  2333. }
  2334. };
  2335. // Ensure wrappers are instances of `baseLodash`.
  2336. lodash.prototype = baseLodash.prototype;
  2337. lodash.prototype.constructor = lodash;
  2338. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2339. LodashWrapper.prototype.constructor = LodashWrapper;
  2340. /*------------------------------------------------------------------------*/
  2341. /**
  2342. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2343. *
  2344. * @private
  2345. * @constructor
  2346. * @param {*} value The value to wrap.
  2347. */
  2348. function LazyWrapper(value) {
  2349. this.__wrapped__ = value;
  2350. this.__actions__ = [];
  2351. this.__dir__ = 1;
  2352. this.__filtered__ = false;
  2353. this.__iteratees__ = [];
  2354. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2355. this.__views__ = [];
  2356. }
  2357. /**
  2358. * Creates a clone of the lazy wrapper object.
  2359. *
  2360. * @private
  2361. * @name clone
  2362. * @memberOf LazyWrapper
  2363. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2364. */
  2365. function lazyClone() {
  2366. var result = new LazyWrapper(this.__wrapped__);
  2367. result.__actions__ = copyArray(this.__actions__);
  2368. result.__dir__ = this.__dir__;
  2369. result.__filtered__ = this.__filtered__;
  2370. result.__iteratees__ = copyArray(this.__iteratees__);
  2371. result.__takeCount__ = this.__takeCount__;
  2372. result.__views__ = copyArray(this.__views__);
  2373. return result;
  2374. }
  2375. /**
  2376. * Reverses the direction of lazy iteration.
  2377. *
  2378. * @private
  2379. * @name reverse
  2380. * @memberOf LazyWrapper
  2381. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2382. */
  2383. function lazyReverse() {
  2384. if (this.__filtered__) {
  2385. var result = new LazyWrapper(this);
  2386. result.__dir__ = -1;
  2387. result.__filtered__ = true;
  2388. } else {
  2389. result = this.clone();
  2390. result.__dir__ *= -1;
  2391. }
  2392. return result;
  2393. }
  2394. /**
  2395. * Extracts the unwrapped value from its lazy wrapper.
  2396. *
  2397. * @private
  2398. * @name value
  2399. * @memberOf LazyWrapper
  2400. * @returns {*} Returns the unwrapped value.
  2401. */
  2402. function lazyValue() {
  2403. var array = this.__wrapped__.value(),
  2404. dir = this.__dir__,
  2405. isArr = isArray(array),
  2406. isRight = dir < 0,
  2407. arrLength = isArr ? array.length : 0,
  2408. view = getView(0, arrLength, this.__views__),
  2409. start = view.start,
  2410. end = view.end,
  2411. length = end - start,
  2412. index = isRight ? end : (start - 1),
  2413. iteratees = this.__iteratees__,
  2414. iterLength = iteratees.length,
  2415. resIndex = 0,
  2416. takeCount = nativeMin(length, this.__takeCount__);
  2417. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  2418. return baseWrapperValue(array, this.__actions__);
  2419. }
  2420. var result = [];
  2421. outer:
  2422. while (length-- && resIndex < takeCount) {
  2423. index += dir;
  2424. var iterIndex = -1,
  2425. value = array[index];
  2426. while (++iterIndex < iterLength) {
  2427. var data = iteratees[iterIndex],
  2428. iteratee = data.iteratee,
  2429. type = data.type,
  2430. computed = iteratee(value);
  2431. if (type == LAZY_MAP_FLAG) {
  2432. value = computed;
  2433. } else if (!computed) {
  2434. if (type == LAZY_FILTER_FLAG) {
  2435. continue outer;
  2436. } else {
  2437. break outer;
  2438. }
  2439. }
  2440. }
  2441. result[resIndex++] = value;
  2442. }
  2443. return result;
  2444. }
  2445. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  2446. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  2447. LazyWrapper.prototype.constructor = LazyWrapper;
  2448. /*------------------------------------------------------------------------*/
  2449. /**
  2450. * Creates a hash object.
  2451. *
  2452. * @private
  2453. * @constructor
  2454. * @param {Array} [entries] The key-value pairs to cache.
  2455. */
  2456. function Hash(entries) {
  2457. var index = -1,
  2458. length = entries == null ? 0 : entries.length;
  2459. this.clear();
  2460. while (++index < length) {
  2461. var entry = entries[index];
  2462. this.set(entry[0], entry[1]);
  2463. }
  2464. }
  2465. /**
  2466. * Removes all key-value entries from the hash.
  2467. *
  2468. * @private
  2469. * @name clear
  2470. * @memberOf Hash
  2471. */
  2472. function hashClear() {
  2473. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2474. this.size = 0;
  2475. }
  2476. /**
  2477. * Removes `key` and its value from the hash.
  2478. *
  2479. * @private
  2480. * @name delete
  2481. * @memberOf Hash
  2482. * @param {Object} hash The hash to modify.
  2483. * @param {string} key The key of the value to remove.
  2484. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2485. */
  2486. function hashDelete(key) {
  2487. var result = this.has(key) && delete this.__data__[key];
  2488. this.size -= result ? 1 : 0;
  2489. return result;
  2490. }
  2491. /**
  2492. * Gets the hash value for `key`.
  2493. *
  2494. * @private
  2495. * @name get
  2496. * @memberOf Hash
  2497. * @param {string} key The key of the value to get.
  2498. * @returns {*} Returns the entry value.
  2499. */
  2500. function hashGet(key) {
  2501. var data = this.__data__;
  2502. if (nativeCreate) {
  2503. var result = data[key];
  2504. return result === HASH_UNDEFINED ? undefined : result;
  2505. }
  2506. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2507. }
  2508. /**
  2509. * Checks if a hash value for `key` exists.
  2510. *
  2511. * @private
  2512. * @name has
  2513. * @memberOf Hash
  2514. * @param {string} key The key of the entry to check.
  2515. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2516. */
  2517. function hashHas(key) {
  2518. var data = this.__data__;
  2519. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  2520. }
  2521. /**
  2522. * Sets the hash `key` to `value`.
  2523. *
  2524. * @private
  2525. * @name set
  2526. * @memberOf Hash
  2527. * @param {string} key The key of the value to set.
  2528. * @param {*} value The value to set.
  2529. * @returns {Object} Returns the hash instance.
  2530. */
  2531. function hashSet(key, value) {
  2532. var data = this.__data__;
  2533. this.size += this.has(key) ? 0 : 1;
  2534. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2535. return this;
  2536. }
  2537. // Add methods to `Hash`.
  2538. Hash.prototype.clear = hashClear;
  2539. Hash.prototype['delete'] = hashDelete;
  2540. Hash.prototype.get = hashGet;
  2541. Hash.prototype.has = hashHas;
  2542. Hash.prototype.set = hashSet;
  2543. /*------------------------------------------------------------------------*/
  2544. /**
  2545. * Creates an list cache object.
  2546. *
  2547. * @private
  2548. * @constructor
  2549. * @param {Array} [entries] The key-value pairs to cache.
  2550. */
  2551. function ListCache(entries) {
  2552. var index = -1,
  2553. length = entries == null ? 0 : entries.length;
  2554. this.clear();
  2555. while (++index < length) {
  2556. var entry = entries[index];
  2557. this.set(entry[0], entry[1]);
  2558. }
  2559. }
  2560. /**
  2561. * Removes all key-value entries from the list cache.
  2562. *
  2563. * @private
  2564. * @name clear
  2565. * @memberOf ListCache
  2566. */
  2567. function listCacheClear() {
  2568. this.__data__ = [];
  2569. this.size = 0;
  2570. }
  2571. /**
  2572. * Removes `key` and its value from the list cache.
  2573. *
  2574. * @private
  2575. * @name delete
  2576. * @memberOf ListCache
  2577. * @param {string} key The key of the value to remove.
  2578. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2579. */
  2580. function listCacheDelete(key) {
  2581. var data = this.__data__,
  2582. index = assocIndexOf(data, key);
  2583. if (index < 0) {
  2584. return false;
  2585. }
  2586. var lastIndex = data.length - 1;
  2587. if (index == lastIndex) {
  2588. data.pop();
  2589. } else {
  2590. splice.call(data, index, 1);
  2591. }
  2592. --this.size;
  2593. return true;
  2594. }
  2595. /**
  2596. * Gets the list cache value for `key`.
  2597. *
  2598. * @private
  2599. * @name get
  2600. * @memberOf ListCache
  2601. * @param {string} key The key of the value to get.
  2602. * @returns {*} Returns the entry value.
  2603. */
  2604. function listCacheGet(key) {
  2605. var data = this.__data__,
  2606. index = assocIndexOf(data, key);
  2607. return index < 0 ? undefined : data[index][1];
  2608. }
  2609. /**
  2610. * Checks if a list cache value for `key` exists.
  2611. *
  2612. * @private
  2613. * @name has
  2614. * @memberOf ListCache
  2615. * @param {string} key The key of the entry to check.
  2616. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2617. */
  2618. function listCacheHas(key) {
  2619. return assocIndexOf(this.__data__, key) > -1;
  2620. }
  2621. /**
  2622. * Sets the list cache `key` to `value`.
  2623. *
  2624. * @private
  2625. * @name set
  2626. * @memberOf ListCache
  2627. * @param {string} key The key of the value to set.
  2628. * @param {*} value The value to set.
  2629. * @returns {Object} Returns the list cache instance.
  2630. */
  2631. function listCacheSet(key, value) {
  2632. var data = this.__data__,
  2633. index = assocIndexOf(data, key);
  2634. if (index < 0) {
  2635. ++this.size;
  2636. data.push([key, value]);
  2637. } else {
  2638. data[index][1] = value;
  2639. }
  2640. return this;
  2641. }
  2642. // Add methods to `ListCache`.
  2643. ListCache.prototype.clear = listCacheClear;
  2644. ListCache.prototype['delete'] = listCacheDelete;
  2645. ListCache.prototype.get = listCacheGet;
  2646. ListCache.prototype.has = listCacheHas;
  2647. ListCache.prototype.set = listCacheSet;
  2648. /*------------------------------------------------------------------------*/
  2649. /**
  2650. * Creates a map cache object to store key-value pairs.
  2651. *
  2652. * @private
  2653. * @constructor
  2654. * @param {Array} [entries] The key-value pairs to cache.
  2655. */
  2656. function MapCache(entries) {
  2657. var index = -1,
  2658. length = entries == null ? 0 : entries.length;
  2659. this.clear();
  2660. while (++index < length) {
  2661. var entry = entries[index];
  2662. this.set(entry[0], entry[1]);
  2663. }
  2664. }
  2665. /**
  2666. * Removes all key-value entries from the map.
  2667. *
  2668. * @private
  2669. * @name clear
  2670. * @memberOf MapCache
  2671. */
  2672. function mapCacheClear() {
  2673. this.size = 0;
  2674. this.__data__ = {
  2675. 'hash': new Hash,
  2676. 'map': new (Map || ListCache),
  2677. 'string': new Hash
  2678. };
  2679. }
  2680. /**
  2681. * Removes `key` and its value from the map.
  2682. *
  2683. * @private
  2684. * @name delete
  2685. * @memberOf MapCache
  2686. * @param {string} key The key of the value to remove.
  2687. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2688. */
  2689. function mapCacheDelete(key) {
  2690. var result = getMapData(this, key)['delete'](key);
  2691. this.size -= result ? 1 : 0;
  2692. return result;
  2693. }
  2694. /**
  2695. * Gets the map value for `key`.
  2696. *
  2697. * @private
  2698. * @name get
  2699. * @memberOf MapCache
  2700. * @param {string} key The key of the value to get.
  2701. * @returns {*} Returns the entry value.
  2702. */
  2703. function mapCacheGet(key) {
  2704. return getMapData(this, key).get(key);
  2705. }
  2706. /**
  2707. * Checks if a map value for `key` exists.
  2708. *
  2709. * @private
  2710. * @name has
  2711. * @memberOf MapCache
  2712. * @param {string} key The key of the entry to check.
  2713. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2714. */
  2715. function mapCacheHas(key) {
  2716. return getMapData(this, key).has(key);
  2717. }
  2718. /**
  2719. * Sets the map `key` to `value`.
  2720. *
  2721. * @private
  2722. * @name set
  2723. * @memberOf MapCache
  2724. * @param {string} key The key of the value to set.
  2725. * @param {*} value The value to set.
  2726. * @returns {Object} Returns the map cache instance.
  2727. */
  2728. function mapCacheSet(key, value) {
  2729. var data = getMapData(this, key),
  2730. size = data.size;
  2731. data.set(key, value);
  2732. this.size += data.size == size ? 0 : 1;
  2733. return this;
  2734. }
  2735. // Add methods to `MapCache`.
  2736. MapCache.prototype.clear = mapCacheClear;
  2737. MapCache.prototype['delete'] = mapCacheDelete;
  2738. MapCache.prototype.get = mapCacheGet;
  2739. MapCache.prototype.has = mapCacheHas;
  2740. MapCache.prototype.set = mapCacheSet;
  2741. /*------------------------------------------------------------------------*/
  2742. /**
  2743. *
  2744. * Creates an array cache object to store unique values.
  2745. *
  2746. * @private
  2747. * @constructor
  2748. * @param {Array} [values] The values to cache.
  2749. */
  2750. function SetCache(values) {
  2751. var index = -1,
  2752. length = values == null ? 0 : values.length;
  2753. this.__data__ = new MapCache;
  2754. while (++index < length) {
  2755. this.add(values[index]);
  2756. }
  2757. }
  2758. /**
  2759. * Adds `value` to the array cache.
  2760. *
  2761. * @private
  2762. * @name add
  2763. * @memberOf SetCache
  2764. * @alias push
  2765. * @param {*} value The value to cache.
  2766. * @returns {Object} Returns the cache instance.
  2767. */
  2768. function setCacheAdd(value) {
  2769. this.__data__.set(value, HASH_UNDEFINED);
  2770. return this;
  2771. }
  2772. /**
  2773. * Checks if `value` is in the array cache.
  2774. *
  2775. * @private
  2776. * @name has
  2777. * @memberOf SetCache
  2778. * @param {*} value The value to search for.
  2779. * @returns {number} Returns `true` if `value` is found, else `false`.
  2780. */
  2781. function setCacheHas(value) {
  2782. return this.__data__.has(value);
  2783. }
  2784. // Add methods to `SetCache`.
  2785. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2786. SetCache.prototype.has = setCacheHas;
  2787. /*------------------------------------------------------------------------*/
  2788. /**
  2789. * Creates a stack cache object to store key-value pairs.
  2790. *
  2791. * @private
  2792. * @constructor
  2793. * @param {Array} [entries] The key-value pairs to cache.
  2794. */
  2795. function Stack(entries) {
  2796. var data = this.__data__ = new ListCache(entries);
  2797. this.size = data.size;
  2798. }
  2799. /**
  2800. * Removes all key-value entries from the stack.
  2801. *
  2802. * @private
  2803. * @name clear
  2804. * @memberOf Stack
  2805. */
  2806. function stackClear() {
  2807. this.__data__ = new ListCache;
  2808. this.size = 0;
  2809. }
  2810. /**
  2811. * Removes `key` and its value from the stack.
  2812. *
  2813. * @private
  2814. * @name delete
  2815. * @memberOf Stack
  2816. * @param {string} key The key of the value to remove.
  2817. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2818. */
  2819. function stackDelete(key) {
  2820. var data = this.__data__,
  2821. result = data['delete'](key);
  2822. this.size = data.size;
  2823. return result;
  2824. }
  2825. /**
  2826. * Gets the stack value for `key`.
  2827. *
  2828. * @private
  2829. * @name get
  2830. * @memberOf Stack
  2831. * @param {string} key The key of the value to get.
  2832. * @returns {*} Returns the entry value.
  2833. */
  2834. function stackGet(key) {
  2835. return this.__data__.get(key);
  2836. }
  2837. /**
  2838. * Checks if a stack value for `key` exists.
  2839. *
  2840. * @private
  2841. * @name has
  2842. * @memberOf Stack
  2843. * @param {string} key The key of the entry to check.
  2844. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2845. */
  2846. function stackHas(key) {
  2847. return this.__data__.has(key);
  2848. }
  2849. /**
  2850. * Sets the stack `key` to `value`.
  2851. *
  2852. * @private
  2853. * @name set
  2854. * @memberOf Stack
  2855. * @param {string} key The key of the value to set.
  2856. * @param {*} value The value to set.
  2857. * @returns {Object} Returns the stack cache instance.
  2858. */
  2859. function stackSet(key, value) {
  2860. var data = this.__data__;
  2861. if (data instanceof ListCache) {
  2862. var pairs = data.__data__;
  2863. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  2864. pairs.push([key, value]);
  2865. this.size = ++data.size;
  2866. return this;
  2867. }
  2868. data = this.__data__ = new MapCache(pairs);
  2869. }
  2870. data.set(key, value);
  2871. this.size = data.size;
  2872. return this;
  2873. }
  2874. // Add methods to `Stack`.
  2875. Stack.prototype.clear = stackClear;
  2876. Stack.prototype['delete'] = stackDelete;
  2877. Stack.prototype.get = stackGet;
  2878. Stack.prototype.has = stackHas;
  2879. Stack.prototype.set = stackSet;
  2880. /*------------------------------------------------------------------------*/
  2881. /**
  2882. * Creates an array of the enumerable property names of the array-like `value`.
  2883. *
  2884. * @private
  2885. * @param {*} value The value to query.
  2886. * @param {boolean} inherited Specify returning inherited property names.
  2887. * @returns {Array} Returns the array of property names.
  2888. */
  2889. function arrayLikeKeys(value, inherited) {
  2890. var isArr = isArray(value),
  2891. isArg = !isArr && isArguments(value),
  2892. isBuff = !isArr && !isArg && isBuffer(value),
  2893. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  2894. skipIndexes = isArr || isArg || isBuff || isType,
  2895. result = skipIndexes ? baseTimes(value.length, String) : [],
  2896. length = result.length;
  2897. for (var key in value) {
  2898. if ((inherited || hasOwnProperty.call(value, key)) &&
  2899. !(skipIndexes && (
  2900. // Safari 9 has enumerable `arguments.length` in strict mode.
  2901. key == 'length' ||
  2902. // Node.js 0.10 has enumerable non-index properties on buffers.
  2903. (isBuff && (key == 'offset' || key == 'parent')) ||
  2904. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  2905. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  2906. // Skip index properties.
  2907. isIndex(key, length)
  2908. ))) {
  2909. result.push(key);
  2910. }
  2911. }
  2912. return result;
  2913. }
  2914. /**
  2915. * A specialized version of `_.sample` for arrays.
  2916. *
  2917. * @private
  2918. * @param {Array} array The array to sample.
  2919. * @returns {*} Returns the random element.
  2920. */
  2921. function arraySample(array) {
  2922. var length = array.length;
  2923. return length ? array[baseRandom(0, length - 1)] : undefined;
  2924. }
  2925. /**
  2926. * A specialized version of `_.sampleSize` for arrays.
  2927. *
  2928. * @private
  2929. * @param {Array} array The array to sample.
  2930. * @param {number} n The number of elements to sample.
  2931. * @returns {Array} Returns the random elements.
  2932. */
  2933. function arraySampleSize(array, n) {
  2934. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  2935. }
  2936. /**
  2937. * A specialized version of `_.shuffle` for arrays.
  2938. *
  2939. * @private
  2940. * @param {Array} array The array to shuffle.
  2941. * @returns {Array} Returns the new shuffled array.
  2942. */
  2943. function arrayShuffle(array) {
  2944. return shuffleSelf(copyArray(array));
  2945. }
  2946. /**
  2947. * This function is like `assignValue` except that it doesn't assign
  2948. * `undefined` values.
  2949. *
  2950. * @private
  2951. * @param {Object} object The object to modify.
  2952. * @param {string} key The key of the property to assign.
  2953. * @param {*} value The value to assign.
  2954. */
  2955. function assignMergeValue(object, key, value) {
  2956. if ((value !== undefined && !eq(object[key], value)) ||
  2957. (value === undefined && !(key in object))) {
  2958. baseAssignValue(object, key, value);
  2959. }
  2960. }
  2961. /**
  2962. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2963. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2964. * for equality comparisons.
  2965. *
  2966. * @private
  2967. * @param {Object} object The object to modify.
  2968. * @param {string} key The key of the property to assign.
  2969. * @param {*} value The value to assign.
  2970. */
  2971. function assignValue(object, key, value) {
  2972. var objValue = object[key];
  2973. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2974. (value === undefined && !(key in object))) {
  2975. baseAssignValue(object, key, value);
  2976. }
  2977. }
  2978. /**
  2979. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2980. *
  2981. * @private
  2982. * @param {Array} array The array to inspect.
  2983. * @param {*} key The key to search for.
  2984. * @returns {number} Returns the index of the matched value, else `-1`.
  2985. */
  2986. function assocIndexOf(array, key) {
  2987. var length = array.length;
  2988. while (length--) {
  2989. if (eq(array[length][0], key)) {
  2990. return length;
  2991. }
  2992. }
  2993. return -1;
  2994. }
  2995. /**
  2996. * Aggregates elements of `collection` on `accumulator` with keys transformed
  2997. * by `iteratee` and values set by `setter`.
  2998. *
  2999. * @private
  3000. * @param {Array|Object} collection The collection to iterate over.
  3001. * @param {Function} setter The function to set `accumulator` values.
  3002. * @param {Function} iteratee The iteratee to transform keys.
  3003. * @param {Object} accumulator The initial aggregated object.
  3004. * @returns {Function} Returns `accumulator`.
  3005. */
  3006. function baseAggregator(collection, setter, iteratee, accumulator) {
  3007. baseEach(collection, function(value, key, collection) {
  3008. setter(accumulator, value, iteratee(value), collection);
  3009. });
  3010. return accumulator;
  3011. }
  3012. /**
  3013. * The base implementation of `_.assign` without support for multiple sources
  3014. * or `customizer` functions.
  3015. *
  3016. * @private
  3017. * @param {Object} object The destination object.
  3018. * @param {Object} source The source object.
  3019. * @returns {Object} Returns `object`.
  3020. */
  3021. function baseAssign(object, source) {
  3022. return object && copyObject(source, keys(source), object);
  3023. }
  3024. /**
  3025. * The base implementation of `_.assignIn` without support for multiple sources
  3026. * or `customizer` functions.
  3027. *
  3028. * @private
  3029. * @param {Object} object The destination object.
  3030. * @param {Object} source The source object.
  3031. * @returns {Object} Returns `object`.
  3032. */
  3033. function baseAssignIn(object, source) {
  3034. return object && copyObject(source, keysIn(source), object);
  3035. }
  3036. /**
  3037. * The base implementation of `assignValue` and `assignMergeValue` without
  3038. * value checks.
  3039. *
  3040. * @private
  3041. * @param {Object} object The object to modify.
  3042. * @param {string} key The key of the property to assign.
  3043. * @param {*} value The value to assign.
  3044. */
  3045. function baseAssignValue(object, key, value) {
  3046. if (key == '__proto__' && defineProperty) {
  3047. defineProperty(object, key, {
  3048. 'configurable': true,
  3049. 'enumerable': true,
  3050. 'value': value,
  3051. 'writable': true
  3052. });
  3053. } else {
  3054. object[key] = value;
  3055. }
  3056. }
  3057. /**
  3058. * The base implementation of `_.at` without support for individual paths.
  3059. *
  3060. * @private
  3061. * @param {Object} object The object to iterate over.
  3062. * @param {string[]} paths The property paths to pick.
  3063. * @returns {Array} Returns the picked elements.
  3064. */
  3065. function baseAt(object, paths) {
  3066. var index = -1,
  3067. length = paths.length,
  3068. result = Array(length),
  3069. skip = object == null;
  3070. while (++index < length) {
  3071. result[index] = skip ? undefined : get(object, paths[index]);
  3072. }
  3073. return result;
  3074. }
  3075. /**
  3076. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3077. *
  3078. * @private
  3079. * @param {number} number The number to clamp.
  3080. * @param {number} [lower] The lower bound.
  3081. * @param {number} upper The upper bound.
  3082. * @returns {number} Returns the clamped number.
  3083. */
  3084. function baseClamp(number, lower, upper) {
  3085. if (number === number) {
  3086. if (upper !== undefined) {
  3087. number = number <= upper ? number : upper;
  3088. }
  3089. if (lower !== undefined) {
  3090. number = number >= lower ? number : lower;
  3091. }
  3092. }
  3093. return number;
  3094. }
  3095. /**
  3096. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3097. * traversed objects.
  3098. *
  3099. * @private
  3100. * @param {*} value The value to clone.
  3101. * @param {boolean} bitmask The bitmask flags.
  3102. * 1 - Deep clone
  3103. * 2 - Flatten inherited properties
  3104. * 4 - Clone symbols
  3105. * @param {Function} [customizer] The function to customize cloning.
  3106. * @param {string} [key] The key of `value`.
  3107. * @param {Object} [object] The parent object of `value`.
  3108. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3109. * @returns {*} Returns the cloned value.
  3110. */
  3111. function baseClone(value, bitmask, customizer, key, object, stack) {
  3112. var result,
  3113. isDeep = bitmask & CLONE_DEEP_FLAG,
  3114. isFlat = bitmask & CLONE_FLAT_FLAG,
  3115. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3116. if (customizer) {
  3117. result = object ? customizer(value, key, object, stack) : customizer(value);
  3118. }
  3119. if (result !== undefined) {
  3120. return result;
  3121. }
  3122. if (!isObject(value)) {
  3123. return value;
  3124. }
  3125. var isArr = isArray(value);
  3126. if (isArr) {
  3127. result = initCloneArray(value);
  3128. if (!isDeep) {
  3129. return copyArray(value, result);
  3130. }
  3131. } else {
  3132. var tag = getTag(value),
  3133. isFunc = tag == funcTag || tag == genTag;
  3134. if (isBuffer(value)) {
  3135. return cloneBuffer(value, isDeep);
  3136. }
  3137. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3138. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3139. if (!isDeep) {
  3140. return isFlat
  3141. ? copySymbolsIn(value, baseAssignIn(result, value))
  3142. : copySymbols(value, baseAssign(result, value));
  3143. }
  3144. } else {
  3145. if (!cloneableTags[tag]) {
  3146. return object ? value : {};
  3147. }
  3148. result = initCloneByTag(value, tag, baseClone, isDeep);
  3149. }
  3150. }
  3151. // Check for circular references and return its corresponding clone.
  3152. stack || (stack = new Stack);
  3153. var stacked = stack.get(value);
  3154. if (stacked) {
  3155. return stacked;
  3156. }
  3157. stack.set(value, result);
  3158. var keysFunc = isFull
  3159. ? (isFlat ? getAllKeysIn : getAllKeys)
  3160. : (isFlat ? keysIn : keys);
  3161. var props = isArr ? undefined : keysFunc(value);
  3162. arrayEach(props || value, function(subValue, key) {
  3163. if (props) {
  3164. key = subValue;
  3165. subValue = value[key];
  3166. }
  3167. // Recursively populate clone (susceptible to call stack limits).
  3168. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3169. });
  3170. return result;
  3171. }
  3172. /**
  3173. * The base implementation of `_.conforms` which doesn't clone `source`.
  3174. *
  3175. * @private
  3176. * @param {Object} source The object of property predicates to conform to.
  3177. * @returns {Function} Returns the new spec function.
  3178. */
  3179. function baseConforms(source) {
  3180. var props = keys(source);
  3181. return function(object) {
  3182. return baseConformsTo(object, source, props);
  3183. };
  3184. }
  3185. /**
  3186. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3187. *
  3188. * @private
  3189. * @param {Object} object The object to inspect.
  3190. * @param {Object} source The object of property predicates to conform to.
  3191. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3192. */
  3193. function baseConformsTo(object, source, props) {
  3194. var length = props.length;
  3195. if (object == null) {
  3196. return !length;
  3197. }
  3198. object = Object(object);
  3199. while (length--) {
  3200. var key = props[length],
  3201. predicate = source[key],
  3202. value = object[key];
  3203. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3204. return false;
  3205. }
  3206. }
  3207. return true;
  3208. }
  3209. /**
  3210. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3211. * to provide to `func`.
  3212. *
  3213. * @private
  3214. * @param {Function} func The function to delay.
  3215. * @param {number} wait The number of milliseconds to delay invocation.
  3216. * @param {Array} args The arguments to provide to `func`.
  3217. * @returns {number|Object} Returns the timer id or timeout object.
  3218. */
  3219. function baseDelay(func, wait, args) {
  3220. if (typeof func != 'function') {
  3221. throw new TypeError(FUNC_ERROR_TEXT);
  3222. }
  3223. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3224. }
  3225. /**
  3226. * The base implementation of methods like `_.difference` without support
  3227. * for excluding multiple arrays or iteratee shorthands.
  3228. *
  3229. * @private
  3230. * @param {Array} array The array to inspect.
  3231. * @param {Array} values The values to exclude.
  3232. * @param {Function} [iteratee] The iteratee invoked per element.
  3233. * @param {Function} [comparator] The comparator invoked per element.
  3234. * @returns {Array} Returns the new array of filtered values.
  3235. */
  3236. function baseDifference(array, values, iteratee, comparator) {
  3237. var index = -1,
  3238. includes = arrayIncludes,
  3239. isCommon = true,
  3240. length = array.length,
  3241. result = [],
  3242. valuesLength = values.length;
  3243. if (!length) {
  3244. return result;
  3245. }
  3246. if (iteratee) {
  3247. values = arrayMap(values, baseUnary(iteratee));
  3248. }
  3249. if (comparator) {
  3250. includes = arrayIncludesWith;
  3251. isCommon = false;
  3252. }
  3253. else if (values.length >= LARGE_ARRAY_SIZE) {
  3254. includes = cacheHas;
  3255. isCommon = false;
  3256. values = new SetCache(values);
  3257. }
  3258. outer:
  3259. while (++index < length) {
  3260. var value = array[index],
  3261. computed = iteratee == null ? value : iteratee(value);
  3262. value = (comparator || value !== 0) ? value : 0;
  3263. if (isCommon && computed === computed) {
  3264. var valuesIndex = valuesLength;
  3265. while (valuesIndex--) {
  3266. if (values[valuesIndex] === computed) {
  3267. continue outer;
  3268. }
  3269. }
  3270. result.push(value);
  3271. }
  3272. else if (!includes(values, computed, comparator)) {
  3273. result.push(value);
  3274. }
  3275. }
  3276. return result;
  3277. }
  3278. /**
  3279. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3280. *
  3281. * @private
  3282. * @param {Array|Object} collection The collection to iterate over.
  3283. * @param {Function} iteratee The function invoked per iteration.
  3284. * @returns {Array|Object} Returns `collection`.
  3285. */
  3286. var baseEach = createBaseEach(baseForOwn);
  3287. /**
  3288. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3289. *
  3290. * @private
  3291. * @param {Array|Object} collection The collection to iterate over.
  3292. * @param {Function} iteratee The function invoked per iteration.
  3293. * @returns {Array|Object} Returns `collection`.
  3294. */
  3295. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3296. /**
  3297. * The base implementation of `_.every` without support for iteratee shorthands.
  3298. *
  3299. * @private
  3300. * @param {Array|Object} collection The collection to iterate over.
  3301. * @param {Function} predicate The function invoked per iteration.
  3302. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3303. * else `false`
  3304. */
  3305. function baseEvery(collection, predicate) {
  3306. var result = true;
  3307. baseEach(collection, function(value, index, collection) {
  3308. result = !!predicate(value, index, collection);
  3309. return result;
  3310. });
  3311. return result;
  3312. }
  3313. /**
  3314. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3315. * `comparator` to determine the extremum value.
  3316. *
  3317. * @private
  3318. * @param {Array} array The array to iterate over.
  3319. * @param {Function} iteratee The iteratee invoked per iteration.
  3320. * @param {Function} comparator The comparator used to compare values.
  3321. * @returns {*} Returns the extremum value.
  3322. */
  3323. function baseExtremum(array, iteratee, comparator) {
  3324. var index = -1,
  3325. length = array.length;
  3326. while (++index < length) {
  3327. var value = array[index],
  3328. current = iteratee(value);
  3329. if (current != null && (computed === undefined
  3330. ? (current === current && !isSymbol(current))
  3331. : comparator(current, computed)
  3332. )) {
  3333. var computed = current,
  3334. result = value;
  3335. }
  3336. }
  3337. return result;
  3338. }
  3339. /**
  3340. * The base implementation of `_.fill` without an iteratee call guard.
  3341. *
  3342. * @private
  3343. * @param {Array} array The array to fill.
  3344. * @param {*} value The value to fill `array` with.
  3345. * @param {number} [start=0] The start position.
  3346. * @param {number} [end=array.length] The end position.
  3347. * @returns {Array} Returns `array`.
  3348. */
  3349. function baseFill(array, value, start, end) {
  3350. var length = array.length;
  3351. start = toInteger(start);
  3352. if (start < 0) {
  3353. start = -start > length ? 0 : (length + start);
  3354. }
  3355. end = (end === undefined || end > length) ? length : toInteger(end);
  3356. if (end < 0) {
  3357. end += length;
  3358. }
  3359. end = start > end ? 0 : toLength(end);
  3360. while (start < end) {
  3361. array[start++] = value;
  3362. }
  3363. return array;
  3364. }
  3365. /**
  3366. * The base implementation of `_.filter` without support for iteratee shorthands.
  3367. *
  3368. * @private
  3369. * @param {Array|Object} collection The collection to iterate over.
  3370. * @param {Function} predicate The function invoked per iteration.
  3371. * @returns {Array} Returns the new filtered array.
  3372. */
  3373. function baseFilter(collection, predicate) {
  3374. var result = [];
  3375. baseEach(collection, function(value, index, collection) {
  3376. if (predicate(value, index, collection)) {
  3377. result.push(value);
  3378. }
  3379. });
  3380. return result;
  3381. }
  3382. /**
  3383. * The base implementation of `_.flatten` with support for restricting flattening.
  3384. *
  3385. * @private
  3386. * @param {Array} array The array to flatten.
  3387. * @param {number} depth The maximum recursion depth.
  3388. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3389. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3390. * @param {Array} [result=[]] The initial result value.
  3391. * @returns {Array} Returns the new flattened array.
  3392. */
  3393. function baseFlatten(array, depth, predicate, isStrict, result) {
  3394. var index = -1,
  3395. length = array.length;
  3396. predicate || (predicate = isFlattenable);
  3397. result || (result = []);
  3398. while (++index < length) {
  3399. var value = array[index];
  3400. if (depth > 0 && predicate(value)) {
  3401. if (depth > 1) {
  3402. // Recursively flatten arrays (susceptible to call stack limits).
  3403. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3404. } else {
  3405. arrayPush(result, value);
  3406. }
  3407. } else if (!isStrict) {
  3408. result[result.length] = value;
  3409. }
  3410. }
  3411. return result;
  3412. }
  3413. /**
  3414. * The base implementation of `baseForOwn` which iterates over `object`
  3415. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  3416. * Iteratee functions may exit iteration early by explicitly returning `false`.
  3417. *
  3418. * @private
  3419. * @param {Object} object The object to iterate over.
  3420. * @param {Function} iteratee The function invoked per iteration.
  3421. * @param {Function} keysFunc The function to get the keys of `object`.
  3422. * @returns {Object} Returns `object`.
  3423. */
  3424. var baseFor = createBaseFor();
  3425. /**
  3426. * This function is like `baseFor` except that it iterates over properties
  3427. * in the opposite order.
  3428. *
  3429. * @private
  3430. * @param {Object} object The object to iterate over.
  3431. * @param {Function} iteratee The function invoked per iteration.
  3432. * @param {Function} keysFunc The function to get the keys of `object`.
  3433. * @returns {Object} Returns `object`.
  3434. */
  3435. var baseForRight = createBaseFor(true);
  3436. /**
  3437. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  3438. *
  3439. * @private
  3440. * @param {Object} object The object to iterate over.
  3441. * @param {Function} iteratee The function invoked per iteration.
  3442. * @returns {Object} Returns `object`.
  3443. */
  3444. function baseForOwn(object, iteratee) {
  3445. return object && baseFor(object, iteratee, keys);
  3446. }
  3447. /**
  3448. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  3449. *
  3450. * @private
  3451. * @param {Object} object The object to iterate over.
  3452. * @param {Function} iteratee The function invoked per iteration.
  3453. * @returns {Object} Returns `object`.
  3454. */
  3455. function baseForOwnRight(object, iteratee) {
  3456. return object && baseForRight(object, iteratee, keys);
  3457. }
  3458. /**
  3459. * The base implementation of `_.functions` which creates an array of
  3460. * `object` function property names filtered from `props`.
  3461. *
  3462. * @private
  3463. * @param {Object} object The object to inspect.
  3464. * @param {Array} props The property names to filter.
  3465. * @returns {Array} Returns the function names.
  3466. */
  3467. function baseFunctions(object, props) {
  3468. return arrayFilter(props, function(key) {
  3469. return isFunction(object[key]);
  3470. });
  3471. }
  3472. /**
  3473. * The base implementation of `_.get` without support for default values.
  3474. *
  3475. * @private
  3476. * @param {Object} object The object to query.
  3477. * @param {Array|string} path The path of the property to get.
  3478. * @returns {*} Returns the resolved value.
  3479. */
  3480. function baseGet(object, path) {
  3481. path = castPath(path, object);
  3482. var index = 0,
  3483. length = path.length;
  3484. while (object != null && index < length) {
  3485. object = object[toKey(path[index++])];
  3486. }
  3487. return (index && index == length) ? object : undefined;
  3488. }
  3489. /**
  3490. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3491. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3492. * symbols of `object`.
  3493. *
  3494. * @private
  3495. * @param {Object} object The object to query.
  3496. * @param {Function} keysFunc The function to get the keys of `object`.
  3497. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3498. * @returns {Array} Returns the array of property names and symbols.
  3499. */
  3500. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3501. var result = keysFunc(object);
  3502. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3503. }
  3504. /**
  3505. * The base implementation of `getTag` without fallbacks for buggy environments.
  3506. *
  3507. * @private
  3508. * @param {*} value The value to query.
  3509. * @returns {string} Returns the `toStringTag`.
  3510. */
  3511. function baseGetTag(value) {
  3512. if (value == null) {
  3513. return value === undefined ? undefinedTag : nullTag;
  3514. }
  3515. return (symToStringTag && symToStringTag in Object(value))
  3516. ? getRawTag(value)
  3517. : objectToString(value);
  3518. }
  3519. /**
  3520. * The base implementation of `_.gt` which doesn't coerce arguments.
  3521. *
  3522. * @private
  3523. * @param {*} value The value to compare.
  3524. * @param {*} other The other value to compare.
  3525. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  3526. * else `false`.
  3527. */
  3528. function baseGt(value, other) {
  3529. return value > other;
  3530. }
  3531. /**
  3532. * The base implementation of `_.has` without support for deep paths.
  3533. *
  3534. * @private
  3535. * @param {Object} [object] The object to query.
  3536. * @param {Array|string} key The key to check.
  3537. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3538. */
  3539. function baseHas(object, key) {
  3540. return object != null && hasOwnProperty.call(object, key);
  3541. }
  3542. /**
  3543. * The base implementation of `_.hasIn` without support for deep paths.
  3544. *
  3545. * @private
  3546. * @param {Object} [object] The object to query.
  3547. * @param {Array|string} key The key to check.
  3548. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3549. */
  3550. function baseHasIn(object, key) {
  3551. return object != null && key in Object(object);
  3552. }
  3553. /**
  3554. * The base implementation of `_.inRange` which doesn't coerce arguments.
  3555. *
  3556. * @private
  3557. * @param {number} number The number to check.
  3558. * @param {number} start The start of the range.
  3559. * @param {number} end The end of the range.
  3560. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  3561. */
  3562. function baseInRange(number, start, end) {
  3563. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  3564. }
  3565. /**
  3566. * The base implementation of methods like `_.intersection`, without support
  3567. * for iteratee shorthands, that accepts an array of arrays to inspect.
  3568. *
  3569. * @private
  3570. * @param {Array} arrays The arrays to inspect.
  3571. * @param {Function} [iteratee] The iteratee invoked per element.
  3572. * @param {Function} [comparator] The comparator invoked per element.
  3573. * @returns {Array} Returns the new array of shared values.
  3574. */
  3575. function baseIntersection(arrays, iteratee, comparator) {
  3576. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  3577. length = arrays[0].length,
  3578. othLength = arrays.length,
  3579. othIndex = othLength,
  3580. caches = Array(othLength),
  3581. maxLength = Infinity,
  3582. result = [];
  3583. while (othIndex--) {
  3584. var array = arrays[othIndex];
  3585. if (othIndex && iteratee) {
  3586. array = arrayMap(array, baseUnary(iteratee));
  3587. }
  3588. maxLength = nativeMin(array.length, maxLength);
  3589. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  3590. ? new SetCache(othIndex && array)
  3591. : undefined;
  3592. }
  3593. array = arrays[0];
  3594. var index = -1,
  3595. seen = caches[0];
  3596. outer:
  3597. while (++index < length && result.length < maxLength) {
  3598. var value = array[index],
  3599. computed = iteratee ? iteratee(value) : value;
  3600. value = (comparator || value !== 0) ? value : 0;
  3601. if (!(seen
  3602. ? cacheHas(seen, computed)
  3603. : includes(result, computed, comparator)
  3604. )) {
  3605. othIndex = othLength;
  3606. while (--othIndex) {
  3607. var cache = caches[othIndex];
  3608. if (!(cache
  3609. ? cacheHas(cache, computed)
  3610. : includes(arrays[othIndex], computed, comparator))
  3611. ) {
  3612. continue outer;
  3613. }
  3614. }
  3615. if (seen) {
  3616. seen.push(computed);
  3617. }
  3618. result.push(value);
  3619. }
  3620. }
  3621. return result;
  3622. }
  3623. /**
  3624. * The base implementation of `_.invert` and `_.invertBy` which inverts
  3625. * `object` with values transformed by `iteratee` and set by `setter`.
  3626. *
  3627. * @private
  3628. * @param {Object} object The object to iterate over.
  3629. * @param {Function} setter The function to set `accumulator` values.
  3630. * @param {Function} iteratee The iteratee to transform values.
  3631. * @param {Object} accumulator The initial inverted object.
  3632. * @returns {Function} Returns `accumulator`.
  3633. */
  3634. function baseInverter(object, setter, iteratee, accumulator) {
  3635. baseForOwn(object, function(value, key, object) {
  3636. setter(accumulator, iteratee(value), key, object);
  3637. });
  3638. return accumulator;
  3639. }
  3640. /**
  3641. * The base implementation of `_.invoke` without support for individual
  3642. * method arguments.
  3643. *
  3644. * @private
  3645. * @param {Object} object The object to query.
  3646. * @param {Array|string} path The path of the method to invoke.
  3647. * @param {Array} args The arguments to invoke the method with.
  3648. * @returns {*} Returns the result of the invoked method.
  3649. */
  3650. function baseInvoke(object, path, args) {
  3651. path = castPath(path, object);
  3652. object = parent(object, path);
  3653. var func = object == null ? object : object[toKey(last(path))];
  3654. return func == null ? undefined : apply(func, object, args);
  3655. }
  3656. /**
  3657. * The base implementation of `_.isArguments`.
  3658. *
  3659. * @private
  3660. * @param {*} value The value to check.
  3661. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3662. */
  3663. function baseIsArguments(value) {
  3664. return isObjectLike(value) && baseGetTag(value) == argsTag;
  3665. }
  3666. /**
  3667. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  3668. *
  3669. * @private
  3670. * @param {*} value The value to check.
  3671. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  3672. */
  3673. function baseIsArrayBuffer(value) {
  3674. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3675. }
  3676. /**
  3677. * The base implementation of `_.isDate` without Node.js optimizations.
  3678. *
  3679. * @private
  3680. * @param {*} value The value to check.
  3681. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  3682. */
  3683. function baseIsDate(value) {
  3684. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3685. }
  3686. /**
  3687. * The base implementation of `_.isEqual` which supports partial comparisons
  3688. * and tracks traversed objects.
  3689. *
  3690. * @private
  3691. * @param {*} value The value to compare.
  3692. * @param {*} other The other value to compare.
  3693. * @param {boolean} bitmask The bitmask flags.
  3694. * 1 - Unordered comparison
  3695. * 2 - Partial comparison
  3696. * @param {Function} [customizer] The function to customize comparisons.
  3697. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  3698. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3699. */
  3700. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3701. if (value === other) {
  3702. return true;
  3703. }
  3704. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  3705. return value !== value && other !== other;
  3706. }
  3707. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3708. }
  3709. /**
  3710. * A specialized version of `baseIsEqual` for arrays and objects which performs
  3711. * deep comparisons and tracks traversed objects enabling objects with circular
  3712. * references to be compared.
  3713. *
  3714. * @private
  3715. * @param {Object} object The object to compare.
  3716. * @param {Object} other The other object to compare.
  3717. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  3718. * @param {Function} customizer The function to customize comparisons.
  3719. * @param {Function} equalFunc The function to determine equivalents of values.
  3720. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  3721. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  3722. */
  3723. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3724. var objIsArr = isArray(object),
  3725. othIsArr = isArray(other),
  3726. objTag = objIsArr ? arrayTag : getTag(object),
  3727. othTag = othIsArr ? arrayTag : getTag(other);
  3728. objTag = objTag == argsTag ? objectTag : objTag;
  3729. othTag = othTag == argsTag ? objectTag : othTag;
  3730. var objIsObj = objTag == objectTag,
  3731. othIsObj = othTag == objectTag,
  3732. isSameTag = objTag == othTag;
  3733. if (isSameTag && isBuffer(object)) {
  3734. if (!isBuffer(other)) {
  3735. return false;
  3736. }
  3737. objIsArr = true;
  3738. objIsObj = false;
  3739. }
  3740. if (isSameTag && !objIsObj) {
  3741. stack || (stack = new Stack);
  3742. return (objIsArr || isTypedArray(object))
  3743. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  3744. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3745. }
  3746. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  3747. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  3748. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  3749. if (objIsWrapped || othIsWrapped) {
  3750. var objUnwrapped = objIsWrapped ? object.value() : object,
  3751. othUnwrapped = othIsWrapped ? other.value() : other;
  3752. stack || (stack = new Stack);
  3753. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3754. }
  3755. }
  3756. if (!isSameTag) {
  3757. return false;
  3758. }
  3759. stack || (stack = new Stack);
  3760. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3761. }
  3762. /**
  3763. * The base implementation of `_.isMap` without Node.js optimizations.
  3764. *
  3765. * @private
  3766. * @param {*} value The value to check.
  3767. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3768. */
  3769. function baseIsMap(value) {
  3770. return isObjectLike(value) && getTag(value) == mapTag;
  3771. }
  3772. /**
  3773. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  3774. *
  3775. * @private
  3776. * @param {Object} object The object to inspect.
  3777. * @param {Object} source The object of property values to match.
  3778. * @param {Array} matchData The property names, values, and compare flags to match.
  3779. * @param {Function} [customizer] The function to customize comparisons.
  3780. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  3781. */
  3782. function baseIsMatch(object, source, matchData, customizer) {
  3783. var index = matchData.length,
  3784. length = index,
  3785. noCustomizer = !customizer;
  3786. if (object == null) {
  3787. return !length;
  3788. }
  3789. object = Object(object);
  3790. while (index--) {
  3791. var data = matchData[index];
  3792. if ((noCustomizer && data[2])
  3793. ? data[1] !== object[data[0]]
  3794. : !(data[0] in object)
  3795. ) {
  3796. return false;
  3797. }
  3798. }
  3799. while (++index < length) {
  3800. data = matchData[index];
  3801. var key = data[0],
  3802. objValue = object[key],
  3803. srcValue = data[1];
  3804. if (noCustomizer && data[2]) {
  3805. if (objValue === undefined && !(key in object)) {
  3806. return false;
  3807. }
  3808. } else {
  3809. var stack = new Stack;
  3810. if (customizer) {
  3811. var result = customizer(objValue, srcValue, key, object, source, stack);
  3812. }
  3813. if (!(result === undefined
  3814. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  3815. : result
  3816. )) {
  3817. return false;
  3818. }
  3819. }
  3820. }
  3821. return true;
  3822. }
  3823. /**
  3824. * The base implementation of `_.isNative` without bad shim checks.
  3825. *
  3826. * @private
  3827. * @param {*} value The value to check.
  3828. * @returns {boolean} Returns `true` if `value` is a native function,
  3829. * else `false`.
  3830. */
  3831. function baseIsNative(value) {
  3832. if (!isObject(value) || isMasked(value)) {
  3833. return false;
  3834. }
  3835. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  3836. return pattern.test(toSource(value));
  3837. }
  3838. /**
  3839. * The base implementation of `_.isRegExp` without Node.js optimizations.
  3840. *
  3841. * @private
  3842. * @param {*} value The value to check.
  3843. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  3844. */
  3845. function baseIsRegExp(value) {
  3846. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  3847. }
  3848. /**
  3849. * The base implementation of `_.isSet` without Node.js optimizations.
  3850. *
  3851. * @private
  3852. * @param {*} value The value to check.
  3853. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  3854. */
  3855. function baseIsSet(value) {
  3856. return isObjectLike(value) && getTag(value) == setTag;
  3857. }
  3858. /**
  3859. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  3860. *
  3861. * @private
  3862. * @param {*} value The value to check.
  3863. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  3864. */
  3865. function baseIsTypedArray(value) {
  3866. return isObjectLike(value) &&
  3867. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  3868. }
  3869. /**
  3870. * The base implementation of `_.iteratee`.
  3871. *
  3872. * @private
  3873. * @param {*} [value=_.identity] The value to convert to an iteratee.
  3874. * @returns {Function} Returns the iteratee.
  3875. */
  3876. function baseIteratee(value) {
  3877. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  3878. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  3879. if (typeof value == 'function') {
  3880. return value;
  3881. }
  3882. if (value == null) {
  3883. return identity;
  3884. }
  3885. if (typeof value == 'object') {
  3886. return isArray(value)
  3887. ? baseMatchesProperty(value[0], value[1])
  3888. : baseMatches(value);
  3889. }
  3890. return property(value);
  3891. }
  3892. /**
  3893. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  3894. *
  3895. * @private
  3896. * @param {Object} object The object to query.
  3897. * @returns {Array} Returns the array of property names.
  3898. */
  3899. function baseKeys(object) {
  3900. if (!isPrototype(object)) {
  3901. return nativeKeys(object);
  3902. }
  3903. var result = [];
  3904. for (var key in Object(object)) {
  3905. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  3906. result.push(key);
  3907. }
  3908. }
  3909. return result;
  3910. }
  3911. /**
  3912. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  3913. *
  3914. * @private
  3915. * @param {Object} object The object to query.
  3916. * @returns {Array} Returns the array of property names.
  3917. */
  3918. function baseKeysIn(object) {
  3919. if (!isObject(object)) {
  3920. return nativeKeysIn(object);
  3921. }
  3922. var isProto = isPrototype(object),
  3923. result = [];
  3924. for (var key in object) {
  3925. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  3926. result.push(key);
  3927. }
  3928. }
  3929. return result;
  3930. }
  3931. /**
  3932. * The base implementation of `_.lt` which doesn't coerce arguments.
  3933. *
  3934. * @private
  3935. * @param {*} value The value to compare.
  3936. * @param {*} other The other value to compare.
  3937. * @returns {boolean} Returns `true` if `value` is less than `other`,
  3938. * else `false`.
  3939. */
  3940. function baseLt(value, other) {
  3941. return value < other;
  3942. }
  3943. /**
  3944. * The base implementation of `_.map` without support for iteratee shorthands.
  3945. *
  3946. * @private
  3947. * @param {Array|Object} collection The collection to iterate over.
  3948. * @param {Function} iteratee The function invoked per iteration.
  3949. * @returns {Array} Returns the new mapped array.
  3950. */
  3951. function baseMap(collection, iteratee) {
  3952. var index = -1,
  3953. result = isArrayLike(collection) ? Array(collection.length) : [];
  3954. baseEach(collection, function(value, key, collection) {
  3955. result[++index] = iteratee(value, key, collection);
  3956. });
  3957. return result;
  3958. }
  3959. /**
  3960. * The base implementation of `_.matches` which doesn't clone `source`.
  3961. *
  3962. * @private
  3963. * @param {Object} source The object of property values to match.
  3964. * @returns {Function} Returns the new spec function.
  3965. */
  3966. function baseMatches(source) {
  3967. var matchData = getMatchData(source);
  3968. if (matchData.length == 1 && matchData[0][2]) {
  3969. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3970. }
  3971. return function(object) {
  3972. return object === source || baseIsMatch(object, source, matchData);
  3973. };
  3974. }
  3975. /**
  3976. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  3977. *
  3978. * @private
  3979. * @param {string} path The path of the property to get.
  3980. * @param {*} srcValue The value to match.
  3981. * @returns {Function} Returns the new spec function.
  3982. */
  3983. function baseMatchesProperty(path, srcValue) {
  3984. if (isKey(path) && isStrictComparable(srcValue)) {
  3985. return matchesStrictComparable(toKey(path), srcValue);
  3986. }
  3987. return function(object) {
  3988. var objValue = get(object, path);
  3989. return (objValue === undefined && objValue === srcValue)
  3990. ? hasIn(object, path)
  3991. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3992. };
  3993. }
  3994. /**
  3995. * The base implementation of `_.merge` without support for multiple sources.
  3996. *
  3997. * @private
  3998. * @param {Object} object The destination object.
  3999. * @param {Object} source The source object.
  4000. * @param {number} srcIndex The index of `source`.
  4001. * @param {Function} [customizer] The function to customize merged values.
  4002. * @param {Object} [stack] Tracks traversed source values and their merged
  4003. * counterparts.
  4004. */
  4005. function baseMerge(object, source, srcIndex, customizer, stack) {
  4006. if (object === source) {
  4007. return;
  4008. }
  4009. baseFor(source, function(srcValue, key) {
  4010. if (isObject(srcValue)) {
  4011. stack || (stack = new Stack);
  4012. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4013. }
  4014. else {
  4015. var newValue = customizer
  4016. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  4017. : undefined;
  4018. if (newValue === undefined) {
  4019. newValue = srcValue;
  4020. }
  4021. assignMergeValue(object, key, newValue);
  4022. }
  4023. }, keysIn);
  4024. }
  4025. /**
  4026. * A specialized version of `baseMerge` for arrays and objects which performs
  4027. * deep merges and tracks traversed objects enabling objects with circular
  4028. * references to be merged.
  4029. *
  4030. * @private
  4031. * @param {Object} object The destination object.
  4032. * @param {Object} source The source object.
  4033. * @param {string} key The key of the value to merge.
  4034. * @param {number} srcIndex The index of `source`.
  4035. * @param {Function} mergeFunc The function to merge values.
  4036. * @param {Function} [customizer] The function to customize assigned values.
  4037. * @param {Object} [stack] Tracks traversed source values and their merged
  4038. * counterparts.
  4039. */
  4040. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4041. var objValue = object[key],
  4042. srcValue = source[key],
  4043. stacked = stack.get(srcValue);
  4044. if (stacked) {
  4045. assignMergeValue(object, key, stacked);
  4046. return;
  4047. }
  4048. var newValue = customizer
  4049. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4050. : undefined;
  4051. var isCommon = newValue === undefined;
  4052. if (isCommon) {
  4053. var isArr = isArray(srcValue),
  4054. isBuff = !isArr && isBuffer(srcValue),
  4055. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4056. newValue = srcValue;
  4057. if (isArr || isBuff || isTyped) {
  4058. if (isArray(objValue)) {
  4059. newValue = objValue;
  4060. }
  4061. else if (isArrayLikeObject(objValue)) {
  4062. newValue = copyArray(objValue);
  4063. }
  4064. else if (isBuff) {
  4065. isCommon = false;
  4066. newValue = cloneBuffer(srcValue, true);
  4067. }
  4068. else if (isTyped) {
  4069. isCommon = false;
  4070. newValue = cloneTypedArray(srcValue, true);
  4071. }
  4072. else {
  4073. newValue = [];
  4074. }
  4075. }
  4076. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4077. newValue = objValue;
  4078. if (isArguments(objValue)) {
  4079. newValue = toPlainObject(objValue);
  4080. }
  4081. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  4082. newValue = initCloneObject(srcValue);
  4083. }
  4084. }
  4085. else {
  4086. isCommon = false;
  4087. }
  4088. }
  4089. if (isCommon) {
  4090. // Recursively merge objects and arrays (susceptible to call stack limits).
  4091. stack.set(srcValue, newValue);
  4092. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4093. stack['delete'](srcValue);
  4094. }
  4095. assignMergeValue(object, key, newValue);
  4096. }
  4097. /**
  4098. * The base implementation of `_.nth` which doesn't coerce arguments.
  4099. *
  4100. * @private
  4101. * @param {Array} array The array to query.
  4102. * @param {number} n The index of the element to return.
  4103. * @returns {*} Returns the nth element of `array`.
  4104. */
  4105. function baseNth(array, n) {
  4106. var length = array.length;
  4107. if (!length) {
  4108. return;
  4109. }
  4110. n += n < 0 ? length : 0;
  4111. return isIndex(n, length) ? array[n] : undefined;
  4112. }
  4113. /**
  4114. * The base implementation of `_.orderBy` without param guards.
  4115. *
  4116. * @private
  4117. * @param {Array|Object} collection The collection to iterate over.
  4118. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4119. * @param {string[]} orders The sort orders of `iteratees`.
  4120. * @returns {Array} Returns the new sorted array.
  4121. */
  4122. function baseOrderBy(collection, iteratees, orders) {
  4123. var index = -1;
  4124. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  4125. var result = baseMap(collection, function(value, key, collection) {
  4126. var criteria = arrayMap(iteratees, function(iteratee) {
  4127. return iteratee(value);
  4128. });
  4129. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4130. });
  4131. return baseSortBy(result, function(object, other) {
  4132. return compareMultiple(object, other, orders);
  4133. });
  4134. }
  4135. /**
  4136. * The base implementation of `_.pick` without support for individual
  4137. * property identifiers.
  4138. *
  4139. * @private
  4140. * @param {Object} object The source object.
  4141. * @param {string[]} paths The property paths to pick.
  4142. * @returns {Object} Returns the new object.
  4143. */
  4144. function basePick(object, paths) {
  4145. return basePickBy(object, paths, function(value, path) {
  4146. return hasIn(object, path);
  4147. });
  4148. }
  4149. /**
  4150. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4151. *
  4152. * @private
  4153. * @param {Object} object The source object.
  4154. * @param {string[]} paths The property paths to pick.
  4155. * @param {Function} predicate The function invoked per property.
  4156. * @returns {Object} Returns the new object.
  4157. */
  4158. function basePickBy(object, paths, predicate) {
  4159. var index = -1,
  4160. length = paths.length,
  4161. result = {};
  4162. while (++index < length) {
  4163. var path = paths[index],
  4164. value = baseGet(object, path);
  4165. if (predicate(value, path)) {
  4166. baseSet(result, castPath(path, object), value);
  4167. }
  4168. }
  4169. return result;
  4170. }
  4171. /**
  4172. * A specialized version of `baseProperty` which supports deep paths.
  4173. *
  4174. * @private
  4175. * @param {Array|string} path The path of the property to get.
  4176. * @returns {Function} Returns the new accessor function.
  4177. */
  4178. function basePropertyDeep(path) {
  4179. return function(object) {
  4180. return baseGet(object, path);
  4181. };
  4182. }
  4183. /**
  4184. * The base implementation of `_.pullAllBy` without support for iteratee
  4185. * shorthands.
  4186. *
  4187. * @private
  4188. * @param {Array} array The array to modify.
  4189. * @param {Array} values The values to remove.
  4190. * @param {Function} [iteratee] The iteratee invoked per element.
  4191. * @param {Function} [comparator] The comparator invoked per element.
  4192. * @returns {Array} Returns `array`.
  4193. */
  4194. function basePullAll(array, values, iteratee, comparator) {
  4195. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4196. index = -1,
  4197. length = values.length,
  4198. seen = array;
  4199. if (array === values) {
  4200. values = copyArray(values);
  4201. }
  4202. if (iteratee) {
  4203. seen = arrayMap(array, baseUnary(iteratee));
  4204. }
  4205. while (++index < length) {
  4206. var fromIndex = 0,
  4207. value = values[index],
  4208. computed = iteratee ? iteratee(value) : value;
  4209. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4210. if (seen !== array) {
  4211. splice.call(seen, fromIndex, 1);
  4212. }
  4213. splice.call(array, fromIndex, 1);
  4214. }
  4215. }
  4216. return array;
  4217. }
  4218. /**
  4219. * The base implementation of `_.pullAt` without support for individual
  4220. * indexes or capturing the removed elements.
  4221. *
  4222. * @private
  4223. * @param {Array} array The array to modify.
  4224. * @param {number[]} indexes The indexes of elements to remove.
  4225. * @returns {Array} Returns `array`.
  4226. */
  4227. function basePullAt(array, indexes) {
  4228. var length = array ? indexes.length : 0,
  4229. lastIndex = length - 1;
  4230. while (length--) {
  4231. var index = indexes[length];
  4232. if (length == lastIndex || index !== previous) {
  4233. var previous = index;
  4234. if (isIndex(index)) {
  4235. splice.call(array, index, 1);
  4236. } else {
  4237. baseUnset(array, index);
  4238. }
  4239. }
  4240. }
  4241. return array;
  4242. }
  4243. /**
  4244. * The base implementation of `_.random` without support for returning
  4245. * floating-point numbers.
  4246. *
  4247. * @private
  4248. * @param {number} lower The lower bound.
  4249. * @param {number} upper The upper bound.
  4250. * @returns {number} Returns the random number.
  4251. */
  4252. function baseRandom(lower, upper) {
  4253. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4254. }
  4255. /**
  4256. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4257. * coerce arguments.
  4258. *
  4259. * @private
  4260. * @param {number} start The start of the range.
  4261. * @param {number} end The end of the range.
  4262. * @param {number} step The value to increment or decrement by.
  4263. * @param {boolean} [fromRight] Specify iterating from right to left.
  4264. * @returns {Array} Returns the range of numbers.
  4265. */
  4266. function baseRange(start, end, step, fromRight) {
  4267. var index = -1,
  4268. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4269. result = Array(length);
  4270. while (length--) {
  4271. result[fromRight ? length : ++index] = start;
  4272. start += step;
  4273. }
  4274. return result;
  4275. }
  4276. /**
  4277. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4278. *
  4279. * @private
  4280. * @param {string} string The string to repeat.
  4281. * @param {number} n The number of times to repeat the string.
  4282. * @returns {string} Returns the repeated string.
  4283. */
  4284. function baseRepeat(string, n) {
  4285. var result = '';
  4286. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4287. return result;
  4288. }
  4289. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4290. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4291. do {
  4292. if (n % 2) {
  4293. result += string;
  4294. }
  4295. n = nativeFloor(n / 2);
  4296. if (n) {
  4297. string += string;
  4298. }
  4299. } while (n);
  4300. return result;
  4301. }
  4302. /**
  4303. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4304. *
  4305. * @private
  4306. * @param {Function} func The function to apply a rest parameter to.
  4307. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4308. * @returns {Function} Returns the new function.
  4309. */
  4310. function baseRest(func, start) {
  4311. return setToString(overRest(func, start, identity), func + '');
  4312. }
  4313. /**
  4314. * The base implementation of `_.sample`.
  4315. *
  4316. * @private
  4317. * @param {Array|Object} collection The collection to sample.
  4318. * @returns {*} Returns the random element.
  4319. */
  4320. function baseSample(collection) {
  4321. return arraySample(values(collection));
  4322. }
  4323. /**
  4324. * The base implementation of `_.sampleSize` without param guards.
  4325. *
  4326. * @private
  4327. * @param {Array|Object} collection The collection to sample.
  4328. * @param {number} n The number of elements to sample.
  4329. * @returns {Array} Returns the random elements.
  4330. */
  4331. function baseSampleSize(collection, n) {
  4332. var array = values(collection);
  4333. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4334. }
  4335. /**
  4336. * The base implementation of `_.set`.
  4337. *
  4338. * @private
  4339. * @param {Object} object The object to modify.
  4340. * @param {Array|string} path The path of the property to set.
  4341. * @param {*} value The value to set.
  4342. * @param {Function} [customizer] The function to customize path creation.
  4343. * @returns {Object} Returns `object`.
  4344. */
  4345. function baseSet(object, path, value, customizer) {
  4346. if (!isObject(object)) {
  4347. return object;
  4348. }
  4349. path = castPath(path, object);
  4350. var index = -1,
  4351. length = path.length,
  4352. lastIndex = length - 1,
  4353. nested = object;
  4354. while (nested != null && ++index < length) {
  4355. var key = toKey(path[index]),
  4356. newValue = value;
  4357. if (index != lastIndex) {
  4358. var objValue = nested[key];
  4359. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4360. if (newValue === undefined) {
  4361. newValue = isObject(objValue)
  4362. ? objValue
  4363. : (isIndex(path[index + 1]) ? [] : {});
  4364. }
  4365. }
  4366. assignValue(nested, key, newValue);
  4367. nested = nested[key];
  4368. }
  4369. return object;
  4370. }
  4371. /**
  4372. * The base implementation of `setData` without support for hot loop shorting.
  4373. *
  4374. * @private
  4375. * @param {Function} func The function to associate metadata with.
  4376. * @param {*} data The metadata.
  4377. * @returns {Function} Returns `func`.
  4378. */
  4379. var baseSetData = !metaMap ? identity : function(func, data) {
  4380. metaMap.set(func, data);
  4381. return func;
  4382. };
  4383. /**
  4384. * The base implementation of `setToString` without support for hot loop shorting.
  4385. *
  4386. * @private
  4387. * @param {Function} func The function to modify.
  4388. * @param {Function} string The `toString` result.
  4389. * @returns {Function} Returns `func`.
  4390. */
  4391. var baseSetToString = !defineProperty ? identity : function(func, string) {
  4392. return defineProperty(func, 'toString', {
  4393. 'configurable': true,
  4394. 'enumerable': false,
  4395. 'value': constant(string),
  4396. 'writable': true
  4397. });
  4398. };
  4399. /**
  4400. * The base implementation of `_.shuffle`.
  4401. *
  4402. * @private
  4403. * @param {Array|Object} collection The collection to shuffle.
  4404. * @returns {Array} Returns the new shuffled array.
  4405. */
  4406. function baseShuffle(collection) {
  4407. return shuffleSelf(values(collection));
  4408. }
  4409. /**
  4410. * The base implementation of `_.slice` without an iteratee call guard.
  4411. *
  4412. * @private
  4413. * @param {Array} array The array to slice.
  4414. * @param {number} [start=0] The start position.
  4415. * @param {number} [end=array.length] The end position.
  4416. * @returns {Array} Returns the slice of `array`.
  4417. */
  4418. function baseSlice(array, start, end) {
  4419. var index = -1,
  4420. length = array.length;
  4421. if (start < 0) {
  4422. start = -start > length ? 0 : (length + start);
  4423. }
  4424. end = end > length ? length : end;
  4425. if (end < 0) {
  4426. end += length;
  4427. }
  4428. length = start > end ? 0 : ((end - start) >>> 0);
  4429. start >>>= 0;
  4430. var result = Array(length);
  4431. while (++index < length) {
  4432. result[index] = array[index + start];
  4433. }
  4434. return result;
  4435. }
  4436. /**
  4437. * The base implementation of `_.some` without support for iteratee shorthands.
  4438. *
  4439. * @private
  4440. * @param {Array|Object} collection The collection to iterate over.
  4441. * @param {Function} predicate The function invoked per iteration.
  4442. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4443. * else `false`.
  4444. */
  4445. function baseSome(collection, predicate) {
  4446. var result;
  4447. baseEach(collection, function(value, index, collection) {
  4448. result = predicate(value, index, collection);
  4449. return !result;
  4450. });
  4451. return !!result;
  4452. }
  4453. /**
  4454. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  4455. * performs a binary search of `array` to determine the index at which `value`
  4456. * should be inserted into `array` in order to maintain its sort order.
  4457. *
  4458. * @private
  4459. * @param {Array} array The sorted array to inspect.
  4460. * @param {*} value The value to evaluate.
  4461. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4462. * @returns {number} Returns the index at which `value` should be inserted
  4463. * into `array`.
  4464. */
  4465. function baseSortedIndex(array, value, retHighest) {
  4466. var low = 0,
  4467. high = array == null ? low : array.length;
  4468. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4469. while (low < high) {
  4470. var mid = (low + high) >>> 1,
  4471. computed = array[mid];
  4472. if (computed !== null && !isSymbol(computed) &&
  4473. (retHighest ? (computed <= value) : (computed < value))) {
  4474. low = mid + 1;
  4475. } else {
  4476. high = mid;
  4477. }
  4478. }
  4479. return high;
  4480. }
  4481. return baseSortedIndexBy(array, value, identity, retHighest);
  4482. }
  4483. /**
  4484. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  4485. * which invokes `iteratee` for `value` and each element of `array` to compute
  4486. * their sort ranking. The iteratee is invoked with one argument; (value).
  4487. *
  4488. * @private
  4489. * @param {Array} array The sorted array to inspect.
  4490. * @param {*} value The value to evaluate.
  4491. * @param {Function} iteratee The iteratee invoked per element.
  4492. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4493. * @returns {number} Returns the index at which `value` should be inserted
  4494. * into `array`.
  4495. */
  4496. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4497. value = iteratee(value);
  4498. var low = 0,
  4499. high = array == null ? 0 : array.length,
  4500. valIsNaN = value !== value,
  4501. valIsNull = value === null,
  4502. valIsSymbol = isSymbol(value),
  4503. valIsUndefined = value === undefined;
  4504. while (low < high) {
  4505. var mid = nativeFloor((low + high) / 2),
  4506. computed = iteratee(array[mid]),
  4507. othIsDefined = computed !== undefined,
  4508. othIsNull = computed === null,
  4509. othIsReflexive = computed === computed,
  4510. othIsSymbol = isSymbol(computed);
  4511. if (valIsNaN) {
  4512. var setLow = retHighest || othIsReflexive;
  4513. } else if (valIsUndefined) {
  4514. setLow = othIsReflexive && (retHighest || othIsDefined);
  4515. } else if (valIsNull) {
  4516. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4517. } else if (valIsSymbol) {
  4518. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4519. } else if (othIsNull || othIsSymbol) {
  4520. setLow = false;
  4521. } else {
  4522. setLow = retHighest ? (computed <= value) : (computed < value);
  4523. }
  4524. if (setLow) {
  4525. low = mid + 1;
  4526. } else {
  4527. high = mid;
  4528. }
  4529. }
  4530. return nativeMin(high, MAX_ARRAY_INDEX);
  4531. }
  4532. /**
  4533. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  4534. * support for iteratee shorthands.
  4535. *
  4536. * @private
  4537. * @param {Array} array The array to inspect.
  4538. * @param {Function} [iteratee] The iteratee invoked per element.
  4539. * @returns {Array} Returns the new duplicate free array.
  4540. */
  4541. function baseSortedUniq(array, iteratee) {
  4542. var index = -1,
  4543. length = array.length,
  4544. resIndex = 0,
  4545. result = [];
  4546. while (++index < length) {
  4547. var value = array[index],
  4548. computed = iteratee ? iteratee(value) : value;
  4549. if (!index || !eq(computed, seen)) {
  4550. var seen = computed;
  4551. result[resIndex++] = value === 0 ? 0 : value;
  4552. }
  4553. }
  4554. return result;
  4555. }
  4556. /**
  4557. * The base implementation of `_.toNumber` which doesn't ensure correct
  4558. * conversions of binary, hexadecimal, or octal string values.
  4559. *
  4560. * @private
  4561. * @param {*} value The value to process.
  4562. * @returns {number} Returns the number.
  4563. */
  4564. function baseToNumber(value) {
  4565. if (typeof value == 'number') {
  4566. return value;
  4567. }
  4568. if (isSymbol(value)) {
  4569. return NAN;
  4570. }
  4571. return +value;
  4572. }
  4573. /**
  4574. * The base implementation of `_.toString` which doesn't convert nullish
  4575. * values to empty strings.
  4576. *
  4577. * @private
  4578. * @param {*} value The value to process.
  4579. * @returns {string} Returns the string.
  4580. */
  4581. function baseToString(value) {
  4582. // Exit early for strings to avoid a performance hit in some environments.
  4583. if (typeof value == 'string') {
  4584. return value;
  4585. }
  4586. if (isArray(value)) {
  4587. // Recursively convert values (susceptible to call stack limits).
  4588. return arrayMap(value, baseToString) + '';
  4589. }
  4590. if (isSymbol(value)) {
  4591. return symbolToString ? symbolToString.call(value) : '';
  4592. }
  4593. var result = (value + '');
  4594. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4595. }
  4596. /**
  4597. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4598. *
  4599. * @private
  4600. * @param {Array} array The array to inspect.
  4601. * @param {Function} [iteratee] The iteratee invoked per element.
  4602. * @param {Function} [comparator] The comparator invoked per element.
  4603. * @returns {Array} Returns the new duplicate free array.
  4604. */
  4605. function baseUniq(array, iteratee, comparator) {
  4606. var index = -1,
  4607. includes = arrayIncludes,
  4608. length = array.length,
  4609. isCommon = true,
  4610. result = [],
  4611. seen = result;
  4612. if (comparator) {
  4613. isCommon = false;
  4614. includes = arrayIncludesWith;
  4615. }
  4616. else if (length >= LARGE_ARRAY_SIZE) {
  4617. var set = iteratee ? null : createSet(array);
  4618. if (set) {
  4619. return setToArray(set);
  4620. }
  4621. isCommon = false;
  4622. includes = cacheHas;
  4623. seen = new SetCache;
  4624. }
  4625. else {
  4626. seen = iteratee ? [] : result;
  4627. }
  4628. outer:
  4629. while (++index < length) {
  4630. var value = array[index],
  4631. computed = iteratee ? iteratee(value) : value;
  4632. value = (comparator || value !== 0) ? value : 0;
  4633. if (isCommon && computed === computed) {
  4634. var seenIndex = seen.length;
  4635. while (seenIndex--) {
  4636. if (seen[seenIndex] === computed) {
  4637. continue outer;
  4638. }
  4639. }
  4640. if (iteratee) {
  4641. seen.push(computed);
  4642. }
  4643. result.push(value);
  4644. }
  4645. else if (!includes(seen, computed, comparator)) {
  4646. if (seen !== result) {
  4647. seen.push(computed);
  4648. }
  4649. result.push(value);
  4650. }
  4651. }
  4652. return result;
  4653. }
  4654. /**
  4655. * The base implementation of `_.unset`.
  4656. *
  4657. * @private
  4658. * @param {Object} object The object to modify.
  4659. * @param {Array|string} path The property path to unset.
  4660. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  4661. */
  4662. function baseUnset(object, path) {
  4663. path = castPath(path, object);
  4664. object = parent(object, path);
  4665. return object == null || delete object[toKey(last(path))];
  4666. }
  4667. /**
  4668. * The base implementation of `_.update`.
  4669. *
  4670. * @private
  4671. * @param {Object} object The object to modify.
  4672. * @param {Array|string} path The path of the property to update.
  4673. * @param {Function} updater The function to produce the updated value.
  4674. * @param {Function} [customizer] The function to customize path creation.
  4675. * @returns {Object} Returns `object`.
  4676. */
  4677. function baseUpdate(object, path, updater, customizer) {
  4678. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  4679. }
  4680. /**
  4681. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  4682. * without support for iteratee shorthands.
  4683. *
  4684. * @private
  4685. * @param {Array} array The array to query.
  4686. * @param {Function} predicate The function invoked per iteration.
  4687. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  4688. * @param {boolean} [fromRight] Specify iterating from right to left.
  4689. * @returns {Array} Returns the slice of `array`.
  4690. */
  4691. function baseWhile(array, predicate, isDrop, fromRight) {
  4692. var length = array.length,
  4693. index = fromRight ? length : -1;
  4694. while ((fromRight ? index-- : ++index < length) &&
  4695. predicate(array[index], index, array)) {}
  4696. return isDrop
  4697. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  4698. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  4699. }
  4700. /**
  4701. * The base implementation of `wrapperValue` which returns the result of
  4702. * performing a sequence of actions on the unwrapped `value`, where each
  4703. * successive action is supplied the return value of the previous.
  4704. *
  4705. * @private
  4706. * @param {*} value The unwrapped value.
  4707. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  4708. * @returns {*} Returns the resolved value.
  4709. */
  4710. function baseWrapperValue(value, actions) {
  4711. var result = value;
  4712. if (result instanceof LazyWrapper) {
  4713. result = result.value();
  4714. }
  4715. return arrayReduce(actions, function(result, action) {
  4716. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  4717. }, result);
  4718. }
  4719. /**
  4720. * The base implementation of methods like `_.xor`, without support for
  4721. * iteratee shorthands, that accepts an array of arrays to inspect.
  4722. *
  4723. * @private
  4724. * @param {Array} arrays The arrays to inspect.
  4725. * @param {Function} [iteratee] The iteratee invoked per element.
  4726. * @param {Function} [comparator] The comparator invoked per element.
  4727. * @returns {Array} Returns the new array of values.
  4728. */
  4729. function baseXor(arrays, iteratee, comparator) {
  4730. var length = arrays.length;
  4731. if (length < 2) {
  4732. return length ? baseUniq(arrays[0]) : [];
  4733. }
  4734. var index = -1,
  4735. result = Array(length);
  4736. while (++index < length) {
  4737. var array = arrays[index],
  4738. othIndex = -1;
  4739. while (++othIndex < length) {
  4740. if (othIndex != index) {
  4741. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  4742. }
  4743. }
  4744. }
  4745. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  4746. }
  4747. /**
  4748. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  4749. *
  4750. * @private
  4751. * @param {Array} props The property identifiers.
  4752. * @param {Array} values The property values.
  4753. * @param {Function} assignFunc The function to assign values.
  4754. * @returns {Object} Returns the new object.
  4755. */
  4756. function baseZipObject(props, values, assignFunc) {
  4757. var index = -1,
  4758. length = props.length,
  4759. valsLength = values.length,
  4760. result = {};
  4761. while (++index < length) {
  4762. var value = index < valsLength ? values[index] : undefined;
  4763. assignFunc(result, props[index], value);
  4764. }
  4765. return result;
  4766. }
  4767. /**
  4768. * Casts `value` to an empty array if it's not an array like object.
  4769. *
  4770. * @private
  4771. * @param {*} value The value to inspect.
  4772. * @returns {Array|Object} Returns the cast array-like object.
  4773. */
  4774. function castArrayLikeObject(value) {
  4775. return isArrayLikeObject(value) ? value : [];
  4776. }
  4777. /**
  4778. * Casts `value` to `identity` if it's not a function.
  4779. *
  4780. * @private
  4781. * @param {*} value The value to inspect.
  4782. * @returns {Function} Returns cast function.
  4783. */
  4784. function castFunction(value) {
  4785. return typeof value == 'function' ? value : identity;
  4786. }
  4787. /**
  4788. * Casts `value` to a path array if it's not one.
  4789. *
  4790. * @private
  4791. * @param {*} value The value to inspect.
  4792. * @param {Object} [object] The object to query keys on.
  4793. * @returns {Array} Returns the cast property path array.
  4794. */
  4795. function castPath(value, object) {
  4796. if (isArray(value)) {
  4797. return value;
  4798. }
  4799. return isKey(value, object) ? [value] : stringToPath(toString(value));
  4800. }
  4801. /**
  4802. * A `baseRest` alias which can be replaced with `identity` by module
  4803. * replacement plugins.
  4804. *
  4805. * @private
  4806. * @type {Function}
  4807. * @param {Function} func The function to apply a rest parameter to.
  4808. * @returns {Function} Returns the new function.
  4809. */
  4810. var castRest = baseRest;
  4811. /**
  4812. * Casts `array` to a slice if it's needed.
  4813. *
  4814. * @private
  4815. * @param {Array} array The array to inspect.
  4816. * @param {number} start The start position.
  4817. * @param {number} [end=array.length] The end position.
  4818. * @returns {Array} Returns the cast slice.
  4819. */
  4820. function castSlice(array, start, end) {
  4821. var length = array.length;
  4822. end = end === undefined ? length : end;
  4823. return (!start && end >= length) ? array : baseSlice(array, start, end);
  4824. }
  4825. /**
  4826. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  4827. *
  4828. * @private
  4829. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  4830. */
  4831. var clearTimeout = ctxClearTimeout || function(id) {
  4832. return root.clearTimeout(id);
  4833. };
  4834. /**
  4835. * Creates a clone of `buffer`.
  4836. *
  4837. * @private
  4838. * @param {Buffer} buffer The buffer to clone.
  4839. * @param {boolean} [isDeep] Specify a deep clone.
  4840. * @returns {Buffer} Returns the cloned buffer.
  4841. */
  4842. function cloneBuffer(buffer, isDeep) {
  4843. if (isDeep) {
  4844. return buffer.slice();
  4845. }
  4846. var length = buffer.length,
  4847. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  4848. buffer.copy(result);
  4849. return result;
  4850. }
  4851. /**
  4852. * Creates a clone of `arrayBuffer`.
  4853. *
  4854. * @private
  4855. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  4856. * @returns {ArrayBuffer} Returns the cloned array buffer.
  4857. */
  4858. function cloneArrayBuffer(arrayBuffer) {
  4859. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  4860. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  4861. return result;
  4862. }
  4863. /**
  4864. * Creates a clone of `dataView`.
  4865. *
  4866. * @private
  4867. * @param {Object} dataView The data view to clone.
  4868. * @param {boolean} [isDeep] Specify a deep clone.
  4869. * @returns {Object} Returns the cloned data view.
  4870. */
  4871. function cloneDataView(dataView, isDeep) {
  4872. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  4873. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  4874. }
  4875. /**
  4876. * Creates a clone of `map`.
  4877. *
  4878. * @private
  4879. * @param {Object} map The map to clone.
  4880. * @param {Function} cloneFunc The function to clone values.
  4881. * @param {boolean} [isDeep] Specify a deep clone.
  4882. * @returns {Object} Returns the cloned map.
  4883. */
  4884. function cloneMap(map, isDeep, cloneFunc) {
  4885. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  4886. return arrayReduce(array, addMapEntry, new map.constructor);
  4887. }
  4888. /**
  4889. * Creates a clone of `regexp`.
  4890. *
  4891. * @private
  4892. * @param {Object} regexp The regexp to clone.
  4893. * @returns {Object} Returns the cloned regexp.
  4894. */
  4895. function cloneRegExp(regexp) {
  4896. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  4897. result.lastIndex = regexp.lastIndex;
  4898. return result;
  4899. }
  4900. /**
  4901. * Creates a clone of `set`.
  4902. *
  4903. * @private
  4904. * @param {Object} set The set to clone.
  4905. * @param {Function} cloneFunc The function to clone values.
  4906. * @param {boolean} [isDeep] Specify a deep clone.
  4907. * @returns {Object} Returns the cloned set.
  4908. */
  4909. function cloneSet(set, isDeep, cloneFunc) {
  4910. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  4911. return arrayReduce(array, addSetEntry, new set.constructor);
  4912. }
  4913. /**
  4914. * Creates a clone of the `symbol` object.
  4915. *
  4916. * @private
  4917. * @param {Object} symbol The symbol object to clone.
  4918. * @returns {Object} Returns the cloned symbol object.
  4919. */
  4920. function cloneSymbol(symbol) {
  4921. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  4922. }
  4923. /**
  4924. * Creates a clone of `typedArray`.
  4925. *
  4926. * @private
  4927. * @param {Object} typedArray The typed array to clone.
  4928. * @param {boolean} [isDeep] Specify a deep clone.
  4929. * @returns {Object} Returns the cloned typed array.
  4930. */
  4931. function cloneTypedArray(typedArray, isDeep) {
  4932. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  4933. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  4934. }
  4935. /**
  4936. * Compares values to sort them in ascending order.
  4937. *
  4938. * @private
  4939. * @param {*} value The value to compare.
  4940. * @param {*} other The other value to compare.
  4941. * @returns {number} Returns the sort order indicator for `value`.
  4942. */
  4943. function compareAscending(value, other) {
  4944. if (value !== other) {
  4945. var valIsDefined = value !== undefined,
  4946. valIsNull = value === null,
  4947. valIsReflexive = value === value,
  4948. valIsSymbol = isSymbol(value);
  4949. var othIsDefined = other !== undefined,
  4950. othIsNull = other === null,
  4951. othIsReflexive = other === other,
  4952. othIsSymbol = isSymbol(other);
  4953. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  4954. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  4955. (valIsNull && othIsDefined && othIsReflexive) ||
  4956. (!valIsDefined && othIsReflexive) ||
  4957. !valIsReflexive) {
  4958. return 1;
  4959. }
  4960. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  4961. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  4962. (othIsNull && valIsDefined && valIsReflexive) ||
  4963. (!othIsDefined && valIsReflexive) ||
  4964. !othIsReflexive) {
  4965. return -1;
  4966. }
  4967. }
  4968. return 0;
  4969. }
  4970. /**
  4971. * Used by `_.orderBy` to compare multiple properties of a value to another
  4972. * and stable sort them.
  4973. *
  4974. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  4975. * specify an order of "desc" for descending or "asc" for ascending sort order
  4976. * of corresponding values.
  4977. *
  4978. * @private
  4979. * @param {Object} object The object to compare.
  4980. * @param {Object} other The other object to compare.
  4981. * @param {boolean[]|string[]} orders The order to sort by for each property.
  4982. * @returns {number} Returns the sort order indicator for `object`.
  4983. */
  4984. function compareMultiple(object, other, orders) {
  4985. var index = -1,
  4986. objCriteria = object.criteria,
  4987. othCriteria = other.criteria,
  4988. length = objCriteria.length,
  4989. ordersLength = orders.length;
  4990. while (++index < length) {
  4991. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4992. if (result) {
  4993. if (index >= ordersLength) {
  4994. return result;
  4995. }
  4996. var order = orders[index];
  4997. return result * (order == 'desc' ? -1 : 1);
  4998. }
  4999. }
  5000. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5001. // that causes it, under certain circumstances, to provide the same value for
  5002. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5003. // for more details.
  5004. //
  5005. // This also ensures a stable sort in V8 and other engines.
  5006. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5007. return object.index - other.index;
  5008. }
  5009. /**
  5010. * Creates an array that is the composition of partially applied arguments,
  5011. * placeholders, and provided arguments into a single array of arguments.
  5012. *
  5013. * @private
  5014. * @param {Array} args The provided arguments.
  5015. * @param {Array} partials The arguments to prepend to those provided.
  5016. * @param {Array} holders The `partials` placeholder indexes.
  5017. * @params {boolean} [isCurried] Specify composing for a curried function.
  5018. * @returns {Array} Returns the new array of composed arguments.
  5019. */
  5020. function composeArgs(args, partials, holders, isCurried) {
  5021. var argsIndex = -1,
  5022. argsLength = args.length,
  5023. holdersLength = holders.length,
  5024. leftIndex = -1,
  5025. leftLength = partials.length,
  5026. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5027. result = Array(leftLength + rangeLength),
  5028. isUncurried = !isCurried;
  5029. while (++leftIndex < leftLength) {
  5030. result[leftIndex] = partials[leftIndex];
  5031. }
  5032. while (++argsIndex < holdersLength) {
  5033. if (isUncurried || argsIndex < argsLength) {
  5034. result[holders[argsIndex]] = args[argsIndex];
  5035. }
  5036. }
  5037. while (rangeLength--) {
  5038. result[leftIndex++] = args[argsIndex++];
  5039. }
  5040. return result;
  5041. }
  5042. /**
  5043. * This function is like `composeArgs` except that the arguments composition
  5044. * is tailored for `_.partialRight`.
  5045. *
  5046. * @private
  5047. * @param {Array} args The provided arguments.
  5048. * @param {Array} partials The arguments to append to those provided.
  5049. * @param {Array} holders The `partials` placeholder indexes.
  5050. * @params {boolean} [isCurried] Specify composing for a curried function.
  5051. * @returns {Array} Returns the new array of composed arguments.
  5052. */
  5053. function composeArgsRight(args, partials, holders, isCurried) {
  5054. var argsIndex = -1,
  5055. argsLength = args.length,
  5056. holdersIndex = -1,
  5057. holdersLength = holders.length,
  5058. rightIndex = -1,
  5059. rightLength = partials.length,
  5060. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5061. result = Array(rangeLength + rightLength),
  5062. isUncurried = !isCurried;
  5063. while (++argsIndex < rangeLength) {
  5064. result[argsIndex] = args[argsIndex];
  5065. }
  5066. var offset = argsIndex;
  5067. while (++rightIndex < rightLength) {
  5068. result[offset + rightIndex] = partials[rightIndex];
  5069. }
  5070. while (++holdersIndex < holdersLength) {
  5071. if (isUncurried || argsIndex < argsLength) {
  5072. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5073. }
  5074. }
  5075. return result;
  5076. }
  5077. /**
  5078. * Copies the values of `source` to `array`.
  5079. *
  5080. * @private
  5081. * @param {Array} source The array to copy values from.
  5082. * @param {Array} [array=[]] The array to copy values to.
  5083. * @returns {Array} Returns `array`.
  5084. */
  5085. function copyArray(source, array) {
  5086. var index = -1,
  5087. length = source.length;
  5088. array || (array = Array(length));
  5089. while (++index < length) {
  5090. array[index] = source[index];
  5091. }
  5092. return array;
  5093. }
  5094. /**
  5095. * Copies properties of `source` to `object`.
  5096. *
  5097. * @private
  5098. * @param {Object} source The object to copy properties from.
  5099. * @param {Array} props The property identifiers to copy.
  5100. * @param {Object} [object={}] The object to copy properties to.
  5101. * @param {Function} [customizer] The function to customize copied values.
  5102. * @returns {Object} Returns `object`.
  5103. */
  5104. function copyObject(source, props, object, customizer) {
  5105. var isNew = !object;
  5106. object || (object = {});
  5107. var index = -1,
  5108. length = props.length;
  5109. while (++index < length) {
  5110. var key = props[index];
  5111. var newValue = customizer
  5112. ? customizer(object[key], source[key], key, object, source)
  5113. : undefined;
  5114. if (newValue === undefined) {
  5115. newValue = source[key];
  5116. }
  5117. if (isNew) {
  5118. baseAssignValue(object, key, newValue);
  5119. } else {
  5120. assignValue(object, key, newValue);
  5121. }
  5122. }
  5123. return object;
  5124. }
  5125. /**
  5126. * Copies own symbols of `source` to `object`.
  5127. *
  5128. * @private
  5129. * @param {Object} source The object to copy symbols from.
  5130. * @param {Object} [object={}] The object to copy symbols to.
  5131. * @returns {Object} Returns `object`.
  5132. */
  5133. function copySymbols(source, object) {
  5134. return copyObject(source, getSymbols(source), object);
  5135. }
  5136. /**
  5137. * Copies own and inherited symbols of `source` to `object`.
  5138. *
  5139. * @private
  5140. * @param {Object} source The object to copy symbols from.
  5141. * @param {Object} [object={}] The object to copy symbols to.
  5142. * @returns {Object} Returns `object`.
  5143. */
  5144. function copySymbolsIn(source, object) {
  5145. return copyObject(source, getSymbolsIn(source), object);
  5146. }
  5147. /**
  5148. * Creates a function like `_.groupBy`.
  5149. *
  5150. * @private
  5151. * @param {Function} setter The function to set accumulator values.
  5152. * @param {Function} [initializer] The accumulator object initializer.
  5153. * @returns {Function} Returns the new aggregator function.
  5154. */
  5155. function createAggregator(setter, initializer) {
  5156. return function(collection, iteratee) {
  5157. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5158. accumulator = initializer ? initializer() : {};
  5159. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5160. };
  5161. }
  5162. /**
  5163. * Creates a function like `_.assign`.
  5164. *
  5165. * @private
  5166. * @param {Function} assigner The function to assign values.
  5167. * @returns {Function} Returns the new assigner function.
  5168. */
  5169. function createAssigner(assigner) {
  5170. return baseRest(function(object, sources) {
  5171. var index = -1,
  5172. length = sources.length,
  5173. customizer = length > 1 ? sources[length - 1] : undefined,
  5174. guard = length > 2 ? sources[2] : undefined;
  5175. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5176. ? (length--, customizer)
  5177. : undefined;
  5178. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5179. customizer = length < 3 ? undefined : customizer;
  5180. length = 1;
  5181. }
  5182. object = Object(object);
  5183. while (++index < length) {
  5184. var source = sources[index];
  5185. if (source) {
  5186. assigner(object, source, index, customizer);
  5187. }
  5188. }
  5189. return object;
  5190. });
  5191. }
  5192. /**
  5193. * Creates a `baseEach` or `baseEachRight` function.
  5194. *
  5195. * @private
  5196. * @param {Function} eachFunc The function to iterate over a collection.
  5197. * @param {boolean} [fromRight] Specify iterating from right to left.
  5198. * @returns {Function} Returns the new base function.
  5199. */
  5200. function createBaseEach(eachFunc, fromRight) {
  5201. return function(collection, iteratee) {
  5202. if (collection == null) {
  5203. return collection;
  5204. }
  5205. if (!isArrayLike(collection)) {
  5206. return eachFunc(collection, iteratee);
  5207. }
  5208. var length = collection.length,
  5209. index = fromRight ? length : -1,
  5210. iterable = Object(collection);
  5211. while ((fromRight ? index-- : ++index < length)) {
  5212. if (iteratee(iterable[index], index, iterable) === false) {
  5213. break;
  5214. }
  5215. }
  5216. return collection;
  5217. };
  5218. }
  5219. /**
  5220. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5221. *
  5222. * @private
  5223. * @param {boolean} [fromRight] Specify iterating from right to left.
  5224. * @returns {Function} Returns the new base function.
  5225. */
  5226. function createBaseFor(fromRight) {
  5227. return function(object, iteratee, keysFunc) {
  5228. var index = -1,
  5229. iterable = Object(object),
  5230. props = keysFunc(object),
  5231. length = props.length;
  5232. while (length--) {
  5233. var key = props[fromRight ? length : ++index];
  5234. if (iteratee(iterable[key], key, iterable) === false) {
  5235. break;
  5236. }
  5237. }
  5238. return object;
  5239. };
  5240. }
  5241. /**
  5242. * Creates a function that wraps `func` to invoke it with the optional `this`
  5243. * binding of `thisArg`.
  5244. *
  5245. * @private
  5246. * @param {Function} func The function to wrap.
  5247. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5248. * @param {*} [thisArg] The `this` binding of `func`.
  5249. * @returns {Function} Returns the new wrapped function.
  5250. */
  5251. function createBind(func, bitmask, thisArg) {
  5252. var isBind = bitmask & WRAP_BIND_FLAG,
  5253. Ctor = createCtor(func);
  5254. function wrapper() {
  5255. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5256. return fn.apply(isBind ? thisArg : this, arguments);
  5257. }
  5258. return wrapper;
  5259. }
  5260. /**
  5261. * Creates a function like `_.lowerFirst`.
  5262. *
  5263. * @private
  5264. * @param {string} methodName The name of the `String` case method to use.
  5265. * @returns {Function} Returns the new case function.
  5266. */
  5267. function createCaseFirst(methodName) {
  5268. return function(string) {
  5269. string = toString(string);
  5270. var strSymbols = hasUnicode(string)
  5271. ? stringToArray(string)
  5272. : undefined;
  5273. var chr = strSymbols
  5274. ? strSymbols[0]
  5275. : string.charAt(0);
  5276. var trailing = strSymbols
  5277. ? castSlice(strSymbols, 1).join('')
  5278. : string.slice(1);
  5279. return chr[methodName]() + trailing;
  5280. };
  5281. }
  5282. /**
  5283. * Creates a function like `_.camelCase`.
  5284. *
  5285. * @private
  5286. * @param {Function} callback The function to combine each word.
  5287. * @returns {Function} Returns the new compounder function.
  5288. */
  5289. function createCompounder(callback) {
  5290. return function(string) {
  5291. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5292. };
  5293. }
  5294. /**
  5295. * Creates a function that produces an instance of `Ctor` regardless of
  5296. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5297. *
  5298. * @private
  5299. * @param {Function} Ctor The constructor to wrap.
  5300. * @returns {Function} Returns the new wrapped function.
  5301. */
  5302. function createCtor(Ctor) {
  5303. return function() {
  5304. // Use a `switch` statement to work with class constructors. See
  5305. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5306. // for more details.
  5307. var args = arguments;
  5308. switch (args.length) {
  5309. case 0: return new Ctor;
  5310. case 1: return new Ctor(args[0]);
  5311. case 2: return new Ctor(args[0], args[1]);
  5312. case 3: return new Ctor(args[0], args[1], args[2]);
  5313. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5314. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5315. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5316. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5317. }
  5318. var thisBinding = baseCreate(Ctor.prototype),
  5319. result = Ctor.apply(thisBinding, args);
  5320. // Mimic the constructor's `return` behavior.
  5321. // See https://es5.github.io/#x13.2.2 for more details.
  5322. return isObject(result) ? result : thisBinding;
  5323. };
  5324. }
  5325. /**
  5326. * Creates a function that wraps `func` to enable currying.
  5327. *
  5328. * @private
  5329. * @param {Function} func The function to wrap.
  5330. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5331. * @param {number} arity The arity of `func`.
  5332. * @returns {Function} Returns the new wrapped function.
  5333. */
  5334. function createCurry(func, bitmask, arity) {
  5335. var Ctor = createCtor(func);
  5336. function wrapper() {
  5337. var length = arguments.length,
  5338. args = Array(length),
  5339. index = length,
  5340. placeholder = getHolder(wrapper);
  5341. while (index--) {
  5342. args[index] = arguments[index];
  5343. }
  5344. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5345. ? []
  5346. : replaceHolders(args, placeholder);
  5347. length -= holders.length;
  5348. if (length < arity) {
  5349. return createRecurry(
  5350. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5351. args, holders, undefined, undefined, arity - length);
  5352. }
  5353. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5354. return apply(fn, this, args);
  5355. }
  5356. return wrapper;
  5357. }
  5358. /**
  5359. * Creates a `_.find` or `_.findLast` function.
  5360. *
  5361. * @private
  5362. * @param {Function} findIndexFunc The function to find the collection index.
  5363. * @returns {Function} Returns the new find function.
  5364. */
  5365. function createFind(findIndexFunc) {
  5366. return function(collection, predicate, fromIndex) {
  5367. var iterable = Object(collection);
  5368. if (!isArrayLike(collection)) {
  5369. var iteratee = getIteratee(predicate, 3);
  5370. collection = keys(collection);
  5371. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5372. }
  5373. var index = findIndexFunc(collection, predicate, fromIndex);
  5374. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5375. };
  5376. }
  5377. /**
  5378. * Creates a `_.flow` or `_.flowRight` function.
  5379. *
  5380. * @private
  5381. * @param {boolean} [fromRight] Specify iterating from right to left.
  5382. * @returns {Function} Returns the new flow function.
  5383. */
  5384. function createFlow(fromRight) {
  5385. return flatRest(function(funcs) {
  5386. var length = funcs.length,
  5387. index = length,
  5388. prereq = LodashWrapper.prototype.thru;
  5389. if (fromRight) {
  5390. funcs.reverse();
  5391. }
  5392. while (index--) {
  5393. var func = funcs[index];
  5394. if (typeof func != 'function') {
  5395. throw new TypeError(FUNC_ERROR_TEXT);
  5396. }
  5397. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  5398. var wrapper = new LodashWrapper([], true);
  5399. }
  5400. }
  5401. index = wrapper ? index : length;
  5402. while (++index < length) {
  5403. func = funcs[index];
  5404. var funcName = getFuncName(func),
  5405. data = funcName == 'wrapper' ? getData(func) : undefined;
  5406. if (data && isLaziable(data[0]) &&
  5407. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  5408. !data[4].length && data[9] == 1
  5409. ) {
  5410. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  5411. } else {
  5412. wrapper = (func.length == 1 && isLaziable(func))
  5413. ? wrapper[funcName]()
  5414. : wrapper.thru(func);
  5415. }
  5416. }
  5417. return function() {
  5418. var args = arguments,
  5419. value = args[0];
  5420. if (wrapper && args.length == 1 && isArray(value)) {
  5421. return wrapper.plant(value).value();
  5422. }
  5423. var index = 0,
  5424. result = length ? funcs[index].apply(this, args) : value;
  5425. while (++index < length) {
  5426. result = funcs[index].call(this, result);
  5427. }
  5428. return result;
  5429. };
  5430. });
  5431. }
  5432. /**
  5433. * Creates a function that wraps `func` to invoke it with optional `this`
  5434. * binding of `thisArg`, partial application, and currying.
  5435. *
  5436. * @private
  5437. * @param {Function|string} func The function or method name to wrap.
  5438. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5439. * @param {*} [thisArg] The `this` binding of `func`.
  5440. * @param {Array} [partials] The arguments to prepend to those provided to
  5441. * the new function.
  5442. * @param {Array} [holders] The `partials` placeholder indexes.
  5443. * @param {Array} [partialsRight] The arguments to append to those provided
  5444. * to the new function.
  5445. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  5446. * @param {Array} [argPos] The argument positions of the new function.
  5447. * @param {number} [ary] The arity cap of `func`.
  5448. * @param {number} [arity] The arity of `func`.
  5449. * @returns {Function} Returns the new wrapped function.
  5450. */
  5451. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  5452. var isAry = bitmask & WRAP_ARY_FLAG,
  5453. isBind = bitmask & WRAP_BIND_FLAG,
  5454. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  5455. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  5456. isFlip = bitmask & WRAP_FLIP_FLAG,
  5457. Ctor = isBindKey ? undefined : createCtor(func);
  5458. function wrapper() {
  5459. var length = arguments.length,
  5460. args = Array(length),
  5461. index = length;
  5462. while (index--) {
  5463. args[index] = arguments[index];
  5464. }
  5465. if (isCurried) {
  5466. var placeholder = getHolder(wrapper),
  5467. holdersCount = countHolders(args, placeholder);
  5468. }
  5469. if (partials) {
  5470. args = composeArgs(args, partials, holders, isCurried);
  5471. }
  5472. if (partialsRight) {
  5473. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  5474. }
  5475. length -= holdersCount;
  5476. if (isCurried && length < arity) {
  5477. var newHolders = replaceHolders(args, placeholder);
  5478. return createRecurry(
  5479. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  5480. args, newHolders, argPos, ary, arity - length
  5481. );
  5482. }
  5483. var thisBinding = isBind ? thisArg : this,
  5484. fn = isBindKey ? thisBinding[func] : func;
  5485. length = args.length;
  5486. if (argPos) {
  5487. args = reorder(args, argPos);
  5488. } else if (isFlip && length > 1) {
  5489. args.reverse();
  5490. }
  5491. if (isAry && ary < length) {
  5492. args.length = ary;
  5493. }
  5494. if (this && this !== root && this instanceof wrapper) {
  5495. fn = Ctor || createCtor(fn);
  5496. }
  5497. return fn.apply(thisBinding, args);
  5498. }
  5499. return wrapper;
  5500. }
  5501. /**
  5502. * Creates a function like `_.invertBy`.
  5503. *
  5504. * @private
  5505. * @param {Function} setter The function to set accumulator values.
  5506. * @param {Function} toIteratee The function to resolve iteratees.
  5507. * @returns {Function} Returns the new inverter function.
  5508. */
  5509. function createInverter(setter, toIteratee) {
  5510. return function(object, iteratee) {
  5511. return baseInverter(object, setter, toIteratee(iteratee), {});
  5512. };
  5513. }
  5514. /**
  5515. * Creates a function that performs a mathematical operation on two values.
  5516. *
  5517. * @private
  5518. * @param {Function} operator The function to perform the operation.
  5519. * @param {number} [defaultValue] The value used for `undefined` arguments.
  5520. * @returns {Function} Returns the new mathematical operation function.
  5521. */
  5522. function createMathOperation(operator, defaultValue) {
  5523. return function(value, other) {
  5524. var result;
  5525. if (value === undefined && other === undefined) {
  5526. return defaultValue;
  5527. }
  5528. if (value !== undefined) {
  5529. result = value;
  5530. }
  5531. if (other !== undefined) {
  5532. if (result === undefined) {
  5533. return other;
  5534. }
  5535. if (typeof value == 'string' || typeof other == 'string') {
  5536. value = baseToString(value);
  5537. other = baseToString(other);
  5538. } else {
  5539. value = baseToNumber(value);
  5540. other = baseToNumber(other);
  5541. }
  5542. result = operator(value, other);
  5543. }
  5544. return result;
  5545. };
  5546. }
  5547. /**
  5548. * Creates a function like `_.over`.
  5549. *
  5550. * @private
  5551. * @param {Function} arrayFunc The function to iterate over iteratees.
  5552. * @returns {Function} Returns the new over function.
  5553. */
  5554. function createOver(arrayFunc) {
  5555. return flatRest(function(iteratees) {
  5556. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5557. return baseRest(function(args) {
  5558. var thisArg = this;
  5559. return arrayFunc(iteratees, function(iteratee) {
  5560. return apply(iteratee, thisArg, args);
  5561. });
  5562. });
  5563. });
  5564. }
  5565. /**
  5566. * Creates the padding for `string` based on `length`. The `chars` string
  5567. * is truncated if the number of characters exceeds `length`.
  5568. *
  5569. * @private
  5570. * @param {number} length The padding length.
  5571. * @param {string} [chars=' '] The string used as padding.
  5572. * @returns {string} Returns the padding for `string`.
  5573. */
  5574. function createPadding(length, chars) {
  5575. chars = chars === undefined ? ' ' : baseToString(chars);
  5576. var charsLength = chars.length;
  5577. if (charsLength < 2) {
  5578. return charsLength ? baseRepeat(chars, length) : chars;
  5579. }
  5580. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  5581. return hasUnicode(chars)
  5582. ? castSlice(stringToArray(result), 0, length).join('')
  5583. : result.slice(0, length);
  5584. }
  5585. /**
  5586. * Creates a function that wraps `func` to invoke it with the `this` binding
  5587. * of `thisArg` and `partials` prepended to the arguments it receives.
  5588. *
  5589. * @private
  5590. * @param {Function} func The function to wrap.
  5591. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5592. * @param {*} thisArg The `this` binding of `func`.
  5593. * @param {Array} partials The arguments to prepend to those provided to
  5594. * the new function.
  5595. * @returns {Function} Returns the new wrapped function.
  5596. */
  5597. function createPartial(func, bitmask, thisArg, partials) {
  5598. var isBind = bitmask & WRAP_BIND_FLAG,
  5599. Ctor = createCtor(func);
  5600. function wrapper() {
  5601. var argsIndex = -1,
  5602. argsLength = arguments.length,
  5603. leftIndex = -1,
  5604. leftLength = partials.length,
  5605. args = Array(leftLength + argsLength),
  5606. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5607. while (++leftIndex < leftLength) {
  5608. args[leftIndex] = partials[leftIndex];
  5609. }
  5610. while (argsLength--) {
  5611. args[leftIndex++] = arguments[++argsIndex];
  5612. }
  5613. return apply(fn, isBind ? thisArg : this, args);
  5614. }
  5615. return wrapper;
  5616. }
  5617. /**
  5618. * Creates a `_.range` or `_.rangeRight` function.
  5619. *
  5620. * @private
  5621. * @param {boolean} [fromRight] Specify iterating from right to left.
  5622. * @returns {Function} Returns the new range function.
  5623. */
  5624. function createRange(fromRight) {
  5625. return function(start, end, step) {
  5626. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  5627. end = step = undefined;
  5628. }
  5629. // Ensure the sign of `-0` is preserved.
  5630. start = toFinite(start);
  5631. if (end === undefined) {
  5632. end = start;
  5633. start = 0;
  5634. } else {
  5635. end = toFinite(end);
  5636. }
  5637. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  5638. return baseRange(start, end, step, fromRight);
  5639. };
  5640. }
  5641. /**
  5642. * Creates a function that performs a relational operation on two values.
  5643. *
  5644. * @private
  5645. * @param {Function} operator The function to perform the operation.
  5646. * @returns {Function} Returns the new relational operation function.
  5647. */
  5648. function createRelationalOperation(operator) {
  5649. return function(value, other) {
  5650. if (!(typeof value == 'string' && typeof other == 'string')) {
  5651. value = toNumber(value);
  5652. other = toNumber(other);
  5653. }
  5654. return operator(value, other);
  5655. };
  5656. }
  5657. /**
  5658. * Creates a function that wraps `func` to continue currying.
  5659. *
  5660. * @private
  5661. * @param {Function} func The function to wrap.
  5662. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5663. * @param {Function} wrapFunc The function to create the `func` wrapper.
  5664. * @param {*} placeholder The placeholder value.
  5665. * @param {*} [thisArg] The `this` binding of `func`.
  5666. * @param {Array} [partials] The arguments to prepend to those provided to
  5667. * the new function.
  5668. * @param {Array} [holders] The `partials` placeholder indexes.
  5669. * @param {Array} [argPos] The argument positions of the new function.
  5670. * @param {number} [ary] The arity cap of `func`.
  5671. * @param {number} [arity] The arity of `func`.
  5672. * @returns {Function} Returns the new wrapped function.
  5673. */
  5674. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  5675. var isCurry = bitmask & WRAP_CURRY_FLAG,
  5676. newHolders = isCurry ? holders : undefined,
  5677. newHoldersRight = isCurry ? undefined : holders,
  5678. newPartials = isCurry ? partials : undefined,
  5679. newPartialsRight = isCurry ? undefined : partials;
  5680. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  5681. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  5682. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  5683. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  5684. }
  5685. var newData = [
  5686. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  5687. newHoldersRight, argPos, ary, arity
  5688. ];
  5689. var result = wrapFunc.apply(undefined, newData);
  5690. if (isLaziable(func)) {
  5691. setData(result, newData);
  5692. }
  5693. result.placeholder = placeholder;
  5694. return setWrapToString(result, func, bitmask);
  5695. }
  5696. /**
  5697. * Creates a function like `_.round`.
  5698. *
  5699. * @private
  5700. * @param {string} methodName The name of the `Math` method to use when rounding.
  5701. * @returns {Function} Returns the new round function.
  5702. */
  5703. function createRound(methodName) {
  5704. var func = Math[methodName];
  5705. return function(number, precision) {
  5706. number = toNumber(number);
  5707. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  5708. if (precision) {
  5709. // Shift with exponential notation to avoid floating-point issues.
  5710. // See [MDN](https://mdn.io/round#Examples) for more details.
  5711. var pair = (toString(number) + 'e').split('e'),
  5712. value = func(pair[0] + 'e' + (+pair[1] + precision));
  5713. pair = (toString(value) + 'e').split('e');
  5714. return +(pair[0] + 'e' + (+pair[1] - precision));
  5715. }
  5716. return func(number);
  5717. };
  5718. }
  5719. /**
  5720. * Creates a set object of `values`.
  5721. *
  5722. * @private
  5723. * @param {Array} values The values to add to the set.
  5724. * @returns {Object} Returns the new set.
  5725. */
  5726. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5727. return new Set(values);
  5728. };
  5729. /**
  5730. * Creates a `_.toPairs` or `_.toPairsIn` function.
  5731. *
  5732. * @private
  5733. * @param {Function} keysFunc The function to get the keys of a given object.
  5734. * @returns {Function} Returns the new pairs function.
  5735. */
  5736. function createToPairs(keysFunc) {
  5737. return function(object) {
  5738. var tag = getTag(object);
  5739. if (tag == mapTag) {
  5740. return mapToArray(object);
  5741. }
  5742. if (tag == setTag) {
  5743. return setToPairs(object);
  5744. }
  5745. return baseToPairs(object, keysFunc(object));
  5746. };
  5747. }
  5748. /**
  5749. * Creates a function that either curries or invokes `func` with optional
  5750. * `this` binding and partially applied arguments.
  5751. *
  5752. * @private
  5753. * @param {Function|string} func The function or method name to wrap.
  5754. * @param {number} bitmask The bitmask flags.
  5755. * 1 - `_.bind`
  5756. * 2 - `_.bindKey`
  5757. * 4 - `_.curry` or `_.curryRight` of a bound function
  5758. * 8 - `_.curry`
  5759. * 16 - `_.curryRight`
  5760. * 32 - `_.partial`
  5761. * 64 - `_.partialRight`
  5762. * 128 - `_.rearg`
  5763. * 256 - `_.ary`
  5764. * 512 - `_.flip`
  5765. * @param {*} [thisArg] The `this` binding of `func`.
  5766. * @param {Array} [partials] The arguments to be partially applied.
  5767. * @param {Array} [holders] The `partials` placeholder indexes.
  5768. * @param {Array} [argPos] The argument positions of the new function.
  5769. * @param {number} [ary] The arity cap of `func`.
  5770. * @param {number} [arity] The arity of `func`.
  5771. * @returns {Function} Returns the new wrapped function.
  5772. */
  5773. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  5774. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  5775. if (!isBindKey && typeof func != 'function') {
  5776. throw new TypeError(FUNC_ERROR_TEXT);
  5777. }
  5778. var length = partials ? partials.length : 0;
  5779. if (!length) {
  5780. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  5781. partials = holders = undefined;
  5782. }
  5783. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  5784. arity = arity === undefined ? arity : toInteger(arity);
  5785. length -= holders ? holders.length : 0;
  5786. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  5787. var partialsRight = partials,
  5788. holdersRight = holders;
  5789. partials = holders = undefined;
  5790. }
  5791. var data = isBindKey ? undefined : getData(func);
  5792. var newData = [
  5793. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  5794. argPos, ary, arity
  5795. ];
  5796. if (data) {
  5797. mergeData(newData, data);
  5798. }
  5799. func = newData[0];
  5800. bitmask = newData[1];
  5801. thisArg = newData[2];
  5802. partials = newData[3];
  5803. holders = newData[4];
  5804. arity = newData[9] = newData[9] === undefined
  5805. ? (isBindKey ? 0 : func.length)
  5806. : nativeMax(newData[9] - length, 0);
  5807. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  5808. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  5809. }
  5810. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  5811. var result = createBind(func, bitmask, thisArg);
  5812. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  5813. result = createCurry(func, bitmask, arity);
  5814. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  5815. result = createPartial(func, bitmask, thisArg, partials);
  5816. } else {
  5817. result = createHybrid.apply(undefined, newData);
  5818. }
  5819. var setter = data ? baseSetData : setData;
  5820. return setWrapToString(setter(result, newData), func, bitmask);
  5821. }
  5822. /**
  5823. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  5824. * of source objects to the destination object for all destination properties
  5825. * that resolve to `undefined`.
  5826. *
  5827. * @private
  5828. * @param {*} objValue The destination value.
  5829. * @param {*} srcValue The source value.
  5830. * @param {string} key The key of the property to assign.
  5831. * @param {Object} object The parent object of `objValue`.
  5832. * @returns {*} Returns the value to assign.
  5833. */
  5834. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5835. if (objValue === undefined ||
  5836. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  5837. return srcValue;
  5838. }
  5839. return objValue;
  5840. }
  5841. /**
  5842. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  5843. * objects into destination objects that are passed thru.
  5844. *
  5845. * @private
  5846. * @param {*} objValue The destination value.
  5847. * @param {*} srcValue The source value.
  5848. * @param {string} key The key of the property to merge.
  5849. * @param {Object} object The parent object of `objValue`.
  5850. * @param {Object} source The parent object of `srcValue`.
  5851. * @param {Object} [stack] Tracks traversed source values and their merged
  5852. * counterparts.
  5853. * @returns {*} Returns the value to assign.
  5854. */
  5855. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  5856. if (isObject(objValue) && isObject(srcValue)) {
  5857. // Recursively merge objects and arrays (susceptible to call stack limits).
  5858. stack.set(srcValue, objValue);
  5859. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  5860. stack['delete'](srcValue);
  5861. }
  5862. return objValue;
  5863. }
  5864. /**
  5865. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  5866. * objects.
  5867. *
  5868. * @private
  5869. * @param {*} value The value to inspect.
  5870. * @param {string} key The key of the property to inspect.
  5871. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  5872. */
  5873. function customOmitClone(value) {
  5874. return isPlainObject(value) ? undefined : value;
  5875. }
  5876. /**
  5877. * A specialized version of `baseIsEqualDeep` for arrays with support for
  5878. * partial deep comparisons.
  5879. *
  5880. * @private
  5881. * @param {Array} array The array to compare.
  5882. * @param {Array} other The other array to compare.
  5883. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  5884. * @param {Function} customizer The function to customize comparisons.
  5885. * @param {Function} equalFunc The function to determine equivalents of values.
  5886. * @param {Object} stack Tracks traversed `array` and `other` objects.
  5887. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  5888. */
  5889. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  5890. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  5891. arrLength = array.length,
  5892. othLength = other.length;
  5893. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  5894. return false;
  5895. }
  5896. // Assume cyclic values are equal.
  5897. var stacked = stack.get(array);
  5898. if (stacked && stack.get(other)) {
  5899. return stacked == other;
  5900. }
  5901. var index = -1,
  5902. result = true,
  5903. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  5904. stack.set(array, other);
  5905. stack.set(other, array);
  5906. // Ignore non-index properties.
  5907. while (++index < arrLength) {
  5908. var arrValue = array[index],
  5909. othValue = other[index];
  5910. if (customizer) {
  5911. var compared = isPartial
  5912. ? customizer(othValue, arrValue, index, other, array, stack)
  5913. : customizer(arrValue, othValue, index, array, other, stack);
  5914. }
  5915. if (compared !== undefined) {
  5916. if (compared) {
  5917. continue;
  5918. }
  5919. result = false;
  5920. break;
  5921. }
  5922. // Recursively compare arrays (susceptible to call stack limits).
  5923. if (seen) {
  5924. if (!arraySome(other, function(othValue, othIndex) {
  5925. if (!cacheHas(seen, othIndex) &&
  5926. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  5927. return seen.push(othIndex);
  5928. }
  5929. })) {
  5930. result = false;
  5931. break;
  5932. }
  5933. } else if (!(
  5934. arrValue === othValue ||
  5935. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  5936. )) {
  5937. result = false;
  5938. break;
  5939. }
  5940. }
  5941. stack['delete'](array);
  5942. stack['delete'](other);
  5943. return result;
  5944. }
  5945. /**
  5946. * A specialized version of `baseIsEqualDeep` for comparing objects of
  5947. * the same `toStringTag`.
  5948. *
  5949. * **Note:** This function only supports comparing values with tags of
  5950. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5951. *
  5952. * @private
  5953. * @param {Object} object The object to compare.
  5954. * @param {Object} other The other object to compare.
  5955. * @param {string} tag The `toStringTag` of the objects to compare.
  5956. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  5957. * @param {Function} customizer The function to customize comparisons.
  5958. * @param {Function} equalFunc The function to determine equivalents of values.
  5959. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5960. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5961. */
  5962. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  5963. switch (tag) {
  5964. case dataViewTag:
  5965. if ((object.byteLength != other.byteLength) ||
  5966. (object.byteOffset != other.byteOffset)) {
  5967. return false;
  5968. }
  5969. object = object.buffer;
  5970. other = other.buffer;
  5971. case arrayBufferTag:
  5972. if ((object.byteLength != other.byteLength) ||
  5973. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  5974. return false;
  5975. }
  5976. return true;
  5977. case boolTag:
  5978. case dateTag:
  5979. case numberTag:
  5980. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5981. // Invalid dates are coerced to `NaN`.
  5982. return eq(+object, +other);
  5983. case errorTag:
  5984. return object.name == other.name && object.message == other.message;
  5985. case regexpTag:
  5986. case stringTag:
  5987. // Coerce regexes to strings and treat strings, primitives and objects,
  5988. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5989. // for more details.
  5990. return object == (other + '');
  5991. case mapTag:
  5992. var convert = mapToArray;
  5993. case setTag:
  5994. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  5995. convert || (convert = setToArray);
  5996. if (object.size != other.size && !isPartial) {
  5997. return false;
  5998. }
  5999. // Assume cyclic values are equal.
  6000. var stacked = stack.get(object);
  6001. if (stacked) {
  6002. return stacked == other;
  6003. }
  6004. bitmask |= COMPARE_UNORDERED_FLAG;
  6005. // Recursively compare objects (susceptible to call stack limits).
  6006. stack.set(object, other);
  6007. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6008. stack['delete'](object);
  6009. return result;
  6010. case symbolTag:
  6011. if (symbolValueOf) {
  6012. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6013. }
  6014. }
  6015. return false;
  6016. }
  6017. /**
  6018. * A specialized version of `baseIsEqualDeep` for objects with support for
  6019. * partial deep comparisons.
  6020. *
  6021. * @private
  6022. * @param {Object} object The object to compare.
  6023. * @param {Object} other The other object 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 `object` and `other` objects.
  6028. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6029. */
  6030. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6031. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6032. objProps = getAllKeys(object),
  6033. objLength = objProps.length,
  6034. othProps = getAllKeys(other),
  6035. othLength = othProps.length;
  6036. if (objLength != othLength && !isPartial) {
  6037. return false;
  6038. }
  6039. var index = objLength;
  6040. while (index--) {
  6041. var key = objProps[index];
  6042. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6043. return false;
  6044. }
  6045. }
  6046. // Assume cyclic values are equal.
  6047. var stacked = stack.get(object);
  6048. if (stacked && stack.get(other)) {
  6049. return stacked == other;
  6050. }
  6051. var result = true;
  6052. stack.set(object, other);
  6053. stack.set(other, object);
  6054. var skipCtor = isPartial;
  6055. while (++index < objLength) {
  6056. key = objProps[index];
  6057. var objValue = object[key],
  6058. othValue = other[key];
  6059. if (customizer) {
  6060. var compared = isPartial
  6061. ? customizer(othValue, objValue, key, other, object, stack)
  6062. : customizer(objValue, othValue, key, object, other, stack);
  6063. }
  6064. // Recursively compare objects (susceptible to call stack limits).
  6065. if (!(compared === undefined
  6066. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6067. : compared
  6068. )) {
  6069. result = false;
  6070. break;
  6071. }
  6072. skipCtor || (skipCtor = key == 'constructor');
  6073. }
  6074. if (result && !skipCtor) {
  6075. var objCtor = object.constructor,
  6076. othCtor = other.constructor;
  6077. // Non `Object` object instances with different constructors are not equal.
  6078. if (objCtor != othCtor &&
  6079. ('constructor' in object && 'constructor' in other) &&
  6080. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6081. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6082. result = false;
  6083. }
  6084. }
  6085. stack['delete'](object);
  6086. stack['delete'](other);
  6087. return result;
  6088. }
  6089. /**
  6090. * A specialized version of `baseRest` which flattens the rest array.
  6091. *
  6092. * @private
  6093. * @param {Function} func The function to apply a rest parameter to.
  6094. * @returns {Function} Returns the new function.
  6095. */
  6096. function flatRest(func) {
  6097. return setToString(overRest(func, undefined, flatten), func + '');
  6098. }
  6099. /**
  6100. * Creates an array of own enumerable property names and symbols of `object`.
  6101. *
  6102. * @private
  6103. * @param {Object} object The object to query.
  6104. * @returns {Array} Returns the array of property names and symbols.
  6105. */
  6106. function getAllKeys(object) {
  6107. return baseGetAllKeys(object, keys, getSymbols);
  6108. }
  6109. /**
  6110. * Creates an array of own and inherited enumerable property names and
  6111. * symbols of `object`.
  6112. *
  6113. * @private
  6114. * @param {Object} object The object to query.
  6115. * @returns {Array} Returns the array of property names and symbols.
  6116. */
  6117. function getAllKeysIn(object) {
  6118. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6119. }
  6120. /**
  6121. * Gets metadata for `func`.
  6122. *
  6123. * @private
  6124. * @param {Function} func The function to query.
  6125. * @returns {*} Returns the metadata for `func`.
  6126. */
  6127. var getData = !metaMap ? noop : function(func) {
  6128. return metaMap.get(func);
  6129. };
  6130. /**
  6131. * Gets the name of `func`.
  6132. *
  6133. * @private
  6134. * @param {Function} func The function to query.
  6135. * @returns {string} Returns the function name.
  6136. */
  6137. function getFuncName(func) {
  6138. var result = (func.name + ''),
  6139. array = realNames[result],
  6140. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6141. while (length--) {
  6142. var data = array[length],
  6143. otherFunc = data.func;
  6144. if (otherFunc == null || otherFunc == func) {
  6145. return data.name;
  6146. }
  6147. }
  6148. return result;
  6149. }
  6150. /**
  6151. * Gets the argument placeholder value for `func`.
  6152. *
  6153. * @private
  6154. * @param {Function} func The function to inspect.
  6155. * @returns {*} Returns the placeholder value.
  6156. */
  6157. function getHolder(func) {
  6158. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6159. return object.placeholder;
  6160. }
  6161. /**
  6162. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6163. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6164. * If arguments are provided, the chosen function is invoked with them and
  6165. * its result is returned.
  6166. *
  6167. * @private
  6168. * @param {*} [value] The value to convert to an iteratee.
  6169. * @param {number} [arity] The arity of the created iteratee.
  6170. * @returns {Function} Returns the chosen function or its result.
  6171. */
  6172. function getIteratee() {
  6173. var result = lodash.iteratee || iteratee;
  6174. result = result === iteratee ? baseIteratee : result;
  6175. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6176. }
  6177. /**
  6178. * Gets the data for `map`.
  6179. *
  6180. * @private
  6181. * @param {Object} map The map to query.
  6182. * @param {string} key The reference key.
  6183. * @returns {*} Returns the map data.
  6184. */
  6185. function getMapData(map, key) {
  6186. var data = map.__data__;
  6187. return isKeyable(key)
  6188. ? data[typeof key == 'string' ? 'string' : 'hash']
  6189. : data.map;
  6190. }
  6191. /**
  6192. * Gets the property names, values, and compare flags of `object`.
  6193. *
  6194. * @private
  6195. * @param {Object} object The object to query.
  6196. * @returns {Array} Returns the match data of `object`.
  6197. */
  6198. function getMatchData(object) {
  6199. var result = keys(object),
  6200. length = result.length;
  6201. while (length--) {
  6202. var key = result[length],
  6203. value = object[key];
  6204. result[length] = [key, value, isStrictComparable(value)];
  6205. }
  6206. return result;
  6207. }
  6208. /**
  6209. * Gets the native function at `key` of `object`.
  6210. *
  6211. * @private
  6212. * @param {Object} object The object to query.
  6213. * @param {string} key The key of the method to get.
  6214. * @returns {*} Returns the function if it's native, else `undefined`.
  6215. */
  6216. function getNative(object, key) {
  6217. var value = getValue(object, key);
  6218. return baseIsNative(value) ? value : undefined;
  6219. }
  6220. /**
  6221. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6222. *
  6223. * @private
  6224. * @param {*} value The value to query.
  6225. * @returns {string} Returns the raw `toStringTag`.
  6226. */
  6227. function getRawTag(value) {
  6228. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6229. tag = value[symToStringTag];
  6230. try {
  6231. value[symToStringTag] = undefined;
  6232. var unmasked = true;
  6233. } catch (e) {}
  6234. var result = nativeObjectToString.call(value);
  6235. if (unmasked) {
  6236. if (isOwn) {
  6237. value[symToStringTag] = tag;
  6238. } else {
  6239. delete value[symToStringTag];
  6240. }
  6241. }
  6242. return result;
  6243. }
  6244. /**
  6245. * Creates an array of the own enumerable symbols of `object`.
  6246. *
  6247. * @private
  6248. * @param {Object} object The object to query.
  6249. * @returns {Array} Returns the array of symbols.
  6250. */
  6251. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6252. if (object == null) {
  6253. return [];
  6254. }
  6255. object = Object(object);
  6256. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6257. return propertyIsEnumerable.call(object, symbol);
  6258. });
  6259. };
  6260. /**
  6261. * Creates an array of the own and inherited enumerable symbols of `object`.
  6262. *
  6263. * @private
  6264. * @param {Object} object The object to query.
  6265. * @returns {Array} Returns the array of symbols.
  6266. */
  6267. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6268. var result = [];
  6269. while (object) {
  6270. arrayPush(result, getSymbols(object));
  6271. object = getPrototype(object);
  6272. }
  6273. return result;
  6274. };
  6275. /**
  6276. * Gets the `toStringTag` of `value`.
  6277. *
  6278. * @private
  6279. * @param {*} value The value to query.
  6280. * @returns {string} Returns the `toStringTag`.
  6281. */
  6282. var getTag = baseGetTag;
  6283. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6284. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6285. (Map && getTag(new Map) != mapTag) ||
  6286. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6287. (Set && getTag(new Set) != setTag) ||
  6288. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6289. getTag = function(value) {
  6290. var result = baseGetTag(value),
  6291. Ctor = result == objectTag ? value.constructor : undefined,
  6292. ctorString = Ctor ? toSource(Ctor) : '';
  6293. if (ctorString) {
  6294. switch (ctorString) {
  6295. case dataViewCtorString: return dataViewTag;
  6296. case mapCtorString: return mapTag;
  6297. case promiseCtorString: return promiseTag;
  6298. case setCtorString: return setTag;
  6299. case weakMapCtorString: return weakMapTag;
  6300. }
  6301. }
  6302. return result;
  6303. };
  6304. }
  6305. /**
  6306. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6307. *
  6308. * @private
  6309. * @param {number} start The start of the view.
  6310. * @param {number} end The end of the view.
  6311. * @param {Array} transforms The transformations to apply to the view.
  6312. * @returns {Object} Returns an object containing the `start` and `end`
  6313. * positions of the view.
  6314. */
  6315. function getView(start, end, transforms) {
  6316. var index = -1,
  6317. length = transforms.length;
  6318. while (++index < length) {
  6319. var data = transforms[index],
  6320. size = data.size;
  6321. switch (data.type) {
  6322. case 'drop': start += size; break;
  6323. case 'dropRight': end -= size; break;
  6324. case 'take': end = nativeMin(end, start + size); break;
  6325. case 'takeRight': start = nativeMax(start, end - size); break;
  6326. }
  6327. }
  6328. return { 'start': start, 'end': end };
  6329. }
  6330. /**
  6331. * Extracts wrapper details from the `source` body comment.
  6332. *
  6333. * @private
  6334. * @param {string} source The source to inspect.
  6335. * @returns {Array} Returns the wrapper details.
  6336. */
  6337. function getWrapDetails(source) {
  6338. var match = source.match(reWrapDetails);
  6339. return match ? match[1].split(reSplitDetails) : [];
  6340. }
  6341. /**
  6342. * Checks if `path` exists on `object`.
  6343. *
  6344. * @private
  6345. * @param {Object} object The object to query.
  6346. * @param {Array|string} path The path to check.
  6347. * @param {Function} hasFunc The function to check properties.
  6348. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6349. */
  6350. function hasPath(object, path, hasFunc) {
  6351. path = castPath(path, object);
  6352. var index = -1,
  6353. length = path.length,
  6354. result = false;
  6355. while (++index < length) {
  6356. var key = toKey(path[index]);
  6357. if (!(result = object != null && hasFunc(object, key))) {
  6358. break;
  6359. }
  6360. object = object[key];
  6361. }
  6362. if (result || ++index != length) {
  6363. return result;
  6364. }
  6365. length = object == null ? 0 : object.length;
  6366. return !!length && isLength(length) && isIndex(key, length) &&
  6367. (isArray(object) || isArguments(object));
  6368. }
  6369. /**
  6370. * Initializes an array clone.
  6371. *
  6372. * @private
  6373. * @param {Array} array The array to clone.
  6374. * @returns {Array} Returns the initialized clone.
  6375. */
  6376. function initCloneArray(array) {
  6377. var length = array.length,
  6378. result = array.constructor(length);
  6379. // Add properties assigned by `RegExp#exec`.
  6380. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6381. result.index = array.index;
  6382. result.input = array.input;
  6383. }
  6384. return result;
  6385. }
  6386. /**
  6387. * Initializes an object clone.
  6388. *
  6389. * @private
  6390. * @param {Object} object The object to clone.
  6391. * @returns {Object} Returns the initialized clone.
  6392. */
  6393. function initCloneObject(object) {
  6394. return (typeof object.constructor == 'function' && !isPrototype(object))
  6395. ? baseCreate(getPrototype(object))
  6396. : {};
  6397. }
  6398. /**
  6399. * Initializes an object clone based on its `toStringTag`.
  6400. *
  6401. * **Note:** This function only supports cloning values with tags of
  6402. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6403. *
  6404. * @private
  6405. * @param {Object} object The object to clone.
  6406. * @param {string} tag The `toStringTag` of the object to clone.
  6407. * @param {Function} cloneFunc The function to clone values.
  6408. * @param {boolean} [isDeep] Specify a deep clone.
  6409. * @returns {Object} Returns the initialized clone.
  6410. */
  6411. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  6412. var Ctor = object.constructor;
  6413. switch (tag) {
  6414. case arrayBufferTag:
  6415. return cloneArrayBuffer(object);
  6416. case boolTag:
  6417. case dateTag:
  6418. return new Ctor(+object);
  6419. case dataViewTag:
  6420. return cloneDataView(object, isDeep);
  6421. case float32Tag: case float64Tag:
  6422. case int8Tag: case int16Tag: case int32Tag:
  6423. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  6424. return cloneTypedArray(object, isDeep);
  6425. case mapTag:
  6426. return cloneMap(object, isDeep, cloneFunc);
  6427. case numberTag:
  6428. case stringTag:
  6429. return new Ctor(object);
  6430. case regexpTag:
  6431. return cloneRegExp(object);
  6432. case setTag:
  6433. return cloneSet(object, isDeep, cloneFunc);
  6434. case symbolTag:
  6435. return cloneSymbol(object);
  6436. }
  6437. }
  6438. /**
  6439. * Inserts wrapper `details` in a comment at the top of the `source` body.
  6440. *
  6441. * @private
  6442. * @param {string} source The source to modify.
  6443. * @returns {Array} details The details to insert.
  6444. * @returns {string} Returns the modified source.
  6445. */
  6446. function insertWrapDetails(source, details) {
  6447. var length = details.length;
  6448. if (!length) {
  6449. return source;
  6450. }
  6451. var lastIndex = length - 1;
  6452. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  6453. details = details.join(length > 2 ? ', ' : ' ');
  6454. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  6455. }
  6456. /**
  6457. * Checks if `value` is a flattenable `arguments` object or array.
  6458. *
  6459. * @private
  6460. * @param {*} value The value to check.
  6461. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  6462. */
  6463. function isFlattenable(value) {
  6464. return isArray(value) || isArguments(value) ||
  6465. !!(spreadableSymbol && value && value[spreadableSymbol]);
  6466. }
  6467. /**
  6468. * Checks if `value` is a valid array-like index.
  6469. *
  6470. * @private
  6471. * @param {*} value The value to check.
  6472. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6473. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6474. */
  6475. function isIndex(value, length) {
  6476. length = length == null ? MAX_SAFE_INTEGER : length;
  6477. return !!length &&
  6478. (typeof value == 'number' || reIsUint.test(value)) &&
  6479. (value > -1 && value % 1 == 0 && value < length);
  6480. }
  6481. /**
  6482. * Checks if the given arguments are from an iteratee call.
  6483. *
  6484. * @private
  6485. * @param {*} value The potential iteratee value argument.
  6486. * @param {*} index The potential iteratee index or key argument.
  6487. * @param {*} object The potential iteratee object argument.
  6488. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  6489. * else `false`.
  6490. */
  6491. function isIterateeCall(value, index, object) {
  6492. if (!isObject(object)) {
  6493. return false;
  6494. }
  6495. var type = typeof index;
  6496. if (type == 'number'
  6497. ? (isArrayLike(object) && isIndex(index, object.length))
  6498. : (type == 'string' && index in object)
  6499. ) {
  6500. return eq(object[index], value);
  6501. }
  6502. return false;
  6503. }
  6504. /**
  6505. * Checks if `value` is a property name and not a property path.
  6506. *
  6507. * @private
  6508. * @param {*} value The value to check.
  6509. * @param {Object} [object] The object to query keys on.
  6510. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6511. */
  6512. function isKey(value, object) {
  6513. if (isArray(value)) {
  6514. return false;
  6515. }
  6516. var type = typeof value;
  6517. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6518. value == null || isSymbol(value)) {
  6519. return true;
  6520. }
  6521. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6522. (object != null && value in Object(object));
  6523. }
  6524. /**
  6525. * Checks if `value` is suitable for use as unique object key.
  6526. *
  6527. * @private
  6528. * @param {*} value The value to check.
  6529. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6530. */
  6531. function isKeyable(value) {
  6532. var type = typeof value;
  6533. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6534. ? (value !== '__proto__')
  6535. : (value === null);
  6536. }
  6537. /**
  6538. * Checks if `func` has a lazy counterpart.
  6539. *
  6540. * @private
  6541. * @param {Function} func The function to check.
  6542. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  6543. * else `false`.
  6544. */
  6545. function isLaziable(func) {
  6546. var funcName = getFuncName(func),
  6547. other = lodash[funcName];
  6548. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  6549. return false;
  6550. }
  6551. if (func === other) {
  6552. return true;
  6553. }
  6554. var data = getData(other);
  6555. return !!data && func === data[0];
  6556. }
  6557. /**
  6558. * Checks if `func` has its source masked.
  6559. *
  6560. * @private
  6561. * @param {Function} func The function to check.
  6562. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6563. */
  6564. function isMasked(func) {
  6565. return !!maskSrcKey && (maskSrcKey in func);
  6566. }
  6567. /**
  6568. * Checks if `func` is capable of being masked.
  6569. *
  6570. * @private
  6571. * @param {*} value The value to check.
  6572. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  6573. */
  6574. var isMaskable = coreJsData ? isFunction : stubFalse;
  6575. /**
  6576. * Checks if `value` is likely a prototype object.
  6577. *
  6578. * @private
  6579. * @param {*} value The value to check.
  6580. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6581. */
  6582. function isPrototype(value) {
  6583. var Ctor = value && value.constructor,
  6584. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6585. return value === proto;
  6586. }
  6587. /**
  6588. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6589. *
  6590. * @private
  6591. * @param {*} value The value to check.
  6592. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6593. * equality comparisons, else `false`.
  6594. */
  6595. function isStrictComparable(value) {
  6596. return value === value && !isObject(value);
  6597. }
  6598. /**
  6599. * A specialized version of `matchesProperty` for source values suitable
  6600. * for strict equality comparisons, i.e. `===`.
  6601. *
  6602. * @private
  6603. * @param {string} key The key of the property to get.
  6604. * @param {*} srcValue The value to match.
  6605. * @returns {Function} Returns the new spec function.
  6606. */
  6607. function matchesStrictComparable(key, srcValue) {
  6608. return function(object) {
  6609. if (object == null) {
  6610. return false;
  6611. }
  6612. return object[key] === srcValue &&
  6613. (srcValue !== undefined || (key in Object(object)));
  6614. };
  6615. }
  6616. /**
  6617. * A specialized version of `_.memoize` which clears the memoized function's
  6618. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  6619. *
  6620. * @private
  6621. * @param {Function} func The function to have its output memoized.
  6622. * @returns {Function} Returns the new memoized function.
  6623. */
  6624. function memoizeCapped(func) {
  6625. var result = memoize(func, function(key) {
  6626. if (cache.size === MAX_MEMOIZE_SIZE) {
  6627. cache.clear();
  6628. }
  6629. return key;
  6630. });
  6631. var cache = result.cache;
  6632. return result;
  6633. }
  6634. /**
  6635. * Merges the function metadata of `source` into `data`.
  6636. *
  6637. * Merging metadata reduces the number of wrappers used to invoke a function.
  6638. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  6639. * may be applied regardless of execution order. Methods like `_.ary` and
  6640. * `_.rearg` modify function arguments, making the order in which they are
  6641. * executed important, preventing the merging of metadata. However, we make
  6642. * an exception for a safe combined case where curried functions have `_.ary`
  6643. * and or `_.rearg` applied.
  6644. *
  6645. * @private
  6646. * @param {Array} data The destination metadata.
  6647. * @param {Array} source The source metadata.
  6648. * @returns {Array} Returns `data`.
  6649. */
  6650. function mergeData(data, source) {
  6651. var bitmask = data[1],
  6652. srcBitmask = source[1],
  6653. newBitmask = bitmask | srcBitmask,
  6654. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  6655. var isCombo =
  6656. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  6657. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  6658. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  6659. // Exit early if metadata can't be merged.
  6660. if (!(isCommon || isCombo)) {
  6661. return data;
  6662. }
  6663. // Use source `thisArg` if available.
  6664. if (srcBitmask & WRAP_BIND_FLAG) {
  6665. data[2] = source[2];
  6666. // Set when currying a bound function.
  6667. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  6668. }
  6669. // Compose partial arguments.
  6670. var value = source[3];
  6671. if (value) {
  6672. var partials = data[3];
  6673. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  6674. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  6675. }
  6676. // Compose partial right arguments.
  6677. value = source[5];
  6678. if (value) {
  6679. partials = data[5];
  6680. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  6681. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  6682. }
  6683. // Use source `argPos` if available.
  6684. value = source[7];
  6685. if (value) {
  6686. data[7] = value;
  6687. }
  6688. // Use source `ary` if it's smaller.
  6689. if (srcBitmask & WRAP_ARY_FLAG) {
  6690. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  6691. }
  6692. // Use source `arity` if one is not provided.
  6693. if (data[9] == null) {
  6694. data[9] = source[9];
  6695. }
  6696. // Use source `func` and merge bitmasks.
  6697. data[0] = source[0];
  6698. data[1] = newBitmask;
  6699. return data;
  6700. }
  6701. /**
  6702. * This function is like
  6703. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6704. * except that it includes inherited enumerable properties.
  6705. *
  6706. * @private
  6707. * @param {Object} object The object to query.
  6708. * @returns {Array} Returns the array of property names.
  6709. */
  6710. function nativeKeysIn(object) {
  6711. var result = [];
  6712. if (object != null) {
  6713. for (var key in Object(object)) {
  6714. result.push(key);
  6715. }
  6716. }
  6717. return result;
  6718. }
  6719. /**
  6720. * Converts `value` to a string using `Object.prototype.toString`.
  6721. *
  6722. * @private
  6723. * @param {*} value The value to convert.
  6724. * @returns {string} Returns the converted string.
  6725. */
  6726. function objectToString(value) {
  6727. return nativeObjectToString.call(value);
  6728. }
  6729. /**
  6730. * A specialized version of `baseRest` which transforms the rest array.
  6731. *
  6732. * @private
  6733. * @param {Function} func The function to apply a rest parameter to.
  6734. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6735. * @param {Function} transform The rest array transform.
  6736. * @returns {Function} Returns the new function.
  6737. */
  6738. function overRest(func, start, transform) {
  6739. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  6740. return function() {
  6741. var args = arguments,
  6742. index = -1,
  6743. length = nativeMax(args.length - start, 0),
  6744. array = Array(length);
  6745. while (++index < length) {
  6746. array[index] = args[start + index];
  6747. }
  6748. index = -1;
  6749. var otherArgs = Array(start + 1);
  6750. while (++index < start) {
  6751. otherArgs[index] = args[index];
  6752. }
  6753. otherArgs[start] = transform(array);
  6754. return apply(func, this, otherArgs);
  6755. };
  6756. }
  6757. /**
  6758. * Gets the parent value at `path` of `object`.
  6759. *
  6760. * @private
  6761. * @param {Object} object The object to query.
  6762. * @param {Array} path The path to get the parent value of.
  6763. * @returns {*} Returns the parent value.
  6764. */
  6765. function parent(object, path) {
  6766. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  6767. }
  6768. /**
  6769. * Reorder `array` according to the specified indexes where the element at
  6770. * the first index is assigned as the first element, the element at
  6771. * the second index is assigned as the second element, and so on.
  6772. *
  6773. * @private
  6774. * @param {Array} array The array to reorder.
  6775. * @param {Array} indexes The arranged array indexes.
  6776. * @returns {Array} Returns `array`.
  6777. */
  6778. function reorder(array, indexes) {
  6779. var arrLength = array.length,
  6780. length = nativeMin(indexes.length, arrLength),
  6781. oldArray = copyArray(array);
  6782. while (length--) {
  6783. var index = indexes[length];
  6784. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  6785. }
  6786. return array;
  6787. }
  6788. /**
  6789. * Sets metadata for `func`.
  6790. *
  6791. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  6792. * period of time, it will trip its breaker and transition to an identity
  6793. * function to avoid garbage collection pauses in V8. See
  6794. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  6795. * for more details.
  6796. *
  6797. * @private
  6798. * @param {Function} func The function to associate metadata with.
  6799. * @param {*} data The metadata.
  6800. * @returns {Function} Returns `func`.
  6801. */
  6802. var setData = shortOut(baseSetData);
  6803. /**
  6804. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  6805. *
  6806. * @private
  6807. * @param {Function} func The function to delay.
  6808. * @param {number} wait The number of milliseconds to delay invocation.
  6809. * @returns {number|Object} Returns the timer id or timeout object.
  6810. */
  6811. var setTimeout = ctxSetTimeout || function(func, wait) {
  6812. return root.setTimeout(func, wait);
  6813. };
  6814. /**
  6815. * Sets the `toString` method of `func` to return `string`.
  6816. *
  6817. * @private
  6818. * @param {Function} func The function to modify.
  6819. * @param {Function} string The `toString` result.
  6820. * @returns {Function} Returns `func`.
  6821. */
  6822. var setToString = shortOut(baseSetToString);
  6823. /**
  6824. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  6825. * with wrapper details in a comment at the top of the source body.
  6826. *
  6827. * @private
  6828. * @param {Function} wrapper The function to modify.
  6829. * @param {Function} reference The reference function.
  6830. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6831. * @returns {Function} Returns `wrapper`.
  6832. */
  6833. function setWrapToString(wrapper, reference, bitmask) {
  6834. var source = (reference + '');
  6835. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  6836. }
  6837. /**
  6838. * Creates a function that'll short out and invoke `identity` instead
  6839. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  6840. * milliseconds.
  6841. *
  6842. * @private
  6843. * @param {Function} func The function to restrict.
  6844. * @returns {Function} Returns the new shortable function.
  6845. */
  6846. function shortOut(func) {
  6847. var count = 0,
  6848. lastCalled = 0;
  6849. return function() {
  6850. var stamp = nativeNow(),
  6851. remaining = HOT_SPAN - (stamp - lastCalled);
  6852. lastCalled = stamp;
  6853. if (remaining > 0) {
  6854. if (++count >= HOT_COUNT) {
  6855. return arguments[0];
  6856. }
  6857. } else {
  6858. count = 0;
  6859. }
  6860. return func.apply(undefined, arguments);
  6861. };
  6862. }
  6863. /**
  6864. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  6865. *
  6866. * @private
  6867. * @param {Array} array The array to shuffle.
  6868. * @param {number} [size=array.length] The size of `array`.
  6869. * @returns {Array} Returns `array`.
  6870. */
  6871. function shuffleSelf(array, size) {
  6872. var index = -1,
  6873. length = array.length,
  6874. lastIndex = length - 1;
  6875. size = size === undefined ? length : size;
  6876. while (++index < size) {
  6877. var rand = baseRandom(index, lastIndex),
  6878. value = array[rand];
  6879. array[rand] = array[index];
  6880. array[index] = value;
  6881. }
  6882. array.length = size;
  6883. return array;
  6884. }
  6885. /**
  6886. * Converts `string` to a property path array.
  6887. *
  6888. * @private
  6889. * @param {string} string The string to convert.
  6890. * @returns {Array} Returns the property path array.
  6891. */
  6892. var stringToPath = memoizeCapped(function(string) {
  6893. var result = [];
  6894. if (reLeadingDot.test(string)) {
  6895. result.push('');
  6896. }
  6897. string.replace(rePropName, function(match, number, quote, string) {
  6898. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  6899. });
  6900. return result;
  6901. });
  6902. /**
  6903. * Converts `value` to a string key if it's not a string or symbol.
  6904. *
  6905. * @private
  6906. * @param {*} value The value to inspect.
  6907. * @returns {string|symbol} Returns the key.
  6908. */
  6909. function toKey(value) {
  6910. if (typeof value == 'string' || isSymbol(value)) {
  6911. return value;
  6912. }
  6913. var result = (value + '');
  6914. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6915. }
  6916. /**
  6917. * Converts `func` to its source code.
  6918. *
  6919. * @private
  6920. * @param {Function} func The function to convert.
  6921. * @returns {string} Returns the source code.
  6922. */
  6923. function toSource(func) {
  6924. if (func != null) {
  6925. try {
  6926. return funcToString.call(func);
  6927. } catch (e) {}
  6928. try {
  6929. return (func + '');
  6930. } catch (e) {}
  6931. }
  6932. return '';
  6933. }
  6934. /**
  6935. * Updates wrapper `details` based on `bitmask` flags.
  6936. *
  6937. * @private
  6938. * @returns {Array} details The details to modify.
  6939. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6940. * @returns {Array} Returns `details`.
  6941. */
  6942. function updateWrapDetails(details, bitmask) {
  6943. arrayEach(wrapFlags, function(pair) {
  6944. var value = '_.' + pair[0];
  6945. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  6946. details.push(value);
  6947. }
  6948. });
  6949. return details.sort();
  6950. }
  6951. /**
  6952. * Creates a clone of `wrapper`.
  6953. *
  6954. * @private
  6955. * @param {Object} wrapper The wrapper to clone.
  6956. * @returns {Object} Returns the cloned wrapper.
  6957. */
  6958. function wrapperClone(wrapper) {
  6959. if (wrapper instanceof LazyWrapper) {
  6960. return wrapper.clone();
  6961. }
  6962. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  6963. result.__actions__ = copyArray(wrapper.__actions__);
  6964. result.__index__ = wrapper.__index__;
  6965. result.__values__ = wrapper.__values__;
  6966. return result;
  6967. }
  6968. /*------------------------------------------------------------------------*/
  6969. /**
  6970. * Creates an array of elements split into groups the length of `size`.
  6971. * If `array` can't be split evenly, the final chunk will be the remaining
  6972. * elements.
  6973. *
  6974. * @static
  6975. * @memberOf _
  6976. * @since 3.0.0
  6977. * @category Array
  6978. * @param {Array} array The array to process.
  6979. * @param {number} [size=1] The length of each chunk
  6980. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  6981. * @returns {Array} Returns the new array of chunks.
  6982. * @example
  6983. *
  6984. * _.chunk(['a', 'b', 'c', 'd'], 2);
  6985. * // => [['a', 'b'], ['c', 'd']]
  6986. *
  6987. * _.chunk(['a', 'b', 'c', 'd'], 3);
  6988. * // => [['a', 'b', 'c'], ['d']]
  6989. */
  6990. function chunk(array, size, guard) {
  6991. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  6992. size = 1;
  6993. } else {
  6994. size = nativeMax(toInteger(size), 0);
  6995. }
  6996. var length = array == null ? 0 : array.length;
  6997. if (!length || size < 1) {
  6998. return [];
  6999. }
  7000. var index = 0,
  7001. resIndex = 0,
  7002. result = Array(nativeCeil(length / size));
  7003. while (index < length) {
  7004. result[resIndex++] = baseSlice(array, index, (index += size));
  7005. }
  7006. return result;
  7007. }
  7008. /**
  7009. * Creates an array with all falsey values removed. The values `false`, `null`,
  7010. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7011. *
  7012. * @static
  7013. * @memberOf _
  7014. * @since 0.1.0
  7015. * @category Array
  7016. * @param {Array} array The array to compact.
  7017. * @returns {Array} Returns the new array of filtered values.
  7018. * @example
  7019. *
  7020. * _.compact([0, 1, false, 2, '', 3]);
  7021. * // => [1, 2, 3]
  7022. */
  7023. function compact(array) {
  7024. var index = -1,
  7025. length = array == null ? 0 : array.length,
  7026. resIndex = 0,
  7027. result = [];
  7028. while (++index < length) {
  7029. var value = array[index];
  7030. if (value) {
  7031. result[resIndex++] = value;
  7032. }
  7033. }
  7034. return result;
  7035. }
  7036. /**
  7037. * Creates a new array concatenating `array` with any additional arrays
  7038. * and/or values.
  7039. *
  7040. * @static
  7041. * @memberOf _
  7042. * @since 4.0.0
  7043. * @category Array
  7044. * @param {Array} array The array to concatenate.
  7045. * @param {...*} [values] The values to concatenate.
  7046. * @returns {Array} Returns the new concatenated array.
  7047. * @example
  7048. *
  7049. * var array = [1];
  7050. * var other = _.concat(array, 2, [3], [[4]]);
  7051. *
  7052. * console.log(other);
  7053. * // => [1, 2, 3, [4]]
  7054. *
  7055. * console.log(array);
  7056. * // => [1]
  7057. */
  7058. function concat() {
  7059. var length = arguments.length;
  7060. if (!length) {
  7061. return [];
  7062. }
  7063. var args = Array(length - 1),
  7064. array = arguments[0],
  7065. index = length;
  7066. while (index--) {
  7067. args[index - 1] = arguments[index];
  7068. }
  7069. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7070. }
  7071. /**
  7072. * Creates an array of `array` values not included in the other given arrays
  7073. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7074. * for equality comparisons. The order and references of result values are
  7075. * determined by the first array.
  7076. *
  7077. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7078. *
  7079. * @static
  7080. * @memberOf _
  7081. * @since 0.1.0
  7082. * @category Array
  7083. * @param {Array} array The array to inspect.
  7084. * @param {...Array} [values] The values to exclude.
  7085. * @returns {Array} Returns the new array of filtered values.
  7086. * @see _.without, _.xor
  7087. * @example
  7088. *
  7089. * _.difference([2, 1], [2, 3]);
  7090. * // => [1]
  7091. */
  7092. var difference = baseRest(function(array, values) {
  7093. return isArrayLikeObject(array)
  7094. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7095. : [];
  7096. });
  7097. /**
  7098. * This method is like `_.difference` except that it accepts `iteratee` which
  7099. * is invoked for each element of `array` and `values` to generate the criterion
  7100. * by which they're compared. The order and references of result values are
  7101. * determined by the first array. The iteratee is invoked with one argument:
  7102. * (value).
  7103. *
  7104. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7105. *
  7106. * @static
  7107. * @memberOf _
  7108. * @since 4.0.0
  7109. * @category Array
  7110. * @param {Array} array The array to inspect.
  7111. * @param {...Array} [values] The values to exclude.
  7112. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7113. * @returns {Array} Returns the new array of filtered values.
  7114. * @example
  7115. *
  7116. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7117. * // => [1.2]
  7118. *
  7119. * // The `_.property` iteratee shorthand.
  7120. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7121. * // => [{ 'x': 2 }]
  7122. */
  7123. var differenceBy = baseRest(function(array, values) {
  7124. var iteratee = last(values);
  7125. if (isArrayLikeObject(iteratee)) {
  7126. iteratee = undefined;
  7127. }
  7128. return isArrayLikeObject(array)
  7129. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7130. : [];
  7131. });
  7132. /**
  7133. * This method is like `_.difference` except that it accepts `comparator`
  7134. * which is invoked to compare elements of `array` to `values`. The order and
  7135. * references of result values are determined by the first array. The comparator
  7136. * is invoked with two arguments: (arrVal, othVal).
  7137. *
  7138. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7139. *
  7140. * @static
  7141. * @memberOf _
  7142. * @since 4.0.0
  7143. * @category Array
  7144. * @param {Array} array The array to inspect.
  7145. * @param {...Array} [values] The values to exclude.
  7146. * @param {Function} [comparator] The comparator invoked per element.
  7147. * @returns {Array} Returns the new array of filtered values.
  7148. * @example
  7149. *
  7150. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7151. *
  7152. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7153. * // => [{ 'x': 2, 'y': 1 }]
  7154. */
  7155. var differenceWith = baseRest(function(array, values) {
  7156. var comparator = last(values);
  7157. if (isArrayLikeObject(comparator)) {
  7158. comparator = undefined;
  7159. }
  7160. return isArrayLikeObject(array)
  7161. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7162. : [];
  7163. });
  7164. /**
  7165. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7166. *
  7167. * @static
  7168. * @memberOf _
  7169. * @since 0.5.0
  7170. * @category Array
  7171. * @param {Array} array The array to query.
  7172. * @param {number} [n=1] The number of elements to drop.
  7173. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7174. * @returns {Array} Returns the slice of `array`.
  7175. * @example
  7176. *
  7177. * _.drop([1, 2, 3]);
  7178. * // => [2, 3]
  7179. *
  7180. * _.drop([1, 2, 3], 2);
  7181. * // => [3]
  7182. *
  7183. * _.drop([1, 2, 3], 5);
  7184. * // => []
  7185. *
  7186. * _.drop([1, 2, 3], 0);
  7187. * // => [1, 2, 3]
  7188. */
  7189. function drop(array, n, guard) {
  7190. var length = array == null ? 0 : array.length;
  7191. if (!length) {
  7192. return [];
  7193. }
  7194. n = (guard || n === undefined) ? 1 : toInteger(n);
  7195. return baseSlice(array, n < 0 ? 0 : n, length);
  7196. }
  7197. /**
  7198. * Creates a slice of `array` with `n` elements dropped from the end.
  7199. *
  7200. * @static
  7201. * @memberOf _
  7202. * @since 3.0.0
  7203. * @category Array
  7204. * @param {Array} array The array to query.
  7205. * @param {number} [n=1] The number of elements to drop.
  7206. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7207. * @returns {Array} Returns the slice of `array`.
  7208. * @example
  7209. *
  7210. * _.dropRight([1, 2, 3]);
  7211. * // => [1, 2]
  7212. *
  7213. * _.dropRight([1, 2, 3], 2);
  7214. * // => [1]
  7215. *
  7216. * _.dropRight([1, 2, 3], 5);
  7217. * // => []
  7218. *
  7219. * _.dropRight([1, 2, 3], 0);
  7220. * // => [1, 2, 3]
  7221. */
  7222. function dropRight(array, n, guard) {
  7223. var length = array == null ? 0 : array.length;
  7224. if (!length) {
  7225. return [];
  7226. }
  7227. n = (guard || n === undefined) ? 1 : toInteger(n);
  7228. n = length - n;
  7229. return baseSlice(array, 0, n < 0 ? 0 : n);
  7230. }
  7231. /**
  7232. * Creates a slice of `array` excluding elements dropped from the end.
  7233. * Elements are dropped until `predicate` returns falsey. The predicate is
  7234. * invoked with three arguments: (value, index, array).
  7235. *
  7236. * @static
  7237. * @memberOf _
  7238. * @since 3.0.0
  7239. * @category Array
  7240. * @param {Array} array The array to query.
  7241. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7242. * @returns {Array} Returns the slice of `array`.
  7243. * @example
  7244. *
  7245. * var users = [
  7246. * { 'user': 'barney', 'active': true },
  7247. * { 'user': 'fred', 'active': false },
  7248. * { 'user': 'pebbles', 'active': false }
  7249. * ];
  7250. *
  7251. * _.dropRightWhile(users, function(o) { return !o.active; });
  7252. * // => objects for ['barney']
  7253. *
  7254. * // The `_.matches` iteratee shorthand.
  7255. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7256. * // => objects for ['barney', 'fred']
  7257. *
  7258. * // The `_.matchesProperty` iteratee shorthand.
  7259. * _.dropRightWhile(users, ['active', false]);
  7260. * // => objects for ['barney']
  7261. *
  7262. * // The `_.property` iteratee shorthand.
  7263. * _.dropRightWhile(users, 'active');
  7264. * // => objects for ['barney', 'fred', 'pebbles']
  7265. */
  7266. function dropRightWhile(array, predicate) {
  7267. return (array && array.length)
  7268. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7269. : [];
  7270. }
  7271. /**
  7272. * Creates a slice of `array` excluding elements dropped from the beginning.
  7273. * Elements are dropped until `predicate` returns falsey. The predicate is
  7274. * invoked with three arguments: (value, index, array).
  7275. *
  7276. * @static
  7277. * @memberOf _
  7278. * @since 3.0.0
  7279. * @category Array
  7280. * @param {Array} array The array to query.
  7281. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7282. * @returns {Array} Returns the slice of `array`.
  7283. * @example
  7284. *
  7285. * var users = [
  7286. * { 'user': 'barney', 'active': false },
  7287. * { 'user': 'fred', 'active': false },
  7288. * { 'user': 'pebbles', 'active': true }
  7289. * ];
  7290. *
  7291. * _.dropWhile(users, function(o) { return !o.active; });
  7292. * // => objects for ['pebbles']
  7293. *
  7294. * // The `_.matches` iteratee shorthand.
  7295. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7296. * // => objects for ['fred', 'pebbles']
  7297. *
  7298. * // The `_.matchesProperty` iteratee shorthand.
  7299. * _.dropWhile(users, ['active', false]);
  7300. * // => objects for ['pebbles']
  7301. *
  7302. * // The `_.property` iteratee shorthand.
  7303. * _.dropWhile(users, 'active');
  7304. * // => objects for ['barney', 'fred', 'pebbles']
  7305. */
  7306. function dropWhile(array, predicate) {
  7307. return (array && array.length)
  7308. ? baseWhile(array, getIteratee(predicate, 3), true)
  7309. : [];
  7310. }
  7311. /**
  7312. * Fills elements of `array` with `value` from `start` up to, but not
  7313. * including, `end`.
  7314. *
  7315. * **Note:** This method mutates `array`.
  7316. *
  7317. * @static
  7318. * @memberOf _
  7319. * @since 3.2.0
  7320. * @category Array
  7321. * @param {Array} array The array to fill.
  7322. * @param {*} value The value to fill `array` with.
  7323. * @param {number} [start=0] The start position.
  7324. * @param {number} [end=array.length] The end position.
  7325. * @returns {Array} Returns `array`.
  7326. * @example
  7327. *
  7328. * var array = [1, 2, 3];
  7329. *
  7330. * _.fill(array, 'a');
  7331. * console.log(array);
  7332. * // => ['a', 'a', 'a']
  7333. *
  7334. * _.fill(Array(3), 2);
  7335. * // => [2, 2, 2]
  7336. *
  7337. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7338. * // => [4, '*', '*', 10]
  7339. */
  7340. function fill(array, value, start, end) {
  7341. var length = array == null ? 0 : array.length;
  7342. if (!length) {
  7343. return [];
  7344. }
  7345. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7346. start = 0;
  7347. end = length;
  7348. }
  7349. return baseFill(array, value, start, end);
  7350. }
  7351. /**
  7352. * This method is like `_.find` except that it returns the index of the first
  7353. * element `predicate` returns truthy for instead of the element itself.
  7354. *
  7355. * @static
  7356. * @memberOf _
  7357. * @since 1.1.0
  7358. * @category Array
  7359. * @param {Array} array The array to inspect.
  7360. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7361. * @param {number} [fromIndex=0] The index to search from.
  7362. * @returns {number} Returns the index of the found element, else `-1`.
  7363. * @example
  7364. *
  7365. * var users = [
  7366. * { 'user': 'barney', 'active': false },
  7367. * { 'user': 'fred', 'active': false },
  7368. * { 'user': 'pebbles', 'active': true }
  7369. * ];
  7370. *
  7371. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  7372. * // => 0
  7373. *
  7374. * // The `_.matches` iteratee shorthand.
  7375. * _.findIndex(users, { 'user': 'fred', 'active': false });
  7376. * // => 1
  7377. *
  7378. * // The `_.matchesProperty` iteratee shorthand.
  7379. * _.findIndex(users, ['active', false]);
  7380. * // => 0
  7381. *
  7382. * // The `_.property` iteratee shorthand.
  7383. * _.findIndex(users, 'active');
  7384. * // => 2
  7385. */
  7386. function findIndex(array, predicate, fromIndex) {
  7387. var length = array == null ? 0 : array.length;
  7388. if (!length) {
  7389. return -1;
  7390. }
  7391. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7392. if (index < 0) {
  7393. index = nativeMax(length + index, 0);
  7394. }
  7395. return baseFindIndex(array, getIteratee(predicate, 3), index);
  7396. }
  7397. /**
  7398. * This method is like `_.findIndex` except that it iterates over elements
  7399. * of `collection` from right to left.
  7400. *
  7401. * @static
  7402. * @memberOf _
  7403. * @since 2.0.0
  7404. * @category Array
  7405. * @param {Array} array The array to inspect.
  7406. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7407. * @param {number} [fromIndex=array.length-1] The index to search from.
  7408. * @returns {number} Returns the index of the found element, else `-1`.
  7409. * @example
  7410. *
  7411. * var users = [
  7412. * { 'user': 'barney', 'active': true },
  7413. * { 'user': 'fred', 'active': false },
  7414. * { 'user': 'pebbles', 'active': false }
  7415. * ];
  7416. *
  7417. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  7418. * // => 2
  7419. *
  7420. * // The `_.matches` iteratee shorthand.
  7421. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  7422. * // => 0
  7423. *
  7424. * // The `_.matchesProperty` iteratee shorthand.
  7425. * _.findLastIndex(users, ['active', false]);
  7426. * // => 2
  7427. *
  7428. * // The `_.property` iteratee shorthand.
  7429. * _.findLastIndex(users, 'active');
  7430. * // => 0
  7431. */
  7432. function findLastIndex(array, predicate, fromIndex) {
  7433. var length = array == null ? 0 : array.length;
  7434. if (!length) {
  7435. return -1;
  7436. }
  7437. var index = length - 1;
  7438. if (fromIndex !== undefined) {
  7439. index = toInteger(fromIndex);
  7440. index = fromIndex < 0
  7441. ? nativeMax(length + index, 0)
  7442. : nativeMin(index, length - 1);
  7443. }
  7444. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  7445. }
  7446. /**
  7447. * Flattens `array` a single level deep.
  7448. *
  7449. * @static
  7450. * @memberOf _
  7451. * @since 0.1.0
  7452. * @category Array
  7453. * @param {Array} array The array to flatten.
  7454. * @returns {Array} Returns the new flattened array.
  7455. * @example
  7456. *
  7457. * _.flatten([1, [2, [3, [4]], 5]]);
  7458. * // => [1, 2, [3, [4]], 5]
  7459. */
  7460. function flatten(array) {
  7461. var length = array == null ? 0 : array.length;
  7462. return length ? baseFlatten(array, 1) : [];
  7463. }
  7464. /**
  7465. * Recursively flattens `array`.
  7466. *
  7467. * @static
  7468. * @memberOf _
  7469. * @since 3.0.0
  7470. * @category Array
  7471. * @param {Array} array The array to flatten.
  7472. * @returns {Array} Returns the new flattened array.
  7473. * @example
  7474. *
  7475. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  7476. * // => [1, 2, 3, 4, 5]
  7477. */
  7478. function flattenDeep(array) {
  7479. var length = array == null ? 0 : array.length;
  7480. return length ? baseFlatten(array, INFINITY) : [];
  7481. }
  7482. /**
  7483. * Recursively flatten `array` up to `depth` times.
  7484. *
  7485. * @static
  7486. * @memberOf _
  7487. * @since 4.4.0
  7488. * @category Array
  7489. * @param {Array} array The array to flatten.
  7490. * @param {number} [depth=1] The maximum recursion depth.
  7491. * @returns {Array} Returns the new flattened array.
  7492. * @example
  7493. *
  7494. * var array = [1, [2, [3, [4]], 5]];
  7495. *
  7496. * _.flattenDepth(array, 1);
  7497. * // => [1, 2, [3, [4]], 5]
  7498. *
  7499. * _.flattenDepth(array, 2);
  7500. * // => [1, 2, 3, [4], 5]
  7501. */
  7502. function flattenDepth(array, depth) {
  7503. var length = array == null ? 0 : array.length;
  7504. if (!length) {
  7505. return [];
  7506. }
  7507. depth = depth === undefined ? 1 : toInteger(depth);
  7508. return baseFlatten(array, depth);
  7509. }
  7510. /**
  7511. * The inverse of `_.toPairs`; this method returns an object composed
  7512. * from key-value `pairs`.
  7513. *
  7514. * @static
  7515. * @memberOf _
  7516. * @since 4.0.0
  7517. * @category Array
  7518. * @param {Array} pairs The key-value pairs.
  7519. * @returns {Object} Returns the new object.
  7520. * @example
  7521. *
  7522. * _.fromPairs([['a', 1], ['b', 2]]);
  7523. * // => { 'a': 1, 'b': 2 }
  7524. */
  7525. function fromPairs(pairs) {
  7526. var index = -1,
  7527. length = pairs == null ? 0 : pairs.length,
  7528. result = {};
  7529. while (++index < length) {
  7530. var pair = pairs[index];
  7531. result[pair[0]] = pair[1];
  7532. }
  7533. return result;
  7534. }
  7535. /**
  7536. * Gets the first element of `array`.
  7537. *
  7538. * @static
  7539. * @memberOf _
  7540. * @since 0.1.0
  7541. * @alias first
  7542. * @category Array
  7543. * @param {Array} array The array to query.
  7544. * @returns {*} Returns the first element of `array`.
  7545. * @example
  7546. *
  7547. * _.head([1, 2, 3]);
  7548. * // => 1
  7549. *
  7550. * _.head([]);
  7551. * // => undefined
  7552. */
  7553. function head(array) {
  7554. return (array && array.length) ? array[0] : undefined;
  7555. }
  7556. /**
  7557. * Gets the index at which the first occurrence of `value` is found in `array`
  7558. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7559. * for equality comparisons. If `fromIndex` is negative, it's used as the
  7560. * offset from the end of `array`.
  7561. *
  7562. * @static
  7563. * @memberOf _
  7564. * @since 0.1.0
  7565. * @category Array
  7566. * @param {Array} array The array to inspect.
  7567. * @param {*} value The value to search for.
  7568. * @param {number} [fromIndex=0] The index to search from.
  7569. * @returns {number} Returns the index of the matched value, else `-1`.
  7570. * @example
  7571. *
  7572. * _.indexOf([1, 2, 1, 2], 2);
  7573. * // => 1
  7574. *
  7575. * // Search from the `fromIndex`.
  7576. * _.indexOf([1, 2, 1, 2], 2, 2);
  7577. * // => 3
  7578. */
  7579. function indexOf(array, value, fromIndex) {
  7580. var length = array == null ? 0 : array.length;
  7581. if (!length) {
  7582. return -1;
  7583. }
  7584. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7585. if (index < 0) {
  7586. index = nativeMax(length + index, 0);
  7587. }
  7588. return baseIndexOf(array, value, index);
  7589. }
  7590. /**
  7591. * Gets all but the last element of `array`.
  7592. *
  7593. * @static
  7594. * @memberOf _
  7595. * @since 0.1.0
  7596. * @category Array
  7597. * @param {Array} array The array to query.
  7598. * @returns {Array} Returns the slice of `array`.
  7599. * @example
  7600. *
  7601. * _.initial([1, 2, 3]);
  7602. * // => [1, 2]
  7603. */
  7604. function initial(array) {
  7605. var length = array == null ? 0 : array.length;
  7606. return length ? baseSlice(array, 0, -1) : [];
  7607. }
  7608. /**
  7609. * Creates an array of unique values that are included in all given arrays
  7610. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7611. * for equality comparisons. The order and references of result values are
  7612. * determined by the first array.
  7613. *
  7614. * @static
  7615. * @memberOf _
  7616. * @since 0.1.0
  7617. * @category Array
  7618. * @param {...Array} [arrays] The arrays to inspect.
  7619. * @returns {Array} Returns the new array of intersecting values.
  7620. * @example
  7621. *
  7622. * _.intersection([2, 1], [2, 3]);
  7623. * // => [2]
  7624. */
  7625. var intersection = baseRest(function(arrays) {
  7626. var mapped = arrayMap(arrays, castArrayLikeObject);
  7627. return (mapped.length && mapped[0] === arrays[0])
  7628. ? baseIntersection(mapped)
  7629. : [];
  7630. });
  7631. /**
  7632. * This method is like `_.intersection` except that it accepts `iteratee`
  7633. * which is invoked for each element of each `arrays` to generate the criterion
  7634. * by which they're compared. The order and references of result values are
  7635. * determined by the first array. The iteratee is invoked with one argument:
  7636. * (value).
  7637. *
  7638. * @static
  7639. * @memberOf _
  7640. * @since 4.0.0
  7641. * @category Array
  7642. * @param {...Array} [arrays] The arrays to inspect.
  7643. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7644. * @returns {Array} Returns the new array of intersecting values.
  7645. * @example
  7646. *
  7647. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7648. * // => [2.1]
  7649. *
  7650. * // The `_.property` iteratee shorthand.
  7651. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  7652. * // => [{ 'x': 1 }]
  7653. */
  7654. var intersectionBy = baseRest(function(arrays) {
  7655. var iteratee = last(arrays),
  7656. mapped = arrayMap(arrays, castArrayLikeObject);
  7657. if (iteratee === last(mapped)) {
  7658. iteratee = undefined;
  7659. } else {
  7660. mapped.pop();
  7661. }
  7662. return (mapped.length && mapped[0] === arrays[0])
  7663. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  7664. : [];
  7665. });
  7666. /**
  7667. * This method is like `_.intersection` except that it accepts `comparator`
  7668. * which is invoked to compare elements of `arrays`. The order and references
  7669. * of result values are determined by the first array. The comparator is
  7670. * invoked with two arguments: (arrVal, othVal).
  7671. *
  7672. * @static
  7673. * @memberOf _
  7674. * @since 4.0.0
  7675. * @category Array
  7676. * @param {...Array} [arrays] The arrays to inspect.
  7677. * @param {Function} [comparator] The comparator invoked per element.
  7678. * @returns {Array} Returns the new array of intersecting values.
  7679. * @example
  7680. *
  7681. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7682. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  7683. *
  7684. * _.intersectionWith(objects, others, _.isEqual);
  7685. * // => [{ 'x': 1, 'y': 2 }]
  7686. */
  7687. var intersectionWith = baseRest(function(arrays) {
  7688. var comparator = last(arrays),
  7689. mapped = arrayMap(arrays, castArrayLikeObject);
  7690. comparator = typeof comparator == 'function' ? comparator : undefined;
  7691. if (comparator) {
  7692. mapped.pop();
  7693. }
  7694. return (mapped.length && mapped[0] === arrays[0])
  7695. ? baseIntersection(mapped, undefined, comparator)
  7696. : [];
  7697. });
  7698. /**
  7699. * Converts all elements in `array` into a string separated by `separator`.
  7700. *
  7701. * @static
  7702. * @memberOf _
  7703. * @since 4.0.0
  7704. * @category Array
  7705. * @param {Array} array The array to convert.
  7706. * @param {string} [separator=','] The element separator.
  7707. * @returns {string} Returns the joined string.
  7708. * @example
  7709. *
  7710. * _.join(['a', 'b', 'c'], '~');
  7711. * // => 'a~b~c'
  7712. */
  7713. function join(array, separator) {
  7714. return array == null ? '' : nativeJoin.call(array, separator);
  7715. }
  7716. /**
  7717. * Gets the last element of `array`.
  7718. *
  7719. * @static
  7720. * @memberOf _
  7721. * @since 0.1.0
  7722. * @category Array
  7723. * @param {Array} array The array to query.
  7724. * @returns {*} Returns the last element of `array`.
  7725. * @example
  7726. *
  7727. * _.last([1, 2, 3]);
  7728. * // => 3
  7729. */
  7730. function last(array) {
  7731. var length = array == null ? 0 : array.length;
  7732. return length ? array[length - 1] : undefined;
  7733. }
  7734. /**
  7735. * This method is like `_.indexOf` except that it iterates over elements of
  7736. * `array` from right to left.
  7737. *
  7738. * @static
  7739. * @memberOf _
  7740. * @since 0.1.0
  7741. * @category Array
  7742. * @param {Array} array The array to inspect.
  7743. * @param {*} value The value to search for.
  7744. * @param {number} [fromIndex=array.length-1] The index to search from.
  7745. * @returns {number} Returns the index of the matched value, else `-1`.
  7746. * @example
  7747. *
  7748. * _.lastIndexOf([1, 2, 1, 2], 2);
  7749. * // => 3
  7750. *
  7751. * // Search from the `fromIndex`.
  7752. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  7753. * // => 1
  7754. */
  7755. function lastIndexOf(array, value, fromIndex) {
  7756. var length = array == null ? 0 : array.length;
  7757. if (!length) {
  7758. return -1;
  7759. }
  7760. var index = length;
  7761. if (fromIndex !== undefined) {
  7762. index = toInteger(fromIndex);
  7763. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  7764. }
  7765. return value === value
  7766. ? strictLastIndexOf(array, value, index)
  7767. : baseFindIndex(array, baseIsNaN, index, true);
  7768. }
  7769. /**
  7770. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  7771. * element from the end is returned.
  7772. *
  7773. * @static
  7774. * @memberOf _
  7775. * @since 4.11.0
  7776. * @category Array
  7777. * @param {Array} array The array to query.
  7778. * @param {number} [n=0] The index of the element to return.
  7779. * @returns {*} Returns the nth element of `array`.
  7780. * @example
  7781. *
  7782. * var array = ['a', 'b', 'c', 'd'];
  7783. *
  7784. * _.nth(array, 1);
  7785. * // => 'b'
  7786. *
  7787. * _.nth(array, -2);
  7788. * // => 'c';
  7789. */
  7790. function nth(array, n) {
  7791. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  7792. }
  7793. /**
  7794. * Removes all given values from `array` using
  7795. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7796. * for equality comparisons.
  7797. *
  7798. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  7799. * to remove elements from an array by predicate.
  7800. *
  7801. * @static
  7802. * @memberOf _
  7803. * @since 2.0.0
  7804. * @category Array
  7805. * @param {Array} array The array to modify.
  7806. * @param {...*} [values] The values to remove.
  7807. * @returns {Array} Returns `array`.
  7808. * @example
  7809. *
  7810. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7811. *
  7812. * _.pull(array, 'a', 'c');
  7813. * console.log(array);
  7814. * // => ['b', 'b']
  7815. */
  7816. var pull = baseRest(pullAll);
  7817. /**
  7818. * This method is like `_.pull` except that it accepts an array of values to remove.
  7819. *
  7820. * **Note:** Unlike `_.difference`, this method mutates `array`.
  7821. *
  7822. * @static
  7823. * @memberOf _
  7824. * @since 4.0.0
  7825. * @category Array
  7826. * @param {Array} array The array to modify.
  7827. * @param {Array} values The values to remove.
  7828. * @returns {Array} Returns `array`.
  7829. * @example
  7830. *
  7831. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7832. *
  7833. * _.pullAll(array, ['a', 'c']);
  7834. * console.log(array);
  7835. * // => ['b', 'b']
  7836. */
  7837. function pullAll(array, values) {
  7838. return (array && array.length && values && values.length)
  7839. ? basePullAll(array, values)
  7840. : array;
  7841. }
  7842. /**
  7843. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  7844. * invoked for each element of `array` and `values` to generate the criterion
  7845. * by which they're compared. The iteratee is invoked with one argument: (value).
  7846. *
  7847. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  7848. *
  7849. * @static
  7850. * @memberOf _
  7851. * @since 4.0.0
  7852. * @category Array
  7853. * @param {Array} array The array to modify.
  7854. * @param {Array} values The values to remove.
  7855. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7856. * @returns {Array} Returns `array`.
  7857. * @example
  7858. *
  7859. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  7860. *
  7861. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  7862. * console.log(array);
  7863. * // => [{ 'x': 2 }]
  7864. */
  7865. function pullAllBy(array, values, iteratee) {
  7866. return (array && array.length && values && values.length)
  7867. ? basePullAll(array, values, getIteratee(iteratee, 2))
  7868. : array;
  7869. }
  7870. /**
  7871. * This method is like `_.pullAll` except that it accepts `comparator` which
  7872. * is invoked to compare elements of `array` to `values`. The comparator is
  7873. * invoked with two arguments: (arrVal, othVal).
  7874. *
  7875. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  7876. *
  7877. * @static
  7878. * @memberOf _
  7879. * @since 4.6.0
  7880. * @category Array
  7881. * @param {Array} array The array to modify.
  7882. * @param {Array} values The values to remove.
  7883. * @param {Function} [comparator] The comparator invoked per element.
  7884. * @returns {Array} Returns `array`.
  7885. * @example
  7886. *
  7887. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  7888. *
  7889. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  7890. * console.log(array);
  7891. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  7892. */
  7893. function pullAllWith(array, values, comparator) {
  7894. return (array && array.length && values && values.length)
  7895. ? basePullAll(array, values, undefined, comparator)
  7896. : array;
  7897. }
  7898. /**
  7899. * Removes elements from `array` corresponding to `indexes` and returns an
  7900. * array of removed elements.
  7901. *
  7902. * **Note:** Unlike `_.at`, this method mutates `array`.
  7903. *
  7904. * @static
  7905. * @memberOf _
  7906. * @since 3.0.0
  7907. * @category Array
  7908. * @param {Array} array The array to modify.
  7909. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  7910. * @returns {Array} Returns the new array of removed elements.
  7911. * @example
  7912. *
  7913. * var array = ['a', 'b', 'c', 'd'];
  7914. * var pulled = _.pullAt(array, [1, 3]);
  7915. *
  7916. * console.log(array);
  7917. * // => ['a', 'c']
  7918. *
  7919. * console.log(pulled);
  7920. * // => ['b', 'd']
  7921. */
  7922. var pullAt = flatRest(function(array, indexes) {
  7923. var length = array == null ? 0 : array.length,
  7924. result = baseAt(array, indexes);
  7925. basePullAt(array, arrayMap(indexes, function(index) {
  7926. return isIndex(index, length) ? +index : index;
  7927. }).sort(compareAscending));
  7928. return result;
  7929. });
  7930. /**
  7931. * Removes all elements from `array` that `predicate` returns truthy for
  7932. * and returns an array of the removed elements. The predicate is invoked
  7933. * with three arguments: (value, index, array).
  7934. *
  7935. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  7936. * to pull elements from an array by value.
  7937. *
  7938. * @static
  7939. * @memberOf _
  7940. * @since 2.0.0
  7941. * @category Array
  7942. * @param {Array} array The array to modify.
  7943. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7944. * @returns {Array} Returns the new array of removed elements.
  7945. * @example
  7946. *
  7947. * var array = [1, 2, 3, 4];
  7948. * var evens = _.remove(array, function(n) {
  7949. * return n % 2 == 0;
  7950. * });
  7951. *
  7952. * console.log(array);
  7953. * // => [1, 3]
  7954. *
  7955. * console.log(evens);
  7956. * // => [2, 4]
  7957. */
  7958. function remove(array, predicate) {
  7959. var result = [];
  7960. if (!(array && array.length)) {
  7961. return result;
  7962. }
  7963. var index = -1,
  7964. indexes = [],
  7965. length = array.length;
  7966. predicate = getIteratee(predicate, 3);
  7967. while (++index < length) {
  7968. var value = array[index];
  7969. if (predicate(value, index, array)) {
  7970. result.push(value);
  7971. indexes.push(index);
  7972. }
  7973. }
  7974. basePullAt(array, indexes);
  7975. return result;
  7976. }
  7977. /**
  7978. * Reverses `array` so that the first element becomes the last, the second
  7979. * element becomes the second to last, and so on.
  7980. *
  7981. * **Note:** This method mutates `array` and is based on
  7982. * [`Array#reverse`](https://mdn.io/Array/reverse).
  7983. *
  7984. * @static
  7985. * @memberOf _
  7986. * @since 4.0.0
  7987. * @category Array
  7988. * @param {Array} array The array to modify.
  7989. * @returns {Array} Returns `array`.
  7990. * @example
  7991. *
  7992. * var array = [1, 2, 3];
  7993. *
  7994. * _.reverse(array);
  7995. * // => [3, 2, 1]
  7996. *
  7997. * console.log(array);
  7998. * // => [3, 2, 1]
  7999. */
  8000. function reverse(array) {
  8001. return array == null ? array : nativeReverse.call(array);
  8002. }
  8003. /**
  8004. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8005. *
  8006. * **Note:** This method is used instead of
  8007. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8008. * returned.
  8009. *
  8010. * @static
  8011. * @memberOf _
  8012. * @since 3.0.0
  8013. * @category Array
  8014. * @param {Array} array The array to slice.
  8015. * @param {number} [start=0] The start position.
  8016. * @param {number} [end=array.length] The end position.
  8017. * @returns {Array} Returns the slice of `array`.
  8018. */
  8019. function slice(array, start, end) {
  8020. var length = array == null ? 0 : array.length;
  8021. if (!length) {
  8022. return [];
  8023. }
  8024. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8025. start = 0;
  8026. end = length;
  8027. }
  8028. else {
  8029. start = start == null ? 0 : toInteger(start);
  8030. end = end === undefined ? length : toInteger(end);
  8031. }
  8032. return baseSlice(array, start, end);
  8033. }
  8034. /**
  8035. * Uses a binary search to determine the lowest index at which `value`
  8036. * should be inserted into `array` in order to maintain its sort order.
  8037. *
  8038. * @static
  8039. * @memberOf _
  8040. * @since 0.1.0
  8041. * @category Array
  8042. * @param {Array} array The sorted array to inspect.
  8043. * @param {*} value The value to evaluate.
  8044. * @returns {number} Returns the index at which `value` should be inserted
  8045. * into `array`.
  8046. * @example
  8047. *
  8048. * _.sortedIndex([30, 50], 40);
  8049. * // => 1
  8050. */
  8051. function sortedIndex(array, value) {
  8052. return baseSortedIndex(array, value);
  8053. }
  8054. /**
  8055. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8056. * which is invoked for `value` and each element of `array` to compute their
  8057. * sort ranking. The iteratee is invoked with one argument: (value).
  8058. *
  8059. * @static
  8060. * @memberOf _
  8061. * @since 4.0.0
  8062. * @category Array
  8063. * @param {Array} array The sorted array to inspect.
  8064. * @param {*} value The value to evaluate.
  8065. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8066. * @returns {number} Returns the index at which `value` should be inserted
  8067. * into `array`.
  8068. * @example
  8069. *
  8070. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8071. *
  8072. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8073. * // => 0
  8074. *
  8075. * // The `_.property` iteratee shorthand.
  8076. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8077. * // => 0
  8078. */
  8079. function sortedIndexBy(array, value, iteratee) {
  8080. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8081. }
  8082. /**
  8083. * This method is like `_.indexOf` except that it performs a binary
  8084. * search on a sorted `array`.
  8085. *
  8086. * @static
  8087. * @memberOf _
  8088. * @since 4.0.0
  8089. * @category Array
  8090. * @param {Array} array The array to inspect.
  8091. * @param {*} value The value to search for.
  8092. * @returns {number} Returns the index of the matched value, else `-1`.
  8093. * @example
  8094. *
  8095. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8096. * // => 1
  8097. */
  8098. function sortedIndexOf(array, value) {
  8099. var length = array == null ? 0 : array.length;
  8100. if (length) {
  8101. var index = baseSortedIndex(array, value);
  8102. if (index < length && eq(array[index], value)) {
  8103. return index;
  8104. }
  8105. }
  8106. return -1;
  8107. }
  8108. /**
  8109. * This method is like `_.sortedIndex` except that it returns the highest
  8110. * index at which `value` should be inserted into `array` in order to
  8111. * maintain its sort order.
  8112. *
  8113. * @static
  8114. * @memberOf _
  8115. * @since 3.0.0
  8116. * @category Array
  8117. * @param {Array} array The sorted array to inspect.
  8118. * @param {*} value The value to evaluate.
  8119. * @returns {number} Returns the index at which `value` should be inserted
  8120. * into `array`.
  8121. * @example
  8122. *
  8123. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8124. * // => 4
  8125. */
  8126. function sortedLastIndex(array, value) {
  8127. return baseSortedIndex(array, value, true);
  8128. }
  8129. /**
  8130. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8131. * which is invoked for `value` and each element of `array` to compute their
  8132. * sort ranking. The iteratee is invoked with one argument: (value).
  8133. *
  8134. * @static
  8135. * @memberOf _
  8136. * @since 4.0.0
  8137. * @category Array
  8138. * @param {Array} array The sorted array to inspect.
  8139. * @param {*} value The value to evaluate.
  8140. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8141. * @returns {number} Returns the index at which `value` should be inserted
  8142. * into `array`.
  8143. * @example
  8144. *
  8145. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8146. *
  8147. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8148. * // => 1
  8149. *
  8150. * // The `_.property` iteratee shorthand.
  8151. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8152. * // => 1
  8153. */
  8154. function sortedLastIndexBy(array, value, iteratee) {
  8155. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8156. }
  8157. /**
  8158. * This method is like `_.lastIndexOf` except that it performs a binary
  8159. * search on a sorted `array`.
  8160. *
  8161. * @static
  8162. * @memberOf _
  8163. * @since 4.0.0
  8164. * @category Array
  8165. * @param {Array} array The array to inspect.
  8166. * @param {*} value The value to search for.
  8167. * @returns {number} Returns the index of the matched value, else `-1`.
  8168. * @example
  8169. *
  8170. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8171. * // => 3
  8172. */
  8173. function sortedLastIndexOf(array, value) {
  8174. var length = array == null ? 0 : array.length;
  8175. if (length) {
  8176. var index = baseSortedIndex(array, value, true) - 1;
  8177. if (eq(array[index], value)) {
  8178. return index;
  8179. }
  8180. }
  8181. return -1;
  8182. }
  8183. /**
  8184. * This method is like `_.uniq` except that it's designed and optimized
  8185. * for sorted arrays.
  8186. *
  8187. * @static
  8188. * @memberOf _
  8189. * @since 4.0.0
  8190. * @category Array
  8191. * @param {Array} array The array to inspect.
  8192. * @returns {Array} Returns the new duplicate free array.
  8193. * @example
  8194. *
  8195. * _.sortedUniq([1, 1, 2]);
  8196. * // => [1, 2]
  8197. */
  8198. function sortedUniq(array) {
  8199. return (array && array.length)
  8200. ? baseSortedUniq(array)
  8201. : [];
  8202. }
  8203. /**
  8204. * This method is like `_.uniqBy` except that it's designed and optimized
  8205. * for sorted arrays.
  8206. *
  8207. * @static
  8208. * @memberOf _
  8209. * @since 4.0.0
  8210. * @category Array
  8211. * @param {Array} array The array to inspect.
  8212. * @param {Function} [iteratee] The iteratee invoked per element.
  8213. * @returns {Array} Returns the new duplicate free array.
  8214. * @example
  8215. *
  8216. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8217. * // => [1.1, 2.3]
  8218. */
  8219. function sortedUniqBy(array, iteratee) {
  8220. return (array && array.length)
  8221. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8222. : [];
  8223. }
  8224. /**
  8225. * Gets all but the first element of `array`.
  8226. *
  8227. * @static
  8228. * @memberOf _
  8229. * @since 4.0.0
  8230. * @category Array
  8231. * @param {Array} array The array to query.
  8232. * @returns {Array} Returns the slice of `array`.
  8233. * @example
  8234. *
  8235. * _.tail([1, 2, 3]);
  8236. * // => [2, 3]
  8237. */
  8238. function tail(array) {
  8239. var length = array == null ? 0 : array.length;
  8240. return length ? baseSlice(array, 1, length) : [];
  8241. }
  8242. /**
  8243. * Creates a slice of `array` with `n` elements taken from the beginning.
  8244. *
  8245. * @static
  8246. * @memberOf _
  8247. * @since 0.1.0
  8248. * @category Array
  8249. * @param {Array} array The array to query.
  8250. * @param {number} [n=1] The number of elements to take.
  8251. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8252. * @returns {Array} Returns the slice of `array`.
  8253. * @example
  8254. *
  8255. * _.take([1, 2, 3]);
  8256. * // => [1]
  8257. *
  8258. * _.take([1, 2, 3], 2);
  8259. * // => [1, 2]
  8260. *
  8261. * _.take([1, 2, 3], 5);
  8262. * // => [1, 2, 3]
  8263. *
  8264. * _.take([1, 2, 3], 0);
  8265. * // => []
  8266. */
  8267. function take(array, n, guard) {
  8268. if (!(array && array.length)) {
  8269. return [];
  8270. }
  8271. n = (guard || n === undefined) ? 1 : toInteger(n);
  8272. return baseSlice(array, 0, n < 0 ? 0 : n);
  8273. }
  8274. /**
  8275. * Creates a slice of `array` with `n` elements taken from the end.
  8276. *
  8277. * @static
  8278. * @memberOf _
  8279. * @since 3.0.0
  8280. * @category Array
  8281. * @param {Array} array The array to query.
  8282. * @param {number} [n=1] The number of elements to take.
  8283. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8284. * @returns {Array} Returns the slice of `array`.
  8285. * @example
  8286. *
  8287. * _.takeRight([1, 2, 3]);
  8288. * // => [3]
  8289. *
  8290. * _.takeRight([1, 2, 3], 2);
  8291. * // => [2, 3]
  8292. *
  8293. * _.takeRight([1, 2, 3], 5);
  8294. * // => [1, 2, 3]
  8295. *
  8296. * _.takeRight([1, 2, 3], 0);
  8297. * // => []
  8298. */
  8299. function takeRight(array, n, guard) {
  8300. var length = array == null ? 0 : array.length;
  8301. if (!length) {
  8302. return [];
  8303. }
  8304. n = (guard || n === undefined) ? 1 : toInteger(n);
  8305. n = length - n;
  8306. return baseSlice(array, n < 0 ? 0 : n, length);
  8307. }
  8308. /**
  8309. * Creates a slice of `array` with elements taken from the end. Elements are
  8310. * taken until `predicate` returns falsey. The predicate is invoked with
  8311. * three arguments: (value, index, array).
  8312. *
  8313. * @static
  8314. * @memberOf _
  8315. * @since 3.0.0
  8316. * @category Array
  8317. * @param {Array} array The array to query.
  8318. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8319. * @returns {Array} Returns the slice of `array`.
  8320. * @example
  8321. *
  8322. * var users = [
  8323. * { 'user': 'barney', 'active': true },
  8324. * { 'user': 'fred', 'active': false },
  8325. * { 'user': 'pebbles', 'active': false }
  8326. * ];
  8327. *
  8328. * _.takeRightWhile(users, function(o) { return !o.active; });
  8329. * // => objects for ['fred', 'pebbles']
  8330. *
  8331. * // The `_.matches` iteratee shorthand.
  8332. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8333. * // => objects for ['pebbles']
  8334. *
  8335. * // The `_.matchesProperty` iteratee shorthand.
  8336. * _.takeRightWhile(users, ['active', false]);
  8337. * // => objects for ['fred', 'pebbles']
  8338. *
  8339. * // The `_.property` iteratee shorthand.
  8340. * _.takeRightWhile(users, 'active');
  8341. * // => []
  8342. */
  8343. function takeRightWhile(array, predicate) {
  8344. return (array && array.length)
  8345. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8346. : [];
  8347. }
  8348. /**
  8349. * Creates a slice of `array` with elements taken from the beginning. Elements
  8350. * are taken until `predicate` returns falsey. The predicate is invoked with
  8351. * three arguments: (value, index, array).
  8352. *
  8353. * @static
  8354. * @memberOf _
  8355. * @since 3.0.0
  8356. * @category Array
  8357. * @param {Array} array The array to query.
  8358. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8359. * @returns {Array} Returns the slice of `array`.
  8360. * @example
  8361. *
  8362. * var users = [
  8363. * { 'user': 'barney', 'active': false },
  8364. * { 'user': 'fred', 'active': false },
  8365. * { 'user': 'pebbles', 'active': true }
  8366. * ];
  8367. *
  8368. * _.takeWhile(users, function(o) { return !o.active; });
  8369. * // => objects for ['barney', 'fred']
  8370. *
  8371. * // The `_.matches` iteratee shorthand.
  8372. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  8373. * // => objects for ['barney']
  8374. *
  8375. * // The `_.matchesProperty` iteratee shorthand.
  8376. * _.takeWhile(users, ['active', false]);
  8377. * // => objects for ['barney', 'fred']
  8378. *
  8379. * // The `_.property` iteratee shorthand.
  8380. * _.takeWhile(users, 'active');
  8381. * // => []
  8382. */
  8383. function takeWhile(array, predicate) {
  8384. return (array && array.length)
  8385. ? baseWhile(array, getIteratee(predicate, 3))
  8386. : [];
  8387. }
  8388. /**
  8389. * Creates an array of unique values, in order, from all given arrays using
  8390. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8391. * for equality comparisons.
  8392. *
  8393. * @static
  8394. * @memberOf _
  8395. * @since 0.1.0
  8396. * @category Array
  8397. * @param {...Array} [arrays] The arrays to inspect.
  8398. * @returns {Array} Returns the new array of combined values.
  8399. * @example
  8400. *
  8401. * _.union([2], [1, 2]);
  8402. * // => [2, 1]
  8403. */
  8404. var union = baseRest(function(arrays) {
  8405. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  8406. });
  8407. /**
  8408. * This method is like `_.union` except that it accepts `iteratee` which is
  8409. * invoked for each element of each `arrays` to generate the criterion by
  8410. * which uniqueness is computed. Result values are chosen from the first
  8411. * array in which the value occurs. The iteratee is invoked with one argument:
  8412. * (value).
  8413. *
  8414. * @static
  8415. * @memberOf _
  8416. * @since 4.0.0
  8417. * @category Array
  8418. * @param {...Array} [arrays] The arrays to inspect.
  8419. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8420. * @returns {Array} Returns the new array of combined values.
  8421. * @example
  8422. *
  8423. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  8424. * // => [2.1, 1.2]
  8425. *
  8426. * // The `_.property` iteratee shorthand.
  8427. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8428. * // => [{ 'x': 1 }, { 'x': 2 }]
  8429. */
  8430. var unionBy = baseRest(function(arrays) {
  8431. var iteratee = last(arrays);
  8432. if (isArrayLikeObject(iteratee)) {
  8433. iteratee = undefined;
  8434. }
  8435. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  8436. });
  8437. /**
  8438. * This method is like `_.union` except that it accepts `comparator` which
  8439. * is invoked to compare elements of `arrays`. Result values are chosen from
  8440. * the first array in which the value occurs. The comparator is invoked
  8441. * with two arguments: (arrVal, othVal).
  8442. *
  8443. * @static
  8444. * @memberOf _
  8445. * @since 4.0.0
  8446. * @category Array
  8447. * @param {...Array} [arrays] The arrays to inspect.
  8448. * @param {Function} [comparator] The comparator invoked per element.
  8449. * @returns {Array} Returns the new array of combined values.
  8450. * @example
  8451. *
  8452. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8453. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8454. *
  8455. * _.unionWith(objects, others, _.isEqual);
  8456. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8457. */
  8458. var unionWith = baseRest(function(arrays) {
  8459. var comparator = last(arrays);
  8460. comparator = typeof comparator == 'function' ? comparator : undefined;
  8461. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  8462. });
  8463. /**
  8464. * Creates a duplicate-free version of an array, using
  8465. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8466. * for equality comparisons, in which only the first occurrence of each element
  8467. * is kept. The order of result values is determined by the order they occur
  8468. * in the array.
  8469. *
  8470. * @static
  8471. * @memberOf _
  8472. * @since 0.1.0
  8473. * @category Array
  8474. * @param {Array} array The array to inspect.
  8475. * @returns {Array} Returns the new duplicate free array.
  8476. * @example
  8477. *
  8478. * _.uniq([2, 1, 2]);
  8479. * // => [2, 1]
  8480. */
  8481. function uniq(array) {
  8482. return (array && array.length) ? baseUniq(array) : [];
  8483. }
  8484. /**
  8485. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8486. * invoked for each element in `array` to generate the criterion by which
  8487. * uniqueness is computed. The order of result values is determined by the
  8488. * order they occur in the array. The iteratee is invoked with one argument:
  8489. * (value).
  8490. *
  8491. * @static
  8492. * @memberOf _
  8493. * @since 4.0.0
  8494. * @category Array
  8495. * @param {Array} array The array to inspect.
  8496. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8497. * @returns {Array} Returns the new duplicate free array.
  8498. * @example
  8499. *
  8500. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8501. * // => [2.1, 1.2]
  8502. *
  8503. * // The `_.property` iteratee shorthand.
  8504. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8505. * // => [{ 'x': 1 }, { 'x': 2 }]
  8506. */
  8507. function uniqBy(array, iteratee) {
  8508. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  8509. }
  8510. /**
  8511. * This method is like `_.uniq` except that it accepts `comparator` which
  8512. * is invoked to compare elements of `array`. The order of result values is
  8513. * determined by the order they occur in the array.The comparator is invoked
  8514. * with two arguments: (arrVal, othVal).
  8515. *
  8516. * @static
  8517. * @memberOf _
  8518. * @since 4.0.0
  8519. * @category Array
  8520. * @param {Array} array The array to inspect.
  8521. * @param {Function} [comparator] The comparator invoked per element.
  8522. * @returns {Array} Returns the new duplicate free array.
  8523. * @example
  8524. *
  8525. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8526. *
  8527. * _.uniqWith(objects, _.isEqual);
  8528. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  8529. */
  8530. function uniqWith(array, comparator) {
  8531. comparator = typeof comparator == 'function' ? comparator : undefined;
  8532. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  8533. }
  8534. /**
  8535. * This method is like `_.zip` except that it accepts an array of grouped
  8536. * elements and creates an array regrouping the elements to their pre-zip
  8537. * configuration.
  8538. *
  8539. * @static
  8540. * @memberOf _
  8541. * @since 1.2.0
  8542. * @category Array
  8543. * @param {Array} array The array of grouped elements to process.
  8544. * @returns {Array} Returns the new array of regrouped elements.
  8545. * @example
  8546. *
  8547. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  8548. * // => [['a', 1, true], ['b', 2, false]]
  8549. *
  8550. * _.unzip(zipped);
  8551. * // => [['a', 'b'], [1, 2], [true, false]]
  8552. */
  8553. function unzip(array) {
  8554. if (!(array && array.length)) {
  8555. return [];
  8556. }
  8557. var length = 0;
  8558. array = arrayFilter(array, function(group) {
  8559. if (isArrayLikeObject(group)) {
  8560. length = nativeMax(group.length, length);
  8561. return true;
  8562. }
  8563. });
  8564. return baseTimes(length, function(index) {
  8565. return arrayMap(array, baseProperty(index));
  8566. });
  8567. }
  8568. /**
  8569. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  8570. * how regrouped values should be combined. The iteratee is invoked with the
  8571. * elements of each group: (...group).
  8572. *
  8573. * @static
  8574. * @memberOf _
  8575. * @since 3.8.0
  8576. * @category Array
  8577. * @param {Array} array The array of grouped elements to process.
  8578. * @param {Function} [iteratee=_.identity] The function to combine
  8579. * regrouped values.
  8580. * @returns {Array} Returns the new array of regrouped elements.
  8581. * @example
  8582. *
  8583. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  8584. * // => [[1, 10, 100], [2, 20, 200]]
  8585. *
  8586. * _.unzipWith(zipped, _.add);
  8587. * // => [3, 30, 300]
  8588. */
  8589. function unzipWith(array, iteratee) {
  8590. if (!(array && array.length)) {
  8591. return [];
  8592. }
  8593. var result = unzip(array);
  8594. if (iteratee == null) {
  8595. return result;
  8596. }
  8597. return arrayMap(result, function(group) {
  8598. return apply(iteratee, undefined, group);
  8599. });
  8600. }
  8601. /**
  8602. * Creates an array excluding all given values using
  8603. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8604. * for equality comparisons.
  8605. *
  8606. * **Note:** Unlike `_.pull`, this method returns a new array.
  8607. *
  8608. * @static
  8609. * @memberOf _
  8610. * @since 0.1.0
  8611. * @category Array
  8612. * @param {Array} array The array to inspect.
  8613. * @param {...*} [values] The values to exclude.
  8614. * @returns {Array} Returns the new array of filtered values.
  8615. * @see _.difference, _.xor
  8616. * @example
  8617. *
  8618. * _.without([2, 1, 2, 3], 1, 2);
  8619. * // => [3]
  8620. */
  8621. var without = baseRest(function(array, values) {
  8622. return isArrayLikeObject(array)
  8623. ? baseDifference(array, values)
  8624. : [];
  8625. });
  8626. /**
  8627. * Creates an array of unique values that is the
  8628. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  8629. * of the given arrays. The order of result values is determined by the order
  8630. * they occur in the arrays.
  8631. *
  8632. * @static
  8633. * @memberOf _
  8634. * @since 2.4.0
  8635. * @category Array
  8636. * @param {...Array} [arrays] The arrays to inspect.
  8637. * @returns {Array} Returns the new array of filtered values.
  8638. * @see _.difference, _.without
  8639. * @example
  8640. *
  8641. * _.xor([2, 1], [2, 3]);
  8642. * // => [1, 3]
  8643. */
  8644. var xor = baseRest(function(arrays) {
  8645. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  8646. });
  8647. /**
  8648. * This method is like `_.xor` except that it accepts `iteratee` which is
  8649. * invoked for each element of each `arrays` to generate the criterion by
  8650. * which by which they're compared. The order of result values is determined
  8651. * by the order they occur in the arrays. The iteratee is invoked with one
  8652. * argument: (value).
  8653. *
  8654. * @static
  8655. * @memberOf _
  8656. * @since 4.0.0
  8657. * @category Array
  8658. * @param {...Array} [arrays] The arrays to inspect.
  8659. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8660. * @returns {Array} Returns the new array of filtered values.
  8661. * @example
  8662. *
  8663. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8664. * // => [1.2, 3.4]
  8665. *
  8666. * // The `_.property` iteratee shorthand.
  8667. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8668. * // => [{ 'x': 2 }]
  8669. */
  8670. var xorBy = baseRest(function(arrays) {
  8671. var iteratee = last(arrays);
  8672. if (isArrayLikeObject(iteratee)) {
  8673. iteratee = undefined;
  8674. }
  8675. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  8676. });
  8677. /**
  8678. * This method is like `_.xor` except that it accepts `comparator` which is
  8679. * invoked to compare elements of `arrays`. The order of result values is
  8680. * determined by the order they occur in the arrays. The comparator is invoked
  8681. * with two arguments: (arrVal, othVal).
  8682. *
  8683. * @static
  8684. * @memberOf _
  8685. * @since 4.0.0
  8686. * @category Array
  8687. * @param {...Array} [arrays] The arrays to inspect.
  8688. * @param {Function} [comparator] The comparator invoked per element.
  8689. * @returns {Array} Returns the new array of filtered values.
  8690. * @example
  8691. *
  8692. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8693. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8694. *
  8695. * _.xorWith(objects, others, _.isEqual);
  8696. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8697. */
  8698. var xorWith = baseRest(function(arrays) {
  8699. var comparator = last(arrays);
  8700. comparator = typeof comparator == 'function' ? comparator : undefined;
  8701. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  8702. });
  8703. /**
  8704. * Creates an array of grouped elements, the first of which contains the
  8705. * first elements of the given arrays, the second of which contains the
  8706. * second elements of the given arrays, and so on.
  8707. *
  8708. * @static
  8709. * @memberOf _
  8710. * @since 0.1.0
  8711. * @category Array
  8712. * @param {...Array} [arrays] The arrays to process.
  8713. * @returns {Array} Returns the new array of grouped elements.
  8714. * @example
  8715. *
  8716. * _.zip(['a', 'b'], [1, 2], [true, false]);
  8717. * // => [['a', 1, true], ['b', 2, false]]
  8718. */
  8719. var zip = baseRest(unzip);
  8720. /**
  8721. * This method is like `_.fromPairs` except that it accepts two arrays,
  8722. * one of property identifiers and one of corresponding values.
  8723. *
  8724. * @static
  8725. * @memberOf _
  8726. * @since 0.4.0
  8727. * @category Array
  8728. * @param {Array} [props=[]] The property identifiers.
  8729. * @param {Array} [values=[]] The property values.
  8730. * @returns {Object} Returns the new object.
  8731. * @example
  8732. *
  8733. * _.zipObject(['a', 'b'], [1, 2]);
  8734. * // => { 'a': 1, 'b': 2 }
  8735. */
  8736. function zipObject(props, values) {
  8737. return baseZipObject(props || [], values || [], assignValue);
  8738. }
  8739. /**
  8740. * This method is like `_.zipObject` except that it supports property paths.
  8741. *
  8742. * @static
  8743. * @memberOf _
  8744. * @since 4.1.0
  8745. * @category Array
  8746. * @param {Array} [props=[]] The property identifiers.
  8747. * @param {Array} [values=[]] The property values.
  8748. * @returns {Object} Returns the new object.
  8749. * @example
  8750. *
  8751. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  8752. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  8753. */
  8754. function zipObjectDeep(props, values) {
  8755. return baseZipObject(props || [], values || [], baseSet);
  8756. }
  8757. /**
  8758. * This method is like `_.zip` except that it accepts `iteratee` to specify
  8759. * how grouped values should be combined. The iteratee is invoked with the
  8760. * elements of each group: (...group).
  8761. *
  8762. * @static
  8763. * @memberOf _
  8764. * @since 3.8.0
  8765. * @category Array
  8766. * @param {...Array} [arrays] The arrays to process.
  8767. * @param {Function} [iteratee=_.identity] The function to combine
  8768. * grouped values.
  8769. * @returns {Array} Returns the new array of grouped elements.
  8770. * @example
  8771. *
  8772. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  8773. * return a + b + c;
  8774. * });
  8775. * // => [111, 222]
  8776. */
  8777. var zipWith = baseRest(function(arrays) {
  8778. var length = arrays.length,
  8779. iteratee = length > 1 ? arrays[length - 1] : undefined;
  8780. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  8781. return unzipWith(arrays, iteratee);
  8782. });
  8783. /*------------------------------------------------------------------------*/
  8784. /**
  8785. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  8786. * chain sequences enabled. The result of such sequences must be unwrapped
  8787. * with `_#value`.
  8788. *
  8789. * @static
  8790. * @memberOf _
  8791. * @since 1.3.0
  8792. * @category Seq
  8793. * @param {*} value The value to wrap.
  8794. * @returns {Object} Returns the new `lodash` wrapper instance.
  8795. * @example
  8796. *
  8797. * var users = [
  8798. * { 'user': 'barney', 'age': 36 },
  8799. * { 'user': 'fred', 'age': 40 },
  8800. * { 'user': 'pebbles', 'age': 1 }
  8801. * ];
  8802. *
  8803. * var youngest = _
  8804. * .chain(users)
  8805. * .sortBy('age')
  8806. * .map(function(o) {
  8807. * return o.user + ' is ' + o.age;
  8808. * })
  8809. * .head()
  8810. * .value();
  8811. * // => 'pebbles is 1'
  8812. */
  8813. function chain(value) {
  8814. var result = lodash(value);
  8815. result.__chain__ = true;
  8816. return result;
  8817. }
  8818. /**
  8819. * This method invokes `interceptor` and returns `value`. The interceptor
  8820. * is invoked with one argument; (value). The purpose of this method is to
  8821. * "tap into" a method chain sequence in order to modify intermediate results.
  8822. *
  8823. * @static
  8824. * @memberOf _
  8825. * @since 0.1.0
  8826. * @category Seq
  8827. * @param {*} value The value to provide to `interceptor`.
  8828. * @param {Function} interceptor The function to invoke.
  8829. * @returns {*} Returns `value`.
  8830. * @example
  8831. *
  8832. * _([1, 2, 3])
  8833. * .tap(function(array) {
  8834. * // Mutate input array.
  8835. * array.pop();
  8836. * })
  8837. * .reverse()
  8838. * .value();
  8839. * // => [2, 1]
  8840. */
  8841. function tap(value, interceptor) {
  8842. interceptor(value);
  8843. return value;
  8844. }
  8845. /**
  8846. * This method is like `_.tap` except that it returns the result of `interceptor`.
  8847. * The purpose of this method is to "pass thru" values replacing intermediate
  8848. * results in a method chain sequence.
  8849. *
  8850. * @static
  8851. * @memberOf _
  8852. * @since 3.0.0
  8853. * @category Seq
  8854. * @param {*} value The value to provide to `interceptor`.
  8855. * @param {Function} interceptor The function to invoke.
  8856. * @returns {*} Returns the result of `interceptor`.
  8857. * @example
  8858. *
  8859. * _(' abc ')
  8860. * .chain()
  8861. * .trim()
  8862. * .thru(function(value) {
  8863. * return [value];
  8864. * })
  8865. * .value();
  8866. * // => ['abc']
  8867. */
  8868. function thru(value, interceptor) {
  8869. return interceptor(value);
  8870. }
  8871. /**
  8872. * This method is the wrapper version of `_.at`.
  8873. *
  8874. * @name at
  8875. * @memberOf _
  8876. * @since 1.0.0
  8877. * @category Seq
  8878. * @param {...(string|string[])} [paths] The property paths to pick.
  8879. * @returns {Object} Returns the new `lodash` wrapper instance.
  8880. * @example
  8881. *
  8882. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  8883. *
  8884. * _(object).at(['a[0].b.c', 'a[1]']).value();
  8885. * // => [3, 4]
  8886. */
  8887. var wrapperAt = flatRest(function(paths) {
  8888. var length = paths.length,
  8889. start = length ? paths[0] : 0,
  8890. value = this.__wrapped__,
  8891. interceptor = function(object) { return baseAt(object, paths); };
  8892. if (length > 1 || this.__actions__.length ||
  8893. !(value instanceof LazyWrapper) || !isIndex(start)) {
  8894. return this.thru(interceptor);
  8895. }
  8896. value = value.slice(start, +start + (length ? 1 : 0));
  8897. value.__actions__.push({
  8898. 'func': thru,
  8899. 'args': [interceptor],
  8900. 'thisArg': undefined
  8901. });
  8902. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  8903. if (length && !array.length) {
  8904. array.push(undefined);
  8905. }
  8906. return array;
  8907. });
  8908. });
  8909. /**
  8910. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  8911. *
  8912. * @name chain
  8913. * @memberOf _
  8914. * @since 0.1.0
  8915. * @category Seq
  8916. * @returns {Object} Returns the new `lodash` wrapper instance.
  8917. * @example
  8918. *
  8919. * var users = [
  8920. * { 'user': 'barney', 'age': 36 },
  8921. * { 'user': 'fred', 'age': 40 }
  8922. * ];
  8923. *
  8924. * // A sequence without explicit chaining.
  8925. * _(users).head();
  8926. * // => { 'user': 'barney', 'age': 36 }
  8927. *
  8928. * // A sequence with explicit chaining.
  8929. * _(users)
  8930. * .chain()
  8931. * .head()
  8932. * .pick('user')
  8933. * .value();
  8934. * // => { 'user': 'barney' }
  8935. */
  8936. function wrapperChain() {
  8937. return chain(this);
  8938. }
  8939. /**
  8940. * Executes the chain sequence and returns the wrapped result.
  8941. *
  8942. * @name commit
  8943. * @memberOf _
  8944. * @since 3.2.0
  8945. * @category Seq
  8946. * @returns {Object} Returns the new `lodash` wrapper instance.
  8947. * @example
  8948. *
  8949. * var array = [1, 2];
  8950. * var wrapped = _(array).push(3);
  8951. *
  8952. * console.log(array);
  8953. * // => [1, 2]
  8954. *
  8955. * wrapped = wrapped.commit();
  8956. * console.log(array);
  8957. * // => [1, 2, 3]
  8958. *
  8959. * wrapped.last();
  8960. * // => 3
  8961. *
  8962. * console.log(array);
  8963. * // => [1, 2, 3]
  8964. */
  8965. function wrapperCommit() {
  8966. return new LodashWrapper(this.value(), this.__chain__);
  8967. }
  8968. /**
  8969. * Gets the next value on a wrapped object following the
  8970. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  8971. *
  8972. * @name next
  8973. * @memberOf _
  8974. * @since 4.0.0
  8975. * @category Seq
  8976. * @returns {Object} Returns the next iterator value.
  8977. * @example
  8978. *
  8979. * var wrapped = _([1, 2]);
  8980. *
  8981. * wrapped.next();
  8982. * // => { 'done': false, 'value': 1 }
  8983. *
  8984. * wrapped.next();
  8985. * // => { 'done': false, 'value': 2 }
  8986. *
  8987. * wrapped.next();
  8988. * // => { 'done': true, 'value': undefined }
  8989. */
  8990. function wrapperNext() {
  8991. if (this.__values__ === undefined) {
  8992. this.__values__ = toArray(this.value());
  8993. }
  8994. var done = this.__index__ >= this.__values__.length,
  8995. value = done ? undefined : this.__values__[this.__index__++];
  8996. return { 'done': done, 'value': value };
  8997. }
  8998. /**
  8999. * Enables the wrapper to be iterable.
  9000. *
  9001. * @name Symbol.iterator
  9002. * @memberOf _
  9003. * @since 4.0.0
  9004. * @category Seq
  9005. * @returns {Object} Returns the wrapper object.
  9006. * @example
  9007. *
  9008. * var wrapped = _([1, 2]);
  9009. *
  9010. * wrapped[Symbol.iterator]() === wrapped;
  9011. * // => true
  9012. *
  9013. * Array.from(wrapped);
  9014. * // => [1, 2]
  9015. */
  9016. function wrapperToIterator() {
  9017. return this;
  9018. }
  9019. /**
  9020. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9021. *
  9022. * @name plant
  9023. * @memberOf _
  9024. * @since 3.2.0
  9025. * @category Seq
  9026. * @param {*} value The value to plant.
  9027. * @returns {Object} Returns the new `lodash` wrapper instance.
  9028. * @example
  9029. *
  9030. * function square(n) {
  9031. * return n * n;
  9032. * }
  9033. *
  9034. * var wrapped = _([1, 2]).map(square);
  9035. * var other = wrapped.plant([3, 4]);
  9036. *
  9037. * other.value();
  9038. * // => [9, 16]
  9039. *
  9040. * wrapped.value();
  9041. * // => [1, 4]
  9042. */
  9043. function wrapperPlant(value) {
  9044. var result,
  9045. parent = this;
  9046. while (parent instanceof baseLodash) {
  9047. var clone = wrapperClone(parent);
  9048. clone.__index__ = 0;
  9049. clone.__values__ = undefined;
  9050. if (result) {
  9051. previous.__wrapped__ = clone;
  9052. } else {
  9053. result = clone;
  9054. }
  9055. var previous = clone;
  9056. parent = parent.__wrapped__;
  9057. }
  9058. previous.__wrapped__ = value;
  9059. return result;
  9060. }
  9061. /**
  9062. * This method is the wrapper version of `_.reverse`.
  9063. *
  9064. * **Note:** This method mutates the wrapped array.
  9065. *
  9066. * @name reverse
  9067. * @memberOf _
  9068. * @since 0.1.0
  9069. * @category Seq
  9070. * @returns {Object} Returns the new `lodash` wrapper instance.
  9071. * @example
  9072. *
  9073. * var array = [1, 2, 3];
  9074. *
  9075. * _(array).reverse().value()
  9076. * // => [3, 2, 1]
  9077. *
  9078. * console.log(array);
  9079. * // => [3, 2, 1]
  9080. */
  9081. function wrapperReverse() {
  9082. var value = this.__wrapped__;
  9083. if (value instanceof LazyWrapper) {
  9084. var wrapped = value;
  9085. if (this.__actions__.length) {
  9086. wrapped = new LazyWrapper(this);
  9087. }
  9088. wrapped = wrapped.reverse();
  9089. wrapped.__actions__.push({
  9090. 'func': thru,
  9091. 'args': [reverse],
  9092. 'thisArg': undefined
  9093. });
  9094. return new LodashWrapper(wrapped, this.__chain__);
  9095. }
  9096. return this.thru(reverse);
  9097. }
  9098. /**
  9099. * Executes the chain sequence to resolve the unwrapped value.
  9100. *
  9101. * @name value
  9102. * @memberOf _
  9103. * @since 0.1.0
  9104. * @alias toJSON, valueOf
  9105. * @category Seq
  9106. * @returns {*} Returns the resolved unwrapped value.
  9107. * @example
  9108. *
  9109. * _([1, 2, 3]).value();
  9110. * // => [1, 2, 3]
  9111. */
  9112. function wrapperValue() {
  9113. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9114. }
  9115. /*------------------------------------------------------------------------*/
  9116. /**
  9117. * Creates an object composed of keys generated from the results of running
  9118. * each element of `collection` thru `iteratee`. The corresponding value of
  9119. * each key is the number of times the key was returned by `iteratee`. The
  9120. * iteratee is invoked with one argument: (value).
  9121. *
  9122. * @static
  9123. * @memberOf _
  9124. * @since 0.5.0
  9125. * @category Collection
  9126. * @param {Array|Object} collection The collection to iterate over.
  9127. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9128. * @returns {Object} Returns the composed aggregate object.
  9129. * @example
  9130. *
  9131. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9132. * // => { '4': 1, '6': 2 }
  9133. *
  9134. * // The `_.property` iteratee shorthand.
  9135. * _.countBy(['one', 'two', 'three'], 'length');
  9136. * // => { '3': 2, '5': 1 }
  9137. */
  9138. var countBy = createAggregator(function(result, value, key) {
  9139. if (hasOwnProperty.call(result, key)) {
  9140. ++result[key];
  9141. } else {
  9142. baseAssignValue(result, key, 1);
  9143. }
  9144. });
  9145. /**
  9146. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9147. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9148. * invoked with three arguments: (value, index|key, collection).
  9149. *
  9150. * **Note:** This method returns `true` for
  9151. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9152. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9153. * elements of empty collections.
  9154. *
  9155. * @static
  9156. * @memberOf _
  9157. * @since 0.1.0
  9158. * @category Collection
  9159. * @param {Array|Object} collection The collection to iterate over.
  9160. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9161. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9162. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9163. * else `false`.
  9164. * @example
  9165. *
  9166. * _.every([true, 1, null, 'yes'], Boolean);
  9167. * // => false
  9168. *
  9169. * var users = [
  9170. * { 'user': 'barney', 'age': 36, 'active': false },
  9171. * { 'user': 'fred', 'age': 40, 'active': false }
  9172. * ];
  9173. *
  9174. * // The `_.matches` iteratee shorthand.
  9175. * _.every(users, { 'user': 'barney', 'active': false });
  9176. * // => false
  9177. *
  9178. * // The `_.matchesProperty` iteratee shorthand.
  9179. * _.every(users, ['active', false]);
  9180. * // => true
  9181. *
  9182. * // The `_.property` iteratee shorthand.
  9183. * _.every(users, 'active');
  9184. * // => false
  9185. */
  9186. function every(collection, predicate, guard) {
  9187. var func = isArray(collection) ? arrayEvery : baseEvery;
  9188. if (guard && isIterateeCall(collection, predicate, guard)) {
  9189. predicate = undefined;
  9190. }
  9191. return func(collection, getIteratee(predicate, 3));
  9192. }
  9193. /**
  9194. * Iterates over elements of `collection`, returning an array of all elements
  9195. * `predicate` returns truthy for. The predicate is invoked with three
  9196. * arguments: (value, index|key, collection).
  9197. *
  9198. * **Note:** Unlike `_.remove`, this method returns a new array.
  9199. *
  9200. * @static
  9201. * @memberOf _
  9202. * @since 0.1.0
  9203. * @category Collection
  9204. * @param {Array|Object} collection The collection to iterate over.
  9205. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9206. * @returns {Array} Returns the new filtered array.
  9207. * @see _.reject
  9208. * @example
  9209. *
  9210. * var users = [
  9211. * { 'user': 'barney', 'age': 36, 'active': true },
  9212. * { 'user': 'fred', 'age': 40, 'active': false }
  9213. * ];
  9214. *
  9215. * _.filter(users, function(o) { return !o.active; });
  9216. * // => objects for ['fred']
  9217. *
  9218. * // The `_.matches` iteratee shorthand.
  9219. * _.filter(users, { 'age': 36, 'active': true });
  9220. * // => objects for ['barney']
  9221. *
  9222. * // The `_.matchesProperty` iteratee shorthand.
  9223. * _.filter(users, ['active', false]);
  9224. * // => objects for ['fred']
  9225. *
  9226. * // The `_.property` iteratee shorthand.
  9227. * _.filter(users, 'active');
  9228. * // => objects for ['barney']
  9229. */
  9230. function filter(collection, predicate) {
  9231. var func = isArray(collection) ? arrayFilter : baseFilter;
  9232. return func(collection, getIteratee(predicate, 3));
  9233. }
  9234. /**
  9235. * Iterates over elements of `collection`, returning the first element
  9236. * `predicate` returns truthy for. The predicate is invoked with three
  9237. * arguments: (value, index|key, collection).
  9238. *
  9239. * @static
  9240. * @memberOf _
  9241. * @since 0.1.0
  9242. * @category Collection
  9243. * @param {Array|Object} collection The collection to inspect.
  9244. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9245. * @param {number} [fromIndex=0] The index to search from.
  9246. * @returns {*} Returns the matched element, else `undefined`.
  9247. * @example
  9248. *
  9249. * var users = [
  9250. * { 'user': 'barney', 'age': 36, 'active': true },
  9251. * { 'user': 'fred', 'age': 40, 'active': false },
  9252. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9253. * ];
  9254. *
  9255. * _.find(users, function(o) { return o.age < 40; });
  9256. * // => object for 'barney'
  9257. *
  9258. * // The `_.matches` iteratee shorthand.
  9259. * _.find(users, { 'age': 1, 'active': true });
  9260. * // => object for 'pebbles'
  9261. *
  9262. * // The `_.matchesProperty` iteratee shorthand.
  9263. * _.find(users, ['active', false]);
  9264. * // => object for 'fred'
  9265. *
  9266. * // The `_.property` iteratee shorthand.
  9267. * _.find(users, 'active');
  9268. * // => object for 'barney'
  9269. */
  9270. var find = createFind(findIndex);
  9271. /**
  9272. * This method is like `_.find` except that it iterates over elements of
  9273. * `collection` from right to left.
  9274. *
  9275. * @static
  9276. * @memberOf _
  9277. * @since 2.0.0
  9278. * @category Collection
  9279. * @param {Array|Object} collection The collection to inspect.
  9280. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9281. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9282. * @returns {*} Returns the matched element, else `undefined`.
  9283. * @example
  9284. *
  9285. * _.findLast([1, 2, 3, 4], function(n) {
  9286. * return n % 2 == 1;
  9287. * });
  9288. * // => 3
  9289. */
  9290. var findLast = createFind(findLastIndex);
  9291. /**
  9292. * Creates a flattened array of values by running each element in `collection`
  9293. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9294. * with three arguments: (value, index|key, collection).
  9295. *
  9296. * @static
  9297. * @memberOf _
  9298. * @since 4.0.0
  9299. * @category Collection
  9300. * @param {Array|Object} collection The collection to iterate over.
  9301. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9302. * @returns {Array} Returns the new flattened array.
  9303. * @example
  9304. *
  9305. * function duplicate(n) {
  9306. * return [n, n];
  9307. * }
  9308. *
  9309. * _.flatMap([1, 2], duplicate);
  9310. * // => [1, 1, 2, 2]
  9311. */
  9312. function flatMap(collection, iteratee) {
  9313. return baseFlatten(map(collection, iteratee), 1);
  9314. }
  9315. /**
  9316. * This method is like `_.flatMap` except that it recursively flattens the
  9317. * mapped results.
  9318. *
  9319. * @static
  9320. * @memberOf _
  9321. * @since 4.7.0
  9322. * @category Collection
  9323. * @param {Array|Object} collection The collection to iterate over.
  9324. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9325. * @returns {Array} Returns the new flattened array.
  9326. * @example
  9327. *
  9328. * function duplicate(n) {
  9329. * return [[[n, n]]];
  9330. * }
  9331. *
  9332. * _.flatMapDeep([1, 2], duplicate);
  9333. * // => [1, 1, 2, 2]
  9334. */
  9335. function flatMapDeep(collection, iteratee) {
  9336. return baseFlatten(map(collection, iteratee), INFINITY);
  9337. }
  9338. /**
  9339. * This method is like `_.flatMap` except that it recursively flattens the
  9340. * mapped results up to `depth` times.
  9341. *
  9342. * @static
  9343. * @memberOf _
  9344. * @since 4.7.0
  9345. * @category Collection
  9346. * @param {Array|Object} collection The collection to iterate over.
  9347. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9348. * @param {number} [depth=1] The maximum recursion depth.
  9349. * @returns {Array} Returns the new flattened array.
  9350. * @example
  9351. *
  9352. * function duplicate(n) {
  9353. * return [[[n, n]]];
  9354. * }
  9355. *
  9356. * _.flatMapDepth([1, 2], duplicate, 2);
  9357. * // => [[1, 1], [2, 2]]
  9358. */
  9359. function flatMapDepth(collection, iteratee, depth) {
  9360. depth = depth === undefined ? 1 : toInteger(depth);
  9361. return baseFlatten(map(collection, iteratee), depth);
  9362. }
  9363. /**
  9364. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9365. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9366. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9367. *
  9368. * **Note:** As with other "Collections" methods, objects with a "length"
  9369. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9370. * or `_.forOwn` for object iteration.
  9371. *
  9372. * @static
  9373. * @memberOf _
  9374. * @since 0.1.0
  9375. * @alias each
  9376. * @category Collection
  9377. * @param {Array|Object} collection The collection to iterate over.
  9378. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9379. * @returns {Array|Object} Returns `collection`.
  9380. * @see _.forEachRight
  9381. * @example
  9382. *
  9383. * _.forEach([1, 2], function(value) {
  9384. * console.log(value);
  9385. * });
  9386. * // => Logs `1` then `2`.
  9387. *
  9388. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9389. * console.log(key);
  9390. * });
  9391. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9392. */
  9393. function forEach(collection, iteratee) {
  9394. var func = isArray(collection) ? arrayEach : baseEach;
  9395. return func(collection, getIteratee(iteratee, 3));
  9396. }
  9397. /**
  9398. * This method is like `_.forEach` except that it iterates over elements of
  9399. * `collection` from right to left.
  9400. *
  9401. * @static
  9402. * @memberOf _
  9403. * @since 2.0.0
  9404. * @alias eachRight
  9405. * @category Collection
  9406. * @param {Array|Object} collection The collection to iterate over.
  9407. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9408. * @returns {Array|Object} Returns `collection`.
  9409. * @see _.forEach
  9410. * @example
  9411. *
  9412. * _.forEachRight([1, 2], function(value) {
  9413. * console.log(value);
  9414. * });
  9415. * // => Logs `2` then `1`.
  9416. */
  9417. function forEachRight(collection, iteratee) {
  9418. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  9419. return func(collection, getIteratee(iteratee, 3));
  9420. }
  9421. /**
  9422. * Creates an object composed of keys generated from the results of running
  9423. * each element of `collection` thru `iteratee`. The order of grouped values
  9424. * is determined by the order they occur in `collection`. The corresponding
  9425. * value of each key is an array of elements responsible for generating the
  9426. * key. The iteratee is invoked with one argument: (value).
  9427. *
  9428. * @static
  9429. * @memberOf _
  9430. * @since 0.1.0
  9431. * @category Collection
  9432. * @param {Array|Object} collection The collection to iterate over.
  9433. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9434. * @returns {Object} Returns the composed aggregate object.
  9435. * @example
  9436. *
  9437. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  9438. * // => { '4': [4.2], '6': [6.1, 6.3] }
  9439. *
  9440. * // The `_.property` iteratee shorthand.
  9441. * _.groupBy(['one', 'two', 'three'], 'length');
  9442. * // => { '3': ['one', 'two'], '5': ['three'] }
  9443. */
  9444. var groupBy = createAggregator(function(result, value, key) {
  9445. if (hasOwnProperty.call(result, key)) {
  9446. result[key].push(value);
  9447. } else {
  9448. baseAssignValue(result, key, [value]);
  9449. }
  9450. });
  9451. /**
  9452. * Checks if `value` is in `collection`. If `collection` is a string, it's
  9453. * checked for a substring of `value`, otherwise
  9454. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9455. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  9456. * the offset from the end of `collection`.
  9457. *
  9458. * @static
  9459. * @memberOf _
  9460. * @since 0.1.0
  9461. * @category Collection
  9462. * @param {Array|Object|string} collection The collection to inspect.
  9463. * @param {*} value The value to search for.
  9464. * @param {number} [fromIndex=0] The index to search from.
  9465. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9466. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  9467. * @example
  9468. *
  9469. * _.includes([1, 2, 3], 1);
  9470. * // => true
  9471. *
  9472. * _.includes([1, 2, 3], 1, 2);
  9473. * // => false
  9474. *
  9475. * _.includes({ 'a': 1, 'b': 2 }, 1);
  9476. * // => true
  9477. *
  9478. * _.includes('abcd', 'bc');
  9479. * // => true
  9480. */
  9481. function includes(collection, value, fromIndex, guard) {
  9482. collection = isArrayLike(collection) ? collection : values(collection);
  9483. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  9484. var length = collection.length;
  9485. if (fromIndex < 0) {
  9486. fromIndex = nativeMax(length + fromIndex, 0);
  9487. }
  9488. return isString(collection)
  9489. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  9490. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  9491. }
  9492. /**
  9493. * Invokes the method at `path` of each element in `collection`, returning
  9494. * an array of the results of each invoked method. Any additional arguments
  9495. * are provided to each invoked method. If `path` is a function, it's invoked
  9496. * for, and `this` bound to, each element in `collection`.
  9497. *
  9498. * @static
  9499. * @memberOf _
  9500. * @since 4.0.0
  9501. * @category Collection
  9502. * @param {Array|Object} collection The collection to iterate over.
  9503. * @param {Array|Function|string} path The path of the method to invoke or
  9504. * the function invoked per iteration.
  9505. * @param {...*} [args] The arguments to invoke each method with.
  9506. * @returns {Array} Returns the array of results.
  9507. * @example
  9508. *
  9509. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  9510. * // => [[1, 5, 7], [1, 2, 3]]
  9511. *
  9512. * _.invokeMap([123, 456], String.prototype.split, '');
  9513. * // => [['1', '2', '3'], ['4', '5', '6']]
  9514. */
  9515. var invokeMap = baseRest(function(collection, path, args) {
  9516. var index = -1,
  9517. isFunc = typeof path == 'function',
  9518. result = isArrayLike(collection) ? Array(collection.length) : [];
  9519. baseEach(collection, function(value) {
  9520. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  9521. });
  9522. return result;
  9523. });
  9524. /**
  9525. * Creates an object composed of keys generated from the results of running
  9526. * each element of `collection` thru `iteratee`. The corresponding value of
  9527. * each key is the last element responsible for generating the key. The
  9528. * iteratee is invoked with one argument: (value).
  9529. *
  9530. * @static
  9531. * @memberOf _
  9532. * @since 4.0.0
  9533. * @category Collection
  9534. * @param {Array|Object} collection The collection to iterate over.
  9535. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9536. * @returns {Object} Returns the composed aggregate object.
  9537. * @example
  9538. *
  9539. * var array = [
  9540. * { 'dir': 'left', 'code': 97 },
  9541. * { 'dir': 'right', 'code': 100 }
  9542. * ];
  9543. *
  9544. * _.keyBy(array, function(o) {
  9545. * return String.fromCharCode(o.code);
  9546. * });
  9547. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  9548. *
  9549. * _.keyBy(array, 'dir');
  9550. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  9551. */
  9552. var keyBy = createAggregator(function(result, value, key) {
  9553. baseAssignValue(result, key, value);
  9554. });
  9555. /**
  9556. * Creates an array of values by running each element in `collection` thru
  9557. * `iteratee`. The iteratee is invoked with three arguments:
  9558. * (value, index|key, collection).
  9559. *
  9560. * Many lodash methods are guarded to work as iteratees for methods like
  9561. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  9562. *
  9563. * The guarded methods are:
  9564. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  9565. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  9566. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  9567. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  9568. *
  9569. * @static
  9570. * @memberOf _
  9571. * @since 0.1.0
  9572. * @category Collection
  9573. * @param {Array|Object} collection The collection to iterate over.
  9574. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9575. * @returns {Array} Returns the new mapped array.
  9576. * @example
  9577. *
  9578. * function square(n) {
  9579. * return n * n;
  9580. * }
  9581. *
  9582. * _.map([4, 8], square);
  9583. * // => [16, 64]
  9584. *
  9585. * _.map({ 'a': 4, 'b': 8 }, square);
  9586. * // => [16, 64] (iteration order is not guaranteed)
  9587. *
  9588. * var users = [
  9589. * { 'user': 'barney' },
  9590. * { 'user': 'fred' }
  9591. * ];
  9592. *
  9593. * // The `_.property` iteratee shorthand.
  9594. * _.map(users, 'user');
  9595. * // => ['barney', 'fred']
  9596. */
  9597. function map(collection, iteratee) {
  9598. var func = isArray(collection) ? arrayMap : baseMap;
  9599. return func(collection, getIteratee(iteratee, 3));
  9600. }
  9601. /**
  9602. * This method is like `_.sortBy` except that it allows specifying the sort
  9603. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  9604. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  9605. * descending or "asc" for ascending sort order of corresponding values.
  9606. *
  9607. * @static
  9608. * @memberOf _
  9609. * @since 4.0.0
  9610. * @category Collection
  9611. * @param {Array|Object} collection The collection to iterate over.
  9612. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  9613. * The iteratees to sort by.
  9614. * @param {string[]} [orders] The sort orders of `iteratees`.
  9615. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9616. * @returns {Array} Returns the new sorted array.
  9617. * @example
  9618. *
  9619. * var users = [
  9620. * { 'user': 'fred', 'age': 48 },
  9621. * { 'user': 'barney', 'age': 34 },
  9622. * { 'user': 'fred', 'age': 40 },
  9623. * { 'user': 'barney', 'age': 36 }
  9624. * ];
  9625. *
  9626. * // Sort by `user` in ascending order and by `age` in descending order.
  9627. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  9628. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9629. */
  9630. function orderBy(collection, iteratees, orders, guard) {
  9631. if (collection == null) {
  9632. return [];
  9633. }
  9634. if (!isArray(iteratees)) {
  9635. iteratees = iteratees == null ? [] : [iteratees];
  9636. }
  9637. orders = guard ? undefined : orders;
  9638. if (!isArray(orders)) {
  9639. orders = orders == null ? [] : [orders];
  9640. }
  9641. return baseOrderBy(collection, iteratees, orders);
  9642. }
  9643. /**
  9644. * Creates an array of elements split into two groups, the first of which
  9645. * contains elements `predicate` returns truthy for, the second of which
  9646. * contains elements `predicate` returns falsey for. The predicate is
  9647. * invoked with one argument: (value).
  9648. *
  9649. * @static
  9650. * @memberOf _
  9651. * @since 3.0.0
  9652. * @category Collection
  9653. * @param {Array|Object} collection The collection to iterate over.
  9654. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9655. * @returns {Array} Returns the array of grouped elements.
  9656. * @example
  9657. *
  9658. * var users = [
  9659. * { 'user': 'barney', 'age': 36, 'active': false },
  9660. * { 'user': 'fred', 'age': 40, 'active': true },
  9661. * { 'user': 'pebbles', 'age': 1, 'active': false }
  9662. * ];
  9663. *
  9664. * _.partition(users, function(o) { return o.active; });
  9665. * // => objects for [['fred'], ['barney', 'pebbles']]
  9666. *
  9667. * // The `_.matches` iteratee shorthand.
  9668. * _.partition(users, { 'age': 1, 'active': false });
  9669. * // => objects for [['pebbles'], ['barney', 'fred']]
  9670. *
  9671. * // The `_.matchesProperty` iteratee shorthand.
  9672. * _.partition(users, ['active', false]);
  9673. * // => objects for [['barney', 'pebbles'], ['fred']]
  9674. *
  9675. * // The `_.property` iteratee shorthand.
  9676. * _.partition(users, 'active');
  9677. * // => objects for [['fred'], ['barney', 'pebbles']]
  9678. */
  9679. var partition = createAggregator(function(result, value, key) {
  9680. result[key ? 0 : 1].push(value);
  9681. }, function() { return [[], []]; });
  9682. /**
  9683. * Reduces `collection` to a value which is the accumulated result of running
  9684. * each element in `collection` thru `iteratee`, where each successive
  9685. * invocation is supplied the return value of the previous. If `accumulator`
  9686. * is not given, the first element of `collection` is used as the initial
  9687. * value. The iteratee is invoked with four arguments:
  9688. * (accumulator, value, index|key, collection).
  9689. *
  9690. * Many lodash methods are guarded to work as iteratees for methods like
  9691. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  9692. *
  9693. * The guarded methods are:
  9694. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  9695. * and `sortBy`
  9696. *
  9697. * @static
  9698. * @memberOf _
  9699. * @since 0.1.0
  9700. * @category Collection
  9701. * @param {Array|Object} collection The collection to iterate over.
  9702. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9703. * @param {*} [accumulator] The initial value.
  9704. * @returns {*} Returns the accumulated value.
  9705. * @see _.reduceRight
  9706. * @example
  9707. *
  9708. * _.reduce([1, 2], function(sum, n) {
  9709. * return sum + n;
  9710. * }, 0);
  9711. * // => 3
  9712. *
  9713. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  9714. * (result[value] || (result[value] = [])).push(key);
  9715. * return result;
  9716. * }, {});
  9717. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  9718. */
  9719. function reduce(collection, iteratee, accumulator) {
  9720. var func = isArray(collection) ? arrayReduce : baseReduce,
  9721. initAccum = arguments.length < 3;
  9722. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  9723. }
  9724. /**
  9725. * This method is like `_.reduce` except that it iterates over elements of
  9726. * `collection` from right to left.
  9727. *
  9728. * @static
  9729. * @memberOf _
  9730. * @since 0.1.0
  9731. * @category Collection
  9732. * @param {Array|Object} collection The collection to iterate over.
  9733. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9734. * @param {*} [accumulator] The initial value.
  9735. * @returns {*} Returns the accumulated value.
  9736. * @see _.reduce
  9737. * @example
  9738. *
  9739. * var array = [[0, 1], [2, 3], [4, 5]];
  9740. *
  9741. * _.reduceRight(array, function(flattened, other) {
  9742. * return flattened.concat(other);
  9743. * }, []);
  9744. * // => [4, 5, 2, 3, 0, 1]
  9745. */
  9746. function reduceRight(collection, iteratee, accumulator) {
  9747. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  9748. initAccum = arguments.length < 3;
  9749. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  9750. }
  9751. /**
  9752. * The opposite of `_.filter`; this method returns the elements of `collection`
  9753. * that `predicate` does **not** return truthy for.
  9754. *
  9755. * @static
  9756. * @memberOf _
  9757. * @since 0.1.0
  9758. * @category Collection
  9759. * @param {Array|Object} collection The collection to iterate over.
  9760. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9761. * @returns {Array} Returns the new filtered array.
  9762. * @see _.filter
  9763. * @example
  9764. *
  9765. * var users = [
  9766. * { 'user': 'barney', 'age': 36, 'active': false },
  9767. * { 'user': 'fred', 'age': 40, 'active': true }
  9768. * ];
  9769. *
  9770. * _.reject(users, function(o) { return !o.active; });
  9771. * // => objects for ['fred']
  9772. *
  9773. * // The `_.matches` iteratee shorthand.
  9774. * _.reject(users, { 'age': 40, 'active': true });
  9775. * // => objects for ['barney']
  9776. *
  9777. * // The `_.matchesProperty` iteratee shorthand.
  9778. * _.reject(users, ['active', false]);
  9779. * // => objects for ['fred']
  9780. *
  9781. * // The `_.property` iteratee shorthand.
  9782. * _.reject(users, 'active');
  9783. * // => objects for ['barney']
  9784. */
  9785. function reject(collection, predicate) {
  9786. var func = isArray(collection) ? arrayFilter : baseFilter;
  9787. return func(collection, negate(getIteratee(predicate, 3)));
  9788. }
  9789. /**
  9790. * Gets a random element from `collection`.
  9791. *
  9792. * @static
  9793. * @memberOf _
  9794. * @since 2.0.0
  9795. * @category Collection
  9796. * @param {Array|Object} collection The collection to sample.
  9797. * @returns {*} Returns the random element.
  9798. * @example
  9799. *
  9800. * _.sample([1, 2, 3, 4]);
  9801. * // => 2
  9802. */
  9803. function sample(collection) {
  9804. var func = isArray(collection) ? arraySample : baseSample;
  9805. return func(collection);
  9806. }
  9807. /**
  9808. * Gets `n` random elements at unique keys from `collection` up to the
  9809. * size of `collection`.
  9810. *
  9811. * @static
  9812. * @memberOf _
  9813. * @since 4.0.0
  9814. * @category Collection
  9815. * @param {Array|Object} collection The collection to sample.
  9816. * @param {number} [n=1] The number of elements to sample.
  9817. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9818. * @returns {Array} Returns the random elements.
  9819. * @example
  9820. *
  9821. * _.sampleSize([1, 2, 3], 2);
  9822. * // => [3, 1]
  9823. *
  9824. * _.sampleSize([1, 2, 3], 4);
  9825. * // => [2, 3, 1]
  9826. */
  9827. function sampleSize(collection, n, guard) {
  9828. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  9829. n = 1;
  9830. } else {
  9831. n = toInteger(n);
  9832. }
  9833. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  9834. return func(collection, n);
  9835. }
  9836. /**
  9837. * Creates an array of shuffled values, using a version of the
  9838. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  9839. *
  9840. * @static
  9841. * @memberOf _
  9842. * @since 0.1.0
  9843. * @category Collection
  9844. * @param {Array|Object} collection The collection to shuffle.
  9845. * @returns {Array} Returns the new shuffled array.
  9846. * @example
  9847. *
  9848. * _.shuffle([1, 2, 3, 4]);
  9849. * // => [4, 1, 3, 2]
  9850. */
  9851. function shuffle(collection) {
  9852. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  9853. return func(collection);
  9854. }
  9855. /**
  9856. * Gets the size of `collection` by returning its length for array-like
  9857. * values or the number of own enumerable string keyed properties for objects.
  9858. *
  9859. * @static
  9860. * @memberOf _
  9861. * @since 0.1.0
  9862. * @category Collection
  9863. * @param {Array|Object|string} collection The collection to inspect.
  9864. * @returns {number} Returns the collection size.
  9865. * @example
  9866. *
  9867. * _.size([1, 2, 3]);
  9868. * // => 3
  9869. *
  9870. * _.size({ 'a': 1, 'b': 2 });
  9871. * // => 2
  9872. *
  9873. * _.size('pebbles');
  9874. * // => 7
  9875. */
  9876. function size(collection) {
  9877. if (collection == null) {
  9878. return 0;
  9879. }
  9880. if (isArrayLike(collection)) {
  9881. return isString(collection) ? stringSize(collection) : collection.length;
  9882. }
  9883. var tag = getTag(collection);
  9884. if (tag == mapTag || tag == setTag) {
  9885. return collection.size;
  9886. }
  9887. return baseKeys(collection).length;
  9888. }
  9889. /**
  9890. * Checks if `predicate` returns truthy for **any** element of `collection`.
  9891. * Iteration is stopped once `predicate` returns truthy. The predicate is
  9892. * invoked with three arguments: (value, index|key, collection).
  9893. *
  9894. * @static
  9895. * @memberOf _
  9896. * @since 0.1.0
  9897. * @category Collection
  9898. * @param {Array|Object} collection The collection to iterate over.
  9899. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9900. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9901. * @returns {boolean} Returns `true` if any element passes the predicate check,
  9902. * else `false`.
  9903. * @example
  9904. *
  9905. * _.some([null, 0, 'yes', false], Boolean);
  9906. * // => true
  9907. *
  9908. * var users = [
  9909. * { 'user': 'barney', 'active': true },
  9910. * { 'user': 'fred', 'active': false }
  9911. * ];
  9912. *
  9913. * // The `_.matches` iteratee shorthand.
  9914. * _.some(users, { 'user': 'barney', 'active': false });
  9915. * // => false
  9916. *
  9917. * // The `_.matchesProperty` iteratee shorthand.
  9918. * _.some(users, ['active', false]);
  9919. * // => true
  9920. *
  9921. * // The `_.property` iteratee shorthand.
  9922. * _.some(users, 'active');
  9923. * // => true
  9924. */
  9925. function some(collection, predicate, guard) {
  9926. var func = isArray(collection) ? arraySome : baseSome;
  9927. if (guard && isIterateeCall(collection, predicate, guard)) {
  9928. predicate = undefined;
  9929. }
  9930. return func(collection, getIteratee(predicate, 3));
  9931. }
  9932. /**
  9933. * Creates an array of elements, sorted in ascending order by the results of
  9934. * running each element in a collection thru each iteratee. This method
  9935. * performs a stable sort, that is, it preserves the original sort order of
  9936. * equal elements. The iteratees are invoked with one argument: (value).
  9937. *
  9938. * @static
  9939. * @memberOf _
  9940. * @since 0.1.0
  9941. * @category Collection
  9942. * @param {Array|Object} collection The collection to iterate over.
  9943. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  9944. * The iteratees to sort by.
  9945. * @returns {Array} Returns the new sorted array.
  9946. * @example
  9947. *
  9948. * var users = [
  9949. * { 'user': 'fred', 'age': 48 },
  9950. * { 'user': 'barney', 'age': 36 },
  9951. * { 'user': 'fred', 'age': 40 },
  9952. * { 'user': 'barney', 'age': 34 }
  9953. * ];
  9954. *
  9955. * _.sortBy(users, [function(o) { return o.user; }]);
  9956. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9957. *
  9958. * _.sortBy(users, ['user', 'age']);
  9959. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  9960. */
  9961. var sortBy = baseRest(function(collection, iteratees) {
  9962. if (collection == null) {
  9963. return [];
  9964. }
  9965. var length = iteratees.length;
  9966. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  9967. iteratees = [];
  9968. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  9969. iteratees = [iteratees[0]];
  9970. }
  9971. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  9972. });
  9973. /*------------------------------------------------------------------------*/
  9974. /**
  9975. * Gets the timestamp of the number of milliseconds that have elapsed since
  9976. * the Unix epoch (1 January 1970 00:00:00 UTC).
  9977. *
  9978. * @static
  9979. * @memberOf _
  9980. * @since 2.4.0
  9981. * @category Date
  9982. * @returns {number} Returns the timestamp.
  9983. * @example
  9984. *
  9985. * _.defer(function(stamp) {
  9986. * console.log(_.now() - stamp);
  9987. * }, _.now());
  9988. * // => Logs the number of milliseconds it took for the deferred invocation.
  9989. */
  9990. var now = ctxNow || function() {
  9991. return root.Date.now();
  9992. };
  9993. /*------------------------------------------------------------------------*/
  9994. /**
  9995. * The opposite of `_.before`; this method creates a function that invokes
  9996. * `func` once it's called `n` or more times.
  9997. *
  9998. * @static
  9999. * @memberOf _
  10000. * @since 0.1.0
  10001. * @category Function
  10002. * @param {number} n The number of calls before `func` is invoked.
  10003. * @param {Function} func The function to restrict.
  10004. * @returns {Function} Returns the new restricted function.
  10005. * @example
  10006. *
  10007. * var saves = ['profile', 'settings'];
  10008. *
  10009. * var done = _.after(saves.length, function() {
  10010. * console.log('done saving!');
  10011. * });
  10012. *
  10013. * _.forEach(saves, function(type) {
  10014. * asyncSave({ 'type': type, 'complete': done });
  10015. * });
  10016. * // => Logs 'done saving!' after the two async saves have completed.
  10017. */
  10018. function after(n, func) {
  10019. if (typeof func != 'function') {
  10020. throw new TypeError(FUNC_ERROR_TEXT);
  10021. }
  10022. n = toInteger(n);
  10023. return function() {
  10024. if (--n < 1) {
  10025. return func.apply(this, arguments);
  10026. }
  10027. };
  10028. }
  10029. /**
  10030. * Creates a function that invokes `func`, with up to `n` arguments,
  10031. * ignoring any additional arguments.
  10032. *
  10033. * @static
  10034. * @memberOf _
  10035. * @since 3.0.0
  10036. * @category Function
  10037. * @param {Function} func The function to cap arguments for.
  10038. * @param {number} [n=func.length] The arity cap.
  10039. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10040. * @returns {Function} Returns the new capped function.
  10041. * @example
  10042. *
  10043. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10044. * // => [6, 8, 10]
  10045. */
  10046. function ary(func, n, guard) {
  10047. n = guard ? undefined : n;
  10048. n = (func && n == null) ? func.length : n;
  10049. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10050. }
  10051. /**
  10052. * Creates a function that invokes `func`, with the `this` binding and arguments
  10053. * of the created function, while it's called less than `n` times. Subsequent
  10054. * calls to the created function return the result of the last `func` invocation.
  10055. *
  10056. * @static
  10057. * @memberOf _
  10058. * @since 3.0.0
  10059. * @category Function
  10060. * @param {number} n The number of calls at which `func` is no longer invoked.
  10061. * @param {Function} func The function to restrict.
  10062. * @returns {Function} Returns the new restricted function.
  10063. * @example
  10064. *
  10065. * jQuery(element).on('click', _.before(5, addContactToList));
  10066. * // => Allows adding up to 4 contacts to the list.
  10067. */
  10068. function before(n, func) {
  10069. var result;
  10070. if (typeof func != 'function') {
  10071. throw new TypeError(FUNC_ERROR_TEXT);
  10072. }
  10073. n = toInteger(n);
  10074. return function() {
  10075. if (--n > 0) {
  10076. result = func.apply(this, arguments);
  10077. }
  10078. if (n <= 1) {
  10079. func = undefined;
  10080. }
  10081. return result;
  10082. };
  10083. }
  10084. /**
  10085. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10086. * and `partials` prepended to the arguments it receives.
  10087. *
  10088. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10089. * may be used as a placeholder for partially applied arguments.
  10090. *
  10091. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10092. * property of bound functions.
  10093. *
  10094. * @static
  10095. * @memberOf _
  10096. * @since 0.1.0
  10097. * @category Function
  10098. * @param {Function} func The function to bind.
  10099. * @param {*} thisArg The `this` binding of `func`.
  10100. * @param {...*} [partials] The arguments to be partially applied.
  10101. * @returns {Function} Returns the new bound function.
  10102. * @example
  10103. *
  10104. * function greet(greeting, punctuation) {
  10105. * return greeting + ' ' + this.user + punctuation;
  10106. * }
  10107. *
  10108. * var object = { 'user': 'fred' };
  10109. *
  10110. * var bound = _.bind(greet, object, 'hi');
  10111. * bound('!');
  10112. * // => 'hi fred!'
  10113. *
  10114. * // Bound with placeholders.
  10115. * var bound = _.bind(greet, object, _, '!');
  10116. * bound('hi');
  10117. * // => 'hi fred!'
  10118. */
  10119. var bind = baseRest(function(func, thisArg, partials) {
  10120. var bitmask = WRAP_BIND_FLAG;
  10121. if (partials.length) {
  10122. var holders = replaceHolders(partials, getHolder(bind));
  10123. bitmask |= WRAP_PARTIAL_FLAG;
  10124. }
  10125. return createWrap(func, bitmask, thisArg, partials, holders);
  10126. });
  10127. /**
  10128. * Creates a function that invokes the method at `object[key]` with `partials`
  10129. * prepended to the arguments it receives.
  10130. *
  10131. * This method differs from `_.bind` by allowing bound functions to reference
  10132. * methods that may be redefined or don't yet exist. See
  10133. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10134. * for more details.
  10135. *
  10136. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10137. * builds, may be used as a placeholder for partially applied arguments.
  10138. *
  10139. * @static
  10140. * @memberOf _
  10141. * @since 0.10.0
  10142. * @category Function
  10143. * @param {Object} object The object to invoke the method on.
  10144. * @param {string} key The key of the method.
  10145. * @param {...*} [partials] The arguments to be partially applied.
  10146. * @returns {Function} Returns the new bound function.
  10147. * @example
  10148. *
  10149. * var object = {
  10150. * 'user': 'fred',
  10151. * 'greet': function(greeting, punctuation) {
  10152. * return greeting + ' ' + this.user + punctuation;
  10153. * }
  10154. * };
  10155. *
  10156. * var bound = _.bindKey(object, 'greet', 'hi');
  10157. * bound('!');
  10158. * // => 'hi fred!'
  10159. *
  10160. * object.greet = function(greeting, punctuation) {
  10161. * return greeting + 'ya ' + this.user + punctuation;
  10162. * };
  10163. *
  10164. * bound('!');
  10165. * // => 'hiya fred!'
  10166. *
  10167. * // Bound with placeholders.
  10168. * var bound = _.bindKey(object, 'greet', _, '!');
  10169. * bound('hi');
  10170. * // => 'hiya fred!'
  10171. */
  10172. var bindKey = baseRest(function(object, key, partials) {
  10173. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10174. if (partials.length) {
  10175. var holders = replaceHolders(partials, getHolder(bindKey));
  10176. bitmask |= WRAP_PARTIAL_FLAG;
  10177. }
  10178. return createWrap(key, bitmask, object, partials, holders);
  10179. });
  10180. /**
  10181. * Creates a function that accepts arguments of `func` and either invokes
  10182. * `func` returning its result, if at least `arity` number of arguments have
  10183. * been provided, or returns a function that accepts the remaining `func`
  10184. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10185. * is not sufficient.
  10186. *
  10187. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10188. * may be used as a placeholder for provided arguments.
  10189. *
  10190. * **Note:** This method doesn't set the "length" property of curried functions.
  10191. *
  10192. * @static
  10193. * @memberOf _
  10194. * @since 2.0.0
  10195. * @category Function
  10196. * @param {Function} func The function to curry.
  10197. * @param {number} [arity=func.length] The arity of `func`.
  10198. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10199. * @returns {Function} Returns the new curried function.
  10200. * @example
  10201. *
  10202. * var abc = function(a, b, c) {
  10203. * return [a, b, c];
  10204. * };
  10205. *
  10206. * var curried = _.curry(abc);
  10207. *
  10208. * curried(1)(2)(3);
  10209. * // => [1, 2, 3]
  10210. *
  10211. * curried(1, 2)(3);
  10212. * // => [1, 2, 3]
  10213. *
  10214. * curried(1, 2, 3);
  10215. * // => [1, 2, 3]
  10216. *
  10217. * // Curried with placeholders.
  10218. * curried(1)(_, 3)(2);
  10219. * // => [1, 2, 3]
  10220. */
  10221. function curry(func, arity, guard) {
  10222. arity = guard ? undefined : arity;
  10223. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10224. result.placeholder = curry.placeholder;
  10225. return result;
  10226. }
  10227. /**
  10228. * This method is like `_.curry` except that arguments are applied to `func`
  10229. * in the manner of `_.partialRight` instead of `_.partial`.
  10230. *
  10231. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10232. * builds, may be used as a placeholder for provided arguments.
  10233. *
  10234. * **Note:** This method doesn't set the "length" property of curried functions.
  10235. *
  10236. * @static
  10237. * @memberOf _
  10238. * @since 3.0.0
  10239. * @category Function
  10240. * @param {Function} func The function to curry.
  10241. * @param {number} [arity=func.length] The arity of `func`.
  10242. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10243. * @returns {Function} Returns the new curried function.
  10244. * @example
  10245. *
  10246. * var abc = function(a, b, c) {
  10247. * return [a, b, c];
  10248. * };
  10249. *
  10250. * var curried = _.curryRight(abc);
  10251. *
  10252. * curried(3)(2)(1);
  10253. * // => [1, 2, 3]
  10254. *
  10255. * curried(2, 3)(1);
  10256. * // => [1, 2, 3]
  10257. *
  10258. * curried(1, 2, 3);
  10259. * // => [1, 2, 3]
  10260. *
  10261. * // Curried with placeholders.
  10262. * curried(3)(1, _)(2);
  10263. * // => [1, 2, 3]
  10264. */
  10265. function curryRight(func, arity, guard) {
  10266. arity = guard ? undefined : arity;
  10267. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10268. result.placeholder = curryRight.placeholder;
  10269. return result;
  10270. }
  10271. /**
  10272. * Creates a debounced function that delays invoking `func` until after `wait`
  10273. * milliseconds have elapsed since the last time the debounced function was
  10274. * invoked. The debounced function comes with a `cancel` method to cancel
  10275. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10276. * Provide `options` to indicate whether `func` should be invoked on the
  10277. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10278. * with the last arguments provided to the debounced function. Subsequent
  10279. * calls to the debounced function return the result of the last `func`
  10280. * invocation.
  10281. *
  10282. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10283. * invoked on the trailing edge of the timeout only if the debounced function
  10284. * is invoked more than once during the `wait` timeout.
  10285. *
  10286. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10287. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10288. *
  10289. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10290. * for details over the differences between `_.debounce` and `_.throttle`.
  10291. *
  10292. * @static
  10293. * @memberOf _
  10294. * @since 0.1.0
  10295. * @category Function
  10296. * @param {Function} func The function to debounce.
  10297. * @param {number} [wait=0] The number of milliseconds to delay.
  10298. * @param {Object} [options={}] The options object.
  10299. * @param {boolean} [options.leading=false]
  10300. * Specify invoking on the leading edge of the timeout.
  10301. * @param {number} [options.maxWait]
  10302. * The maximum time `func` is allowed to be delayed before it's invoked.
  10303. * @param {boolean} [options.trailing=true]
  10304. * Specify invoking on the trailing edge of the timeout.
  10305. * @returns {Function} Returns the new debounced function.
  10306. * @example
  10307. *
  10308. * // Avoid costly calculations while the window size is in flux.
  10309. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10310. *
  10311. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10312. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10313. * 'leading': true,
  10314. * 'trailing': false
  10315. * }));
  10316. *
  10317. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10318. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10319. * var source = new EventSource('/stream');
  10320. * jQuery(source).on('message', debounced);
  10321. *
  10322. * // Cancel the trailing debounced invocation.
  10323. * jQuery(window).on('popstate', debounced.cancel);
  10324. */
  10325. function debounce(func, wait, options) {
  10326. var lastArgs,
  10327. lastThis,
  10328. maxWait,
  10329. result,
  10330. timerId,
  10331. lastCallTime,
  10332. lastInvokeTime = 0,
  10333. leading = false,
  10334. maxing = false,
  10335. trailing = true;
  10336. if (typeof func != 'function') {
  10337. throw new TypeError(FUNC_ERROR_TEXT);
  10338. }
  10339. wait = toNumber(wait) || 0;
  10340. if (isObject(options)) {
  10341. leading = !!options.leading;
  10342. maxing = 'maxWait' in options;
  10343. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10344. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10345. }
  10346. function invokeFunc(time) {
  10347. var args = lastArgs,
  10348. thisArg = lastThis;
  10349. lastArgs = lastThis = undefined;
  10350. lastInvokeTime = time;
  10351. result = func.apply(thisArg, args);
  10352. return result;
  10353. }
  10354. function leadingEdge(time) {
  10355. // Reset any `maxWait` timer.
  10356. lastInvokeTime = time;
  10357. // Start the timer for the trailing edge.
  10358. timerId = setTimeout(timerExpired, wait);
  10359. // Invoke the leading edge.
  10360. return leading ? invokeFunc(time) : result;
  10361. }
  10362. function remainingWait(time) {
  10363. var timeSinceLastCall = time - lastCallTime,
  10364. timeSinceLastInvoke = time - lastInvokeTime,
  10365. result = wait - timeSinceLastCall;
  10366. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  10367. }
  10368. function shouldInvoke(time) {
  10369. var timeSinceLastCall = time - lastCallTime,
  10370. timeSinceLastInvoke = time - lastInvokeTime;
  10371. // Either this is the first call, activity has stopped and we're at the
  10372. // trailing edge, the system time has gone backwards and we're treating
  10373. // it as the trailing edge, or we've hit the `maxWait` limit.
  10374. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10375. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10376. }
  10377. function timerExpired() {
  10378. var time = now();
  10379. if (shouldInvoke(time)) {
  10380. return trailingEdge(time);
  10381. }
  10382. // Restart the timer.
  10383. timerId = setTimeout(timerExpired, remainingWait(time));
  10384. }
  10385. function trailingEdge(time) {
  10386. timerId = undefined;
  10387. // Only invoke if we have `lastArgs` which means `func` has been
  10388. // debounced at least once.
  10389. if (trailing && lastArgs) {
  10390. return invokeFunc(time);
  10391. }
  10392. lastArgs = lastThis = undefined;
  10393. return result;
  10394. }
  10395. function cancel() {
  10396. if (timerId !== undefined) {
  10397. clearTimeout(timerId);
  10398. }
  10399. lastInvokeTime = 0;
  10400. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10401. }
  10402. function flush() {
  10403. return timerId === undefined ? result : trailingEdge(now());
  10404. }
  10405. function debounced() {
  10406. var time = now(),
  10407. isInvoking = shouldInvoke(time);
  10408. lastArgs = arguments;
  10409. lastThis = this;
  10410. lastCallTime = time;
  10411. if (isInvoking) {
  10412. if (timerId === undefined) {
  10413. return leadingEdge(lastCallTime);
  10414. }
  10415. if (maxing) {
  10416. // Handle invocations in a tight loop.
  10417. timerId = setTimeout(timerExpired, wait);
  10418. return invokeFunc(lastCallTime);
  10419. }
  10420. }
  10421. if (timerId === undefined) {
  10422. timerId = setTimeout(timerExpired, wait);
  10423. }
  10424. return result;
  10425. }
  10426. debounced.cancel = cancel;
  10427. debounced.flush = flush;
  10428. return debounced;
  10429. }
  10430. /**
  10431. * Defers invoking the `func` until the current call stack has cleared. Any
  10432. * additional arguments are provided to `func` when it's invoked.
  10433. *
  10434. * @static
  10435. * @memberOf _
  10436. * @since 0.1.0
  10437. * @category Function
  10438. * @param {Function} func The function to defer.
  10439. * @param {...*} [args] The arguments to invoke `func` with.
  10440. * @returns {number} Returns the timer id.
  10441. * @example
  10442. *
  10443. * _.defer(function(text) {
  10444. * console.log(text);
  10445. * }, 'deferred');
  10446. * // => Logs 'deferred' after one millisecond.
  10447. */
  10448. var defer = baseRest(function(func, args) {
  10449. return baseDelay(func, 1, args);
  10450. });
  10451. /**
  10452. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  10453. * provided to `func` when it's invoked.
  10454. *
  10455. * @static
  10456. * @memberOf _
  10457. * @since 0.1.0
  10458. * @category Function
  10459. * @param {Function} func The function to delay.
  10460. * @param {number} wait The number of milliseconds to delay invocation.
  10461. * @param {...*} [args] The arguments to invoke `func` with.
  10462. * @returns {number} Returns the timer id.
  10463. * @example
  10464. *
  10465. * _.delay(function(text) {
  10466. * console.log(text);
  10467. * }, 1000, 'later');
  10468. * // => Logs 'later' after one second.
  10469. */
  10470. var delay = baseRest(function(func, wait, args) {
  10471. return baseDelay(func, toNumber(wait) || 0, args);
  10472. });
  10473. /**
  10474. * Creates a function that invokes `func` with arguments reversed.
  10475. *
  10476. * @static
  10477. * @memberOf _
  10478. * @since 4.0.0
  10479. * @category Function
  10480. * @param {Function} func The function to flip arguments for.
  10481. * @returns {Function} Returns the new flipped function.
  10482. * @example
  10483. *
  10484. * var flipped = _.flip(function() {
  10485. * return _.toArray(arguments);
  10486. * });
  10487. *
  10488. * flipped('a', 'b', 'c', 'd');
  10489. * // => ['d', 'c', 'b', 'a']
  10490. */
  10491. function flip(func) {
  10492. return createWrap(func, WRAP_FLIP_FLAG);
  10493. }
  10494. /**
  10495. * Creates a function that memoizes the result of `func`. If `resolver` is
  10496. * provided, it determines the cache key for storing the result based on the
  10497. * arguments provided to the memoized function. By default, the first argument
  10498. * provided to the memoized function is used as the map cache key. The `func`
  10499. * is invoked with the `this` binding of the memoized function.
  10500. *
  10501. * **Note:** The cache is exposed as the `cache` property on the memoized
  10502. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10503. * constructor with one whose instances implement the
  10504. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10505. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10506. *
  10507. * @static
  10508. * @memberOf _
  10509. * @since 0.1.0
  10510. * @category Function
  10511. * @param {Function} func The function to have its output memoized.
  10512. * @param {Function} [resolver] The function to resolve the cache key.
  10513. * @returns {Function} Returns the new memoized function.
  10514. * @example
  10515. *
  10516. * var object = { 'a': 1, 'b': 2 };
  10517. * var other = { 'c': 3, 'd': 4 };
  10518. *
  10519. * var values = _.memoize(_.values);
  10520. * values(object);
  10521. * // => [1, 2]
  10522. *
  10523. * values(other);
  10524. * // => [3, 4]
  10525. *
  10526. * object.a = 2;
  10527. * values(object);
  10528. * // => [1, 2]
  10529. *
  10530. * // Modify the result cache.
  10531. * values.cache.set(object, ['a', 'b']);
  10532. * values(object);
  10533. * // => ['a', 'b']
  10534. *
  10535. * // Replace `_.memoize.Cache`.
  10536. * _.memoize.Cache = WeakMap;
  10537. */
  10538. function memoize(func, resolver) {
  10539. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  10540. throw new TypeError(FUNC_ERROR_TEXT);
  10541. }
  10542. var memoized = function() {
  10543. var args = arguments,
  10544. key = resolver ? resolver.apply(this, args) : args[0],
  10545. cache = memoized.cache;
  10546. if (cache.has(key)) {
  10547. return cache.get(key);
  10548. }
  10549. var result = func.apply(this, args);
  10550. memoized.cache = cache.set(key, result) || cache;
  10551. return result;
  10552. };
  10553. memoized.cache = new (memoize.Cache || MapCache);
  10554. return memoized;
  10555. }
  10556. // Expose `MapCache`.
  10557. memoize.Cache = MapCache;
  10558. /**
  10559. * Creates a function that negates the result of the predicate `func`. The
  10560. * `func` predicate is invoked with the `this` binding and arguments of the
  10561. * created function.
  10562. *
  10563. * @static
  10564. * @memberOf _
  10565. * @since 3.0.0
  10566. * @category Function
  10567. * @param {Function} predicate The predicate to negate.
  10568. * @returns {Function} Returns the new negated function.
  10569. * @example
  10570. *
  10571. * function isEven(n) {
  10572. * return n % 2 == 0;
  10573. * }
  10574. *
  10575. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  10576. * // => [1, 3, 5]
  10577. */
  10578. function negate(predicate) {
  10579. if (typeof predicate != 'function') {
  10580. throw new TypeError(FUNC_ERROR_TEXT);
  10581. }
  10582. return function() {
  10583. var args = arguments;
  10584. switch (args.length) {
  10585. case 0: return !predicate.call(this);
  10586. case 1: return !predicate.call(this, args[0]);
  10587. case 2: return !predicate.call(this, args[0], args[1]);
  10588. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  10589. }
  10590. return !predicate.apply(this, args);
  10591. };
  10592. }
  10593. /**
  10594. * Creates a function that is restricted to invoking `func` once. Repeat calls
  10595. * to the function return the value of the first invocation. The `func` is
  10596. * invoked with the `this` binding and arguments of the created function.
  10597. *
  10598. * @static
  10599. * @memberOf _
  10600. * @since 0.1.0
  10601. * @category Function
  10602. * @param {Function} func The function to restrict.
  10603. * @returns {Function} Returns the new restricted function.
  10604. * @example
  10605. *
  10606. * var initialize = _.once(createApplication);
  10607. * initialize();
  10608. * initialize();
  10609. * // => `createApplication` is invoked once
  10610. */
  10611. function once(func) {
  10612. return before(2, func);
  10613. }
  10614. /**
  10615. * Creates a function that invokes `func` with its arguments transformed.
  10616. *
  10617. * @static
  10618. * @since 4.0.0
  10619. * @memberOf _
  10620. * @category Function
  10621. * @param {Function} func The function to wrap.
  10622. * @param {...(Function|Function[])} [transforms=[_.identity]]
  10623. * The argument transforms.
  10624. * @returns {Function} Returns the new function.
  10625. * @example
  10626. *
  10627. * function doubled(n) {
  10628. * return n * 2;
  10629. * }
  10630. *
  10631. * function square(n) {
  10632. * return n * n;
  10633. * }
  10634. *
  10635. * var func = _.overArgs(function(x, y) {
  10636. * return [x, y];
  10637. * }, [square, doubled]);
  10638. *
  10639. * func(9, 3);
  10640. * // => [81, 6]
  10641. *
  10642. * func(10, 5);
  10643. * // => [100, 10]
  10644. */
  10645. var overArgs = castRest(function(func, transforms) {
  10646. transforms = (transforms.length == 1 && isArray(transforms[0]))
  10647. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  10648. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  10649. var funcsLength = transforms.length;
  10650. return baseRest(function(args) {
  10651. var index = -1,
  10652. length = nativeMin(args.length, funcsLength);
  10653. while (++index < length) {
  10654. args[index] = transforms[index].call(this, args[index]);
  10655. }
  10656. return apply(func, this, args);
  10657. });
  10658. });
  10659. /**
  10660. * Creates a function that invokes `func` with `partials` prepended to the
  10661. * arguments it receives. This method is like `_.bind` except it does **not**
  10662. * alter the `this` binding.
  10663. *
  10664. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  10665. * builds, may be used as a placeholder for partially applied arguments.
  10666. *
  10667. * **Note:** This method doesn't set the "length" property of partially
  10668. * applied functions.
  10669. *
  10670. * @static
  10671. * @memberOf _
  10672. * @since 0.2.0
  10673. * @category Function
  10674. * @param {Function} func The function to partially apply arguments to.
  10675. * @param {...*} [partials] The arguments to be partially applied.
  10676. * @returns {Function} Returns the new partially applied function.
  10677. * @example
  10678. *
  10679. * function greet(greeting, name) {
  10680. * return greeting + ' ' + name;
  10681. * }
  10682. *
  10683. * var sayHelloTo = _.partial(greet, 'hello');
  10684. * sayHelloTo('fred');
  10685. * // => 'hello fred'
  10686. *
  10687. * // Partially applied with placeholders.
  10688. * var greetFred = _.partial(greet, _, 'fred');
  10689. * greetFred('hi');
  10690. * // => 'hi fred'
  10691. */
  10692. var partial = baseRest(function(func, partials) {
  10693. var holders = replaceHolders(partials, getHolder(partial));
  10694. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  10695. });
  10696. /**
  10697. * This method is like `_.partial` except that partially applied arguments
  10698. * are appended to the arguments it receives.
  10699. *
  10700. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  10701. * builds, may be used as a placeholder for partially applied arguments.
  10702. *
  10703. * **Note:** This method doesn't set the "length" property of partially
  10704. * applied functions.
  10705. *
  10706. * @static
  10707. * @memberOf _
  10708. * @since 1.0.0
  10709. * @category Function
  10710. * @param {Function} func The function to partially apply arguments to.
  10711. * @param {...*} [partials] The arguments to be partially applied.
  10712. * @returns {Function} Returns the new partially applied function.
  10713. * @example
  10714. *
  10715. * function greet(greeting, name) {
  10716. * return greeting + ' ' + name;
  10717. * }
  10718. *
  10719. * var greetFred = _.partialRight(greet, 'fred');
  10720. * greetFred('hi');
  10721. * // => 'hi fred'
  10722. *
  10723. * // Partially applied with placeholders.
  10724. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  10725. * sayHelloTo('fred');
  10726. * // => 'hello fred'
  10727. */
  10728. var partialRight = baseRest(function(func, partials) {
  10729. var holders = replaceHolders(partials, getHolder(partialRight));
  10730. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  10731. });
  10732. /**
  10733. * Creates a function that invokes `func` with arguments arranged according
  10734. * to the specified `indexes` where the argument value at the first index is
  10735. * provided as the first argument, the argument value at the second index is
  10736. * provided as the second argument, and so on.
  10737. *
  10738. * @static
  10739. * @memberOf _
  10740. * @since 3.0.0
  10741. * @category Function
  10742. * @param {Function} func The function to rearrange arguments for.
  10743. * @param {...(number|number[])} indexes The arranged argument indexes.
  10744. * @returns {Function} Returns the new function.
  10745. * @example
  10746. *
  10747. * var rearged = _.rearg(function(a, b, c) {
  10748. * return [a, b, c];
  10749. * }, [2, 0, 1]);
  10750. *
  10751. * rearged('b', 'c', 'a')
  10752. * // => ['a', 'b', 'c']
  10753. */
  10754. var rearg = flatRest(function(func, indexes) {
  10755. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  10756. });
  10757. /**
  10758. * Creates a function that invokes `func` with the `this` binding of the
  10759. * created function and arguments from `start` and beyond provided as
  10760. * an array.
  10761. *
  10762. * **Note:** This method is based on the
  10763. * [rest parameter](https://mdn.io/rest_parameters).
  10764. *
  10765. * @static
  10766. * @memberOf _
  10767. * @since 4.0.0
  10768. * @category Function
  10769. * @param {Function} func The function to apply a rest parameter to.
  10770. * @param {number} [start=func.length-1] The start position of the rest parameter.
  10771. * @returns {Function} Returns the new function.
  10772. * @example
  10773. *
  10774. * var say = _.rest(function(what, names) {
  10775. * return what + ' ' + _.initial(names).join(', ') +
  10776. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  10777. * });
  10778. *
  10779. * say('hello', 'fred', 'barney', 'pebbles');
  10780. * // => 'hello fred, barney, & pebbles'
  10781. */
  10782. function rest(func, start) {
  10783. if (typeof func != 'function') {
  10784. throw new TypeError(FUNC_ERROR_TEXT);
  10785. }
  10786. start = start === undefined ? start : toInteger(start);
  10787. return baseRest(func, start);
  10788. }
  10789. /**
  10790. * Creates a function that invokes `func` with the `this` binding of the
  10791. * create function and an array of arguments much like
  10792. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  10793. *
  10794. * **Note:** This method is based on the
  10795. * [spread operator](https://mdn.io/spread_operator).
  10796. *
  10797. * @static
  10798. * @memberOf _
  10799. * @since 3.2.0
  10800. * @category Function
  10801. * @param {Function} func The function to spread arguments over.
  10802. * @param {number} [start=0] The start position of the spread.
  10803. * @returns {Function} Returns the new function.
  10804. * @example
  10805. *
  10806. * var say = _.spread(function(who, what) {
  10807. * return who + ' says ' + what;
  10808. * });
  10809. *
  10810. * say(['fred', 'hello']);
  10811. * // => 'fred says hello'
  10812. *
  10813. * var numbers = Promise.all([
  10814. * Promise.resolve(40),
  10815. * Promise.resolve(36)
  10816. * ]);
  10817. *
  10818. * numbers.then(_.spread(function(x, y) {
  10819. * return x + y;
  10820. * }));
  10821. * // => a Promise of 76
  10822. */
  10823. function spread(func, start) {
  10824. if (typeof func != 'function') {
  10825. throw new TypeError(FUNC_ERROR_TEXT);
  10826. }
  10827. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  10828. return baseRest(function(args) {
  10829. var array = args[start],
  10830. otherArgs = castSlice(args, 0, start);
  10831. if (array) {
  10832. arrayPush(otherArgs, array);
  10833. }
  10834. return apply(func, this, otherArgs);
  10835. });
  10836. }
  10837. /**
  10838. * Creates a throttled function that only invokes `func` at most once per
  10839. * every `wait` milliseconds. The throttled function comes with a `cancel`
  10840. * method to cancel delayed `func` invocations and a `flush` method to
  10841. * immediately invoke them. Provide `options` to indicate whether `func`
  10842. * should be invoked on the leading and/or trailing edge of the `wait`
  10843. * timeout. The `func` is invoked with the last arguments provided to the
  10844. * throttled function. Subsequent calls to the throttled function return the
  10845. * result of the last `func` invocation.
  10846. *
  10847. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10848. * invoked on the trailing edge of the timeout only if the throttled function
  10849. * is invoked more than once during the `wait` timeout.
  10850. *
  10851. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10852. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10853. *
  10854. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10855. * for details over the differences between `_.throttle` and `_.debounce`.
  10856. *
  10857. * @static
  10858. * @memberOf _
  10859. * @since 0.1.0
  10860. * @category Function
  10861. * @param {Function} func The function to throttle.
  10862. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  10863. * @param {Object} [options={}] The options object.
  10864. * @param {boolean} [options.leading=true]
  10865. * Specify invoking on the leading edge of the timeout.
  10866. * @param {boolean} [options.trailing=true]
  10867. * Specify invoking on the trailing edge of the timeout.
  10868. * @returns {Function} Returns the new throttled function.
  10869. * @example
  10870. *
  10871. * // Avoid excessively updating the position while scrolling.
  10872. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  10873. *
  10874. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  10875. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  10876. * jQuery(element).on('click', throttled);
  10877. *
  10878. * // Cancel the trailing throttled invocation.
  10879. * jQuery(window).on('popstate', throttled.cancel);
  10880. */
  10881. function throttle(func, wait, options) {
  10882. var leading = true,
  10883. trailing = true;
  10884. if (typeof func != 'function') {
  10885. throw new TypeError(FUNC_ERROR_TEXT);
  10886. }
  10887. if (isObject(options)) {
  10888. leading = 'leading' in options ? !!options.leading : leading;
  10889. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10890. }
  10891. return debounce(func, wait, {
  10892. 'leading': leading,
  10893. 'maxWait': wait,
  10894. 'trailing': trailing
  10895. });
  10896. }
  10897. /**
  10898. * Creates a function that accepts up to one argument, ignoring any
  10899. * additional arguments.
  10900. *
  10901. * @static
  10902. * @memberOf _
  10903. * @since 4.0.0
  10904. * @category Function
  10905. * @param {Function} func The function to cap arguments for.
  10906. * @returns {Function} Returns the new capped function.
  10907. * @example
  10908. *
  10909. * _.map(['6', '8', '10'], _.unary(parseInt));
  10910. * // => [6, 8, 10]
  10911. */
  10912. function unary(func) {
  10913. return ary(func, 1);
  10914. }
  10915. /**
  10916. * Creates a function that provides `value` to `wrapper` as its first
  10917. * argument. Any additional arguments provided to the function are appended
  10918. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  10919. * binding of the created function.
  10920. *
  10921. * @static
  10922. * @memberOf _
  10923. * @since 0.1.0
  10924. * @category Function
  10925. * @param {*} value The value to wrap.
  10926. * @param {Function} [wrapper=identity] The wrapper function.
  10927. * @returns {Function} Returns the new function.
  10928. * @example
  10929. *
  10930. * var p = _.wrap(_.escape, function(func, text) {
  10931. * return '<p>' + func(text) + '</p>';
  10932. * });
  10933. *
  10934. * p('fred, barney, & pebbles');
  10935. * // => '<p>fred, barney, &amp; pebbles</p>'
  10936. */
  10937. function wrap(value, wrapper) {
  10938. return partial(castFunction(wrapper), value);
  10939. }
  10940. /*------------------------------------------------------------------------*/
  10941. /**
  10942. * Casts `value` as an array if it's not one.
  10943. *
  10944. * @static
  10945. * @memberOf _
  10946. * @since 4.4.0
  10947. * @category Lang
  10948. * @param {*} value The value to inspect.
  10949. * @returns {Array} Returns the cast array.
  10950. * @example
  10951. *
  10952. * _.castArray(1);
  10953. * // => [1]
  10954. *
  10955. * _.castArray({ 'a': 1 });
  10956. * // => [{ 'a': 1 }]
  10957. *
  10958. * _.castArray('abc');
  10959. * // => ['abc']
  10960. *
  10961. * _.castArray(null);
  10962. * // => [null]
  10963. *
  10964. * _.castArray(undefined);
  10965. * // => [undefined]
  10966. *
  10967. * _.castArray();
  10968. * // => []
  10969. *
  10970. * var array = [1, 2, 3];
  10971. * console.log(_.castArray(array) === array);
  10972. * // => true
  10973. */
  10974. function castArray() {
  10975. if (!arguments.length) {
  10976. return [];
  10977. }
  10978. var value = arguments[0];
  10979. return isArray(value) ? value : [value];
  10980. }
  10981. /**
  10982. * Creates a shallow clone of `value`.
  10983. *
  10984. * **Note:** This method is loosely based on the
  10985. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  10986. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  10987. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  10988. * arrays. The own enumerable properties of `arguments` objects are cloned
  10989. * as plain objects. An empty object is returned for uncloneable values such
  10990. * as error objects, functions, DOM nodes, and WeakMaps.
  10991. *
  10992. * @static
  10993. * @memberOf _
  10994. * @since 0.1.0
  10995. * @category Lang
  10996. * @param {*} value The value to clone.
  10997. * @returns {*} Returns the cloned value.
  10998. * @see _.cloneDeep
  10999. * @example
  11000. *
  11001. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11002. *
  11003. * var shallow = _.clone(objects);
  11004. * console.log(shallow[0] === objects[0]);
  11005. * // => true
  11006. */
  11007. function clone(value) {
  11008. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11009. }
  11010. /**
  11011. * This method is like `_.clone` except that it accepts `customizer` which
  11012. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11013. * cloning is handled by the method instead. The `customizer` is invoked with
  11014. * up to four arguments; (value [, index|key, object, stack]).
  11015. *
  11016. * @static
  11017. * @memberOf _
  11018. * @since 4.0.0
  11019. * @category Lang
  11020. * @param {*} value The value to clone.
  11021. * @param {Function} [customizer] The function to customize cloning.
  11022. * @returns {*} Returns the cloned value.
  11023. * @see _.cloneDeepWith
  11024. * @example
  11025. *
  11026. * function customizer(value) {
  11027. * if (_.isElement(value)) {
  11028. * return value.cloneNode(false);
  11029. * }
  11030. * }
  11031. *
  11032. * var el = _.cloneWith(document.body, customizer);
  11033. *
  11034. * console.log(el === document.body);
  11035. * // => false
  11036. * console.log(el.nodeName);
  11037. * // => 'BODY'
  11038. * console.log(el.childNodes.length);
  11039. * // => 0
  11040. */
  11041. function cloneWith(value, customizer) {
  11042. customizer = typeof customizer == 'function' ? customizer : undefined;
  11043. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11044. }
  11045. /**
  11046. * This method is like `_.clone` except that it recursively clones `value`.
  11047. *
  11048. * @static
  11049. * @memberOf _
  11050. * @since 1.0.0
  11051. * @category Lang
  11052. * @param {*} value The value to recursively clone.
  11053. * @returns {*} Returns the deep cloned value.
  11054. * @see _.clone
  11055. * @example
  11056. *
  11057. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11058. *
  11059. * var deep = _.cloneDeep(objects);
  11060. * console.log(deep[0] === objects[0]);
  11061. * // => false
  11062. */
  11063. function cloneDeep(value) {
  11064. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11065. }
  11066. /**
  11067. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11068. *
  11069. * @static
  11070. * @memberOf _
  11071. * @since 4.0.0
  11072. * @category Lang
  11073. * @param {*} value The value to recursively clone.
  11074. * @param {Function} [customizer] The function to customize cloning.
  11075. * @returns {*} Returns the deep cloned value.
  11076. * @see _.cloneWith
  11077. * @example
  11078. *
  11079. * function customizer(value) {
  11080. * if (_.isElement(value)) {
  11081. * return value.cloneNode(true);
  11082. * }
  11083. * }
  11084. *
  11085. * var el = _.cloneDeepWith(document.body, customizer);
  11086. *
  11087. * console.log(el === document.body);
  11088. * // => false
  11089. * console.log(el.nodeName);
  11090. * // => 'BODY'
  11091. * console.log(el.childNodes.length);
  11092. * // => 20
  11093. */
  11094. function cloneDeepWith(value, customizer) {
  11095. customizer = typeof customizer == 'function' ? customizer : undefined;
  11096. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11097. }
  11098. /**
  11099. * Checks if `object` conforms to `source` by invoking the predicate
  11100. * properties of `source` with the corresponding property values of `object`.
  11101. *
  11102. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11103. * partially applied.
  11104. *
  11105. * @static
  11106. * @memberOf _
  11107. * @since 4.14.0
  11108. * @category Lang
  11109. * @param {Object} object The object to inspect.
  11110. * @param {Object} source The object of property predicates to conform to.
  11111. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11112. * @example
  11113. *
  11114. * var object = { 'a': 1, 'b': 2 };
  11115. *
  11116. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11117. * // => true
  11118. *
  11119. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11120. * // => false
  11121. */
  11122. function conformsTo(object, source) {
  11123. return source == null || baseConformsTo(object, source, keys(source));
  11124. }
  11125. /**
  11126. * Performs a
  11127. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11128. * comparison between two values to determine if they are equivalent.
  11129. *
  11130. * @static
  11131. * @memberOf _
  11132. * @since 4.0.0
  11133. * @category Lang
  11134. * @param {*} value The value to compare.
  11135. * @param {*} other The other value to compare.
  11136. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11137. * @example
  11138. *
  11139. * var object = { 'a': 1 };
  11140. * var other = { 'a': 1 };
  11141. *
  11142. * _.eq(object, object);
  11143. * // => true
  11144. *
  11145. * _.eq(object, other);
  11146. * // => false
  11147. *
  11148. * _.eq('a', 'a');
  11149. * // => true
  11150. *
  11151. * _.eq('a', Object('a'));
  11152. * // => false
  11153. *
  11154. * _.eq(NaN, NaN);
  11155. * // => true
  11156. */
  11157. function eq(value, other) {
  11158. return value === other || (value !== value && other !== other);
  11159. }
  11160. /**
  11161. * Checks if `value` is greater than `other`.
  11162. *
  11163. * @static
  11164. * @memberOf _
  11165. * @since 3.9.0
  11166. * @category Lang
  11167. * @param {*} value The value to compare.
  11168. * @param {*} other The other value to compare.
  11169. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11170. * else `false`.
  11171. * @see _.lt
  11172. * @example
  11173. *
  11174. * _.gt(3, 1);
  11175. * // => true
  11176. *
  11177. * _.gt(3, 3);
  11178. * // => false
  11179. *
  11180. * _.gt(1, 3);
  11181. * // => false
  11182. */
  11183. var gt = createRelationalOperation(baseGt);
  11184. /**
  11185. * Checks if `value` is greater than or equal to `other`.
  11186. *
  11187. * @static
  11188. * @memberOf _
  11189. * @since 3.9.0
  11190. * @category Lang
  11191. * @param {*} value The value to compare.
  11192. * @param {*} other The other value to compare.
  11193. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11194. * `other`, else `false`.
  11195. * @see _.lte
  11196. * @example
  11197. *
  11198. * _.gte(3, 1);
  11199. * // => true
  11200. *
  11201. * _.gte(3, 3);
  11202. * // => true
  11203. *
  11204. * _.gte(1, 3);
  11205. * // => false
  11206. */
  11207. var gte = createRelationalOperation(function(value, other) {
  11208. return value >= other;
  11209. });
  11210. /**
  11211. * Checks if `value` is likely an `arguments` object.
  11212. *
  11213. * @static
  11214. * @memberOf _
  11215. * @since 0.1.0
  11216. * @category Lang
  11217. * @param {*} value The value to check.
  11218. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11219. * else `false`.
  11220. * @example
  11221. *
  11222. * _.isArguments(function() { return arguments; }());
  11223. * // => true
  11224. *
  11225. * _.isArguments([1, 2, 3]);
  11226. * // => false
  11227. */
  11228. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11229. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11230. !propertyIsEnumerable.call(value, 'callee');
  11231. };
  11232. /**
  11233. * Checks if `value` is classified as an `Array` object.
  11234. *
  11235. * @static
  11236. * @memberOf _
  11237. * @since 0.1.0
  11238. * @category Lang
  11239. * @param {*} value The value to check.
  11240. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11241. * @example
  11242. *
  11243. * _.isArray([1, 2, 3]);
  11244. * // => true
  11245. *
  11246. * _.isArray(document.body.children);
  11247. * // => false
  11248. *
  11249. * _.isArray('abc');
  11250. * // => false
  11251. *
  11252. * _.isArray(_.noop);
  11253. * // => false
  11254. */
  11255. var isArray = Array.isArray;
  11256. /**
  11257. * Checks if `value` is classified as an `ArrayBuffer` object.
  11258. *
  11259. * @static
  11260. * @memberOf _
  11261. * @since 4.3.0
  11262. * @category Lang
  11263. * @param {*} value The value to check.
  11264. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11265. * @example
  11266. *
  11267. * _.isArrayBuffer(new ArrayBuffer(2));
  11268. * // => true
  11269. *
  11270. * _.isArrayBuffer(new Array(2));
  11271. * // => false
  11272. */
  11273. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11274. /**
  11275. * Checks if `value` is array-like. A value is considered array-like if it's
  11276. * not a function and has a `value.length` that's an integer greater than or
  11277. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11278. *
  11279. * @static
  11280. * @memberOf _
  11281. * @since 4.0.0
  11282. * @category Lang
  11283. * @param {*} value The value to check.
  11284. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11285. * @example
  11286. *
  11287. * _.isArrayLike([1, 2, 3]);
  11288. * // => true
  11289. *
  11290. * _.isArrayLike(document.body.children);
  11291. * // => true
  11292. *
  11293. * _.isArrayLike('abc');
  11294. * // => true
  11295. *
  11296. * _.isArrayLike(_.noop);
  11297. * // => false
  11298. */
  11299. function isArrayLike(value) {
  11300. return value != null && isLength(value.length) && !isFunction(value);
  11301. }
  11302. /**
  11303. * This method is like `_.isArrayLike` except that it also checks if `value`
  11304. * is an object.
  11305. *
  11306. * @static
  11307. * @memberOf _
  11308. * @since 4.0.0
  11309. * @category Lang
  11310. * @param {*} value The value to check.
  11311. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11312. * else `false`.
  11313. * @example
  11314. *
  11315. * _.isArrayLikeObject([1, 2, 3]);
  11316. * // => true
  11317. *
  11318. * _.isArrayLikeObject(document.body.children);
  11319. * // => true
  11320. *
  11321. * _.isArrayLikeObject('abc');
  11322. * // => false
  11323. *
  11324. * _.isArrayLikeObject(_.noop);
  11325. * // => false
  11326. */
  11327. function isArrayLikeObject(value) {
  11328. return isObjectLike(value) && isArrayLike(value);
  11329. }
  11330. /**
  11331. * Checks if `value` is classified as a boolean primitive or object.
  11332. *
  11333. * @static
  11334. * @memberOf _
  11335. * @since 0.1.0
  11336. * @category Lang
  11337. * @param {*} value The value to check.
  11338. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11339. * @example
  11340. *
  11341. * _.isBoolean(false);
  11342. * // => true
  11343. *
  11344. * _.isBoolean(null);
  11345. * // => false
  11346. */
  11347. function isBoolean(value) {
  11348. return value === true || value === false ||
  11349. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11350. }
  11351. /**
  11352. * Checks if `value` is a buffer.
  11353. *
  11354. * @static
  11355. * @memberOf _
  11356. * @since 4.3.0
  11357. * @category Lang
  11358. * @param {*} value The value to check.
  11359. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11360. * @example
  11361. *
  11362. * _.isBuffer(new Buffer(2));
  11363. * // => true
  11364. *
  11365. * _.isBuffer(new Uint8Array(2));
  11366. * // => false
  11367. */
  11368. var isBuffer = nativeIsBuffer || stubFalse;
  11369. /**
  11370. * Checks if `value` is classified as a `Date` object.
  11371. *
  11372. * @static
  11373. * @memberOf _
  11374. * @since 0.1.0
  11375. * @category Lang
  11376. * @param {*} value The value to check.
  11377. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11378. * @example
  11379. *
  11380. * _.isDate(new Date);
  11381. * // => true
  11382. *
  11383. * _.isDate('Mon April 23 2012');
  11384. * // => false
  11385. */
  11386. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  11387. /**
  11388. * Checks if `value` is likely a DOM element.
  11389. *
  11390. * @static
  11391. * @memberOf _
  11392. * @since 0.1.0
  11393. * @category Lang
  11394. * @param {*} value The value to check.
  11395. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  11396. * @example
  11397. *
  11398. * _.isElement(document.body);
  11399. * // => true
  11400. *
  11401. * _.isElement('<body>');
  11402. * // => false
  11403. */
  11404. function isElement(value) {
  11405. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  11406. }
  11407. /**
  11408. * Checks if `value` is an empty object, collection, map, or set.
  11409. *
  11410. * Objects are considered empty if they have no own enumerable string keyed
  11411. * properties.
  11412. *
  11413. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  11414. * jQuery-like collections are considered empty if they have a `length` of `0`.
  11415. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  11416. *
  11417. * @static
  11418. * @memberOf _
  11419. * @since 0.1.0
  11420. * @category Lang
  11421. * @param {*} value The value to check.
  11422. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  11423. * @example
  11424. *
  11425. * _.isEmpty(null);
  11426. * // => true
  11427. *
  11428. * _.isEmpty(true);
  11429. * // => true
  11430. *
  11431. * _.isEmpty(1);
  11432. * // => true
  11433. *
  11434. * _.isEmpty([1, 2, 3]);
  11435. * // => false
  11436. *
  11437. * _.isEmpty({ 'a': 1 });
  11438. * // => false
  11439. */
  11440. function isEmpty(value) {
  11441. if (value == null) {
  11442. return true;
  11443. }
  11444. if (isArrayLike(value) &&
  11445. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  11446. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  11447. return !value.length;
  11448. }
  11449. var tag = getTag(value);
  11450. if (tag == mapTag || tag == setTag) {
  11451. return !value.size;
  11452. }
  11453. if (isPrototype(value)) {
  11454. return !baseKeys(value).length;
  11455. }
  11456. for (var key in value) {
  11457. if (hasOwnProperty.call(value, key)) {
  11458. return false;
  11459. }
  11460. }
  11461. return true;
  11462. }
  11463. /**
  11464. * Performs a deep comparison between two values to determine if they are
  11465. * equivalent.
  11466. *
  11467. * **Note:** This method supports comparing arrays, array buffers, booleans,
  11468. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  11469. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  11470. * by their own, not inherited, enumerable properties. Functions and DOM
  11471. * nodes are compared by strict equality, i.e. `===`.
  11472. *
  11473. * @static
  11474. * @memberOf _
  11475. * @since 0.1.0
  11476. * @category Lang
  11477. * @param {*} value The value to compare.
  11478. * @param {*} other The other value to compare.
  11479. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11480. * @example
  11481. *
  11482. * var object = { 'a': 1 };
  11483. * var other = { 'a': 1 };
  11484. *
  11485. * _.isEqual(object, other);
  11486. * // => true
  11487. *
  11488. * object === other;
  11489. * // => false
  11490. */
  11491. function isEqual(value, other) {
  11492. return baseIsEqual(value, other);
  11493. }
  11494. /**
  11495. * This method is like `_.isEqual` except that it accepts `customizer` which
  11496. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11497. * are handled by the method instead. The `customizer` is invoked with up to
  11498. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  11499. *
  11500. * @static
  11501. * @memberOf _
  11502. * @since 4.0.0
  11503. * @category Lang
  11504. * @param {*} value The value to compare.
  11505. * @param {*} other The other value to compare.
  11506. * @param {Function} [customizer] The function to customize comparisons.
  11507. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11508. * @example
  11509. *
  11510. * function isGreeting(value) {
  11511. * return /^h(?:i|ello)$/.test(value);
  11512. * }
  11513. *
  11514. * function customizer(objValue, othValue) {
  11515. * if (isGreeting(objValue) && isGreeting(othValue)) {
  11516. * return true;
  11517. * }
  11518. * }
  11519. *
  11520. * var array = ['hello', 'goodbye'];
  11521. * var other = ['hi', 'goodbye'];
  11522. *
  11523. * _.isEqualWith(array, other, customizer);
  11524. * // => true
  11525. */
  11526. function isEqualWith(value, other, customizer) {
  11527. customizer = typeof customizer == 'function' ? customizer : undefined;
  11528. var result = customizer ? customizer(value, other) : undefined;
  11529. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  11530. }
  11531. /**
  11532. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  11533. * `SyntaxError`, `TypeError`, or `URIError` object.
  11534. *
  11535. * @static
  11536. * @memberOf _
  11537. * @since 3.0.0
  11538. * @category Lang
  11539. * @param {*} value The value to check.
  11540. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  11541. * @example
  11542. *
  11543. * _.isError(new Error);
  11544. * // => true
  11545. *
  11546. * _.isError(Error);
  11547. * // => false
  11548. */
  11549. function isError(value) {
  11550. if (!isObjectLike(value)) {
  11551. return false;
  11552. }
  11553. var tag = baseGetTag(value);
  11554. return tag == errorTag || tag == domExcTag ||
  11555. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  11556. }
  11557. /**
  11558. * Checks if `value` is a finite primitive number.
  11559. *
  11560. * **Note:** This method is based on
  11561. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  11562. *
  11563. * @static
  11564. * @memberOf _
  11565. * @since 0.1.0
  11566. * @category Lang
  11567. * @param {*} value The value to check.
  11568. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  11569. * @example
  11570. *
  11571. * _.isFinite(3);
  11572. * // => true
  11573. *
  11574. * _.isFinite(Number.MIN_VALUE);
  11575. * // => true
  11576. *
  11577. * _.isFinite(Infinity);
  11578. * // => false
  11579. *
  11580. * _.isFinite('3');
  11581. * // => false
  11582. */
  11583. function isFinite(value) {
  11584. return typeof value == 'number' && nativeIsFinite(value);
  11585. }
  11586. /**
  11587. * Checks if `value` is classified as a `Function` object.
  11588. *
  11589. * @static
  11590. * @memberOf _
  11591. * @since 0.1.0
  11592. * @category Lang
  11593. * @param {*} value The value to check.
  11594. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  11595. * @example
  11596. *
  11597. * _.isFunction(_);
  11598. * // => true
  11599. *
  11600. * _.isFunction(/abc/);
  11601. * // => false
  11602. */
  11603. function isFunction(value) {
  11604. if (!isObject(value)) {
  11605. return false;
  11606. }
  11607. // The use of `Object#toString` avoids issues with the `typeof` operator
  11608. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  11609. var tag = baseGetTag(value);
  11610. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  11611. }
  11612. /**
  11613. * Checks if `value` is an integer.
  11614. *
  11615. * **Note:** This method is based on
  11616. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  11617. *
  11618. * @static
  11619. * @memberOf _
  11620. * @since 4.0.0
  11621. * @category Lang
  11622. * @param {*} value The value to check.
  11623. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  11624. * @example
  11625. *
  11626. * _.isInteger(3);
  11627. * // => true
  11628. *
  11629. * _.isInteger(Number.MIN_VALUE);
  11630. * // => false
  11631. *
  11632. * _.isInteger(Infinity);
  11633. * // => false
  11634. *
  11635. * _.isInteger('3');
  11636. * // => false
  11637. */
  11638. function isInteger(value) {
  11639. return typeof value == 'number' && value == toInteger(value);
  11640. }
  11641. /**
  11642. * Checks if `value` is a valid array-like length.
  11643. *
  11644. * **Note:** This method is loosely based on
  11645. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  11646. *
  11647. * @static
  11648. * @memberOf _
  11649. * @since 4.0.0
  11650. * @category Lang
  11651. * @param {*} value The value to check.
  11652. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  11653. * @example
  11654. *
  11655. * _.isLength(3);
  11656. * // => true
  11657. *
  11658. * _.isLength(Number.MIN_VALUE);
  11659. * // => false
  11660. *
  11661. * _.isLength(Infinity);
  11662. * // => false
  11663. *
  11664. * _.isLength('3');
  11665. * // => false
  11666. */
  11667. function isLength(value) {
  11668. return typeof value == 'number' &&
  11669. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  11670. }
  11671. /**
  11672. * Checks if `value` is the
  11673. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  11674. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  11675. *
  11676. * @static
  11677. * @memberOf _
  11678. * @since 0.1.0
  11679. * @category Lang
  11680. * @param {*} value The value to check.
  11681. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  11682. * @example
  11683. *
  11684. * _.isObject({});
  11685. * // => true
  11686. *
  11687. * _.isObject([1, 2, 3]);
  11688. * // => true
  11689. *
  11690. * _.isObject(_.noop);
  11691. * // => true
  11692. *
  11693. * _.isObject(null);
  11694. * // => false
  11695. */
  11696. function isObject(value) {
  11697. var type = typeof value;
  11698. return value != null && (type == 'object' || type == 'function');
  11699. }
  11700. /**
  11701. * Checks if `value` is object-like. A value is object-like if it's not `null`
  11702. * and has a `typeof` result of "object".
  11703. *
  11704. * @static
  11705. * @memberOf _
  11706. * @since 4.0.0
  11707. * @category Lang
  11708. * @param {*} value The value to check.
  11709. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  11710. * @example
  11711. *
  11712. * _.isObjectLike({});
  11713. * // => true
  11714. *
  11715. * _.isObjectLike([1, 2, 3]);
  11716. * // => true
  11717. *
  11718. * _.isObjectLike(_.noop);
  11719. * // => false
  11720. *
  11721. * _.isObjectLike(null);
  11722. * // => false
  11723. */
  11724. function isObjectLike(value) {
  11725. return value != null && typeof value == 'object';
  11726. }
  11727. /**
  11728. * Checks if `value` is classified as a `Map` object.
  11729. *
  11730. * @static
  11731. * @memberOf _
  11732. * @since 4.3.0
  11733. * @category Lang
  11734. * @param {*} value The value to check.
  11735. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  11736. * @example
  11737. *
  11738. * _.isMap(new Map);
  11739. * // => true
  11740. *
  11741. * _.isMap(new WeakMap);
  11742. * // => false
  11743. */
  11744. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  11745. /**
  11746. * Performs a partial deep comparison between `object` and `source` to
  11747. * determine if `object` contains equivalent property values.
  11748. *
  11749. * **Note:** This method is equivalent to `_.matches` when `source` is
  11750. * partially applied.
  11751. *
  11752. * Partial comparisons will match empty array and empty object `source`
  11753. * values against any array or object value, respectively. See `_.isEqual`
  11754. * for a list of supported value comparisons.
  11755. *
  11756. * @static
  11757. * @memberOf _
  11758. * @since 3.0.0
  11759. * @category Lang
  11760. * @param {Object} object The object to inspect.
  11761. * @param {Object} source The object of property values to match.
  11762. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11763. * @example
  11764. *
  11765. * var object = { 'a': 1, 'b': 2 };
  11766. *
  11767. * _.isMatch(object, { 'b': 2 });
  11768. * // => true
  11769. *
  11770. * _.isMatch(object, { 'b': 1 });
  11771. * // => false
  11772. */
  11773. function isMatch(object, source) {
  11774. return object === source || baseIsMatch(object, source, getMatchData(source));
  11775. }
  11776. /**
  11777. * This method is like `_.isMatch` except that it accepts `customizer` which
  11778. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11779. * are handled by the method instead. The `customizer` is invoked with five
  11780. * arguments: (objValue, srcValue, index|key, object, source).
  11781. *
  11782. * @static
  11783. * @memberOf _
  11784. * @since 4.0.0
  11785. * @category Lang
  11786. * @param {Object} object The object to inspect.
  11787. * @param {Object} source The object of property values to match.
  11788. * @param {Function} [customizer] The function to customize comparisons.
  11789. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11790. * @example
  11791. *
  11792. * function isGreeting(value) {
  11793. * return /^h(?:i|ello)$/.test(value);
  11794. * }
  11795. *
  11796. * function customizer(objValue, srcValue) {
  11797. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  11798. * return true;
  11799. * }
  11800. * }
  11801. *
  11802. * var object = { 'greeting': 'hello' };
  11803. * var source = { 'greeting': 'hi' };
  11804. *
  11805. * _.isMatchWith(object, source, customizer);
  11806. * // => true
  11807. */
  11808. function isMatchWith(object, source, customizer) {
  11809. customizer = typeof customizer == 'function' ? customizer : undefined;
  11810. return baseIsMatch(object, source, getMatchData(source), customizer);
  11811. }
  11812. /**
  11813. * Checks if `value` is `NaN`.
  11814. *
  11815. * **Note:** This method is based on
  11816. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  11817. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  11818. * `undefined` and other non-number values.
  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 `NaN`, else `false`.
  11826. * @example
  11827. *
  11828. * _.isNaN(NaN);
  11829. * // => true
  11830. *
  11831. * _.isNaN(new Number(NaN));
  11832. * // => true
  11833. *
  11834. * isNaN(undefined);
  11835. * // => true
  11836. *
  11837. * _.isNaN(undefined);
  11838. * // => false
  11839. */
  11840. function isNaN(value) {
  11841. // An `NaN` primitive is the only value that is not equal to itself.
  11842. // Perform the `toStringTag` check first to avoid errors with some
  11843. // ActiveX objects in IE.
  11844. return isNumber(value) && value != +value;
  11845. }
  11846. /**
  11847. * Checks if `value` is a pristine native function.
  11848. *
  11849. * **Note:** This method can't reliably detect native functions in the presence
  11850. * of the core-js package because core-js circumvents this kind of detection.
  11851. * Despite multiple requests, the core-js maintainer has made it clear: any
  11852. * attempt to fix the detection will be obstructed. As a result, we're left
  11853. * with little choice but to throw an error. Unfortunately, this also affects
  11854. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  11855. * which rely on core-js.
  11856. *
  11857. * @static
  11858. * @memberOf _
  11859. * @since 3.0.0
  11860. * @category Lang
  11861. * @param {*} value The value to check.
  11862. * @returns {boolean} Returns `true` if `value` is a native function,
  11863. * else `false`.
  11864. * @example
  11865. *
  11866. * _.isNative(Array.prototype.push);
  11867. * // => true
  11868. *
  11869. * _.isNative(_);
  11870. * // => false
  11871. */
  11872. function isNative(value) {
  11873. if (isMaskable(value)) {
  11874. throw new Error(CORE_ERROR_TEXT);
  11875. }
  11876. return baseIsNative(value);
  11877. }
  11878. /**
  11879. * Checks if `value` is `null`.
  11880. *
  11881. * @static
  11882. * @memberOf _
  11883. * @since 0.1.0
  11884. * @category Lang
  11885. * @param {*} value The value to check.
  11886. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  11887. * @example
  11888. *
  11889. * _.isNull(null);
  11890. * // => true
  11891. *
  11892. * _.isNull(void 0);
  11893. * // => false
  11894. */
  11895. function isNull(value) {
  11896. return value === null;
  11897. }
  11898. /**
  11899. * Checks if `value` is `null` or `undefined`.
  11900. *
  11901. * @static
  11902. * @memberOf _
  11903. * @since 4.0.0
  11904. * @category Lang
  11905. * @param {*} value The value to check.
  11906. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  11907. * @example
  11908. *
  11909. * _.isNil(null);
  11910. * // => true
  11911. *
  11912. * _.isNil(void 0);
  11913. * // => true
  11914. *
  11915. * _.isNil(NaN);
  11916. * // => false
  11917. */
  11918. function isNil(value) {
  11919. return value == null;
  11920. }
  11921. /**
  11922. * Checks if `value` is classified as a `Number` primitive or object.
  11923. *
  11924. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  11925. * classified as numbers, use the `_.isFinite` method.
  11926. *
  11927. * @static
  11928. * @memberOf _
  11929. * @since 0.1.0
  11930. * @category Lang
  11931. * @param {*} value The value to check.
  11932. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  11933. * @example
  11934. *
  11935. * _.isNumber(3);
  11936. * // => true
  11937. *
  11938. * _.isNumber(Number.MIN_VALUE);
  11939. * // => true
  11940. *
  11941. * _.isNumber(Infinity);
  11942. * // => true
  11943. *
  11944. * _.isNumber('3');
  11945. * // => false
  11946. */
  11947. function isNumber(value) {
  11948. return typeof value == 'number' ||
  11949. (isObjectLike(value) && baseGetTag(value) == numberTag);
  11950. }
  11951. /**
  11952. * Checks if `value` is a plain object, that is, an object created by the
  11953. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  11954. *
  11955. * @static
  11956. * @memberOf _
  11957. * @since 0.8.0
  11958. * @category Lang
  11959. * @param {*} value The value to check.
  11960. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  11961. * @example
  11962. *
  11963. * function Foo() {
  11964. * this.a = 1;
  11965. * }
  11966. *
  11967. * _.isPlainObject(new Foo);
  11968. * // => false
  11969. *
  11970. * _.isPlainObject([1, 2, 3]);
  11971. * // => false
  11972. *
  11973. * _.isPlainObject({ 'x': 0, 'y': 0 });
  11974. * // => true
  11975. *
  11976. * _.isPlainObject(Object.create(null));
  11977. * // => true
  11978. */
  11979. function isPlainObject(value) {
  11980. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  11981. return false;
  11982. }
  11983. var proto = getPrototype(value);
  11984. if (proto === null) {
  11985. return true;
  11986. }
  11987. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  11988. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  11989. funcToString.call(Ctor) == objectCtorString;
  11990. }
  11991. /**
  11992. * Checks if `value` is classified as a `RegExp` object.
  11993. *
  11994. * @static
  11995. * @memberOf _
  11996. * @since 0.1.0
  11997. * @category Lang
  11998. * @param {*} value The value to check.
  11999. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12000. * @example
  12001. *
  12002. * _.isRegExp(/abc/);
  12003. * // => true
  12004. *
  12005. * _.isRegExp('/abc/');
  12006. * // => false
  12007. */
  12008. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12009. /**
  12010. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12011. * double precision number which isn't the result of a rounded unsafe integer.
  12012. *
  12013. * **Note:** This method is based on
  12014. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12015. *
  12016. * @static
  12017. * @memberOf _
  12018. * @since 4.0.0
  12019. * @category Lang
  12020. * @param {*} value The value to check.
  12021. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12022. * @example
  12023. *
  12024. * _.isSafeInteger(3);
  12025. * // => true
  12026. *
  12027. * _.isSafeInteger(Number.MIN_VALUE);
  12028. * // => false
  12029. *
  12030. * _.isSafeInteger(Infinity);
  12031. * // => false
  12032. *
  12033. * _.isSafeInteger('3');
  12034. * // => false
  12035. */
  12036. function isSafeInteger(value) {
  12037. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12038. }
  12039. /**
  12040. * Checks if `value` is classified as a `Set` object.
  12041. *
  12042. * @static
  12043. * @memberOf _
  12044. * @since 4.3.0
  12045. * @category Lang
  12046. * @param {*} value The value to check.
  12047. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12048. * @example
  12049. *
  12050. * _.isSet(new Set);
  12051. * // => true
  12052. *
  12053. * _.isSet(new WeakSet);
  12054. * // => false
  12055. */
  12056. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12057. /**
  12058. * Checks if `value` is classified as a `String` primitive or object.
  12059. *
  12060. * @static
  12061. * @since 0.1.0
  12062. * @memberOf _
  12063. * @category Lang
  12064. * @param {*} value The value to check.
  12065. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12066. * @example
  12067. *
  12068. * _.isString('abc');
  12069. * // => true
  12070. *
  12071. * _.isString(1);
  12072. * // => false
  12073. */
  12074. function isString(value) {
  12075. return typeof value == 'string' ||
  12076. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12077. }
  12078. /**
  12079. * Checks if `value` is classified as a `Symbol` primitive or object.
  12080. *
  12081. * @static
  12082. * @memberOf _
  12083. * @since 4.0.0
  12084. * @category Lang
  12085. * @param {*} value The value to check.
  12086. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12087. * @example
  12088. *
  12089. * _.isSymbol(Symbol.iterator);
  12090. * // => true
  12091. *
  12092. * _.isSymbol('abc');
  12093. * // => false
  12094. */
  12095. function isSymbol(value) {
  12096. return typeof value == 'symbol' ||
  12097. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12098. }
  12099. /**
  12100. * Checks if `value` is classified as a typed array.
  12101. *
  12102. * @static
  12103. * @memberOf _
  12104. * @since 3.0.0
  12105. * @category Lang
  12106. * @param {*} value The value to check.
  12107. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12108. * @example
  12109. *
  12110. * _.isTypedArray(new Uint8Array);
  12111. * // => true
  12112. *
  12113. * _.isTypedArray([]);
  12114. * // => false
  12115. */
  12116. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12117. /**
  12118. * Checks if `value` is `undefined`.
  12119. *
  12120. * @static
  12121. * @since 0.1.0
  12122. * @memberOf _
  12123. * @category Lang
  12124. * @param {*} value The value to check.
  12125. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12126. * @example
  12127. *
  12128. * _.isUndefined(void 0);
  12129. * // => true
  12130. *
  12131. * _.isUndefined(null);
  12132. * // => false
  12133. */
  12134. function isUndefined(value) {
  12135. return value === undefined;
  12136. }
  12137. /**
  12138. * Checks if `value` is classified as a `WeakMap` object.
  12139. *
  12140. * @static
  12141. * @memberOf _
  12142. * @since 4.3.0
  12143. * @category Lang
  12144. * @param {*} value The value to check.
  12145. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12146. * @example
  12147. *
  12148. * _.isWeakMap(new WeakMap);
  12149. * // => true
  12150. *
  12151. * _.isWeakMap(new Map);
  12152. * // => false
  12153. */
  12154. function isWeakMap(value) {
  12155. return isObjectLike(value) && getTag(value) == weakMapTag;
  12156. }
  12157. /**
  12158. * Checks if `value` is classified as a `WeakSet` object.
  12159. *
  12160. * @static
  12161. * @memberOf _
  12162. * @since 4.3.0
  12163. * @category Lang
  12164. * @param {*} value The value to check.
  12165. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12166. * @example
  12167. *
  12168. * _.isWeakSet(new WeakSet);
  12169. * // => true
  12170. *
  12171. * _.isWeakSet(new Set);
  12172. * // => false
  12173. */
  12174. function isWeakSet(value) {
  12175. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12176. }
  12177. /**
  12178. * Checks if `value` is less than `other`.
  12179. *
  12180. * @static
  12181. * @memberOf _
  12182. * @since 3.9.0
  12183. * @category Lang
  12184. * @param {*} value The value to compare.
  12185. * @param {*} other The other value to compare.
  12186. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12187. * else `false`.
  12188. * @see _.gt
  12189. * @example
  12190. *
  12191. * _.lt(1, 3);
  12192. * // => true
  12193. *
  12194. * _.lt(3, 3);
  12195. * // => false
  12196. *
  12197. * _.lt(3, 1);
  12198. * // => false
  12199. */
  12200. var lt = createRelationalOperation(baseLt);
  12201. /**
  12202. * Checks if `value` is less than or equal to `other`.
  12203. *
  12204. * @static
  12205. * @memberOf _
  12206. * @since 3.9.0
  12207. * @category Lang
  12208. * @param {*} value The value to compare.
  12209. * @param {*} other The other value to compare.
  12210. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12211. * `other`, else `false`.
  12212. * @see _.gte
  12213. * @example
  12214. *
  12215. * _.lte(1, 3);
  12216. * // => true
  12217. *
  12218. * _.lte(3, 3);
  12219. * // => true
  12220. *
  12221. * _.lte(3, 1);
  12222. * // => false
  12223. */
  12224. var lte = createRelationalOperation(function(value, other) {
  12225. return value <= other;
  12226. });
  12227. /**
  12228. * Converts `value` to an array.
  12229. *
  12230. * @static
  12231. * @since 0.1.0
  12232. * @memberOf _
  12233. * @category Lang
  12234. * @param {*} value The value to convert.
  12235. * @returns {Array} Returns the converted array.
  12236. * @example
  12237. *
  12238. * _.toArray({ 'a': 1, 'b': 2 });
  12239. * // => [1, 2]
  12240. *
  12241. * _.toArray('abc');
  12242. * // => ['a', 'b', 'c']
  12243. *
  12244. * _.toArray(1);
  12245. * // => []
  12246. *
  12247. * _.toArray(null);
  12248. * // => []
  12249. */
  12250. function toArray(value) {
  12251. if (!value) {
  12252. return [];
  12253. }
  12254. if (isArrayLike(value)) {
  12255. return isString(value) ? stringToArray(value) : copyArray(value);
  12256. }
  12257. if (symIterator && value[symIterator]) {
  12258. return iteratorToArray(value[symIterator]());
  12259. }
  12260. var tag = getTag(value),
  12261. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12262. return func(value);
  12263. }
  12264. /**
  12265. * Converts `value` to a finite number.
  12266. *
  12267. * @static
  12268. * @memberOf _
  12269. * @since 4.12.0
  12270. * @category Lang
  12271. * @param {*} value The value to convert.
  12272. * @returns {number} Returns the converted number.
  12273. * @example
  12274. *
  12275. * _.toFinite(3.2);
  12276. * // => 3.2
  12277. *
  12278. * _.toFinite(Number.MIN_VALUE);
  12279. * // => 5e-324
  12280. *
  12281. * _.toFinite(Infinity);
  12282. * // => 1.7976931348623157e+308
  12283. *
  12284. * _.toFinite('3.2');
  12285. * // => 3.2
  12286. */
  12287. function toFinite(value) {
  12288. if (!value) {
  12289. return value === 0 ? value : 0;
  12290. }
  12291. value = toNumber(value);
  12292. if (value === INFINITY || value === -INFINITY) {
  12293. var sign = (value < 0 ? -1 : 1);
  12294. return sign * MAX_INTEGER;
  12295. }
  12296. return value === value ? value : 0;
  12297. }
  12298. /**
  12299. * Converts `value` to an integer.
  12300. *
  12301. * **Note:** This method is loosely based on
  12302. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12303. *
  12304. * @static
  12305. * @memberOf _
  12306. * @since 4.0.0
  12307. * @category Lang
  12308. * @param {*} value The value to convert.
  12309. * @returns {number} Returns the converted integer.
  12310. * @example
  12311. *
  12312. * _.toInteger(3.2);
  12313. * // => 3
  12314. *
  12315. * _.toInteger(Number.MIN_VALUE);
  12316. * // => 0
  12317. *
  12318. * _.toInteger(Infinity);
  12319. * // => 1.7976931348623157e+308
  12320. *
  12321. * _.toInteger('3.2');
  12322. * // => 3
  12323. */
  12324. function toInteger(value) {
  12325. var result = toFinite(value),
  12326. remainder = result % 1;
  12327. return result === result ? (remainder ? result - remainder : result) : 0;
  12328. }
  12329. /**
  12330. * Converts `value` to an integer suitable for use as the length of an
  12331. * array-like object.
  12332. *
  12333. * **Note:** This method is based on
  12334. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12335. *
  12336. * @static
  12337. * @memberOf _
  12338. * @since 4.0.0
  12339. * @category Lang
  12340. * @param {*} value The value to convert.
  12341. * @returns {number} Returns the converted integer.
  12342. * @example
  12343. *
  12344. * _.toLength(3.2);
  12345. * // => 3
  12346. *
  12347. * _.toLength(Number.MIN_VALUE);
  12348. * // => 0
  12349. *
  12350. * _.toLength(Infinity);
  12351. * // => 4294967295
  12352. *
  12353. * _.toLength('3.2');
  12354. * // => 3
  12355. */
  12356. function toLength(value) {
  12357. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12358. }
  12359. /**
  12360. * Converts `value` to a number.
  12361. *
  12362. * @static
  12363. * @memberOf _
  12364. * @since 4.0.0
  12365. * @category Lang
  12366. * @param {*} value The value to process.
  12367. * @returns {number} Returns the number.
  12368. * @example
  12369. *
  12370. * _.toNumber(3.2);
  12371. * // => 3.2
  12372. *
  12373. * _.toNumber(Number.MIN_VALUE);
  12374. * // => 5e-324
  12375. *
  12376. * _.toNumber(Infinity);
  12377. * // => Infinity
  12378. *
  12379. * _.toNumber('3.2');
  12380. * // => 3.2
  12381. */
  12382. function toNumber(value) {
  12383. if (typeof value == 'number') {
  12384. return value;
  12385. }
  12386. if (isSymbol(value)) {
  12387. return NAN;
  12388. }
  12389. if (isObject(value)) {
  12390. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  12391. value = isObject(other) ? (other + '') : other;
  12392. }
  12393. if (typeof value != 'string') {
  12394. return value === 0 ? value : +value;
  12395. }
  12396. value = value.replace(reTrim, '');
  12397. var isBinary = reIsBinary.test(value);
  12398. return (isBinary || reIsOctal.test(value))
  12399. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  12400. : (reIsBadHex.test(value) ? NAN : +value);
  12401. }
  12402. /**
  12403. * Converts `value` to a plain object flattening inherited enumerable string
  12404. * keyed properties of `value` to own properties of the plain object.
  12405. *
  12406. * @static
  12407. * @memberOf _
  12408. * @since 3.0.0
  12409. * @category Lang
  12410. * @param {*} value The value to convert.
  12411. * @returns {Object} Returns the converted plain object.
  12412. * @example
  12413. *
  12414. * function Foo() {
  12415. * this.b = 2;
  12416. * }
  12417. *
  12418. * Foo.prototype.c = 3;
  12419. *
  12420. * _.assign({ 'a': 1 }, new Foo);
  12421. * // => { 'a': 1, 'b': 2 }
  12422. *
  12423. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  12424. * // => { 'a': 1, 'b': 2, 'c': 3 }
  12425. */
  12426. function toPlainObject(value) {
  12427. return copyObject(value, keysIn(value));
  12428. }
  12429. /**
  12430. * Converts `value` to a safe integer. A safe integer can be compared and
  12431. * represented correctly.
  12432. *
  12433. * @static
  12434. * @memberOf _
  12435. * @since 4.0.0
  12436. * @category Lang
  12437. * @param {*} value The value to convert.
  12438. * @returns {number} Returns the converted integer.
  12439. * @example
  12440. *
  12441. * _.toSafeInteger(3.2);
  12442. * // => 3
  12443. *
  12444. * _.toSafeInteger(Number.MIN_VALUE);
  12445. * // => 0
  12446. *
  12447. * _.toSafeInteger(Infinity);
  12448. * // => 9007199254740991
  12449. *
  12450. * _.toSafeInteger('3.2');
  12451. * // => 3
  12452. */
  12453. function toSafeInteger(value) {
  12454. return value
  12455. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  12456. : (value === 0 ? value : 0);
  12457. }
  12458. /**
  12459. * Converts `value` to a string. An empty string is returned for `null`
  12460. * and `undefined` values. The sign of `-0` is preserved.
  12461. *
  12462. * @static
  12463. * @memberOf _
  12464. * @since 4.0.0
  12465. * @category Lang
  12466. * @param {*} value The value to convert.
  12467. * @returns {string} Returns the converted string.
  12468. * @example
  12469. *
  12470. * _.toString(null);
  12471. * // => ''
  12472. *
  12473. * _.toString(-0);
  12474. * // => '-0'
  12475. *
  12476. * _.toString([1, 2, 3]);
  12477. * // => '1,2,3'
  12478. */
  12479. function toString(value) {
  12480. return value == null ? '' : baseToString(value);
  12481. }
  12482. /*------------------------------------------------------------------------*/
  12483. /**
  12484. * Assigns own enumerable string keyed properties of source objects to the
  12485. * destination object. Source objects are applied from left to right.
  12486. * Subsequent sources overwrite property assignments of previous sources.
  12487. *
  12488. * **Note:** This method mutates `object` and is loosely based on
  12489. * [`Object.assign`](https://mdn.io/Object/assign).
  12490. *
  12491. * @static
  12492. * @memberOf _
  12493. * @since 0.10.0
  12494. * @category Object
  12495. * @param {Object} object The destination object.
  12496. * @param {...Object} [sources] The source objects.
  12497. * @returns {Object} Returns `object`.
  12498. * @see _.assignIn
  12499. * @example
  12500. *
  12501. * function Foo() {
  12502. * this.a = 1;
  12503. * }
  12504. *
  12505. * function Bar() {
  12506. * this.c = 3;
  12507. * }
  12508. *
  12509. * Foo.prototype.b = 2;
  12510. * Bar.prototype.d = 4;
  12511. *
  12512. * _.assign({ 'a': 0 }, new Foo, new Bar);
  12513. * // => { 'a': 1, 'c': 3 }
  12514. */
  12515. var assign = createAssigner(function(object, source) {
  12516. if (isPrototype(source) || isArrayLike(source)) {
  12517. copyObject(source, keys(source), object);
  12518. return;
  12519. }
  12520. for (var key in source) {
  12521. if (hasOwnProperty.call(source, key)) {
  12522. assignValue(object, key, source[key]);
  12523. }
  12524. }
  12525. });
  12526. /**
  12527. * This method is like `_.assign` except that it iterates over own and
  12528. * inherited source properties.
  12529. *
  12530. * **Note:** This method mutates `object`.
  12531. *
  12532. * @static
  12533. * @memberOf _
  12534. * @since 4.0.0
  12535. * @alias extend
  12536. * @category Object
  12537. * @param {Object} object The destination object.
  12538. * @param {...Object} [sources] The source objects.
  12539. * @returns {Object} Returns `object`.
  12540. * @see _.assign
  12541. * @example
  12542. *
  12543. * function Foo() {
  12544. * this.a = 1;
  12545. * }
  12546. *
  12547. * function Bar() {
  12548. * this.c = 3;
  12549. * }
  12550. *
  12551. * Foo.prototype.b = 2;
  12552. * Bar.prototype.d = 4;
  12553. *
  12554. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  12555. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  12556. */
  12557. var assignIn = createAssigner(function(object, source) {
  12558. copyObject(source, keysIn(source), object);
  12559. });
  12560. /**
  12561. * This method is like `_.assignIn` except that it accepts `customizer`
  12562. * which is invoked to produce the assigned values. If `customizer` returns
  12563. * `undefined`, assignment is handled by the method instead. The `customizer`
  12564. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12565. *
  12566. * **Note:** This method mutates `object`.
  12567. *
  12568. * @static
  12569. * @memberOf _
  12570. * @since 4.0.0
  12571. * @alias extendWith
  12572. * @category Object
  12573. * @param {Object} object The destination object.
  12574. * @param {...Object} sources The source objects.
  12575. * @param {Function} [customizer] The function to customize assigned values.
  12576. * @returns {Object} Returns `object`.
  12577. * @see _.assignWith
  12578. * @example
  12579. *
  12580. * function customizer(objValue, srcValue) {
  12581. * return _.isUndefined(objValue) ? srcValue : objValue;
  12582. * }
  12583. *
  12584. * var defaults = _.partialRight(_.assignInWith, customizer);
  12585. *
  12586. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12587. * // => { 'a': 1, 'b': 2 }
  12588. */
  12589. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  12590. copyObject(source, keysIn(source), object, customizer);
  12591. });
  12592. /**
  12593. * This method is like `_.assign` except that it accepts `customizer`
  12594. * which is invoked to produce the assigned values. If `customizer` returns
  12595. * `undefined`, assignment is handled by the method instead. The `customizer`
  12596. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12597. *
  12598. * **Note:** This method mutates `object`.
  12599. *
  12600. * @static
  12601. * @memberOf _
  12602. * @since 4.0.0
  12603. * @category Object
  12604. * @param {Object} object The destination object.
  12605. * @param {...Object} sources The source objects.
  12606. * @param {Function} [customizer] The function to customize assigned values.
  12607. * @returns {Object} Returns `object`.
  12608. * @see _.assignInWith
  12609. * @example
  12610. *
  12611. * function customizer(objValue, srcValue) {
  12612. * return _.isUndefined(objValue) ? srcValue : objValue;
  12613. * }
  12614. *
  12615. * var defaults = _.partialRight(_.assignWith, customizer);
  12616. *
  12617. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12618. * // => { 'a': 1, 'b': 2 }
  12619. */
  12620. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  12621. copyObject(source, keys(source), object, customizer);
  12622. });
  12623. /**
  12624. * Creates an array of values corresponding to `paths` of `object`.
  12625. *
  12626. * @static
  12627. * @memberOf _
  12628. * @since 1.0.0
  12629. * @category Object
  12630. * @param {Object} object The object to iterate over.
  12631. * @param {...(string|string[])} [paths] The property paths to pick.
  12632. * @returns {Array} Returns the picked values.
  12633. * @example
  12634. *
  12635. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  12636. *
  12637. * _.at(object, ['a[0].b.c', 'a[1]']);
  12638. * // => [3, 4]
  12639. */
  12640. var at = flatRest(baseAt);
  12641. /**
  12642. * Creates an object that inherits from the `prototype` object. If a
  12643. * `properties` object is given, its own enumerable string keyed properties
  12644. * are assigned to the created object.
  12645. *
  12646. * @static
  12647. * @memberOf _
  12648. * @since 2.3.0
  12649. * @category Object
  12650. * @param {Object} prototype The object to inherit from.
  12651. * @param {Object} [properties] The properties to assign to the object.
  12652. * @returns {Object} Returns the new object.
  12653. * @example
  12654. *
  12655. * function Shape() {
  12656. * this.x = 0;
  12657. * this.y = 0;
  12658. * }
  12659. *
  12660. * function Circle() {
  12661. * Shape.call(this);
  12662. * }
  12663. *
  12664. * Circle.prototype = _.create(Shape.prototype, {
  12665. * 'constructor': Circle
  12666. * });
  12667. *
  12668. * var circle = new Circle;
  12669. * circle instanceof Circle;
  12670. * // => true
  12671. *
  12672. * circle instanceof Shape;
  12673. * // => true
  12674. */
  12675. function create(prototype, properties) {
  12676. var result = baseCreate(prototype);
  12677. return properties == null ? result : baseAssign(result, properties);
  12678. }
  12679. /**
  12680. * Assigns own and inherited enumerable string keyed properties of source
  12681. * objects to the destination object for all destination properties that
  12682. * resolve to `undefined`. Source objects are applied from left to right.
  12683. * Once a property is set, additional values of the same property are ignored.
  12684. *
  12685. * **Note:** This method mutates `object`.
  12686. *
  12687. * @static
  12688. * @since 0.1.0
  12689. * @memberOf _
  12690. * @category Object
  12691. * @param {Object} object The destination object.
  12692. * @param {...Object} [sources] The source objects.
  12693. * @returns {Object} Returns `object`.
  12694. * @see _.defaultsDeep
  12695. * @example
  12696. *
  12697. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12698. * // => { 'a': 1, 'b': 2 }
  12699. */
  12700. var defaults = baseRest(function(args) {
  12701. args.push(undefined, customDefaultsAssignIn);
  12702. return apply(assignInWith, undefined, args);
  12703. });
  12704. /**
  12705. * This method is like `_.defaults` except that it recursively assigns
  12706. * default properties.
  12707. *
  12708. * **Note:** This method mutates `object`.
  12709. *
  12710. * @static
  12711. * @memberOf _
  12712. * @since 3.10.0
  12713. * @category Object
  12714. * @param {Object} object The destination object.
  12715. * @param {...Object} [sources] The source objects.
  12716. * @returns {Object} Returns `object`.
  12717. * @see _.defaults
  12718. * @example
  12719. *
  12720. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  12721. * // => { 'a': { 'b': 2, 'c': 3 } }
  12722. */
  12723. var defaultsDeep = baseRest(function(args) {
  12724. args.push(undefined, customDefaultsMerge);
  12725. return apply(mergeWith, undefined, args);
  12726. });
  12727. /**
  12728. * This method is like `_.find` except that it returns the key of the first
  12729. * element `predicate` returns truthy for instead of the element itself.
  12730. *
  12731. * @static
  12732. * @memberOf _
  12733. * @since 1.1.0
  12734. * @category Object
  12735. * @param {Object} object The object to inspect.
  12736. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12737. * @returns {string|undefined} Returns the key of the matched element,
  12738. * else `undefined`.
  12739. * @example
  12740. *
  12741. * var users = {
  12742. * 'barney': { 'age': 36, 'active': true },
  12743. * 'fred': { 'age': 40, 'active': false },
  12744. * 'pebbles': { 'age': 1, 'active': true }
  12745. * };
  12746. *
  12747. * _.findKey(users, function(o) { return o.age < 40; });
  12748. * // => 'barney' (iteration order is not guaranteed)
  12749. *
  12750. * // The `_.matches` iteratee shorthand.
  12751. * _.findKey(users, { 'age': 1, 'active': true });
  12752. * // => 'pebbles'
  12753. *
  12754. * // The `_.matchesProperty` iteratee shorthand.
  12755. * _.findKey(users, ['active', false]);
  12756. * // => 'fred'
  12757. *
  12758. * // The `_.property` iteratee shorthand.
  12759. * _.findKey(users, 'active');
  12760. * // => 'barney'
  12761. */
  12762. function findKey(object, predicate) {
  12763. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  12764. }
  12765. /**
  12766. * This method is like `_.findKey` except that it iterates over elements of
  12767. * a collection in the opposite order.
  12768. *
  12769. * @static
  12770. * @memberOf _
  12771. * @since 2.0.0
  12772. * @category Object
  12773. * @param {Object} object The object to inspect.
  12774. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12775. * @returns {string|undefined} Returns the key of the matched element,
  12776. * else `undefined`.
  12777. * @example
  12778. *
  12779. * var users = {
  12780. * 'barney': { 'age': 36, 'active': true },
  12781. * 'fred': { 'age': 40, 'active': false },
  12782. * 'pebbles': { 'age': 1, 'active': true }
  12783. * };
  12784. *
  12785. * _.findLastKey(users, function(o) { return o.age < 40; });
  12786. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  12787. *
  12788. * // The `_.matches` iteratee shorthand.
  12789. * _.findLastKey(users, { 'age': 36, 'active': true });
  12790. * // => 'barney'
  12791. *
  12792. * // The `_.matchesProperty` iteratee shorthand.
  12793. * _.findLastKey(users, ['active', false]);
  12794. * // => 'fred'
  12795. *
  12796. * // The `_.property` iteratee shorthand.
  12797. * _.findLastKey(users, 'active');
  12798. * // => 'pebbles'
  12799. */
  12800. function findLastKey(object, predicate) {
  12801. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  12802. }
  12803. /**
  12804. * Iterates over own and inherited enumerable string keyed properties of an
  12805. * object and invokes `iteratee` for each property. The iteratee is invoked
  12806. * with three arguments: (value, key, object). Iteratee functions may exit
  12807. * iteration early by explicitly returning `false`.
  12808. *
  12809. * @static
  12810. * @memberOf _
  12811. * @since 0.3.0
  12812. * @category Object
  12813. * @param {Object} object The object to iterate over.
  12814. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12815. * @returns {Object} Returns `object`.
  12816. * @see _.forInRight
  12817. * @example
  12818. *
  12819. * function Foo() {
  12820. * this.a = 1;
  12821. * this.b = 2;
  12822. * }
  12823. *
  12824. * Foo.prototype.c = 3;
  12825. *
  12826. * _.forIn(new Foo, function(value, key) {
  12827. * console.log(key);
  12828. * });
  12829. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  12830. */
  12831. function forIn(object, iteratee) {
  12832. return object == null
  12833. ? object
  12834. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  12835. }
  12836. /**
  12837. * This method is like `_.forIn` except that it iterates over properties of
  12838. * `object` in the opposite order.
  12839. *
  12840. * @static
  12841. * @memberOf _
  12842. * @since 2.0.0
  12843. * @category Object
  12844. * @param {Object} object The object to iterate over.
  12845. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12846. * @returns {Object} Returns `object`.
  12847. * @see _.forIn
  12848. * @example
  12849. *
  12850. * function Foo() {
  12851. * this.a = 1;
  12852. * this.b = 2;
  12853. * }
  12854. *
  12855. * Foo.prototype.c = 3;
  12856. *
  12857. * _.forInRight(new Foo, function(value, key) {
  12858. * console.log(key);
  12859. * });
  12860. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  12861. */
  12862. function forInRight(object, iteratee) {
  12863. return object == null
  12864. ? object
  12865. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  12866. }
  12867. /**
  12868. * Iterates over own enumerable string keyed properties of an object and
  12869. * invokes `iteratee` for each property. The iteratee is invoked with three
  12870. * arguments: (value, key, object). Iteratee functions may exit iteration
  12871. * early by explicitly returning `false`.
  12872. *
  12873. * @static
  12874. * @memberOf _
  12875. * @since 0.3.0
  12876. * @category Object
  12877. * @param {Object} object The object to iterate over.
  12878. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12879. * @returns {Object} Returns `object`.
  12880. * @see _.forOwnRight
  12881. * @example
  12882. *
  12883. * function Foo() {
  12884. * this.a = 1;
  12885. * this.b = 2;
  12886. * }
  12887. *
  12888. * Foo.prototype.c = 3;
  12889. *
  12890. * _.forOwn(new Foo, function(value, key) {
  12891. * console.log(key);
  12892. * });
  12893. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  12894. */
  12895. function forOwn(object, iteratee) {
  12896. return object && baseForOwn(object, getIteratee(iteratee, 3));
  12897. }
  12898. /**
  12899. * This method is like `_.forOwn` except that it iterates over properties of
  12900. * `object` in the opposite order.
  12901. *
  12902. * @static
  12903. * @memberOf _
  12904. * @since 2.0.0
  12905. * @category Object
  12906. * @param {Object} object The object to iterate over.
  12907. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12908. * @returns {Object} Returns `object`.
  12909. * @see _.forOwn
  12910. * @example
  12911. *
  12912. * function Foo() {
  12913. * this.a = 1;
  12914. * this.b = 2;
  12915. * }
  12916. *
  12917. * Foo.prototype.c = 3;
  12918. *
  12919. * _.forOwnRight(new Foo, function(value, key) {
  12920. * console.log(key);
  12921. * });
  12922. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  12923. */
  12924. function forOwnRight(object, iteratee) {
  12925. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  12926. }
  12927. /**
  12928. * Creates an array of function property names from own enumerable properties
  12929. * of `object`.
  12930. *
  12931. * @static
  12932. * @since 0.1.0
  12933. * @memberOf _
  12934. * @category Object
  12935. * @param {Object} object The object to inspect.
  12936. * @returns {Array} Returns the function names.
  12937. * @see _.functionsIn
  12938. * @example
  12939. *
  12940. * function Foo() {
  12941. * this.a = _.constant('a');
  12942. * this.b = _.constant('b');
  12943. * }
  12944. *
  12945. * Foo.prototype.c = _.constant('c');
  12946. *
  12947. * _.functions(new Foo);
  12948. * // => ['a', 'b']
  12949. */
  12950. function functions(object) {
  12951. return object == null ? [] : baseFunctions(object, keys(object));
  12952. }
  12953. /**
  12954. * Creates an array of function property names from own and inherited
  12955. * enumerable properties of `object`.
  12956. *
  12957. * @static
  12958. * @memberOf _
  12959. * @since 4.0.0
  12960. * @category Object
  12961. * @param {Object} object The object to inspect.
  12962. * @returns {Array} Returns the function names.
  12963. * @see _.functions
  12964. * @example
  12965. *
  12966. * function Foo() {
  12967. * this.a = _.constant('a');
  12968. * this.b = _.constant('b');
  12969. * }
  12970. *
  12971. * Foo.prototype.c = _.constant('c');
  12972. *
  12973. * _.functionsIn(new Foo);
  12974. * // => ['a', 'b', 'c']
  12975. */
  12976. function functionsIn(object) {
  12977. return object == null ? [] : baseFunctions(object, keysIn(object));
  12978. }
  12979. /**
  12980. * Gets the value at `path` of `object`. If the resolved value is
  12981. * `undefined`, the `defaultValue` is returned in its place.
  12982. *
  12983. * @static
  12984. * @memberOf _
  12985. * @since 3.7.0
  12986. * @category Object
  12987. * @param {Object} object The object to query.
  12988. * @param {Array|string} path The path of the property to get.
  12989. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  12990. * @returns {*} Returns the resolved value.
  12991. * @example
  12992. *
  12993. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  12994. *
  12995. * _.get(object, 'a[0].b.c');
  12996. * // => 3
  12997. *
  12998. * _.get(object, ['a', '0', 'b', 'c']);
  12999. * // => 3
  13000. *
  13001. * _.get(object, 'a.b.c', 'default');
  13002. * // => 'default'
  13003. */
  13004. function get(object, path, defaultValue) {
  13005. var result = object == null ? undefined : baseGet(object, path);
  13006. return result === undefined ? defaultValue : result;
  13007. }
  13008. /**
  13009. * Checks if `path` is a direct property of `object`.
  13010. *
  13011. * @static
  13012. * @since 0.1.0
  13013. * @memberOf _
  13014. * @category Object
  13015. * @param {Object} object The object to query.
  13016. * @param {Array|string} path The path to check.
  13017. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13018. * @example
  13019. *
  13020. * var object = { 'a': { 'b': 2 } };
  13021. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13022. *
  13023. * _.has(object, 'a');
  13024. * // => true
  13025. *
  13026. * _.has(object, 'a.b');
  13027. * // => true
  13028. *
  13029. * _.has(object, ['a', 'b']);
  13030. * // => true
  13031. *
  13032. * _.has(other, 'a');
  13033. * // => false
  13034. */
  13035. function has(object, path) {
  13036. return object != null && hasPath(object, path, baseHas);
  13037. }
  13038. /**
  13039. * Checks if `path` is a direct or inherited property of `object`.
  13040. *
  13041. * @static
  13042. * @memberOf _
  13043. * @since 4.0.0
  13044. * @category Object
  13045. * @param {Object} object The object to query.
  13046. * @param {Array|string} path The path to check.
  13047. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13048. * @example
  13049. *
  13050. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13051. *
  13052. * _.hasIn(object, 'a');
  13053. * // => true
  13054. *
  13055. * _.hasIn(object, 'a.b');
  13056. * // => true
  13057. *
  13058. * _.hasIn(object, ['a', 'b']);
  13059. * // => true
  13060. *
  13061. * _.hasIn(object, 'b');
  13062. * // => false
  13063. */
  13064. function hasIn(object, path) {
  13065. return object != null && hasPath(object, path, baseHasIn);
  13066. }
  13067. /**
  13068. * Creates an object composed of the inverted keys and values of `object`.
  13069. * If `object` contains duplicate values, subsequent values overwrite
  13070. * property assignments of previous values.
  13071. *
  13072. * @static
  13073. * @memberOf _
  13074. * @since 0.7.0
  13075. * @category Object
  13076. * @param {Object} object The object to invert.
  13077. * @returns {Object} Returns the new inverted object.
  13078. * @example
  13079. *
  13080. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13081. *
  13082. * _.invert(object);
  13083. * // => { '1': 'c', '2': 'b' }
  13084. */
  13085. var invert = createInverter(function(result, value, key) {
  13086. result[value] = key;
  13087. }, constant(identity));
  13088. /**
  13089. * This method is like `_.invert` except that the inverted object is generated
  13090. * from the results of running each element of `object` thru `iteratee`. The
  13091. * corresponding inverted value of each inverted key is an array of keys
  13092. * responsible for generating the inverted value. The iteratee is invoked
  13093. * with one argument: (value).
  13094. *
  13095. * @static
  13096. * @memberOf _
  13097. * @since 4.1.0
  13098. * @category Object
  13099. * @param {Object} object The object to invert.
  13100. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13101. * @returns {Object} Returns the new inverted object.
  13102. * @example
  13103. *
  13104. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13105. *
  13106. * _.invertBy(object);
  13107. * // => { '1': ['a', 'c'], '2': ['b'] }
  13108. *
  13109. * _.invertBy(object, function(value) {
  13110. * return 'group' + value;
  13111. * });
  13112. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13113. */
  13114. var invertBy = createInverter(function(result, value, key) {
  13115. if (hasOwnProperty.call(result, value)) {
  13116. result[value].push(key);
  13117. } else {
  13118. result[value] = [key];
  13119. }
  13120. }, getIteratee);
  13121. /**
  13122. * Invokes the method at `path` of `object`.
  13123. *
  13124. * @static
  13125. * @memberOf _
  13126. * @since 4.0.0
  13127. * @category Object
  13128. * @param {Object} object The object to query.
  13129. * @param {Array|string} path The path of the method to invoke.
  13130. * @param {...*} [args] The arguments to invoke the method with.
  13131. * @returns {*} Returns the result of the invoked method.
  13132. * @example
  13133. *
  13134. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13135. *
  13136. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13137. * // => [2, 3]
  13138. */
  13139. var invoke = baseRest(baseInvoke);
  13140. /**
  13141. * Creates an array of the own enumerable property names of `object`.
  13142. *
  13143. * **Note:** Non-object values are coerced to objects. See the
  13144. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13145. * for more details.
  13146. *
  13147. * @static
  13148. * @since 0.1.0
  13149. * @memberOf _
  13150. * @category Object
  13151. * @param {Object} object The object to query.
  13152. * @returns {Array} Returns the array of property names.
  13153. * @example
  13154. *
  13155. * function Foo() {
  13156. * this.a = 1;
  13157. * this.b = 2;
  13158. * }
  13159. *
  13160. * Foo.prototype.c = 3;
  13161. *
  13162. * _.keys(new Foo);
  13163. * // => ['a', 'b'] (iteration order is not guaranteed)
  13164. *
  13165. * _.keys('hi');
  13166. * // => ['0', '1']
  13167. */
  13168. function keys(object) {
  13169. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13170. }
  13171. /**
  13172. * Creates an array of the own and inherited enumerable property names of `object`.
  13173. *
  13174. * **Note:** Non-object values are coerced to objects.
  13175. *
  13176. * @static
  13177. * @memberOf _
  13178. * @since 3.0.0
  13179. * @category Object
  13180. * @param {Object} object The object to query.
  13181. * @returns {Array} Returns the array of property names.
  13182. * @example
  13183. *
  13184. * function Foo() {
  13185. * this.a = 1;
  13186. * this.b = 2;
  13187. * }
  13188. *
  13189. * Foo.prototype.c = 3;
  13190. *
  13191. * _.keysIn(new Foo);
  13192. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13193. */
  13194. function keysIn(object) {
  13195. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13196. }
  13197. /**
  13198. * The opposite of `_.mapValues`; this method creates an object with the
  13199. * same values as `object` and keys generated by running each own enumerable
  13200. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13201. * with three arguments: (value, key, object).
  13202. *
  13203. * @static
  13204. * @memberOf _
  13205. * @since 3.8.0
  13206. * @category Object
  13207. * @param {Object} object The object to iterate over.
  13208. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13209. * @returns {Object} Returns the new mapped object.
  13210. * @see _.mapValues
  13211. * @example
  13212. *
  13213. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13214. * return key + value;
  13215. * });
  13216. * // => { 'a1': 1, 'b2': 2 }
  13217. */
  13218. function mapKeys(object, iteratee) {
  13219. var result = {};
  13220. iteratee = getIteratee(iteratee, 3);
  13221. baseForOwn(object, function(value, key, object) {
  13222. baseAssignValue(result, iteratee(value, key, object), value);
  13223. });
  13224. return result;
  13225. }
  13226. /**
  13227. * Creates an object with the same keys as `object` and values generated
  13228. * by running each own enumerable string keyed property of `object` thru
  13229. * `iteratee`. The iteratee is invoked with three arguments:
  13230. * (value, key, object).
  13231. *
  13232. * @static
  13233. * @memberOf _
  13234. * @since 2.4.0
  13235. * @category Object
  13236. * @param {Object} object The object to iterate over.
  13237. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13238. * @returns {Object} Returns the new mapped object.
  13239. * @see _.mapKeys
  13240. * @example
  13241. *
  13242. * var users = {
  13243. * 'fred': { 'user': 'fred', 'age': 40 },
  13244. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13245. * };
  13246. *
  13247. * _.mapValues(users, function(o) { return o.age; });
  13248. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13249. *
  13250. * // The `_.property` iteratee shorthand.
  13251. * _.mapValues(users, 'age');
  13252. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13253. */
  13254. function mapValues(object, iteratee) {
  13255. var result = {};
  13256. iteratee = getIteratee(iteratee, 3);
  13257. baseForOwn(object, function(value, key, object) {
  13258. baseAssignValue(result, key, iteratee(value, key, object));
  13259. });
  13260. return result;
  13261. }
  13262. /**
  13263. * This method is like `_.assign` except that it recursively merges own and
  13264. * inherited enumerable string keyed properties of source objects into the
  13265. * destination object. Source properties that resolve to `undefined` are
  13266. * skipped if a destination value exists. Array and plain object properties
  13267. * are merged recursively. Other objects and value types are overridden by
  13268. * assignment. Source objects are applied from left to right. Subsequent
  13269. * sources overwrite property assignments of previous sources.
  13270. *
  13271. * **Note:** This method mutates `object`.
  13272. *
  13273. * @static
  13274. * @memberOf _
  13275. * @since 0.5.0
  13276. * @category Object
  13277. * @param {Object} object The destination object.
  13278. * @param {...Object} [sources] The source objects.
  13279. * @returns {Object} Returns `object`.
  13280. * @example
  13281. *
  13282. * var object = {
  13283. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13284. * };
  13285. *
  13286. * var other = {
  13287. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13288. * };
  13289. *
  13290. * _.merge(object, other);
  13291. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13292. */
  13293. var merge = createAssigner(function(object, source, srcIndex) {
  13294. baseMerge(object, source, srcIndex);
  13295. });
  13296. /**
  13297. * This method is like `_.merge` except that it accepts `customizer` which
  13298. * is invoked to produce the merged values of the destination and source
  13299. * properties. If `customizer` returns `undefined`, merging is handled by the
  13300. * method instead. The `customizer` is invoked with six arguments:
  13301. * (objValue, srcValue, key, object, source, stack).
  13302. *
  13303. * **Note:** This method mutates `object`.
  13304. *
  13305. * @static
  13306. * @memberOf _
  13307. * @since 4.0.0
  13308. * @category Object
  13309. * @param {Object} object The destination object.
  13310. * @param {...Object} sources The source objects.
  13311. * @param {Function} customizer The function to customize assigned values.
  13312. * @returns {Object} Returns `object`.
  13313. * @example
  13314. *
  13315. * function customizer(objValue, srcValue) {
  13316. * if (_.isArray(objValue)) {
  13317. * return objValue.concat(srcValue);
  13318. * }
  13319. * }
  13320. *
  13321. * var object = { 'a': [1], 'b': [2] };
  13322. * var other = { 'a': [3], 'b': [4] };
  13323. *
  13324. * _.mergeWith(object, other, customizer);
  13325. * // => { 'a': [1, 3], 'b': [2, 4] }
  13326. */
  13327. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13328. baseMerge(object, source, srcIndex, customizer);
  13329. });
  13330. /**
  13331. * The opposite of `_.pick`; this method creates an object composed of the
  13332. * own and inherited enumerable property paths of `object` that are not omitted.
  13333. *
  13334. * **Note:** This method is considerably slower than `_.pick`.
  13335. *
  13336. * @static
  13337. * @since 0.1.0
  13338. * @memberOf _
  13339. * @category Object
  13340. * @param {Object} object The source object.
  13341. * @param {...(string|string[])} [paths] The property paths to omit.
  13342. * @returns {Object} Returns the new object.
  13343. * @example
  13344. *
  13345. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13346. *
  13347. * _.omit(object, ['a', 'c']);
  13348. * // => { 'b': '2' }
  13349. */
  13350. var omit = flatRest(function(object, paths) {
  13351. var result = {};
  13352. if (object == null) {
  13353. return result;
  13354. }
  13355. var isDeep = false;
  13356. paths = arrayMap(paths, function(path) {
  13357. path = castPath(path, object);
  13358. isDeep || (isDeep = path.length > 1);
  13359. return path;
  13360. });
  13361. copyObject(object, getAllKeysIn(object), result);
  13362. if (isDeep) {
  13363. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  13364. }
  13365. var length = paths.length;
  13366. while (length--) {
  13367. baseUnset(result, paths[length]);
  13368. }
  13369. return result;
  13370. });
  13371. /**
  13372. * The opposite of `_.pickBy`; this method creates an object composed of
  13373. * the own and inherited enumerable string keyed properties of `object` that
  13374. * `predicate` doesn't return truthy for. The predicate is invoked with two
  13375. * arguments: (value, key).
  13376. *
  13377. * @static
  13378. * @memberOf _
  13379. * @since 4.0.0
  13380. * @category Object
  13381. * @param {Object} object The source object.
  13382. * @param {Function} [predicate=_.identity] The function invoked per property.
  13383. * @returns {Object} Returns the new object.
  13384. * @example
  13385. *
  13386. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13387. *
  13388. * _.omitBy(object, _.isNumber);
  13389. * // => { 'b': '2' }
  13390. */
  13391. function omitBy(object, predicate) {
  13392. return pickBy(object, negate(getIteratee(predicate)));
  13393. }
  13394. /**
  13395. * Creates an object composed of the picked `object` properties.
  13396. *
  13397. * @static
  13398. * @since 0.1.0
  13399. * @memberOf _
  13400. * @category Object
  13401. * @param {Object} object The source object.
  13402. * @param {...(string|string[])} [paths] The property paths to pick.
  13403. * @returns {Object} Returns the new object.
  13404. * @example
  13405. *
  13406. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13407. *
  13408. * _.pick(object, ['a', 'c']);
  13409. * // => { 'a': 1, 'c': 3 }
  13410. */
  13411. var pick = flatRest(function(object, paths) {
  13412. return object == null ? {} : basePick(object, paths);
  13413. });
  13414. /**
  13415. * Creates an object composed of the `object` properties `predicate` returns
  13416. * truthy for. The predicate is invoked with two arguments: (value, key).
  13417. *
  13418. * @static
  13419. * @memberOf _
  13420. * @since 4.0.0
  13421. * @category Object
  13422. * @param {Object} object The source object.
  13423. * @param {Function} [predicate=_.identity] The function invoked per property.
  13424. * @returns {Object} Returns the new object.
  13425. * @example
  13426. *
  13427. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13428. *
  13429. * _.pickBy(object, _.isNumber);
  13430. * // => { 'a': 1, 'c': 3 }
  13431. */
  13432. function pickBy(object, predicate) {
  13433. if (object == null) {
  13434. return {};
  13435. }
  13436. var props = arrayMap(getAllKeysIn(object), function(prop) {
  13437. return [prop];
  13438. });
  13439. predicate = getIteratee(predicate);
  13440. return basePickBy(object, props, function(value, path) {
  13441. return predicate(value, path[0]);
  13442. });
  13443. }
  13444. /**
  13445. * This method is like `_.get` except that if the resolved value is a
  13446. * function it's invoked with the `this` binding of its parent object and
  13447. * its result is returned.
  13448. *
  13449. * @static
  13450. * @since 0.1.0
  13451. * @memberOf _
  13452. * @category Object
  13453. * @param {Object} object The object to query.
  13454. * @param {Array|string} path The path of the property to resolve.
  13455. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13456. * @returns {*} Returns the resolved value.
  13457. * @example
  13458. *
  13459. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  13460. *
  13461. * _.result(object, 'a[0].b.c1');
  13462. * // => 3
  13463. *
  13464. * _.result(object, 'a[0].b.c2');
  13465. * // => 4
  13466. *
  13467. * _.result(object, 'a[0].b.c3', 'default');
  13468. * // => 'default'
  13469. *
  13470. * _.result(object, 'a[0].b.c3', _.constant('default'));
  13471. * // => 'default'
  13472. */
  13473. function result(object, path, defaultValue) {
  13474. path = castPath(path, object);
  13475. var index = -1,
  13476. length = path.length;
  13477. // Ensure the loop is entered when path is empty.
  13478. if (!length) {
  13479. length = 1;
  13480. object = undefined;
  13481. }
  13482. while (++index < length) {
  13483. var value = object == null ? undefined : object[toKey(path[index])];
  13484. if (value === undefined) {
  13485. index = length;
  13486. value = defaultValue;
  13487. }
  13488. object = isFunction(value) ? value.call(object) : value;
  13489. }
  13490. return object;
  13491. }
  13492. /**
  13493. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  13494. * it's created. Arrays are created for missing index properties while objects
  13495. * are created for all other missing properties. Use `_.setWith` to customize
  13496. * `path` creation.
  13497. *
  13498. * **Note:** This method mutates `object`.
  13499. *
  13500. * @static
  13501. * @memberOf _
  13502. * @since 3.7.0
  13503. * @category Object
  13504. * @param {Object} object The object to modify.
  13505. * @param {Array|string} path The path of the property to set.
  13506. * @param {*} value The value to set.
  13507. * @returns {Object} Returns `object`.
  13508. * @example
  13509. *
  13510. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13511. *
  13512. * _.set(object, 'a[0].b.c', 4);
  13513. * console.log(object.a[0].b.c);
  13514. * // => 4
  13515. *
  13516. * _.set(object, ['x', '0', 'y', 'z'], 5);
  13517. * console.log(object.x[0].y.z);
  13518. * // => 5
  13519. */
  13520. function set(object, path, value) {
  13521. return object == null ? object : baseSet(object, path, value);
  13522. }
  13523. /**
  13524. * This method is like `_.set` except that it accepts `customizer` which is
  13525. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13526. * path creation is handled by the method instead. The `customizer` is invoked
  13527. * with three arguments: (nsValue, key, nsObject).
  13528. *
  13529. * **Note:** This method mutates `object`.
  13530. *
  13531. * @static
  13532. * @memberOf _
  13533. * @since 4.0.0
  13534. * @category Object
  13535. * @param {Object} object The object to modify.
  13536. * @param {Array|string} path The path of the property to set.
  13537. * @param {*} value The value to set.
  13538. * @param {Function} [customizer] The function to customize assigned values.
  13539. * @returns {Object} Returns `object`.
  13540. * @example
  13541. *
  13542. * var object = {};
  13543. *
  13544. * _.setWith(object, '[0][1]', 'a', Object);
  13545. * // => { '0': { '1': 'a' } }
  13546. */
  13547. function setWith(object, path, value, customizer) {
  13548. customizer = typeof customizer == 'function' ? customizer : undefined;
  13549. return object == null ? object : baseSet(object, path, value, customizer);
  13550. }
  13551. /**
  13552. * Creates an array of own enumerable string keyed-value pairs for `object`
  13553. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  13554. * entries are returned.
  13555. *
  13556. * @static
  13557. * @memberOf _
  13558. * @since 4.0.0
  13559. * @alias entries
  13560. * @category Object
  13561. * @param {Object} object The object to query.
  13562. * @returns {Array} Returns the key-value pairs.
  13563. * @example
  13564. *
  13565. * function Foo() {
  13566. * this.a = 1;
  13567. * this.b = 2;
  13568. * }
  13569. *
  13570. * Foo.prototype.c = 3;
  13571. *
  13572. * _.toPairs(new Foo);
  13573. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  13574. */
  13575. var toPairs = createToPairs(keys);
  13576. /**
  13577. * Creates an array of own and inherited enumerable string keyed-value pairs
  13578. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  13579. * or set, its entries are returned.
  13580. *
  13581. * @static
  13582. * @memberOf _
  13583. * @since 4.0.0
  13584. * @alias entriesIn
  13585. * @category Object
  13586. * @param {Object} object The object to query.
  13587. * @returns {Array} Returns the key-value pairs.
  13588. * @example
  13589. *
  13590. * function Foo() {
  13591. * this.a = 1;
  13592. * this.b = 2;
  13593. * }
  13594. *
  13595. * Foo.prototype.c = 3;
  13596. *
  13597. * _.toPairsIn(new Foo);
  13598. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  13599. */
  13600. var toPairsIn = createToPairs(keysIn);
  13601. /**
  13602. * An alternative to `_.reduce`; this method transforms `object` to a new
  13603. * `accumulator` object which is the result of running each of its own
  13604. * enumerable string keyed properties thru `iteratee`, with each invocation
  13605. * potentially mutating the `accumulator` object. If `accumulator` is not
  13606. * provided, a new object with the same `[[Prototype]]` will be used. The
  13607. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  13608. * Iteratee functions may exit iteration early by explicitly returning `false`.
  13609. *
  13610. * @static
  13611. * @memberOf _
  13612. * @since 1.3.0
  13613. * @category Object
  13614. * @param {Object} object The object to iterate over.
  13615. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13616. * @param {*} [accumulator] The custom accumulator value.
  13617. * @returns {*} Returns the accumulated value.
  13618. * @example
  13619. *
  13620. * _.transform([2, 3, 4], function(result, n) {
  13621. * result.push(n *= n);
  13622. * return n % 2 == 0;
  13623. * }, []);
  13624. * // => [4, 9]
  13625. *
  13626. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  13627. * (result[value] || (result[value] = [])).push(key);
  13628. * }, {});
  13629. * // => { '1': ['a', 'c'], '2': ['b'] }
  13630. */
  13631. function transform(object, iteratee, accumulator) {
  13632. var isArr = isArray(object),
  13633. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  13634. iteratee = getIteratee(iteratee, 4);
  13635. if (accumulator == null) {
  13636. var Ctor = object && object.constructor;
  13637. if (isArrLike) {
  13638. accumulator = isArr ? new Ctor : [];
  13639. }
  13640. else if (isObject(object)) {
  13641. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  13642. }
  13643. else {
  13644. accumulator = {};
  13645. }
  13646. }
  13647. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  13648. return iteratee(accumulator, value, index, object);
  13649. });
  13650. return accumulator;
  13651. }
  13652. /**
  13653. * Removes the property at `path` of `object`.
  13654. *
  13655. * **Note:** This method mutates `object`.
  13656. *
  13657. * @static
  13658. * @memberOf _
  13659. * @since 4.0.0
  13660. * @category Object
  13661. * @param {Object} object The object to modify.
  13662. * @param {Array|string} path The path of the property to unset.
  13663. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  13664. * @example
  13665. *
  13666. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  13667. * _.unset(object, 'a[0].b.c');
  13668. * // => true
  13669. *
  13670. * console.log(object);
  13671. * // => { 'a': [{ 'b': {} }] };
  13672. *
  13673. * _.unset(object, ['a', '0', 'b', 'c']);
  13674. * // => true
  13675. *
  13676. * console.log(object);
  13677. * // => { 'a': [{ 'b': {} }] };
  13678. */
  13679. function unset(object, path) {
  13680. return object == null ? true : baseUnset(object, path);
  13681. }
  13682. /**
  13683. * This method is like `_.set` except that accepts `updater` to produce the
  13684. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  13685. * is invoked with one argument: (value).
  13686. *
  13687. * **Note:** This method mutates `object`.
  13688. *
  13689. * @static
  13690. * @memberOf _
  13691. * @since 4.6.0
  13692. * @category Object
  13693. * @param {Object} object The object to modify.
  13694. * @param {Array|string} path The path of the property to set.
  13695. * @param {Function} updater The function to produce the updated value.
  13696. * @returns {Object} Returns `object`.
  13697. * @example
  13698. *
  13699. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13700. *
  13701. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  13702. * console.log(object.a[0].b.c);
  13703. * // => 9
  13704. *
  13705. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  13706. * console.log(object.x[0].y.z);
  13707. * // => 0
  13708. */
  13709. function update(object, path, updater) {
  13710. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  13711. }
  13712. /**
  13713. * This method is like `_.update` except that it accepts `customizer` which is
  13714. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13715. * path creation is handled by the method instead. The `customizer` is invoked
  13716. * with three arguments: (nsValue, key, nsObject).
  13717. *
  13718. * **Note:** This method mutates `object`.
  13719. *
  13720. * @static
  13721. * @memberOf _
  13722. * @since 4.6.0
  13723. * @category Object
  13724. * @param {Object} object The object to modify.
  13725. * @param {Array|string} path The path of the property to set.
  13726. * @param {Function} updater The function to produce the updated value.
  13727. * @param {Function} [customizer] The function to customize assigned values.
  13728. * @returns {Object} Returns `object`.
  13729. * @example
  13730. *
  13731. * var object = {};
  13732. *
  13733. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  13734. * // => { '0': { '1': 'a' } }
  13735. */
  13736. function updateWith(object, path, updater, customizer) {
  13737. customizer = typeof customizer == 'function' ? customizer : undefined;
  13738. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  13739. }
  13740. /**
  13741. * Creates an array of the own enumerable string keyed property values of `object`.
  13742. *
  13743. * **Note:** Non-object values are coerced to objects.
  13744. *
  13745. * @static
  13746. * @since 0.1.0
  13747. * @memberOf _
  13748. * @category Object
  13749. * @param {Object} object The object to query.
  13750. * @returns {Array} Returns the array of property values.
  13751. * @example
  13752. *
  13753. * function Foo() {
  13754. * this.a = 1;
  13755. * this.b = 2;
  13756. * }
  13757. *
  13758. * Foo.prototype.c = 3;
  13759. *
  13760. * _.values(new Foo);
  13761. * // => [1, 2] (iteration order is not guaranteed)
  13762. *
  13763. * _.values('hi');
  13764. * // => ['h', 'i']
  13765. */
  13766. function values(object) {
  13767. return object == null ? [] : baseValues(object, keys(object));
  13768. }
  13769. /**
  13770. * Creates an array of the own and inherited enumerable string keyed property
  13771. * values of `object`.
  13772. *
  13773. * **Note:** Non-object values are coerced to objects.
  13774. *
  13775. * @static
  13776. * @memberOf _
  13777. * @since 3.0.0
  13778. * @category Object
  13779. * @param {Object} object The object to query.
  13780. * @returns {Array} Returns the array of property values.
  13781. * @example
  13782. *
  13783. * function Foo() {
  13784. * this.a = 1;
  13785. * this.b = 2;
  13786. * }
  13787. *
  13788. * Foo.prototype.c = 3;
  13789. *
  13790. * _.valuesIn(new Foo);
  13791. * // => [1, 2, 3] (iteration order is not guaranteed)
  13792. */
  13793. function valuesIn(object) {
  13794. return object == null ? [] : baseValues(object, keysIn(object));
  13795. }
  13796. /*------------------------------------------------------------------------*/
  13797. /**
  13798. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  13799. *
  13800. * @static
  13801. * @memberOf _
  13802. * @since 4.0.0
  13803. * @category Number
  13804. * @param {number} number The number to clamp.
  13805. * @param {number} [lower] The lower bound.
  13806. * @param {number} upper The upper bound.
  13807. * @returns {number} Returns the clamped number.
  13808. * @example
  13809. *
  13810. * _.clamp(-10, -5, 5);
  13811. * // => -5
  13812. *
  13813. * _.clamp(10, -5, 5);
  13814. * // => 5
  13815. */
  13816. function clamp(number, lower, upper) {
  13817. if (upper === undefined) {
  13818. upper = lower;
  13819. lower = undefined;
  13820. }
  13821. if (upper !== undefined) {
  13822. upper = toNumber(upper);
  13823. upper = upper === upper ? upper : 0;
  13824. }
  13825. if (lower !== undefined) {
  13826. lower = toNumber(lower);
  13827. lower = lower === lower ? lower : 0;
  13828. }
  13829. return baseClamp(toNumber(number), lower, upper);
  13830. }
  13831. /**
  13832. * Checks if `n` is between `start` and up to, but not including, `end`. If
  13833. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  13834. * If `start` is greater than `end` the params are swapped to support
  13835. * negative ranges.
  13836. *
  13837. * @static
  13838. * @memberOf _
  13839. * @since 3.3.0
  13840. * @category Number
  13841. * @param {number} number The number to check.
  13842. * @param {number} [start=0] The start of the range.
  13843. * @param {number} end The end of the range.
  13844. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  13845. * @see _.range, _.rangeRight
  13846. * @example
  13847. *
  13848. * _.inRange(3, 2, 4);
  13849. * // => true
  13850. *
  13851. * _.inRange(4, 8);
  13852. * // => true
  13853. *
  13854. * _.inRange(4, 2);
  13855. * // => false
  13856. *
  13857. * _.inRange(2, 2);
  13858. * // => false
  13859. *
  13860. * _.inRange(1.2, 2);
  13861. * // => true
  13862. *
  13863. * _.inRange(5.2, 4);
  13864. * // => false
  13865. *
  13866. * _.inRange(-3, -2, -6);
  13867. * // => true
  13868. */
  13869. function inRange(number, start, end) {
  13870. start = toFinite(start);
  13871. if (end === undefined) {
  13872. end = start;
  13873. start = 0;
  13874. } else {
  13875. end = toFinite(end);
  13876. }
  13877. number = toNumber(number);
  13878. return baseInRange(number, start, end);
  13879. }
  13880. /**
  13881. * Produces a random number between the inclusive `lower` and `upper` bounds.
  13882. * If only one argument is provided a number between `0` and the given number
  13883. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  13884. * floats, a floating-point number is returned instead of an integer.
  13885. *
  13886. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  13887. * floating-point values which can produce unexpected results.
  13888. *
  13889. * @static
  13890. * @memberOf _
  13891. * @since 0.7.0
  13892. * @category Number
  13893. * @param {number} [lower=0] The lower bound.
  13894. * @param {number} [upper=1] The upper bound.
  13895. * @param {boolean} [floating] Specify returning a floating-point number.
  13896. * @returns {number} Returns the random number.
  13897. * @example
  13898. *
  13899. * _.random(0, 5);
  13900. * // => an integer between 0 and 5
  13901. *
  13902. * _.random(5);
  13903. * // => also an integer between 0 and 5
  13904. *
  13905. * _.random(5, true);
  13906. * // => a floating-point number between 0 and 5
  13907. *
  13908. * _.random(1.2, 5.2);
  13909. * // => a floating-point number between 1.2 and 5.2
  13910. */
  13911. function random(lower, upper, floating) {
  13912. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  13913. upper = floating = undefined;
  13914. }
  13915. if (floating === undefined) {
  13916. if (typeof upper == 'boolean') {
  13917. floating = upper;
  13918. upper = undefined;
  13919. }
  13920. else if (typeof lower == 'boolean') {
  13921. floating = lower;
  13922. lower = undefined;
  13923. }
  13924. }
  13925. if (lower === undefined && upper === undefined) {
  13926. lower = 0;
  13927. upper = 1;
  13928. }
  13929. else {
  13930. lower = toFinite(lower);
  13931. if (upper === undefined) {
  13932. upper = lower;
  13933. lower = 0;
  13934. } else {
  13935. upper = toFinite(upper);
  13936. }
  13937. }
  13938. if (lower > upper) {
  13939. var temp = lower;
  13940. lower = upper;
  13941. upper = temp;
  13942. }
  13943. if (floating || lower % 1 || upper % 1) {
  13944. var rand = nativeRandom();
  13945. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  13946. }
  13947. return baseRandom(lower, upper);
  13948. }
  13949. /*------------------------------------------------------------------------*/
  13950. /**
  13951. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  13952. *
  13953. * @static
  13954. * @memberOf _
  13955. * @since 3.0.0
  13956. * @category String
  13957. * @param {string} [string=''] The string to convert.
  13958. * @returns {string} Returns the camel cased string.
  13959. * @example
  13960. *
  13961. * _.camelCase('Foo Bar');
  13962. * // => 'fooBar'
  13963. *
  13964. * _.camelCase('--foo-bar--');
  13965. * // => 'fooBar'
  13966. *
  13967. * _.camelCase('__FOO_BAR__');
  13968. * // => 'fooBar'
  13969. */
  13970. var camelCase = createCompounder(function(result, word, index) {
  13971. word = word.toLowerCase();
  13972. return result + (index ? capitalize(word) : word);
  13973. });
  13974. /**
  13975. * Converts the first character of `string` to upper case and the remaining
  13976. * to lower case.
  13977. *
  13978. * @static
  13979. * @memberOf _
  13980. * @since 3.0.0
  13981. * @category String
  13982. * @param {string} [string=''] The string to capitalize.
  13983. * @returns {string} Returns the capitalized string.
  13984. * @example
  13985. *
  13986. * _.capitalize('FRED');
  13987. * // => 'Fred'
  13988. */
  13989. function capitalize(string) {
  13990. return upperFirst(toString(string).toLowerCase());
  13991. }
  13992. /**
  13993. * Deburrs `string` by converting
  13994. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  13995. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  13996. * letters to basic Latin letters and removing
  13997. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  13998. *
  13999. * @static
  14000. * @memberOf _
  14001. * @since 3.0.0
  14002. * @category String
  14003. * @param {string} [string=''] The string to deburr.
  14004. * @returns {string} Returns the deburred string.
  14005. * @example
  14006. *
  14007. * _.deburr('déjà vu');
  14008. * // => 'deja vu'
  14009. */
  14010. function deburr(string) {
  14011. string = toString(string);
  14012. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14013. }
  14014. /**
  14015. * Checks if `string` ends with the given target string.
  14016. *
  14017. * @static
  14018. * @memberOf _
  14019. * @since 3.0.0
  14020. * @category String
  14021. * @param {string} [string=''] The string to inspect.
  14022. * @param {string} [target] The string to search for.
  14023. * @param {number} [position=string.length] The position to search up to.
  14024. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14025. * else `false`.
  14026. * @example
  14027. *
  14028. * _.endsWith('abc', 'c');
  14029. * // => true
  14030. *
  14031. * _.endsWith('abc', 'b');
  14032. * // => false
  14033. *
  14034. * _.endsWith('abc', 'b', 2);
  14035. * // => true
  14036. */
  14037. function endsWith(string, target, position) {
  14038. string = toString(string);
  14039. target = baseToString(target);
  14040. var length = string.length;
  14041. position = position === undefined
  14042. ? length
  14043. : baseClamp(toInteger(position), 0, length);
  14044. var end = position;
  14045. position -= target.length;
  14046. return position >= 0 && string.slice(position, end) == target;
  14047. }
  14048. /**
  14049. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14050. * corresponding HTML entities.
  14051. *
  14052. * **Note:** No other characters are escaped. To escape additional
  14053. * characters use a third-party library like [_he_](https://mths.be/he).
  14054. *
  14055. * Though the ">" character is escaped for symmetry, characters like
  14056. * ">" and "/" don't need escaping in HTML and have no special meaning
  14057. * unless they're part of a tag or unquoted attribute value. See
  14058. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14059. * (under "semi-related fun fact") for more details.
  14060. *
  14061. * When working with HTML you should always
  14062. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14063. * XSS vectors.
  14064. *
  14065. * @static
  14066. * @since 0.1.0
  14067. * @memberOf _
  14068. * @category String
  14069. * @param {string} [string=''] The string to escape.
  14070. * @returns {string} Returns the escaped string.
  14071. * @example
  14072. *
  14073. * _.escape('fred, barney, & pebbles');
  14074. * // => 'fred, barney, &amp; pebbles'
  14075. */
  14076. function escape(string) {
  14077. string = toString(string);
  14078. return (string && reHasUnescapedHtml.test(string))
  14079. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14080. : string;
  14081. }
  14082. /**
  14083. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14084. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14085. *
  14086. * @static
  14087. * @memberOf _
  14088. * @since 3.0.0
  14089. * @category String
  14090. * @param {string} [string=''] The string to escape.
  14091. * @returns {string} Returns the escaped string.
  14092. * @example
  14093. *
  14094. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14095. * // => '\[lodash\]\(https://lodash\.com/\)'
  14096. */
  14097. function escapeRegExp(string) {
  14098. string = toString(string);
  14099. return (string && reHasRegExpChar.test(string))
  14100. ? string.replace(reRegExpChar, '\\$&')
  14101. : string;
  14102. }
  14103. /**
  14104. * Converts `string` to
  14105. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14106. *
  14107. * @static
  14108. * @memberOf _
  14109. * @since 3.0.0
  14110. * @category String
  14111. * @param {string} [string=''] The string to convert.
  14112. * @returns {string} Returns the kebab cased string.
  14113. * @example
  14114. *
  14115. * _.kebabCase('Foo Bar');
  14116. * // => 'foo-bar'
  14117. *
  14118. * _.kebabCase('fooBar');
  14119. * // => 'foo-bar'
  14120. *
  14121. * _.kebabCase('__FOO_BAR__');
  14122. * // => 'foo-bar'
  14123. */
  14124. var kebabCase = createCompounder(function(result, word, index) {
  14125. return result + (index ? '-' : '') + word.toLowerCase();
  14126. });
  14127. /**
  14128. * Converts `string`, as space separated words, to lower case.
  14129. *
  14130. * @static
  14131. * @memberOf _
  14132. * @since 4.0.0
  14133. * @category String
  14134. * @param {string} [string=''] The string to convert.
  14135. * @returns {string} Returns the lower cased string.
  14136. * @example
  14137. *
  14138. * _.lowerCase('--Foo-Bar--');
  14139. * // => 'foo bar'
  14140. *
  14141. * _.lowerCase('fooBar');
  14142. * // => 'foo bar'
  14143. *
  14144. * _.lowerCase('__FOO_BAR__');
  14145. * // => 'foo bar'
  14146. */
  14147. var lowerCase = createCompounder(function(result, word, index) {
  14148. return result + (index ? ' ' : '') + word.toLowerCase();
  14149. });
  14150. /**
  14151. * Converts the first character of `string` to lower case.
  14152. *
  14153. * @static
  14154. * @memberOf _
  14155. * @since 4.0.0
  14156. * @category String
  14157. * @param {string} [string=''] The string to convert.
  14158. * @returns {string} Returns the converted string.
  14159. * @example
  14160. *
  14161. * _.lowerFirst('Fred');
  14162. * // => 'fred'
  14163. *
  14164. * _.lowerFirst('FRED');
  14165. * // => 'fRED'
  14166. */
  14167. var lowerFirst = createCaseFirst('toLowerCase');
  14168. /**
  14169. * Pads `string` on the left and right sides if it's shorter than `length`.
  14170. * Padding characters are truncated if they can't be evenly divided by `length`.
  14171. *
  14172. * @static
  14173. * @memberOf _
  14174. * @since 3.0.0
  14175. * @category String
  14176. * @param {string} [string=''] The string to pad.
  14177. * @param {number} [length=0] The padding length.
  14178. * @param {string} [chars=' '] The string used as padding.
  14179. * @returns {string} Returns the padded string.
  14180. * @example
  14181. *
  14182. * _.pad('abc', 8);
  14183. * // => ' abc '
  14184. *
  14185. * _.pad('abc', 8, '_-');
  14186. * // => '_-abc_-_'
  14187. *
  14188. * _.pad('abc', 3);
  14189. * // => 'abc'
  14190. */
  14191. function pad(string, length, chars) {
  14192. string = toString(string);
  14193. length = toInteger(length);
  14194. var strLength = length ? stringSize(string) : 0;
  14195. if (!length || strLength >= length) {
  14196. return string;
  14197. }
  14198. var mid = (length - strLength) / 2;
  14199. return (
  14200. createPadding(nativeFloor(mid), chars) +
  14201. string +
  14202. createPadding(nativeCeil(mid), chars)
  14203. );
  14204. }
  14205. /**
  14206. * Pads `string` on the right side if it's shorter than `length`. Padding
  14207. * characters are truncated if they exceed `length`.
  14208. *
  14209. * @static
  14210. * @memberOf _
  14211. * @since 4.0.0
  14212. * @category String
  14213. * @param {string} [string=''] The string to pad.
  14214. * @param {number} [length=0] The padding length.
  14215. * @param {string} [chars=' '] The string used as padding.
  14216. * @returns {string} Returns the padded string.
  14217. * @example
  14218. *
  14219. * _.padEnd('abc', 6);
  14220. * // => 'abc '
  14221. *
  14222. * _.padEnd('abc', 6, '_-');
  14223. * // => 'abc_-_'
  14224. *
  14225. * _.padEnd('abc', 3);
  14226. * // => 'abc'
  14227. */
  14228. function padEnd(string, length, chars) {
  14229. string = toString(string);
  14230. length = toInteger(length);
  14231. var strLength = length ? stringSize(string) : 0;
  14232. return (length && strLength < length)
  14233. ? (string + createPadding(length - strLength, chars))
  14234. : string;
  14235. }
  14236. /**
  14237. * Pads `string` on the left side if it's shorter than `length`. Padding
  14238. * characters are truncated if they exceed `length`.
  14239. *
  14240. * @static
  14241. * @memberOf _
  14242. * @since 4.0.0
  14243. * @category String
  14244. * @param {string} [string=''] The string to pad.
  14245. * @param {number} [length=0] The padding length.
  14246. * @param {string} [chars=' '] The string used as padding.
  14247. * @returns {string} Returns the padded string.
  14248. * @example
  14249. *
  14250. * _.padStart('abc', 6);
  14251. * // => ' abc'
  14252. *
  14253. * _.padStart('abc', 6, '_-');
  14254. * // => '_-_abc'
  14255. *
  14256. * _.padStart('abc', 3);
  14257. * // => 'abc'
  14258. */
  14259. function padStart(string, length, chars) {
  14260. string = toString(string);
  14261. length = toInteger(length);
  14262. var strLength = length ? stringSize(string) : 0;
  14263. return (length && strLength < length)
  14264. ? (createPadding(length - strLength, chars) + string)
  14265. : string;
  14266. }
  14267. /**
  14268. * Converts `string` to an integer of the specified radix. If `radix` is
  14269. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14270. * hexadecimal, in which case a `radix` of `16` is used.
  14271. *
  14272. * **Note:** This method aligns with the
  14273. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14274. *
  14275. * @static
  14276. * @memberOf _
  14277. * @since 1.1.0
  14278. * @category String
  14279. * @param {string} string The string to convert.
  14280. * @param {number} [radix=10] The radix to interpret `value` by.
  14281. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14282. * @returns {number} Returns the converted integer.
  14283. * @example
  14284. *
  14285. * _.parseInt('08');
  14286. * // => 8
  14287. *
  14288. * _.map(['6', '08', '10'], _.parseInt);
  14289. * // => [6, 8, 10]
  14290. */
  14291. function parseInt(string, radix, guard) {
  14292. if (guard || radix == null) {
  14293. radix = 0;
  14294. } else if (radix) {
  14295. radix = +radix;
  14296. }
  14297. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14298. }
  14299. /**
  14300. * Repeats the given string `n` times.
  14301. *
  14302. * @static
  14303. * @memberOf _
  14304. * @since 3.0.0
  14305. * @category String
  14306. * @param {string} [string=''] The string to repeat.
  14307. * @param {number} [n=1] The number of times to repeat the string.
  14308. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14309. * @returns {string} Returns the repeated string.
  14310. * @example
  14311. *
  14312. * _.repeat('*', 3);
  14313. * // => '***'
  14314. *
  14315. * _.repeat('abc', 2);
  14316. * // => 'abcabc'
  14317. *
  14318. * _.repeat('abc', 0);
  14319. * // => ''
  14320. */
  14321. function repeat(string, n, guard) {
  14322. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14323. n = 1;
  14324. } else {
  14325. n = toInteger(n);
  14326. }
  14327. return baseRepeat(toString(string), n);
  14328. }
  14329. /**
  14330. * Replaces matches for `pattern` in `string` with `replacement`.
  14331. *
  14332. * **Note:** This method is based on
  14333. * [`String#replace`](https://mdn.io/String/replace).
  14334. *
  14335. * @static
  14336. * @memberOf _
  14337. * @since 4.0.0
  14338. * @category String
  14339. * @param {string} [string=''] The string to modify.
  14340. * @param {RegExp|string} pattern The pattern to replace.
  14341. * @param {Function|string} replacement The match replacement.
  14342. * @returns {string} Returns the modified string.
  14343. * @example
  14344. *
  14345. * _.replace('Hi Fred', 'Fred', 'Barney');
  14346. * // => 'Hi Barney'
  14347. */
  14348. function replace() {
  14349. var args = arguments,
  14350. string = toString(args[0]);
  14351. return args.length < 3 ? string : string.replace(args[1], args[2]);
  14352. }
  14353. /**
  14354. * Converts `string` to
  14355. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  14356. *
  14357. * @static
  14358. * @memberOf _
  14359. * @since 3.0.0
  14360. * @category String
  14361. * @param {string} [string=''] The string to convert.
  14362. * @returns {string} Returns the snake cased string.
  14363. * @example
  14364. *
  14365. * _.snakeCase('Foo Bar');
  14366. * // => 'foo_bar'
  14367. *
  14368. * _.snakeCase('fooBar');
  14369. * // => 'foo_bar'
  14370. *
  14371. * _.snakeCase('--FOO-BAR--');
  14372. * // => 'foo_bar'
  14373. */
  14374. var snakeCase = createCompounder(function(result, word, index) {
  14375. return result + (index ? '_' : '') + word.toLowerCase();
  14376. });
  14377. /**
  14378. * Splits `string` by `separator`.
  14379. *
  14380. * **Note:** This method is based on
  14381. * [`String#split`](https://mdn.io/String/split).
  14382. *
  14383. * @static
  14384. * @memberOf _
  14385. * @since 4.0.0
  14386. * @category String
  14387. * @param {string} [string=''] The string to split.
  14388. * @param {RegExp|string} separator The separator pattern to split by.
  14389. * @param {number} [limit] The length to truncate results to.
  14390. * @returns {Array} Returns the string segments.
  14391. * @example
  14392. *
  14393. * _.split('a-b-c', '-', 2);
  14394. * // => ['a', 'b']
  14395. */
  14396. function split(string, separator, limit) {
  14397. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  14398. separator = limit = undefined;
  14399. }
  14400. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  14401. if (!limit) {
  14402. return [];
  14403. }
  14404. string = toString(string);
  14405. if (string && (
  14406. typeof separator == 'string' ||
  14407. (separator != null && !isRegExp(separator))
  14408. )) {
  14409. separator = baseToString(separator);
  14410. if (!separator && hasUnicode(string)) {
  14411. return castSlice(stringToArray(string), 0, limit);
  14412. }
  14413. }
  14414. return string.split(separator, limit);
  14415. }
  14416. /**
  14417. * Converts `string` to
  14418. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  14419. *
  14420. * @static
  14421. * @memberOf _
  14422. * @since 3.1.0
  14423. * @category String
  14424. * @param {string} [string=''] The string to convert.
  14425. * @returns {string} Returns the start cased string.
  14426. * @example
  14427. *
  14428. * _.startCase('--foo-bar--');
  14429. * // => 'Foo Bar'
  14430. *
  14431. * _.startCase('fooBar');
  14432. * // => 'Foo Bar'
  14433. *
  14434. * _.startCase('__FOO_BAR__');
  14435. * // => 'FOO BAR'
  14436. */
  14437. var startCase = createCompounder(function(result, word, index) {
  14438. return result + (index ? ' ' : '') + upperFirst(word);
  14439. });
  14440. /**
  14441. * Checks if `string` starts with the given target string.
  14442. *
  14443. * @static
  14444. * @memberOf _
  14445. * @since 3.0.0
  14446. * @category String
  14447. * @param {string} [string=''] The string to inspect.
  14448. * @param {string} [target] The string to search for.
  14449. * @param {number} [position=0] The position to search from.
  14450. * @returns {boolean} Returns `true` if `string` starts with `target`,
  14451. * else `false`.
  14452. * @example
  14453. *
  14454. * _.startsWith('abc', 'a');
  14455. * // => true
  14456. *
  14457. * _.startsWith('abc', 'b');
  14458. * // => false
  14459. *
  14460. * _.startsWith('abc', 'b', 1);
  14461. * // => true
  14462. */
  14463. function startsWith(string, target, position) {
  14464. string = toString(string);
  14465. position = position == null
  14466. ? 0
  14467. : baseClamp(toInteger(position), 0, string.length);
  14468. target = baseToString(target);
  14469. return string.slice(position, position + target.length) == target;
  14470. }
  14471. /**
  14472. * Creates a compiled template function that can interpolate data properties
  14473. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  14474. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  14475. * properties may be accessed as free variables in the template. If a setting
  14476. * object is given, it takes precedence over `_.templateSettings` values.
  14477. *
  14478. * **Note:** In the development build `_.template` utilizes
  14479. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  14480. * for easier debugging.
  14481. *
  14482. * For more information on precompiling templates see
  14483. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  14484. *
  14485. * For more information on Chrome extension sandboxes see
  14486. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  14487. *
  14488. * @static
  14489. * @since 0.1.0
  14490. * @memberOf _
  14491. * @category String
  14492. * @param {string} [string=''] The template string.
  14493. * @param {Object} [options={}] The options object.
  14494. * @param {RegExp} [options.escape=_.templateSettings.escape]
  14495. * The HTML "escape" delimiter.
  14496. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  14497. * The "evaluate" delimiter.
  14498. * @param {Object} [options.imports=_.templateSettings.imports]
  14499. * An object to import into the template as free variables.
  14500. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  14501. * The "interpolate" delimiter.
  14502. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  14503. * The sourceURL of the compiled template.
  14504. * @param {string} [options.variable='obj']
  14505. * The data object variable name.
  14506. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14507. * @returns {Function} Returns the compiled template function.
  14508. * @example
  14509. *
  14510. * // Use the "interpolate" delimiter to create a compiled template.
  14511. * var compiled = _.template('hello <%= user %>!');
  14512. * compiled({ 'user': 'fred' });
  14513. * // => 'hello fred!'
  14514. *
  14515. * // Use the HTML "escape" delimiter to escape data property values.
  14516. * var compiled = _.template('<b><%- value %></b>');
  14517. * compiled({ 'value': '<script>' });
  14518. * // => '<b>&lt;script&gt;</b>'
  14519. *
  14520. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  14521. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  14522. * compiled({ 'users': ['fred', 'barney'] });
  14523. * // => '<li>fred</li><li>barney</li>'
  14524. *
  14525. * // Use the internal `print` function in "evaluate" delimiters.
  14526. * var compiled = _.template('<% print("hello " + user); %>!');
  14527. * compiled({ 'user': 'barney' });
  14528. * // => 'hello barney!'
  14529. *
  14530. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  14531. * // Disable support by replacing the "interpolate" delimiter.
  14532. * var compiled = _.template('hello ${ user }!');
  14533. * compiled({ 'user': 'pebbles' });
  14534. * // => 'hello pebbles!'
  14535. *
  14536. * // Use backslashes to treat delimiters as plain text.
  14537. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  14538. * compiled({ 'value': 'ignored' });
  14539. * // => '<%- value %>'
  14540. *
  14541. * // Use the `imports` option to import `jQuery` as `jq`.
  14542. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  14543. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  14544. * compiled({ 'users': ['fred', 'barney'] });
  14545. * // => '<li>fred</li><li>barney</li>'
  14546. *
  14547. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  14548. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  14549. * compiled(data);
  14550. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  14551. *
  14552. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  14553. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  14554. * compiled.source;
  14555. * // => function(data) {
  14556. * // var __t, __p = '';
  14557. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  14558. * // return __p;
  14559. * // }
  14560. *
  14561. * // Use custom template delimiters.
  14562. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  14563. * var compiled = _.template('hello {{ user }}!');
  14564. * compiled({ 'user': 'mustache' });
  14565. * // => 'hello mustache!'
  14566. *
  14567. * // Use the `source` property to inline compiled templates for meaningful
  14568. * // line numbers in error messages and stack traces.
  14569. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  14570. * var JST = {\
  14571. * "main": ' + _.template(mainText).source + '\
  14572. * };\
  14573. * ');
  14574. */
  14575. function template(string, options, guard) {
  14576. // Based on John Resig's `tmpl` implementation
  14577. // (http://ejohn.org/blog/javascript-micro-templating/)
  14578. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  14579. var settings = lodash.templateSettings;
  14580. if (guard && isIterateeCall(string, options, guard)) {
  14581. options = undefined;
  14582. }
  14583. string = toString(string);
  14584. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  14585. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  14586. importsKeys = keys(imports),
  14587. importsValues = baseValues(imports, importsKeys);
  14588. var isEscaping,
  14589. isEvaluating,
  14590. index = 0,
  14591. interpolate = options.interpolate || reNoMatch,
  14592. source = "__p += '";
  14593. // Compile the regexp to match each delimiter.
  14594. var reDelimiters = RegExp(
  14595. (options.escape || reNoMatch).source + '|' +
  14596. interpolate.source + '|' +
  14597. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  14598. (options.evaluate || reNoMatch).source + '|$'
  14599. , 'g');
  14600. // Use a sourceURL for easier debugging.
  14601. var sourceURL = '//# sourceURL=' +
  14602. ('sourceURL' in options
  14603. ? options.sourceURL
  14604. : ('lodash.templateSources[' + (++templateCounter) + ']')
  14605. ) + '\n';
  14606. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  14607. interpolateValue || (interpolateValue = esTemplateValue);
  14608. // Escape characters that can't be included in string literals.
  14609. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  14610. // Replace delimiters with snippets.
  14611. if (escapeValue) {
  14612. isEscaping = true;
  14613. source += "' +\n__e(" + escapeValue + ") +\n'";
  14614. }
  14615. if (evaluateValue) {
  14616. isEvaluating = true;
  14617. source += "';\n" + evaluateValue + ";\n__p += '";
  14618. }
  14619. if (interpolateValue) {
  14620. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  14621. }
  14622. index = offset + match.length;
  14623. // The JS engine embedded in Adobe products needs `match` returned in
  14624. // order to produce the correct `offset` value.
  14625. return match;
  14626. });
  14627. source += "';\n";
  14628. // If `variable` is not specified wrap a with-statement around the generated
  14629. // code to add the data object to the top of the scope chain.
  14630. var variable = options.variable;
  14631. if (!variable) {
  14632. source = 'with (obj) {\n' + source + '\n}\n';
  14633. }
  14634. // Cleanup code by stripping empty strings.
  14635. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  14636. .replace(reEmptyStringMiddle, '$1')
  14637. .replace(reEmptyStringTrailing, '$1;');
  14638. // Frame code as the function body.
  14639. source = 'function(' + (variable || 'obj') + ') {\n' +
  14640. (variable
  14641. ? ''
  14642. : 'obj || (obj = {});\n'
  14643. ) +
  14644. "var __t, __p = ''" +
  14645. (isEscaping
  14646. ? ', __e = _.escape'
  14647. : ''
  14648. ) +
  14649. (isEvaluating
  14650. ? ', __j = Array.prototype.join;\n' +
  14651. "function print() { __p += __j.call(arguments, '') }\n"
  14652. : ';\n'
  14653. ) +
  14654. source +
  14655. 'return __p\n}';
  14656. var result = attempt(function() {
  14657. return Function(importsKeys, sourceURL + 'return ' + source)
  14658. .apply(undefined, importsValues);
  14659. });
  14660. // Provide the compiled function's source by its `toString` method or
  14661. // the `source` property as a convenience for inlining compiled templates.
  14662. result.source = source;
  14663. if (isError(result)) {
  14664. throw result;
  14665. }
  14666. return result;
  14667. }
  14668. /**
  14669. * Converts `string`, as a whole, to lower case just like
  14670. * [String#toLowerCase](https://mdn.io/toLowerCase).
  14671. *
  14672. * @static
  14673. * @memberOf _
  14674. * @since 4.0.0
  14675. * @category String
  14676. * @param {string} [string=''] The string to convert.
  14677. * @returns {string} Returns the lower cased string.
  14678. * @example
  14679. *
  14680. * _.toLower('--Foo-Bar--');
  14681. * // => '--foo-bar--'
  14682. *
  14683. * _.toLower('fooBar');
  14684. * // => 'foobar'
  14685. *
  14686. * _.toLower('__FOO_BAR__');
  14687. * // => '__foo_bar__'
  14688. */
  14689. function toLower(value) {
  14690. return toString(value).toLowerCase();
  14691. }
  14692. /**
  14693. * Converts `string`, as a whole, to upper case just like
  14694. * [String#toUpperCase](https://mdn.io/toUpperCase).
  14695. *
  14696. * @static
  14697. * @memberOf _
  14698. * @since 4.0.0
  14699. * @category String
  14700. * @param {string} [string=''] The string to convert.
  14701. * @returns {string} Returns the upper cased string.
  14702. * @example
  14703. *
  14704. * _.toUpper('--foo-bar--');
  14705. * // => '--FOO-BAR--'
  14706. *
  14707. * _.toUpper('fooBar');
  14708. * // => 'FOOBAR'
  14709. *
  14710. * _.toUpper('__foo_bar__');
  14711. * // => '__FOO_BAR__'
  14712. */
  14713. function toUpper(value) {
  14714. return toString(value).toUpperCase();
  14715. }
  14716. /**
  14717. * Removes leading and trailing whitespace or specified characters from `string`.
  14718. *
  14719. * @static
  14720. * @memberOf _
  14721. * @since 3.0.0
  14722. * @category String
  14723. * @param {string} [string=''] The string to trim.
  14724. * @param {string} [chars=whitespace] The characters to trim.
  14725. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14726. * @returns {string} Returns the trimmed string.
  14727. * @example
  14728. *
  14729. * _.trim(' abc ');
  14730. * // => 'abc'
  14731. *
  14732. * _.trim('-_-abc-_-', '_-');
  14733. * // => 'abc'
  14734. *
  14735. * _.map([' foo ', ' bar '], _.trim);
  14736. * // => ['foo', 'bar']
  14737. */
  14738. function trim(string, chars, guard) {
  14739. string = toString(string);
  14740. if (string && (guard || chars === undefined)) {
  14741. return string.replace(reTrim, '');
  14742. }
  14743. if (!string || !(chars = baseToString(chars))) {
  14744. return string;
  14745. }
  14746. var strSymbols = stringToArray(string),
  14747. chrSymbols = stringToArray(chars),
  14748. start = charsStartIndex(strSymbols, chrSymbols),
  14749. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  14750. return castSlice(strSymbols, start, end).join('');
  14751. }
  14752. /**
  14753. * Removes trailing whitespace or specified characters from `string`.
  14754. *
  14755. * @static
  14756. * @memberOf _
  14757. * @since 4.0.0
  14758. * @category String
  14759. * @param {string} [string=''] The string to trim.
  14760. * @param {string} [chars=whitespace] The characters to trim.
  14761. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14762. * @returns {string} Returns the trimmed string.
  14763. * @example
  14764. *
  14765. * _.trimEnd(' abc ');
  14766. * // => ' abc'
  14767. *
  14768. * _.trimEnd('-_-abc-_-', '_-');
  14769. * // => '-_-abc'
  14770. */
  14771. function trimEnd(string, chars, guard) {
  14772. string = toString(string);
  14773. if (string && (guard || chars === undefined)) {
  14774. return string.replace(reTrimEnd, '');
  14775. }
  14776. if (!string || !(chars = baseToString(chars))) {
  14777. return string;
  14778. }
  14779. var strSymbols = stringToArray(string),
  14780. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  14781. return castSlice(strSymbols, 0, end).join('');
  14782. }
  14783. /**
  14784. * Removes leading whitespace or specified characters from `string`.
  14785. *
  14786. * @static
  14787. * @memberOf _
  14788. * @since 4.0.0
  14789. * @category String
  14790. * @param {string} [string=''] The string to trim.
  14791. * @param {string} [chars=whitespace] The characters to trim.
  14792. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14793. * @returns {string} Returns the trimmed string.
  14794. * @example
  14795. *
  14796. * _.trimStart(' abc ');
  14797. * // => 'abc '
  14798. *
  14799. * _.trimStart('-_-abc-_-', '_-');
  14800. * // => 'abc-_-'
  14801. */
  14802. function trimStart(string, chars, guard) {
  14803. string = toString(string);
  14804. if (string && (guard || chars === undefined)) {
  14805. return string.replace(reTrimStart, '');
  14806. }
  14807. if (!string || !(chars = baseToString(chars))) {
  14808. return string;
  14809. }
  14810. var strSymbols = stringToArray(string),
  14811. start = charsStartIndex(strSymbols, stringToArray(chars));
  14812. return castSlice(strSymbols, start).join('');
  14813. }
  14814. /**
  14815. * Truncates `string` if it's longer than the given maximum string length.
  14816. * The last characters of the truncated string are replaced with the omission
  14817. * string which defaults to "...".
  14818. *
  14819. * @static
  14820. * @memberOf _
  14821. * @since 4.0.0
  14822. * @category String
  14823. * @param {string} [string=''] The string to truncate.
  14824. * @param {Object} [options={}] The options object.
  14825. * @param {number} [options.length=30] The maximum string length.
  14826. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  14827. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  14828. * @returns {string} Returns the truncated string.
  14829. * @example
  14830. *
  14831. * _.truncate('hi-diddly-ho there, neighborino');
  14832. * // => 'hi-diddly-ho there, neighbo...'
  14833. *
  14834. * _.truncate('hi-diddly-ho there, neighborino', {
  14835. * 'length': 24,
  14836. * 'separator': ' '
  14837. * });
  14838. * // => 'hi-diddly-ho there,...'
  14839. *
  14840. * _.truncate('hi-diddly-ho there, neighborino', {
  14841. * 'length': 24,
  14842. * 'separator': /,? +/
  14843. * });
  14844. * // => 'hi-diddly-ho there...'
  14845. *
  14846. * _.truncate('hi-diddly-ho there, neighborino', {
  14847. * 'omission': ' [...]'
  14848. * });
  14849. * // => 'hi-diddly-ho there, neig [...]'
  14850. */
  14851. function truncate(string, options) {
  14852. var length = DEFAULT_TRUNC_LENGTH,
  14853. omission = DEFAULT_TRUNC_OMISSION;
  14854. if (isObject(options)) {
  14855. var separator = 'separator' in options ? options.separator : separator;
  14856. length = 'length' in options ? toInteger(options.length) : length;
  14857. omission = 'omission' in options ? baseToString(options.omission) : omission;
  14858. }
  14859. string = toString(string);
  14860. var strLength = string.length;
  14861. if (hasUnicode(string)) {
  14862. var strSymbols = stringToArray(string);
  14863. strLength = strSymbols.length;
  14864. }
  14865. if (length >= strLength) {
  14866. return string;
  14867. }
  14868. var end = length - stringSize(omission);
  14869. if (end < 1) {
  14870. return omission;
  14871. }
  14872. var result = strSymbols
  14873. ? castSlice(strSymbols, 0, end).join('')
  14874. : string.slice(0, end);
  14875. if (separator === undefined) {
  14876. return result + omission;
  14877. }
  14878. if (strSymbols) {
  14879. end += (result.length - end);
  14880. }
  14881. if (isRegExp(separator)) {
  14882. if (string.slice(end).search(separator)) {
  14883. var match,
  14884. substring = result;
  14885. if (!separator.global) {
  14886. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  14887. }
  14888. separator.lastIndex = 0;
  14889. while ((match = separator.exec(substring))) {
  14890. var newEnd = match.index;
  14891. }
  14892. result = result.slice(0, newEnd === undefined ? end : newEnd);
  14893. }
  14894. } else if (string.indexOf(baseToString(separator), end) != end) {
  14895. var index = result.lastIndexOf(separator);
  14896. if (index > -1) {
  14897. result = result.slice(0, index);
  14898. }
  14899. }
  14900. return result + omission;
  14901. }
  14902. /**
  14903. * The inverse of `_.escape`; this method converts the HTML entities
  14904. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  14905. * their corresponding characters.
  14906. *
  14907. * **Note:** No other HTML entities are unescaped. To unescape additional
  14908. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  14909. *
  14910. * @static
  14911. * @memberOf _
  14912. * @since 0.6.0
  14913. * @category String
  14914. * @param {string} [string=''] The string to unescape.
  14915. * @returns {string} Returns the unescaped string.
  14916. * @example
  14917. *
  14918. * _.unescape('fred, barney, &amp; pebbles');
  14919. * // => 'fred, barney, & pebbles'
  14920. */
  14921. function unescape(string) {
  14922. string = toString(string);
  14923. return (string && reHasEscapedHtml.test(string))
  14924. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  14925. : string;
  14926. }
  14927. /**
  14928. * Converts `string`, as space separated words, to upper case.
  14929. *
  14930. * @static
  14931. * @memberOf _
  14932. * @since 4.0.0
  14933. * @category String
  14934. * @param {string} [string=''] The string to convert.
  14935. * @returns {string} Returns the upper cased string.
  14936. * @example
  14937. *
  14938. * _.upperCase('--foo-bar');
  14939. * // => 'FOO BAR'
  14940. *
  14941. * _.upperCase('fooBar');
  14942. * // => 'FOO BAR'
  14943. *
  14944. * _.upperCase('__foo_bar__');
  14945. * // => 'FOO BAR'
  14946. */
  14947. var upperCase = createCompounder(function(result, word, index) {
  14948. return result + (index ? ' ' : '') + word.toUpperCase();
  14949. });
  14950. /**
  14951. * Converts the first character of `string` to upper case.
  14952. *
  14953. * @static
  14954. * @memberOf _
  14955. * @since 4.0.0
  14956. * @category String
  14957. * @param {string} [string=''] The string to convert.
  14958. * @returns {string} Returns the converted string.
  14959. * @example
  14960. *
  14961. * _.upperFirst('fred');
  14962. * // => 'Fred'
  14963. *
  14964. * _.upperFirst('FRED');
  14965. * // => 'FRED'
  14966. */
  14967. var upperFirst = createCaseFirst('toUpperCase');
  14968. /**
  14969. * Splits `string` into an array of its words.
  14970. *
  14971. * @static
  14972. * @memberOf _
  14973. * @since 3.0.0
  14974. * @category String
  14975. * @param {string} [string=''] The string to inspect.
  14976. * @param {RegExp|string} [pattern] The pattern to match words.
  14977. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14978. * @returns {Array} Returns the words of `string`.
  14979. * @example
  14980. *
  14981. * _.words('fred, barney, & pebbles');
  14982. * // => ['fred', 'barney', 'pebbles']
  14983. *
  14984. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  14985. * // => ['fred', 'barney', '&', 'pebbles']
  14986. */
  14987. function words(string, pattern, guard) {
  14988. string = toString(string);
  14989. pattern = guard ? undefined : pattern;
  14990. if (pattern === undefined) {
  14991. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  14992. }
  14993. return string.match(pattern) || [];
  14994. }
  14995. /*------------------------------------------------------------------------*/
  14996. /**
  14997. * Attempts to invoke `func`, returning either the result or the caught error
  14998. * object. Any additional arguments are provided to `func` when it's invoked.
  14999. *
  15000. * @static
  15001. * @memberOf _
  15002. * @since 3.0.0
  15003. * @category Util
  15004. * @param {Function} func The function to attempt.
  15005. * @param {...*} [args] The arguments to invoke `func` with.
  15006. * @returns {*} Returns the `func` result or error object.
  15007. * @example
  15008. *
  15009. * // Avoid throwing errors for invalid selectors.
  15010. * var elements = _.attempt(function(selector) {
  15011. * return document.querySelectorAll(selector);
  15012. * }, '>_>');
  15013. *
  15014. * if (_.isError(elements)) {
  15015. * elements = [];
  15016. * }
  15017. */
  15018. var attempt = baseRest(function(func, args) {
  15019. try {
  15020. return apply(func, undefined, args);
  15021. } catch (e) {
  15022. return isError(e) ? e : new Error(e);
  15023. }
  15024. });
  15025. /**
  15026. * Binds methods of an object to the object itself, overwriting the existing
  15027. * method.
  15028. *
  15029. * **Note:** This method doesn't set the "length" property of bound functions.
  15030. *
  15031. * @static
  15032. * @since 0.1.0
  15033. * @memberOf _
  15034. * @category Util
  15035. * @param {Object} object The object to bind and assign the bound methods to.
  15036. * @param {...(string|string[])} methodNames The object method names to bind.
  15037. * @returns {Object} Returns `object`.
  15038. * @example
  15039. *
  15040. * var view = {
  15041. * 'label': 'docs',
  15042. * 'click': function() {
  15043. * console.log('clicked ' + this.label);
  15044. * }
  15045. * };
  15046. *
  15047. * _.bindAll(view, ['click']);
  15048. * jQuery(element).on('click', view.click);
  15049. * // => Logs 'clicked docs' when clicked.
  15050. */
  15051. var bindAll = flatRest(function(object, methodNames) {
  15052. arrayEach(methodNames, function(key) {
  15053. key = toKey(key);
  15054. baseAssignValue(object, key, bind(object[key], object));
  15055. });
  15056. return object;
  15057. });
  15058. /**
  15059. * Creates a function that iterates over `pairs` and invokes the corresponding
  15060. * function of the first predicate to return truthy. The predicate-function
  15061. * pairs are invoked with the `this` binding and arguments of the created
  15062. * function.
  15063. *
  15064. * @static
  15065. * @memberOf _
  15066. * @since 4.0.0
  15067. * @category Util
  15068. * @param {Array} pairs The predicate-function pairs.
  15069. * @returns {Function} Returns the new composite function.
  15070. * @example
  15071. *
  15072. * var func = _.cond([
  15073. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15074. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15075. * [_.stubTrue, _.constant('no match')]
  15076. * ]);
  15077. *
  15078. * func({ 'a': 1, 'b': 2 });
  15079. * // => 'matches A'
  15080. *
  15081. * func({ 'a': 0, 'b': 1 });
  15082. * // => 'matches B'
  15083. *
  15084. * func({ 'a': '1', 'b': '2' });
  15085. * // => 'no match'
  15086. */
  15087. function cond(pairs) {
  15088. var length = pairs == null ? 0 : pairs.length,
  15089. toIteratee = getIteratee();
  15090. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15091. if (typeof pair[1] != 'function') {
  15092. throw new TypeError(FUNC_ERROR_TEXT);
  15093. }
  15094. return [toIteratee(pair[0]), pair[1]];
  15095. });
  15096. return baseRest(function(args) {
  15097. var index = -1;
  15098. while (++index < length) {
  15099. var pair = pairs[index];
  15100. if (apply(pair[0], this, args)) {
  15101. return apply(pair[1], this, args);
  15102. }
  15103. }
  15104. });
  15105. }
  15106. /**
  15107. * Creates a function that invokes the predicate properties of `source` with
  15108. * the corresponding property values of a given object, returning `true` if
  15109. * all predicates return truthy, else `false`.
  15110. *
  15111. * **Note:** The created function is equivalent to `_.conformsTo` with
  15112. * `source` partially applied.
  15113. *
  15114. * @static
  15115. * @memberOf _
  15116. * @since 4.0.0
  15117. * @category Util
  15118. * @param {Object} source The object of property predicates to conform to.
  15119. * @returns {Function} Returns the new spec function.
  15120. * @example
  15121. *
  15122. * var objects = [
  15123. * { 'a': 2, 'b': 1 },
  15124. * { 'a': 1, 'b': 2 }
  15125. * ];
  15126. *
  15127. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15128. * // => [{ 'a': 1, 'b': 2 }]
  15129. */
  15130. function conforms(source) {
  15131. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15132. }
  15133. /**
  15134. * Creates a function that returns `value`.
  15135. *
  15136. * @static
  15137. * @memberOf _
  15138. * @since 2.4.0
  15139. * @category Util
  15140. * @param {*} value The value to return from the new function.
  15141. * @returns {Function} Returns the new constant function.
  15142. * @example
  15143. *
  15144. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15145. *
  15146. * console.log(objects);
  15147. * // => [{ 'a': 1 }, { 'a': 1 }]
  15148. *
  15149. * console.log(objects[0] === objects[1]);
  15150. * // => true
  15151. */
  15152. function constant(value) {
  15153. return function() {
  15154. return value;
  15155. };
  15156. }
  15157. /**
  15158. * Checks `value` to determine whether a default value should be returned in
  15159. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15160. * or `undefined`.
  15161. *
  15162. * @static
  15163. * @memberOf _
  15164. * @since 4.14.0
  15165. * @category Util
  15166. * @param {*} value The value to check.
  15167. * @param {*} defaultValue The default value.
  15168. * @returns {*} Returns the resolved value.
  15169. * @example
  15170. *
  15171. * _.defaultTo(1, 10);
  15172. * // => 1
  15173. *
  15174. * _.defaultTo(undefined, 10);
  15175. * // => 10
  15176. */
  15177. function defaultTo(value, defaultValue) {
  15178. return (value == null || value !== value) ? defaultValue : value;
  15179. }
  15180. /**
  15181. * Creates a function that returns the result of invoking the given functions
  15182. * with the `this` binding of the created function, where each successive
  15183. * invocation is supplied the return value of the previous.
  15184. *
  15185. * @static
  15186. * @memberOf _
  15187. * @since 3.0.0
  15188. * @category Util
  15189. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15190. * @returns {Function} Returns the new composite function.
  15191. * @see _.flowRight
  15192. * @example
  15193. *
  15194. * function square(n) {
  15195. * return n * n;
  15196. * }
  15197. *
  15198. * var addSquare = _.flow([_.add, square]);
  15199. * addSquare(1, 2);
  15200. * // => 9
  15201. */
  15202. var flow = createFlow();
  15203. /**
  15204. * This method is like `_.flow` except that it creates a function that
  15205. * invokes the given functions from right to left.
  15206. *
  15207. * @static
  15208. * @since 3.0.0
  15209. * @memberOf _
  15210. * @category Util
  15211. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15212. * @returns {Function} Returns the new composite function.
  15213. * @see _.flow
  15214. * @example
  15215. *
  15216. * function square(n) {
  15217. * return n * n;
  15218. * }
  15219. *
  15220. * var addSquare = _.flowRight([square, _.add]);
  15221. * addSquare(1, 2);
  15222. * // => 9
  15223. */
  15224. var flowRight = createFlow(true);
  15225. /**
  15226. * This method returns the first argument it receives.
  15227. *
  15228. * @static
  15229. * @since 0.1.0
  15230. * @memberOf _
  15231. * @category Util
  15232. * @param {*} value Any value.
  15233. * @returns {*} Returns `value`.
  15234. * @example
  15235. *
  15236. * var object = { 'a': 1 };
  15237. *
  15238. * console.log(_.identity(object) === object);
  15239. * // => true
  15240. */
  15241. function identity(value) {
  15242. return value;
  15243. }
  15244. /**
  15245. * Creates a function that invokes `func` with the arguments of the created
  15246. * function. If `func` is a property name, the created function returns the
  15247. * property value for a given element. If `func` is an array or object, the
  15248. * created function returns `true` for elements that contain the equivalent
  15249. * source properties, otherwise it returns `false`.
  15250. *
  15251. * @static
  15252. * @since 4.0.0
  15253. * @memberOf _
  15254. * @category Util
  15255. * @param {*} [func=_.identity] The value to convert to a callback.
  15256. * @returns {Function} Returns the callback.
  15257. * @example
  15258. *
  15259. * var users = [
  15260. * { 'user': 'barney', 'age': 36, 'active': true },
  15261. * { 'user': 'fred', 'age': 40, 'active': false }
  15262. * ];
  15263. *
  15264. * // The `_.matches` iteratee shorthand.
  15265. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15266. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15267. *
  15268. * // The `_.matchesProperty` iteratee shorthand.
  15269. * _.filter(users, _.iteratee(['user', 'fred']));
  15270. * // => [{ 'user': 'fred', 'age': 40 }]
  15271. *
  15272. * // The `_.property` iteratee shorthand.
  15273. * _.map(users, _.iteratee('user'));
  15274. * // => ['barney', 'fred']
  15275. *
  15276. * // Create custom iteratee shorthands.
  15277. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15278. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15279. * return func.test(string);
  15280. * };
  15281. * });
  15282. *
  15283. * _.filter(['abc', 'def'], /ef/);
  15284. * // => ['def']
  15285. */
  15286. function iteratee(func) {
  15287. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15288. }
  15289. /**
  15290. * Creates a function that performs a partial deep comparison between a given
  15291. * object and `source`, returning `true` if the given object has equivalent
  15292. * property values, else `false`.
  15293. *
  15294. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15295. * partially applied.
  15296. *
  15297. * Partial comparisons will match empty array and empty object `source`
  15298. * values against any array or object value, respectively. See `_.isEqual`
  15299. * for a list of supported value comparisons.
  15300. *
  15301. * @static
  15302. * @memberOf _
  15303. * @since 3.0.0
  15304. * @category Util
  15305. * @param {Object} source The object of property values to match.
  15306. * @returns {Function} Returns the new spec function.
  15307. * @example
  15308. *
  15309. * var objects = [
  15310. * { 'a': 1, 'b': 2, 'c': 3 },
  15311. * { 'a': 4, 'b': 5, 'c': 6 }
  15312. * ];
  15313. *
  15314. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15315. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15316. */
  15317. function matches(source) {
  15318. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15319. }
  15320. /**
  15321. * Creates a function that performs a partial deep comparison between the
  15322. * value at `path` of a given object to `srcValue`, returning `true` if the
  15323. * object value is equivalent, else `false`.
  15324. *
  15325. * **Note:** Partial comparisons will match empty array and empty object
  15326. * `srcValue` values against any array or object value, respectively. See
  15327. * `_.isEqual` for a list of supported value comparisons.
  15328. *
  15329. * @static
  15330. * @memberOf _
  15331. * @since 3.2.0
  15332. * @category Util
  15333. * @param {Array|string} path The path of the property to get.
  15334. * @param {*} srcValue The value to match.
  15335. * @returns {Function} Returns the new spec function.
  15336. * @example
  15337. *
  15338. * var objects = [
  15339. * { 'a': 1, 'b': 2, 'c': 3 },
  15340. * { 'a': 4, 'b': 5, 'c': 6 }
  15341. * ];
  15342. *
  15343. * _.find(objects, _.matchesProperty('a', 4));
  15344. * // => { 'a': 4, 'b': 5, 'c': 6 }
  15345. */
  15346. function matchesProperty(path, srcValue) {
  15347. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  15348. }
  15349. /**
  15350. * Creates a function that invokes the method at `path` of a given object.
  15351. * Any additional arguments are provided to the invoked method.
  15352. *
  15353. * @static
  15354. * @memberOf _
  15355. * @since 3.7.0
  15356. * @category Util
  15357. * @param {Array|string} path The path of the method to invoke.
  15358. * @param {...*} [args] The arguments to invoke the method with.
  15359. * @returns {Function} Returns the new invoker function.
  15360. * @example
  15361. *
  15362. * var objects = [
  15363. * { 'a': { 'b': _.constant(2) } },
  15364. * { 'a': { 'b': _.constant(1) } }
  15365. * ];
  15366. *
  15367. * _.map(objects, _.method('a.b'));
  15368. * // => [2, 1]
  15369. *
  15370. * _.map(objects, _.method(['a', 'b']));
  15371. * // => [2, 1]
  15372. */
  15373. var method = baseRest(function(path, args) {
  15374. return function(object) {
  15375. return baseInvoke(object, path, args);
  15376. };
  15377. });
  15378. /**
  15379. * The opposite of `_.method`; this method creates a function that invokes
  15380. * the method at a given path of `object`. Any additional arguments are
  15381. * provided to the invoked method.
  15382. *
  15383. * @static
  15384. * @memberOf _
  15385. * @since 3.7.0
  15386. * @category Util
  15387. * @param {Object} object The object to query.
  15388. * @param {...*} [args] The arguments to invoke the method with.
  15389. * @returns {Function} Returns the new invoker function.
  15390. * @example
  15391. *
  15392. * var array = _.times(3, _.constant),
  15393. * object = { 'a': array, 'b': array, 'c': array };
  15394. *
  15395. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  15396. * // => [2, 0]
  15397. *
  15398. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  15399. * // => [2, 0]
  15400. */
  15401. var methodOf = baseRest(function(object, args) {
  15402. return function(path) {
  15403. return baseInvoke(object, path, args);
  15404. };
  15405. });
  15406. /**
  15407. * Adds all own enumerable string keyed function properties of a source
  15408. * object to the destination object. If `object` is a function, then methods
  15409. * are added to its prototype as well.
  15410. *
  15411. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  15412. * avoid conflicts caused by modifying the original.
  15413. *
  15414. * @static
  15415. * @since 0.1.0
  15416. * @memberOf _
  15417. * @category Util
  15418. * @param {Function|Object} [object=lodash] The destination object.
  15419. * @param {Object} source The object of functions to add.
  15420. * @param {Object} [options={}] The options object.
  15421. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  15422. * @returns {Function|Object} Returns `object`.
  15423. * @example
  15424. *
  15425. * function vowels(string) {
  15426. * return _.filter(string, function(v) {
  15427. * return /[aeiou]/i.test(v);
  15428. * });
  15429. * }
  15430. *
  15431. * _.mixin({ 'vowels': vowels });
  15432. * _.vowels('fred');
  15433. * // => ['e']
  15434. *
  15435. * _('fred').vowels().value();
  15436. * // => ['e']
  15437. *
  15438. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  15439. * _('fred').vowels();
  15440. * // => ['e']
  15441. */
  15442. function mixin(object, source, options) {
  15443. var props = keys(source),
  15444. methodNames = baseFunctions(source, props);
  15445. if (options == null &&
  15446. !(isObject(source) && (methodNames.length || !props.length))) {
  15447. options = source;
  15448. source = object;
  15449. object = this;
  15450. methodNames = baseFunctions(source, keys(source));
  15451. }
  15452. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  15453. isFunc = isFunction(object);
  15454. arrayEach(methodNames, function(methodName) {
  15455. var func = source[methodName];
  15456. object[methodName] = func;
  15457. if (isFunc) {
  15458. object.prototype[methodName] = function() {
  15459. var chainAll = this.__chain__;
  15460. if (chain || chainAll) {
  15461. var result = object(this.__wrapped__),
  15462. actions = result.__actions__ = copyArray(this.__actions__);
  15463. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  15464. result.__chain__ = chainAll;
  15465. return result;
  15466. }
  15467. return func.apply(object, arrayPush([this.value()], arguments));
  15468. };
  15469. }
  15470. });
  15471. return object;
  15472. }
  15473. /**
  15474. * Reverts the `_` variable to its previous value and returns a reference to
  15475. * the `lodash` function.
  15476. *
  15477. * @static
  15478. * @since 0.1.0
  15479. * @memberOf _
  15480. * @category Util
  15481. * @returns {Function} Returns the `lodash` function.
  15482. * @example
  15483. *
  15484. * var lodash = _.noConflict();
  15485. */
  15486. function noConflict() {
  15487. if (root._ === this) {
  15488. root._ = oldDash;
  15489. }
  15490. return this;
  15491. }
  15492. /**
  15493. * This method returns `undefined`.
  15494. *
  15495. * @static
  15496. * @memberOf _
  15497. * @since 2.3.0
  15498. * @category Util
  15499. * @example
  15500. *
  15501. * _.times(2, _.noop);
  15502. * // => [undefined, undefined]
  15503. */
  15504. function noop() {
  15505. // No operation performed.
  15506. }
  15507. /**
  15508. * Creates a function that gets the argument at index `n`. If `n` is negative,
  15509. * the nth argument from the end is returned.
  15510. *
  15511. * @static
  15512. * @memberOf _
  15513. * @since 4.0.0
  15514. * @category Util
  15515. * @param {number} [n=0] The index of the argument to return.
  15516. * @returns {Function} Returns the new pass-thru function.
  15517. * @example
  15518. *
  15519. * var func = _.nthArg(1);
  15520. * func('a', 'b', 'c', 'd');
  15521. * // => 'b'
  15522. *
  15523. * var func = _.nthArg(-2);
  15524. * func('a', 'b', 'c', 'd');
  15525. * // => 'c'
  15526. */
  15527. function nthArg(n) {
  15528. n = toInteger(n);
  15529. return baseRest(function(args) {
  15530. return baseNth(args, n);
  15531. });
  15532. }
  15533. /**
  15534. * Creates a function that invokes `iteratees` with the arguments it receives
  15535. * and returns their results.
  15536. *
  15537. * @static
  15538. * @memberOf _
  15539. * @since 4.0.0
  15540. * @category Util
  15541. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  15542. * The iteratees to invoke.
  15543. * @returns {Function} Returns the new function.
  15544. * @example
  15545. *
  15546. * var func = _.over([Math.max, Math.min]);
  15547. *
  15548. * func(1, 2, 3, 4);
  15549. * // => [4, 1]
  15550. */
  15551. var over = createOver(arrayMap);
  15552. /**
  15553. * Creates a function that checks if **all** of the `predicates` return
  15554. * truthy when invoked with the arguments it receives.
  15555. *
  15556. * @static
  15557. * @memberOf _
  15558. * @since 4.0.0
  15559. * @category Util
  15560. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15561. * The predicates to check.
  15562. * @returns {Function} Returns the new function.
  15563. * @example
  15564. *
  15565. * var func = _.overEvery([Boolean, isFinite]);
  15566. *
  15567. * func('1');
  15568. * // => true
  15569. *
  15570. * func(null);
  15571. * // => false
  15572. *
  15573. * func(NaN);
  15574. * // => false
  15575. */
  15576. var overEvery = createOver(arrayEvery);
  15577. /**
  15578. * Creates a function that checks if **any** of the `predicates` return
  15579. * truthy when invoked with the arguments it receives.
  15580. *
  15581. * @static
  15582. * @memberOf _
  15583. * @since 4.0.0
  15584. * @category Util
  15585. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15586. * The predicates to check.
  15587. * @returns {Function} Returns the new function.
  15588. * @example
  15589. *
  15590. * var func = _.overSome([Boolean, isFinite]);
  15591. *
  15592. * func('1');
  15593. * // => true
  15594. *
  15595. * func(null);
  15596. * // => true
  15597. *
  15598. * func(NaN);
  15599. * // => false
  15600. */
  15601. var overSome = createOver(arraySome);
  15602. /**
  15603. * Creates a function that returns the value at `path` of a given object.
  15604. *
  15605. * @static
  15606. * @memberOf _
  15607. * @since 2.4.0
  15608. * @category Util
  15609. * @param {Array|string} path The path of the property to get.
  15610. * @returns {Function} Returns the new accessor function.
  15611. * @example
  15612. *
  15613. * var objects = [
  15614. * { 'a': { 'b': 2 } },
  15615. * { 'a': { 'b': 1 } }
  15616. * ];
  15617. *
  15618. * _.map(objects, _.property('a.b'));
  15619. * // => [2, 1]
  15620. *
  15621. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  15622. * // => [1, 2]
  15623. */
  15624. function property(path) {
  15625. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  15626. }
  15627. /**
  15628. * The opposite of `_.property`; this method creates a function that returns
  15629. * the value at a given path of `object`.
  15630. *
  15631. * @static
  15632. * @memberOf _
  15633. * @since 3.0.0
  15634. * @category Util
  15635. * @param {Object} object The object to query.
  15636. * @returns {Function} Returns the new accessor function.
  15637. * @example
  15638. *
  15639. * var array = [0, 1, 2],
  15640. * object = { 'a': array, 'b': array, 'c': array };
  15641. *
  15642. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  15643. * // => [2, 0]
  15644. *
  15645. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  15646. * // => [2, 0]
  15647. */
  15648. function propertyOf(object) {
  15649. return function(path) {
  15650. return object == null ? undefined : baseGet(object, path);
  15651. };
  15652. }
  15653. /**
  15654. * Creates an array of numbers (positive and/or negative) progressing from
  15655. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  15656. * `start` is specified without an `end` or `step`. If `end` is not specified,
  15657. * it's set to `start` with `start` then set to `0`.
  15658. *
  15659. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  15660. * floating-point values which can produce unexpected results.
  15661. *
  15662. * @static
  15663. * @since 0.1.0
  15664. * @memberOf _
  15665. * @category Util
  15666. * @param {number} [start=0] The start of the range.
  15667. * @param {number} end The end of the range.
  15668. * @param {number} [step=1] The value to increment or decrement by.
  15669. * @returns {Array} Returns the range of numbers.
  15670. * @see _.inRange, _.rangeRight
  15671. * @example
  15672. *
  15673. * _.range(4);
  15674. * // => [0, 1, 2, 3]
  15675. *
  15676. * _.range(-4);
  15677. * // => [0, -1, -2, -3]
  15678. *
  15679. * _.range(1, 5);
  15680. * // => [1, 2, 3, 4]
  15681. *
  15682. * _.range(0, 20, 5);
  15683. * // => [0, 5, 10, 15]
  15684. *
  15685. * _.range(0, -4, -1);
  15686. * // => [0, -1, -2, -3]
  15687. *
  15688. * _.range(1, 4, 0);
  15689. * // => [1, 1, 1]
  15690. *
  15691. * _.range(0);
  15692. * // => []
  15693. */
  15694. var range = createRange();
  15695. /**
  15696. * This method is like `_.range` except that it populates values in
  15697. * descending order.
  15698. *
  15699. * @static
  15700. * @memberOf _
  15701. * @since 4.0.0
  15702. * @category Util
  15703. * @param {number} [start=0] The start of the range.
  15704. * @param {number} end The end of the range.
  15705. * @param {number} [step=1] The value to increment or decrement by.
  15706. * @returns {Array} Returns the range of numbers.
  15707. * @see _.inRange, _.range
  15708. * @example
  15709. *
  15710. * _.rangeRight(4);
  15711. * // => [3, 2, 1, 0]
  15712. *
  15713. * _.rangeRight(-4);
  15714. * // => [-3, -2, -1, 0]
  15715. *
  15716. * _.rangeRight(1, 5);
  15717. * // => [4, 3, 2, 1]
  15718. *
  15719. * _.rangeRight(0, 20, 5);
  15720. * // => [15, 10, 5, 0]
  15721. *
  15722. * _.rangeRight(0, -4, -1);
  15723. * // => [-3, -2, -1, 0]
  15724. *
  15725. * _.rangeRight(1, 4, 0);
  15726. * // => [1, 1, 1]
  15727. *
  15728. * _.rangeRight(0);
  15729. * // => []
  15730. */
  15731. var rangeRight = createRange(true);
  15732. /**
  15733. * This method returns a new empty array.
  15734. *
  15735. * @static
  15736. * @memberOf _
  15737. * @since 4.13.0
  15738. * @category Util
  15739. * @returns {Array} Returns the new empty array.
  15740. * @example
  15741. *
  15742. * var arrays = _.times(2, _.stubArray);
  15743. *
  15744. * console.log(arrays);
  15745. * // => [[], []]
  15746. *
  15747. * console.log(arrays[0] === arrays[1]);
  15748. * // => false
  15749. */
  15750. function stubArray() {
  15751. return [];
  15752. }
  15753. /**
  15754. * This method returns `false`.
  15755. *
  15756. * @static
  15757. * @memberOf _
  15758. * @since 4.13.0
  15759. * @category Util
  15760. * @returns {boolean} Returns `false`.
  15761. * @example
  15762. *
  15763. * _.times(2, _.stubFalse);
  15764. * // => [false, false]
  15765. */
  15766. function stubFalse() {
  15767. return false;
  15768. }
  15769. /**
  15770. * This method returns a new empty object.
  15771. *
  15772. * @static
  15773. * @memberOf _
  15774. * @since 4.13.0
  15775. * @category Util
  15776. * @returns {Object} Returns the new empty object.
  15777. * @example
  15778. *
  15779. * var objects = _.times(2, _.stubObject);
  15780. *
  15781. * console.log(objects);
  15782. * // => [{}, {}]
  15783. *
  15784. * console.log(objects[0] === objects[1]);
  15785. * // => false
  15786. */
  15787. function stubObject() {
  15788. return {};
  15789. }
  15790. /**
  15791. * This method returns an empty string.
  15792. *
  15793. * @static
  15794. * @memberOf _
  15795. * @since 4.13.0
  15796. * @category Util
  15797. * @returns {string} Returns the empty string.
  15798. * @example
  15799. *
  15800. * _.times(2, _.stubString);
  15801. * // => ['', '']
  15802. */
  15803. function stubString() {
  15804. return '';
  15805. }
  15806. /**
  15807. * This method returns `true`.
  15808. *
  15809. * @static
  15810. * @memberOf _
  15811. * @since 4.13.0
  15812. * @category Util
  15813. * @returns {boolean} Returns `true`.
  15814. * @example
  15815. *
  15816. * _.times(2, _.stubTrue);
  15817. * // => [true, true]
  15818. */
  15819. function stubTrue() {
  15820. return true;
  15821. }
  15822. /**
  15823. * Invokes the iteratee `n` times, returning an array of the results of
  15824. * each invocation. The iteratee is invoked with one argument; (index).
  15825. *
  15826. * @static
  15827. * @since 0.1.0
  15828. * @memberOf _
  15829. * @category Util
  15830. * @param {number} n The number of times to invoke `iteratee`.
  15831. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  15832. * @returns {Array} Returns the array of results.
  15833. * @example
  15834. *
  15835. * _.times(3, String);
  15836. * // => ['0', '1', '2']
  15837. *
  15838. * _.times(4, _.constant(0));
  15839. * // => [0, 0, 0, 0]
  15840. */
  15841. function times(n, iteratee) {
  15842. n = toInteger(n);
  15843. if (n < 1 || n > MAX_SAFE_INTEGER) {
  15844. return [];
  15845. }
  15846. var index = MAX_ARRAY_LENGTH,
  15847. length = nativeMin(n, MAX_ARRAY_LENGTH);
  15848. iteratee = getIteratee(iteratee);
  15849. n -= MAX_ARRAY_LENGTH;
  15850. var result = baseTimes(length, iteratee);
  15851. while (++index < n) {
  15852. iteratee(index);
  15853. }
  15854. return result;
  15855. }
  15856. /**
  15857. * Converts `value` to a property path array.
  15858. *
  15859. * @static
  15860. * @memberOf _
  15861. * @since 4.0.0
  15862. * @category Util
  15863. * @param {*} value The value to convert.
  15864. * @returns {Array} Returns the new property path array.
  15865. * @example
  15866. *
  15867. * _.toPath('a.b.c');
  15868. * // => ['a', 'b', 'c']
  15869. *
  15870. * _.toPath('a[0].b.c');
  15871. * // => ['a', '0', 'b', 'c']
  15872. */
  15873. function toPath(value) {
  15874. if (isArray(value)) {
  15875. return arrayMap(value, toKey);
  15876. }
  15877. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  15878. }
  15879. /**
  15880. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  15881. *
  15882. * @static
  15883. * @since 0.1.0
  15884. * @memberOf _
  15885. * @category Util
  15886. * @param {string} [prefix=''] The value to prefix the ID with.
  15887. * @returns {string} Returns the unique ID.
  15888. * @example
  15889. *
  15890. * _.uniqueId('contact_');
  15891. * // => 'contact_104'
  15892. *
  15893. * _.uniqueId();
  15894. * // => '105'
  15895. */
  15896. function uniqueId(prefix) {
  15897. var id = ++idCounter;
  15898. return toString(prefix) + id;
  15899. }
  15900. /*------------------------------------------------------------------------*/
  15901. /**
  15902. * Adds two numbers.
  15903. *
  15904. * @static
  15905. * @memberOf _
  15906. * @since 3.4.0
  15907. * @category Math
  15908. * @param {number} augend The first number in an addition.
  15909. * @param {number} addend The second number in an addition.
  15910. * @returns {number} Returns the total.
  15911. * @example
  15912. *
  15913. * _.add(6, 4);
  15914. * // => 10
  15915. */
  15916. var add = createMathOperation(function(augend, addend) {
  15917. return augend + addend;
  15918. }, 0);
  15919. /**
  15920. * Computes `number` rounded up to `precision`.
  15921. *
  15922. * @static
  15923. * @memberOf _
  15924. * @since 3.10.0
  15925. * @category Math
  15926. * @param {number} number The number to round up.
  15927. * @param {number} [precision=0] The precision to round up to.
  15928. * @returns {number} Returns the rounded up number.
  15929. * @example
  15930. *
  15931. * _.ceil(4.006);
  15932. * // => 5
  15933. *
  15934. * _.ceil(6.004, 2);
  15935. * // => 6.01
  15936. *
  15937. * _.ceil(6040, -2);
  15938. * // => 6100
  15939. */
  15940. var ceil = createRound('ceil');
  15941. /**
  15942. * Divide two numbers.
  15943. *
  15944. * @static
  15945. * @memberOf _
  15946. * @since 4.7.0
  15947. * @category Math
  15948. * @param {number} dividend The first number in a division.
  15949. * @param {number} divisor The second number in a division.
  15950. * @returns {number} Returns the quotient.
  15951. * @example
  15952. *
  15953. * _.divide(6, 4);
  15954. * // => 1.5
  15955. */
  15956. var divide = createMathOperation(function(dividend, divisor) {
  15957. return dividend / divisor;
  15958. }, 1);
  15959. /**
  15960. * Computes `number` rounded down to `precision`.
  15961. *
  15962. * @static
  15963. * @memberOf _
  15964. * @since 3.10.0
  15965. * @category Math
  15966. * @param {number} number The number to round down.
  15967. * @param {number} [precision=0] The precision to round down to.
  15968. * @returns {number} Returns the rounded down number.
  15969. * @example
  15970. *
  15971. * _.floor(4.006);
  15972. * // => 4
  15973. *
  15974. * _.floor(0.046, 2);
  15975. * // => 0.04
  15976. *
  15977. * _.floor(4060, -2);
  15978. * // => 4000
  15979. */
  15980. var floor = createRound('floor');
  15981. /**
  15982. * Computes the maximum value of `array`. If `array` is empty or falsey,
  15983. * `undefined` is returned.
  15984. *
  15985. * @static
  15986. * @since 0.1.0
  15987. * @memberOf _
  15988. * @category Math
  15989. * @param {Array} array The array to iterate over.
  15990. * @returns {*} Returns the maximum value.
  15991. * @example
  15992. *
  15993. * _.max([4, 2, 8, 6]);
  15994. * // => 8
  15995. *
  15996. * _.max([]);
  15997. * // => undefined
  15998. */
  15999. function max(array) {
  16000. return (array && array.length)
  16001. ? baseExtremum(array, identity, baseGt)
  16002. : undefined;
  16003. }
  16004. /**
  16005. * This method is like `_.max` except that it accepts `iteratee` which is
  16006. * invoked for each element in `array` to generate the criterion by which
  16007. * the value is ranked. The iteratee is invoked with one argument: (value).
  16008. *
  16009. * @static
  16010. * @memberOf _
  16011. * @since 4.0.0
  16012. * @category Math
  16013. * @param {Array} array The array to iterate over.
  16014. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16015. * @returns {*} Returns the maximum value.
  16016. * @example
  16017. *
  16018. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16019. *
  16020. * _.maxBy(objects, function(o) { return o.n; });
  16021. * // => { 'n': 2 }
  16022. *
  16023. * // The `_.property` iteratee shorthand.
  16024. * _.maxBy(objects, 'n');
  16025. * // => { 'n': 2 }
  16026. */
  16027. function maxBy(array, iteratee) {
  16028. return (array && array.length)
  16029. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16030. : undefined;
  16031. }
  16032. /**
  16033. * Computes the mean of the values in `array`.
  16034. *
  16035. * @static
  16036. * @memberOf _
  16037. * @since 4.0.0
  16038. * @category Math
  16039. * @param {Array} array The array to iterate over.
  16040. * @returns {number} Returns the mean.
  16041. * @example
  16042. *
  16043. * _.mean([4, 2, 8, 6]);
  16044. * // => 5
  16045. */
  16046. function mean(array) {
  16047. return baseMean(array, identity);
  16048. }
  16049. /**
  16050. * This method is like `_.mean` except that it accepts `iteratee` which is
  16051. * invoked for each element in `array` to generate the value to be averaged.
  16052. * The iteratee is invoked with one argument: (value).
  16053. *
  16054. * @static
  16055. * @memberOf _
  16056. * @since 4.7.0
  16057. * @category Math
  16058. * @param {Array} array The array to iterate over.
  16059. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16060. * @returns {number} Returns the mean.
  16061. * @example
  16062. *
  16063. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16064. *
  16065. * _.meanBy(objects, function(o) { return o.n; });
  16066. * // => 5
  16067. *
  16068. * // The `_.property` iteratee shorthand.
  16069. * _.meanBy(objects, 'n');
  16070. * // => 5
  16071. */
  16072. function meanBy(array, iteratee) {
  16073. return baseMean(array, getIteratee(iteratee, 2));
  16074. }
  16075. /**
  16076. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16077. * `undefined` is returned.
  16078. *
  16079. * @static
  16080. * @since 0.1.0
  16081. * @memberOf _
  16082. * @category Math
  16083. * @param {Array} array The array to iterate over.
  16084. * @returns {*} Returns the minimum value.
  16085. * @example
  16086. *
  16087. * _.min([4, 2, 8, 6]);
  16088. * // => 2
  16089. *
  16090. * _.min([]);
  16091. * // => undefined
  16092. */
  16093. function min(array) {
  16094. return (array && array.length)
  16095. ? baseExtremum(array, identity, baseLt)
  16096. : undefined;
  16097. }
  16098. /**
  16099. * This method is like `_.min` except that it accepts `iteratee` which is
  16100. * invoked for each element in `array` to generate the criterion by which
  16101. * the value is ranked. The iteratee is invoked with one argument: (value).
  16102. *
  16103. * @static
  16104. * @memberOf _
  16105. * @since 4.0.0
  16106. * @category Math
  16107. * @param {Array} array The array to iterate over.
  16108. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16109. * @returns {*} Returns the minimum value.
  16110. * @example
  16111. *
  16112. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16113. *
  16114. * _.minBy(objects, function(o) { return o.n; });
  16115. * // => { 'n': 1 }
  16116. *
  16117. * // The `_.property` iteratee shorthand.
  16118. * _.minBy(objects, 'n');
  16119. * // => { 'n': 1 }
  16120. */
  16121. function minBy(array, iteratee) {
  16122. return (array && array.length)
  16123. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16124. : undefined;
  16125. }
  16126. /**
  16127. * Multiply two numbers.
  16128. *
  16129. * @static
  16130. * @memberOf _
  16131. * @since 4.7.0
  16132. * @category Math
  16133. * @param {number} multiplier The first number in a multiplication.
  16134. * @param {number} multiplicand The second number in a multiplication.
  16135. * @returns {number} Returns the product.
  16136. * @example
  16137. *
  16138. * _.multiply(6, 4);
  16139. * // => 24
  16140. */
  16141. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16142. return multiplier * multiplicand;
  16143. }, 1);
  16144. /**
  16145. * Computes `number` rounded to `precision`.
  16146. *
  16147. * @static
  16148. * @memberOf _
  16149. * @since 3.10.0
  16150. * @category Math
  16151. * @param {number} number The number to round.
  16152. * @param {number} [precision=0] The precision to round to.
  16153. * @returns {number} Returns the rounded number.
  16154. * @example
  16155. *
  16156. * _.round(4.006);
  16157. * // => 4
  16158. *
  16159. * _.round(4.006, 2);
  16160. * // => 4.01
  16161. *
  16162. * _.round(4060, -2);
  16163. * // => 4100
  16164. */
  16165. var round = createRound('round');
  16166. /**
  16167. * Subtract two numbers.
  16168. *
  16169. * @static
  16170. * @memberOf _
  16171. * @since 4.0.0
  16172. * @category Math
  16173. * @param {number} minuend The first number in a subtraction.
  16174. * @param {number} subtrahend The second number in a subtraction.
  16175. * @returns {number} Returns the difference.
  16176. * @example
  16177. *
  16178. * _.subtract(6, 4);
  16179. * // => 2
  16180. */
  16181. var subtract = createMathOperation(function(minuend, subtrahend) {
  16182. return minuend - subtrahend;
  16183. }, 0);
  16184. /**
  16185. * Computes the sum of the values in `array`.
  16186. *
  16187. * @static
  16188. * @memberOf _
  16189. * @since 3.4.0
  16190. * @category Math
  16191. * @param {Array} array The array to iterate over.
  16192. * @returns {number} Returns the sum.
  16193. * @example
  16194. *
  16195. * _.sum([4, 2, 8, 6]);
  16196. * // => 20
  16197. */
  16198. function sum(array) {
  16199. return (array && array.length)
  16200. ? baseSum(array, identity)
  16201. : 0;
  16202. }
  16203. /**
  16204. * This method is like `_.sum` except that it accepts `iteratee` which is
  16205. * invoked for each element in `array` to generate the value to be summed.
  16206. * The iteratee is invoked with one argument: (value).
  16207. *
  16208. * @static
  16209. * @memberOf _
  16210. * @since 4.0.0
  16211. * @category Math
  16212. * @param {Array} array The array to iterate over.
  16213. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16214. * @returns {number} Returns the sum.
  16215. * @example
  16216. *
  16217. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16218. *
  16219. * _.sumBy(objects, function(o) { return o.n; });
  16220. * // => 20
  16221. *
  16222. * // The `_.property` iteratee shorthand.
  16223. * _.sumBy(objects, 'n');
  16224. * // => 20
  16225. */
  16226. function sumBy(array, iteratee) {
  16227. return (array && array.length)
  16228. ? baseSum(array, getIteratee(iteratee, 2))
  16229. : 0;
  16230. }
  16231. /*------------------------------------------------------------------------*/
  16232. // Add methods that return wrapped values in chain sequences.
  16233. lodash.after = after;
  16234. lodash.ary = ary;
  16235. lodash.assign = assign;
  16236. lodash.assignIn = assignIn;
  16237. lodash.assignInWith = assignInWith;
  16238. lodash.assignWith = assignWith;
  16239. lodash.at = at;
  16240. lodash.before = before;
  16241. lodash.bind = bind;
  16242. lodash.bindAll = bindAll;
  16243. lodash.bindKey = bindKey;
  16244. lodash.castArray = castArray;
  16245. lodash.chain = chain;
  16246. lodash.chunk = chunk;
  16247. lodash.compact = compact;
  16248. lodash.concat = concat;
  16249. lodash.cond = cond;
  16250. lodash.conforms = conforms;
  16251. lodash.constant = constant;
  16252. lodash.countBy = countBy;
  16253. lodash.create = create;
  16254. lodash.curry = curry;
  16255. lodash.curryRight = curryRight;
  16256. lodash.debounce = debounce;
  16257. lodash.defaults = defaults;
  16258. lodash.defaultsDeep = defaultsDeep;
  16259. lodash.defer = defer;
  16260. lodash.delay = delay;
  16261. lodash.difference = difference;
  16262. lodash.differenceBy = differenceBy;
  16263. lodash.differenceWith = differenceWith;
  16264. lodash.drop = drop;
  16265. lodash.dropRight = dropRight;
  16266. lodash.dropRightWhile = dropRightWhile;
  16267. lodash.dropWhile = dropWhile;
  16268. lodash.fill = fill;
  16269. lodash.filter = filter;
  16270. lodash.flatMap = flatMap;
  16271. lodash.flatMapDeep = flatMapDeep;
  16272. lodash.flatMapDepth = flatMapDepth;
  16273. lodash.flatten = flatten;
  16274. lodash.flattenDeep = flattenDeep;
  16275. lodash.flattenDepth = flattenDepth;
  16276. lodash.flip = flip;
  16277. lodash.flow = flow;
  16278. lodash.flowRight = flowRight;
  16279. lodash.fromPairs = fromPairs;
  16280. lodash.functions = functions;
  16281. lodash.functionsIn = functionsIn;
  16282. lodash.groupBy = groupBy;
  16283. lodash.initial = initial;
  16284. lodash.intersection = intersection;
  16285. lodash.intersectionBy = intersectionBy;
  16286. lodash.intersectionWith = intersectionWith;
  16287. lodash.invert = invert;
  16288. lodash.invertBy = invertBy;
  16289. lodash.invokeMap = invokeMap;
  16290. lodash.iteratee = iteratee;
  16291. lodash.keyBy = keyBy;
  16292. lodash.keys = keys;
  16293. lodash.keysIn = keysIn;
  16294. lodash.map = map;
  16295. lodash.mapKeys = mapKeys;
  16296. lodash.mapValues = mapValues;
  16297. lodash.matches = matches;
  16298. lodash.matchesProperty = matchesProperty;
  16299. lodash.memoize = memoize;
  16300. lodash.merge = merge;
  16301. lodash.mergeWith = mergeWith;
  16302. lodash.method = method;
  16303. lodash.methodOf = methodOf;
  16304. lodash.mixin = mixin;
  16305. lodash.negate = negate;
  16306. lodash.nthArg = nthArg;
  16307. lodash.omit = omit;
  16308. lodash.omitBy = omitBy;
  16309. lodash.once = once;
  16310. lodash.orderBy = orderBy;
  16311. lodash.over = over;
  16312. lodash.overArgs = overArgs;
  16313. lodash.overEvery = overEvery;
  16314. lodash.overSome = overSome;
  16315. lodash.partial = partial;
  16316. lodash.partialRight = partialRight;
  16317. lodash.partition = partition;
  16318. lodash.pick = pick;
  16319. lodash.pickBy = pickBy;
  16320. lodash.property = property;
  16321. lodash.propertyOf = propertyOf;
  16322. lodash.pull = pull;
  16323. lodash.pullAll = pullAll;
  16324. lodash.pullAllBy = pullAllBy;
  16325. lodash.pullAllWith = pullAllWith;
  16326. lodash.pullAt = pullAt;
  16327. lodash.range = range;
  16328. lodash.rangeRight = rangeRight;
  16329. lodash.rearg = rearg;
  16330. lodash.reject = reject;
  16331. lodash.remove = remove;
  16332. lodash.rest = rest;
  16333. lodash.reverse = reverse;
  16334. lodash.sampleSize = sampleSize;
  16335. lodash.set = set;
  16336. lodash.setWith = setWith;
  16337. lodash.shuffle = shuffle;
  16338. lodash.slice = slice;
  16339. lodash.sortBy = sortBy;
  16340. lodash.sortedUniq = sortedUniq;
  16341. lodash.sortedUniqBy = sortedUniqBy;
  16342. lodash.split = split;
  16343. lodash.spread = spread;
  16344. lodash.tail = tail;
  16345. lodash.take = take;
  16346. lodash.takeRight = takeRight;
  16347. lodash.takeRightWhile = takeRightWhile;
  16348. lodash.takeWhile = takeWhile;
  16349. lodash.tap = tap;
  16350. lodash.throttle = throttle;
  16351. lodash.thru = thru;
  16352. lodash.toArray = toArray;
  16353. lodash.toPairs = toPairs;
  16354. lodash.toPairsIn = toPairsIn;
  16355. lodash.toPath = toPath;
  16356. lodash.toPlainObject = toPlainObject;
  16357. lodash.transform = transform;
  16358. lodash.unary = unary;
  16359. lodash.union = union;
  16360. lodash.unionBy = unionBy;
  16361. lodash.unionWith = unionWith;
  16362. lodash.uniq = uniq;
  16363. lodash.uniqBy = uniqBy;
  16364. lodash.uniqWith = uniqWith;
  16365. lodash.unset = unset;
  16366. lodash.unzip = unzip;
  16367. lodash.unzipWith = unzipWith;
  16368. lodash.update = update;
  16369. lodash.updateWith = updateWith;
  16370. lodash.values = values;
  16371. lodash.valuesIn = valuesIn;
  16372. lodash.without = without;
  16373. lodash.words = words;
  16374. lodash.wrap = wrap;
  16375. lodash.xor = xor;
  16376. lodash.xorBy = xorBy;
  16377. lodash.xorWith = xorWith;
  16378. lodash.zip = zip;
  16379. lodash.zipObject = zipObject;
  16380. lodash.zipObjectDeep = zipObjectDeep;
  16381. lodash.zipWith = zipWith;
  16382. // Add aliases.
  16383. lodash.entries = toPairs;
  16384. lodash.entriesIn = toPairsIn;
  16385. lodash.extend = assignIn;
  16386. lodash.extendWith = assignInWith;
  16387. // Add methods to `lodash.prototype`.
  16388. mixin(lodash, lodash);
  16389. /*------------------------------------------------------------------------*/
  16390. // Add methods that return unwrapped values in chain sequences.
  16391. lodash.add = add;
  16392. lodash.attempt = attempt;
  16393. lodash.camelCase = camelCase;
  16394. lodash.capitalize = capitalize;
  16395. lodash.ceil = ceil;
  16396. lodash.clamp = clamp;
  16397. lodash.clone = clone;
  16398. lodash.cloneDeep = cloneDeep;
  16399. lodash.cloneDeepWith = cloneDeepWith;
  16400. lodash.cloneWith = cloneWith;
  16401. lodash.conformsTo = conformsTo;
  16402. lodash.deburr = deburr;
  16403. lodash.defaultTo = defaultTo;
  16404. lodash.divide = divide;
  16405. lodash.endsWith = endsWith;
  16406. lodash.eq = eq;
  16407. lodash.escape = escape;
  16408. lodash.escapeRegExp = escapeRegExp;
  16409. lodash.every = every;
  16410. lodash.find = find;
  16411. lodash.findIndex = findIndex;
  16412. lodash.findKey = findKey;
  16413. lodash.findLast = findLast;
  16414. lodash.findLastIndex = findLastIndex;
  16415. lodash.findLastKey = findLastKey;
  16416. lodash.floor = floor;
  16417. lodash.forEach = forEach;
  16418. lodash.forEachRight = forEachRight;
  16419. lodash.forIn = forIn;
  16420. lodash.forInRight = forInRight;
  16421. lodash.forOwn = forOwn;
  16422. lodash.forOwnRight = forOwnRight;
  16423. lodash.get = get;
  16424. lodash.gt = gt;
  16425. lodash.gte = gte;
  16426. lodash.has = has;
  16427. lodash.hasIn = hasIn;
  16428. lodash.head = head;
  16429. lodash.identity = identity;
  16430. lodash.includes = includes;
  16431. lodash.indexOf = indexOf;
  16432. lodash.inRange = inRange;
  16433. lodash.invoke = invoke;
  16434. lodash.isArguments = isArguments;
  16435. lodash.isArray = isArray;
  16436. lodash.isArrayBuffer = isArrayBuffer;
  16437. lodash.isArrayLike = isArrayLike;
  16438. lodash.isArrayLikeObject = isArrayLikeObject;
  16439. lodash.isBoolean = isBoolean;
  16440. lodash.isBuffer = isBuffer;
  16441. lodash.isDate = isDate;
  16442. lodash.isElement = isElement;
  16443. lodash.isEmpty = isEmpty;
  16444. lodash.isEqual = isEqual;
  16445. lodash.isEqualWith = isEqualWith;
  16446. lodash.isError = isError;
  16447. lodash.isFinite = isFinite;
  16448. lodash.isFunction = isFunction;
  16449. lodash.isInteger = isInteger;
  16450. lodash.isLength = isLength;
  16451. lodash.isMap = isMap;
  16452. lodash.isMatch = isMatch;
  16453. lodash.isMatchWith = isMatchWith;
  16454. lodash.isNaN = isNaN;
  16455. lodash.isNative = isNative;
  16456. lodash.isNil = isNil;
  16457. lodash.isNull = isNull;
  16458. lodash.isNumber = isNumber;
  16459. lodash.isObject = isObject;
  16460. lodash.isObjectLike = isObjectLike;
  16461. lodash.isPlainObject = isPlainObject;
  16462. lodash.isRegExp = isRegExp;
  16463. lodash.isSafeInteger = isSafeInteger;
  16464. lodash.isSet = isSet;
  16465. lodash.isString = isString;
  16466. lodash.isSymbol = isSymbol;
  16467. lodash.isTypedArray = isTypedArray;
  16468. lodash.isUndefined = isUndefined;
  16469. lodash.isWeakMap = isWeakMap;
  16470. lodash.isWeakSet = isWeakSet;
  16471. lodash.join = join;
  16472. lodash.kebabCase = kebabCase;
  16473. lodash.last = last;
  16474. lodash.lastIndexOf = lastIndexOf;
  16475. lodash.lowerCase = lowerCase;
  16476. lodash.lowerFirst = lowerFirst;
  16477. lodash.lt = lt;
  16478. lodash.lte = lte;
  16479. lodash.max = max;
  16480. lodash.maxBy = maxBy;
  16481. lodash.mean = mean;
  16482. lodash.meanBy = meanBy;
  16483. lodash.min = min;
  16484. lodash.minBy = minBy;
  16485. lodash.stubArray = stubArray;
  16486. lodash.stubFalse = stubFalse;
  16487. lodash.stubObject = stubObject;
  16488. lodash.stubString = stubString;
  16489. lodash.stubTrue = stubTrue;
  16490. lodash.multiply = multiply;
  16491. lodash.nth = nth;
  16492. lodash.noConflict = noConflict;
  16493. lodash.noop = noop;
  16494. lodash.now = now;
  16495. lodash.pad = pad;
  16496. lodash.padEnd = padEnd;
  16497. lodash.padStart = padStart;
  16498. lodash.parseInt = parseInt;
  16499. lodash.random = random;
  16500. lodash.reduce = reduce;
  16501. lodash.reduceRight = reduceRight;
  16502. lodash.repeat = repeat;
  16503. lodash.replace = replace;
  16504. lodash.result = result;
  16505. lodash.round = round;
  16506. lodash.runInContext = runInContext;
  16507. lodash.sample = sample;
  16508. lodash.size = size;
  16509. lodash.snakeCase = snakeCase;
  16510. lodash.some = some;
  16511. lodash.sortedIndex = sortedIndex;
  16512. lodash.sortedIndexBy = sortedIndexBy;
  16513. lodash.sortedIndexOf = sortedIndexOf;
  16514. lodash.sortedLastIndex = sortedLastIndex;
  16515. lodash.sortedLastIndexBy = sortedLastIndexBy;
  16516. lodash.sortedLastIndexOf = sortedLastIndexOf;
  16517. lodash.startCase = startCase;
  16518. lodash.startsWith = startsWith;
  16519. lodash.subtract = subtract;
  16520. lodash.sum = sum;
  16521. lodash.sumBy = sumBy;
  16522. lodash.template = template;
  16523. lodash.times = times;
  16524. lodash.toFinite = toFinite;
  16525. lodash.toInteger = toInteger;
  16526. lodash.toLength = toLength;
  16527. lodash.toLower = toLower;
  16528. lodash.toNumber = toNumber;
  16529. lodash.toSafeInteger = toSafeInteger;
  16530. lodash.toString = toString;
  16531. lodash.toUpper = toUpper;
  16532. lodash.trim = trim;
  16533. lodash.trimEnd = trimEnd;
  16534. lodash.trimStart = trimStart;
  16535. lodash.truncate = truncate;
  16536. lodash.unescape = unescape;
  16537. lodash.uniqueId = uniqueId;
  16538. lodash.upperCase = upperCase;
  16539. lodash.upperFirst = upperFirst;
  16540. // Add aliases.
  16541. lodash.each = forEach;
  16542. lodash.eachRight = forEachRight;
  16543. lodash.first = head;
  16544. mixin(lodash, (function() {
  16545. var source = {};
  16546. baseForOwn(lodash, function(func, methodName) {
  16547. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  16548. source[methodName] = func;
  16549. }
  16550. });
  16551. return source;
  16552. }()), { 'chain': false });
  16553. /*------------------------------------------------------------------------*/
  16554. /**
  16555. * The semantic version number.
  16556. *
  16557. * @static
  16558. * @memberOf _
  16559. * @type {string}
  16560. */
  16561. lodash.VERSION = VERSION;
  16562. // Assign default placeholders.
  16563. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  16564. lodash[methodName].placeholder = lodash;
  16565. });
  16566. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  16567. arrayEach(['drop', 'take'], function(methodName, index) {
  16568. LazyWrapper.prototype[methodName] = function(n) {
  16569. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  16570. var result = (this.__filtered__ && !index)
  16571. ? new LazyWrapper(this)
  16572. : this.clone();
  16573. if (result.__filtered__) {
  16574. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  16575. } else {
  16576. result.__views__.push({
  16577. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  16578. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  16579. });
  16580. }
  16581. return result;
  16582. };
  16583. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  16584. return this.reverse()[methodName](n).reverse();
  16585. };
  16586. });
  16587. // Add `LazyWrapper` methods that accept an `iteratee` value.
  16588. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  16589. var type = index + 1,
  16590. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  16591. LazyWrapper.prototype[methodName] = function(iteratee) {
  16592. var result = this.clone();
  16593. result.__iteratees__.push({
  16594. 'iteratee': getIteratee(iteratee, 3),
  16595. 'type': type
  16596. });
  16597. result.__filtered__ = result.__filtered__ || isFilter;
  16598. return result;
  16599. };
  16600. });
  16601. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  16602. arrayEach(['head', 'last'], function(methodName, index) {
  16603. var takeName = 'take' + (index ? 'Right' : '');
  16604. LazyWrapper.prototype[methodName] = function() {
  16605. return this[takeName](1).value()[0];
  16606. };
  16607. });
  16608. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  16609. arrayEach(['initial', 'tail'], function(methodName, index) {
  16610. var dropName = 'drop' + (index ? '' : 'Right');
  16611. LazyWrapper.prototype[methodName] = function() {
  16612. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  16613. };
  16614. });
  16615. LazyWrapper.prototype.compact = function() {
  16616. return this.filter(identity);
  16617. };
  16618. LazyWrapper.prototype.find = function(predicate) {
  16619. return this.filter(predicate).head();
  16620. };
  16621. LazyWrapper.prototype.findLast = function(predicate) {
  16622. return this.reverse().find(predicate);
  16623. };
  16624. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  16625. if (typeof path == 'function') {
  16626. return new LazyWrapper(this);
  16627. }
  16628. return this.map(function(value) {
  16629. return baseInvoke(value, path, args);
  16630. });
  16631. });
  16632. LazyWrapper.prototype.reject = function(predicate) {
  16633. return this.filter(negate(getIteratee(predicate)));
  16634. };
  16635. LazyWrapper.prototype.slice = function(start, end) {
  16636. start = toInteger(start);
  16637. var result = this;
  16638. if (result.__filtered__ && (start > 0 || end < 0)) {
  16639. return new LazyWrapper(result);
  16640. }
  16641. if (start < 0) {
  16642. result = result.takeRight(-start);
  16643. } else if (start) {
  16644. result = result.drop(start);
  16645. }
  16646. if (end !== undefined) {
  16647. end = toInteger(end);
  16648. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  16649. }
  16650. return result;
  16651. };
  16652. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  16653. return this.reverse().takeWhile(predicate).reverse();
  16654. };
  16655. LazyWrapper.prototype.toArray = function() {
  16656. return this.take(MAX_ARRAY_LENGTH);
  16657. };
  16658. // Add `LazyWrapper` methods to `lodash.prototype`.
  16659. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16660. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  16661. isTaker = /^(?:head|last)$/.test(methodName),
  16662. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  16663. retUnwrapped = isTaker || /^find/.test(methodName);
  16664. if (!lodashFunc) {
  16665. return;
  16666. }
  16667. lodash.prototype[methodName] = function() {
  16668. var value = this.__wrapped__,
  16669. args = isTaker ? [1] : arguments,
  16670. isLazy = value instanceof LazyWrapper,
  16671. iteratee = args[0],
  16672. useLazy = isLazy || isArray(value);
  16673. var interceptor = function(value) {
  16674. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  16675. return (isTaker && chainAll) ? result[0] : result;
  16676. };
  16677. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  16678. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  16679. isLazy = useLazy = false;
  16680. }
  16681. var chainAll = this.__chain__,
  16682. isHybrid = !!this.__actions__.length,
  16683. isUnwrapped = retUnwrapped && !chainAll,
  16684. onlyLazy = isLazy && !isHybrid;
  16685. if (!retUnwrapped && useLazy) {
  16686. value = onlyLazy ? value : new LazyWrapper(this);
  16687. var result = func.apply(value, args);
  16688. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  16689. return new LodashWrapper(result, chainAll);
  16690. }
  16691. if (isUnwrapped && onlyLazy) {
  16692. return func.apply(this, args);
  16693. }
  16694. result = this.thru(interceptor);
  16695. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  16696. };
  16697. });
  16698. // Add `Array` methods to `lodash.prototype`.
  16699. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  16700. var func = arrayProto[methodName],
  16701. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  16702. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  16703. lodash.prototype[methodName] = function() {
  16704. var args = arguments;
  16705. if (retUnwrapped && !this.__chain__) {
  16706. var value = this.value();
  16707. return func.apply(isArray(value) ? value : [], args);
  16708. }
  16709. return this[chainName](function(value) {
  16710. return func.apply(isArray(value) ? value : [], args);
  16711. });
  16712. };
  16713. });
  16714. // Map minified method names to their real names.
  16715. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16716. var lodashFunc = lodash[methodName];
  16717. if (lodashFunc) {
  16718. var key = (lodashFunc.name + ''),
  16719. names = realNames[key] || (realNames[key] = []);
  16720. names.push({ 'name': methodName, 'func': lodashFunc });
  16721. }
  16722. });
  16723. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  16724. 'name': 'wrapper',
  16725. 'func': undefined
  16726. }];
  16727. // Add methods to `LazyWrapper`.
  16728. LazyWrapper.prototype.clone = lazyClone;
  16729. LazyWrapper.prototype.reverse = lazyReverse;
  16730. LazyWrapper.prototype.value = lazyValue;
  16731. // Add chain sequence methods to the `lodash` wrapper.
  16732. lodash.prototype.at = wrapperAt;
  16733. lodash.prototype.chain = wrapperChain;
  16734. lodash.prototype.commit = wrapperCommit;
  16735. lodash.prototype.next = wrapperNext;
  16736. lodash.prototype.plant = wrapperPlant;
  16737. lodash.prototype.reverse = wrapperReverse;
  16738. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  16739. // Add lazy aliases.
  16740. lodash.prototype.first = lodash.prototype.head;
  16741. if (symIterator) {
  16742. lodash.prototype[symIterator] = wrapperToIterator;
  16743. }
  16744. return lodash;
  16745. });
  16746. /*--------------------------------------------------------------------------*/
  16747. // Export lodash.
  16748. var _ = runInContext();
  16749. // Some AMD build optimizers, like r.js, check for condition patterns like:
  16750. if (true) {
  16751. // Expose Lodash on the global object to prevent errors when Lodash is
  16752. // loaded by a script tag in the presence of an AMD loader.
  16753. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  16754. // Use `_.noConflict` to remove Lodash from the global object.
  16755. root._ = _;
  16756. // Define as an anonymous module so, through path mapping, it can be
  16757. // referenced as the "underscore" module.
  16758. !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
  16759. return _;
  16760. }.call(exports, __webpack_require__, exports, module),
  16761. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16762. }
  16763. // Check for `exports` after `define` in case a build optimizer adds it.
  16764. else if (freeModule) {
  16765. // Export for Node.js.
  16766. (freeModule.exports = _)._ = _;
  16767. // Export for CommonJS support.
  16768. freeExports._ = _;
  16769. }
  16770. else {
  16771. // Export to the global object.
  16772. root._ = _;
  16773. }
  16774. }.call(this));
  16775. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(12)(module)))
  16776. /***/ }),
  16777. /* 12 */
  16778. /***/ (function(module, exports) {
  16779. module.exports = function(module) {
  16780. if(!module.webpackPolyfill) {
  16781. module.deprecate = function() {};
  16782. module.paths = [];
  16783. // module.parent = undefined by default
  16784. if(!module.children) module.children = [];
  16785. Object.defineProperty(module, "loaded", {
  16786. enumerable: true,
  16787. get: function() {
  16788. return module.l;
  16789. }
  16790. });
  16791. Object.defineProperty(module, "id", {
  16792. enumerable: true,
  16793. get: function() {
  16794. return module.i;
  16795. }
  16796. });
  16797. module.webpackPolyfill = 1;
  16798. }
  16799. return module;
  16800. };
  16801. /***/ }),
  16802. /* 13 */
  16803. /***/ (function(module, exports, __webpack_require__) {
  16804. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  16805. * jQuery JavaScript Library v3.2.1
  16806. * https://jquery.com/
  16807. *
  16808. * Includes Sizzle.js
  16809. * https://sizzlejs.com/
  16810. *
  16811. * Copyright JS Foundation and other contributors
  16812. * Released under the MIT license
  16813. * https://jquery.org/license
  16814. *
  16815. * Date: 2017-03-20T18:59Z
  16816. */
  16817. ( function( global, factory ) {
  16818. "use strict";
  16819. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16820. // For CommonJS and CommonJS-like environments where a proper `window`
  16821. // is present, execute the factory and get jQuery.
  16822. // For environments that do not have a `window` with a `document`
  16823. // (such as Node.js), expose a factory as module.exports.
  16824. // This accentuates the need for the creation of a real `window`.
  16825. // e.g. var jQuery = require("jquery")(window);
  16826. // See ticket #14549 for more info.
  16827. module.exports = global.document ?
  16828. factory( global, true ) :
  16829. function( w ) {
  16830. if ( !w.document ) {
  16831. throw new Error( "jQuery requires a window with a document" );
  16832. }
  16833. return factory( w );
  16834. };
  16835. } else {
  16836. factory( global );
  16837. }
  16838. // Pass this if window is not defined yet
  16839. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  16840. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  16841. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  16842. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  16843. // enough that all such attempts are guarded in a try block.
  16844. "use strict";
  16845. var arr = [];
  16846. var document = window.document;
  16847. var getProto = Object.getPrototypeOf;
  16848. var slice = arr.slice;
  16849. var concat = arr.concat;
  16850. var push = arr.push;
  16851. var indexOf = arr.indexOf;
  16852. var class2type = {};
  16853. var toString = class2type.toString;
  16854. var hasOwn = class2type.hasOwnProperty;
  16855. var fnToString = hasOwn.toString;
  16856. var ObjectFunctionString = fnToString.call( Object );
  16857. var support = {};
  16858. function DOMEval( code, doc ) {
  16859. doc = doc || document;
  16860. var script = doc.createElement( "script" );
  16861. script.text = code;
  16862. doc.head.appendChild( script ).parentNode.removeChild( script );
  16863. }
  16864. /* global Symbol */
  16865. // Defining this global in .eslintrc.json would create a danger of using the global
  16866. // unguarded in another place, it seems safer to define global only for this module
  16867. var
  16868. version = "3.2.1",
  16869. // Define a local copy of jQuery
  16870. jQuery = function( selector, context ) {
  16871. // The jQuery object is actually just the init constructor 'enhanced'
  16872. // Need init if jQuery is called (just allow error to be thrown if not included)
  16873. return new jQuery.fn.init( selector, context );
  16874. },
  16875. // Support: Android <=4.0 only
  16876. // Make sure we trim BOM and NBSP
  16877. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  16878. // Matches dashed string for camelizing
  16879. rmsPrefix = /^-ms-/,
  16880. rdashAlpha = /-([a-z])/g,
  16881. // Used by jQuery.camelCase as callback to replace()
  16882. fcamelCase = function( all, letter ) {
  16883. return letter.toUpperCase();
  16884. };
  16885. jQuery.fn = jQuery.prototype = {
  16886. // The current version of jQuery being used
  16887. jquery: version,
  16888. constructor: jQuery,
  16889. // The default length of a jQuery object is 0
  16890. length: 0,
  16891. toArray: function() {
  16892. return slice.call( this );
  16893. },
  16894. // Get the Nth element in the matched element set OR
  16895. // Get the whole matched element set as a clean array
  16896. get: function( num ) {
  16897. // Return all the elements in a clean array
  16898. if ( num == null ) {
  16899. return slice.call( this );
  16900. }
  16901. // Return just the one element from the set
  16902. return num < 0 ? this[ num + this.length ] : this[ num ];
  16903. },
  16904. // Take an array of elements and push it onto the stack
  16905. // (returning the new matched element set)
  16906. pushStack: function( elems ) {
  16907. // Build a new jQuery matched element set
  16908. var ret = jQuery.merge( this.constructor(), elems );
  16909. // Add the old object onto the stack (as a reference)
  16910. ret.prevObject = this;
  16911. // Return the newly-formed element set
  16912. return ret;
  16913. },
  16914. // Execute a callback for every element in the matched set.
  16915. each: function( callback ) {
  16916. return jQuery.each( this, callback );
  16917. },
  16918. map: function( callback ) {
  16919. return this.pushStack( jQuery.map( this, function( elem, i ) {
  16920. return callback.call( elem, i, elem );
  16921. } ) );
  16922. },
  16923. slice: function() {
  16924. return this.pushStack( slice.apply( this, arguments ) );
  16925. },
  16926. first: function() {
  16927. return this.eq( 0 );
  16928. },
  16929. last: function() {
  16930. return this.eq( -1 );
  16931. },
  16932. eq: function( i ) {
  16933. var len = this.length,
  16934. j = +i + ( i < 0 ? len : 0 );
  16935. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  16936. },
  16937. end: function() {
  16938. return this.prevObject || this.constructor();
  16939. },
  16940. // For internal use only.
  16941. // Behaves like an Array's method, not like a jQuery method.
  16942. push: push,
  16943. sort: arr.sort,
  16944. splice: arr.splice
  16945. };
  16946. jQuery.extend = jQuery.fn.extend = function() {
  16947. var options, name, src, copy, copyIsArray, clone,
  16948. target = arguments[ 0 ] || {},
  16949. i = 1,
  16950. length = arguments.length,
  16951. deep = false;
  16952. // Handle a deep copy situation
  16953. if ( typeof target === "boolean" ) {
  16954. deep = target;
  16955. // Skip the boolean and the target
  16956. target = arguments[ i ] || {};
  16957. i++;
  16958. }
  16959. // Handle case when target is a string or something (possible in deep copy)
  16960. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  16961. target = {};
  16962. }
  16963. // Extend jQuery itself if only one argument is passed
  16964. if ( i === length ) {
  16965. target = this;
  16966. i--;
  16967. }
  16968. for ( ; i < length; i++ ) {
  16969. // Only deal with non-null/undefined values
  16970. if ( ( options = arguments[ i ] ) != null ) {
  16971. // Extend the base object
  16972. for ( name in options ) {
  16973. src = target[ name ];
  16974. copy = options[ name ];
  16975. // Prevent never-ending loop
  16976. if ( target === copy ) {
  16977. continue;
  16978. }
  16979. // Recurse if we're merging plain objects or arrays
  16980. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  16981. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  16982. if ( copyIsArray ) {
  16983. copyIsArray = false;
  16984. clone = src && Array.isArray( src ) ? src : [];
  16985. } else {
  16986. clone = src && jQuery.isPlainObject( src ) ? src : {};
  16987. }
  16988. // Never move original objects, clone them
  16989. target[ name ] = jQuery.extend( deep, clone, copy );
  16990. // Don't bring in undefined values
  16991. } else if ( copy !== undefined ) {
  16992. target[ name ] = copy;
  16993. }
  16994. }
  16995. }
  16996. }
  16997. // Return the modified object
  16998. return target;
  16999. };
  17000. jQuery.extend( {
  17001. // Unique for each copy of jQuery on the page
  17002. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  17003. // Assume jQuery is ready without the ready module
  17004. isReady: true,
  17005. error: function( msg ) {
  17006. throw new Error( msg );
  17007. },
  17008. noop: function() {},
  17009. isFunction: function( obj ) {
  17010. return jQuery.type( obj ) === "function";
  17011. },
  17012. isWindow: function( obj ) {
  17013. return obj != null && obj === obj.window;
  17014. },
  17015. isNumeric: function( obj ) {
  17016. // As of jQuery 3.0, isNumeric is limited to
  17017. // strings and numbers (primitives or objects)
  17018. // that can be coerced to finite numbers (gh-2662)
  17019. var type = jQuery.type( obj );
  17020. return ( type === "number" || type === "string" ) &&
  17021. // parseFloat NaNs numeric-cast false positives ("")
  17022. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17023. // subtraction forces infinities to NaN
  17024. !isNaN( obj - parseFloat( obj ) );
  17025. },
  17026. isPlainObject: function( obj ) {
  17027. var proto, Ctor;
  17028. // Detect obvious negatives
  17029. // Use toString instead of jQuery.type to catch host objects
  17030. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  17031. return false;
  17032. }
  17033. proto = getProto( obj );
  17034. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  17035. if ( !proto ) {
  17036. return true;
  17037. }
  17038. // Objects with prototype are plain iff they were constructed by a global Object function
  17039. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  17040. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  17041. },
  17042. isEmptyObject: function( obj ) {
  17043. /* eslint-disable no-unused-vars */
  17044. // See https://github.com/eslint/eslint/issues/6125
  17045. var name;
  17046. for ( name in obj ) {
  17047. return false;
  17048. }
  17049. return true;
  17050. },
  17051. type: function( obj ) {
  17052. if ( obj == null ) {
  17053. return obj + "";
  17054. }
  17055. // Support: Android <=2.3 only (functionish RegExp)
  17056. return typeof obj === "object" || typeof obj === "function" ?
  17057. class2type[ toString.call( obj ) ] || "object" :
  17058. typeof obj;
  17059. },
  17060. // Evaluates a script in a global context
  17061. globalEval: function( code ) {
  17062. DOMEval( code );
  17063. },
  17064. // Convert dashed to camelCase; used by the css and data modules
  17065. // Support: IE <=9 - 11, Edge 12 - 13
  17066. // Microsoft forgot to hump their vendor prefix (#9572)
  17067. camelCase: function( string ) {
  17068. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  17069. },
  17070. each: function( obj, callback ) {
  17071. var length, i = 0;
  17072. if ( isArrayLike( obj ) ) {
  17073. length = obj.length;
  17074. for ( ; i < length; i++ ) {
  17075. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17076. break;
  17077. }
  17078. }
  17079. } else {
  17080. for ( i in obj ) {
  17081. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17082. break;
  17083. }
  17084. }
  17085. }
  17086. return obj;
  17087. },
  17088. // Support: Android <=4.0 only
  17089. trim: function( text ) {
  17090. return text == null ?
  17091. "" :
  17092. ( text + "" ).replace( rtrim, "" );
  17093. },
  17094. // results is for internal usage only
  17095. makeArray: function( arr, results ) {
  17096. var ret = results || [];
  17097. if ( arr != null ) {
  17098. if ( isArrayLike( Object( arr ) ) ) {
  17099. jQuery.merge( ret,
  17100. typeof arr === "string" ?
  17101. [ arr ] : arr
  17102. );
  17103. } else {
  17104. push.call( ret, arr );
  17105. }
  17106. }
  17107. return ret;
  17108. },
  17109. inArray: function( elem, arr, i ) {
  17110. return arr == null ? -1 : indexOf.call( arr, elem, i );
  17111. },
  17112. // Support: Android <=4.0 only, PhantomJS 1 only
  17113. // push.apply(_, arraylike) throws on ancient WebKit
  17114. merge: function( first, second ) {
  17115. var len = +second.length,
  17116. j = 0,
  17117. i = first.length;
  17118. for ( ; j < len; j++ ) {
  17119. first[ i++ ] = second[ j ];
  17120. }
  17121. first.length = i;
  17122. return first;
  17123. },
  17124. grep: function( elems, callback, invert ) {
  17125. var callbackInverse,
  17126. matches = [],
  17127. i = 0,
  17128. length = elems.length,
  17129. callbackExpect = !invert;
  17130. // Go through the array, only saving the items
  17131. // that pass the validator function
  17132. for ( ; i < length; i++ ) {
  17133. callbackInverse = !callback( elems[ i ], i );
  17134. if ( callbackInverse !== callbackExpect ) {
  17135. matches.push( elems[ i ] );
  17136. }
  17137. }
  17138. return matches;
  17139. },
  17140. // arg is for internal usage only
  17141. map: function( elems, callback, arg ) {
  17142. var length, value,
  17143. i = 0,
  17144. ret = [];
  17145. // Go through the array, translating each of the items to their new values
  17146. if ( isArrayLike( elems ) ) {
  17147. length = elems.length;
  17148. for ( ; i < length; i++ ) {
  17149. value = callback( elems[ i ], i, arg );
  17150. if ( value != null ) {
  17151. ret.push( value );
  17152. }
  17153. }
  17154. // Go through every key on the object,
  17155. } else {
  17156. for ( i in elems ) {
  17157. value = callback( elems[ i ], i, arg );
  17158. if ( value != null ) {
  17159. ret.push( value );
  17160. }
  17161. }
  17162. }
  17163. // Flatten any nested arrays
  17164. return concat.apply( [], ret );
  17165. },
  17166. // A global GUID counter for objects
  17167. guid: 1,
  17168. // Bind a function to a context, optionally partially applying any
  17169. // arguments.
  17170. proxy: function( fn, context ) {
  17171. var tmp, args, proxy;
  17172. if ( typeof context === "string" ) {
  17173. tmp = fn[ context ];
  17174. context = fn;
  17175. fn = tmp;
  17176. }
  17177. // Quick check to determine if target is callable, in the spec
  17178. // this throws a TypeError, but we will just return undefined.
  17179. if ( !jQuery.isFunction( fn ) ) {
  17180. return undefined;
  17181. }
  17182. // Simulated bind
  17183. args = slice.call( arguments, 2 );
  17184. proxy = function() {
  17185. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17186. };
  17187. // Set the guid of unique handler to the same of original handler, so it can be removed
  17188. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17189. return proxy;
  17190. },
  17191. now: Date.now,
  17192. // jQuery.support is not used in Core but other projects attach their
  17193. // properties to it so it needs to exist.
  17194. support: support
  17195. } );
  17196. if ( typeof Symbol === "function" ) {
  17197. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  17198. }
  17199. // Populate the class2type map
  17200. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  17201. function( i, name ) {
  17202. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  17203. } );
  17204. function isArrayLike( obj ) {
  17205. // Support: real iOS 8.2 only (not reproducible in simulator)
  17206. // `in` check used to prevent JIT error (gh-2145)
  17207. // hasOwn isn't used here due to false negatives
  17208. // regarding Nodelist length in IE
  17209. var length = !!obj && "length" in obj && obj.length,
  17210. type = jQuery.type( obj );
  17211. if ( type === "function" || jQuery.isWindow( obj ) ) {
  17212. return false;
  17213. }
  17214. return type === "array" || length === 0 ||
  17215. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  17216. }
  17217. var Sizzle =
  17218. /*!
  17219. * Sizzle CSS Selector Engine v2.3.3
  17220. * https://sizzlejs.com/
  17221. *
  17222. * Copyright jQuery Foundation and other contributors
  17223. * Released under the MIT license
  17224. * http://jquery.org/license
  17225. *
  17226. * Date: 2016-08-08
  17227. */
  17228. (function( window ) {
  17229. var i,
  17230. support,
  17231. Expr,
  17232. getText,
  17233. isXML,
  17234. tokenize,
  17235. compile,
  17236. select,
  17237. outermostContext,
  17238. sortInput,
  17239. hasDuplicate,
  17240. // Local document vars
  17241. setDocument,
  17242. document,
  17243. docElem,
  17244. documentIsHTML,
  17245. rbuggyQSA,
  17246. rbuggyMatches,
  17247. matches,
  17248. contains,
  17249. // Instance-specific data
  17250. expando = "sizzle" + 1 * new Date(),
  17251. preferredDoc = window.document,
  17252. dirruns = 0,
  17253. done = 0,
  17254. classCache = createCache(),
  17255. tokenCache = createCache(),
  17256. compilerCache = createCache(),
  17257. sortOrder = function( a, b ) {
  17258. if ( a === b ) {
  17259. hasDuplicate = true;
  17260. }
  17261. return 0;
  17262. },
  17263. // Instance methods
  17264. hasOwn = ({}).hasOwnProperty,
  17265. arr = [],
  17266. pop = arr.pop,
  17267. push_native = arr.push,
  17268. push = arr.push,
  17269. slice = arr.slice,
  17270. // Use a stripped-down indexOf as it's faster than native
  17271. // https://jsperf.com/thor-indexof-vs-for/5
  17272. indexOf = function( list, elem ) {
  17273. var i = 0,
  17274. len = list.length;
  17275. for ( ; i < len; i++ ) {
  17276. if ( list[i] === elem ) {
  17277. return i;
  17278. }
  17279. }
  17280. return -1;
  17281. },
  17282. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  17283. // Regular expressions
  17284. // http://www.w3.org/TR/css3-selectors/#whitespace
  17285. whitespace = "[\\x20\\t\\r\\n\\f]",
  17286. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  17287. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  17288. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  17289. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  17290. // Operator (capture 2)
  17291. "*([*^$|!~]?=)" + whitespace +
  17292. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  17293. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  17294. "*\\]",
  17295. pseudos = ":(" + identifier + ")(?:\\((" +
  17296. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  17297. // 1. quoted (capture 3; capture 4 or capture 5)
  17298. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  17299. // 2. simple (capture 6)
  17300. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  17301. // 3. anything else (capture 2)
  17302. ".*" +
  17303. ")\\)|)",
  17304. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  17305. rwhitespace = new RegExp( whitespace + "+", "g" ),
  17306. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  17307. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  17308. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  17309. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  17310. rpseudo = new RegExp( pseudos ),
  17311. ridentifier = new RegExp( "^" + identifier + "$" ),
  17312. matchExpr = {
  17313. "ID": new RegExp( "^#(" + identifier + ")" ),
  17314. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  17315. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  17316. "ATTR": new RegExp( "^" + attributes ),
  17317. "PSEUDO": new RegExp( "^" + pseudos ),
  17318. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  17319. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  17320. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  17321. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  17322. // For use in libraries implementing .is()
  17323. // We use this for POS matching in `select`
  17324. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  17325. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  17326. },
  17327. rinputs = /^(?:input|select|textarea|button)$/i,
  17328. rheader = /^h\d$/i,
  17329. rnative = /^[^{]+\{\s*\[native \w/,
  17330. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  17331. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  17332. rsibling = /[+~]/,
  17333. // CSS escapes
  17334. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  17335. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  17336. funescape = function( _, escaped, escapedWhitespace ) {
  17337. var high = "0x" + escaped - 0x10000;
  17338. // NaN means non-codepoint
  17339. // Support: Firefox<24
  17340. // Workaround erroneous numeric interpretation of +"0x"
  17341. return high !== high || escapedWhitespace ?
  17342. escaped :
  17343. high < 0 ?
  17344. // BMP codepoint
  17345. String.fromCharCode( high + 0x10000 ) :
  17346. // Supplemental Plane codepoint (surrogate pair)
  17347. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  17348. },
  17349. // CSS string/identifier serialization
  17350. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  17351. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  17352. fcssescape = function( ch, asCodePoint ) {
  17353. if ( asCodePoint ) {
  17354. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  17355. if ( ch === "\0" ) {
  17356. return "\uFFFD";
  17357. }
  17358. // Control characters and (dependent upon position) numbers get escaped as code points
  17359. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  17360. }
  17361. // Other potentially-special ASCII characters get backslash-escaped
  17362. return "\\" + ch;
  17363. },
  17364. // Used for iframes
  17365. // See setDocument()
  17366. // Removing the function wrapper causes a "Permission Denied"
  17367. // error in IE
  17368. unloadHandler = function() {
  17369. setDocument();
  17370. },
  17371. disabledAncestor = addCombinator(
  17372. function( elem ) {
  17373. return elem.disabled === true && ("form" in elem || "label" in elem);
  17374. },
  17375. { dir: "parentNode", next: "legend" }
  17376. );
  17377. // Optimize for push.apply( _, NodeList )
  17378. try {
  17379. push.apply(
  17380. (arr = slice.call( preferredDoc.childNodes )),
  17381. preferredDoc.childNodes
  17382. );
  17383. // Support: Android<4.0
  17384. // Detect silently failing push.apply
  17385. arr[ preferredDoc.childNodes.length ].nodeType;
  17386. } catch ( e ) {
  17387. push = { apply: arr.length ?
  17388. // Leverage slice if possible
  17389. function( target, els ) {
  17390. push_native.apply( target, slice.call(els) );
  17391. } :
  17392. // Support: IE<9
  17393. // Otherwise append directly
  17394. function( target, els ) {
  17395. var j = target.length,
  17396. i = 0;
  17397. // Can't trust NodeList.length
  17398. while ( (target[j++] = els[i++]) ) {}
  17399. target.length = j - 1;
  17400. }
  17401. };
  17402. }
  17403. function Sizzle( selector, context, results, seed ) {
  17404. var m, i, elem, nid, match, groups, newSelector,
  17405. newContext = context && context.ownerDocument,
  17406. // nodeType defaults to 9, since context defaults to document
  17407. nodeType = context ? context.nodeType : 9;
  17408. results = results || [];
  17409. // Return early from calls with invalid selector or context
  17410. if ( typeof selector !== "string" || !selector ||
  17411. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  17412. return results;
  17413. }
  17414. // Try to shortcut find operations (as opposed to filters) in HTML documents
  17415. if ( !seed ) {
  17416. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  17417. setDocument( context );
  17418. }
  17419. context = context || document;
  17420. if ( documentIsHTML ) {
  17421. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  17422. // (excepting DocumentFragment context, where the methods don't exist)
  17423. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  17424. // ID selector
  17425. if ( (m = match[1]) ) {
  17426. // Document context
  17427. if ( nodeType === 9 ) {
  17428. if ( (elem = context.getElementById( m )) ) {
  17429. // Support: IE, Opera, Webkit
  17430. // TODO: identify versions
  17431. // getElementById can match elements by name instead of ID
  17432. if ( elem.id === m ) {
  17433. results.push( elem );
  17434. return results;
  17435. }
  17436. } else {
  17437. return results;
  17438. }
  17439. // Element context
  17440. } else {
  17441. // Support: IE, Opera, Webkit
  17442. // TODO: identify versions
  17443. // getElementById can match elements by name instead of ID
  17444. if ( newContext && (elem = newContext.getElementById( m )) &&
  17445. contains( context, elem ) &&
  17446. elem.id === m ) {
  17447. results.push( elem );
  17448. return results;
  17449. }
  17450. }
  17451. // Type selector
  17452. } else if ( match[2] ) {
  17453. push.apply( results, context.getElementsByTagName( selector ) );
  17454. return results;
  17455. // Class selector
  17456. } else if ( (m = match[3]) && support.getElementsByClassName &&
  17457. context.getElementsByClassName ) {
  17458. push.apply( results, context.getElementsByClassName( m ) );
  17459. return results;
  17460. }
  17461. }
  17462. // Take advantage of querySelectorAll
  17463. if ( support.qsa &&
  17464. !compilerCache[ selector + " " ] &&
  17465. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  17466. if ( nodeType !== 1 ) {
  17467. newContext = context;
  17468. newSelector = selector;
  17469. // qSA looks outside Element context, which is not what we want
  17470. // Thanks to Andrew Dupont for this workaround technique
  17471. // Support: IE <=8
  17472. // Exclude object elements
  17473. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  17474. // Capture the context ID, setting it first if necessary
  17475. if ( (nid = context.getAttribute( "id" )) ) {
  17476. nid = nid.replace( rcssescape, fcssescape );
  17477. } else {
  17478. context.setAttribute( "id", (nid = expando) );
  17479. }
  17480. // Prefix every selector in the list
  17481. groups = tokenize( selector );
  17482. i = groups.length;
  17483. while ( i-- ) {
  17484. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  17485. }
  17486. newSelector = groups.join( "," );
  17487. // Expand context for sibling selectors
  17488. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  17489. context;
  17490. }
  17491. if ( newSelector ) {
  17492. try {
  17493. push.apply( results,
  17494. newContext.querySelectorAll( newSelector )
  17495. );
  17496. return results;
  17497. } catch ( qsaError ) {
  17498. } finally {
  17499. if ( nid === expando ) {
  17500. context.removeAttribute( "id" );
  17501. }
  17502. }
  17503. }
  17504. }
  17505. }
  17506. }
  17507. // All others
  17508. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  17509. }
  17510. /**
  17511. * Create key-value caches of limited size
  17512. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  17513. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  17514. * deleting the oldest entry
  17515. */
  17516. function createCache() {
  17517. var keys = [];
  17518. function cache( key, value ) {
  17519. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  17520. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  17521. // Only keep the most recent entries
  17522. delete cache[ keys.shift() ];
  17523. }
  17524. return (cache[ key + " " ] = value);
  17525. }
  17526. return cache;
  17527. }
  17528. /**
  17529. * Mark a function for special use by Sizzle
  17530. * @param {Function} fn The function to mark
  17531. */
  17532. function markFunction( fn ) {
  17533. fn[ expando ] = true;
  17534. return fn;
  17535. }
  17536. /**
  17537. * Support testing using an element
  17538. * @param {Function} fn Passed the created element and returns a boolean result
  17539. */
  17540. function assert( fn ) {
  17541. var el = document.createElement("fieldset");
  17542. try {
  17543. return !!fn( el );
  17544. } catch (e) {
  17545. return false;
  17546. } finally {
  17547. // Remove from its parent by default
  17548. if ( el.parentNode ) {
  17549. el.parentNode.removeChild( el );
  17550. }
  17551. // release memory in IE
  17552. el = null;
  17553. }
  17554. }
  17555. /**
  17556. * Adds the same handler for all of the specified attrs
  17557. * @param {String} attrs Pipe-separated list of attributes
  17558. * @param {Function} handler The method that will be applied
  17559. */
  17560. function addHandle( attrs, handler ) {
  17561. var arr = attrs.split("|"),
  17562. i = arr.length;
  17563. while ( i-- ) {
  17564. Expr.attrHandle[ arr[i] ] = handler;
  17565. }
  17566. }
  17567. /**
  17568. * Checks document order of two siblings
  17569. * @param {Element} a
  17570. * @param {Element} b
  17571. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  17572. */
  17573. function siblingCheck( a, b ) {
  17574. var cur = b && a,
  17575. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  17576. a.sourceIndex - b.sourceIndex;
  17577. // Use IE sourceIndex if available on both nodes
  17578. if ( diff ) {
  17579. return diff;
  17580. }
  17581. // Check if b follows a
  17582. if ( cur ) {
  17583. while ( (cur = cur.nextSibling) ) {
  17584. if ( cur === b ) {
  17585. return -1;
  17586. }
  17587. }
  17588. }
  17589. return a ? 1 : -1;
  17590. }
  17591. /**
  17592. * Returns a function to use in pseudos for input types
  17593. * @param {String} type
  17594. */
  17595. function createInputPseudo( type ) {
  17596. return function( elem ) {
  17597. var name = elem.nodeName.toLowerCase();
  17598. return name === "input" && elem.type === type;
  17599. };
  17600. }
  17601. /**
  17602. * Returns a function to use in pseudos for buttons
  17603. * @param {String} type
  17604. */
  17605. function createButtonPseudo( type ) {
  17606. return function( elem ) {
  17607. var name = elem.nodeName.toLowerCase();
  17608. return (name === "input" || name === "button") && elem.type === type;
  17609. };
  17610. }
  17611. /**
  17612. * Returns a function to use in pseudos for :enabled/:disabled
  17613. * @param {Boolean} disabled true for :disabled; false for :enabled
  17614. */
  17615. function createDisabledPseudo( disabled ) {
  17616. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  17617. return function( elem ) {
  17618. // Only certain elements can match :enabled or :disabled
  17619. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  17620. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  17621. if ( "form" in elem ) {
  17622. // Check for inherited disabledness on relevant non-disabled elements:
  17623. // * listed form-associated elements in a disabled fieldset
  17624. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  17625. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  17626. // * option elements in a disabled optgroup
  17627. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  17628. // All such elements have a "form" property.
  17629. if ( elem.parentNode && elem.disabled === false ) {
  17630. // Option elements defer to a parent optgroup if present
  17631. if ( "label" in elem ) {
  17632. if ( "label" in elem.parentNode ) {
  17633. return elem.parentNode.disabled === disabled;
  17634. } else {
  17635. return elem.disabled === disabled;
  17636. }
  17637. }
  17638. // Support: IE 6 - 11
  17639. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  17640. return elem.isDisabled === disabled ||
  17641. // Where there is no isDisabled, check manually
  17642. /* jshint -W018 */
  17643. elem.isDisabled !== !disabled &&
  17644. disabledAncestor( elem ) === disabled;
  17645. }
  17646. return elem.disabled === disabled;
  17647. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  17648. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  17649. // even exist on them, let alone have a boolean value.
  17650. } else if ( "label" in elem ) {
  17651. return elem.disabled === disabled;
  17652. }
  17653. // Remaining elements are neither :enabled nor :disabled
  17654. return false;
  17655. };
  17656. }
  17657. /**
  17658. * Returns a function to use in pseudos for positionals
  17659. * @param {Function} fn
  17660. */
  17661. function createPositionalPseudo( fn ) {
  17662. return markFunction(function( argument ) {
  17663. argument = +argument;
  17664. return markFunction(function( seed, matches ) {
  17665. var j,
  17666. matchIndexes = fn( [], seed.length, argument ),
  17667. i = matchIndexes.length;
  17668. // Match elements found at the specified indexes
  17669. while ( i-- ) {
  17670. if ( seed[ (j = matchIndexes[i]) ] ) {
  17671. seed[j] = !(matches[j] = seed[j]);
  17672. }
  17673. }
  17674. });
  17675. });
  17676. }
  17677. /**
  17678. * Checks a node for validity as a Sizzle context
  17679. * @param {Element|Object=} context
  17680. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  17681. */
  17682. function testContext( context ) {
  17683. return context && typeof context.getElementsByTagName !== "undefined" && context;
  17684. }
  17685. // Expose support vars for convenience
  17686. support = Sizzle.support = {};
  17687. /**
  17688. * Detects XML nodes
  17689. * @param {Element|Object} elem An element or a document
  17690. * @returns {Boolean} True iff elem is a non-HTML XML node
  17691. */
  17692. isXML = Sizzle.isXML = function( elem ) {
  17693. // documentElement is verified for cases where it doesn't yet exist
  17694. // (such as loading iframes in IE - #4833)
  17695. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  17696. return documentElement ? documentElement.nodeName !== "HTML" : false;
  17697. };
  17698. /**
  17699. * Sets document-related variables once based on the current document
  17700. * @param {Element|Object} [doc] An element or document object to use to set the document
  17701. * @returns {Object} Returns the current document
  17702. */
  17703. setDocument = Sizzle.setDocument = function( node ) {
  17704. var hasCompare, subWindow,
  17705. doc = node ? node.ownerDocument || node : preferredDoc;
  17706. // Return early if doc is invalid or already selected
  17707. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  17708. return document;
  17709. }
  17710. // Update global variables
  17711. document = doc;
  17712. docElem = document.documentElement;
  17713. documentIsHTML = !isXML( document );
  17714. // Support: IE 9-11, Edge
  17715. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  17716. if ( preferredDoc !== document &&
  17717. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  17718. // Support: IE 11, Edge
  17719. if ( subWindow.addEventListener ) {
  17720. subWindow.addEventListener( "unload", unloadHandler, false );
  17721. // Support: IE 9 - 10 only
  17722. } else if ( subWindow.attachEvent ) {
  17723. subWindow.attachEvent( "onunload", unloadHandler );
  17724. }
  17725. }
  17726. /* Attributes
  17727. ---------------------------------------------------------------------- */
  17728. // Support: IE<8
  17729. // Verify that getAttribute really returns attributes and not properties
  17730. // (excepting IE8 booleans)
  17731. support.attributes = assert(function( el ) {
  17732. el.className = "i";
  17733. return !el.getAttribute("className");
  17734. });
  17735. /* getElement(s)By*
  17736. ---------------------------------------------------------------------- */
  17737. // Check if getElementsByTagName("*") returns only elements
  17738. support.getElementsByTagName = assert(function( el ) {
  17739. el.appendChild( document.createComment("") );
  17740. return !el.getElementsByTagName("*").length;
  17741. });
  17742. // Support: IE<9
  17743. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  17744. // Support: IE<10
  17745. // Check if getElementById returns elements by name
  17746. // The broken getElementById methods don't pick up programmatically-set names,
  17747. // so use a roundabout getElementsByName test
  17748. support.getById = assert(function( el ) {
  17749. docElem.appendChild( el ).id = expando;
  17750. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  17751. });
  17752. // ID filter and find
  17753. if ( support.getById ) {
  17754. Expr.filter["ID"] = function( id ) {
  17755. var attrId = id.replace( runescape, funescape );
  17756. return function( elem ) {
  17757. return elem.getAttribute("id") === attrId;
  17758. };
  17759. };
  17760. Expr.find["ID"] = function( id, context ) {
  17761. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17762. var elem = context.getElementById( id );
  17763. return elem ? [ elem ] : [];
  17764. }
  17765. };
  17766. } else {
  17767. Expr.filter["ID"] = function( id ) {
  17768. var attrId = id.replace( runescape, funescape );
  17769. return function( elem ) {
  17770. var node = typeof elem.getAttributeNode !== "undefined" &&
  17771. elem.getAttributeNode("id");
  17772. return node && node.value === attrId;
  17773. };
  17774. };
  17775. // Support: IE 6 - 7 only
  17776. // getElementById is not reliable as a find shortcut
  17777. Expr.find["ID"] = function( id, context ) {
  17778. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17779. var node, i, elems,
  17780. elem = context.getElementById( id );
  17781. if ( elem ) {
  17782. // Verify the id attribute
  17783. node = elem.getAttributeNode("id");
  17784. if ( node && node.value === id ) {
  17785. return [ elem ];
  17786. }
  17787. // Fall back on getElementsByName
  17788. elems = context.getElementsByName( id );
  17789. i = 0;
  17790. while ( (elem = elems[i++]) ) {
  17791. node = elem.getAttributeNode("id");
  17792. if ( node && node.value === id ) {
  17793. return [ elem ];
  17794. }
  17795. }
  17796. }
  17797. return [];
  17798. }
  17799. };
  17800. }
  17801. // Tag
  17802. Expr.find["TAG"] = support.getElementsByTagName ?
  17803. function( tag, context ) {
  17804. if ( typeof context.getElementsByTagName !== "undefined" ) {
  17805. return context.getElementsByTagName( tag );
  17806. // DocumentFragment nodes don't have gEBTN
  17807. } else if ( support.qsa ) {
  17808. return context.querySelectorAll( tag );
  17809. }
  17810. } :
  17811. function( tag, context ) {
  17812. var elem,
  17813. tmp = [],
  17814. i = 0,
  17815. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  17816. results = context.getElementsByTagName( tag );
  17817. // Filter out possible comments
  17818. if ( tag === "*" ) {
  17819. while ( (elem = results[i++]) ) {
  17820. if ( elem.nodeType === 1 ) {
  17821. tmp.push( elem );
  17822. }
  17823. }
  17824. return tmp;
  17825. }
  17826. return results;
  17827. };
  17828. // Class
  17829. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  17830. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  17831. return context.getElementsByClassName( className );
  17832. }
  17833. };
  17834. /* QSA/matchesSelector
  17835. ---------------------------------------------------------------------- */
  17836. // QSA and matchesSelector support
  17837. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  17838. rbuggyMatches = [];
  17839. // qSa(:focus) reports false when true (Chrome 21)
  17840. // We allow this because of a bug in IE8/9 that throws an error
  17841. // whenever `document.activeElement` is accessed on an iframe
  17842. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  17843. // See https://bugs.jquery.com/ticket/13378
  17844. rbuggyQSA = [];
  17845. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  17846. // Build QSA regex
  17847. // Regex strategy adopted from Diego Perini
  17848. assert(function( el ) {
  17849. // Select is set to empty string on purpose
  17850. // This is to test IE's treatment of not explicitly
  17851. // setting a boolean content attribute,
  17852. // since its presence should be enough
  17853. // https://bugs.jquery.com/ticket/12359
  17854. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  17855. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  17856. "<option selected=''></option></select>";
  17857. // Support: IE8, Opera 11-12.16
  17858. // Nothing should be selected when empty strings follow ^= or $= or *=
  17859. // The test attribute must be unknown in Opera but "safe" for WinRT
  17860. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  17861. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  17862. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  17863. }
  17864. // Support: IE8
  17865. // Boolean attributes and "value" are not treated correctly
  17866. if ( !el.querySelectorAll("[selected]").length ) {
  17867. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  17868. }
  17869. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  17870. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  17871. rbuggyQSA.push("~=");
  17872. }
  17873. // Webkit/Opera - :checked should return selected option elements
  17874. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  17875. // IE8 throws error here and will not see later tests
  17876. if ( !el.querySelectorAll(":checked").length ) {
  17877. rbuggyQSA.push(":checked");
  17878. }
  17879. // Support: Safari 8+, iOS 8+
  17880. // https://bugs.webkit.org/show_bug.cgi?id=136851
  17881. // In-page `selector#id sibling-combinator selector` fails
  17882. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  17883. rbuggyQSA.push(".#.+[+~]");
  17884. }
  17885. });
  17886. assert(function( el ) {
  17887. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  17888. "<select disabled='disabled'><option/></select>";
  17889. // Support: Windows 8 Native Apps
  17890. // The type and name attributes are restricted during .innerHTML assignment
  17891. var input = document.createElement("input");
  17892. input.setAttribute( "type", "hidden" );
  17893. el.appendChild( input ).setAttribute( "name", "D" );
  17894. // Support: IE8
  17895. // Enforce case-sensitivity of name attribute
  17896. if ( el.querySelectorAll("[name=d]").length ) {
  17897. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  17898. }
  17899. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  17900. // IE8 throws error here and will not see later tests
  17901. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  17902. rbuggyQSA.push( ":enabled", ":disabled" );
  17903. }
  17904. // Support: IE9-11+
  17905. // IE's :disabled selector does not pick up the children of disabled fieldsets
  17906. docElem.appendChild( el ).disabled = true;
  17907. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  17908. rbuggyQSA.push( ":enabled", ":disabled" );
  17909. }
  17910. // Opera 10-11 does not throw on post-comma invalid pseudos
  17911. el.querySelectorAll("*,:x");
  17912. rbuggyQSA.push(",.*:");
  17913. });
  17914. }
  17915. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  17916. docElem.webkitMatchesSelector ||
  17917. docElem.mozMatchesSelector ||
  17918. docElem.oMatchesSelector ||
  17919. docElem.msMatchesSelector) )) ) {
  17920. assert(function( el ) {
  17921. // Check to see if it's possible to do matchesSelector
  17922. // on a disconnected node (IE 9)
  17923. support.disconnectedMatch = matches.call( el, "*" );
  17924. // This should fail with an exception
  17925. // Gecko does not error, returns false instead
  17926. matches.call( el, "[s!='']:x" );
  17927. rbuggyMatches.push( "!=", pseudos );
  17928. });
  17929. }
  17930. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  17931. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  17932. /* Contains
  17933. ---------------------------------------------------------------------- */
  17934. hasCompare = rnative.test( docElem.compareDocumentPosition );
  17935. // Element contains another
  17936. // Purposefully self-exclusive
  17937. // As in, an element does not contain itself
  17938. contains = hasCompare || rnative.test( docElem.contains ) ?
  17939. function( a, b ) {
  17940. var adown = a.nodeType === 9 ? a.documentElement : a,
  17941. bup = b && b.parentNode;
  17942. return a === bup || !!( bup && bup.nodeType === 1 && (
  17943. adown.contains ?
  17944. adown.contains( bup ) :
  17945. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  17946. ));
  17947. } :
  17948. function( a, b ) {
  17949. if ( b ) {
  17950. while ( (b = b.parentNode) ) {
  17951. if ( b === a ) {
  17952. return true;
  17953. }
  17954. }
  17955. }
  17956. return false;
  17957. };
  17958. /* Sorting
  17959. ---------------------------------------------------------------------- */
  17960. // Document order sorting
  17961. sortOrder = hasCompare ?
  17962. function( a, b ) {
  17963. // Flag for duplicate removal
  17964. if ( a === b ) {
  17965. hasDuplicate = true;
  17966. return 0;
  17967. }
  17968. // Sort on method existence if only one input has compareDocumentPosition
  17969. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  17970. if ( compare ) {
  17971. return compare;
  17972. }
  17973. // Calculate position if both inputs belong to the same document
  17974. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  17975. a.compareDocumentPosition( b ) :
  17976. // Otherwise we know they are disconnected
  17977. 1;
  17978. // Disconnected nodes
  17979. if ( compare & 1 ||
  17980. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  17981. // Choose the first element that is related to our preferred document
  17982. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  17983. return -1;
  17984. }
  17985. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  17986. return 1;
  17987. }
  17988. // Maintain original order
  17989. return sortInput ?
  17990. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  17991. 0;
  17992. }
  17993. return compare & 4 ? -1 : 1;
  17994. } :
  17995. function( a, b ) {
  17996. // Exit early if the nodes are identical
  17997. if ( a === b ) {
  17998. hasDuplicate = true;
  17999. return 0;
  18000. }
  18001. var cur,
  18002. i = 0,
  18003. aup = a.parentNode,
  18004. bup = b.parentNode,
  18005. ap = [ a ],
  18006. bp = [ b ];
  18007. // Parentless nodes are either documents or disconnected
  18008. if ( !aup || !bup ) {
  18009. return a === document ? -1 :
  18010. b === document ? 1 :
  18011. aup ? -1 :
  18012. bup ? 1 :
  18013. sortInput ?
  18014. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18015. 0;
  18016. // If the nodes are siblings, we can do a quick check
  18017. } else if ( aup === bup ) {
  18018. return siblingCheck( a, b );
  18019. }
  18020. // Otherwise we need full lists of their ancestors for comparison
  18021. cur = a;
  18022. while ( (cur = cur.parentNode) ) {
  18023. ap.unshift( cur );
  18024. }
  18025. cur = b;
  18026. while ( (cur = cur.parentNode) ) {
  18027. bp.unshift( cur );
  18028. }
  18029. // Walk down the tree looking for a discrepancy
  18030. while ( ap[i] === bp[i] ) {
  18031. i++;
  18032. }
  18033. return i ?
  18034. // Do a sibling check if the nodes have a common ancestor
  18035. siblingCheck( ap[i], bp[i] ) :
  18036. // Otherwise nodes in our document sort first
  18037. ap[i] === preferredDoc ? -1 :
  18038. bp[i] === preferredDoc ? 1 :
  18039. 0;
  18040. };
  18041. return document;
  18042. };
  18043. Sizzle.matches = function( expr, elements ) {
  18044. return Sizzle( expr, null, null, elements );
  18045. };
  18046. Sizzle.matchesSelector = function( elem, expr ) {
  18047. // Set document vars if needed
  18048. if ( ( elem.ownerDocument || elem ) !== document ) {
  18049. setDocument( elem );
  18050. }
  18051. // Make sure that attribute selectors are quoted
  18052. expr = expr.replace( rattributeQuotes, "='$1']" );
  18053. if ( support.matchesSelector && documentIsHTML &&
  18054. !compilerCache[ expr + " " ] &&
  18055. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  18056. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  18057. try {
  18058. var ret = matches.call( elem, expr );
  18059. // IE 9's matchesSelector returns false on disconnected nodes
  18060. if ( ret || support.disconnectedMatch ||
  18061. // As well, disconnected nodes are said to be in a document
  18062. // fragment in IE 9
  18063. elem.document && elem.document.nodeType !== 11 ) {
  18064. return ret;
  18065. }
  18066. } catch (e) {}
  18067. }
  18068. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  18069. };
  18070. Sizzle.contains = function( context, elem ) {
  18071. // Set document vars if needed
  18072. if ( ( context.ownerDocument || context ) !== document ) {
  18073. setDocument( context );
  18074. }
  18075. return contains( context, elem );
  18076. };
  18077. Sizzle.attr = function( elem, name ) {
  18078. // Set document vars if needed
  18079. if ( ( elem.ownerDocument || elem ) !== document ) {
  18080. setDocument( elem );
  18081. }
  18082. var fn = Expr.attrHandle[ name.toLowerCase() ],
  18083. // Don't get fooled by Object.prototype properties (jQuery #13807)
  18084. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  18085. fn( elem, name, !documentIsHTML ) :
  18086. undefined;
  18087. return val !== undefined ?
  18088. val :
  18089. support.attributes || !documentIsHTML ?
  18090. elem.getAttribute( name ) :
  18091. (val = elem.getAttributeNode(name)) && val.specified ?
  18092. val.value :
  18093. null;
  18094. };
  18095. Sizzle.escape = function( sel ) {
  18096. return (sel + "").replace( rcssescape, fcssescape );
  18097. };
  18098. Sizzle.error = function( msg ) {
  18099. throw new Error( "Syntax error, unrecognized expression: " + msg );
  18100. };
  18101. /**
  18102. * Document sorting and removing duplicates
  18103. * @param {ArrayLike} results
  18104. */
  18105. Sizzle.uniqueSort = function( results ) {
  18106. var elem,
  18107. duplicates = [],
  18108. j = 0,
  18109. i = 0;
  18110. // Unless we *know* we can detect duplicates, assume their presence
  18111. hasDuplicate = !support.detectDuplicates;
  18112. sortInput = !support.sortStable && results.slice( 0 );
  18113. results.sort( sortOrder );
  18114. if ( hasDuplicate ) {
  18115. while ( (elem = results[i++]) ) {
  18116. if ( elem === results[ i ] ) {
  18117. j = duplicates.push( i );
  18118. }
  18119. }
  18120. while ( j-- ) {
  18121. results.splice( duplicates[ j ], 1 );
  18122. }
  18123. }
  18124. // Clear input after sorting to release objects
  18125. // See https://github.com/jquery/sizzle/pull/225
  18126. sortInput = null;
  18127. return results;
  18128. };
  18129. /**
  18130. * Utility function for retrieving the text value of an array of DOM nodes
  18131. * @param {Array|Element} elem
  18132. */
  18133. getText = Sizzle.getText = function( elem ) {
  18134. var node,
  18135. ret = "",
  18136. i = 0,
  18137. nodeType = elem.nodeType;
  18138. if ( !nodeType ) {
  18139. // If no nodeType, this is expected to be an array
  18140. while ( (node = elem[i++]) ) {
  18141. // Do not traverse comment nodes
  18142. ret += getText( node );
  18143. }
  18144. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  18145. // Use textContent for elements
  18146. // innerText usage removed for consistency of new lines (jQuery #11153)
  18147. if ( typeof elem.textContent === "string" ) {
  18148. return elem.textContent;
  18149. } else {
  18150. // Traverse its children
  18151. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18152. ret += getText( elem );
  18153. }
  18154. }
  18155. } else if ( nodeType === 3 || nodeType === 4 ) {
  18156. return elem.nodeValue;
  18157. }
  18158. // Do not include comment or processing instruction nodes
  18159. return ret;
  18160. };
  18161. Expr = Sizzle.selectors = {
  18162. // Can be adjusted by the user
  18163. cacheLength: 50,
  18164. createPseudo: markFunction,
  18165. match: matchExpr,
  18166. attrHandle: {},
  18167. find: {},
  18168. relative: {
  18169. ">": { dir: "parentNode", first: true },
  18170. " ": { dir: "parentNode" },
  18171. "+": { dir: "previousSibling", first: true },
  18172. "~": { dir: "previousSibling" }
  18173. },
  18174. preFilter: {
  18175. "ATTR": function( match ) {
  18176. match[1] = match[1].replace( runescape, funescape );
  18177. // Move the given value to match[3] whether quoted or unquoted
  18178. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  18179. if ( match[2] === "~=" ) {
  18180. match[3] = " " + match[3] + " ";
  18181. }
  18182. return match.slice( 0, 4 );
  18183. },
  18184. "CHILD": function( match ) {
  18185. /* matches from matchExpr["CHILD"]
  18186. 1 type (only|nth|...)
  18187. 2 what (child|of-type)
  18188. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  18189. 4 xn-component of xn+y argument ([+-]?\d*n|)
  18190. 5 sign of xn-component
  18191. 6 x of xn-component
  18192. 7 sign of y-component
  18193. 8 y of y-component
  18194. */
  18195. match[1] = match[1].toLowerCase();
  18196. if ( match[1].slice( 0, 3 ) === "nth" ) {
  18197. // nth-* requires argument
  18198. if ( !match[3] ) {
  18199. Sizzle.error( match[0] );
  18200. }
  18201. // numeric x and y parameters for Expr.filter.CHILD
  18202. // remember that false/true cast respectively to 0/1
  18203. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  18204. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  18205. // other types prohibit arguments
  18206. } else if ( match[3] ) {
  18207. Sizzle.error( match[0] );
  18208. }
  18209. return match;
  18210. },
  18211. "PSEUDO": function( match ) {
  18212. var excess,
  18213. unquoted = !match[6] && match[2];
  18214. if ( matchExpr["CHILD"].test( match[0] ) ) {
  18215. return null;
  18216. }
  18217. // Accept quoted arguments as-is
  18218. if ( match[3] ) {
  18219. match[2] = match[4] || match[5] || "";
  18220. // Strip excess characters from unquoted arguments
  18221. } else if ( unquoted && rpseudo.test( unquoted ) &&
  18222. // Get excess from tokenize (recursively)
  18223. (excess = tokenize( unquoted, true )) &&
  18224. // advance to the next closing parenthesis
  18225. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  18226. // excess is a negative index
  18227. match[0] = match[0].slice( 0, excess );
  18228. match[2] = unquoted.slice( 0, excess );
  18229. }
  18230. // Return only captures needed by the pseudo filter method (type and argument)
  18231. return match.slice( 0, 3 );
  18232. }
  18233. },
  18234. filter: {
  18235. "TAG": function( nodeNameSelector ) {
  18236. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  18237. return nodeNameSelector === "*" ?
  18238. function() { return true; } :
  18239. function( elem ) {
  18240. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  18241. };
  18242. },
  18243. "CLASS": function( className ) {
  18244. var pattern = classCache[ className + " " ];
  18245. return pattern ||
  18246. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  18247. classCache( className, function( elem ) {
  18248. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  18249. });
  18250. },
  18251. "ATTR": function( name, operator, check ) {
  18252. return function( elem ) {
  18253. var result = Sizzle.attr( elem, name );
  18254. if ( result == null ) {
  18255. return operator === "!=";
  18256. }
  18257. if ( !operator ) {
  18258. return true;
  18259. }
  18260. result += "";
  18261. return operator === "=" ? result === check :
  18262. operator === "!=" ? result !== check :
  18263. operator === "^=" ? check && result.indexOf( check ) === 0 :
  18264. operator === "*=" ? check && result.indexOf( check ) > -1 :
  18265. operator === "$=" ? check && result.slice( -check.length ) === check :
  18266. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  18267. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  18268. false;
  18269. };
  18270. },
  18271. "CHILD": function( type, what, argument, first, last ) {
  18272. var simple = type.slice( 0, 3 ) !== "nth",
  18273. forward = type.slice( -4 ) !== "last",
  18274. ofType = what === "of-type";
  18275. return first === 1 && last === 0 ?
  18276. // Shortcut for :nth-*(n)
  18277. function( elem ) {
  18278. return !!elem.parentNode;
  18279. } :
  18280. function( elem, context, xml ) {
  18281. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  18282. dir = simple !== forward ? "nextSibling" : "previousSibling",
  18283. parent = elem.parentNode,
  18284. name = ofType && elem.nodeName.toLowerCase(),
  18285. useCache = !xml && !ofType,
  18286. diff = false;
  18287. if ( parent ) {
  18288. // :(first|last|only)-(child|of-type)
  18289. if ( simple ) {
  18290. while ( dir ) {
  18291. node = elem;
  18292. while ( (node = node[ dir ]) ) {
  18293. if ( ofType ?
  18294. node.nodeName.toLowerCase() === name :
  18295. node.nodeType === 1 ) {
  18296. return false;
  18297. }
  18298. }
  18299. // Reverse direction for :only-* (if we haven't yet done so)
  18300. start = dir = type === "only" && !start && "nextSibling";
  18301. }
  18302. return true;
  18303. }
  18304. start = [ forward ? parent.firstChild : parent.lastChild ];
  18305. // non-xml :nth-child(...) stores cache data on `parent`
  18306. if ( forward && useCache ) {
  18307. // Seek `elem` from a previously-cached index
  18308. // ...in a gzip-friendly way
  18309. node = parent;
  18310. outerCache = node[ expando ] || (node[ expando ] = {});
  18311. // Support: IE <9 only
  18312. // Defend against cloned attroperties (jQuery gh-1709)
  18313. uniqueCache = outerCache[ node.uniqueID ] ||
  18314. (outerCache[ node.uniqueID ] = {});
  18315. cache = uniqueCache[ type ] || [];
  18316. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18317. diff = nodeIndex && cache[ 2 ];
  18318. node = nodeIndex && parent.childNodes[ nodeIndex ];
  18319. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18320. // Fallback to seeking `elem` from the start
  18321. (diff = nodeIndex = 0) || start.pop()) ) {
  18322. // When found, cache indexes on `parent` and break
  18323. if ( node.nodeType === 1 && ++diff && node === elem ) {
  18324. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  18325. break;
  18326. }
  18327. }
  18328. } else {
  18329. // Use previously-cached element index if available
  18330. if ( useCache ) {
  18331. // ...in a gzip-friendly way
  18332. node = elem;
  18333. outerCache = node[ expando ] || (node[ expando ] = {});
  18334. // Support: IE <9 only
  18335. // Defend against cloned attroperties (jQuery gh-1709)
  18336. uniqueCache = outerCache[ node.uniqueID ] ||
  18337. (outerCache[ node.uniqueID ] = {});
  18338. cache = uniqueCache[ type ] || [];
  18339. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18340. diff = nodeIndex;
  18341. }
  18342. // xml :nth-child(...)
  18343. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  18344. if ( diff === false ) {
  18345. // Use the same loop as above to seek `elem` from the start
  18346. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18347. (diff = nodeIndex = 0) || start.pop()) ) {
  18348. if ( ( ofType ?
  18349. node.nodeName.toLowerCase() === name :
  18350. node.nodeType === 1 ) &&
  18351. ++diff ) {
  18352. // Cache the index of each encountered element
  18353. if ( useCache ) {
  18354. outerCache = node[ expando ] || (node[ expando ] = {});
  18355. // Support: IE <9 only
  18356. // Defend against cloned attroperties (jQuery gh-1709)
  18357. uniqueCache = outerCache[ node.uniqueID ] ||
  18358. (outerCache[ node.uniqueID ] = {});
  18359. uniqueCache[ type ] = [ dirruns, diff ];
  18360. }
  18361. if ( node === elem ) {
  18362. break;
  18363. }
  18364. }
  18365. }
  18366. }
  18367. }
  18368. // Incorporate the offset, then check against cycle size
  18369. diff -= last;
  18370. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  18371. }
  18372. };
  18373. },
  18374. "PSEUDO": function( pseudo, argument ) {
  18375. // pseudo-class names are case-insensitive
  18376. // http://www.w3.org/TR/selectors/#pseudo-classes
  18377. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  18378. // Remember that setFilters inherits from pseudos
  18379. var args,
  18380. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  18381. Sizzle.error( "unsupported pseudo: " + pseudo );
  18382. // The user may use createPseudo to indicate that
  18383. // arguments are needed to create the filter function
  18384. // just as Sizzle does
  18385. if ( fn[ expando ] ) {
  18386. return fn( argument );
  18387. }
  18388. // But maintain support for old signatures
  18389. if ( fn.length > 1 ) {
  18390. args = [ pseudo, pseudo, "", argument ];
  18391. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  18392. markFunction(function( seed, matches ) {
  18393. var idx,
  18394. matched = fn( seed, argument ),
  18395. i = matched.length;
  18396. while ( i-- ) {
  18397. idx = indexOf( seed, matched[i] );
  18398. seed[ idx ] = !( matches[ idx ] = matched[i] );
  18399. }
  18400. }) :
  18401. function( elem ) {
  18402. return fn( elem, 0, args );
  18403. };
  18404. }
  18405. return fn;
  18406. }
  18407. },
  18408. pseudos: {
  18409. // Potentially complex pseudos
  18410. "not": markFunction(function( selector ) {
  18411. // Trim the selector passed to compile
  18412. // to avoid treating leading and trailing
  18413. // spaces as combinators
  18414. var input = [],
  18415. results = [],
  18416. matcher = compile( selector.replace( rtrim, "$1" ) );
  18417. return matcher[ expando ] ?
  18418. markFunction(function( seed, matches, context, xml ) {
  18419. var elem,
  18420. unmatched = matcher( seed, null, xml, [] ),
  18421. i = seed.length;
  18422. // Match elements unmatched by `matcher`
  18423. while ( i-- ) {
  18424. if ( (elem = unmatched[i]) ) {
  18425. seed[i] = !(matches[i] = elem);
  18426. }
  18427. }
  18428. }) :
  18429. function( elem, context, xml ) {
  18430. input[0] = elem;
  18431. matcher( input, null, xml, results );
  18432. // Don't keep the element (issue #299)
  18433. input[0] = null;
  18434. return !results.pop();
  18435. };
  18436. }),
  18437. "has": markFunction(function( selector ) {
  18438. return function( elem ) {
  18439. return Sizzle( selector, elem ).length > 0;
  18440. };
  18441. }),
  18442. "contains": markFunction(function( text ) {
  18443. text = text.replace( runescape, funescape );
  18444. return function( elem ) {
  18445. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  18446. };
  18447. }),
  18448. // "Whether an element is represented by a :lang() selector
  18449. // is based solely on the element's language value
  18450. // being equal to the identifier C,
  18451. // or beginning with the identifier C immediately followed by "-".
  18452. // The matching of C against the element's language value is performed case-insensitively.
  18453. // The identifier C does not have to be a valid language name."
  18454. // http://www.w3.org/TR/selectors/#lang-pseudo
  18455. "lang": markFunction( function( lang ) {
  18456. // lang value must be a valid identifier
  18457. if ( !ridentifier.test(lang || "") ) {
  18458. Sizzle.error( "unsupported lang: " + lang );
  18459. }
  18460. lang = lang.replace( runescape, funescape ).toLowerCase();
  18461. return function( elem ) {
  18462. var elemLang;
  18463. do {
  18464. if ( (elemLang = documentIsHTML ?
  18465. elem.lang :
  18466. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  18467. elemLang = elemLang.toLowerCase();
  18468. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  18469. }
  18470. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  18471. return false;
  18472. };
  18473. }),
  18474. // Miscellaneous
  18475. "target": function( elem ) {
  18476. var hash = window.location && window.location.hash;
  18477. return hash && hash.slice( 1 ) === elem.id;
  18478. },
  18479. "root": function( elem ) {
  18480. return elem === docElem;
  18481. },
  18482. "focus": function( elem ) {
  18483. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  18484. },
  18485. // Boolean properties
  18486. "enabled": createDisabledPseudo( false ),
  18487. "disabled": createDisabledPseudo( true ),
  18488. "checked": function( elem ) {
  18489. // In CSS3, :checked should return both checked and selected elements
  18490. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18491. var nodeName = elem.nodeName.toLowerCase();
  18492. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  18493. },
  18494. "selected": function( elem ) {
  18495. // Accessing this property makes selected-by-default
  18496. // options in Safari work properly
  18497. if ( elem.parentNode ) {
  18498. elem.parentNode.selectedIndex;
  18499. }
  18500. return elem.selected === true;
  18501. },
  18502. // Contents
  18503. "empty": function( elem ) {
  18504. // http://www.w3.org/TR/selectors/#empty-pseudo
  18505. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  18506. // but not by others (comment: 8; processing instruction: 7; etc.)
  18507. // nodeType < 6 works because attributes (2) do not appear as children
  18508. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18509. if ( elem.nodeType < 6 ) {
  18510. return false;
  18511. }
  18512. }
  18513. return true;
  18514. },
  18515. "parent": function( elem ) {
  18516. return !Expr.pseudos["empty"]( elem );
  18517. },
  18518. // Element/input types
  18519. "header": function( elem ) {
  18520. return rheader.test( elem.nodeName );
  18521. },
  18522. "input": function( elem ) {
  18523. return rinputs.test( elem.nodeName );
  18524. },
  18525. "button": function( elem ) {
  18526. var name = elem.nodeName.toLowerCase();
  18527. return name === "input" && elem.type === "button" || name === "button";
  18528. },
  18529. "text": function( elem ) {
  18530. var attr;
  18531. return elem.nodeName.toLowerCase() === "input" &&
  18532. elem.type === "text" &&
  18533. // Support: IE<8
  18534. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  18535. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  18536. },
  18537. // Position-in-collection
  18538. "first": createPositionalPseudo(function() {
  18539. return [ 0 ];
  18540. }),
  18541. "last": createPositionalPseudo(function( matchIndexes, length ) {
  18542. return [ length - 1 ];
  18543. }),
  18544. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18545. return [ argument < 0 ? argument + length : argument ];
  18546. }),
  18547. "even": createPositionalPseudo(function( matchIndexes, length ) {
  18548. var i = 0;
  18549. for ( ; i < length; i += 2 ) {
  18550. matchIndexes.push( i );
  18551. }
  18552. return matchIndexes;
  18553. }),
  18554. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  18555. var i = 1;
  18556. for ( ; i < length; i += 2 ) {
  18557. matchIndexes.push( i );
  18558. }
  18559. return matchIndexes;
  18560. }),
  18561. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18562. var i = argument < 0 ? argument + length : argument;
  18563. for ( ; --i >= 0; ) {
  18564. matchIndexes.push( i );
  18565. }
  18566. return matchIndexes;
  18567. }),
  18568. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18569. var i = argument < 0 ? argument + length : argument;
  18570. for ( ; ++i < length; ) {
  18571. matchIndexes.push( i );
  18572. }
  18573. return matchIndexes;
  18574. })
  18575. }
  18576. };
  18577. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  18578. // Add button/input type pseudos
  18579. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  18580. Expr.pseudos[ i ] = createInputPseudo( i );
  18581. }
  18582. for ( i in { submit: true, reset: true } ) {
  18583. Expr.pseudos[ i ] = createButtonPseudo( i );
  18584. }
  18585. // Easy API for creating new setFilters
  18586. function setFilters() {}
  18587. setFilters.prototype = Expr.filters = Expr.pseudos;
  18588. Expr.setFilters = new setFilters();
  18589. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  18590. var matched, match, tokens, type,
  18591. soFar, groups, preFilters,
  18592. cached = tokenCache[ selector + " " ];
  18593. if ( cached ) {
  18594. return parseOnly ? 0 : cached.slice( 0 );
  18595. }
  18596. soFar = selector;
  18597. groups = [];
  18598. preFilters = Expr.preFilter;
  18599. while ( soFar ) {
  18600. // Comma and first run
  18601. if ( !matched || (match = rcomma.exec( soFar )) ) {
  18602. if ( match ) {
  18603. // Don't consume trailing commas as valid
  18604. soFar = soFar.slice( match[0].length ) || soFar;
  18605. }
  18606. groups.push( (tokens = []) );
  18607. }
  18608. matched = false;
  18609. // Combinators
  18610. if ( (match = rcombinators.exec( soFar )) ) {
  18611. matched = match.shift();
  18612. tokens.push({
  18613. value: matched,
  18614. // Cast descendant combinators to space
  18615. type: match[0].replace( rtrim, " " )
  18616. });
  18617. soFar = soFar.slice( matched.length );
  18618. }
  18619. // Filters
  18620. for ( type in Expr.filter ) {
  18621. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  18622. (match = preFilters[ type ]( match ))) ) {
  18623. matched = match.shift();
  18624. tokens.push({
  18625. value: matched,
  18626. type: type,
  18627. matches: match
  18628. });
  18629. soFar = soFar.slice( matched.length );
  18630. }
  18631. }
  18632. if ( !matched ) {
  18633. break;
  18634. }
  18635. }
  18636. // Return the length of the invalid excess
  18637. // if we're just parsing
  18638. // Otherwise, throw an error or return tokens
  18639. return parseOnly ?
  18640. soFar.length :
  18641. soFar ?
  18642. Sizzle.error( selector ) :
  18643. // Cache the tokens
  18644. tokenCache( selector, groups ).slice( 0 );
  18645. };
  18646. function toSelector( tokens ) {
  18647. var i = 0,
  18648. len = tokens.length,
  18649. selector = "";
  18650. for ( ; i < len; i++ ) {
  18651. selector += tokens[i].value;
  18652. }
  18653. return selector;
  18654. }
  18655. function addCombinator( matcher, combinator, base ) {
  18656. var dir = combinator.dir,
  18657. skip = combinator.next,
  18658. key = skip || dir,
  18659. checkNonElements = base && key === "parentNode",
  18660. doneName = done++;
  18661. return combinator.first ?
  18662. // Check against closest ancestor/preceding element
  18663. function( elem, context, xml ) {
  18664. while ( (elem = elem[ dir ]) ) {
  18665. if ( elem.nodeType === 1 || checkNonElements ) {
  18666. return matcher( elem, context, xml );
  18667. }
  18668. }
  18669. return false;
  18670. } :
  18671. // Check against all ancestor/preceding elements
  18672. function( elem, context, xml ) {
  18673. var oldCache, uniqueCache, outerCache,
  18674. newCache = [ dirruns, doneName ];
  18675. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  18676. if ( xml ) {
  18677. while ( (elem = elem[ dir ]) ) {
  18678. if ( elem.nodeType === 1 || checkNonElements ) {
  18679. if ( matcher( elem, context, xml ) ) {
  18680. return true;
  18681. }
  18682. }
  18683. }
  18684. } else {
  18685. while ( (elem = elem[ dir ]) ) {
  18686. if ( elem.nodeType === 1 || checkNonElements ) {
  18687. outerCache = elem[ expando ] || (elem[ expando ] = {});
  18688. // Support: IE <9 only
  18689. // Defend against cloned attroperties (jQuery gh-1709)
  18690. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  18691. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  18692. elem = elem[ dir ] || elem;
  18693. } else if ( (oldCache = uniqueCache[ key ]) &&
  18694. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  18695. // Assign to newCache so results back-propagate to previous elements
  18696. return (newCache[ 2 ] = oldCache[ 2 ]);
  18697. } else {
  18698. // Reuse newcache so results back-propagate to previous elements
  18699. uniqueCache[ key ] = newCache;
  18700. // A match means we're done; a fail means we have to keep checking
  18701. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  18702. return true;
  18703. }
  18704. }
  18705. }
  18706. }
  18707. }
  18708. return false;
  18709. };
  18710. }
  18711. function elementMatcher( matchers ) {
  18712. return matchers.length > 1 ?
  18713. function( elem, context, xml ) {
  18714. var i = matchers.length;
  18715. while ( i-- ) {
  18716. if ( !matchers[i]( elem, context, xml ) ) {
  18717. return false;
  18718. }
  18719. }
  18720. return true;
  18721. } :
  18722. matchers[0];
  18723. }
  18724. function multipleContexts( selector, contexts, results ) {
  18725. var i = 0,
  18726. len = contexts.length;
  18727. for ( ; i < len; i++ ) {
  18728. Sizzle( selector, contexts[i], results );
  18729. }
  18730. return results;
  18731. }
  18732. function condense( unmatched, map, filter, context, xml ) {
  18733. var elem,
  18734. newUnmatched = [],
  18735. i = 0,
  18736. len = unmatched.length,
  18737. mapped = map != null;
  18738. for ( ; i < len; i++ ) {
  18739. if ( (elem = unmatched[i]) ) {
  18740. if ( !filter || filter( elem, context, xml ) ) {
  18741. newUnmatched.push( elem );
  18742. if ( mapped ) {
  18743. map.push( i );
  18744. }
  18745. }
  18746. }
  18747. }
  18748. return newUnmatched;
  18749. }
  18750. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  18751. if ( postFilter && !postFilter[ expando ] ) {
  18752. postFilter = setMatcher( postFilter );
  18753. }
  18754. if ( postFinder && !postFinder[ expando ] ) {
  18755. postFinder = setMatcher( postFinder, postSelector );
  18756. }
  18757. return markFunction(function( seed, results, context, xml ) {
  18758. var temp, i, elem,
  18759. preMap = [],
  18760. postMap = [],
  18761. preexisting = results.length,
  18762. // Get initial elements from seed or context
  18763. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  18764. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  18765. matcherIn = preFilter && ( seed || !selector ) ?
  18766. condense( elems, preMap, preFilter, context, xml ) :
  18767. elems,
  18768. matcherOut = matcher ?
  18769. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  18770. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  18771. // ...intermediate processing is necessary
  18772. [] :
  18773. // ...otherwise use results directly
  18774. results :
  18775. matcherIn;
  18776. // Find primary matches
  18777. if ( matcher ) {
  18778. matcher( matcherIn, matcherOut, context, xml );
  18779. }
  18780. // Apply postFilter
  18781. if ( postFilter ) {
  18782. temp = condense( matcherOut, postMap );
  18783. postFilter( temp, [], context, xml );
  18784. // Un-match failing elements by moving them back to matcherIn
  18785. i = temp.length;
  18786. while ( i-- ) {
  18787. if ( (elem = temp[i]) ) {
  18788. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  18789. }
  18790. }
  18791. }
  18792. if ( seed ) {
  18793. if ( postFinder || preFilter ) {
  18794. if ( postFinder ) {
  18795. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  18796. temp = [];
  18797. i = matcherOut.length;
  18798. while ( i-- ) {
  18799. if ( (elem = matcherOut[i]) ) {
  18800. // Restore matcherIn since elem is not yet a final match
  18801. temp.push( (matcherIn[i] = elem) );
  18802. }
  18803. }
  18804. postFinder( null, (matcherOut = []), temp, xml );
  18805. }
  18806. // Move matched elements from seed to results to keep them synchronized
  18807. i = matcherOut.length;
  18808. while ( i-- ) {
  18809. if ( (elem = matcherOut[i]) &&
  18810. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  18811. seed[temp] = !(results[temp] = elem);
  18812. }
  18813. }
  18814. }
  18815. // Add elements to results, through postFinder if defined
  18816. } else {
  18817. matcherOut = condense(
  18818. matcherOut === results ?
  18819. matcherOut.splice( preexisting, matcherOut.length ) :
  18820. matcherOut
  18821. );
  18822. if ( postFinder ) {
  18823. postFinder( null, results, matcherOut, xml );
  18824. } else {
  18825. push.apply( results, matcherOut );
  18826. }
  18827. }
  18828. });
  18829. }
  18830. function matcherFromTokens( tokens ) {
  18831. var checkContext, matcher, j,
  18832. len = tokens.length,
  18833. leadingRelative = Expr.relative[ tokens[0].type ],
  18834. implicitRelative = leadingRelative || Expr.relative[" "],
  18835. i = leadingRelative ? 1 : 0,
  18836. // The foundational matcher ensures that elements are reachable from top-level context(s)
  18837. matchContext = addCombinator( function( elem ) {
  18838. return elem === checkContext;
  18839. }, implicitRelative, true ),
  18840. matchAnyContext = addCombinator( function( elem ) {
  18841. return indexOf( checkContext, elem ) > -1;
  18842. }, implicitRelative, true ),
  18843. matchers = [ function( elem, context, xml ) {
  18844. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  18845. (checkContext = context).nodeType ?
  18846. matchContext( elem, context, xml ) :
  18847. matchAnyContext( elem, context, xml ) );
  18848. // Avoid hanging onto element (issue #299)
  18849. checkContext = null;
  18850. return ret;
  18851. } ];
  18852. for ( ; i < len; i++ ) {
  18853. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  18854. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  18855. } else {
  18856. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  18857. // Return special upon seeing a positional matcher
  18858. if ( matcher[ expando ] ) {
  18859. // Find the next relative operator (if any) for proper handling
  18860. j = ++i;
  18861. for ( ; j < len; j++ ) {
  18862. if ( Expr.relative[ tokens[j].type ] ) {
  18863. break;
  18864. }
  18865. }
  18866. return setMatcher(
  18867. i > 1 && elementMatcher( matchers ),
  18868. i > 1 && toSelector(
  18869. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  18870. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  18871. ).replace( rtrim, "$1" ),
  18872. matcher,
  18873. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  18874. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  18875. j < len && toSelector( tokens )
  18876. );
  18877. }
  18878. matchers.push( matcher );
  18879. }
  18880. }
  18881. return elementMatcher( matchers );
  18882. }
  18883. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  18884. var bySet = setMatchers.length > 0,
  18885. byElement = elementMatchers.length > 0,
  18886. superMatcher = function( seed, context, xml, results, outermost ) {
  18887. var elem, j, matcher,
  18888. matchedCount = 0,
  18889. i = "0",
  18890. unmatched = seed && [],
  18891. setMatched = [],
  18892. contextBackup = outermostContext,
  18893. // We must always have either seed elements or outermost context
  18894. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  18895. // Use integer dirruns iff this is the outermost matcher
  18896. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  18897. len = elems.length;
  18898. if ( outermost ) {
  18899. outermostContext = context === document || context || outermost;
  18900. }
  18901. // Add elements passing elementMatchers directly to results
  18902. // Support: IE<9, Safari
  18903. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  18904. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  18905. if ( byElement && elem ) {
  18906. j = 0;
  18907. if ( !context && elem.ownerDocument !== document ) {
  18908. setDocument( elem );
  18909. xml = !documentIsHTML;
  18910. }
  18911. while ( (matcher = elementMatchers[j++]) ) {
  18912. if ( matcher( elem, context || document, xml) ) {
  18913. results.push( elem );
  18914. break;
  18915. }
  18916. }
  18917. if ( outermost ) {
  18918. dirruns = dirrunsUnique;
  18919. }
  18920. }
  18921. // Track unmatched elements for set filters
  18922. if ( bySet ) {
  18923. // They will have gone through all possible matchers
  18924. if ( (elem = !matcher && elem) ) {
  18925. matchedCount--;
  18926. }
  18927. // Lengthen the array for every element, matched or not
  18928. if ( seed ) {
  18929. unmatched.push( elem );
  18930. }
  18931. }
  18932. }
  18933. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  18934. // makes the latter nonnegative.
  18935. matchedCount += i;
  18936. // Apply set filters to unmatched elements
  18937. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  18938. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  18939. // no element matchers and no seed.
  18940. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  18941. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  18942. // numerically zero.
  18943. if ( bySet && i !== matchedCount ) {
  18944. j = 0;
  18945. while ( (matcher = setMatchers[j++]) ) {
  18946. matcher( unmatched, setMatched, context, xml );
  18947. }
  18948. if ( seed ) {
  18949. // Reintegrate element matches to eliminate the need for sorting
  18950. if ( matchedCount > 0 ) {
  18951. while ( i-- ) {
  18952. if ( !(unmatched[i] || setMatched[i]) ) {
  18953. setMatched[i] = pop.call( results );
  18954. }
  18955. }
  18956. }
  18957. // Discard index placeholder values to get only actual matches
  18958. setMatched = condense( setMatched );
  18959. }
  18960. // Add matches to results
  18961. push.apply( results, setMatched );
  18962. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  18963. if ( outermost && !seed && setMatched.length > 0 &&
  18964. ( matchedCount + setMatchers.length ) > 1 ) {
  18965. Sizzle.uniqueSort( results );
  18966. }
  18967. }
  18968. // Override manipulation of globals by nested matchers
  18969. if ( outermost ) {
  18970. dirruns = dirrunsUnique;
  18971. outermostContext = contextBackup;
  18972. }
  18973. return unmatched;
  18974. };
  18975. return bySet ?
  18976. markFunction( superMatcher ) :
  18977. superMatcher;
  18978. }
  18979. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  18980. var i,
  18981. setMatchers = [],
  18982. elementMatchers = [],
  18983. cached = compilerCache[ selector + " " ];
  18984. if ( !cached ) {
  18985. // Generate a function of recursive functions that can be used to check each element
  18986. if ( !match ) {
  18987. match = tokenize( selector );
  18988. }
  18989. i = match.length;
  18990. while ( i-- ) {
  18991. cached = matcherFromTokens( match[i] );
  18992. if ( cached[ expando ] ) {
  18993. setMatchers.push( cached );
  18994. } else {
  18995. elementMatchers.push( cached );
  18996. }
  18997. }
  18998. // Cache the compiled function
  18999. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  19000. // Save selector and tokenization
  19001. cached.selector = selector;
  19002. }
  19003. return cached;
  19004. };
  19005. /**
  19006. * A low-level selection function that works with Sizzle's compiled
  19007. * selector functions
  19008. * @param {String|Function} selector A selector or a pre-compiled
  19009. * selector function built with Sizzle.compile
  19010. * @param {Element} context
  19011. * @param {Array} [results]
  19012. * @param {Array} [seed] A set of elements to match against
  19013. */
  19014. select = Sizzle.select = function( selector, context, results, seed ) {
  19015. var i, tokens, token, type, find,
  19016. compiled = typeof selector === "function" && selector,
  19017. match = !seed && tokenize( (selector = compiled.selector || selector) );
  19018. results = results || [];
  19019. // Try to minimize operations if there is only one selector in the list and no seed
  19020. // (the latter of which guarantees us context)
  19021. if ( match.length === 1 ) {
  19022. // Reduce context if the leading compound selector is an ID
  19023. tokens = match[0] = match[0].slice( 0 );
  19024. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  19025. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  19026. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  19027. if ( !context ) {
  19028. return results;
  19029. // Precompiled matchers will still verify ancestry, so step up a level
  19030. } else if ( compiled ) {
  19031. context = context.parentNode;
  19032. }
  19033. selector = selector.slice( tokens.shift().value.length );
  19034. }
  19035. // Fetch a seed set for right-to-left matching
  19036. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  19037. while ( i-- ) {
  19038. token = tokens[i];
  19039. // Abort if we hit a combinator
  19040. if ( Expr.relative[ (type = token.type) ] ) {
  19041. break;
  19042. }
  19043. if ( (find = Expr.find[ type ]) ) {
  19044. // Search, expanding context for leading sibling combinators
  19045. if ( (seed = find(
  19046. token.matches[0].replace( runescape, funescape ),
  19047. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  19048. )) ) {
  19049. // If seed is empty or no tokens remain, we can return early
  19050. tokens.splice( i, 1 );
  19051. selector = seed.length && toSelector( tokens );
  19052. if ( !selector ) {
  19053. push.apply( results, seed );
  19054. return results;
  19055. }
  19056. break;
  19057. }
  19058. }
  19059. }
  19060. }
  19061. // Compile and execute a filtering function if one is not provided
  19062. // Provide `match` to avoid retokenization if we modified the selector above
  19063. ( compiled || compile( selector, match ) )(
  19064. seed,
  19065. context,
  19066. !documentIsHTML,
  19067. results,
  19068. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  19069. );
  19070. return results;
  19071. };
  19072. // One-time assignments
  19073. // Sort stability
  19074. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  19075. // Support: Chrome 14-35+
  19076. // Always assume duplicates if they aren't passed to the comparison function
  19077. support.detectDuplicates = !!hasDuplicate;
  19078. // Initialize against the default document
  19079. setDocument();
  19080. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  19081. // Detached nodes confoundingly follow *each other*
  19082. support.sortDetached = assert(function( el ) {
  19083. // Should return 1, but returns 4 (following)
  19084. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  19085. });
  19086. // Support: IE<8
  19087. // Prevent attribute/property "interpolation"
  19088. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  19089. if ( !assert(function( el ) {
  19090. el.innerHTML = "<a href='#'></a>";
  19091. return el.firstChild.getAttribute("href") === "#" ;
  19092. }) ) {
  19093. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  19094. if ( !isXML ) {
  19095. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  19096. }
  19097. });
  19098. }
  19099. // Support: IE<9
  19100. // Use defaultValue in place of getAttribute("value")
  19101. if ( !support.attributes || !assert(function( el ) {
  19102. el.innerHTML = "<input/>";
  19103. el.firstChild.setAttribute( "value", "" );
  19104. return el.firstChild.getAttribute( "value" ) === "";
  19105. }) ) {
  19106. addHandle( "value", function( elem, name, isXML ) {
  19107. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  19108. return elem.defaultValue;
  19109. }
  19110. });
  19111. }
  19112. // Support: IE<9
  19113. // Use getAttributeNode to fetch booleans when getAttribute lies
  19114. if ( !assert(function( el ) {
  19115. return el.getAttribute("disabled") == null;
  19116. }) ) {
  19117. addHandle( booleans, function( elem, name, isXML ) {
  19118. var val;
  19119. if ( !isXML ) {
  19120. return elem[ name ] === true ? name.toLowerCase() :
  19121. (val = elem.getAttributeNode( name )) && val.specified ?
  19122. val.value :
  19123. null;
  19124. }
  19125. });
  19126. }
  19127. return Sizzle;
  19128. })( window );
  19129. jQuery.find = Sizzle;
  19130. jQuery.expr = Sizzle.selectors;
  19131. // Deprecated
  19132. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  19133. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  19134. jQuery.text = Sizzle.getText;
  19135. jQuery.isXMLDoc = Sizzle.isXML;
  19136. jQuery.contains = Sizzle.contains;
  19137. jQuery.escapeSelector = Sizzle.escape;
  19138. var dir = function( elem, dir, until ) {
  19139. var matched = [],
  19140. truncate = until !== undefined;
  19141. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  19142. if ( elem.nodeType === 1 ) {
  19143. if ( truncate && jQuery( elem ).is( until ) ) {
  19144. break;
  19145. }
  19146. matched.push( elem );
  19147. }
  19148. }
  19149. return matched;
  19150. };
  19151. var siblings = function( n, elem ) {
  19152. var matched = [];
  19153. for ( ; n; n = n.nextSibling ) {
  19154. if ( n.nodeType === 1 && n !== elem ) {
  19155. matched.push( n );
  19156. }
  19157. }
  19158. return matched;
  19159. };
  19160. var rneedsContext = jQuery.expr.match.needsContext;
  19161. function nodeName( elem, name ) {
  19162. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  19163. };
  19164. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  19165. var risSimple = /^.[^:#\[\.,]*$/;
  19166. // Implement the identical functionality for filter and not
  19167. function winnow( elements, qualifier, not ) {
  19168. if ( jQuery.isFunction( qualifier ) ) {
  19169. return jQuery.grep( elements, function( elem, i ) {
  19170. return !!qualifier.call( elem, i, elem ) !== not;
  19171. } );
  19172. }
  19173. // Single element
  19174. if ( qualifier.nodeType ) {
  19175. return jQuery.grep( elements, function( elem ) {
  19176. return ( elem === qualifier ) !== not;
  19177. } );
  19178. }
  19179. // Arraylike of elements (jQuery, arguments, Array)
  19180. if ( typeof qualifier !== "string" ) {
  19181. return jQuery.grep( elements, function( elem ) {
  19182. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  19183. } );
  19184. }
  19185. // Simple selector that can be filtered directly, removing non-Elements
  19186. if ( risSimple.test( qualifier ) ) {
  19187. return jQuery.filter( qualifier, elements, not );
  19188. }
  19189. // Complex selector, compare the two sets, removing non-Elements
  19190. qualifier = jQuery.filter( qualifier, elements );
  19191. return jQuery.grep( elements, function( elem ) {
  19192. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  19193. } );
  19194. }
  19195. jQuery.filter = function( expr, elems, not ) {
  19196. var elem = elems[ 0 ];
  19197. if ( not ) {
  19198. expr = ":not(" + expr + ")";
  19199. }
  19200. if ( elems.length === 1 && elem.nodeType === 1 ) {
  19201. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  19202. }
  19203. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  19204. return elem.nodeType === 1;
  19205. } ) );
  19206. };
  19207. jQuery.fn.extend( {
  19208. find: function( selector ) {
  19209. var i, ret,
  19210. len = this.length,
  19211. self = this;
  19212. if ( typeof selector !== "string" ) {
  19213. return this.pushStack( jQuery( selector ).filter( function() {
  19214. for ( i = 0; i < len; i++ ) {
  19215. if ( jQuery.contains( self[ i ], this ) ) {
  19216. return true;
  19217. }
  19218. }
  19219. } ) );
  19220. }
  19221. ret = this.pushStack( [] );
  19222. for ( i = 0; i < len; i++ ) {
  19223. jQuery.find( selector, self[ i ], ret );
  19224. }
  19225. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  19226. },
  19227. filter: function( selector ) {
  19228. return this.pushStack( winnow( this, selector || [], false ) );
  19229. },
  19230. not: function( selector ) {
  19231. return this.pushStack( winnow( this, selector || [], true ) );
  19232. },
  19233. is: function( selector ) {
  19234. return !!winnow(
  19235. this,
  19236. // If this is a positional/relative selector, check membership in the returned set
  19237. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  19238. typeof selector === "string" && rneedsContext.test( selector ) ?
  19239. jQuery( selector ) :
  19240. selector || [],
  19241. false
  19242. ).length;
  19243. }
  19244. } );
  19245. // Initialize a jQuery object
  19246. // A central reference to the root jQuery(document)
  19247. var rootjQuery,
  19248. // A simple way to check for HTML strings
  19249. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  19250. // Strict HTML recognition (#11290: must start with <)
  19251. // Shortcut simple #id case for speed
  19252. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  19253. init = jQuery.fn.init = function( selector, context, root ) {
  19254. var match, elem;
  19255. // HANDLE: $(""), $(null), $(undefined), $(false)
  19256. if ( !selector ) {
  19257. return this;
  19258. }
  19259. // Method init() accepts an alternate rootjQuery
  19260. // so migrate can support jQuery.sub (gh-2101)
  19261. root = root || rootjQuery;
  19262. // Handle HTML strings
  19263. if ( typeof selector === "string" ) {
  19264. if ( selector[ 0 ] === "<" &&
  19265. selector[ selector.length - 1 ] === ">" &&
  19266. selector.length >= 3 ) {
  19267. // Assume that strings that start and end with <> are HTML and skip the regex check
  19268. match = [ null, selector, null ];
  19269. } else {
  19270. match = rquickExpr.exec( selector );
  19271. }
  19272. // Match html or make sure no context is specified for #id
  19273. if ( match && ( match[ 1 ] || !context ) ) {
  19274. // HANDLE: $(html) -> $(array)
  19275. if ( match[ 1 ] ) {
  19276. context = context instanceof jQuery ? context[ 0 ] : context;
  19277. // Option to run scripts is true for back-compat
  19278. // Intentionally let the error be thrown if parseHTML is not present
  19279. jQuery.merge( this, jQuery.parseHTML(
  19280. match[ 1 ],
  19281. context && context.nodeType ? context.ownerDocument || context : document,
  19282. true
  19283. ) );
  19284. // HANDLE: $(html, props)
  19285. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  19286. for ( match in context ) {
  19287. // Properties of context are called as methods if possible
  19288. if ( jQuery.isFunction( this[ match ] ) ) {
  19289. this[ match ]( context[ match ] );
  19290. // ...and otherwise set as attributes
  19291. } else {
  19292. this.attr( match, context[ match ] );
  19293. }
  19294. }
  19295. }
  19296. return this;
  19297. // HANDLE: $(#id)
  19298. } else {
  19299. elem = document.getElementById( match[ 2 ] );
  19300. if ( elem ) {
  19301. // Inject the element directly into the jQuery object
  19302. this[ 0 ] = elem;
  19303. this.length = 1;
  19304. }
  19305. return this;
  19306. }
  19307. // HANDLE: $(expr, $(...))
  19308. } else if ( !context || context.jquery ) {
  19309. return ( context || root ).find( selector );
  19310. // HANDLE: $(expr, context)
  19311. // (which is just equivalent to: $(context).find(expr)
  19312. } else {
  19313. return this.constructor( context ).find( selector );
  19314. }
  19315. // HANDLE: $(DOMElement)
  19316. } else if ( selector.nodeType ) {
  19317. this[ 0 ] = selector;
  19318. this.length = 1;
  19319. return this;
  19320. // HANDLE: $(function)
  19321. // Shortcut for document ready
  19322. } else if ( jQuery.isFunction( selector ) ) {
  19323. return root.ready !== undefined ?
  19324. root.ready( selector ) :
  19325. // Execute immediately if ready is not present
  19326. selector( jQuery );
  19327. }
  19328. return jQuery.makeArray( selector, this );
  19329. };
  19330. // Give the init function the jQuery prototype for later instantiation
  19331. init.prototype = jQuery.fn;
  19332. // Initialize central reference
  19333. rootjQuery = jQuery( document );
  19334. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  19335. // Methods guaranteed to produce a unique set when starting from a unique set
  19336. guaranteedUnique = {
  19337. children: true,
  19338. contents: true,
  19339. next: true,
  19340. prev: true
  19341. };
  19342. jQuery.fn.extend( {
  19343. has: function( target ) {
  19344. var targets = jQuery( target, this ),
  19345. l = targets.length;
  19346. return this.filter( function() {
  19347. var i = 0;
  19348. for ( ; i < l; i++ ) {
  19349. if ( jQuery.contains( this, targets[ i ] ) ) {
  19350. return true;
  19351. }
  19352. }
  19353. } );
  19354. },
  19355. closest: function( selectors, context ) {
  19356. var cur,
  19357. i = 0,
  19358. l = this.length,
  19359. matched = [],
  19360. targets = typeof selectors !== "string" && jQuery( selectors );
  19361. // Positional selectors never match, since there's no _selection_ context
  19362. if ( !rneedsContext.test( selectors ) ) {
  19363. for ( ; i < l; i++ ) {
  19364. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  19365. // Always skip document fragments
  19366. if ( cur.nodeType < 11 && ( targets ?
  19367. targets.index( cur ) > -1 :
  19368. // Don't pass non-elements to Sizzle
  19369. cur.nodeType === 1 &&
  19370. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  19371. matched.push( cur );
  19372. break;
  19373. }
  19374. }
  19375. }
  19376. }
  19377. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  19378. },
  19379. // Determine the position of an element within the set
  19380. index: function( elem ) {
  19381. // No argument, return index in parent
  19382. if ( !elem ) {
  19383. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  19384. }
  19385. // Index in selector
  19386. if ( typeof elem === "string" ) {
  19387. return indexOf.call( jQuery( elem ), this[ 0 ] );
  19388. }
  19389. // Locate the position of the desired element
  19390. return indexOf.call( this,
  19391. // If it receives a jQuery object, the first element is used
  19392. elem.jquery ? elem[ 0 ] : elem
  19393. );
  19394. },
  19395. add: function( selector, context ) {
  19396. return this.pushStack(
  19397. jQuery.uniqueSort(
  19398. jQuery.merge( this.get(), jQuery( selector, context ) )
  19399. )
  19400. );
  19401. },
  19402. addBack: function( selector ) {
  19403. return this.add( selector == null ?
  19404. this.prevObject : this.prevObject.filter( selector )
  19405. );
  19406. }
  19407. } );
  19408. function sibling( cur, dir ) {
  19409. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  19410. return cur;
  19411. }
  19412. jQuery.each( {
  19413. parent: function( elem ) {
  19414. var parent = elem.parentNode;
  19415. return parent && parent.nodeType !== 11 ? parent : null;
  19416. },
  19417. parents: function( elem ) {
  19418. return dir( elem, "parentNode" );
  19419. },
  19420. parentsUntil: function( elem, i, until ) {
  19421. return dir( elem, "parentNode", until );
  19422. },
  19423. next: function( elem ) {
  19424. return sibling( elem, "nextSibling" );
  19425. },
  19426. prev: function( elem ) {
  19427. return sibling( elem, "previousSibling" );
  19428. },
  19429. nextAll: function( elem ) {
  19430. return dir( elem, "nextSibling" );
  19431. },
  19432. prevAll: function( elem ) {
  19433. return dir( elem, "previousSibling" );
  19434. },
  19435. nextUntil: function( elem, i, until ) {
  19436. return dir( elem, "nextSibling", until );
  19437. },
  19438. prevUntil: function( elem, i, until ) {
  19439. return dir( elem, "previousSibling", until );
  19440. },
  19441. siblings: function( elem ) {
  19442. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  19443. },
  19444. children: function( elem ) {
  19445. return siblings( elem.firstChild );
  19446. },
  19447. contents: function( elem ) {
  19448. if ( nodeName( elem, "iframe" ) ) {
  19449. return elem.contentDocument;
  19450. }
  19451. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  19452. // Treat the template element as a regular one in browsers that
  19453. // don't support it.
  19454. if ( nodeName( elem, "template" ) ) {
  19455. elem = elem.content || elem;
  19456. }
  19457. return jQuery.merge( [], elem.childNodes );
  19458. }
  19459. }, function( name, fn ) {
  19460. jQuery.fn[ name ] = function( until, selector ) {
  19461. var matched = jQuery.map( this, fn, until );
  19462. if ( name.slice( -5 ) !== "Until" ) {
  19463. selector = until;
  19464. }
  19465. if ( selector && typeof selector === "string" ) {
  19466. matched = jQuery.filter( selector, matched );
  19467. }
  19468. if ( this.length > 1 ) {
  19469. // Remove duplicates
  19470. if ( !guaranteedUnique[ name ] ) {
  19471. jQuery.uniqueSort( matched );
  19472. }
  19473. // Reverse order for parents* and prev-derivatives
  19474. if ( rparentsprev.test( name ) ) {
  19475. matched.reverse();
  19476. }
  19477. }
  19478. return this.pushStack( matched );
  19479. };
  19480. } );
  19481. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  19482. // Convert String-formatted options into Object-formatted ones
  19483. function createOptions( options ) {
  19484. var object = {};
  19485. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  19486. object[ flag ] = true;
  19487. } );
  19488. return object;
  19489. }
  19490. /*
  19491. * Create a callback list using the following parameters:
  19492. *
  19493. * options: an optional list of space-separated options that will change how
  19494. * the callback list behaves or a more traditional option object
  19495. *
  19496. * By default a callback list will act like an event callback list and can be
  19497. * "fired" multiple times.
  19498. *
  19499. * Possible options:
  19500. *
  19501. * once: will ensure the callback list can only be fired once (like a Deferred)
  19502. *
  19503. * memory: will keep track of previous values and will call any callback added
  19504. * after the list has been fired right away with the latest "memorized"
  19505. * values (like a Deferred)
  19506. *
  19507. * unique: will ensure a callback can only be added once (no duplicate in the list)
  19508. *
  19509. * stopOnFalse: interrupt callings when a callback returns false
  19510. *
  19511. */
  19512. jQuery.Callbacks = function( options ) {
  19513. // Convert options from String-formatted to Object-formatted if needed
  19514. // (we check in cache first)
  19515. options = typeof options === "string" ?
  19516. createOptions( options ) :
  19517. jQuery.extend( {}, options );
  19518. var // Flag to know if list is currently firing
  19519. firing,
  19520. // Last fire value for non-forgettable lists
  19521. memory,
  19522. // Flag to know if list was already fired
  19523. fired,
  19524. // Flag to prevent firing
  19525. locked,
  19526. // Actual callback list
  19527. list = [],
  19528. // Queue of execution data for repeatable lists
  19529. queue = [],
  19530. // Index of currently firing callback (modified by add/remove as needed)
  19531. firingIndex = -1,
  19532. // Fire callbacks
  19533. fire = function() {
  19534. // Enforce single-firing
  19535. locked = locked || options.once;
  19536. // Execute callbacks for all pending executions,
  19537. // respecting firingIndex overrides and runtime changes
  19538. fired = firing = true;
  19539. for ( ; queue.length; firingIndex = -1 ) {
  19540. memory = queue.shift();
  19541. while ( ++firingIndex < list.length ) {
  19542. // Run callback and check for early termination
  19543. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  19544. options.stopOnFalse ) {
  19545. // Jump to end and forget the data so .add doesn't re-fire
  19546. firingIndex = list.length;
  19547. memory = false;
  19548. }
  19549. }
  19550. }
  19551. // Forget the data if we're done with it
  19552. if ( !options.memory ) {
  19553. memory = false;
  19554. }
  19555. firing = false;
  19556. // Clean up if we're done firing for good
  19557. if ( locked ) {
  19558. // Keep an empty list if we have data for future add calls
  19559. if ( memory ) {
  19560. list = [];
  19561. // Otherwise, this object is spent
  19562. } else {
  19563. list = "";
  19564. }
  19565. }
  19566. },
  19567. // Actual Callbacks object
  19568. self = {
  19569. // Add a callback or a collection of callbacks to the list
  19570. add: function() {
  19571. if ( list ) {
  19572. // If we have memory from a past run, we should fire after adding
  19573. if ( memory && !firing ) {
  19574. firingIndex = list.length - 1;
  19575. queue.push( memory );
  19576. }
  19577. ( function add( args ) {
  19578. jQuery.each( args, function( _, arg ) {
  19579. if ( jQuery.isFunction( arg ) ) {
  19580. if ( !options.unique || !self.has( arg ) ) {
  19581. list.push( arg );
  19582. }
  19583. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  19584. // Inspect recursively
  19585. add( arg );
  19586. }
  19587. } );
  19588. } )( arguments );
  19589. if ( memory && !firing ) {
  19590. fire();
  19591. }
  19592. }
  19593. return this;
  19594. },
  19595. // Remove a callback from the list
  19596. remove: function() {
  19597. jQuery.each( arguments, function( _, arg ) {
  19598. var index;
  19599. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  19600. list.splice( index, 1 );
  19601. // Handle firing indexes
  19602. if ( index <= firingIndex ) {
  19603. firingIndex--;
  19604. }
  19605. }
  19606. } );
  19607. return this;
  19608. },
  19609. // Check if a given callback is in the list.
  19610. // If no argument is given, return whether or not list has callbacks attached.
  19611. has: function( fn ) {
  19612. return fn ?
  19613. jQuery.inArray( fn, list ) > -1 :
  19614. list.length > 0;
  19615. },
  19616. // Remove all callbacks from the list
  19617. empty: function() {
  19618. if ( list ) {
  19619. list = [];
  19620. }
  19621. return this;
  19622. },
  19623. // Disable .fire and .add
  19624. // Abort any current/pending executions
  19625. // Clear all callbacks and values
  19626. disable: function() {
  19627. locked = queue = [];
  19628. list = memory = "";
  19629. return this;
  19630. },
  19631. disabled: function() {
  19632. return !list;
  19633. },
  19634. // Disable .fire
  19635. // Also disable .add unless we have memory (since it would have no effect)
  19636. // Abort any pending executions
  19637. lock: function() {
  19638. locked = queue = [];
  19639. if ( !memory && !firing ) {
  19640. list = memory = "";
  19641. }
  19642. return this;
  19643. },
  19644. locked: function() {
  19645. return !!locked;
  19646. },
  19647. // Call all callbacks with the given context and arguments
  19648. fireWith: function( context, args ) {
  19649. if ( !locked ) {
  19650. args = args || [];
  19651. args = [ context, args.slice ? args.slice() : args ];
  19652. queue.push( args );
  19653. if ( !firing ) {
  19654. fire();
  19655. }
  19656. }
  19657. return this;
  19658. },
  19659. // Call all the callbacks with the given arguments
  19660. fire: function() {
  19661. self.fireWith( this, arguments );
  19662. return this;
  19663. },
  19664. // To know if the callbacks have already been called at least once
  19665. fired: function() {
  19666. return !!fired;
  19667. }
  19668. };
  19669. return self;
  19670. };
  19671. function Identity( v ) {
  19672. return v;
  19673. }
  19674. function Thrower( ex ) {
  19675. throw ex;
  19676. }
  19677. function adoptValue( value, resolve, reject, noValue ) {
  19678. var method;
  19679. try {
  19680. // Check for promise aspect first to privilege synchronous behavior
  19681. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  19682. method.call( value ).done( resolve ).fail( reject );
  19683. // Other thenables
  19684. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  19685. method.call( value, resolve, reject );
  19686. // Other non-thenables
  19687. } else {
  19688. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  19689. // * false: [ value ].slice( 0 ) => resolve( value )
  19690. // * true: [ value ].slice( 1 ) => resolve()
  19691. resolve.apply( undefined, [ value ].slice( noValue ) );
  19692. }
  19693. // For Promises/A+, convert exceptions into rejections
  19694. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  19695. // Deferred#then to conditionally suppress rejection.
  19696. } catch ( value ) {
  19697. // Support: Android 4.0 only
  19698. // Strict mode functions invoked without .call/.apply get global-object context
  19699. reject.apply( undefined, [ value ] );
  19700. }
  19701. }
  19702. jQuery.extend( {
  19703. Deferred: function( func ) {
  19704. var tuples = [
  19705. // action, add listener, callbacks,
  19706. // ... .then handlers, argument index, [final state]
  19707. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  19708. jQuery.Callbacks( "memory" ), 2 ],
  19709. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  19710. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  19711. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  19712. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  19713. ],
  19714. state = "pending",
  19715. promise = {
  19716. state: function() {
  19717. return state;
  19718. },
  19719. always: function() {
  19720. deferred.done( arguments ).fail( arguments );
  19721. return this;
  19722. },
  19723. "catch": function( fn ) {
  19724. return promise.then( null, fn );
  19725. },
  19726. // Keep pipe for back-compat
  19727. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  19728. var fns = arguments;
  19729. return jQuery.Deferred( function( newDefer ) {
  19730. jQuery.each( tuples, function( i, tuple ) {
  19731. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  19732. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  19733. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  19734. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  19735. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  19736. deferred[ tuple[ 1 ] ]( function() {
  19737. var returned = fn && fn.apply( this, arguments );
  19738. if ( returned && jQuery.isFunction( returned.promise ) ) {
  19739. returned.promise()
  19740. .progress( newDefer.notify )
  19741. .done( newDefer.resolve )
  19742. .fail( newDefer.reject );
  19743. } else {
  19744. newDefer[ tuple[ 0 ] + "With" ](
  19745. this,
  19746. fn ? [ returned ] : arguments
  19747. );
  19748. }
  19749. } );
  19750. } );
  19751. fns = null;
  19752. } ).promise();
  19753. },
  19754. then: function( onFulfilled, onRejected, onProgress ) {
  19755. var maxDepth = 0;
  19756. function resolve( depth, deferred, handler, special ) {
  19757. return function() {
  19758. var that = this,
  19759. args = arguments,
  19760. mightThrow = function() {
  19761. var returned, then;
  19762. // Support: Promises/A+ section 2.3.3.3.3
  19763. // https://promisesaplus.com/#point-59
  19764. // Ignore double-resolution attempts
  19765. if ( depth < maxDepth ) {
  19766. return;
  19767. }
  19768. returned = handler.apply( that, args );
  19769. // Support: Promises/A+ section 2.3.1
  19770. // https://promisesaplus.com/#point-48
  19771. if ( returned === deferred.promise() ) {
  19772. throw new TypeError( "Thenable self-resolution" );
  19773. }
  19774. // Support: Promises/A+ sections 2.3.3.1, 3.5
  19775. // https://promisesaplus.com/#point-54
  19776. // https://promisesaplus.com/#point-75
  19777. // Retrieve `then` only once
  19778. then = returned &&
  19779. // Support: Promises/A+ section 2.3.4
  19780. // https://promisesaplus.com/#point-64
  19781. // Only check objects and functions for thenability
  19782. ( typeof returned === "object" ||
  19783. typeof returned === "function" ) &&
  19784. returned.then;
  19785. // Handle a returned thenable
  19786. if ( jQuery.isFunction( then ) ) {
  19787. // Special processors (notify) just wait for resolution
  19788. if ( special ) {
  19789. then.call(
  19790. returned,
  19791. resolve( maxDepth, deferred, Identity, special ),
  19792. resolve( maxDepth, deferred, Thrower, special )
  19793. );
  19794. // Normal processors (resolve) also hook into progress
  19795. } else {
  19796. // ...and disregard older resolution values
  19797. maxDepth++;
  19798. then.call(
  19799. returned,
  19800. resolve( maxDepth, deferred, Identity, special ),
  19801. resolve( maxDepth, deferred, Thrower, special ),
  19802. resolve( maxDepth, deferred, Identity,
  19803. deferred.notifyWith )
  19804. );
  19805. }
  19806. // Handle all other returned values
  19807. } else {
  19808. // Only substitute handlers pass on context
  19809. // and multiple values (non-spec behavior)
  19810. if ( handler !== Identity ) {
  19811. that = undefined;
  19812. args = [ returned ];
  19813. }
  19814. // Process the value(s)
  19815. // Default process is resolve
  19816. ( special || deferred.resolveWith )( that, args );
  19817. }
  19818. },
  19819. // Only normal processors (resolve) catch and reject exceptions
  19820. process = special ?
  19821. mightThrow :
  19822. function() {
  19823. try {
  19824. mightThrow();
  19825. } catch ( e ) {
  19826. if ( jQuery.Deferred.exceptionHook ) {
  19827. jQuery.Deferred.exceptionHook( e,
  19828. process.stackTrace );
  19829. }
  19830. // Support: Promises/A+ section 2.3.3.3.4.1
  19831. // https://promisesaplus.com/#point-61
  19832. // Ignore post-resolution exceptions
  19833. if ( depth + 1 >= maxDepth ) {
  19834. // Only substitute handlers pass on context
  19835. // and multiple values (non-spec behavior)
  19836. if ( handler !== Thrower ) {
  19837. that = undefined;
  19838. args = [ e ];
  19839. }
  19840. deferred.rejectWith( that, args );
  19841. }
  19842. }
  19843. };
  19844. // Support: Promises/A+ section 2.3.3.3.1
  19845. // https://promisesaplus.com/#point-57
  19846. // Re-resolve promises immediately to dodge false rejection from
  19847. // subsequent errors
  19848. if ( depth ) {
  19849. process();
  19850. } else {
  19851. // Call an optional hook to record the stack, in case of exception
  19852. // since it's otherwise lost when execution goes async
  19853. if ( jQuery.Deferred.getStackHook ) {
  19854. process.stackTrace = jQuery.Deferred.getStackHook();
  19855. }
  19856. window.setTimeout( process );
  19857. }
  19858. };
  19859. }
  19860. return jQuery.Deferred( function( newDefer ) {
  19861. // progress_handlers.add( ... )
  19862. tuples[ 0 ][ 3 ].add(
  19863. resolve(
  19864. 0,
  19865. newDefer,
  19866. jQuery.isFunction( onProgress ) ?
  19867. onProgress :
  19868. Identity,
  19869. newDefer.notifyWith
  19870. )
  19871. );
  19872. // fulfilled_handlers.add( ... )
  19873. tuples[ 1 ][ 3 ].add(
  19874. resolve(
  19875. 0,
  19876. newDefer,
  19877. jQuery.isFunction( onFulfilled ) ?
  19878. onFulfilled :
  19879. Identity
  19880. )
  19881. );
  19882. // rejected_handlers.add( ... )
  19883. tuples[ 2 ][ 3 ].add(
  19884. resolve(
  19885. 0,
  19886. newDefer,
  19887. jQuery.isFunction( onRejected ) ?
  19888. onRejected :
  19889. Thrower
  19890. )
  19891. );
  19892. } ).promise();
  19893. },
  19894. // Get a promise for this deferred
  19895. // If obj is provided, the promise aspect is added to the object
  19896. promise: function( obj ) {
  19897. return obj != null ? jQuery.extend( obj, promise ) : promise;
  19898. }
  19899. },
  19900. deferred = {};
  19901. // Add list-specific methods
  19902. jQuery.each( tuples, function( i, tuple ) {
  19903. var list = tuple[ 2 ],
  19904. stateString = tuple[ 5 ];
  19905. // promise.progress = list.add
  19906. // promise.done = list.add
  19907. // promise.fail = list.add
  19908. promise[ tuple[ 1 ] ] = list.add;
  19909. // Handle state
  19910. if ( stateString ) {
  19911. list.add(
  19912. function() {
  19913. // state = "resolved" (i.e., fulfilled)
  19914. // state = "rejected"
  19915. state = stateString;
  19916. },
  19917. // rejected_callbacks.disable
  19918. // fulfilled_callbacks.disable
  19919. tuples[ 3 - i ][ 2 ].disable,
  19920. // progress_callbacks.lock
  19921. tuples[ 0 ][ 2 ].lock
  19922. );
  19923. }
  19924. // progress_handlers.fire
  19925. // fulfilled_handlers.fire
  19926. // rejected_handlers.fire
  19927. list.add( tuple[ 3 ].fire );
  19928. // deferred.notify = function() { deferred.notifyWith(...) }
  19929. // deferred.resolve = function() { deferred.resolveWith(...) }
  19930. // deferred.reject = function() { deferred.rejectWith(...) }
  19931. deferred[ tuple[ 0 ] ] = function() {
  19932. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  19933. return this;
  19934. };
  19935. // deferred.notifyWith = list.fireWith
  19936. // deferred.resolveWith = list.fireWith
  19937. // deferred.rejectWith = list.fireWith
  19938. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  19939. } );
  19940. // Make the deferred a promise
  19941. promise.promise( deferred );
  19942. // Call given func if any
  19943. if ( func ) {
  19944. func.call( deferred, deferred );
  19945. }
  19946. // All done!
  19947. return deferred;
  19948. },
  19949. // Deferred helper
  19950. when: function( singleValue ) {
  19951. var
  19952. // count of uncompleted subordinates
  19953. remaining = arguments.length,
  19954. // count of unprocessed arguments
  19955. i = remaining,
  19956. // subordinate fulfillment data
  19957. resolveContexts = Array( i ),
  19958. resolveValues = slice.call( arguments ),
  19959. // the master Deferred
  19960. master = jQuery.Deferred(),
  19961. // subordinate callback factory
  19962. updateFunc = function( i ) {
  19963. return function( value ) {
  19964. resolveContexts[ i ] = this;
  19965. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  19966. if ( !( --remaining ) ) {
  19967. master.resolveWith( resolveContexts, resolveValues );
  19968. }
  19969. };
  19970. };
  19971. // Single- and empty arguments are adopted like Promise.resolve
  19972. if ( remaining <= 1 ) {
  19973. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  19974. !remaining );
  19975. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  19976. if ( master.state() === "pending" ||
  19977. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  19978. return master.then();
  19979. }
  19980. }
  19981. // Multiple arguments are aggregated like Promise.all array elements
  19982. while ( i-- ) {
  19983. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  19984. }
  19985. return master.promise();
  19986. }
  19987. } );
  19988. // These usually indicate a programmer mistake during development,
  19989. // warn about them ASAP rather than swallowing them by default.
  19990. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  19991. jQuery.Deferred.exceptionHook = function( error, stack ) {
  19992. // Support: IE 8 - 9 only
  19993. // Console exists when dev tools are open, which can happen at any time
  19994. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  19995. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  19996. }
  19997. };
  19998. jQuery.readyException = function( error ) {
  19999. window.setTimeout( function() {
  20000. throw error;
  20001. } );
  20002. };
  20003. // The deferred used on DOM ready
  20004. var readyList = jQuery.Deferred();
  20005. jQuery.fn.ready = function( fn ) {
  20006. readyList
  20007. .then( fn )
  20008. // Wrap jQuery.readyException in a function so that the lookup
  20009. // happens at the time of error handling instead of callback
  20010. // registration.
  20011. .catch( function( error ) {
  20012. jQuery.readyException( error );
  20013. } );
  20014. return this;
  20015. };
  20016. jQuery.extend( {
  20017. // Is the DOM ready to be used? Set to true once it occurs.
  20018. isReady: false,
  20019. // A counter to track how many items to wait for before
  20020. // the ready event fires. See #6781
  20021. readyWait: 1,
  20022. // Handle when the DOM is ready
  20023. ready: function( wait ) {
  20024. // Abort if there are pending holds or we're already ready
  20025. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  20026. return;
  20027. }
  20028. // Remember that the DOM is ready
  20029. jQuery.isReady = true;
  20030. // If a normal DOM Ready event fired, decrement, and wait if need be
  20031. if ( wait !== true && --jQuery.readyWait > 0 ) {
  20032. return;
  20033. }
  20034. // If there are functions bound, to execute
  20035. readyList.resolveWith( document, [ jQuery ] );
  20036. }
  20037. } );
  20038. jQuery.ready.then = readyList.then;
  20039. // The ready event handler and self cleanup method
  20040. function completed() {
  20041. document.removeEventListener( "DOMContentLoaded", completed );
  20042. window.removeEventListener( "load", completed );
  20043. jQuery.ready();
  20044. }
  20045. // Catch cases where $(document).ready() is called
  20046. // after the browser event has already occurred.
  20047. // Support: IE <=9 - 10 only
  20048. // Older IE sometimes signals "interactive" too soon
  20049. if ( document.readyState === "complete" ||
  20050. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  20051. // Handle it asynchronously to allow scripts the opportunity to delay ready
  20052. window.setTimeout( jQuery.ready );
  20053. } else {
  20054. // Use the handy event callback
  20055. document.addEventListener( "DOMContentLoaded", completed );
  20056. // A fallback to window.onload, that will always work
  20057. window.addEventListener( "load", completed );
  20058. }
  20059. // Multifunctional method to get and set values of a collection
  20060. // The value/s can optionally be executed if it's a function
  20061. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  20062. var i = 0,
  20063. len = elems.length,
  20064. bulk = key == null;
  20065. // Sets many values
  20066. if ( jQuery.type( key ) === "object" ) {
  20067. chainable = true;
  20068. for ( i in key ) {
  20069. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  20070. }
  20071. // Sets one value
  20072. } else if ( value !== undefined ) {
  20073. chainable = true;
  20074. if ( !jQuery.isFunction( value ) ) {
  20075. raw = true;
  20076. }
  20077. if ( bulk ) {
  20078. // Bulk operations run against the entire set
  20079. if ( raw ) {
  20080. fn.call( elems, value );
  20081. fn = null;
  20082. // ...except when executing function values
  20083. } else {
  20084. bulk = fn;
  20085. fn = function( elem, key, value ) {
  20086. return bulk.call( jQuery( elem ), value );
  20087. };
  20088. }
  20089. }
  20090. if ( fn ) {
  20091. for ( ; i < len; i++ ) {
  20092. fn(
  20093. elems[ i ], key, raw ?
  20094. value :
  20095. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  20096. );
  20097. }
  20098. }
  20099. }
  20100. if ( chainable ) {
  20101. return elems;
  20102. }
  20103. // Gets
  20104. if ( bulk ) {
  20105. return fn.call( elems );
  20106. }
  20107. return len ? fn( elems[ 0 ], key ) : emptyGet;
  20108. };
  20109. var acceptData = function( owner ) {
  20110. // Accepts only:
  20111. // - Node
  20112. // - Node.ELEMENT_NODE
  20113. // - Node.DOCUMENT_NODE
  20114. // - Object
  20115. // - Any
  20116. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  20117. };
  20118. function Data() {
  20119. this.expando = jQuery.expando + Data.uid++;
  20120. }
  20121. Data.uid = 1;
  20122. Data.prototype = {
  20123. cache: function( owner ) {
  20124. // Check if the owner object already has a cache
  20125. var value = owner[ this.expando ];
  20126. // If not, create one
  20127. if ( !value ) {
  20128. value = {};
  20129. // We can accept data for non-element nodes in modern browsers,
  20130. // but we should not, see #8335.
  20131. // Always return an empty object.
  20132. if ( acceptData( owner ) ) {
  20133. // If it is a node unlikely to be stringify-ed or looped over
  20134. // use plain assignment
  20135. if ( owner.nodeType ) {
  20136. owner[ this.expando ] = value;
  20137. // Otherwise secure it in a non-enumerable property
  20138. // configurable must be true to allow the property to be
  20139. // deleted when data is removed
  20140. } else {
  20141. Object.defineProperty( owner, this.expando, {
  20142. value: value,
  20143. configurable: true
  20144. } );
  20145. }
  20146. }
  20147. }
  20148. return value;
  20149. },
  20150. set: function( owner, data, value ) {
  20151. var prop,
  20152. cache = this.cache( owner );
  20153. // Handle: [ owner, key, value ] args
  20154. // Always use camelCase key (gh-2257)
  20155. if ( typeof data === "string" ) {
  20156. cache[ jQuery.camelCase( data ) ] = value;
  20157. // Handle: [ owner, { properties } ] args
  20158. } else {
  20159. // Copy the properties one-by-one to the cache object
  20160. for ( prop in data ) {
  20161. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  20162. }
  20163. }
  20164. return cache;
  20165. },
  20166. get: function( owner, key ) {
  20167. return key === undefined ?
  20168. this.cache( owner ) :
  20169. // Always use camelCase key (gh-2257)
  20170. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  20171. },
  20172. access: function( owner, key, value ) {
  20173. // In cases where either:
  20174. //
  20175. // 1. No key was specified
  20176. // 2. A string key was specified, but no value provided
  20177. //
  20178. // Take the "read" path and allow the get method to determine
  20179. // which value to return, respectively either:
  20180. //
  20181. // 1. The entire cache object
  20182. // 2. The data stored at the key
  20183. //
  20184. if ( key === undefined ||
  20185. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  20186. return this.get( owner, key );
  20187. }
  20188. // When the key is not a string, or both a key and value
  20189. // are specified, set or extend (existing objects) with either:
  20190. //
  20191. // 1. An object of properties
  20192. // 2. A key and value
  20193. //
  20194. this.set( owner, key, value );
  20195. // Since the "set" path can have two possible entry points
  20196. // return the expected data based on which path was taken[*]
  20197. return value !== undefined ? value : key;
  20198. },
  20199. remove: function( owner, key ) {
  20200. var i,
  20201. cache = owner[ this.expando ];
  20202. if ( cache === undefined ) {
  20203. return;
  20204. }
  20205. if ( key !== undefined ) {
  20206. // Support array or space separated string of keys
  20207. if ( Array.isArray( key ) ) {
  20208. // If key is an array of keys...
  20209. // We always set camelCase keys, so remove that.
  20210. key = key.map( jQuery.camelCase );
  20211. } else {
  20212. key = jQuery.camelCase( key );
  20213. // If a key with the spaces exists, use it.
  20214. // Otherwise, create an array by matching non-whitespace
  20215. key = key in cache ?
  20216. [ key ] :
  20217. ( key.match( rnothtmlwhite ) || [] );
  20218. }
  20219. i = key.length;
  20220. while ( i-- ) {
  20221. delete cache[ key[ i ] ];
  20222. }
  20223. }
  20224. // Remove the expando if there's no more data
  20225. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  20226. // Support: Chrome <=35 - 45
  20227. // Webkit & Blink performance suffers when deleting properties
  20228. // from DOM nodes, so set to undefined instead
  20229. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  20230. if ( owner.nodeType ) {
  20231. owner[ this.expando ] = undefined;
  20232. } else {
  20233. delete owner[ this.expando ];
  20234. }
  20235. }
  20236. },
  20237. hasData: function( owner ) {
  20238. var cache = owner[ this.expando ];
  20239. return cache !== undefined && !jQuery.isEmptyObject( cache );
  20240. }
  20241. };
  20242. var dataPriv = new Data();
  20243. var dataUser = new Data();
  20244. // Implementation Summary
  20245. //
  20246. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  20247. // 2. Improve the module's maintainability by reducing the storage
  20248. // paths to a single mechanism.
  20249. // 3. Use the same single mechanism to support "private" and "user" data.
  20250. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  20251. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  20252. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  20253. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  20254. rmultiDash = /[A-Z]/g;
  20255. function getData( data ) {
  20256. if ( data === "true" ) {
  20257. return true;
  20258. }
  20259. if ( data === "false" ) {
  20260. return false;
  20261. }
  20262. if ( data === "null" ) {
  20263. return null;
  20264. }
  20265. // Only convert to a number if it doesn't change the string
  20266. if ( data === +data + "" ) {
  20267. return +data;
  20268. }
  20269. if ( rbrace.test( data ) ) {
  20270. return JSON.parse( data );
  20271. }
  20272. return data;
  20273. }
  20274. function dataAttr( elem, key, data ) {
  20275. var name;
  20276. // If nothing was found internally, try to fetch any
  20277. // data from the HTML5 data-* attribute
  20278. if ( data === undefined && elem.nodeType === 1 ) {
  20279. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  20280. data = elem.getAttribute( name );
  20281. if ( typeof data === "string" ) {
  20282. try {
  20283. data = getData( data );
  20284. } catch ( e ) {}
  20285. // Make sure we set the data so it isn't changed later
  20286. dataUser.set( elem, key, data );
  20287. } else {
  20288. data = undefined;
  20289. }
  20290. }
  20291. return data;
  20292. }
  20293. jQuery.extend( {
  20294. hasData: function( elem ) {
  20295. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  20296. },
  20297. data: function( elem, name, data ) {
  20298. return dataUser.access( elem, name, data );
  20299. },
  20300. removeData: function( elem, name ) {
  20301. dataUser.remove( elem, name );
  20302. },
  20303. // TODO: Now that all calls to _data and _removeData have been replaced
  20304. // with direct calls to dataPriv methods, these can be deprecated.
  20305. _data: function( elem, name, data ) {
  20306. return dataPriv.access( elem, name, data );
  20307. },
  20308. _removeData: function( elem, name ) {
  20309. dataPriv.remove( elem, name );
  20310. }
  20311. } );
  20312. jQuery.fn.extend( {
  20313. data: function( key, value ) {
  20314. var i, name, data,
  20315. elem = this[ 0 ],
  20316. attrs = elem && elem.attributes;
  20317. // Gets all values
  20318. if ( key === undefined ) {
  20319. if ( this.length ) {
  20320. data = dataUser.get( elem );
  20321. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  20322. i = attrs.length;
  20323. while ( i-- ) {
  20324. // Support: IE 11 only
  20325. // The attrs elements can be null (#14894)
  20326. if ( attrs[ i ] ) {
  20327. name = attrs[ i ].name;
  20328. if ( name.indexOf( "data-" ) === 0 ) {
  20329. name = jQuery.camelCase( name.slice( 5 ) );
  20330. dataAttr( elem, name, data[ name ] );
  20331. }
  20332. }
  20333. }
  20334. dataPriv.set( elem, "hasDataAttrs", true );
  20335. }
  20336. }
  20337. return data;
  20338. }
  20339. // Sets multiple values
  20340. if ( typeof key === "object" ) {
  20341. return this.each( function() {
  20342. dataUser.set( this, key );
  20343. } );
  20344. }
  20345. return access( this, function( value ) {
  20346. var data;
  20347. // The calling jQuery object (element matches) is not empty
  20348. // (and therefore has an element appears at this[ 0 ]) and the
  20349. // `value` parameter was not undefined. An empty jQuery object
  20350. // will result in `undefined` for elem = this[ 0 ] which will
  20351. // throw an exception if an attempt to read a data cache is made.
  20352. if ( elem && value === undefined ) {
  20353. // Attempt to get data from the cache
  20354. // The key will always be camelCased in Data
  20355. data = dataUser.get( elem, key );
  20356. if ( data !== undefined ) {
  20357. return data;
  20358. }
  20359. // Attempt to "discover" the data in
  20360. // HTML5 custom data-* attrs
  20361. data = dataAttr( elem, key );
  20362. if ( data !== undefined ) {
  20363. return data;
  20364. }
  20365. // We tried really hard, but the data doesn't exist.
  20366. return;
  20367. }
  20368. // Set the data...
  20369. this.each( function() {
  20370. // We always store the camelCased key
  20371. dataUser.set( this, key, value );
  20372. } );
  20373. }, null, value, arguments.length > 1, null, true );
  20374. },
  20375. removeData: function( key ) {
  20376. return this.each( function() {
  20377. dataUser.remove( this, key );
  20378. } );
  20379. }
  20380. } );
  20381. jQuery.extend( {
  20382. queue: function( elem, type, data ) {
  20383. var queue;
  20384. if ( elem ) {
  20385. type = ( type || "fx" ) + "queue";
  20386. queue = dataPriv.get( elem, type );
  20387. // Speed up dequeue by getting out quickly if this is just a lookup
  20388. if ( data ) {
  20389. if ( !queue || Array.isArray( data ) ) {
  20390. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  20391. } else {
  20392. queue.push( data );
  20393. }
  20394. }
  20395. return queue || [];
  20396. }
  20397. },
  20398. dequeue: function( elem, type ) {
  20399. type = type || "fx";
  20400. var queue = jQuery.queue( elem, type ),
  20401. startLength = queue.length,
  20402. fn = queue.shift(),
  20403. hooks = jQuery._queueHooks( elem, type ),
  20404. next = function() {
  20405. jQuery.dequeue( elem, type );
  20406. };
  20407. // If the fx queue is dequeued, always remove the progress sentinel
  20408. if ( fn === "inprogress" ) {
  20409. fn = queue.shift();
  20410. startLength--;
  20411. }
  20412. if ( fn ) {
  20413. // Add a progress sentinel to prevent the fx queue from being
  20414. // automatically dequeued
  20415. if ( type === "fx" ) {
  20416. queue.unshift( "inprogress" );
  20417. }
  20418. // Clear up the last queue stop function
  20419. delete hooks.stop;
  20420. fn.call( elem, next, hooks );
  20421. }
  20422. if ( !startLength && hooks ) {
  20423. hooks.empty.fire();
  20424. }
  20425. },
  20426. // Not public - generate a queueHooks object, or return the current one
  20427. _queueHooks: function( elem, type ) {
  20428. var key = type + "queueHooks";
  20429. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  20430. empty: jQuery.Callbacks( "once memory" ).add( function() {
  20431. dataPriv.remove( elem, [ type + "queue", key ] );
  20432. } )
  20433. } );
  20434. }
  20435. } );
  20436. jQuery.fn.extend( {
  20437. queue: function( type, data ) {
  20438. var setter = 2;
  20439. if ( typeof type !== "string" ) {
  20440. data = type;
  20441. type = "fx";
  20442. setter--;
  20443. }
  20444. if ( arguments.length < setter ) {
  20445. return jQuery.queue( this[ 0 ], type );
  20446. }
  20447. return data === undefined ?
  20448. this :
  20449. this.each( function() {
  20450. var queue = jQuery.queue( this, type, data );
  20451. // Ensure a hooks for this queue
  20452. jQuery._queueHooks( this, type );
  20453. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  20454. jQuery.dequeue( this, type );
  20455. }
  20456. } );
  20457. },
  20458. dequeue: function( type ) {
  20459. return this.each( function() {
  20460. jQuery.dequeue( this, type );
  20461. } );
  20462. },
  20463. clearQueue: function( type ) {
  20464. return this.queue( type || "fx", [] );
  20465. },
  20466. // Get a promise resolved when queues of a certain type
  20467. // are emptied (fx is the type by default)
  20468. promise: function( type, obj ) {
  20469. var tmp,
  20470. count = 1,
  20471. defer = jQuery.Deferred(),
  20472. elements = this,
  20473. i = this.length,
  20474. resolve = function() {
  20475. if ( !( --count ) ) {
  20476. defer.resolveWith( elements, [ elements ] );
  20477. }
  20478. };
  20479. if ( typeof type !== "string" ) {
  20480. obj = type;
  20481. type = undefined;
  20482. }
  20483. type = type || "fx";
  20484. while ( i-- ) {
  20485. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  20486. if ( tmp && tmp.empty ) {
  20487. count++;
  20488. tmp.empty.add( resolve );
  20489. }
  20490. }
  20491. resolve();
  20492. return defer.promise( obj );
  20493. }
  20494. } );
  20495. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  20496. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  20497. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  20498. var isHiddenWithinTree = function( elem, el ) {
  20499. // isHiddenWithinTree might be called from jQuery#filter function;
  20500. // in that case, element will be second argument
  20501. elem = el || elem;
  20502. // Inline style trumps all
  20503. return elem.style.display === "none" ||
  20504. elem.style.display === "" &&
  20505. // Otherwise, check computed style
  20506. // Support: Firefox <=43 - 45
  20507. // Disconnected elements can have computed display: none, so first confirm that elem is
  20508. // in the document.
  20509. jQuery.contains( elem.ownerDocument, elem ) &&
  20510. jQuery.css( elem, "display" ) === "none";
  20511. };
  20512. var swap = function( elem, options, callback, args ) {
  20513. var ret, name,
  20514. old = {};
  20515. // Remember the old values, and insert the new ones
  20516. for ( name in options ) {
  20517. old[ name ] = elem.style[ name ];
  20518. elem.style[ name ] = options[ name ];
  20519. }
  20520. ret = callback.apply( elem, args || [] );
  20521. // Revert the old values
  20522. for ( name in options ) {
  20523. elem.style[ name ] = old[ name ];
  20524. }
  20525. return ret;
  20526. };
  20527. function adjustCSS( elem, prop, valueParts, tween ) {
  20528. var adjusted,
  20529. scale = 1,
  20530. maxIterations = 20,
  20531. currentValue = tween ?
  20532. function() {
  20533. return tween.cur();
  20534. } :
  20535. function() {
  20536. return jQuery.css( elem, prop, "" );
  20537. },
  20538. initial = currentValue(),
  20539. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  20540. // Starting value computation is required for potential unit mismatches
  20541. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  20542. rcssNum.exec( jQuery.css( elem, prop ) );
  20543. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  20544. // Trust units reported by jQuery.css
  20545. unit = unit || initialInUnit[ 3 ];
  20546. // Make sure we update the tween properties later on
  20547. valueParts = valueParts || [];
  20548. // Iteratively approximate from a nonzero starting point
  20549. initialInUnit = +initial || 1;
  20550. do {
  20551. // If previous iteration zeroed out, double until we get *something*.
  20552. // Use string for doubling so we don't accidentally see scale as unchanged below
  20553. scale = scale || ".5";
  20554. // Adjust and apply
  20555. initialInUnit = initialInUnit / scale;
  20556. jQuery.style( elem, prop, initialInUnit + unit );
  20557. // Update scale, tolerating zero or NaN from tween.cur()
  20558. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  20559. } while (
  20560. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  20561. );
  20562. }
  20563. if ( valueParts ) {
  20564. initialInUnit = +initialInUnit || +initial || 0;
  20565. // Apply relative offset (+=/-=) if specified
  20566. adjusted = valueParts[ 1 ] ?
  20567. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  20568. +valueParts[ 2 ];
  20569. if ( tween ) {
  20570. tween.unit = unit;
  20571. tween.start = initialInUnit;
  20572. tween.end = adjusted;
  20573. }
  20574. }
  20575. return adjusted;
  20576. }
  20577. var defaultDisplayMap = {};
  20578. function getDefaultDisplay( elem ) {
  20579. var temp,
  20580. doc = elem.ownerDocument,
  20581. nodeName = elem.nodeName,
  20582. display = defaultDisplayMap[ nodeName ];
  20583. if ( display ) {
  20584. return display;
  20585. }
  20586. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  20587. display = jQuery.css( temp, "display" );
  20588. temp.parentNode.removeChild( temp );
  20589. if ( display === "none" ) {
  20590. display = "block";
  20591. }
  20592. defaultDisplayMap[ nodeName ] = display;
  20593. return display;
  20594. }
  20595. function showHide( elements, show ) {
  20596. var display, elem,
  20597. values = [],
  20598. index = 0,
  20599. length = elements.length;
  20600. // Determine new display value for elements that need to change
  20601. for ( ; index < length; index++ ) {
  20602. elem = elements[ index ];
  20603. if ( !elem.style ) {
  20604. continue;
  20605. }
  20606. display = elem.style.display;
  20607. if ( show ) {
  20608. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  20609. // check is required in this first loop unless we have a nonempty display value (either
  20610. // inline or about-to-be-restored)
  20611. if ( display === "none" ) {
  20612. values[ index ] = dataPriv.get( elem, "display" ) || null;
  20613. if ( !values[ index ] ) {
  20614. elem.style.display = "";
  20615. }
  20616. }
  20617. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  20618. values[ index ] = getDefaultDisplay( elem );
  20619. }
  20620. } else {
  20621. if ( display !== "none" ) {
  20622. values[ index ] = "none";
  20623. // Remember what we're overwriting
  20624. dataPriv.set( elem, "display", display );
  20625. }
  20626. }
  20627. }
  20628. // Set the display of the elements in a second loop to avoid constant reflow
  20629. for ( index = 0; index < length; index++ ) {
  20630. if ( values[ index ] != null ) {
  20631. elements[ index ].style.display = values[ index ];
  20632. }
  20633. }
  20634. return elements;
  20635. }
  20636. jQuery.fn.extend( {
  20637. show: function() {
  20638. return showHide( this, true );
  20639. },
  20640. hide: function() {
  20641. return showHide( this );
  20642. },
  20643. toggle: function( state ) {
  20644. if ( typeof state === "boolean" ) {
  20645. return state ? this.show() : this.hide();
  20646. }
  20647. return this.each( function() {
  20648. if ( isHiddenWithinTree( this ) ) {
  20649. jQuery( this ).show();
  20650. } else {
  20651. jQuery( this ).hide();
  20652. }
  20653. } );
  20654. }
  20655. } );
  20656. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  20657. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  20658. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  20659. // We have to close these tags to support XHTML (#13200)
  20660. var wrapMap = {
  20661. // Support: IE <=9 only
  20662. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  20663. // XHTML parsers do not magically insert elements in the
  20664. // same way that tag soup parsers do. So we cannot shorten
  20665. // this by omitting <tbody> or other required elements.
  20666. thead: [ 1, "<table>", "</table>" ],
  20667. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  20668. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  20669. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  20670. _default: [ 0, "", "" ]
  20671. };
  20672. // Support: IE <=9 only
  20673. wrapMap.optgroup = wrapMap.option;
  20674. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  20675. wrapMap.th = wrapMap.td;
  20676. function getAll( context, tag ) {
  20677. // Support: IE <=9 - 11 only
  20678. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  20679. var ret;
  20680. if ( typeof context.getElementsByTagName !== "undefined" ) {
  20681. ret = context.getElementsByTagName( tag || "*" );
  20682. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  20683. ret = context.querySelectorAll( tag || "*" );
  20684. } else {
  20685. ret = [];
  20686. }
  20687. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  20688. return jQuery.merge( [ context ], ret );
  20689. }
  20690. return ret;
  20691. }
  20692. // Mark scripts as having already been evaluated
  20693. function setGlobalEval( elems, refElements ) {
  20694. var i = 0,
  20695. l = elems.length;
  20696. for ( ; i < l; i++ ) {
  20697. dataPriv.set(
  20698. elems[ i ],
  20699. "globalEval",
  20700. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  20701. );
  20702. }
  20703. }
  20704. var rhtml = /<|&#?\w+;/;
  20705. function buildFragment( elems, context, scripts, selection, ignored ) {
  20706. var elem, tmp, tag, wrap, contains, j,
  20707. fragment = context.createDocumentFragment(),
  20708. nodes = [],
  20709. i = 0,
  20710. l = elems.length;
  20711. for ( ; i < l; i++ ) {
  20712. elem = elems[ i ];
  20713. if ( elem || elem === 0 ) {
  20714. // Add nodes directly
  20715. if ( jQuery.type( elem ) === "object" ) {
  20716. // Support: Android <=4.0 only, PhantomJS 1 only
  20717. // push.apply(_, arraylike) throws on ancient WebKit
  20718. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  20719. // Convert non-html into a text node
  20720. } else if ( !rhtml.test( elem ) ) {
  20721. nodes.push( context.createTextNode( elem ) );
  20722. // Convert html into DOM nodes
  20723. } else {
  20724. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  20725. // Deserialize a standard representation
  20726. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  20727. wrap = wrapMap[ tag ] || wrapMap._default;
  20728. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  20729. // Descend through wrappers to the right content
  20730. j = wrap[ 0 ];
  20731. while ( j-- ) {
  20732. tmp = tmp.lastChild;
  20733. }
  20734. // Support: Android <=4.0 only, PhantomJS 1 only
  20735. // push.apply(_, arraylike) throws on ancient WebKit
  20736. jQuery.merge( nodes, tmp.childNodes );
  20737. // Remember the top-level container
  20738. tmp = fragment.firstChild;
  20739. // Ensure the created nodes are orphaned (#12392)
  20740. tmp.textContent = "";
  20741. }
  20742. }
  20743. }
  20744. // Remove wrapper from fragment
  20745. fragment.textContent = "";
  20746. i = 0;
  20747. while ( ( elem = nodes[ i++ ] ) ) {
  20748. // Skip elements already in the context collection (trac-4087)
  20749. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  20750. if ( ignored ) {
  20751. ignored.push( elem );
  20752. }
  20753. continue;
  20754. }
  20755. contains = jQuery.contains( elem.ownerDocument, elem );
  20756. // Append to fragment
  20757. tmp = getAll( fragment.appendChild( elem ), "script" );
  20758. // Preserve script evaluation history
  20759. if ( contains ) {
  20760. setGlobalEval( tmp );
  20761. }
  20762. // Capture executables
  20763. if ( scripts ) {
  20764. j = 0;
  20765. while ( ( elem = tmp[ j++ ] ) ) {
  20766. if ( rscriptType.test( elem.type || "" ) ) {
  20767. scripts.push( elem );
  20768. }
  20769. }
  20770. }
  20771. }
  20772. return fragment;
  20773. }
  20774. ( function() {
  20775. var fragment = document.createDocumentFragment(),
  20776. div = fragment.appendChild( document.createElement( "div" ) ),
  20777. input = document.createElement( "input" );
  20778. // Support: Android 4.0 - 4.3 only
  20779. // Check state lost if the name is set (#11217)
  20780. // Support: Windows Web Apps (WWA)
  20781. // `name` and `type` must use .setAttribute for WWA (#14901)
  20782. input.setAttribute( "type", "radio" );
  20783. input.setAttribute( "checked", "checked" );
  20784. input.setAttribute( "name", "t" );
  20785. div.appendChild( input );
  20786. // Support: Android <=4.1 only
  20787. // Older WebKit doesn't clone checked state correctly in fragments
  20788. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  20789. // Support: IE <=11 only
  20790. // Make sure textarea (and checkbox) defaultValue is properly cloned
  20791. div.innerHTML = "<textarea>x</textarea>";
  20792. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  20793. } )();
  20794. var documentElement = document.documentElement;
  20795. var
  20796. rkeyEvent = /^key/,
  20797. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  20798. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  20799. function returnTrue() {
  20800. return true;
  20801. }
  20802. function returnFalse() {
  20803. return false;
  20804. }
  20805. // Support: IE <=9 only
  20806. // See #13393 for more info
  20807. function safeActiveElement() {
  20808. try {
  20809. return document.activeElement;
  20810. } catch ( err ) { }
  20811. }
  20812. function on( elem, types, selector, data, fn, one ) {
  20813. var origFn, type;
  20814. // Types can be a map of types/handlers
  20815. if ( typeof types === "object" ) {
  20816. // ( types-Object, selector, data )
  20817. if ( typeof selector !== "string" ) {
  20818. // ( types-Object, data )
  20819. data = data || selector;
  20820. selector = undefined;
  20821. }
  20822. for ( type in types ) {
  20823. on( elem, type, selector, data, types[ type ], one );
  20824. }
  20825. return elem;
  20826. }
  20827. if ( data == null && fn == null ) {
  20828. // ( types, fn )
  20829. fn = selector;
  20830. data = selector = undefined;
  20831. } else if ( fn == null ) {
  20832. if ( typeof selector === "string" ) {
  20833. // ( types, selector, fn )
  20834. fn = data;
  20835. data = undefined;
  20836. } else {
  20837. // ( types, data, fn )
  20838. fn = data;
  20839. data = selector;
  20840. selector = undefined;
  20841. }
  20842. }
  20843. if ( fn === false ) {
  20844. fn = returnFalse;
  20845. } else if ( !fn ) {
  20846. return elem;
  20847. }
  20848. if ( one === 1 ) {
  20849. origFn = fn;
  20850. fn = function( event ) {
  20851. // Can use an empty set, since event contains the info
  20852. jQuery().off( event );
  20853. return origFn.apply( this, arguments );
  20854. };
  20855. // Use same guid so caller can remove using origFn
  20856. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  20857. }
  20858. return elem.each( function() {
  20859. jQuery.event.add( this, types, fn, data, selector );
  20860. } );
  20861. }
  20862. /*
  20863. * Helper functions for managing events -- not part of the public interface.
  20864. * Props to Dean Edwards' addEvent library for many of the ideas.
  20865. */
  20866. jQuery.event = {
  20867. global: {},
  20868. add: function( elem, types, handler, data, selector ) {
  20869. var handleObjIn, eventHandle, tmp,
  20870. events, t, handleObj,
  20871. special, handlers, type, namespaces, origType,
  20872. elemData = dataPriv.get( elem );
  20873. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  20874. if ( !elemData ) {
  20875. return;
  20876. }
  20877. // Caller can pass in an object of custom data in lieu of the handler
  20878. if ( handler.handler ) {
  20879. handleObjIn = handler;
  20880. handler = handleObjIn.handler;
  20881. selector = handleObjIn.selector;
  20882. }
  20883. // Ensure that invalid selectors throw exceptions at attach time
  20884. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  20885. if ( selector ) {
  20886. jQuery.find.matchesSelector( documentElement, selector );
  20887. }
  20888. // Make sure that the handler has a unique ID, used to find/remove it later
  20889. if ( !handler.guid ) {
  20890. handler.guid = jQuery.guid++;
  20891. }
  20892. // Init the element's event structure and main handler, if this is the first
  20893. if ( !( events = elemData.events ) ) {
  20894. events = elemData.events = {};
  20895. }
  20896. if ( !( eventHandle = elemData.handle ) ) {
  20897. eventHandle = elemData.handle = function( e ) {
  20898. // Discard the second event of a jQuery.event.trigger() and
  20899. // when an event is called after a page has unloaded
  20900. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  20901. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  20902. };
  20903. }
  20904. // Handle multiple events separated by a space
  20905. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  20906. t = types.length;
  20907. while ( t-- ) {
  20908. tmp = rtypenamespace.exec( types[ t ] ) || [];
  20909. type = origType = tmp[ 1 ];
  20910. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  20911. // There *must* be a type, no attaching namespace-only handlers
  20912. if ( !type ) {
  20913. continue;
  20914. }
  20915. // If event changes its type, use the special event handlers for the changed type
  20916. special = jQuery.event.special[ type ] || {};
  20917. // If selector defined, determine special event api type, otherwise given type
  20918. type = ( selector ? special.delegateType : special.bindType ) || type;
  20919. // Update special based on newly reset type
  20920. special = jQuery.event.special[ type ] || {};
  20921. // handleObj is passed to all event handlers
  20922. handleObj = jQuery.extend( {
  20923. type: type,
  20924. origType: origType,
  20925. data: data,
  20926. handler: handler,
  20927. guid: handler.guid,
  20928. selector: selector,
  20929. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  20930. namespace: namespaces.join( "." )
  20931. }, handleObjIn );
  20932. // Init the event handler queue if we're the first
  20933. if ( !( handlers = events[ type ] ) ) {
  20934. handlers = events[ type ] = [];
  20935. handlers.delegateCount = 0;
  20936. // Only use addEventListener if the special events handler returns false
  20937. if ( !special.setup ||
  20938. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  20939. if ( elem.addEventListener ) {
  20940. elem.addEventListener( type, eventHandle );
  20941. }
  20942. }
  20943. }
  20944. if ( special.add ) {
  20945. special.add.call( elem, handleObj );
  20946. if ( !handleObj.handler.guid ) {
  20947. handleObj.handler.guid = handler.guid;
  20948. }
  20949. }
  20950. // Add to the element's handler list, delegates in front
  20951. if ( selector ) {
  20952. handlers.splice( handlers.delegateCount++, 0, handleObj );
  20953. } else {
  20954. handlers.push( handleObj );
  20955. }
  20956. // Keep track of which events have ever been used, for event optimization
  20957. jQuery.event.global[ type ] = true;
  20958. }
  20959. },
  20960. // Detach an event or set of events from an element
  20961. remove: function( elem, types, handler, selector, mappedTypes ) {
  20962. var j, origCount, tmp,
  20963. events, t, handleObj,
  20964. special, handlers, type, namespaces, origType,
  20965. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  20966. if ( !elemData || !( events = elemData.events ) ) {
  20967. return;
  20968. }
  20969. // Once for each type.namespace in types; type may be omitted
  20970. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  20971. t = types.length;
  20972. while ( t-- ) {
  20973. tmp = rtypenamespace.exec( types[ t ] ) || [];
  20974. type = origType = tmp[ 1 ];
  20975. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  20976. // Unbind all events (on this namespace, if provided) for the element
  20977. if ( !type ) {
  20978. for ( type in events ) {
  20979. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  20980. }
  20981. continue;
  20982. }
  20983. special = jQuery.event.special[ type ] || {};
  20984. type = ( selector ? special.delegateType : special.bindType ) || type;
  20985. handlers = events[ type ] || [];
  20986. tmp = tmp[ 2 ] &&
  20987. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  20988. // Remove matching events
  20989. origCount = j = handlers.length;
  20990. while ( j-- ) {
  20991. handleObj = handlers[ j ];
  20992. if ( ( mappedTypes || origType === handleObj.origType ) &&
  20993. ( !handler || handler.guid === handleObj.guid ) &&
  20994. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  20995. ( !selector || selector === handleObj.selector ||
  20996. selector === "**" && handleObj.selector ) ) {
  20997. handlers.splice( j, 1 );
  20998. if ( handleObj.selector ) {
  20999. handlers.delegateCount--;
  21000. }
  21001. if ( special.remove ) {
  21002. special.remove.call( elem, handleObj );
  21003. }
  21004. }
  21005. }
  21006. // Remove generic event handler if we removed something and no more handlers exist
  21007. // (avoids potential for endless recursion during removal of special event handlers)
  21008. if ( origCount && !handlers.length ) {
  21009. if ( !special.teardown ||
  21010. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  21011. jQuery.removeEvent( elem, type, elemData.handle );
  21012. }
  21013. delete events[ type ];
  21014. }
  21015. }
  21016. // Remove data and the expando if it's no longer used
  21017. if ( jQuery.isEmptyObject( events ) ) {
  21018. dataPriv.remove( elem, "handle events" );
  21019. }
  21020. },
  21021. dispatch: function( nativeEvent ) {
  21022. // Make a writable jQuery.Event from the native event object
  21023. var event = jQuery.event.fix( nativeEvent );
  21024. var i, j, ret, matched, handleObj, handlerQueue,
  21025. args = new Array( arguments.length ),
  21026. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  21027. special = jQuery.event.special[ event.type ] || {};
  21028. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  21029. args[ 0 ] = event;
  21030. for ( i = 1; i < arguments.length; i++ ) {
  21031. args[ i ] = arguments[ i ];
  21032. }
  21033. event.delegateTarget = this;
  21034. // Call the preDispatch hook for the mapped type, and let it bail if desired
  21035. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  21036. return;
  21037. }
  21038. // Determine handlers
  21039. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  21040. // Run delegates first; they may want to stop propagation beneath us
  21041. i = 0;
  21042. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  21043. event.currentTarget = matched.elem;
  21044. j = 0;
  21045. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  21046. !event.isImmediatePropagationStopped() ) {
  21047. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  21048. // a subset or equal to those in the bound event (both can have no namespace).
  21049. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  21050. event.handleObj = handleObj;
  21051. event.data = handleObj.data;
  21052. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  21053. handleObj.handler ).apply( matched.elem, args );
  21054. if ( ret !== undefined ) {
  21055. if ( ( event.result = ret ) === false ) {
  21056. event.preventDefault();
  21057. event.stopPropagation();
  21058. }
  21059. }
  21060. }
  21061. }
  21062. }
  21063. // Call the postDispatch hook for the mapped type
  21064. if ( special.postDispatch ) {
  21065. special.postDispatch.call( this, event );
  21066. }
  21067. return event.result;
  21068. },
  21069. handlers: function( event, handlers ) {
  21070. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  21071. handlerQueue = [],
  21072. delegateCount = handlers.delegateCount,
  21073. cur = event.target;
  21074. // Find delegate handlers
  21075. if ( delegateCount &&
  21076. // Support: IE <=9
  21077. // Black-hole SVG <use> instance trees (trac-13180)
  21078. cur.nodeType &&
  21079. // Support: Firefox <=42
  21080. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  21081. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  21082. // Support: IE 11 only
  21083. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  21084. !( event.type === "click" && event.button >= 1 ) ) {
  21085. for ( ; cur !== this; cur = cur.parentNode || this ) {
  21086. // Don't check non-elements (#13208)
  21087. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  21088. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  21089. matchedHandlers = [];
  21090. matchedSelectors = {};
  21091. for ( i = 0; i < delegateCount; i++ ) {
  21092. handleObj = handlers[ i ];
  21093. // Don't conflict with Object.prototype properties (#13203)
  21094. sel = handleObj.selector + " ";
  21095. if ( matchedSelectors[ sel ] === undefined ) {
  21096. matchedSelectors[ sel ] = handleObj.needsContext ?
  21097. jQuery( sel, this ).index( cur ) > -1 :
  21098. jQuery.find( sel, this, null, [ cur ] ).length;
  21099. }
  21100. if ( matchedSelectors[ sel ] ) {
  21101. matchedHandlers.push( handleObj );
  21102. }
  21103. }
  21104. if ( matchedHandlers.length ) {
  21105. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  21106. }
  21107. }
  21108. }
  21109. }
  21110. // Add the remaining (directly-bound) handlers
  21111. cur = this;
  21112. if ( delegateCount < handlers.length ) {
  21113. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  21114. }
  21115. return handlerQueue;
  21116. },
  21117. addProp: function( name, hook ) {
  21118. Object.defineProperty( jQuery.Event.prototype, name, {
  21119. enumerable: true,
  21120. configurable: true,
  21121. get: jQuery.isFunction( hook ) ?
  21122. function() {
  21123. if ( this.originalEvent ) {
  21124. return hook( this.originalEvent );
  21125. }
  21126. } :
  21127. function() {
  21128. if ( this.originalEvent ) {
  21129. return this.originalEvent[ name ];
  21130. }
  21131. },
  21132. set: function( value ) {
  21133. Object.defineProperty( this, name, {
  21134. enumerable: true,
  21135. configurable: true,
  21136. writable: true,
  21137. value: value
  21138. } );
  21139. }
  21140. } );
  21141. },
  21142. fix: function( originalEvent ) {
  21143. return originalEvent[ jQuery.expando ] ?
  21144. originalEvent :
  21145. new jQuery.Event( originalEvent );
  21146. },
  21147. special: {
  21148. load: {
  21149. // Prevent triggered image.load events from bubbling to window.load
  21150. noBubble: true
  21151. },
  21152. focus: {
  21153. // Fire native event if possible so blur/focus sequence is correct
  21154. trigger: function() {
  21155. if ( this !== safeActiveElement() && this.focus ) {
  21156. this.focus();
  21157. return false;
  21158. }
  21159. },
  21160. delegateType: "focusin"
  21161. },
  21162. blur: {
  21163. trigger: function() {
  21164. if ( this === safeActiveElement() && this.blur ) {
  21165. this.blur();
  21166. return false;
  21167. }
  21168. },
  21169. delegateType: "focusout"
  21170. },
  21171. click: {
  21172. // For checkbox, fire native event so checked state will be right
  21173. trigger: function() {
  21174. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  21175. this.click();
  21176. return false;
  21177. }
  21178. },
  21179. // For cross-browser consistency, don't fire native .click() on links
  21180. _default: function( event ) {
  21181. return nodeName( event.target, "a" );
  21182. }
  21183. },
  21184. beforeunload: {
  21185. postDispatch: function( event ) {
  21186. // Support: Firefox 20+
  21187. // Firefox doesn't alert if the returnValue field is not set.
  21188. if ( event.result !== undefined && event.originalEvent ) {
  21189. event.originalEvent.returnValue = event.result;
  21190. }
  21191. }
  21192. }
  21193. }
  21194. };
  21195. jQuery.removeEvent = function( elem, type, handle ) {
  21196. // This "if" is needed for plain objects
  21197. if ( elem.removeEventListener ) {
  21198. elem.removeEventListener( type, handle );
  21199. }
  21200. };
  21201. jQuery.Event = function( src, props ) {
  21202. // Allow instantiation without the 'new' keyword
  21203. if ( !( this instanceof jQuery.Event ) ) {
  21204. return new jQuery.Event( src, props );
  21205. }
  21206. // Event object
  21207. if ( src && src.type ) {
  21208. this.originalEvent = src;
  21209. this.type = src.type;
  21210. // Events bubbling up the document may have been marked as prevented
  21211. // by a handler lower down the tree; reflect the correct value.
  21212. this.isDefaultPrevented = src.defaultPrevented ||
  21213. src.defaultPrevented === undefined &&
  21214. // Support: Android <=2.3 only
  21215. src.returnValue === false ?
  21216. returnTrue :
  21217. returnFalse;
  21218. // Create target properties
  21219. // Support: Safari <=6 - 7 only
  21220. // Target should not be a text node (#504, #13143)
  21221. this.target = ( src.target && src.target.nodeType === 3 ) ?
  21222. src.target.parentNode :
  21223. src.target;
  21224. this.currentTarget = src.currentTarget;
  21225. this.relatedTarget = src.relatedTarget;
  21226. // Event type
  21227. } else {
  21228. this.type = src;
  21229. }
  21230. // Put explicitly provided properties onto the event object
  21231. if ( props ) {
  21232. jQuery.extend( this, props );
  21233. }
  21234. // Create a timestamp if incoming event doesn't have one
  21235. this.timeStamp = src && src.timeStamp || jQuery.now();
  21236. // Mark it as fixed
  21237. this[ jQuery.expando ] = true;
  21238. };
  21239. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  21240. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  21241. jQuery.Event.prototype = {
  21242. constructor: jQuery.Event,
  21243. isDefaultPrevented: returnFalse,
  21244. isPropagationStopped: returnFalse,
  21245. isImmediatePropagationStopped: returnFalse,
  21246. isSimulated: false,
  21247. preventDefault: function() {
  21248. var e = this.originalEvent;
  21249. this.isDefaultPrevented = returnTrue;
  21250. if ( e && !this.isSimulated ) {
  21251. e.preventDefault();
  21252. }
  21253. },
  21254. stopPropagation: function() {
  21255. var e = this.originalEvent;
  21256. this.isPropagationStopped = returnTrue;
  21257. if ( e && !this.isSimulated ) {
  21258. e.stopPropagation();
  21259. }
  21260. },
  21261. stopImmediatePropagation: function() {
  21262. var e = this.originalEvent;
  21263. this.isImmediatePropagationStopped = returnTrue;
  21264. if ( e && !this.isSimulated ) {
  21265. e.stopImmediatePropagation();
  21266. }
  21267. this.stopPropagation();
  21268. }
  21269. };
  21270. // Includes all common event props including KeyEvent and MouseEvent specific props
  21271. jQuery.each( {
  21272. altKey: true,
  21273. bubbles: true,
  21274. cancelable: true,
  21275. changedTouches: true,
  21276. ctrlKey: true,
  21277. detail: true,
  21278. eventPhase: true,
  21279. metaKey: true,
  21280. pageX: true,
  21281. pageY: true,
  21282. shiftKey: true,
  21283. view: true,
  21284. "char": true,
  21285. charCode: true,
  21286. key: true,
  21287. keyCode: true,
  21288. button: true,
  21289. buttons: true,
  21290. clientX: true,
  21291. clientY: true,
  21292. offsetX: true,
  21293. offsetY: true,
  21294. pointerId: true,
  21295. pointerType: true,
  21296. screenX: true,
  21297. screenY: true,
  21298. targetTouches: true,
  21299. toElement: true,
  21300. touches: true,
  21301. which: function( event ) {
  21302. var button = event.button;
  21303. // Add which for key events
  21304. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  21305. return event.charCode != null ? event.charCode : event.keyCode;
  21306. }
  21307. // Add which for click: 1 === left; 2 === middle; 3 === right
  21308. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  21309. if ( button & 1 ) {
  21310. return 1;
  21311. }
  21312. if ( button & 2 ) {
  21313. return 3;
  21314. }
  21315. if ( button & 4 ) {
  21316. return 2;
  21317. }
  21318. return 0;
  21319. }
  21320. return event.which;
  21321. }
  21322. }, jQuery.event.addProp );
  21323. // Create mouseenter/leave events using mouseover/out and event-time checks
  21324. // so that event delegation works in jQuery.
  21325. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  21326. //
  21327. // Support: Safari 7 only
  21328. // Safari sends mouseenter too often; see:
  21329. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  21330. // for the description of the bug (it existed in older Chrome versions as well).
  21331. jQuery.each( {
  21332. mouseenter: "mouseover",
  21333. mouseleave: "mouseout",
  21334. pointerenter: "pointerover",
  21335. pointerleave: "pointerout"
  21336. }, function( orig, fix ) {
  21337. jQuery.event.special[ orig ] = {
  21338. delegateType: fix,
  21339. bindType: fix,
  21340. handle: function( event ) {
  21341. var ret,
  21342. target = this,
  21343. related = event.relatedTarget,
  21344. handleObj = event.handleObj;
  21345. // For mouseenter/leave call the handler if related is outside the target.
  21346. // NB: No relatedTarget if the mouse left/entered the browser window
  21347. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  21348. event.type = handleObj.origType;
  21349. ret = handleObj.handler.apply( this, arguments );
  21350. event.type = fix;
  21351. }
  21352. return ret;
  21353. }
  21354. };
  21355. } );
  21356. jQuery.fn.extend( {
  21357. on: function( types, selector, data, fn ) {
  21358. return on( this, types, selector, data, fn );
  21359. },
  21360. one: function( types, selector, data, fn ) {
  21361. return on( this, types, selector, data, fn, 1 );
  21362. },
  21363. off: function( types, selector, fn ) {
  21364. var handleObj, type;
  21365. if ( types && types.preventDefault && types.handleObj ) {
  21366. // ( event ) dispatched jQuery.Event
  21367. handleObj = types.handleObj;
  21368. jQuery( types.delegateTarget ).off(
  21369. handleObj.namespace ?
  21370. handleObj.origType + "." + handleObj.namespace :
  21371. handleObj.origType,
  21372. handleObj.selector,
  21373. handleObj.handler
  21374. );
  21375. return this;
  21376. }
  21377. if ( typeof types === "object" ) {
  21378. // ( types-object [, selector] )
  21379. for ( type in types ) {
  21380. this.off( type, selector, types[ type ] );
  21381. }
  21382. return this;
  21383. }
  21384. if ( selector === false || typeof selector === "function" ) {
  21385. // ( types [, fn] )
  21386. fn = selector;
  21387. selector = undefined;
  21388. }
  21389. if ( fn === false ) {
  21390. fn = returnFalse;
  21391. }
  21392. return this.each( function() {
  21393. jQuery.event.remove( this, types, fn, selector );
  21394. } );
  21395. }
  21396. } );
  21397. var
  21398. /* eslint-disable max-len */
  21399. // See https://github.com/eslint/eslint/issues/3229
  21400. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  21401. /* eslint-enable */
  21402. // Support: IE <=10 - 11, Edge 12 - 13
  21403. // In IE/Edge using regex groups here causes severe slowdowns.
  21404. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  21405. rnoInnerhtml = /<script|<style|<link/i,
  21406. // checked="checked" or checked
  21407. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  21408. rscriptTypeMasked = /^true\/(.*)/,
  21409. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  21410. // Prefer a tbody over its parent table for containing new rows
  21411. function manipulationTarget( elem, content ) {
  21412. if ( nodeName( elem, "table" ) &&
  21413. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  21414. return jQuery( ">tbody", elem )[ 0 ] || elem;
  21415. }
  21416. return elem;
  21417. }
  21418. // Replace/restore the type attribute of script elements for safe DOM manipulation
  21419. function disableScript( elem ) {
  21420. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  21421. return elem;
  21422. }
  21423. function restoreScript( elem ) {
  21424. var match = rscriptTypeMasked.exec( elem.type );
  21425. if ( match ) {
  21426. elem.type = match[ 1 ];
  21427. } else {
  21428. elem.removeAttribute( "type" );
  21429. }
  21430. return elem;
  21431. }
  21432. function cloneCopyEvent( src, dest ) {
  21433. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  21434. if ( dest.nodeType !== 1 ) {
  21435. return;
  21436. }
  21437. // 1. Copy private data: events, handlers, etc.
  21438. if ( dataPriv.hasData( src ) ) {
  21439. pdataOld = dataPriv.access( src );
  21440. pdataCur = dataPriv.set( dest, pdataOld );
  21441. events = pdataOld.events;
  21442. if ( events ) {
  21443. delete pdataCur.handle;
  21444. pdataCur.events = {};
  21445. for ( type in events ) {
  21446. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  21447. jQuery.event.add( dest, type, events[ type ][ i ] );
  21448. }
  21449. }
  21450. }
  21451. }
  21452. // 2. Copy user data
  21453. if ( dataUser.hasData( src ) ) {
  21454. udataOld = dataUser.access( src );
  21455. udataCur = jQuery.extend( {}, udataOld );
  21456. dataUser.set( dest, udataCur );
  21457. }
  21458. }
  21459. // Fix IE bugs, see support tests
  21460. function fixInput( src, dest ) {
  21461. var nodeName = dest.nodeName.toLowerCase();
  21462. // Fails to persist the checked state of a cloned checkbox or radio button.
  21463. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  21464. dest.checked = src.checked;
  21465. // Fails to return the selected option to the default selected state when cloning options
  21466. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  21467. dest.defaultValue = src.defaultValue;
  21468. }
  21469. }
  21470. function domManip( collection, args, callback, ignored ) {
  21471. // Flatten any nested arrays
  21472. args = concat.apply( [], args );
  21473. var fragment, first, scripts, hasScripts, node, doc,
  21474. i = 0,
  21475. l = collection.length,
  21476. iNoClone = l - 1,
  21477. value = args[ 0 ],
  21478. isFunction = jQuery.isFunction( value );
  21479. // We can't cloneNode fragments that contain checked, in WebKit
  21480. if ( isFunction ||
  21481. ( l > 1 && typeof value === "string" &&
  21482. !support.checkClone && rchecked.test( value ) ) ) {
  21483. return collection.each( function( index ) {
  21484. var self = collection.eq( index );
  21485. if ( isFunction ) {
  21486. args[ 0 ] = value.call( this, index, self.html() );
  21487. }
  21488. domManip( self, args, callback, ignored );
  21489. } );
  21490. }
  21491. if ( l ) {
  21492. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  21493. first = fragment.firstChild;
  21494. if ( fragment.childNodes.length === 1 ) {
  21495. fragment = first;
  21496. }
  21497. // Require either new content or an interest in ignored elements to invoke the callback
  21498. if ( first || ignored ) {
  21499. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  21500. hasScripts = scripts.length;
  21501. // Use the original fragment for the last item
  21502. // instead of the first because it can end up
  21503. // being emptied incorrectly in certain situations (#8070).
  21504. for ( ; i < l; i++ ) {
  21505. node = fragment;
  21506. if ( i !== iNoClone ) {
  21507. node = jQuery.clone( node, true, true );
  21508. // Keep references to cloned scripts for later restoration
  21509. if ( hasScripts ) {
  21510. // Support: Android <=4.0 only, PhantomJS 1 only
  21511. // push.apply(_, arraylike) throws on ancient WebKit
  21512. jQuery.merge( scripts, getAll( node, "script" ) );
  21513. }
  21514. }
  21515. callback.call( collection[ i ], node, i );
  21516. }
  21517. if ( hasScripts ) {
  21518. doc = scripts[ scripts.length - 1 ].ownerDocument;
  21519. // Reenable scripts
  21520. jQuery.map( scripts, restoreScript );
  21521. // Evaluate executable scripts on first document insertion
  21522. for ( i = 0; i < hasScripts; i++ ) {
  21523. node = scripts[ i ];
  21524. if ( rscriptType.test( node.type || "" ) &&
  21525. !dataPriv.access( node, "globalEval" ) &&
  21526. jQuery.contains( doc, node ) ) {
  21527. if ( node.src ) {
  21528. // Optional AJAX dependency, but won't run scripts if not present
  21529. if ( jQuery._evalUrl ) {
  21530. jQuery._evalUrl( node.src );
  21531. }
  21532. } else {
  21533. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  21534. }
  21535. }
  21536. }
  21537. }
  21538. }
  21539. }
  21540. return collection;
  21541. }
  21542. function remove( elem, selector, keepData ) {
  21543. var node,
  21544. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  21545. i = 0;
  21546. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  21547. if ( !keepData && node.nodeType === 1 ) {
  21548. jQuery.cleanData( getAll( node ) );
  21549. }
  21550. if ( node.parentNode ) {
  21551. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  21552. setGlobalEval( getAll( node, "script" ) );
  21553. }
  21554. node.parentNode.removeChild( node );
  21555. }
  21556. }
  21557. return elem;
  21558. }
  21559. jQuery.extend( {
  21560. htmlPrefilter: function( html ) {
  21561. return html.replace( rxhtmlTag, "<$1></$2>" );
  21562. },
  21563. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  21564. var i, l, srcElements, destElements,
  21565. clone = elem.cloneNode( true ),
  21566. inPage = jQuery.contains( elem.ownerDocument, elem );
  21567. // Fix IE cloning issues
  21568. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  21569. !jQuery.isXMLDoc( elem ) ) {
  21570. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  21571. destElements = getAll( clone );
  21572. srcElements = getAll( elem );
  21573. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21574. fixInput( srcElements[ i ], destElements[ i ] );
  21575. }
  21576. }
  21577. // Copy the events from the original to the clone
  21578. if ( dataAndEvents ) {
  21579. if ( deepDataAndEvents ) {
  21580. srcElements = srcElements || getAll( elem );
  21581. destElements = destElements || getAll( clone );
  21582. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21583. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  21584. }
  21585. } else {
  21586. cloneCopyEvent( elem, clone );
  21587. }
  21588. }
  21589. // Preserve script evaluation history
  21590. destElements = getAll( clone, "script" );
  21591. if ( destElements.length > 0 ) {
  21592. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  21593. }
  21594. // Return the cloned set
  21595. return clone;
  21596. },
  21597. cleanData: function( elems ) {
  21598. var data, elem, type,
  21599. special = jQuery.event.special,
  21600. i = 0;
  21601. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  21602. if ( acceptData( elem ) ) {
  21603. if ( ( data = elem[ dataPriv.expando ] ) ) {
  21604. if ( data.events ) {
  21605. for ( type in data.events ) {
  21606. if ( special[ type ] ) {
  21607. jQuery.event.remove( elem, type );
  21608. // This is a shortcut to avoid jQuery.event.remove's overhead
  21609. } else {
  21610. jQuery.removeEvent( elem, type, data.handle );
  21611. }
  21612. }
  21613. }
  21614. // Support: Chrome <=35 - 45+
  21615. // Assign undefined instead of using delete, see Data#remove
  21616. elem[ dataPriv.expando ] = undefined;
  21617. }
  21618. if ( elem[ dataUser.expando ] ) {
  21619. // Support: Chrome <=35 - 45+
  21620. // Assign undefined instead of using delete, see Data#remove
  21621. elem[ dataUser.expando ] = undefined;
  21622. }
  21623. }
  21624. }
  21625. }
  21626. } );
  21627. jQuery.fn.extend( {
  21628. detach: function( selector ) {
  21629. return remove( this, selector, true );
  21630. },
  21631. remove: function( selector ) {
  21632. return remove( this, selector );
  21633. },
  21634. text: function( value ) {
  21635. return access( this, function( value ) {
  21636. return value === undefined ?
  21637. jQuery.text( this ) :
  21638. this.empty().each( function() {
  21639. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21640. this.textContent = value;
  21641. }
  21642. } );
  21643. }, null, value, arguments.length );
  21644. },
  21645. append: function() {
  21646. return domManip( this, arguments, function( elem ) {
  21647. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21648. var target = manipulationTarget( this, elem );
  21649. target.appendChild( elem );
  21650. }
  21651. } );
  21652. },
  21653. prepend: function() {
  21654. return domManip( this, arguments, function( elem ) {
  21655. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21656. var target = manipulationTarget( this, elem );
  21657. target.insertBefore( elem, target.firstChild );
  21658. }
  21659. } );
  21660. },
  21661. before: function() {
  21662. return domManip( this, arguments, function( elem ) {
  21663. if ( this.parentNode ) {
  21664. this.parentNode.insertBefore( elem, this );
  21665. }
  21666. } );
  21667. },
  21668. after: function() {
  21669. return domManip( this, arguments, function( elem ) {
  21670. if ( this.parentNode ) {
  21671. this.parentNode.insertBefore( elem, this.nextSibling );
  21672. }
  21673. } );
  21674. },
  21675. empty: function() {
  21676. var elem,
  21677. i = 0;
  21678. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  21679. if ( elem.nodeType === 1 ) {
  21680. // Prevent memory leaks
  21681. jQuery.cleanData( getAll( elem, false ) );
  21682. // Remove any remaining nodes
  21683. elem.textContent = "";
  21684. }
  21685. }
  21686. return this;
  21687. },
  21688. clone: function( dataAndEvents, deepDataAndEvents ) {
  21689. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  21690. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  21691. return this.map( function() {
  21692. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  21693. } );
  21694. },
  21695. html: function( value ) {
  21696. return access( this, function( value ) {
  21697. var elem = this[ 0 ] || {},
  21698. i = 0,
  21699. l = this.length;
  21700. if ( value === undefined && elem.nodeType === 1 ) {
  21701. return elem.innerHTML;
  21702. }
  21703. // See if we can take a shortcut and just use innerHTML
  21704. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  21705. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  21706. value = jQuery.htmlPrefilter( value );
  21707. try {
  21708. for ( ; i < l; i++ ) {
  21709. elem = this[ i ] || {};
  21710. // Remove element nodes and prevent memory leaks
  21711. if ( elem.nodeType === 1 ) {
  21712. jQuery.cleanData( getAll( elem, false ) );
  21713. elem.innerHTML = value;
  21714. }
  21715. }
  21716. elem = 0;
  21717. // If using innerHTML throws an exception, use the fallback method
  21718. } catch ( e ) {}
  21719. }
  21720. if ( elem ) {
  21721. this.empty().append( value );
  21722. }
  21723. }, null, value, arguments.length );
  21724. },
  21725. replaceWith: function() {
  21726. var ignored = [];
  21727. // Make the changes, replacing each non-ignored context element with the new content
  21728. return domManip( this, arguments, function( elem ) {
  21729. var parent = this.parentNode;
  21730. if ( jQuery.inArray( this, ignored ) < 0 ) {
  21731. jQuery.cleanData( getAll( this ) );
  21732. if ( parent ) {
  21733. parent.replaceChild( elem, this );
  21734. }
  21735. }
  21736. // Force callback invocation
  21737. }, ignored );
  21738. }
  21739. } );
  21740. jQuery.each( {
  21741. appendTo: "append",
  21742. prependTo: "prepend",
  21743. insertBefore: "before",
  21744. insertAfter: "after",
  21745. replaceAll: "replaceWith"
  21746. }, function( name, original ) {
  21747. jQuery.fn[ name ] = function( selector ) {
  21748. var elems,
  21749. ret = [],
  21750. insert = jQuery( selector ),
  21751. last = insert.length - 1,
  21752. i = 0;
  21753. for ( ; i <= last; i++ ) {
  21754. elems = i === last ? this : this.clone( true );
  21755. jQuery( insert[ i ] )[ original ]( elems );
  21756. // Support: Android <=4.0 only, PhantomJS 1 only
  21757. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  21758. push.apply( ret, elems.get() );
  21759. }
  21760. return this.pushStack( ret );
  21761. };
  21762. } );
  21763. var rmargin = ( /^margin/ );
  21764. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  21765. var getStyles = function( elem ) {
  21766. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  21767. // IE throws on elements created in popups
  21768. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  21769. var view = elem.ownerDocument.defaultView;
  21770. if ( !view || !view.opener ) {
  21771. view = window;
  21772. }
  21773. return view.getComputedStyle( elem );
  21774. };
  21775. ( function() {
  21776. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  21777. // so they're executed at the same time to save the second computation.
  21778. function computeStyleTests() {
  21779. // This is a singleton, we need to execute it only once
  21780. if ( !div ) {
  21781. return;
  21782. }
  21783. div.style.cssText =
  21784. "box-sizing:border-box;" +
  21785. "position:relative;display:block;" +
  21786. "margin:auto;border:1px;padding:1px;" +
  21787. "top:1%;width:50%";
  21788. div.innerHTML = "";
  21789. documentElement.appendChild( container );
  21790. var divStyle = window.getComputedStyle( div );
  21791. pixelPositionVal = divStyle.top !== "1%";
  21792. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  21793. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  21794. boxSizingReliableVal = divStyle.width === "4px";
  21795. // Support: Android 4.0 - 4.3 only
  21796. // Some styles come back with percentage values, even though they shouldn't
  21797. div.style.marginRight = "50%";
  21798. pixelMarginRightVal = divStyle.marginRight === "4px";
  21799. documentElement.removeChild( container );
  21800. // Nullify the div so it wouldn't be stored in the memory and
  21801. // it will also be a sign that checks already performed
  21802. div = null;
  21803. }
  21804. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  21805. container = document.createElement( "div" ),
  21806. div = document.createElement( "div" );
  21807. // Finish early in limited (non-browser) environments
  21808. if ( !div.style ) {
  21809. return;
  21810. }
  21811. // Support: IE <=9 - 11 only
  21812. // Style of cloned element affects source element cloned (#8908)
  21813. div.style.backgroundClip = "content-box";
  21814. div.cloneNode( true ).style.backgroundClip = "";
  21815. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  21816. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  21817. "padding:0;margin-top:1px;position:absolute";
  21818. container.appendChild( div );
  21819. jQuery.extend( support, {
  21820. pixelPosition: function() {
  21821. computeStyleTests();
  21822. return pixelPositionVal;
  21823. },
  21824. boxSizingReliable: function() {
  21825. computeStyleTests();
  21826. return boxSizingReliableVal;
  21827. },
  21828. pixelMarginRight: function() {
  21829. computeStyleTests();
  21830. return pixelMarginRightVal;
  21831. },
  21832. reliableMarginLeft: function() {
  21833. computeStyleTests();
  21834. return reliableMarginLeftVal;
  21835. }
  21836. } );
  21837. } )();
  21838. function curCSS( elem, name, computed ) {
  21839. var width, minWidth, maxWidth, ret,
  21840. // Support: Firefox 51+
  21841. // Retrieving style before computed somehow
  21842. // fixes an issue with getting wrong values
  21843. // on detached elements
  21844. style = elem.style;
  21845. computed = computed || getStyles( elem );
  21846. // getPropertyValue is needed for:
  21847. // .css('filter') (IE 9 only, #12537)
  21848. // .css('--customProperty) (#3144)
  21849. if ( computed ) {
  21850. ret = computed.getPropertyValue( name ) || computed[ name ];
  21851. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  21852. ret = jQuery.style( elem, name );
  21853. }
  21854. // A tribute to the "awesome hack by Dean Edwards"
  21855. // Android Browser returns percentage for some values,
  21856. // but width seems to be reliably pixels.
  21857. // This is against the CSSOM draft spec:
  21858. // https://drafts.csswg.org/cssom/#resolved-values
  21859. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  21860. // Remember the original values
  21861. width = style.width;
  21862. minWidth = style.minWidth;
  21863. maxWidth = style.maxWidth;
  21864. // Put in the new values to get a computed value out
  21865. style.minWidth = style.maxWidth = style.width = ret;
  21866. ret = computed.width;
  21867. // Revert the changed values
  21868. style.width = width;
  21869. style.minWidth = minWidth;
  21870. style.maxWidth = maxWidth;
  21871. }
  21872. }
  21873. return ret !== undefined ?
  21874. // Support: IE <=9 - 11 only
  21875. // IE returns zIndex value as an integer.
  21876. ret + "" :
  21877. ret;
  21878. }
  21879. function addGetHookIf( conditionFn, hookFn ) {
  21880. // Define the hook, we'll check on the first run if it's really needed.
  21881. return {
  21882. get: function() {
  21883. if ( conditionFn() ) {
  21884. // Hook not needed (or it's not possible to use it due
  21885. // to missing dependency), remove it.
  21886. delete this.get;
  21887. return;
  21888. }
  21889. // Hook needed; redefine it so that the support test is not executed again.
  21890. return ( this.get = hookFn ).apply( this, arguments );
  21891. }
  21892. };
  21893. }
  21894. var
  21895. // Swappable if display is none or starts with table
  21896. // except "table", "table-cell", or "table-caption"
  21897. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  21898. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  21899. rcustomProp = /^--/,
  21900. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  21901. cssNormalTransform = {
  21902. letterSpacing: "0",
  21903. fontWeight: "400"
  21904. },
  21905. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  21906. emptyStyle = document.createElement( "div" ).style;
  21907. // Return a css property mapped to a potentially vendor prefixed property
  21908. function vendorPropName( name ) {
  21909. // Shortcut for names that are not vendor prefixed
  21910. if ( name in emptyStyle ) {
  21911. return name;
  21912. }
  21913. // Check for vendor prefixed names
  21914. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  21915. i = cssPrefixes.length;
  21916. while ( i-- ) {
  21917. name = cssPrefixes[ i ] + capName;
  21918. if ( name in emptyStyle ) {
  21919. return name;
  21920. }
  21921. }
  21922. }
  21923. // Return a property mapped along what jQuery.cssProps suggests or to
  21924. // a vendor prefixed property.
  21925. function finalPropName( name ) {
  21926. var ret = jQuery.cssProps[ name ];
  21927. if ( !ret ) {
  21928. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  21929. }
  21930. return ret;
  21931. }
  21932. function setPositiveNumber( elem, value, subtract ) {
  21933. // Any relative (+/-) values have already been
  21934. // normalized at this point
  21935. var matches = rcssNum.exec( value );
  21936. return matches ?
  21937. // Guard against undefined "subtract", e.g., when used as in cssHooks
  21938. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  21939. value;
  21940. }
  21941. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  21942. var i,
  21943. val = 0;
  21944. // If we already have the right measurement, avoid augmentation
  21945. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  21946. i = 4;
  21947. // Otherwise initialize for horizontal or vertical properties
  21948. } else {
  21949. i = name === "width" ? 1 : 0;
  21950. }
  21951. for ( ; i < 4; i += 2 ) {
  21952. // Both box models exclude margin, so add it if we want it
  21953. if ( extra === "margin" ) {
  21954. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  21955. }
  21956. if ( isBorderBox ) {
  21957. // border-box includes padding, so remove it if we want content
  21958. if ( extra === "content" ) {
  21959. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  21960. }
  21961. // At this point, extra isn't border nor margin, so remove border
  21962. if ( extra !== "margin" ) {
  21963. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  21964. }
  21965. } else {
  21966. // At this point, extra isn't content, so add padding
  21967. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  21968. // At this point, extra isn't content nor padding, so add border
  21969. if ( extra !== "padding" ) {
  21970. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  21971. }
  21972. }
  21973. }
  21974. return val;
  21975. }
  21976. function getWidthOrHeight( elem, name, extra ) {
  21977. // Start with computed style
  21978. var valueIsBorderBox,
  21979. styles = getStyles( elem ),
  21980. val = curCSS( elem, name, styles ),
  21981. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  21982. // Computed unit is not pixels. Stop here and return.
  21983. if ( rnumnonpx.test( val ) ) {
  21984. return val;
  21985. }
  21986. // Check for style in case a browser which returns unreliable values
  21987. // for getComputedStyle silently falls back to the reliable elem.style
  21988. valueIsBorderBox = isBorderBox &&
  21989. ( support.boxSizingReliable() || val === elem.style[ name ] );
  21990. // Fall back to offsetWidth/Height when value is "auto"
  21991. // This happens for inline elements with no explicit setting (gh-3571)
  21992. if ( val === "auto" ) {
  21993. val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
  21994. }
  21995. // Normalize "", auto, and prepare for extra
  21996. val = parseFloat( val ) || 0;
  21997. // Use the active box-sizing model to add/subtract irrelevant styles
  21998. return ( val +
  21999. augmentWidthOrHeight(
  22000. elem,
  22001. name,
  22002. extra || ( isBorderBox ? "border" : "content" ),
  22003. valueIsBorderBox,
  22004. styles
  22005. )
  22006. ) + "px";
  22007. }
  22008. jQuery.extend( {
  22009. // Add in style property hooks for overriding the default
  22010. // behavior of getting and setting a style property
  22011. cssHooks: {
  22012. opacity: {
  22013. get: function( elem, computed ) {
  22014. if ( computed ) {
  22015. // We should always get a number back from opacity
  22016. var ret = curCSS( elem, "opacity" );
  22017. return ret === "" ? "1" : ret;
  22018. }
  22019. }
  22020. }
  22021. },
  22022. // Don't automatically add "px" to these possibly-unitless properties
  22023. cssNumber: {
  22024. "animationIterationCount": true,
  22025. "columnCount": true,
  22026. "fillOpacity": true,
  22027. "flexGrow": true,
  22028. "flexShrink": true,
  22029. "fontWeight": true,
  22030. "lineHeight": true,
  22031. "opacity": true,
  22032. "order": true,
  22033. "orphans": true,
  22034. "widows": true,
  22035. "zIndex": true,
  22036. "zoom": true
  22037. },
  22038. // Add in properties whose names you wish to fix before
  22039. // setting or getting the value
  22040. cssProps: {
  22041. "float": "cssFloat"
  22042. },
  22043. // Get and set the style property on a DOM Node
  22044. style: function( elem, name, value, extra ) {
  22045. // Don't set styles on text and comment nodes
  22046. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  22047. return;
  22048. }
  22049. // Make sure that we're working with the right name
  22050. var ret, type, hooks,
  22051. origName = jQuery.camelCase( name ),
  22052. isCustomProp = rcustomProp.test( name ),
  22053. style = elem.style;
  22054. // Make sure that we're working with the right name. We don't
  22055. // want to query the value if it is a CSS custom property
  22056. // since they are user-defined.
  22057. if ( !isCustomProp ) {
  22058. name = finalPropName( origName );
  22059. }
  22060. // Gets hook for the prefixed version, then unprefixed version
  22061. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22062. // Check if we're setting a value
  22063. if ( value !== undefined ) {
  22064. type = typeof value;
  22065. // Convert "+=" or "-=" to relative numbers (#7345)
  22066. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  22067. value = adjustCSS( elem, name, ret );
  22068. // Fixes bug #9237
  22069. type = "number";
  22070. }
  22071. // Make sure that null and NaN values aren't set (#7116)
  22072. if ( value == null || value !== value ) {
  22073. return;
  22074. }
  22075. // If a number was passed in, add the unit (except for certain CSS properties)
  22076. if ( type === "number" ) {
  22077. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  22078. }
  22079. // background-* props affect original clone's values
  22080. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  22081. style[ name ] = "inherit";
  22082. }
  22083. // If a hook was provided, use that value, otherwise just set the specified value
  22084. if ( !hooks || !( "set" in hooks ) ||
  22085. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  22086. if ( isCustomProp ) {
  22087. style.setProperty( name, value );
  22088. } else {
  22089. style[ name ] = value;
  22090. }
  22091. }
  22092. } else {
  22093. // If a hook was provided get the non-computed value from there
  22094. if ( hooks && "get" in hooks &&
  22095. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  22096. return ret;
  22097. }
  22098. // Otherwise just get the value from the style object
  22099. return style[ name ];
  22100. }
  22101. },
  22102. css: function( elem, name, extra, styles ) {
  22103. var val, num, hooks,
  22104. origName = jQuery.camelCase( name ),
  22105. isCustomProp = rcustomProp.test( name );
  22106. // Make sure that we're working with the right name. We don't
  22107. // want to modify the value if it is a CSS custom property
  22108. // since they are user-defined.
  22109. if ( !isCustomProp ) {
  22110. name = finalPropName( origName );
  22111. }
  22112. // Try prefixed name followed by the unprefixed name
  22113. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22114. // If a hook was provided get the computed value from there
  22115. if ( hooks && "get" in hooks ) {
  22116. val = hooks.get( elem, true, extra );
  22117. }
  22118. // Otherwise, if a way to get the computed value exists, use that
  22119. if ( val === undefined ) {
  22120. val = curCSS( elem, name, styles );
  22121. }
  22122. // Convert "normal" to computed value
  22123. if ( val === "normal" && name in cssNormalTransform ) {
  22124. val = cssNormalTransform[ name ];
  22125. }
  22126. // Make numeric if forced or a qualifier was provided and val looks numeric
  22127. if ( extra === "" || extra ) {
  22128. num = parseFloat( val );
  22129. return extra === true || isFinite( num ) ? num || 0 : val;
  22130. }
  22131. return val;
  22132. }
  22133. } );
  22134. jQuery.each( [ "height", "width" ], function( i, name ) {
  22135. jQuery.cssHooks[ name ] = {
  22136. get: function( elem, computed, extra ) {
  22137. if ( computed ) {
  22138. // Certain elements can have dimension info if we invisibly show them
  22139. // but it must have a current display style that would benefit
  22140. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  22141. // Support: Safari 8+
  22142. // Table columns in Safari have non-zero offsetWidth & zero
  22143. // getBoundingClientRect().width unless display is changed.
  22144. // Support: IE <=11 only
  22145. // Running getBoundingClientRect on a disconnected node
  22146. // in IE throws an error.
  22147. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  22148. swap( elem, cssShow, function() {
  22149. return getWidthOrHeight( elem, name, extra );
  22150. } ) :
  22151. getWidthOrHeight( elem, name, extra );
  22152. }
  22153. },
  22154. set: function( elem, value, extra ) {
  22155. var matches,
  22156. styles = extra && getStyles( elem ),
  22157. subtract = extra && augmentWidthOrHeight(
  22158. elem,
  22159. name,
  22160. extra,
  22161. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22162. styles
  22163. );
  22164. // Convert to pixels if value adjustment is needed
  22165. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  22166. ( matches[ 3 ] || "px" ) !== "px" ) {
  22167. elem.style[ name ] = value;
  22168. value = jQuery.css( elem, name );
  22169. }
  22170. return setPositiveNumber( elem, value, subtract );
  22171. }
  22172. };
  22173. } );
  22174. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  22175. function( elem, computed ) {
  22176. if ( computed ) {
  22177. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  22178. elem.getBoundingClientRect().left -
  22179. swap( elem, { marginLeft: 0 }, function() {
  22180. return elem.getBoundingClientRect().left;
  22181. } )
  22182. ) + "px";
  22183. }
  22184. }
  22185. );
  22186. // These hooks are used by animate to expand properties
  22187. jQuery.each( {
  22188. margin: "",
  22189. padding: "",
  22190. border: "Width"
  22191. }, function( prefix, suffix ) {
  22192. jQuery.cssHooks[ prefix + suffix ] = {
  22193. expand: function( value ) {
  22194. var i = 0,
  22195. expanded = {},
  22196. // Assumes a single number if not a string
  22197. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  22198. for ( ; i < 4; i++ ) {
  22199. expanded[ prefix + cssExpand[ i ] + suffix ] =
  22200. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  22201. }
  22202. return expanded;
  22203. }
  22204. };
  22205. if ( !rmargin.test( prefix ) ) {
  22206. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  22207. }
  22208. } );
  22209. jQuery.fn.extend( {
  22210. css: function( name, value ) {
  22211. return access( this, function( elem, name, value ) {
  22212. var styles, len,
  22213. map = {},
  22214. i = 0;
  22215. if ( Array.isArray( name ) ) {
  22216. styles = getStyles( elem );
  22217. len = name.length;
  22218. for ( ; i < len; i++ ) {
  22219. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  22220. }
  22221. return map;
  22222. }
  22223. return value !== undefined ?
  22224. jQuery.style( elem, name, value ) :
  22225. jQuery.css( elem, name );
  22226. }, name, value, arguments.length > 1 );
  22227. }
  22228. } );
  22229. function Tween( elem, options, prop, end, easing ) {
  22230. return new Tween.prototype.init( elem, options, prop, end, easing );
  22231. }
  22232. jQuery.Tween = Tween;
  22233. Tween.prototype = {
  22234. constructor: Tween,
  22235. init: function( elem, options, prop, end, easing, unit ) {
  22236. this.elem = elem;
  22237. this.prop = prop;
  22238. this.easing = easing || jQuery.easing._default;
  22239. this.options = options;
  22240. this.start = this.now = this.cur();
  22241. this.end = end;
  22242. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  22243. },
  22244. cur: function() {
  22245. var hooks = Tween.propHooks[ this.prop ];
  22246. return hooks && hooks.get ?
  22247. hooks.get( this ) :
  22248. Tween.propHooks._default.get( this );
  22249. },
  22250. run: function( percent ) {
  22251. var eased,
  22252. hooks = Tween.propHooks[ this.prop ];
  22253. if ( this.options.duration ) {
  22254. this.pos = eased = jQuery.easing[ this.easing ](
  22255. percent, this.options.duration * percent, 0, 1, this.options.duration
  22256. );
  22257. } else {
  22258. this.pos = eased = percent;
  22259. }
  22260. this.now = ( this.end - this.start ) * eased + this.start;
  22261. if ( this.options.step ) {
  22262. this.options.step.call( this.elem, this.now, this );
  22263. }
  22264. if ( hooks && hooks.set ) {
  22265. hooks.set( this );
  22266. } else {
  22267. Tween.propHooks._default.set( this );
  22268. }
  22269. return this;
  22270. }
  22271. };
  22272. Tween.prototype.init.prototype = Tween.prototype;
  22273. Tween.propHooks = {
  22274. _default: {
  22275. get: function( tween ) {
  22276. var result;
  22277. // Use a property on the element directly when it is not a DOM element,
  22278. // or when there is no matching style property that exists.
  22279. if ( tween.elem.nodeType !== 1 ||
  22280. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  22281. return tween.elem[ tween.prop ];
  22282. }
  22283. // Passing an empty string as a 3rd parameter to .css will automatically
  22284. // attempt a parseFloat and fallback to a string if the parse fails.
  22285. // Simple values such as "10px" are parsed to Float;
  22286. // complex values such as "rotate(1rad)" are returned as-is.
  22287. result = jQuery.css( tween.elem, tween.prop, "" );
  22288. // Empty strings, null, undefined and "auto" are converted to 0.
  22289. return !result || result === "auto" ? 0 : result;
  22290. },
  22291. set: function( tween ) {
  22292. // Use step hook for back compat.
  22293. // Use cssHook if its there.
  22294. // Use .style if available and use plain properties where available.
  22295. if ( jQuery.fx.step[ tween.prop ] ) {
  22296. jQuery.fx.step[ tween.prop ]( tween );
  22297. } else if ( tween.elem.nodeType === 1 &&
  22298. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  22299. jQuery.cssHooks[ tween.prop ] ) ) {
  22300. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  22301. } else {
  22302. tween.elem[ tween.prop ] = tween.now;
  22303. }
  22304. }
  22305. }
  22306. };
  22307. // Support: IE <=9 only
  22308. // Panic based approach to setting things on disconnected nodes
  22309. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  22310. set: function( tween ) {
  22311. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  22312. tween.elem[ tween.prop ] = tween.now;
  22313. }
  22314. }
  22315. };
  22316. jQuery.easing = {
  22317. linear: function( p ) {
  22318. return p;
  22319. },
  22320. swing: function( p ) {
  22321. return 0.5 - Math.cos( p * Math.PI ) / 2;
  22322. },
  22323. _default: "swing"
  22324. };
  22325. jQuery.fx = Tween.prototype.init;
  22326. // Back compat <1.8 extension point
  22327. jQuery.fx.step = {};
  22328. var
  22329. fxNow, inProgress,
  22330. rfxtypes = /^(?:toggle|show|hide)$/,
  22331. rrun = /queueHooks$/;
  22332. function schedule() {
  22333. if ( inProgress ) {
  22334. if ( document.hidden === false && window.requestAnimationFrame ) {
  22335. window.requestAnimationFrame( schedule );
  22336. } else {
  22337. window.setTimeout( schedule, jQuery.fx.interval );
  22338. }
  22339. jQuery.fx.tick();
  22340. }
  22341. }
  22342. // Animations created synchronously will run synchronously
  22343. function createFxNow() {
  22344. window.setTimeout( function() {
  22345. fxNow = undefined;
  22346. } );
  22347. return ( fxNow = jQuery.now() );
  22348. }
  22349. // Generate parameters to create a standard animation
  22350. function genFx( type, includeWidth ) {
  22351. var which,
  22352. i = 0,
  22353. attrs = { height: type };
  22354. // If we include width, step value is 1 to do all cssExpand values,
  22355. // otherwise step value is 2 to skip over Left and Right
  22356. includeWidth = includeWidth ? 1 : 0;
  22357. for ( ; i < 4; i += 2 - includeWidth ) {
  22358. which = cssExpand[ i ];
  22359. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  22360. }
  22361. if ( includeWidth ) {
  22362. attrs.opacity = attrs.width = type;
  22363. }
  22364. return attrs;
  22365. }
  22366. function createTween( value, prop, animation ) {
  22367. var tween,
  22368. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  22369. index = 0,
  22370. length = collection.length;
  22371. for ( ; index < length; index++ ) {
  22372. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  22373. // We're done with this property
  22374. return tween;
  22375. }
  22376. }
  22377. }
  22378. function defaultPrefilter( elem, props, opts ) {
  22379. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  22380. isBox = "width" in props || "height" in props,
  22381. anim = this,
  22382. orig = {},
  22383. style = elem.style,
  22384. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  22385. dataShow = dataPriv.get( elem, "fxshow" );
  22386. // Queue-skipping animations hijack the fx hooks
  22387. if ( !opts.queue ) {
  22388. hooks = jQuery._queueHooks( elem, "fx" );
  22389. if ( hooks.unqueued == null ) {
  22390. hooks.unqueued = 0;
  22391. oldfire = hooks.empty.fire;
  22392. hooks.empty.fire = function() {
  22393. if ( !hooks.unqueued ) {
  22394. oldfire();
  22395. }
  22396. };
  22397. }
  22398. hooks.unqueued++;
  22399. anim.always( function() {
  22400. // Ensure the complete handler is called before this completes
  22401. anim.always( function() {
  22402. hooks.unqueued--;
  22403. if ( !jQuery.queue( elem, "fx" ).length ) {
  22404. hooks.empty.fire();
  22405. }
  22406. } );
  22407. } );
  22408. }
  22409. // Detect show/hide animations
  22410. for ( prop in props ) {
  22411. value = props[ prop ];
  22412. if ( rfxtypes.test( value ) ) {
  22413. delete props[ prop ];
  22414. toggle = toggle || value === "toggle";
  22415. if ( value === ( hidden ? "hide" : "show" ) ) {
  22416. // Pretend to be hidden if this is a "show" and
  22417. // there is still data from a stopped show/hide
  22418. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  22419. hidden = true;
  22420. // Ignore all other no-op show/hide data
  22421. } else {
  22422. continue;
  22423. }
  22424. }
  22425. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  22426. }
  22427. }
  22428. // Bail out if this is a no-op like .hide().hide()
  22429. propTween = !jQuery.isEmptyObject( props );
  22430. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  22431. return;
  22432. }
  22433. // Restrict "overflow" and "display" styles during box animations
  22434. if ( isBox && elem.nodeType === 1 ) {
  22435. // Support: IE <=9 - 11, Edge 12 - 13
  22436. // Record all 3 overflow attributes because IE does not infer the shorthand
  22437. // from identically-valued overflowX and overflowY
  22438. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  22439. // Identify a display type, preferring old show/hide data over the CSS cascade
  22440. restoreDisplay = dataShow && dataShow.display;
  22441. if ( restoreDisplay == null ) {
  22442. restoreDisplay = dataPriv.get( elem, "display" );
  22443. }
  22444. display = jQuery.css( elem, "display" );
  22445. if ( display === "none" ) {
  22446. if ( restoreDisplay ) {
  22447. display = restoreDisplay;
  22448. } else {
  22449. // Get nonempty value(s) by temporarily forcing visibility
  22450. showHide( [ elem ], true );
  22451. restoreDisplay = elem.style.display || restoreDisplay;
  22452. display = jQuery.css( elem, "display" );
  22453. showHide( [ elem ] );
  22454. }
  22455. }
  22456. // Animate inline elements as inline-block
  22457. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  22458. if ( jQuery.css( elem, "float" ) === "none" ) {
  22459. // Restore the original display value at the end of pure show/hide animations
  22460. if ( !propTween ) {
  22461. anim.done( function() {
  22462. style.display = restoreDisplay;
  22463. } );
  22464. if ( restoreDisplay == null ) {
  22465. display = style.display;
  22466. restoreDisplay = display === "none" ? "" : display;
  22467. }
  22468. }
  22469. style.display = "inline-block";
  22470. }
  22471. }
  22472. }
  22473. if ( opts.overflow ) {
  22474. style.overflow = "hidden";
  22475. anim.always( function() {
  22476. style.overflow = opts.overflow[ 0 ];
  22477. style.overflowX = opts.overflow[ 1 ];
  22478. style.overflowY = opts.overflow[ 2 ];
  22479. } );
  22480. }
  22481. // Implement show/hide animations
  22482. propTween = false;
  22483. for ( prop in orig ) {
  22484. // General show/hide setup for this element animation
  22485. if ( !propTween ) {
  22486. if ( dataShow ) {
  22487. if ( "hidden" in dataShow ) {
  22488. hidden = dataShow.hidden;
  22489. }
  22490. } else {
  22491. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  22492. }
  22493. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  22494. if ( toggle ) {
  22495. dataShow.hidden = !hidden;
  22496. }
  22497. // Show elements before animating them
  22498. if ( hidden ) {
  22499. showHide( [ elem ], true );
  22500. }
  22501. /* eslint-disable no-loop-func */
  22502. anim.done( function() {
  22503. /* eslint-enable no-loop-func */
  22504. // The final step of a "hide" animation is actually hiding the element
  22505. if ( !hidden ) {
  22506. showHide( [ elem ] );
  22507. }
  22508. dataPriv.remove( elem, "fxshow" );
  22509. for ( prop in orig ) {
  22510. jQuery.style( elem, prop, orig[ prop ] );
  22511. }
  22512. } );
  22513. }
  22514. // Per-property setup
  22515. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  22516. if ( !( prop in dataShow ) ) {
  22517. dataShow[ prop ] = propTween.start;
  22518. if ( hidden ) {
  22519. propTween.end = propTween.start;
  22520. propTween.start = 0;
  22521. }
  22522. }
  22523. }
  22524. }
  22525. function propFilter( props, specialEasing ) {
  22526. var index, name, easing, value, hooks;
  22527. // camelCase, specialEasing and expand cssHook pass
  22528. for ( index in props ) {
  22529. name = jQuery.camelCase( index );
  22530. easing = specialEasing[ name ];
  22531. value = props[ index ];
  22532. if ( Array.isArray( value ) ) {
  22533. easing = value[ 1 ];
  22534. value = props[ index ] = value[ 0 ];
  22535. }
  22536. if ( index !== name ) {
  22537. props[ name ] = value;
  22538. delete props[ index ];
  22539. }
  22540. hooks = jQuery.cssHooks[ name ];
  22541. if ( hooks && "expand" in hooks ) {
  22542. value = hooks.expand( value );
  22543. delete props[ name ];
  22544. // Not quite $.extend, this won't overwrite existing keys.
  22545. // Reusing 'index' because we have the correct "name"
  22546. for ( index in value ) {
  22547. if ( !( index in props ) ) {
  22548. props[ index ] = value[ index ];
  22549. specialEasing[ index ] = easing;
  22550. }
  22551. }
  22552. } else {
  22553. specialEasing[ name ] = easing;
  22554. }
  22555. }
  22556. }
  22557. function Animation( elem, properties, options ) {
  22558. var result,
  22559. stopped,
  22560. index = 0,
  22561. length = Animation.prefilters.length,
  22562. deferred = jQuery.Deferred().always( function() {
  22563. // Don't match elem in the :animated selector
  22564. delete tick.elem;
  22565. } ),
  22566. tick = function() {
  22567. if ( stopped ) {
  22568. return false;
  22569. }
  22570. var currentTime = fxNow || createFxNow(),
  22571. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  22572. // Support: Android 2.3 only
  22573. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  22574. temp = remaining / animation.duration || 0,
  22575. percent = 1 - temp,
  22576. index = 0,
  22577. length = animation.tweens.length;
  22578. for ( ; index < length; index++ ) {
  22579. animation.tweens[ index ].run( percent );
  22580. }
  22581. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  22582. // If there's more to do, yield
  22583. if ( percent < 1 && length ) {
  22584. return remaining;
  22585. }
  22586. // If this was an empty animation, synthesize a final progress notification
  22587. if ( !length ) {
  22588. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22589. }
  22590. // Resolve the animation and report its conclusion
  22591. deferred.resolveWith( elem, [ animation ] );
  22592. return false;
  22593. },
  22594. animation = deferred.promise( {
  22595. elem: elem,
  22596. props: jQuery.extend( {}, properties ),
  22597. opts: jQuery.extend( true, {
  22598. specialEasing: {},
  22599. easing: jQuery.easing._default
  22600. }, options ),
  22601. originalProperties: properties,
  22602. originalOptions: options,
  22603. startTime: fxNow || createFxNow(),
  22604. duration: options.duration,
  22605. tweens: [],
  22606. createTween: function( prop, end ) {
  22607. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  22608. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  22609. animation.tweens.push( tween );
  22610. return tween;
  22611. },
  22612. stop: function( gotoEnd ) {
  22613. var index = 0,
  22614. // If we are going to the end, we want to run all the tweens
  22615. // otherwise we skip this part
  22616. length = gotoEnd ? animation.tweens.length : 0;
  22617. if ( stopped ) {
  22618. return this;
  22619. }
  22620. stopped = true;
  22621. for ( ; index < length; index++ ) {
  22622. animation.tweens[ index ].run( 1 );
  22623. }
  22624. // Resolve when we played the last frame; otherwise, reject
  22625. if ( gotoEnd ) {
  22626. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22627. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  22628. } else {
  22629. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  22630. }
  22631. return this;
  22632. }
  22633. } ),
  22634. props = animation.props;
  22635. propFilter( props, animation.opts.specialEasing );
  22636. for ( ; index < length; index++ ) {
  22637. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  22638. if ( result ) {
  22639. if ( jQuery.isFunction( result.stop ) ) {
  22640. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  22641. jQuery.proxy( result.stop, result );
  22642. }
  22643. return result;
  22644. }
  22645. }
  22646. jQuery.map( props, createTween, animation );
  22647. if ( jQuery.isFunction( animation.opts.start ) ) {
  22648. animation.opts.start.call( elem, animation );
  22649. }
  22650. // Attach callbacks from options
  22651. animation
  22652. .progress( animation.opts.progress )
  22653. .done( animation.opts.done, animation.opts.complete )
  22654. .fail( animation.opts.fail )
  22655. .always( animation.opts.always );
  22656. jQuery.fx.timer(
  22657. jQuery.extend( tick, {
  22658. elem: elem,
  22659. anim: animation,
  22660. queue: animation.opts.queue
  22661. } )
  22662. );
  22663. return animation;
  22664. }
  22665. jQuery.Animation = jQuery.extend( Animation, {
  22666. tweeners: {
  22667. "*": [ function( prop, value ) {
  22668. var tween = this.createTween( prop, value );
  22669. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  22670. return tween;
  22671. } ]
  22672. },
  22673. tweener: function( props, callback ) {
  22674. if ( jQuery.isFunction( props ) ) {
  22675. callback = props;
  22676. props = [ "*" ];
  22677. } else {
  22678. props = props.match( rnothtmlwhite );
  22679. }
  22680. var prop,
  22681. index = 0,
  22682. length = props.length;
  22683. for ( ; index < length; index++ ) {
  22684. prop = props[ index ];
  22685. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  22686. Animation.tweeners[ prop ].unshift( callback );
  22687. }
  22688. },
  22689. prefilters: [ defaultPrefilter ],
  22690. prefilter: function( callback, prepend ) {
  22691. if ( prepend ) {
  22692. Animation.prefilters.unshift( callback );
  22693. } else {
  22694. Animation.prefilters.push( callback );
  22695. }
  22696. }
  22697. } );
  22698. jQuery.speed = function( speed, easing, fn ) {
  22699. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  22700. complete: fn || !fn && easing ||
  22701. jQuery.isFunction( speed ) && speed,
  22702. duration: speed,
  22703. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  22704. };
  22705. // Go to the end state if fx are off
  22706. if ( jQuery.fx.off ) {
  22707. opt.duration = 0;
  22708. } else {
  22709. if ( typeof opt.duration !== "number" ) {
  22710. if ( opt.duration in jQuery.fx.speeds ) {
  22711. opt.duration = jQuery.fx.speeds[ opt.duration ];
  22712. } else {
  22713. opt.duration = jQuery.fx.speeds._default;
  22714. }
  22715. }
  22716. }
  22717. // Normalize opt.queue - true/undefined/null -> "fx"
  22718. if ( opt.queue == null || opt.queue === true ) {
  22719. opt.queue = "fx";
  22720. }
  22721. // Queueing
  22722. opt.old = opt.complete;
  22723. opt.complete = function() {
  22724. if ( jQuery.isFunction( opt.old ) ) {
  22725. opt.old.call( this );
  22726. }
  22727. if ( opt.queue ) {
  22728. jQuery.dequeue( this, opt.queue );
  22729. }
  22730. };
  22731. return opt;
  22732. };
  22733. jQuery.fn.extend( {
  22734. fadeTo: function( speed, to, easing, callback ) {
  22735. // Show any hidden elements after setting opacity to 0
  22736. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  22737. // Animate to the value specified
  22738. .end().animate( { opacity: to }, speed, easing, callback );
  22739. },
  22740. animate: function( prop, speed, easing, callback ) {
  22741. var empty = jQuery.isEmptyObject( prop ),
  22742. optall = jQuery.speed( speed, easing, callback ),
  22743. doAnimation = function() {
  22744. // Operate on a copy of prop so per-property easing won't be lost
  22745. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  22746. // Empty animations, or finishing resolves immediately
  22747. if ( empty || dataPriv.get( this, "finish" ) ) {
  22748. anim.stop( true );
  22749. }
  22750. };
  22751. doAnimation.finish = doAnimation;
  22752. return empty || optall.queue === false ?
  22753. this.each( doAnimation ) :
  22754. this.queue( optall.queue, doAnimation );
  22755. },
  22756. stop: function( type, clearQueue, gotoEnd ) {
  22757. var stopQueue = function( hooks ) {
  22758. var stop = hooks.stop;
  22759. delete hooks.stop;
  22760. stop( gotoEnd );
  22761. };
  22762. if ( typeof type !== "string" ) {
  22763. gotoEnd = clearQueue;
  22764. clearQueue = type;
  22765. type = undefined;
  22766. }
  22767. if ( clearQueue && type !== false ) {
  22768. this.queue( type || "fx", [] );
  22769. }
  22770. return this.each( function() {
  22771. var dequeue = true,
  22772. index = type != null && type + "queueHooks",
  22773. timers = jQuery.timers,
  22774. data = dataPriv.get( this );
  22775. if ( index ) {
  22776. if ( data[ index ] && data[ index ].stop ) {
  22777. stopQueue( data[ index ] );
  22778. }
  22779. } else {
  22780. for ( index in data ) {
  22781. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  22782. stopQueue( data[ index ] );
  22783. }
  22784. }
  22785. }
  22786. for ( index = timers.length; index--; ) {
  22787. if ( timers[ index ].elem === this &&
  22788. ( type == null || timers[ index ].queue === type ) ) {
  22789. timers[ index ].anim.stop( gotoEnd );
  22790. dequeue = false;
  22791. timers.splice( index, 1 );
  22792. }
  22793. }
  22794. // Start the next in the queue if the last step wasn't forced.
  22795. // Timers currently will call their complete callbacks, which
  22796. // will dequeue but only if they were gotoEnd.
  22797. if ( dequeue || !gotoEnd ) {
  22798. jQuery.dequeue( this, type );
  22799. }
  22800. } );
  22801. },
  22802. finish: function( type ) {
  22803. if ( type !== false ) {
  22804. type = type || "fx";
  22805. }
  22806. return this.each( function() {
  22807. var index,
  22808. data = dataPriv.get( this ),
  22809. queue = data[ type + "queue" ],
  22810. hooks = data[ type + "queueHooks" ],
  22811. timers = jQuery.timers,
  22812. length = queue ? queue.length : 0;
  22813. // Enable finishing flag on private data
  22814. data.finish = true;
  22815. // Empty the queue first
  22816. jQuery.queue( this, type, [] );
  22817. if ( hooks && hooks.stop ) {
  22818. hooks.stop.call( this, true );
  22819. }
  22820. // Look for any active animations, and finish them
  22821. for ( index = timers.length; index--; ) {
  22822. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  22823. timers[ index ].anim.stop( true );
  22824. timers.splice( index, 1 );
  22825. }
  22826. }
  22827. // Look for any animations in the old queue and finish them
  22828. for ( index = 0; index < length; index++ ) {
  22829. if ( queue[ index ] && queue[ index ].finish ) {
  22830. queue[ index ].finish.call( this );
  22831. }
  22832. }
  22833. // Turn off finishing flag
  22834. delete data.finish;
  22835. } );
  22836. }
  22837. } );
  22838. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  22839. var cssFn = jQuery.fn[ name ];
  22840. jQuery.fn[ name ] = function( speed, easing, callback ) {
  22841. return speed == null || typeof speed === "boolean" ?
  22842. cssFn.apply( this, arguments ) :
  22843. this.animate( genFx( name, true ), speed, easing, callback );
  22844. };
  22845. } );
  22846. // Generate shortcuts for custom animations
  22847. jQuery.each( {
  22848. slideDown: genFx( "show" ),
  22849. slideUp: genFx( "hide" ),
  22850. slideToggle: genFx( "toggle" ),
  22851. fadeIn: { opacity: "show" },
  22852. fadeOut: { opacity: "hide" },
  22853. fadeToggle: { opacity: "toggle" }
  22854. }, function( name, props ) {
  22855. jQuery.fn[ name ] = function( speed, easing, callback ) {
  22856. return this.animate( props, speed, easing, callback );
  22857. };
  22858. } );
  22859. jQuery.timers = [];
  22860. jQuery.fx.tick = function() {
  22861. var timer,
  22862. i = 0,
  22863. timers = jQuery.timers;
  22864. fxNow = jQuery.now();
  22865. for ( ; i < timers.length; i++ ) {
  22866. timer = timers[ i ];
  22867. // Run the timer and safely remove it when done (allowing for external removal)
  22868. if ( !timer() && timers[ i ] === timer ) {
  22869. timers.splice( i--, 1 );
  22870. }
  22871. }
  22872. if ( !timers.length ) {
  22873. jQuery.fx.stop();
  22874. }
  22875. fxNow = undefined;
  22876. };
  22877. jQuery.fx.timer = function( timer ) {
  22878. jQuery.timers.push( timer );
  22879. jQuery.fx.start();
  22880. };
  22881. jQuery.fx.interval = 13;
  22882. jQuery.fx.start = function() {
  22883. if ( inProgress ) {
  22884. return;
  22885. }
  22886. inProgress = true;
  22887. schedule();
  22888. };
  22889. jQuery.fx.stop = function() {
  22890. inProgress = null;
  22891. };
  22892. jQuery.fx.speeds = {
  22893. slow: 600,
  22894. fast: 200,
  22895. // Default speed
  22896. _default: 400
  22897. };
  22898. // Based off of the plugin by Clint Helfers, with permission.
  22899. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  22900. jQuery.fn.delay = function( time, type ) {
  22901. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  22902. type = type || "fx";
  22903. return this.queue( type, function( next, hooks ) {
  22904. var timeout = window.setTimeout( next, time );
  22905. hooks.stop = function() {
  22906. window.clearTimeout( timeout );
  22907. };
  22908. } );
  22909. };
  22910. ( function() {
  22911. var input = document.createElement( "input" ),
  22912. select = document.createElement( "select" ),
  22913. opt = select.appendChild( document.createElement( "option" ) );
  22914. input.type = "checkbox";
  22915. // Support: Android <=4.3 only
  22916. // Default value for a checkbox should be "on"
  22917. support.checkOn = input.value !== "";
  22918. // Support: IE <=11 only
  22919. // Must access selectedIndex to make default options select
  22920. support.optSelected = opt.selected;
  22921. // Support: IE <=11 only
  22922. // An input loses its value after becoming a radio
  22923. input = document.createElement( "input" );
  22924. input.value = "t";
  22925. input.type = "radio";
  22926. support.radioValue = input.value === "t";
  22927. } )();
  22928. var boolHook,
  22929. attrHandle = jQuery.expr.attrHandle;
  22930. jQuery.fn.extend( {
  22931. attr: function( name, value ) {
  22932. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  22933. },
  22934. removeAttr: function( name ) {
  22935. return this.each( function() {
  22936. jQuery.removeAttr( this, name );
  22937. } );
  22938. }
  22939. } );
  22940. jQuery.extend( {
  22941. attr: function( elem, name, value ) {
  22942. var ret, hooks,
  22943. nType = elem.nodeType;
  22944. // Don't get/set attributes on text, comment and attribute nodes
  22945. if ( nType === 3 || nType === 8 || nType === 2 ) {
  22946. return;
  22947. }
  22948. // Fallback to prop when attributes are not supported
  22949. if ( typeof elem.getAttribute === "undefined" ) {
  22950. return jQuery.prop( elem, name, value );
  22951. }
  22952. // Attribute hooks are determined by the lowercase version
  22953. // Grab necessary hook if one is defined
  22954. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  22955. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  22956. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  22957. }
  22958. if ( value !== undefined ) {
  22959. if ( value === null ) {
  22960. jQuery.removeAttr( elem, name );
  22961. return;
  22962. }
  22963. if ( hooks && "set" in hooks &&
  22964. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  22965. return ret;
  22966. }
  22967. elem.setAttribute( name, value + "" );
  22968. return value;
  22969. }
  22970. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  22971. return ret;
  22972. }
  22973. ret = jQuery.find.attr( elem, name );
  22974. // Non-existent attributes return null, we normalize to undefined
  22975. return ret == null ? undefined : ret;
  22976. },
  22977. attrHooks: {
  22978. type: {
  22979. set: function( elem, value ) {
  22980. if ( !support.radioValue && value === "radio" &&
  22981. nodeName( elem, "input" ) ) {
  22982. var val = elem.value;
  22983. elem.setAttribute( "type", value );
  22984. if ( val ) {
  22985. elem.value = val;
  22986. }
  22987. return value;
  22988. }
  22989. }
  22990. }
  22991. },
  22992. removeAttr: function( elem, value ) {
  22993. var name,
  22994. i = 0,
  22995. // Attribute names can contain non-HTML whitespace characters
  22996. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  22997. attrNames = value && value.match( rnothtmlwhite );
  22998. if ( attrNames && elem.nodeType === 1 ) {
  22999. while ( ( name = attrNames[ i++ ] ) ) {
  23000. elem.removeAttribute( name );
  23001. }
  23002. }
  23003. }
  23004. } );
  23005. // Hooks for boolean attributes
  23006. boolHook = {
  23007. set: function( elem, value, name ) {
  23008. if ( value === false ) {
  23009. // Remove boolean attributes when set to false
  23010. jQuery.removeAttr( elem, name );
  23011. } else {
  23012. elem.setAttribute( name, name );
  23013. }
  23014. return name;
  23015. }
  23016. };
  23017. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  23018. var getter = attrHandle[ name ] || jQuery.find.attr;
  23019. attrHandle[ name ] = function( elem, name, isXML ) {
  23020. var ret, handle,
  23021. lowercaseName = name.toLowerCase();
  23022. if ( !isXML ) {
  23023. // Avoid an infinite loop by temporarily removing this function from the getter
  23024. handle = attrHandle[ lowercaseName ];
  23025. attrHandle[ lowercaseName ] = ret;
  23026. ret = getter( elem, name, isXML ) != null ?
  23027. lowercaseName :
  23028. null;
  23029. attrHandle[ lowercaseName ] = handle;
  23030. }
  23031. return ret;
  23032. };
  23033. } );
  23034. var rfocusable = /^(?:input|select|textarea|button)$/i,
  23035. rclickable = /^(?:a|area)$/i;
  23036. jQuery.fn.extend( {
  23037. prop: function( name, value ) {
  23038. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  23039. },
  23040. removeProp: function( name ) {
  23041. return this.each( function() {
  23042. delete this[ jQuery.propFix[ name ] || name ];
  23043. } );
  23044. }
  23045. } );
  23046. jQuery.extend( {
  23047. prop: function( elem, name, value ) {
  23048. var ret, hooks,
  23049. nType = elem.nodeType;
  23050. // Don't get/set properties on text, comment and attribute nodes
  23051. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23052. return;
  23053. }
  23054. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23055. // Fix name and attach hooks
  23056. name = jQuery.propFix[ name ] || name;
  23057. hooks = jQuery.propHooks[ name ];
  23058. }
  23059. if ( value !== undefined ) {
  23060. if ( hooks && "set" in hooks &&
  23061. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23062. return ret;
  23063. }
  23064. return ( elem[ name ] = value );
  23065. }
  23066. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23067. return ret;
  23068. }
  23069. return elem[ name ];
  23070. },
  23071. propHooks: {
  23072. tabIndex: {
  23073. get: function( elem ) {
  23074. // Support: IE <=9 - 11 only
  23075. // elem.tabIndex doesn't always return the
  23076. // correct value when it hasn't been explicitly set
  23077. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  23078. // Use proper attribute retrieval(#12072)
  23079. var tabindex = jQuery.find.attr( elem, "tabindex" );
  23080. if ( tabindex ) {
  23081. return parseInt( tabindex, 10 );
  23082. }
  23083. if (
  23084. rfocusable.test( elem.nodeName ) ||
  23085. rclickable.test( elem.nodeName ) &&
  23086. elem.href
  23087. ) {
  23088. return 0;
  23089. }
  23090. return -1;
  23091. }
  23092. }
  23093. },
  23094. propFix: {
  23095. "for": "htmlFor",
  23096. "class": "className"
  23097. }
  23098. } );
  23099. // Support: IE <=11 only
  23100. // Accessing the selectedIndex property
  23101. // forces the browser to respect setting selected
  23102. // on the option
  23103. // The getter ensures a default option is selected
  23104. // when in an optgroup
  23105. // eslint rule "no-unused-expressions" is disabled for this code
  23106. // since it considers such accessions noop
  23107. if ( !support.optSelected ) {
  23108. jQuery.propHooks.selected = {
  23109. get: function( elem ) {
  23110. /* eslint no-unused-expressions: "off" */
  23111. var parent = elem.parentNode;
  23112. if ( parent && parent.parentNode ) {
  23113. parent.parentNode.selectedIndex;
  23114. }
  23115. return null;
  23116. },
  23117. set: function( elem ) {
  23118. /* eslint no-unused-expressions: "off" */
  23119. var parent = elem.parentNode;
  23120. if ( parent ) {
  23121. parent.selectedIndex;
  23122. if ( parent.parentNode ) {
  23123. parent.parentNode.selectedIndex;
  23124. }
  23125. }
  23126. }
  23127. };
  23128. }
  23129. jQuery.each( [
  23130. "tabIndex",
  23131. "readOnly",
  23132. "maxLength",
  23133. "cellSpacing",
  23134. "cellPadding",
  23135. "rowSpan",
  23136. "colSpan",
  23137. "useMap",
  23138. "frameBorder",
  23139. "contentEditable"
  23140. ], function() {
  23141. jQuery.propFix[ this.toLowerCase() ] = this;
  23142. } );
  23143. // Strip and collapse whitespace according to HTML spec
  23144. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  23145. function stripAndCollapse( value ) {
  23146. var tokens = value.match( rnothtmlwhite ) || [];
  23147. return tokens.join( " " );
  23148. }
  23149. function getClass( elem ) {
  23150. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  23151. }
  23152. jQuery.fn.extend( {
  23153. addClass: function( value ) {
  23154. var classes, elem, cur, curValue, clazz, j, finalValue,
  23155. i = 0;
  23156. if ( jQuery.isFunction( value ) ) {
  23157. return this.each( function( j ) {
  23158. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  23159. } );
  23160. }
  23161. if ( typeof value === "string" && value ) {
  23162. classes = value.match( rnothtmlwhite ) || [];
  23163. while ( ( elem = this[ i++ ] ) ) {
  23164. curValue = getClass( elem );
  23165. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23166. if ( cur ) {
  23167. j = 0;
  23168. while ( ( clazz = classes[ j++ ] ) ) {
  23169. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  23170. cur += clazz + " ";
  23171. }
  23172. }
  23173. // Only assign if different to avoid unneeded rendering.
  23174. finalValue = stripAndCollapse( cur );
  23175. if ( curValue !== finalValue ) {
  23176. elem.setAttribute( "class", finalValue );
  23177. }
  23178. }
  23179. }
  23180. }
  23181. return this;
  23182. },
  23183. removeClass: function( value ) {
  23184. var classes, elem, cur, curValue, clazz, j, finalValue,
  23185. i = 0;
  23186. if ( jQuery.isFunction( value ) ) {
  23187. return this.each( function( j ) {
  23188. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  23189. } );
  23190. }
  23191. if ( !arguments.length ) {
  23192. return this.attr( "class", "" );
  23193. }
  23194. if ( typeof value === "string" && value ) {
  23195. classes = value.match( rnothtmlwhite ) || [];
  23196. while ( ( elem = this[ i++ ] ) ) {
  23197. curValue = getClass( elem );
  23198. // This expression is here for better compressibility (see addClass)
  23199. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23200. if ( cur ) {
  23201. j = 0;
  23202. while ( ( clazz = classes[ j++ ] ) ) {
  23203. // Remove *all* instances
  23204. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  23205. cur = cur.replace( " " + clazz + " ", " " );
  23206. }
  23207. }
  23208. // Only assign if different to avoid unneeded rendering.
  23209. finalValue = stripAndCollapse( cur );
  23210. if ( curValue !== finalValue ) {
  23211. elem.setAttribute( "class", finalValue );
  23212. }
  23213. }
  23214. }
  23215. }
  23216. return this;
  23217. },
  23218. toggleClass: function( value, stateVal ) {
  23219. var type = typeof value;
  23220. if ( typeof stateVal === "boolean" && type === "string" ) {
  23221. return stateVal ? this.addClass( value ) : this.removeClass( value );
  23222. }
  23223. if ( jQuery.isFunction( value ) ) {
  23224. return this.each( function( i ) {
  23225. jQuery( this ).toggleClass(
  23226. value.call( this, i, getClass( this ), stateVal ),
  23227. stateVal
  23228. );
  23229. } );
  23230. }
  23231. return this.each( function() {
  23232. var className, i, self, classNames;
  23233. if ( type === "string" ) {
  23234. // Toggle individual class names
  23235. i = 0;
  23236. self = jQuery( this );
  23237. classNames = value.match( rnothtmlwhite ) || [];
  23238. while ( ( className = classNames[ i++ ] ) ) {
  23239. // Check each className given, space separated list
  23240. if ( self.hasClass( className ) ) {
  23241. self.removeClass( className );
  23242. } else {
  23243. self.addClass( className );
  23244. }
  23245. }
  23246. // Toggle whole class name
  23247. } else if ( value === undefined || type === "boolean" ) {
  23248. className = getClass( this );
  23249. if ( className ) {
  23250. // Store className if set
  23251. dataPriv.set( this, "__className__", className );
  23252. }
  23253. // If the element has a class name or if we're passed `false`,
  23254. // then remove the whole classname (if there was one, the above saved it).
  23255. // Otherwise bring back whatever was previously saved (if anything),
  23256. // falling back to the empty string if nothing was stored.
  23257. if ( this.setAttribute ) {
  23258. this.setAttribute( "class",
  23259. className || value === false ?
  23260. "" :
  23261. dataPriv.get( this, "__className__" ) || ""
  23262. );
  23263. }
  23264. }
  23265. } );
  23266. },
  23267. hasClass: function( selector ) {
  23268. var className, elem,
  23269. i = 0;
  23270. className = " " + selector + " ";
  23271. while ( ( elem = this[ i++ ] ) ) {
  23272. if ( elem.nodeType === 1 &&
  23273. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  23274. return true;
  23275. }
  23276. }
  23277. return false;
  23278. }
  23279. } );
  23280. var rreturn = /\r/g;
  23281. jQuery.fn.extend( {
  23282. val: function( value ) {
  23283. var hooks, ret, isFunction,
  23284. elem = this[ 0 ];
  23285. if ( !arguments.length ) {
  23286. if ( elem ) {
  23287. hooks = jQuery.valHooks[ elem.type ] ||
  23288. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  23289. if ( hooks &&
  23290. "get" in hooks &&
  23291. ( ret = hooks.get( elem, "value" ) ) !== undefined
  23292. ) {
  23293. return ret;
  23294. }
  23295. ret = elem.value;
  23296. // Handle most common string cases
  23297. if ( typeof ret === "string" ) {
  23298. return ret.replace( rreturn, "" );
  23299. }
  23300. // Handle cases where value is null/undef or number
  23301. return ret == null ? "" : ret;
  23302. }
  23303. return;
  23304. }
  23305. isFunction = jQuery.isFunction( value );
  23306. return this.each( function( i ) {
  23307. var val;
  23308. if ( this.nodeType !== 1 ) {
  23309. return;
  23310. }
  23311. if ( isFunction ) {
  23312. val = value.call( this, i, jQuery( this ).val() );
  23313. } else {
  23314. val = value;
  23315. }
  23316. // Treat null/undefined as ""; convert numbers to string
  23317. if ( val == null ) {
  23318. val = "";
  23319. } else if ( typeof val === "number" ) {
  23320. val += "";
  23321. } else if ( Array.isArray( val ) ) {
  23322. val = jQuery.map( val, function( value ) {
  23323. return value == null ? "" : value + "";
  23324. } );
  23325. }
  23326. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  23327. // If set returns undefined, fall back to normal setting
  23328. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  23329. this.value = val;
  23330. }
  23331. } );
  23332. }
  23333. } );
  23334. jQuery.extend( {
  23335. valHooks: {
  23336. option: {
  23337. get: function( elem ) {
  23338. var val = jQuery.find.attr( elem, "value" );
  23339. return val != null ?
  23340. val :
  23341. // Support: IE <=10 - 11 only
  23342. // option.text throws exceptions (#14686, #14858)
  23343. // Strip and collapse whitespace
  23344. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  23345. stripAndCollapse( jQuery.text( elem ) );
  23346. }
  23347. },
  23348. select: {
  23349. get: function( elem ) {
  23350. var value, option, i,
  23351. options = elem.options,
  23352. index = elem.selectedIndex,
  23353. one = elem.type === "select-one",
  23354. values = one ? null : [],
  23355. max = one ? index + 1 : options.length;
  23356. if ( index < 0 ) {
  23357. i = max;
  23358. } else {
  23359. i = one ? index : 0;
  23360. }
  23361. // Loop through all the selected options
  23362. for ( ; i < max; i++ ) {
  23363. option = options[ i ];
  23364. // Support: IE <=9 only
  23365. // IE8-9 doesn't update selected after form reset (#2551)
  23366. if ( ( option.selected || i === index ) &&
  23367. // Don't return options that are disabled or in a disabled optgroup
  23368. !option.disabled &&
  23369. ( !option.parentNode.disabled ||
  23370. !nodeName( option.parentNode, "optgroup" ) ) ) {
  23371. // Get the specific value for the option
  23372. value = jQuery( option ).val();
  23373. // We don't need an array for one selects
  23374. if ( one ) {
  23375. return value;
  23376. }
  23377. // Multi-Selects return an array
  23378. values.push( value );
  23379. }
  23380. }
  23381. return values;
  23382. },
  23383. set: function( elem, value ) {
  23384. var optionSet, option,
  23385. options = elem.options,
  23386. values = jQuery.makeArray( value ),
  23387. i = options.length;
  23388. while ( i-- ) {
  23389. option = options[ i ];
  23390. /* eslint-disable no-cond-assign */
  23391. if ( option.selected =
  23392. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  23393. ) {
  23394. optionSet = true;
  23395. }
  23396. /* eslint-enable no-cond-assign */
  23397. }
  23398. // Force browsers to behave consistently when non-matching value is set
  23399. if ( !optionSet ) {
  23400. elem.selectedIndex = -1;
  23401. }
  23402. return values;
  23403. }
  23404. }
  23405. }
  23406. } );
  23407. // Radios and checkboxes getter/setter
  23408. jQuery.each( [ "radio", "checkbox" ], function() {
  23409. jQuery.valHooks[ this ] = {
  23410. set: function( elem, value ) {
  23411. if ( Array.isArray( value ) ) {
  23412. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  23413. }
  23414. }
  23415. };
  23416. if ( !support.checkOn ) {
  23417. jQuery.valHooks[ this ].get = function( elem ) {
  23418. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  23419. };
  23420. }
  23421. } );
  23422. // Return jQuery for attributes-only inclusion
  23423. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  23424. jQuery.extend( jQuery.event, {
  23425. trigger: function( event, data, elem, onlyHandlers ) {
  23426. var i, cur, tmp, bubbleType, ontype, handle, special,
  23427. eventPath = [ elem || document ],
  23428. type = hasOwn.call( event, "type" ) ? event.type : event,
  23429. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  23430. cur = tmp = elem = elem || document;
  23431. // Don't do events on text and comment nodes
  23432. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  23433. return;
  23434. }
  23435. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  23436. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  23437. return;
  23438. }
  23439. if ( type.indexOf( "." ) > -1 ) {
  23440. // Namespaced trigger; create a regexp to match event type in handle()
  23441. namespaces = type.split( "." );
  23442. type = namespaces.shift();
  23443. namespaces.sort();
  23444. }
  23445. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  23446. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  23447. event = event[ jQuery.expando ] ?
  23448. event :
  23449. new jQuery.Event( type, typeof event === "object" && event );
  23450. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  23451. event.isTrigger = onlyHandlers ? 2 : 3;
  23452. event.namespace = namespaces.join( "." );
  23453. event.rnamespace = event.namespace ?
  23454. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  23455. null;
  23456. // Clean up the event in case it is being reused
  23457. event.result = undefined;
  23458. if ( !event.target ) {
  23459. event.target = elem;
  23460. }
  23461. // Clone any incoming data and prepend the event, creating the handler arg list
  23462. data = data == null ?
  23463. [ event ] :
  23464. jQuery.makeArray( data, [ event ] );
  23465. // Allow special events to draw outside the lines
  23466. special = jQuery.event.special[ type ] || {};
  23467. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  23468. return;
  23469. }
  23470. // Determine event propagation path in advance, per W3C events spec (#9951)
  23471. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  23472. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  23473. bubbleType = special.delegateType || type;
  23474. if ( !rfocusMorph.test( bubbleType + type ) ) {
  23475. cur = cur.parentNode;
  23476. }
  23477. for ( ; cur; cur = cur.parentNode ) {
  23478. eventPath.push( cur );
  23479. tmp = cur;
  23480. }
  23481. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  23482. if ( tmp === ( elem.ownerDocument || document ) ) {
  23483. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  23484. }
  23485. }
  23486. // Fire handlers on the event path
  23487. i = 0;
  23488. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  23489. event.type = i > 1 ?
  23490. bubbleType :
  23491. special.bindType || type;
  23492. // jQuery handler
  23493. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  23494. dataPriv.get( cur, "handle" );
  23495. if ( handle ) {
  23496. handle.apply( cur, data );
  23497. }
  23498. // Native handler
  23499. handle = ontype && cur[ ontype ];
  23500. if ( handle && handle.apply && acceptData( cur ) ) {
  23501. event.result = handle.apply( cur, data );
  23502. if ( event.result === false ) {
  23503. event.preventDefault();
  23504. }
  23505. }
  23506. }
  23507. event.type = type;
  23508. // If nobody prevented the default action, do it now
  23509. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  23510. if ( ( !special._default ||
  23511. special._default.apply( eventPath.pop(), data ) === false ) &&
  23512. acceptData( elem ) ) {
  23513. // Call a native DOM method on the target with the same name as the event.
  23514. // Don't do default actions on window, that's where global variables be (#6170)
  23515. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  23516. // Don't re-trigger an onFOO event when we call its FOO() method
  23517. tmp = elem[ ontype ];
  23518. if ( tmp ) {
  23519. elem[ ontype ] = null;
  23520. }
  23521. // Prevent re-triggering of the same event, since we already bubbled it above
  23522. jQuery.event.triggered = type;
  23523. elem[ type ]();
  23524. jQuery.event.triggered = undefined;
  23525. if ( tmp ) {
  23526. elem[ ontype ] = tmp;
  23527. }
  23528. }
  23529. }
  23530. }
  23531. return event.result;
  23532. },
  23533. // Piggyback on a donor event to simulate a different one
  23534. // Used only for `focus(in | out)` events
  23535. simulate: function( type, elem, event ) {
  23536. var e = jQuery.extend(
  23537. new jQuery.Event(),
  23538. event,
  23539. {
  23540. type: type,
  23541. isSimulated: true
  23542. }
  23543. );
  23544. jQuery.event.trigger( e, null, elem );
  23545. }
  23546. } );
  23547. jQuery.fn.extend( {
  23548. trigger: function( type, data ) {
  23549. return this.each( function() {
  23550. jQuery.event.trigger( type, data, this );
  23551. } );
  23552. },
  23553. triggerHandler: function( type, data ) {
  23554. var elem = this[ 0 ];
  23555. if ( elem ) {
  23556. return jQuery.event.trigger( type, data, elem, true );
  23557. }
  23558. }
  23559. } );
  23560. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  23561. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  23562. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  23563. function( i, name ) {
  23564. // Handle event binding
  23565. jQuery.fn[ name ] = function( data, fn ) {
  23566. return arguments.length > 0 ?
  23567. this.on( name, null, data, fn ) :
  23568. this.trigger( name );
  23569. };
  23570. } );
  23571. jQuery.fn.extend( {
  23572. hover: function( fnOver, fnOut ) {
  23573. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  23574. }
  23575. } );
  23576. support.focusin = "onfocusin" in window;
  23577. // Support: Firefox <=44
  23578. // Firefox doesn't have focus(in | out) events
  23579. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  23580. //
  23581. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  23582. // focus(in | out) events fire after focus & blur events,
  23583. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  23584. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  23585. if ( !support.focusin ) {
  23586. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  23587. // Attach a single capturing handler on the document while someone wants focusin/focusout
  23588. var handler = function( event ) {
  23589. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  23590. };
  23591. jQuery.event.special[ fix ] = {
  23592. setup: function() {
  23593. var doc = this.ownerDocument || this,
  23594. attaches = dataPriv.access( doc, fix );
  23595. if ( !attaches ) {
  23596. doc.addEventListener( orig, handler, true );
  23597. }
  23598. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  23599. },
  23600. teardown: function() {
  23601. var doc = this.ownerDocument || this,
  23602. attaches = dataPriv.access( doc, fix ) - 1;
  23603. if ( !attaches ) {
  23604. doc.removeEventListener( orig, handler, true );
  23605. dataPriv.remove( doc, fix );
  23606. } else {
  23607. dataPriv.access( doc, fix, attaches );
  23608. }
  23609. }
  23610. };
  23611. } );
  23612. }
  23613. var location = window.location;
  23614. var nonce = jQuery.now();
  23615. var rquery = ( /\?/ );
  23616. // Cross-browser xml parsing
  23617. jQuery.parseXML = function( data ) {
  23618. var xml;
  23619. if ( !data || typeof data !== "string" ) {
  23620. return null;
  23621. }
  23622. // Support: IE 9 - 11 only
  23623. // IE throws on parseFromString with invalid input.
  23624. try {
  23625. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  23626. } catch ( e ) {
  23627. xml = undefined;
  23628. }
  23629. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  23630. jQuery.error( "Invalid XML: " + data );
  23631. }
  23632. return xml;
  23633. };
  23634. var
  23635. rbracket = /\[\]$/,
  23636. rCRLF = /\r?\n/g,
  23637. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  23638. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  23639. function buildParams( prefix, obj, traditional, add ) {
  23640. var name;
  23641. if ( Array.isArray( obj ) ) {
  23642. // Serialize array item.
  23643. jQuery.each( obj, function( i, v ) {
  23644. if ( traditional || rbracket.test( prefix ) ) {
  23645. // Treat each array item as a scalar.
  23646. add( prefix, v );
  23647. } else {
  23648. // Item is non-scalar (array or object), encode its numeric index.
  23649. buildParams(
  23650. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  23651. v,
  23652. traditional,
  23653. add
  23654. );
  23655. }
  23656. } );
  23657. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  23658. // Serialize object item.
  23659. for ( name in obj ) {
  23660. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  23661. }
  23662. } else {
  23663. // Serialize scalar item.
  23664. add( prefix, obj );
  23665. }
  23666. }
  23667. // Serialize an array of form elements or a set of
  23668. // key/values into a query string
  23669. jQuery.param = function( a, traditional ) {
  23670. var prefix,
  23671. s = [],
  23672. add = function( key, valueOrFunction ) {
  23673. // If value is a function, invoke it and use its return value
  23674. var value = jQuery.isFunction( valueOrFunction ) ?
  23675. valueOrFunction() :
  23676. valueOrFunction;
  23677. s[ s.length ] = encodeURIComponent( key ) + "=" +
  23678. encodeURIComponent( value == null ? "" : value );
  23679. };
  23680. // If an array was passed in, assume that it is an array of form elements.
  23681. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  23682. // Serialize the form elements
  23683. jQuery.each( a, function() {
  23684. add( this.name, this.value );
  23685. } );
  23686. } else {
  23687. // If traditional, encode the "old" way (the way 1.3.2 or older
  23688. // did it), otherwise encode params recursively.
  23689. for ( prefix in a ) {
  23690. buildParams( prefix, a[ prefix ], traditional, add );
  23691. }
  23692. }
  23693. // Return the resulting serialization
  23694. return s.join( "&" );
  23695. };
  23696. jQuery.fn.extend( {
  23697. serialize: function() {
  23698. return jQuery.param( this.serializeArray() );
  23699. },
  23700. serializeArray: function() {
  23701. return this.map( function() {
  23702. // Can add propHook for "elements" to filter or add form elements
  23703. var elements = jQuery.prop( this, "elements" );
  23704. return elements ? jQuery.makeArray( elements ) : this;
  23705. } )
  23706. .filter( function() {
  23707. var type = this.type;
  23708. // Use .is( ":disabled" ) so that fieldset[disabled] works
  23709. return this.name && !jQuery( this ).is( ":disabled" ) &&
  23710. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  23711. ( this.checked || !rcheckableType.test( type ) );
  23712. } )
  23713. .map( function( i, elem ) {
  23714. var val = jQuery( this ).val();
  23715. if ( val == null ) {
  23716. return null;
  23717. }
  23718. if ( Array.isArray( val ) ) {
  23719. return jQuery.map( val, function( val ) {
  23720. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23721. } );
  23722. }
  23723. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23724. } ).get();
  23725. }
  23726. } );
  23727. var
  23728. r20 = /%20/g,
  23729. rhash = /#.*$/,
  23730. rantiCache = /([?&])_=[^&]*/,
  23731. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  23732. // #7653, #8125, #8152: local protocol detection
  23733. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  23734. rnoContent = /^(?:GET|HEAD)$/,
  23735. rprotocol = /^\/\//,
  23736. /* Prefilters
  23737. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  23738. * 2) These are called:
  23739. * - BEFORE asking for a transport
  23740. * - AFTER param serialization (s.data is a string if s.processData is true)
  23741. * 3) key is the dataType
  23742. * 4) the catchall symbol "*" can be used
  23743. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  23744. */
  23745. prefilters = {},
  23746. /* Transports bindings
  23747. * 1) key is the dataType
  23748. * 2) the catchall symbol "*" can be used
  23749. * 3) selection will start with transport dataType and THEN go to "*" if needed
  23750. */
  23751. transports = {},
  23752. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  23753. allTypes = "*/".concat( "*" ),
  23754. // Anchor tag for parsing the document origin
  23755. originAnchor = document.createElement( "a" );
  23756. originAnchor.href = location.href;
  23757. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  23758. function addToPrefiltersOrTransports( structure ) {
  23759. // dataTypeExpression is optional and defaults to "*"
  23760. return function( dataTypeExpression, func ) {
  23761. if ( typeof dataTypeExpression !== "string" ) {
  23762. func = dataTypeExpression;
  23763. dataTypeExpression = "*";
  23764. }
  23765. var dataType,
  23766. i = 0,
  23767. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  23768. if ( jQuery.isFunction( func ) ) {
  23769. // For each dataType in the dataTypeExpression
  23770. while ( ( dataType = dataTypes[ i++ ] ) ) {
  23771. // Prepend if requested
  23772. if ( dataType[ 0 ] === "+" ) {
  23773. dataType = dataType.slice( 1 ) || "*";
  23774. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  23775. // Otherwise append
  23776. } else {
  23777. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  23778. }
  23779. }
  23780. }
  23781. };
  23782. }
  23783. // Base inspection function for prefilters and transports
  23784. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  23785. var inspected = {},
  23786. seekingTransport = ( structure === transports );
  23787. function inspect( dataType ) {
  23788. var selected;
  23789. inspected[ dataType ] = true;
  23790. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  23791. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  23792. if ( typeof dataTypeOrTransport === "string" &&
  23793. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  23794. options.dataTypes.unshift( dataTypeOrTransport );
  23795. inspect( dataTypeOrTransport );
  23796. return false;
  23797. } else if ( seekingTransport ) {
  23798. return !( selected = dataTypeOrTransport );
  23799. }
  23800. } );
  23801. return selected;
  23802. }
  23803. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  23804. }
  23805. // A special extend for ajax options
  23806. // that takes "flat" options (not to be deep extended)
  23807. // Fixes #9887
  23808. function ajaxExtend( target, src ) {
  23809. var key, deep,
  23810. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  23811. for ( key in src ) {
  23812. if ( src[ key ] !== undefined ) {
  23813. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  23814. }
  23815. }
  23816. if ( deep ) {
  23817. jQuery.extend( true, target, deep );
  23818. }
  23819. return target;
  23820. }
  23821. /* Handles responses to an ajax request:
  23822. * - finds the right dataType (mediates between content-type and expected dataType)
  23823. * - returns the corresponding response
  23824. */
  23825. function ajaxHandleResponses( s, jqXHR, responses ) {
  23826. var ct, type, finalDataType, firstDataType,
  23827. contents = s.contents,
  23828. dataTypes = s.dataTypes;
  23829. // Remove auto dataType and get content-type in the process
  23830. while ( dataTypes[ 0 ] === "*" ) {
  23831. dataTypes.shift();
  23832. if ( ct === undefined ) {
  23833. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  23834. }
  23835. }
  23836. // Check if we're dealing with a known content-type
  23837. if ( ct ) {
  23838. for ( type in contents ) {
  23839. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  23840. dataTypes.unshift( type );
  23841. break;
  23842. }
  23843. }
  23844. }
  23845. // Check to see if we have a response for the expected dataType
  23846. if ( dataTypes[ 0 ] in responses ) {
  23847. finalDataType = dataTypes[ 0 ];
  23848. } else {
  23849. // Try convertible dataTypes
  23850. for ( type in responses ) {
  23851. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  23852. finalDataType = type;
  23853. break;
  23854. }
  23855. if ( !firstDataType ) {
  23856. firstDataType = type;
  23857. }
  23858. }
  23859. // Or just use first one
  23860. finalDataType = finalDataType || firstDataType;
  23861. }
  23862. // If we found a dataType
  23863. // We add the dataType to the list if needed
  23864. // and return the corresponding response
  23865. if ( finalDataType ) {
  23866. if ( finalDataType !== dataTypes[ 0 ] ) {
  23867. dataTypes.unshift( finalDataType );
  23868. }
  23869. return responses[ finalDataType ];
  23870. }
  23871. }
  23872. /* Chain conversions given the request and the original response
  23873. * Also sets the responseXXX fields on the jqXHR instance
  23874. */
  23875. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  23876. var conv2, current, conv, tmp, prev,
  23877. converters = {},
  23878. // Work with a copy of dataTypes in case we need to modify it for conversion
  23879. dataTypes = s.dataTypes.slice();
  23880. // Create converters map with lowercased keys
  23881. if ( dataTypes[ 1 ] ) {
  23882. for ( conv in s.converters ) {
  23883. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  23884. }
  23885. }
  23886. current = dataTypes.shift();
  23887. // Convert to each sequential dataType
  23888. while ( current ) {
  23889. if ( s.responseFields[ current ] ) {
  23890. jqXHR[ s.responseFields[ current ] ] = response;
  23891. }
  23892. // Apply the dataFilter if provided
  23893. if ( !prev && isSuccess && s.dataFilter ) {
  23894. response = s.dataFilter( response, s.dataType );
  23895. }
  23896. prev = current;
  23897. current = dataTypes.shift();
  23898. if ( current ) {
  23899. // There's only work to do if current dataType is non-auto
  23900. if ( current === "*" ) {
  23901. current = prev;
  23902. // Convert response if prev dataType is non-auto and differs from current
  23903. } else if ( prev !== "*" && prev !== current ) {
  23904. // Seek a direct converter
  23905. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  23906. // If none found, seek a pair
  23907. if ( !conv ) {
  23908. for ( conv2 in converters ) {
  23909. // If conv2 outputs current
  23910. tmp = conv2.split( " " );
  23911. if ( tmp[ 1 ] === current ) {
  23912. // If prev can be converted to accepted input
  23913. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  23914. converters[ "* " + tmp[ 0 ] ];
  23915. if ( conv ) {
  23916. // Condense equivalence converters
  23917. if ( conv === true ) {
  23918. conv = converters[ conv2 ];
  23919. // Otherwise, insert the intermediate dataType
  23920. } else if ( converters[ conv2 ] !== true ) {
  23921. current = tmp[ 0 ];
  23922. dataTypes.unshift( tmp[ 1 ] );
  23923. }
  23924. break;
  23925. }
  23926. }
  23927. }
  23928. }
  23929. // Apply converter (if not an equivalence)
  23930. if ( conv !== true ) {
  23931. // Unless errors are allowed to bubble, catch and return them
  23932. if ( conv && s.throws ) {
  23933. response = conv( response );
  23934. } else {
  23935. try {
  23936. response = conv( response );
  23937. } catch ( e ) {
  23938. return {
  23939. state: "parsererror",
  23940. error: conv ? e : "No conversion from " + prev + " to " + current
  23941. };
  23942. }
  23943. }
  23944. }
  23945. }
  23946. }
  23947. }
  23948. return { state: "success", data: response };
  23949. }
  23950. jQuery.extend( {
  23951. // Counter for holding the number of active queries
  23952. active: 0,
  23953. // Last-Modified header cache for next request
  23954. lastModified: {},
  23955. etag: {},
  23956. ajaxSettings: {
  23957. url: location.href,
  23958. type: "GET",
  23959. isLocal: rlocalProtocol.test( location.protocol ),
  23960. global: true,
  23961. processData: true,
  23962. async: true,
  23963. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  23964. /*
  23965. timeout: 0,
  23966. data: null,
  23967. dataType: null,
  23968. username: null,
  23969. password: null,
  23970. cache: null,
  23971. throws: false,
  23972. traditional: false,
  23973. headers: {},
  23974. */
  23975. accepts: {
  23976. "*": allTypes,
  23977. text: "text/plain",
  23978. html: "text/html",
  23979. xml: "application/xml, text/xml",
  23980. json: "application/json, text/javascript"
  23981. },
  23982. contents: {
  23983. xml: /\bxml\b/,
  23984. html: /\bhtml/,
  23985. json: /\bjson\b/
  23986. },
  23987. responseFields: {
  23988. xml: "responseXML",
  23989. text: "responseText",
  23990. json: "responseJSON"
  23991. },
  23992. // Data converters
  23993. // Keys separate source (or catchall "*") and destination types with a single space
  23994. converters: {
  23995. // Convert anything to text
  23996. "* text": String,
  23997. // Text to html (true = no transformation)
  23998. "text html": true,
  23999. // Evaluate text as a json expression
  24000. "text json": JSON.parse,
  24001. // Parse text as xml
  24002. "text xml": jQuery.parseXML
  24003. },
  24004. // For options that shouldn't be deep extended:
  24005. // you can add your own custom options here if
  24006. // and when you create one that shouldn't be
  24007. // deep extended (see ajaxExtend)
  24008. flatOptions: {
  24009. url: true,
  24010. context: true
  24011. }
  24012. },
  24013. // Creates a full fledged settings object into target
  24014. // with both ajaxSettings and settings fields.
  24015. // If target is omitted, writes into ajaxSettings.
  24016. ajaxSetup: function( target, settings ) {
  24017. return settings ?
  24018. // Building a settings object
  24019. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  24020. // Extending ajaxSettings
  24021. ajaxExtend( jQuery.ajaxSettings, target );
  24022. },
  24023. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  24024. ajaxTransport: addToPrefiltersOrTransports( transports ),
  24025. // Main method
  24026. ajax: function( url, options ) {
  24027. // If url is an object, simulate pre-1.5 signature
  24028. if ( typeof url === "object" ) {
  24029. options = url;
  24030. url = undefined;
  24031. }
  24032. // Force options to be an object
  24033. options = options || {};
  24034. var transport,
  24035. // URL without anti-cache param
  24036. cacheURL,
  24037. // Response headers
  24038. responseHeadersString,
  24039. responseHeaders,
  24040. // timeout handle
  24041. timeoutTimer,
  24042. // Url cleanup var
  24043. urlAnchor,
  24044. // Request state (becomes false upon send and true upon completion)
  24045. completed,
  24046. // To know if global events are to be dispatched
  24047. fireGlobals,
  24048. // Loop variable
  24049. i,
  24050. // uncached part of the url
  24051. uncached,
  24052. // Create the final options object
  24053. s = jQuery.ajaxSetup( {}, options ),
  24054. // Callbacks context
  24055. callbackContext = s.context || s,
  24056. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  24057. globalEventContext = s.context &&
  24058. ( callbackContext.nodeType || callbackContext.jquery ) ?
  24059. jQuery( callbackContext ) :
  24060. jQuery.event,
  24061. // Deferreds
  24062. deferred = jQuery.Deferred(),
  24063. completeDeferred = jQuery.Callbacks( "once memory" ),
  24064. // Status-dependent callbacks
  24065. statusCode = s.statusCode || {},
  24066. // Headers (they are sent all at once)
  24067. requestHeaders = {},
  24068. requestHeadersNames = {},
  24069. // Default abort message
  24070. strAbort = "canceled",
  24071. // Fake xhr
  24072. jqXHR = {
  24073. readyState: 0,
  24074. // Builds headers hashtable if needed
  24075. getResponseHeader: function( key ) {
  24076. var match;
  24077. if ( completed ) {
  24078. if ( !responseHeaders ) {
  24079. responseHeaders = {};
  24080. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  24081. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  24082. }
  24083. }
  24084. match = responseHeaders[ key.toLowerCase() ];
  24085. }
  24086. return match == null ? null : match;
  24087. },
  24088. // Raw string
  24089. getAllResponseHeaders: function() {
  24090. return completed ? responseHeadersString : null;
  24091. },
  24092. // Caches the header
  24093. setRequestHeader: function( name, value ) {
  24094. if ( completed == null ) {
  24095. name = requestHeadersNames[ name.toLowerCase() ] =
  24096. requestHeadersNames[ name.toLowerCase() ] || name;
  24097. requestHeaders[ name ] = value;
  24098. }
  24099. return this;
  24100. },
  24101. // Overrides response content-type header
  24102. overrideMimeType: function( type ) {
  24103. if ( completed == null ) {
  24104. s.mimeType = type;
  24105. }
  24106. return this;
  24107. },
  24108. // Status-dependent callbacks
  24109. statusCode: function( map ) {
  24110. var code;
  24111. if ( map ) {
  24112. if ( completed ) {
  24113. // Execute the appropriate callbacks
  24114. jqXHR.always( map[ jqXHR.status ] );
  24115. } else {
  24116. // Lazy-add the new callbacks in a way that preserves old ones
  24117. for ( code in map ) {
  24118. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  24119. }
  24120. }
  24121. }
  24122. return this;
  24123. },
  24124. // Cancel the request
  24125. abort: function( statusText ) {
  24126. var finalText = statusText || strAbort;
  24127. if ( transport ) {
  24128. transport.abort( finalText );
  24129. }
  24130. done( 0, finalText );
  24131. return this;
  24132. }
  24133. };
  24134. // Attach deferreds
  24135. deferred.promise( jqXHR );
  24136. // Add protocol if not provided (prefilters might expect it)
  24137. // Handle falsy url in the settings object (#10093: consistency with old signature)
  24138. // We also use the url parameter if available
  24139. s.url = ( ( url || s.url || location.href ) + "" )
  24140. .replace( rprotocol, location.protocol + "//" );
  24141. // Alias method option to type as per ticket #12004
  24142. s.type = options.method || options.type || s.method || s.type;
  24143. // Extract dataTypes list
  24144. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  24145. // A cross-domain request is in order when the origin doesn't match the current origin.
  24146. if ( s.crossDomain == null ) {
  24147. urlAnchor = document.createElement( "a" );
  24148. // Support: IE <=8 - 11, Edge 12 - 13
  24149. // IE throws exception on accessing the href property if url is malformed,
  24150. // e.g. http://example.com:80x/
  24151. try {
  24152. urlAnchor.href = s.url;
  24153. // Support: IE <=8 - 11 only
  24154. // Anchor's host property isn't correctly set when s.url is relative
  24155. urlAnchor.href = urlAnchor.href;
  24156. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  24157. urlAnchor.protocol + "//" + urlAnchor.host;
  24158. } catch ( e ) {
  24159. // If there is an error parsing the URL, assume it is crossDomain,
  24160. // it can be rejected by the transport if it is invalid
  24161. s.crossDomain = true;
  24162. }
  24163. }
  24164. // Convert data if not already a string
  24165. if ( s.data && s.processData && typeof s.data !== "string" ) {
  24166. s.data = jQuery.param( s.data, s.traditional );
  24167. }
  24168. // Apply prefilters
  24169. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  24170. // If request was aborted inside a prefilter, stop there
  24171. if ( completed ) {
  24172. return jqXHR;
  24173. }
  24174. // We can fire global events as of now if asked to
  24175. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  24176. fireGlobals = jQuery.event && s.global;
  24177. // Watch for a new set of requests
  24178. if ( fireGlobals && jQuery.active++ === 0 ) {
  24179. jQuery.event.trigger( "ajaxStart" );
  24180. }
  24181. // Uppercase the type
  24182. s.type = s.type.toUpperCase();
  24183. // Determine if request has content
  24184. s.hasContent = !rnoContent.test( s.type );
  24185. // Save the URL in case we're toying with the If-Modified-Since
  24186. // and/or If-None-Match header later on
  24187. // Remove hash to simplify url manipulation
  24188. cacheURL = s.url.replace( rhash, "" );
  24189. // More options handling for requests with no content
  24190. if ( !s.hasContent ) {
  24191. // Remember the hash so we can put it back
  24192. uncached = s.url.slice( cacheURL.length );
  24193. // If data is available, append data to url
  24194. if ( s.data ) {
  24195. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  24196. // #9682: remove data so that it's not used in an eventual retry
  24197. delete s.data;
  24198. }
  24199. // Add or update anti-cache param if needed
  24200. if ( s.cache === false ) {
  24201. cacheURL = cacheURL.replace( rantiCache, "$1" );
  24202. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  24203. }
  24204. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  24205. s.url = cacheURL + uncached;
  24206. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  24207. } else if ( s.data && s.processData &&
  24208. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  24209. s.data = s.data.replace( r20, "+" );
  24210. }
  24211. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24212. if ( s.ifModified ) {
  24213. if ( jQuery.lastModified[ cacheURL ] ) {
  24214. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  24215. }
  24216. if ( jQuery.etag[ cacheURL ] ) {
  24217. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  24218. }
  24219. }
  24220. // Set the correct header, if data is being sent
  24221. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  24222. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  24223. }
  24224. // Set the Accepts header for the server, depending on the dataType
  24225. jqXHR.setRequestHeader(
  24226. "Accept",
  24227. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  24228. s.accepts[ s.dataTypes[ 0 ] ] +
  24229. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  24230. s.accepts[ "*" ]
  24231. );
  24232. // Check for headers option
  24233. for ( i in s.headers ) {
  24234. jqXHR.setRequestHeader( i, s.headers[ i ] );
  24235. }
  24236. // Allow custom headers/mimetypes and early abort
  24237. if ( s.beforeSend &&
  24238. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  24239. // Abort if not done already and return
  24240. return jqXHR.abort();
  24241. }
  24242. // Aborting is no longer a cancellation
  24243. strAbort = "abort";
  24244. // Install callbacks on deferreds
  24245. completeDeferred.add( s.complete );
  24246. jqXHR.done( s.success );
  24247. jqXHR.fail( s.error );
  24248. // Get transport
  24249. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  24250. // If no transport, we auto-abort
  24251. if ( !transport ) {
  24252. done( -1, "No Transport" );
  24253. } else {
  24254. jqXHR.readyState = 1;
  24255. // Send global event
  24256. if ( fireGlobals ) {
  24257. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  24258. }
  24259. // If request was aborted inside ajaxSend, stop there
  24260. if ( completed ) {
  24261. return jqXHR;
  24262. }
  24263. // Timeout
  24264. if ( s.async && s.timeout > 0 ) {
  24265. timeoutTimer = window.setTimeout( function() {
  24266. jqXHR.abort( "timeout" );
  24267. }, s.timeout );
  24268. }
  24269. try {
  24270. completed = false;
  24271. transport.send( requestHeaders, done );
  24272. } catch ( e ) {
  24273. // Rethrow post-completion exceptions
  24274. if ( completed ) {
  24275. throw e;
  24276. }
  24277. // Propagate others as results
  24278. done( -1, e );
  24279. }
  24280. }
  24281. // Callback for when everything is done
  24282. function done( status, nativeStatusText, responses, headers ) {
  24283. var isSuccess, success, error, response, modified,
  24284. statusText = nativeStatusText;
  24285. // Ignore repeat invocations
  24286. if ( completed ) {
  24287. return;
  24288. }
  24289. completed = true;
  24290. // Clear timeout if it exists
  24291. if ( timeoutTimer ) {
  24292. window.clearTimeout( timeoutTimer );
  24293. }
  24294. // Dereference transport for early garbage collection
  24295. // (no matter how long the jqXHR object will be used)
  24296. transport = undefined;
  24297. // Cache response headers
  24298. responseHeadersString = headers || "";
  24299. // Set readyState
  24300. jqXHR.readyState = status > 0 ? 4 : 0;
  24301. // Determine if successful
  24302. isSuccess = status >= 200 && status < 300 || status === 304;
  24303. // Get response data
  24304. if ( responses ) {
  24305. response = ajaxHandleResponses( s, jqXHR, responses );
  24306. }
  24307. // Convert no matter what (that way responseXXX fields are always set)
  24308. response = ajaxConvert( s, response, jqXHR, isSuccess );
  24309. // If successful, handle type chaining
  24310. if ( isSuccess ) {
  24311. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24312. if ( s.ifModified ) {
  24313. modified = jqXHR.getResponseHeader( "Last-Modified" );
  24314. if ( modified ) {
  24315. jQuery.lastModified[ cacheURL ] = modified;
  24316. }
  24317. modified = jqXHR.getResponseHeader( "etag" );
  24318. if ( modified ) {
  24319. jQuery.etag[ cacheURL ] = modified;
  24320. }
  24321. }
  24322. // if no content
  24323. if ( status === 204 || s.type === "HEAD" ) {
  24324. statusText = "nocontent";
  24325. // if not modified
  24326. } else if ( status === 304 ) {
  24327. statusText = "notmodified";
  24328. // If we have data, let's convert it
  24329. } else {
  24330. statusText = response.state;
  24331. success = response.data;
  24332. error = response.error;
  24333. isSuccess = !error;
  24334. }
  24335. } else {
  24336. // Extract error from statusText and normalize for non-aborts
  24337. error = statusText;
  24338. if ( status || !statusText ) {
  24339. statusText = "error";
  24340. if ( status < 0 ) {
  24341. status = 0;
  24342. }
  24343. }
  24344. }
  24345. // Set data for the fake xhr object
  24346. jqXHR.status = status;
  24347. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  24348. // Success/Error
  24349. if ( isSuccess ) {
  24350. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  24351. } else {
  24352. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  24353. }
  24354. // Status-dependent callbacks
  24355. jqXHR.statusCode( statusCode );
  24356. statusCode = undefined;
  24357. if ( fireGlobals ) {
  24358. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  24359. [ jqXHR, s, isSuccess ? success : error ] );
  24360. }
  24361. // Complete
  24362. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  24363. if ( fireGlobals ) {
  24364. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  24365. // Handle the global AJAX counter
  24366. if ( !( --jQuery.active ) ) {
  24367. jQuery.event.trigger( "ajaxStop" );
  24368. }
  24369. }
  24370. }
  24371. return jqXHR;
  24372. },
  24373. getJSON: function( url, data, callback ) {
  24374. return jQuery.get( url, data, callback, "json" );
  24375. },
  24376. getScript: function( url, callback ) {
  24377. return jQuery.get( url, undefined, callback, "script" );
  24378. }
  24379. } );
  24380. jQuery.each( [ "get", "post" ], function( i, method ) {
  24381. jQuery[ method ] = function( url, data, callback, type ) {
  24382. // Shift arguments if data argument was omitted
  24383. if ( jQuery.isFunction( data ) ) {
  24384. type = type || callback;
  24385. callback = data;
  24386. data = undefined;
  24387. }
  24388. // The url can be an options object (which then must have .url)
  24389. return jQuery.ajax( jQuery.extend( {
  24390. url: url,
  24391. type: method,
  24392. dataType: type,
  24393. data: data,
  24394. success: callback
  24395. }, jQuery.isPlainObject( url ) && url ) );
  24396. };
  24397. } );
  24398. jQuery._evalUrl = function( url ) {
  24399. return jQuery.ajax( {
  24400. url: url,
  24401. // Make this explicit, since user can override this through ajaxSetup (#11264)
  24402. type: "GET",
  24403. dataType: "script",
  24404. cache: true,
  24405. async: false,
  24406. global: false,
  24407. "throws": true
  24408. } );
  24409. };
  24410. jQuery.fn.extend( {
  24411. wrapAll: function( html ) {
  24412. var wrap;
  24413. if ( this[ 0 ] ) {
  24414. if ( jQuery.isFunction( html ) ) {
  24415. html = html.call( this[ 0 ] );
  24416. }
  24417. // The elements to wrap the target around
  24418. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  24419. if ( this[ 0 ].parentNode ) {
  24420. wrap.insertBefore( this[ 0 ] );
  24421. }
  24422. wrap.map( function() {
  24423. var elem = this;
  24424. while ( elem.firstElementChild ) {
  24425. elem = elem.firstElementChild;
  24426. }
  24427. return elem;
  24428. } ).append( this );
  24429. }
  24430. return this;
  24431. },
  24432. wrapInner: function( html ) {
  24433. if ( jQuery.isFunction( html ) ) {
  24434. return this.each( function( i ) {
  24435. jQuery( this ).wrapInner( html.call( this, i ) );
  24436. } );
  24437. }
  24438. return this.each( function() {
  24439. var self = jQuery( this ),
  24440. contents = self.contents();
  24441. if ( contents.length ) {
  24442. contents.wrapAll( html );
  24443. } else {
  24444. self.append( html );
  24445. }
  24446. } );
  24447. },
  24448. wrap: function( html ) {
  24449. var isFunction = jQuery.isFunction( html );
  24450. return this.each( function( i ) {
  24451. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  24452. } );
  24453. },
  24454. unwrap: function( selector ) {
  24455. this.parent( selector ).not( "body" ).each( function() {
  24456. jQuery( this ).replaceWith( this.childNodes );
  24457. } );
  24458. return this;
  24459. }
  24460. } );
  24461. jQuery.expr.pseudos.hidden = function( elem ) {
  24462. return !jQuery.expr.pseudos.visible( elem );
  24463. };
  24464. jQuery.expr.pseudos.visible = function( elem ) {
  24465. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  24466. };
  24467. jQuery.ajaxSettings.xhr = function() {
  24468. try {
  24469. return new window.XMLHttpRequest();
  24470. } catch ( e ) {}
  24471. };
  24472. var xhrSuccessStatus = {
  24473. // File protocol always yields status code 0, assume 200
  24474. 0: 200,
  24475. // Support: IE <=9 only
  24476. // #1450: sometimes IE returns 1223 when it should be 204
  24477. 1223: 204
  24478. },
  24479. xhrSupported = jQuery.ajaxSettings.xhr();
  24480. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  24481. support.ajax = xhrSupported = !!xhrSupported;
  24482. jQuery.ajaxTransport( function( options ) {
  24483. var callback, errorCallback;
  24484. // Cross domain only allowed if supported through XMLHttpRequest
  24485. if ( support.cors || xhrSupported && !options.crossDomain ) {
  24486. return {
  24487. send: function( headers, complete ) {
  24488. var i,
  24489. xhr = options.xhr();
  24490. xhr.open(
  24491. options.type,
  24492. options.url,
  24493. options.async,
  24494. options.username,
  24495. options.password
  24496. );
  24497. // Apply custom fields if provided
  24498. if ( options.xhrFields ) {
  24499. for ( i in options.xhrFields ) {
  24500. xhr[ i ] = options.xhrFields[ i ];
  24501. }
  24502. }
  24503. // Override mime type if needed
  24504. if ( options.mimeType && xhr.overrideMimeType ) {
  24505. xhr.overrideMimeType( options.mimeType );
  24506. }
  24507. // X-Requested-With header
  24508. // For cross-domain requests, seeing as conditions for a preflight are
  24509. // akin to a jigsaw puzzle, we simply never set it to be sure.
  24510. // (it can always be set on a per-request basis or even using ajaxSetup)
  24511. // For same-domain requests, won't change header if already provided.
  24512. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  24513. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  24514. }
  24515. // Set headers
  24516. for ( i in headers ) {
  24517. xhr.setRequestHeader( i, headers[ i ] );
  24518. }
  24519. // Callback
  24520. callback = function( type ) {
  24521. return function() {
  24522. if ( callback ) {
  24523. callback = errorCallback = xhr.onload =
  24524. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  24525. if ( type === "abort" ) {
  24526. xhr.abort();
  24527. } else if ( type === "error" ) {
  24528. // Support: IE <=9 only
  24529. // On a manual native abort, IE9 throws
  24530. // errors on any property access that is not readyState
  24531. if ( typeof xhr.status !== "number" ) {
  24532. complete( 0, "error" );
  24533. } else {
  24534. complete(
  24535. // File: protocol always yields status 0; see #8605, #14207
  24536. xhr.status,
  24537. xhr.statusText
  24538. );
  24539. }
  24540. } else {
  24541. complete(
  24542. xhrSuccessStatus[ xhr.status ] || xhr.status,
  24543. xhr.statusText,
  24544. // Support: IE <=9 only
  24545. // IE9 has no XHR2 but throws on binary (trac-11426)
  24546. // For XHR2 non-text, let the caller handle it (gh-2498)
  24547. ( xhr.responseType || "text" ) !== "text" ||
  24548. typeof xhr.responseText !== "string" ?
  24549. { binary: xhr.response } :
  24550. { text: xhr.responseText },
  24551. xhr.getAllResponseHeaders()
  24552. );
  24553. }
  24554. }
  24555. };
  24556. };
  24557. // Listen to events
  24558. xhr.onload = callback();
  24559. errorCallback = xhr.onerror = callback( "error" );
  24560. // Support: IE 9 only
  24561. // Use onreadystatechange to replace onabort
  24562. // to handle uncaught aborts
  24563. if ( xhr.onabort !== undefined ) {
  24564. xhr.onabort = errorCallback;
  24565. } else {
  24566. xhr.onreadystatechange = function() {
  24567. // Check readyState before timeout as it changes
  24568. if ( xhr.readyState === 4 ) {
  24569. // Allow onerror to be called first,
  24570. // but that will not handle a native abort
  24571. // Also, save errorCallback to a variable
  24572. // as xhr.onerror cannot be accessed
  24573. window.setTimeout( function() {
  24574. if ( callback ) {
  24575. errorCallback();
  24576. }
  24577. } );
  24578. }
  24579. };
  24580. }
  24581. // Create the abort callback
  24582. callback = callback( "abort" );
  24583. try {
  24584. // Do send the request (this may raise an exception)
  24585. xhr.send( options.hasContent && options.data || null );
  24586. } catch ( e ) {
  24587. // #14683: Only rethrow if this hasn't been notified as an error yet
  24588. if ( callback ) {
  24589. throw e;
  24590. }
  24591. }
  24592. },
  24593. abort: function() {
  24594. if ( callback ) {
  24595. callback();
  24596. }
  24597. }
  24598. };
  24599. }
  24600. } );
  24601. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  24602. jQuery.ajaxPrefilter( function( s ) {
  24603. if ( s.crossDomain ) {
  24604. s.contents.script = false;
  24605. }
  24606. } );
  24607. // Install script dataType
  24608. jQuery.ajaxSetup( {
  24609. accepts: {
  24610. script: "text/javascript, application/javascript, " +
  24611. "application/ecmascript, application/x-ecmascript"
  24612. },
  24613. contents: {
  24614. script: /\b(?:java|ecma)script\b/
  24615. },
  24616. converters: {
  24617. "text script": function( text ) {
  24618. jQuery.globalEval( text );
  24619. return text;
  24620. }
  24621. }
  24622. } );
  24623. // Handle cache's special case and crossDomain
  24624. jQuery.ajaxPrefilter( "script", function( s ) {
  24625. if ( s.cache === undefined ) {
  24626. s.cache = false;
  24627. }
  24628. if ( s.crossDomain ) {
  24629. s.type = "GET";
  24630. }
  24631. } );
  24632. // Bind script tag hack transport
  24633. jQuery.ajaxTransport( "script", function( s ) {
  24634. // This transport only deals with cross domain requests
  24635. if ( s.crossDomain ) {
  24636. var script, callback;
  24637. return {
  24638. send: function( _, complete ) {
  24639. script = jQuery( "<script>" ).prop( {
  24640. charset: s.scriptCharset,
  24641. src: s.url
  24642. } ).on(
  24643. "load error",
  24644. callback = function( evt ) {
  24645. script.remove();
  24646. callback = null;
  24647. if ( evt ) {
  24648. complete( evt.type === "error" ? 404 : 200, evt.type );
  24649. }
  24650. }
  24651. );
  24652. // Use native DOM manipulation to avoid our domManip AJAX trickery
  24653. document.head.appendChild( script[ 0 ] );
  24654. },
  24655. abort: function() {
  24656. if ( callback ) {
  24657. callback();
  24658. }
  24659. }
  24660. };
  24661. }
  24662. } );
  24663. var oldCallbacks = [],
  24664. rjsonp = /(=)\?(?=&|$)|\?\?/;
  24665. // Default jsonp settings
  24666. jQuery.ajaxSetup( {
  24667. jsonp: "callback",
  24668. jsonpCallback: function() {
  24669. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  24670. this[ callback ] = true;
  24671. return callback;
  24672. }
  24673. } );
  24674. // Detect, normalize options and install callbacks for jsonp requests
  24675. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  24676. var callbackName, overwritten, responseContainer,
  24677. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  24678. "url" :
  24679. typeof s.data === "string" &&
  24680. ( s.contentType || "" )
  24681. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  24682. rjsonp.test( s.data ) && "data"
  24683. );
  24684. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  24685. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  24686. // Get callback name, remembering preexisting value associated with it
  24687. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  24688. s.jsonpCallback() :
  24689. s.jsonpCallback;
  24690. // Insert callback into url or form data
  24691. if ( jsonProp ) {
  24692. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  24693. } else if ( s.jsonp !== false ) {
  24694. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  24695. }
  24696. // Use data converter to retrieve json after script execution
  24697. s.converters[ "script json" ] = function() {
  24698. if ( !responseContainer ) {
  24699. jQuery.error( callbackName + " was not called" );
  24700. }
  24701. return responseContainer[ 0 ];
  24702. };
  24703. // Force json dataType
  24704. s.dataTypes[ 0 ] = "json";
  24705. // Install callback
  24706. overwritten = window[ callbackName ];
  24707. window[ callbackName ] = function() {
  24708. responseContainer = arguments;
  24709. };
  24710. // Clean-up function (fires after converters)
  24711. jqXHR.always( function() {
  24712. // If previous value didn't exist - remove it
  24713. if ( overwritten === undefined ) {
  24714. jQuery( window ).removeProp( callbackName );
  24715. // Otherwise restore preexisting value
  24716. } else {
  24717. window[ callbackName ] = overwritten;
  24718. }
  24719. // Save back as free
  24720. if ( s[ callbackName ] ) {
  24721. // Make sure that re-using the options doesn't screw things around
  24722. s.jsonpCallback = originalSettings.jsonpCallback;
  24723. // Save the callback name for future use
  24724. oldCallbacks.push( callbackName );
  24725. }
  24726. // Call if it was a function and we have a response
  24727. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  24728. overwritten( responseContainer[ 0 ] );
  24729. }
  24730. responseContainer = overwritten = undefined;
  24731. } );
  24732. // Delegate to script
  24733. return "script";
  24734. }
  24735. } );
  24736. // Support: Safari 8 only
  24737. // In Safari 8 documents created via document.implementation.createHTMLDocument
  24738. // collapse sibling forms: the second one becomes a child of the first one.
  24739. // Because of that, this security measure has to be disabled in Safari 8.
  24740. // https://bugs.webkit.org/show_bug.cgi?id=137337
  24741. support.createHTMLDocument = ( function() {
  24742. var body = document.implementation.createHTMLDocument( "" ).body;
  24743. body.innerHTML = "<form></form><form></form>";
  24744. return body.childNodes.length === 2;
  24745. } )();
  24746. // Argument "data" should be string of html
  24747. // context (optional): If specified, the fragment will be created in this context,
  24748. // defaults to document
  24749. // keepScripts (optional): If true, will include scripts passed in the html string
  24750. jQuery.parseHTML = function( data, context, keepScripts ) {
  24751. if ( typeof data !== "string" ) {
  24752. return [];
  24753. }
  24754. if ( typeof context === "boolean" ) {
  24755. keepScripts = context;
  24756. context = false;
  24757. }
  24758. var base, parsed, scripts;
  24759. if ( !context ) {
  24760. // Stop scripts or inline event handlers from being executed immediately
  24761. // by using document.implementation
  24762. if ( support.createHTMLDocument ) {
  24763. context = document.implementation.createHTMLDocument( "" );
  24764. // Set the base href for the created document
  24765. // so any parsed elements with URLs
  24766. // are based on the document's URL (gh-2965)
  24767. base = context.createElement( "base" );
  24768. base.href = document.location.href;
  24769. context.head.appendChild( base );
  24770. } else {
  24771. context = document;
  24772. }
  24773. }
  24774. parsed = rsingleTag.exec( data );
  24775. scripts = !keepScripts && [];
  24776. // Single tag
  24777. if ( parsed ) {
  24778. return [ context.createElement( parsed[ 1 ] ) ];
  24779. }
  24780. parsed = buildFragment( [ data ], context, scripts );
  24781. if ( scripts && scripts.length ) {
  24782. jQuery( scripts ).remove();
  24783. }
  24784. return jQuery.merge( [], parsed.childNodes );
  24785. };
  24786. /**
  24787. * Load a url into a page
  24788. */
  24789. jQuery.fn.load = function( url, params, callback ) {
  24790. var selector, type, response,
  24791. self = this,
  24792. off = url.indexOf( " " );
  24793. if ( off > -1 ) {
  24794. selector = stripAndCollapse( url.slice( off ) );
  24795. url = url.slice( 0, off );
  24796. }
  24797. // If it's a function
  24798. if ( jQuery.isFunction( params ) ) {
  24799. // We assume that it's the callback
  24800. callback = params;
  24801. params = undefined;
  24802. // Otherwise, build a param string
  24803. } else if ( params && typeof params === "object" ) {
  24804. type = "POST";
  24805. }
  24806. // If we have elements to modify, make the request
  24807. if ( self.length > 0 ) {
  24808. jQuery.ajax( {
  24809. url: url,
  24810. // If "type" variable is undefined, then "GET" method will be used.
  24811. // Make value of this field explicit since
  24812. // user can override it through ajaxSetup method
  24813. type: type || "GET",
  24814. dataType: "html",
  24815. data: params
  24816. } ).done( function( responseText ) {
  24817. // Save response for use in complete callback
  24818. response = arguments;
  24819. self.html( selector ?
  24820. // If a selector was specified, locate the right elements in a dummy div
  24821. // Exclude scripts to avoid IE 'Permission Denied' errors
  24822. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  24823. // Otherwise use the full result
  24824. responseText );
  24825. // If the request succeeds, this function gets "data", "status", "jqXHR"
  24826. // but they are ignored because response was set above.
  24827. // If it fails, this function gets "jqXHR", "status", "error"
  24828. } ).always( callback && function( jqXHR, status ) {
  24829. self.each( function() {
  24830. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  24831. } );
  24832. } );
  24833. }
  24834. return this;
  24835. };
  24836. // Attach a bunch of functions for handling common AJAX events
  24837. jQuery.each( [
  24838. "ajaxStart",
  24839. "ajaxStop",
  24840. "ajaxComplete",
  24841. "ajaxError",
  24842. "ajaxSuccess",
  24843. "ajaxSend"
  24844. ], function( i, type ) {
  24845. jQuery.fn[ type ] = function( fn ) {
  24846. return this.on( type, fn );
  24847. };
  24848. } );
  24849. jQuery.expr.pseudos.animated = function( elem ) {
  24850. return jQuery.grep( jQuery.timers, function( fn ) {
  24851. return elem === fn.elem;
  24852. } ).length;
  24853. };
  24854. jQuery.offset = {
  24855. setOffset: function( elem, options, i ) {
  24856. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  24857. position = jQuery.css( elem, "position" ),
  24858. curElem = jQuery( elem ),
  24859. props = {};
  24860. // Set position first, in-case top/left are set even on static elem
  24861. if ( position === "static" ) {
  24862. elem.style.position = "relative";
  24863. }
  24864. curOffset = curElem.offset();
  24865. curCSSTop = jQuery.css( elem, "top" );
  24866. curCSSLeft = jQuery.css( elem, "left" );
  24867. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  24868. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  24869. // Need to be able to calculate position if either
  24870. // top or left is auto and position is either absolute or fixed
  24871. if ( calculatePosition ) {
  24872. curPosition = curElem.position();
  24873. curTop = curPosition.top;
  24874. curLeft = curPosition.left;
  24875. } else {
  24876. curTop = parseFloat( curCSSTop ) || 0;
  24877. curLeft = parseFloat( curCSSLeft ) || 0;
  24878. }
  24879. if ( jQuery.isFunction( options ) ) {
  24880. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  24881. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  24882. }
  24883. if ( options.top != null ) {
  24884. props.top = ( options.top - curOffset.top ) + curTop;
  24885. }
  24886. if ( options.left != null ) {
  24887. props.left = ( options.left - curOffset.left ) + curLeft;
  24888. }
  24889. if ( "using" in options ) {
  24890. options.using.call( elem, props );
  24891. } else {
  24892. curElem.css( props );
  24893. }
  24894. }
  24895. };
  24896. jQuery.fn.extend( {
  24897. offset: function( options ) {
  24898. // Preserve chaining for setter
  24899. if ( arguments.length ) {
  24900. return options === undefined ?
  24901. this :
  24902. this.each( function( i ) {
  24903. jQuery.offset.setOffset( this, options, i );
  24904. } );
  24905. }
  24906. var doc, docElem, rect, win,
  24907. elem = this[ 0 ];
  24908. if ( !elem ) {
  24909. return;
  24910. }
  24911. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  24912. // Support: IE <=11 only
  24913. // Running getBoundingClientRect on a
  24914. // disconnected node in IE throws an error
  24915. if ( !elem.getClientRects().length ) {
  24916. return { top: 0, left: 0 };
  24917. }
  24918. rect = elem.getBoundingClientRect();
  24919. doc = elem.ownerDocument;
  24920. docElem = doc.documentElement;
  24921. win = doc.defaultView;
  24922. return {
  24923. top: rect.top + win.pageYOffset - docElem.clientTop,
  24924. left: rect.left + win.pageXOffset - docElem.clientLeft
  24925. };
  24926. },
  24927. position: function() {
  24928. if ( !this[ 0 ] ) {
  24929. return;
  24930. }
  24931. var offsetParent, offset,
  24932. elem = this[ 0 ],
  24933. parentOffset = { top: 0, left: 0 };
  24934. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  24935. // because it is its only offset parent
  24936. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  24937. // Assume getBoundingClientRect is there when computed position is fixed
  24938. offset = elem.getBoundingClientRect();
  24939. } else {
  24940. // Get *real* offsetParent
  24941. offsetParent = this.offsetParent();
  24942. // Get correct offsets
  24943. offset = this.offset();
  24944. if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
  24945. parentOffset = offsetParent.offset();
  24946. }
  24947. // Add offsetParent borders
  24948. parentOffset = {
  24949. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  24950. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  24951. };
  24952. }
  24953. // Subtract parent offsets and element margins
  24954. return {
  24955. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  24956. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  24957. };
  24958. },
  24959. // This method will return documentElement in the following cases:
  24960. // 1) For the element inside the iframe without offsetParent, this method will return
  24961. // documentElement of the parent window
  24962. // 2) For the hidden or detached element
  24963. // 3) For body or html element, i.e. in case of the html node - it will return itself
  24964. //
  24965. // but those exceptions were never presented as a real life use-cases
  24966. // and might be considered as more preferable results.
  24967. //
  24968. // This logic, however, is not guaranteed and can change at any point in the future
  24969. offsetParent: function() {
  24970. return this.map( function() {
  24971. var offsetParent = this.offsetParent;
  24972. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  24973. offsetParent = offsetParent.offsetParent;
  24974. }
  24975. return offsetParent || documentElement;
  24976. } );
  24977. }
  24978. } );
  24979. // Create scrollLeft and scrollTop methods
  24980. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  24981. var top = "pageYOffset" === prop;
  24982. jQuery.fn[ method ] = function( val ) {
  24983. return access( this, function( elem, method, val ) {
  24984. // Coalesce documents and windows
  24985. var win;
  24986. if ( jQuery.isWindow( elem ) ) {
  24987. win = elem;
  24988. } else if ( elem.nodeType === 9 ) {
  24989. win = elem.defaultView;
  24990. }
  24991. if ( val === undefined ) {
  24992. return win ? win[ prop ] : elem[ method ];
  24993. }
  24994. if ( win ) {
  24995. win.scrollTo(
  24996. !top ? val : win.pageXOffset,
  24997. top ? val : win.pageYOffset
  24998. );
  24999. } else {
  25000. elem[ method ] = val;
  25001. }
  25002. }, method, val, arguments.length );
  25003. };
  25004. } );
  25005. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  25006. // Add the top/left cssHooks using jQuery.fn.position
  25007. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  25008. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  25009. // getComputedStyle returns percent when specified for top/left/bottom/right;
  25010. // rather than make the css module depend on the offset module, just check for it here
  25011. jQuery.each( [ "top", "left" ], function( i, prop ) {
  25012. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  25013. function( elem, computed ) {
  25014. if ( computed ) {
  25015. computed = curCSS( elem, prop );
  25016. // If curCSS returns percentage, fallback to offset
  25017. return rnumnonpx.test( computed ) ?
  25018. jQuery( elem ).position()[ prop ] + "px" :
  25019. computed;
  25020. }
  25021. }
  25022. );
  25023. } );
  25024. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  25025. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  25026. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  25027. function( defaultExtra, funcName ) {
  25028. // Margin is only for outerHeight, outerWidth
  25029. jQuery.fn[ funcName ] = function( margin, value ) {
  25030. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  25031. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  25032. return access( this, function( elem, type, value ) {
  25033. var doc;
  25034. if ( jQuery.isWindow( elem ) ) {
  25035. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  25036. return funcName.indexOf( "outer" ) === 0 ?
  25037. elem[ "inner" + name ] :
  25038. elem.document.documentElement[ "client" + name ];
  25039. }
  25040. // Get document width or height
  25041. if ( elem.nodeType === 9 ) {
  25042. doc = elem.documentElement;
  25043. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  25044. // whichever is greatest
  25045. return Math.max(
  25046. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  25047. elem.body[ "offset" + name ], doc[ "offset" + name ],
  25048. doc[ "client" + name ]
  25049. );
  25050. }
  25051. return value === undefined ?
  25052. // Get width or height on the element, requesting but not forcing parseFloat
  25053. jQuery.css( elem, type, extra ) :
  25054. // Set width or height on the element
  25055. jQuery.style( elem, type, value, extra );
  25056. }, type, chainable ? margin : undefined, chainable );
  25057. };
  25058. } );
  25059. } );
  25060. jQuery.fn.extend( {
  25061. bind: function( types, data, fn ) {
  25062. return this.on( types, null, data, fn );
  25063. },
  25064. unbind: function( types, fn ) {
  25065. return this.off( types, null, fn );
  25066. },
  25067. delegate: function( selector, types, data, fn ) {
  25068. return this.on( types, selector, data, fn );
  25069. },
  25070. undelegate: function( selector, types, fn ) {
  25071. // ( namespace ) or ( selector, types [, fn] )
  25072. return arguments.length === 1 ?
  25073. this.off( selector, "**" ) :
  25074. this.off( types, selector || "**", fn );
  25075. }
  25076. } );
  25077. jQuery.holdReady = function( hold ) {
  25078. if ( hold ) {
  25079. jQuery.readyWait++;
  25080. } else {
  25081. jQuery.ready( true );
  25082. }
  25083. };
  25084. jQuery.isArray = Array.isArray;
  25085. jQuery.parseJSON = JSON.parse;
  25086. jQuery.nodeName = nodeName;
  25087. // Register as a named AMD module, since jQuery can be concatenated with other
  25088. // files that may use define, but not via a proper concatenation script that
  25089. // understands anonymous AMD modules. A named AMD is safest and most robust
  25090. // way to register. Lowercase jquery is used because AMD module names are
  25091. // derived from file names, and jQuery is normally delivered in a lowercase
  25092. // file name. Do this after creating the global so that if an AMD module wants
  25093. // to call noConflict to hide this version of jQuery, it will work.
  25094. // Note that for maximum portability, libraries that are not jQuery should
  25095. // declare themselves as anonymous modules, and avoid setting a global if an
  25096. // AMD loader is present. jQuery is a special case. For more information, see
  25097. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  25098. if ( true ) {
  25099. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
  25100. return jQuery;
  25101. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  25102. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25103. }
  25104. var
  25105. // Map over jQuery in case of overwrite
  25106. _jQuery = window.jQuery,
  25107. // Map over the $ in case of overwrite
  25108. _$ = window.$;
  25109. jQuery.noConflict = function( deep ) {
  25110. if ( window.$ === jQuery ) {
  25111. window.$ = _$;
  25112. }
  25113. if ( deep && window.jQuery === jQuery ) {
  25114. window.jQuery = _jQuery;
  25115. }
  25116. return jQuery;
  25117. };
  25118. // Expose jQuery and $ identifiers, even in AMD
  25119. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  25120. // and CommonJS for browser emulators (#13566)
  25121. if ( !noGlobal ) {
  25122. window.jQuery = window.$ = jQuery;
  25123. }
  25124. return jQuery;
  25125. } );
  25126. /***/ }),
  25127. /* 14 */
  25128. /***/ (function(module, exports) {
  25129. /*!
  25130. * Bootstrap v3.3.7 (http://getbootstrap.com)
  25131. * Copyright 2011-2016 Twitter, Inc.
  25132. * Licensed under the MIT license
  25133. */
  25134. if (typeof jQuery === 'undefined') {
  25135. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  25136. }
  25137. +function ($) {
  25138. 'use strict';
  25139. var version = $.fn.jquery.split(' ')[0].split('.')
  25140. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  25141. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  25142. }
  25143. }(jQuery);
  25144. /* ========================================================================
  25145. * Bootstrap: transition.js v3.3.7
  25146. * http://getbootstrap.com/javascript/#transitions
  25147. * ========================================================================
  25148. * Copyright 2011-2016 Twitter, Inc.
  25149. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25150. * ======================================================================== */
  25151. +function ($) {
  25152. 'use strict';
  25153. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  25154. // ============================================================
  25155. function transitionEnd() {
  25156. var el = document.createElement('bootstrap')
  25157. var transEndEventNames = {
  25158. WebkitTransition : 'webkitTransitionEnd',
  25159. MozTransition : 'transitionend',
  25160. OTransition : 'oTransitionEnd otransitionend',
  25161. transition : 'transitionend'
  25162. }
  25163. for (var name in transEndEventNames) {
  25164. if (el.style[name] !== undefined) {
  25165. return { end: transEndEventNames[name] }
  25166. }
  25167. }
  25168. return false // explicit for ie8 ( ._.)
  25169. }
  25170. // http://blog.alexmaccaw.com/css-transitions
  25171. $.fn.emulateTransitionEnd = function (duration) {
  25172. var called = false
  25173. var $el = this
  25174. $(this).one('bsTransitionEnd', function () { called = true })
  25175. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  25176. setTimeout(callback, duration)
  25177. return this
  25178. }
  25179. $(function () {
  25180. $.support.transition = transitionEnd()
  25181. if (!$.support.transition) return
  25182. $.event.special.bsTransitionEnd = {
  25183. bindType: $.support.transition.end,
  25184. delegateType: $.support.transition.end,
  25185. handle: function (e) {
  25186. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  25187. }
  25188. }
  25189. })
  25190. }(jQuery);
  25191. /* ========================================================================
  25192. * Bootstrap: alert.js v3.3.7
  25193. * http://getbootstrap.com/javascript/#alerts
  25194. * ========================================================================
  25195. * Copyright 2011-2016 Twitter, Inc.
  25196. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25197. * ======================================================================== */
  25198. +function ($) {
  25199. 'use strict';
  25200. // ALERT CLASS DEFINITION
  25201. // ======================
  25202. var dismiss = '[data-dismiss="alert"]'
  25203. var Alert = function (el) {
  25204. $(el).on('click', dismiss, this.close)
  25205. }
  25206. Alert.VERSION = '3.3.7'
  25207. Alert.TRANSITION_DURATION = 150
  25208. Alert.prototype.close = function (e) {
  25209. var $this = $(this)
  25210. var selector = $this.attr('data-target')
  25211. if (!selector) {
  25212. selector = $this.attr('href')
  25213. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25214. }
  25215. var $parent = $(selector === '#' ? [] : selector)
  25216. if (e) e.preventDefault()
  25217. if (!$parent.length) {
  25218. $parent = $this.closest('.alert')
  25219. }
  25220. $parent.trigger(e = $.Event('close.bs.alert'))
  25221. if (e.isDefaultPrevented()) return
  25222. $parent.removeClass('in')
  25223. function removeElement() {
  25224. // detach from parent, fire event then clean up data
  25225. $parent.detach().trigger('closed.bs.alert').remove()
  25226. }
  25227. $.support.transition && $parent.hasClass('fade') ?
  25228. $parent
  25229. .one('bsTransitionEnd', removeElement)
  25230. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  25231. removeElement()
  25232. }
  25233. // ALERT PLUGIN DEFINITION
  25234. // =======================
  25235. function Plugin(option) {
  25236. return this.each(function () {
  25237. var $this = $(this)
  25238. var data = $this.data('bs.alert')
  25239. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  25240. if (typeof option == 'string') data[option].call($this)
  25241. })
  25242. }
  25243. var old = $.fn.alert
  25244. $.fn.alert = Plugin
  25245. $.fn.alert.Constructor = Alert
  25246. // ALERT NO CONFLICT
  25247. // =================
  25248. $.fn.alert.noConflict = function () {
  25249. $.fn.alert = old
  25250. return this
  25251. }
  25252. // ALERT DATA-API
  25253. // ==============
  25254. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  25255. }(jQuery);
  25256. /* ========================================================================
  25257. * Bootstrap: button.js v3.3.7
  25258. * http://getbootstrap.com/javascript/#buttons
  25259. * ========================================================================
  25260. * Copyright 2011-2016 Twitter, Inc.
  25261. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25262. * ======================================================================== */
  25263. +function ($) {
  25264. 'use strict';
  25265. // BUTTON PUBLIC CLASS DEFINITION
  25266. // ==============================
  25267. var Button = function (element, options) {
  25268. this.$element = $(element)
  25269. this.options = $.extend({}, Button.DEFAULTS, options)
  25270. this.isLoading = false
  25271. }
  25272. Button.VERSION = '3.3.7'
  25273. Button.DEFAULTS = {
  25274. loadingText: 'loading...'
  25275. }
  25276. Button.prototype.setState = function (state) {
  25277. var d = 'disabled'
  25278. var $el = this.$element
  25279. var val = $el.is('input') ? 'val' : 'html'
  25280. var data = $el.data()
  25281. state += 'Text'
  25282. if (data.resetText == null) $el.data('resetText', $el[val]())
  25283. // push to event loop to allow forms to submit
  25284. setTimeout($.proxy(function () {
  25285. $el[val](data[state] == null ? this.options[state] : data[state])
  25286. if (state == 'loadingText') {
  25287. this.isLoading = true
  25288. $el.addClass(d).attr(d, d).prop(d, true)
  25289. } else if (this.isLoading) {
  25290. this.isLoading = false
  25291. $el.removeClass(d).removeAttr(d).prop(d, false)
  25292. }
  25293. }, this), 0)
  25294. }
  25295. Button.prototype.toggle = function () {
  25296. var changed = true
  25297. var $parent = this.$element.closest('[data-toggle="buttons"]')
  25298. if ($parent.length) {
  25299. var $input = this.$element.find('input')
  25300. if ($input.prop('type') == 'radio') {
  25301. if ($input.prop('checked')) changed = false
  25302. $parent.find('.active').removeClass('active')
  25303. this.$element.addClass('active')
  25304. } else if ($input.prop('type') == 'checkbox') {
  25305. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  25306. this.$element.toggleClass('active')
  25307. }
  25308. $input.prop('checked', this.$element.hasClass('active'))
  25309. if (changed) $input.trigger('change')
  25310. } else {
  25311. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  25312. this.$element.toggleClass('active')
  25313. }
  25314. }
  25315. // BUTTON PLUGIN DEFINITION
  25316. // ========================
  25317. function Plugin(option) {
  25318. return this.each(function () {
  25319. var $this = $(this)
  25320. var data = $this.data('bs.button')
  25321. var options = typeof option == 'object' && option
  25322. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  25323. if (option == 'toggle') data.toggle()
  25324. else if (option) data.setState(option)
  25325. })
  25326. }
  25327. var old = $.fn.button
  25328. $.fn.button = Plugin
  25329. $.fn.button.Constructor = Button
  25330. // BUTTON NO CONFLICT
  25331. // ==================
  25332. $.fn.button.noConflict = function () {
  25333. $.fn.button = old
  25334. return this
  25335. }
  25336. // BUTTON DATA-API
  25337. // ===============
  25338. $(document)
  25339. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25340. var $btn = $(e.target).closest('.btn')
  25341. Plugin.call($btn, 'toggle')
  25342. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  25343. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  25344. e.preventDefault()
  25345. // The target component still receive the focus
  25346. if ($btn.is('input,button')) $btn.trigger('focus')
  25347. else $btn.find('input:visible,button:visible').first().trigger('focus')
  25348. }
  25349. })
  25350. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25351. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  25352. })
  25353. }(jQuery);
  25354. /* ========================================================================
  25355. * Bootstrap: carousel.js v3.3.7
  25356. * http://getbootstrap.com/javascript/#carousel
  25357. * ========================================================================
  25358. * Copyright 2011-2016 Twitter, Inc.
  25359. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25360. * ======================================================================== */
  25361. +function ($) {
  25362. 'use strict';
  25363. // CAROUSEL CLASS DEFINITION
  25364. // =========================
  25365. var Carousel = function (element, options) {
  25366. this.$element = $(element)
  25367. this.$indicators = this.$element.find('.carousel-indicators')
  25368. this.options = options
  25369. this.paused = null
  25370. this.sliding = null
  25371. this.interval = null
  25372. this.$active = null
  25373. this.$items = null
  25374. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  25375. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  25376. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  25377. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  25378. }
  25379. Carousel.VERSION = '3.3.7'
  25380. Carousel.TRANSITION_DURATION = 600
  25381. Carousel.DEFAULTS = {
  25382. interval: 5000,
  25383. pause: 'hover',
  25384. wrap: true,
  25385. keyboard: true
  25386. }
  25387. Carousel.prototype.keydown = function (e) {
  25388. if (/input|textarea/i.test(e.target.tagName)) return
  25389. switch (e.which) {
  25390. case 37: this.prev(); break
  25391. case 39: this.next(); break
  25392. default: return
  25393. }
  25394. e.preventDefault()
  25395. }
  25396. Carousel.prototype.cycle = function (e) {
  25397. e || (this.paused = false)
  25398. this.interval && clearInterval(this.interval)
  25399. this.options.interval
  25400. && !this.paused
  25401. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  25402. return this
  25403. }
  25404. Carousel.prototype.getItemIndex = function (item) {
  25405. this.$items = item.parent().children('.item')
  25406. return this.$items.index(item || this.$active)
  25407. }
  25408. Carousel.prototype.getItemForDirection = function (direction, active) {
  25409. var activeIndex = this.getItemIndex(active)
  25410. var willWrap = (direction == 'prev' && activeIndex === 0)
  25411. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  25412. if (willWrap && !this.options.wrap) return active
  25413. var delta = direction == 'prev' ? -1 : 1
  25414. var itemIndex = (activeIndex + delta) % this.$items.length
  25415. return this.$items.eq(itemIndex)
  25416. }
  25417. Carousel.prototype.to = function (pos) {
  25418. var that = this
  25419. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  25420. if (pos > (this.$items.length - 1) || pos < 0) return
  25421. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  25422. if (activeIndex == pos) return this.pause().cycle()
  25423. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  25424. }
  25425. Carousel.prototype.pause = function (e) {
  25426. e || (this.paused = true)
  25427. if (this.$element.find('.next, .prev').length && $.support.transition) {
  25428. this.$element.trigger($.support.transition.end)
  25429. this.cycle(true)
  25430. }
  25431. this.interval = clearInterval(this.interval)
  25432. return this
  25433. }
  25434. Carousel.prototype.next = function () {
  25435. if (this.sliding) return
  25436. return this.slide('next')
  25437. }
  25438. Carousel.prototype.prev = function () {
  25439. if (this.sliding) return
  25440. return this.slide('prev')
  25441. }
  25442. Carousel.prototype.slide = function (type, next) {
  25443. var $active = this.$element.find('.item.active')
  25444. var $next = next || this.getItemForDirection(type, $active)
  25445. var isCycling = this.interval
  25446. var direction = type == 'next' ? 'left' : 'right'
  25447. var that = this
  25448. if ($next.hasClass('active')) return (this.sliding = false)
  25449. var relatedTarget = $next[0]
  25450. var slideEvent = $.Event('slide.bs.carousel', {
  25451. relatedTarget: relatedTarget,
  25452. direction: direction
  25453. })
  25454. this.$element.trigger(slideEvent)
  25455. if (slideEvent.isDefaultPrevented()) return
  25456. this.sliding = true
  25457. isCycling && this.pause()
  25458. if (this.$indicators.length) {
  25459. this.$indicators.find('.active').removeClass('active')
  25460. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  25461. $nextIndicator && $nextIndicator.addClass('active')
  25462. }
  25463. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  25464. if ($.support.transition && this.$element.hasClass('slide')) {
  25465. $next.addClass(type)
  25466. $next[0].offsetWidth // force reflow
  25467. $active.addClass(direction)
  25468. $next.addClass(direction)
  25469. $active
  25470. .one('bsTransitionEnd', function () {
  25471. $next.removeClass([type, direction].join(' ')).addClass('active')
  25472. $active.removeClass(['active', direction].join(' '))
  25473. that.sliding = false
  25474. setTimeout(function () {
  25475. that.$element.trigger(slidEvent)
  25476. }, 0)
  25477. })
  25478. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  25479. } else {
  25480. $active.removeClass('active')
  25481. $next.addClass('active')
  25482. this.sliding = false
  25483. this.$element.trigger(slidEvent)
  25484. }
  25485. isCycling && this.cycle()
  25486. return this
  25487. }
  25488. // CAROUSEL PLUGIN DEFINITION
  25489. // ==========================
  25490. function Plugin(option) {
  25491. return this.each(function () {
  25492. var $this = $(this)
  25493. var data = $this.data('bs.carousel')
  25494. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25495. var action = typeof option == 'string' ? option : options.slide
  25496. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  25497. if (typeof option == 'number') data.to(option)
  25498. else if (action) data[action]()
  25499. else if (options.interval) data.pause().cycle()
  25500. })
  25501. }
  25502. var old = $.fn.carousel
  25503. $.fn.carousel = Plugin
  25504. $.fn.carousel.Constructor = Carousel
  25505. // CAROUSEL NO CONFLICT
  25506. // ====================
  25507. $.fn.carousel.noConflict = function () {
  25508. $.fn.carousel = old
  25509. return this
  25510. }
  25511. // CAROUSEL DATA-API
  25512. // =================
  25513. var clickHandler = function (e) {
  25514. var href
  25515. var $this = $(this)
  25516. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  25517. if (!$target.hasClass('carousel')) return
  25518. var options = $.extend({}, $target.data(), $this.data())
  25519. var slideIndex = $this.attr('data-slide-to')
  25520. if (slideIndex) options.interval = false
  25521. Plugin.call($target, options)
  25522. if (slideIndex) {
  25523. $target.data('bs.carousel').to(slideIndex)
  25524. }
  25525. e.preventDefault()
  25526. }
  25527. $(document)
  25528. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  25529. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  25530. $(window).on('load', function () {
  25531. $('[data-ride="carousel"]').each(function () {
  25532. var $carousel = $(this)
  25533. Plugin.call($carousel, $carousel.data())
  25534. })
  25535. })
  25536. }(jQuery);
  25537. /* ========================================================================
  25538. * Bootstrap: collapse.js v3.3.7
  25539. * http://getbootstrap.com/javascript/#collapse
  25540. * ========================================================================
  25541. * Copyright 2011-2016 Twitter, Inc.
  25542. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25543. * ======================================================================== */
  25544. /* jshint latedef: false */
  25545. +function ($) {
  25546. 'use strict';
  25547. // COLLAPSE PUBLIC CLASS DEFINITION
  25548. // ================================
  25549. var Collapse = function (element, options) {
  25550. this.$element = $(element)
  25551. this.options = $.extend({}, Collapse.DEFAULTS, options)
  25552. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  25553. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  25554. this.transitioning = null
  25555. if (this.options.parent) {
  25556. this.$parent = this.getParent()
  25557. } else {
  25558. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  25559. }
  25560. if (this.options.toggle) this.toggle()
  25561. }
  25562. Collapse.VERSION = '3.3.7'
  25563. Collapse.TRANSITION_DURATION = 350
  25564. Collapse.DEFAULTS = {
  25565. toggle: true
  25566. }
  25567. Collapse.prototype.dimension = function () {
  25568. var hasWidth = this.$element.hasClass('width')
  25569. return hasWidth ? 'width' : 'height'
  25570. }
  25571. Collapse.prototype.show = function () {
  25572. if (this.transitioning || this.$element.hasClass('in')) return
  25573. var activesData
  25574. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  25575. if (actives && actives.length) {
  25576. activesData = actives.data('bs.collapse')
  25577. if (activesData && activesData.transitioning) return
  25578. }
  25579. var startEvent = $.Event('show.bs.collapse')
  25580. this.$element.trigger(startEvent)
  25581. if (startEvent.isDefaultPrevented()) return
  25582. if (actives && actives.length) {
  25583. Plugin.call(actives, 'hide')
  25584. activesData || actives.data('bs.collapse', null)
  25585. }
  25586. var dimension = this.dimension()
  25587. this.$element
  25588. .removeClass('collapse')
  25589. .addClass('collapsing')[dimension](0)
  25590. .attr('aria-expanded', true)
  25591. this.$trigger
  25592. .removeClass('collapsed')
  25593. .attr('aria-expanded', true)
  25594. this.transitioning = 1
  25595. var complete = function () {
  25596. this.$element
  25597. .removeClass('collapsing')
  25598. .addClass('collapse in')[dimension]('')
  25599. this.transitioning = 0
  25600. this.$element
  25601. .trigger('shown.bs.collapse')
  25602. }
  25603. if (!$.support.transition) return complete.call(this)
  25604. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  25605. this.$element
  25606. .one('bsTransitionEnd', $.proxy(complete, this))
  25607. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  25608. }
  25609. Collapse.prototype.hide = function () {
  25610. if (this.transitioning || !this.$element.hasClass('in')) return
  25611. var startEvent = $.Event('hide.bs.collapse')
  25612. this.$element.trigger(startEvent)
  25613. if (startEvent.isDefaultPrevented()) return
  25614. var dimension = this.dimension()
  25615. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  25616. this.$element
  25617. .addClass('collapsing')
  25618. .removeClass('collapse in')
  25619. .attr('aria-expanded', false)
  25620. this.$trigger
  25621. .addClass('collapsed')
  25622. .attr('aria-expanded', false)
  25623. this.transitioning = 1
  25624. var complete = function () {
  25625. this.transitioning = 0
  25626. this.$element
  25627. .removeClass('collapsing')
  25628. .addClass('collapse')
  25629. .trigger('hidden.bs.collapse')
  25630. }
  25631. if (!$.support.transition) return complete.call(this)
  25632. this.$element
  25633. [dimension](0)
  25634. .one('bsTransitionEnd', $.proxy(complete, this))
  25635. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  25636. }
  25637. Collapse.prototype.toggle = function () {
  25638. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  25639. }
  25640. Collapse.prototype.getParent = function () {
  25641. return $(this.options.parent)
  25642. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  25643. .each($.proxy(function (i, element) {
  25644. var $element = $(element)
  25645. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  25646. }, this))
  25647. .end()
  25648. }
  25649. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  25650. var isOpen = $element.hasClass('in')
  25651. $element.attr('aria-expanded', isOpen)
  25652. $trigger
  25653. .toggleClass('collapsed', !isOpen)
  25654. .attr('aria-expanded', isOpen)
  25655. }
  25656. function getTargetFromTrigger($trigger) {
  25657. var href
  25658. var target = $trigger.attr('data-target')
  25659. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  25660. return $(target)
  25661. }
  25662. // COLLAPSE PLUGIN DEFINITION
  25663. // ==========================
  25664. function Plugin(option) {
  25665. return this.each(function () {
  25666. var $this = $(this)
  25667. var data = $this.data('bs.collapse')
  25668. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25669. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  25670. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  25671. if (typeof option == 'string') data[option]()
  25672. })
  25673. }
  25674. var old = $.fn.collapse
  25675. $.fn.collapse = Plugin
  25676. $.fn.collapse.Constructor = Collapse
  25677. // COLLAPSE NO CONFLICT
  25678. // ====================
  25679. $.fn.collapse.noConflict = function () {
  25680. $.fn.collapse = old
  25681. return this
  25682. }
  25683. // COLLAPSE DATA-API
  25684. // =================
  25685. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  25686. var $this = $(this)
  25687. if (!$this.attr('data-target')) e.preventDefault()
  25688. var $target = getTargetFromTrigger($this)
  25689. var data = $target.data('bs.collapse')
  25690. var option = data ? 'toggle' : $this.data()
  25691. Plugin.call($target, option)
  25692. })
  25693. }(jQuery);
  25694. /* ========================================================================
  25695. * Bootstrap: dropdown.js v3.3.7
  25696. * http://getbootstrap.com/javascript/#dropdowns
  25697. * ========================================================================
  25698. * Copyright 2011-2016 Twitter, Inc.
  25699. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25700. * ======================================================================== */
  25701. +function ($) {
  25702. 'use strict';
  25703. // DROPDOWN CLASS DEFINITION
  25704. // =========================
  25705. var backdrop = '.dropdown-backdrop'
  25706. var toggle = '[data-toggle="dropdown"]'
  25707. var Dropdown = function (element) {
  25708. $(element).on('click.bs.dropdown', this.toggle)
  25709. }
  25710. Dropdown.VERSION = '3.3.7'
  25711. function getParent($this) {
  25712. var selector = $this.attr('data-target')
  25713. if (!selector) {
  25714. selector = $this.attr('href')
  25715. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25716. }
  25717. var $parent = selector && $(selector)
  25718. return $parent && $parent.length ? $parent : $this.parent()
  25719. }
  25720. function clearMenus(e) {
  25721. if (e && e.which === 3) return
  25722. $(backdrop).remove()
  25723. $(toggle).each(function () {
  25724. var $this = $(this)
  25725. var $parent = getParent($this)
  25726. var relatedTarget = { relatedTarget: this }
  25727. if (!$parent.hasClass('open')) return
  25728. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  25729. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  25730. if (e.isDefaultPrevented()) return
  25731. $this.attr('aria-expanded', 'false')
  25732. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  25733. })
  25734. }
  25735. Dropdown.prototype.toggle = function (e) {
  25736. var $this = $(this)
  25737. if ($this.is('.disabled, :disabled')) return
  25738. var $parent = getParent($this)
  25739. var isActive = $parent.hasClass('open')
  25740. clearMenus()
  25741. if (!isActive) {
  25742. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  25743. // if mobile we use a backdrop because click events don't delegate
  25744. $(document.createElement('div'))
  25745. .addClass('dropdown-backdrop')
  25746. .insertAfter($(this))
  25747. .on('click', clearMenus)
  25748. }
  25749. var relatedTarget = { relatedTarget: this }
  25750. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  25751. if (e.isDefaultPrevented()) return
  25752. $this
  25753. .trigger('focus')
  25754. .attr('aria-expanded', 'true')
  25755. $parent
  25756. .toggleClass('open')
  25757. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  25758. }
  25759. return false
  25760. }
  25761. Dropdown.prototype.keydown = function (e) {
  25762. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  25763. var $this = $(this)
  25764. e.preventDefault()
  25765. e.stopPropagation()
  25766. if ($this.is('.disabled, :disabled')) return
  25767. var $parent = getParent($this)
  25768. var isActive = $parent.hasClass('open')
  25769. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  25770. if (e.which == 27) $parent.find(toggle).trigger('focus')
  25771. return $this.trigger('click')
  25772. }
  25773. var desc = ' li:not(.disabled):visible a'
  25774. var $items = $parent.find('.dropdown-menu' + desc)
  25775. if (!$items.length) return
  25776. var index = $items.index(e.target)
  25777. if (e.which == 38 && index > 0) index-- // up
  25778. if (e.which == 40 && index < $items.length - 1) index++ // down
  25779. if (!~index) index = 0
  25780. $items.eq(index).trigger('focus')
  25781. }
  25782. // DROPDOWN PLUGIN DEFINITION
  25783. // ==========================
  25784. function Plugin(option) {
  25785. return this.each(function () {
  25786. var $this = $(this)
  25787. var data = $this.data('bs.dropdown')
  25788. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  25789. if (typeof option == 'string') data[option].call($this)
  25790. })
  25791. }
  25792. var old = $.fn.dropdown
  25793. $.fn.dropdown = Plugin
  25794. $.fn.dropdown.Constructor = Dropdown
  25795. // DROPDOWN NO CONFLICT
  25796. // ====================
  25797. $.fn.dropdown.noConflict = function () {
  25798. $.fn.dropdown = old
  25799. return this
  25800. }
  25801. // APPLY TO STANDARD DROPDOWN ELEMENTS
  25802. // ===================================
  25803. $(document)
  25804. .on('click.bs.dropdown.data-api', clearMenus)
  25805. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  25806. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  25807. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  25808. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  25809. }(jQuery);
  25810. /* ========================================================================
  25811. * Bootstrap: modal.js v3.3.7
  25812. * http://getbootstrap.com/javascript/#modals
  25813. * ========================================================================
  25814. * Copyright 2011-2016 Twitter, Inc.
  25815. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25816. * ======================================================================== */
  25817. +function ($) {
  25818. 'use strict';
  25819. // MODAL CLASS DEFINITION
  25820. // ======================
  25821. var Modal = function (element, options) {
  25822. this.options = options
  25823. this.$body = $(document.body)
  25824. this.$element = $(element)
  25825. this.$dialog = this.$element.find('.modal-dialog')
  25826. this.$backdrop = null
  25827. this.isShown = null
  25828. this.originalBodyPad = null
  25829. this.scrollbarWidth = 0
  25830. this.ignoreBackdropClick = false
  25831. if (this.options.remote) {
  25832. this.$element
  25833. .find('.modal-content')
  25834. .load(this.options.remote, $.proxy(function () {
  25835. this.$element.trigger('loaded.bs.modal')
  25836. }, this))
  25837. }
  25838. }
  25839. Modal.VERSION = '3.3.7'
  25840. Modal.TRANSITION_DURATION = 300
  25841. Modal.BACKDROP_TRANSITION_DURATION = 150
  25842. Modal.DEFAULTS = {
  25843. backdrop: true,
  25844. keyboard: true,
  25845. show: true
  25846. }
  25847. Modal.prototype.toggle = function (_relatedTarget) {
  25848. return this.isShown ? this.hide() : this.show(_relatedTarget)
  25849. }
  25850. Modal.prototype.show = function (_relatedTarget) {
  25851. var that = this
  25852. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  25853. this.$element.trigger(e)
  25854. if (this.isShown || e.isDefaultPrevented()) return
  25855. this.isShown = true
  25856. this.checkScrollbar()
  25857. this.setScrollbar()
  25858. this.$body.addClass('modal-open')
  25859. this.escape()
  25860. this.resize()
  25861. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  25862. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  25863. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  25864. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  25865. })
  25866. })
  25867. this.backdrop(function () {
  25868. var transition = $.support.transition && that.$element.hasClass('fade')
  25869. if (!that.$element.parent().length) {
  25870. that.$element.appendTo(that.$body) // don't move modals dom position
  25871. }
  25872. that.$element
  25873. .show()
  25874. .scrollTop(0)
  25875. that.adjustDialog()
  25876. if (transition) {
  25877. that.$element[0].offsetWidth // force reflow
  25878. }
  25879. that.$element.addClass('in')
  25880. that.enforceFocus()
  25881. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  25882. transition ?
  25883. that.$dialog // wait for modal to slide in
  25884. .one('bsTransitionEnd', function () {
  25885. that.$element.trigger('focus').trigger(e)
  25886. })
  25887. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  25888. that.$element.trigger('focus').trigger(e)
  25889. })
  25890. }
  25891. Modal.prototype.hide = function (e) {
  25892. if (e) e.preventDefault()
  25893. e = $.Event('hide.bs.modal')
  25894. this.$element.trigger(e)
  25895. if (!this.isShown || e.isDefaultPrevented()) return
  25896. this.isShown = false
  25897. this.escape()
  25898. this.resize()
  25899. $(document).off('focusin.bs.modal')
  25900. this.$element
  25901. .removeClass('in')
  25902. .off('click.dismiss.bs.modal')
  25903. .off('mouseup.dismiss.bs.modal')
  25904. this.$dialog.off('mousedown.dismiss.bs.modal')
  25905. $.support.transition && this.$element.hasClass('fade') ?
  25906. this.$element
  25907. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  25908. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  25909. this.hideModal()
  25910. }
  25911. Modal.prototype.enforceFocus = function () {
  25912. $(document)
  25913. .off('focusin.bs.modal') // guard against infinite focus loop
  25914. .on('focusin.bs.modal', $.proxy(function (e) {
  25915. if (document !== e.target &&
  25916. this.$element[0] !== e.target &&
  25917. !this.$element.has(e.target).length) {
  25918. this.$element.trigger('focus')
  25919. }
  25920. }, this))
  25921. }
  25922. Modal.prototype.escape = function () {
  25923. if (this.isShown && this.options.keyboard) {
  25924. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  25925. e.which == 27 && this.hide()
  25926. }, this))
  25927. } else if (!this.isShown) {
  25928. this.$element.off('keydown.dismiss.bs.modal')
  25929. }
  25930. }
  25931. Modal.prototype.resize = function () {
  25932. if (this.isShown) {
  25933. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  25934. } else {
  25935. $(window).off('resize.bs.modal')
  25936. }
  25937. }
  25938. Modal.prototype.hideModal = function () {
  25939. var that = this
  25940. this.$element.hide()
  25941. this.backdrop(function () {
  25942. that.$body.removeClass('modal-open')
  25943. that.resetAdjustments()
  25944. that.resetScrollbar()
  25945. that.$element.trigger('hidden.bs.modal')
  25946. })
  25947. }
  25948. Modal.prototype.removeBackdrop = function () {
  25949. this.$backdrop && this.$backdrop.remove()
  25950. this.$backdrop = null
  25951. }
  25952. Modal.prototype.backdrop = function (callback) {
  25953. var that = this
  25954. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  25955. if (this.isShown && this.options.backdrop) {
  25956. var doAnimate = $.support.transition && animate
  25957. this.$backdrop = $(document.createElement('div'))
  25958. .addClass('modal-backdrop ' + animate)
  25959. .appendTo(this.$body)
  25960. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  25961. if (this.ignoreBackdropClick) {
  25962. this.ignoreBackdropClick = false
  25963. return
  25964. }
  25965. if (e.target !== e.currentTarget) return
  25966. this.options.backdrop == 'static'
  25967. ? this.$element[0].focus()
  25968. : this.hide()
  25969. }, this))
  25970. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  25971. this.$backdrop.addClass('in')
  25972. if (!callback) return
  25973. doAnimate ?
  25974. this.$backdrop
  25975. .one('bsTransitionEnd', callback)
  25976. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  25977. callback()
  25978. } else if (!this.isShown && this.$backdrop) {
  25979. this.$backdrop.removeClass('in')
  25980. var callbackRemove = function () {
  25981. that.removeBackdrop()
  25982. callback && callback()
  25983. }
  25984. $.support.transition && this.$element.hasClass('fade') ?
  25985. this.$backdrop
  25986. .one('bsTransitionEnd', callbackRemove)
  25987. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  25988. callbackRemove()
  25989. } else if (callback) {
  25990. callback()
  25991. }
  25992. }
  25993. // these following methods are used to handle overflowing modals
  25994. Modal.prototype.handleUpdate = function () {
  25995. this.adjustDialog()
  25996. }
  25997. Modal.prototype.adjustDialog = function () {
  25998. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  25999. this.$element.css({
  26000. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  26001. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  26002. })
  26003. }
  26004. Modal.prototype.resetAdjustments = function () {
  26005. this.$element.css({
  26006. paddingLeft: '',
  26007. paddingRight: ''
  26008. })
  26009. }
  26010. Modal.prototype.checkScrollbar = function () {
  26011. var fullWindowWidth = window.innerWidth
  26012. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  26013. var documentElementRect = document.documentElement.getBoundingClientRect()
  26014. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  26015. }
  26016. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  26017. this.scrollbarWidth = this.measureScrollbar()
  26018. }
  26019. Modal.prototype.setScrollbar = function () {
  26020. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  26021. this.originalBodyPad = document.body.style.paddingRight || ''
  26022. if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  26023. }
  26024. Modal.prototype.resetScrollbar = function () {
  26025. this.$body.css('padding-right', this.originalBodyPad)
  26026. }
  26027. Modal.prototype.measureScrollbar = function () { // thx walsh
  26028. var scrollDiv = document.createElement('div')
  26029. scrollDiv.className = 'modal-scrollbar-measure'
  26030. this.$body.append(scrollDiv)
  26031. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  26032. this.$body[0].removeChild(scrollDiv)
  26033. return scrollbarWidth
  26034. }
  26035. // MODAL PLUGIN DEFINITION
  26036. // =======================
  26037. function Plugin(option, _relatedTarget) {
  26038. return this.each(function () {
  26039. var $this = $(this)
  26040. var data = $this.data('bs.modal')
  26041. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26042. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  26043. if (typeof option == 'string') data[option](_relatedTarget)
  26044. else if (options.show) data.show(_relatedTarget)
  26045. })
  26046. }
  26047. var old = $.fn.modal
  26048. $.fn.modal = Plugin
  26049. $.fn.modal.Constructor = Modal
  26050. // MODAL NO CONFLICT
  26051. // =================
  26052. $.fn.modal.noConflict = function () {
  26053. $.fn.modal = old
  26054. return this
  26055. }
  26056. // MODAL DATA-API
  26057. // ==============
  26058. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  26059. var $this = $(this)
  26060. var href = $this.attr('href')
  26061. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  26062. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  26063. if ($this.is('a')) e.preventDefault()
  26064. $target.one('show.bs.modal', function (showEvent) {
  26065. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  26066. $target.one('hidden.bs.modal', function () {
  26067. $this.is(':visible') && $this.trigger('focus')
  26068. })
  26069. })
  26070. Plugin.call($target, option, this)
  26071. })
  26072. }(jQuery);
  26073. /* ========================================================================
  26074. * Bootstrap: tooltip.js v3.3.7
  26075. * http://getbootstrap.com/javascript/#tooltip
  26076. * Inspired by the original jQuery.tipsy by Jason Frame
  26077. * ========================================================================
  26078. * Copyright 2011-2016 Twitter, Inc.
  26079. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26080. * ======================================================================== */
  26081. +function ($) {
  26082. 'use strict';
  26083. // TOOLTIP PUBLIC CLASS DEFINITION
  26084. // ===============================
  26085. var Tooltip = function (element, options) {
  26086. this.type = null
  26087. this.options = null
  26088. this.enabled = null
  26089. this.timeout = null
  26090. this.hoverState = null
  26091. this.$element = null
  26092. this.inState = null
  26093. this.init('tooltip', element, options)
  26094. }
  26095. Tooltip.VERSION = '3.3.7'
  26096. Tooltip.TRANSITION_DURATION = 150
  26097. Tooltip.DEFAULTS = {
  26098. animation: true,
  26099. placement: 'top',
  26100. selector: false,
  26101. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  26102. trigger: 'hover focus',
  26103. title: '',
  26104. delay: 0,
  26105. html: false,
  26106. container: false,
  26107. viewport: {
  26108. selector: 'body',
  26109. padding: 0
  26110. }
  26111. }
  26112. Tooltip.prototype.init = function (type, element, options) {
  26113. this.enabled = true
  26114. this.type = type
  26115. this.$element = $(element)
  26116. this.options = this.getOptions(options)
  26117. this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  26118. this.inState = { click: false, hover: false, focus: false }
  26119. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  26120. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  26121. }
  26122. var triggers = this.options.trigger.split(' ')
  26123. for (var i = triggers.length; i--;) {
  26124. var trigger = triggers[i]
  26125. if (trigger == 'click') {
  26126. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  26127. } else if (trigger != 'manual') {
  26128. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  26129. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  26130. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  26131. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  26132. }
  26133. }
  26134. this.options.selector ?
  26135. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  26136. this.fixTitle()
  26137. }
  26138. Tooltip.prototype.getDefaults = function () {
  26139. return Tooltip.DEFAULTS
  26140. }
  26141. Tooltip.prototype.getOptions = function (options) {
  26142. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  26143. if (options.delay && typeof options.delay == 'number') {
  26144. options.delay = {
  26145. show: options.delay,
  26146. hide: options.delay
  26147. }
  26148. }
  26149. return options
  26150. }
  26151. Tooltip.prototype.getDelegateOptions = function () {
  26152. var options = {}
  26153. var defaults = this.getDefaults()
  26154. this._options && $.each(this._options, function (key, value) {
  26155. if (defaults[key] != value) options[key] = value
  26156. })
  26157. return options
  26158. }
  26159. Tooltip.prototype.enter = function (obj) {
  26160. var self = obj instanceof this.constructor ?
  26161. obj : $(obj.currentTarget).data('bs.' + this.type)
  26162. if (!self) {
  26163. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26164. $(obj.currentTarget).data('bs.' + this.type, self)
  26165. }
  26166. if (obj instanceof $.Event) {
  26167. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  26168. }
  26169. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  26170. self.hoverState = 'in'
  26171. return
  26172. }
  26173. clearTimeout(self.timeout)
  26174. self.hoverState = 'in'
  26175. if (!self.options.delay || !self.options.delay.show) return self.show()
  26176. self.timeout = setTimeout(function () {
  26177. if (self.hoverState == 'in') self.show()
  26178. }, self.options.delay.show)
  26179. }
  26180. Tooltip.prototype.isInStateTrue = function () {
  26181. for (var key in this.inState) {
  26182. if (this.inState[key]) return true
  26183. }
  26184. return false
  26185. }
  26186. Tooltip.prototype.leave = function (obj) {
  26187. var self = obj instanceof this.constructor ?
  26188. obj : $(obj.currentTarget).data('bs.' + this.type)
  26189. if (!self) {
  26190. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26191. $(obj.currentTarget).data('bs.' + this.type, self)
  26192. }
  26193. if (obj instanceof $.Event) {
  26194. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  26195. }
  26196. if (self.isInStateTrue()) return
  26197. clearTimeout(self.timeout)
  26198. self.hoverState = 'out'
  26199. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  26200. self.timeout = setTimeout(function () {
  26201. if (self.hoverState == 'out') self.hide()
  26202. }, self.options.delay.hide)
  26203. }
  26204. Tooltip.prototype.show = function () {
  26205. var e = $.Event('show.bs.' + this.type)
  26206. if (this.hasContent() && this.enabled) {
  26207. this.$element.trigger(e)
  26208. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  26209. if (e.isDefaultPrevented() || !inDom) return
  26210. var that = this
  26211. var $tip = this.tip()
  26212. var tipId = this.getUID(this.type)
  26213. this.setContent()
  26214. $tip.attr('id', tipId)
  26215. this.$element.attr('aria-describedby', tipId)
  26216. if (this.options.animation) $tip.addClass('fade')
  26217. var placement = typeof this.options.placement == 'function' ?
  26218. this.options.placement.call(this, $tip[0], this.$element[0]) :
  26219. this.options.placement
  26220. var autoToken = /\s?auto?\s?/i
  26221. var autoPlace = autoToken.test(placement)
  26222. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  26223. $tip
  26224. .detach()
  26225. .css({ top: 0, left: 0, display: 'block' })
  26226. .addClass(placement)
  26227. .data('bs.' + this.type, this)
  26228. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  26229. this.$element.trigger('inserted.bs.' + this.type)
  26230. var pos = this.getPosition()
  26231. var actualWidth = $tip[0].offsetWidth
  26232. var actualHeight = $tip[0].offsetHeight
  26233. if (autoPlace) {
  26234. var orgPlacement = placement
  26235. var viewportDim = this.getPosition(this.$viewport)
  26236. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  26237. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  26238. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  26239. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  26240. placement
  26241. $tip
  26242. .removeClass(orgPlacement)
  26243. .addClass(placement)
  26244. }
  26245. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  26246. this.applyPlacement(calculatedOffset, placement)
  26247. var complete = function () {
  26248. var prevHoverState = that.hoverState
  26249. that.$element.trigger('shown.bs.' + that.type)
  26250. that.hoverState = null
  26251. if (prevHoverState == 'out') that.leave(that)
  26252. }
  26253. $.support.transition && this.$tip.hasClass('fade') ?
  26254. $tip
  26255. .one('bsTransitionEnd', complete)
  26256. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26257. complete()
  26258. }
  26259. }
  26260. Tooltip.prototype.applyPlacement = function (offset, placement) {
  26261. var $tip = this.tip()
  26262. var width = $tip[0].offsetWidth
  26263. var height = $tip[0].offsetHeight
  26264. // manually read margins because getBoundingClientRect includes difference
  26265. var marginTop = parseInt($tip.css('margin-top'), 10)
  26266. var marginLeft = parseInt($tip.css('margin-left'), 10)
  26267. // we must check for NaN for ie 8/9
  26268. if (isNaN(marginTop)) marginTop = 0
  26269. if (isNaN(marginLeft)) marginLeft = 0
  26270. offset.top += marginTop
  26271. offset.left += marginLeft
  26272. // $.fn.offset doesn't round pixel values
  26273. // so we use setOffset directly with our own function B-0
  26274. $.offset.setOffset($tip[0], $.extend({
  26275. using: function (props) {
  26276. $tip.css({
  26277. top: Math.round(props.top),
  26278. left: Math.round(props.left)
  26279. })
  26280. }
  26281. }, offset), 0)
  26282. $tip.addClass('in')
  26283. // check to see if placing tip in new offset caused the tip to resize itself
  26284. var actualWidth = $tip[0].offsetWidth
  26285. var actualHeight = $tip[0].offsetHeight
  26286. if (placement == 'top' && actualHeight != height) {
  26287. offset.top = offset.top + height - actualHeight
  26288. }
  26289. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  26290. if (delta.left) offset.left += delta.left
  26291. else offset.top += delta.top
  26292. var isVertical = /top|bottom/.test(placement)
  26293. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  26294. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  26295. $tip.offset(offset)
  26296. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  26297. }
  26298. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  26299. this.arrow()
  26300. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  26301. .css(isVertical ? 'top' : 'left', '')
  26302. }
  26303. Tooltip.prototype.setContent = function () {
  26304. var $tip = this.tip()
  26305. var title = this.getTitle()
  26306. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  26307. $tip.removeClass('fade in top bottom left right')
  26308. }
  26309. Tooltip.prototype.hide = function (callback) {
  26310. var that = this
  26311. var $tip = $(this.$tip)
  26312. var e = $.Event('hide.bs.' + this.type)
  26313. function complete() {
  26314. if (that.hoverState != 'in') $tip.detach()
  26315. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  26316. that.$element
  26317. .removeAttr('aria-describedby')
  26318. .trigger('hidden.bs.' + that.type)
  26319. }
  26320. callback && callback()
  26321. }
  26322. this.$element.trigger(e)
  26323. if (e.isDefaultPrevented()) return
  26324. $tip.removeClass('in')
  26325. $.support.transition && $tip.hasClass('fade') ?
  26326. $tip
  26327. .one('bsTransitionEnd', complete)
  26328. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26329. complete()
  26330. this.hoverState = null
  26331. return this
  26332. }
  26333. Tooltip.prototype.fixTitle = function () {
  26334. var $e = this.$element
  26335. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  26336. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  26337. }
  26338. }
  26339. Tooltip.prototype.hasContent = function () {
  26340. return this.getTitle()
  26341. }
  26342. Tooltip.prototype.getPosition = function ($element) {
  26343. $element = $element || this.$element
  26344. var el = $element[0]
  26345. var isBody = el.tagName == 'BODY'
  26346. var elRect = el.getBoundingClientRect()
  26347. if (elRect.width == null) {
  26348. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  26349. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  26350. }
  26351. var isSvg = window.SVGElement && el instanceof window.SVGElement
  26352. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  26353. // See https://github.com/twbs/bootstrap/issues/20280
  26354. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  26355. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  26356. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  26357. return $.extend({}, elRect, scroll, outerDims, elOffset)
  26358. }
  26359. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  26360. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26361. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26362. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  26363. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  26364. }
  26365. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  26366. var delta = { top: 0, left: 0 }
  26367. if (!this.$viewport) return delta
  26368. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  26369. var viewportDimensions = this.getPosition(this.$viewport)
  26370. if (/right|left/.test(placement)) {
  26371. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  26372. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  26373. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  26374. delta.top = viewportDimensions.top - topEdgeOffset
  26375. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  26376. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  26377. }
  26378. } else {
  26379. var leftEdgeOffset = pos.left - viewportPadding
  26380. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  26381. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  26382. delta.left = viewportDimensions.left - leftEdgeOffset
  26383. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  26384. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  26385. }
  26386. }
  26387. return delta
  26388. }
  26389. Tooltip.prototype.getTitle = function () {
  26390. var title
  26391. var $e = this.$element
  26392. var o = this.options
  26393. title = $e.attr('data-original-title')
  26394. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  26395. return title
  26396. }
  26397. Tooltip.prototype.getUID = function (prefix) {
  26398. do prefix += ~~(Math.random() * 1000000)
  26399. while (document.getElementById(prefix))
  26400. return prefix
  26401. }
  26402. Tooltip.prototype.tip = function () {
  26403. if (!this.$tip) {
  26404. this.$tip = $(this.options.template)
  26405. if (this.$tip.length != 1) {
  26406. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  26407. }
  26408. }
  26409. return this.$tip
  26410. }
  26411. Tooltip.prototype.arrow = function () {
  26412. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  26413. }
  26414. Tooltip.prototype.enable = function () {
  26415. this.enabled = true
  26416. }
  26417. Tooltip.prototype.disable = function () {
  26418. this.enabled = false
  26419. }
  26420. Tooltip.prototype.toggleEnabled = function () {
  26421. this.enabled = !this.enabled
  26422. }
  26423. Tooltip.prototype.toggle = function (e) {
  26424. var self = this
  26425. if (e) {
  26426. self = $(e.currentTarget).data('bs.' + this.type)
  26427. if (!self) {
  26428. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  26429. $(e.currentTarget).data('bs.' + this.type, self)
  26430. }
  26431. }
  26432. if (e) {
  26433. self.inState.click = !self.inState.click
  26434. if (self.isInStateTrue()) self.enter(self)
  26435. else self.leave(self)
  26436. } else {
  26437. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  26438. }
  26439. }
  26440. Tooltip.prototype.destroy = function () {
  26441. var that = this
  26442. clearTimeout(this.timeout)
  26443. this.hide(function () {
  26444. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  26445. if (that.$tip) {
  26446. that.$tip.detach()
  26447. }
  26448. that.$tip = null
  26449. that.$arrow = null
  26450. that.$viewport = null
  26451. that.$element = null
  26452. })
  26453. }
  26454. // TOOLTIP PLUGIN DEFINITION
  26455. // =========================
  26456. function Plugin(option) {
  26457. return this.each(function () {
  26458. var $this = $(this)
  26459. var data = $this.data('bs.tooltip')
  26460. var options = typeof option == 'object' && option
  26461. if (!data && /destroy|hide/.test(option)) return
  26462. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  26463. if (typeof option == 'string') data[option]()
  26464. })
  26465. }
  26466. var old = $.fn.tooltip
  26467. $.fn.tooltip = Plugin
  26468. $.fn.tooltip.Constructor = Tooltip
  26469. // TOOLTIP NO CONFLICT
  26470. // ===================
  26471. $.fn.tooltip.noConflict = function () {
  26472. $.fn.tooltip = old
  26473. return this
  26474. }
  26475. }(jQuery);
  26476. /* ========================================================================
  26477. * Bootstrap: popover.js v3.3.7
  26478. * http://getbootstrap.com/javascript/#popovers
  26479. * ========================================================================
  26480. * Copyright 2011-2016 Twitter, Inc.
  26481. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26482. * ======================================================================== */
  26483. +function ($) {
  26484. 'use strict';
  26485. // POPOVER PUBLIC CLASS DEFINITION
  26486. // ===============================
  26487. var Popover = function (element, options) {
  26488. this.init('popover', element, options)
  26489. }
  26490. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  26491. Popover.VERSION = '3.3.7'
  26492. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  26493. placement: 'right',
  26494. trigger: 'click',
  26495. content: '',
  26496. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  26497. })
  26498. // NOTE: POPOVER EXTENDS tooltip.js
  26499. // ================================
  26500. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  26501. Popover.prototype.constructor = Popover
  26502. Popover.prototype.getDefaults = function () {
  26503. return Popover.DEFAULTS
  26504. }
  26505. Popover.prototype.setContent = function () {
  26506. var $tip = this.tip()
  26507. var title = this.getTitle()
  26508. var content = this.getContent()
  26509. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  26510. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  26511. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  26512. ](content)
  26513. $tip.removeClass('fade top bottom left right in')
  26514. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  26515. // this manually by checking the contents.
  26516. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  26517. }
  26518. Popover.prototype.hasContent = function () {
  26519. return this.getTitle() || this.getContent()
  26520. }
  26521. Popover.prototype.getContent = function () {
  26522. var $e = this.$element
  26523. var o = this.options
  26524. return $e.attr('data-content')
  26525. || (typeof o.content == 'function' ?
  26526. o.content.call($e[0]) :
  26527. o.content)
  26528. }
  26529. Popover.prototype.arrow = function () {
  26530. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  26531. }
  26532. // POPOVER PLUGIN DEFINITION
  26533. // =========================
  26534. function Plugin(option) {
  26535. return this.each(function () {
  26536. var $this = $(this)
  26537. var data = $this.data('bs.popover')
  26538. var options = typeof option == 'object' && option
  26539. if (!data && /destroy|hide/.test(option)) return
  26540. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  26541. if (typeof option == 'string') data[option]()
  26542. })
  26543. }
  26544. var old = $.fn.popover
  26545. $.fn.popover = Plugin
  26546. $.fn.popover.Constructor = Popover
  26547. // POPOVER NO CONFLICT
  26548. // ===================
  26549. $.fn.popover.noConflict = function () {
  26550. $.fn.popover = old
  26551. return this
  26552. }
  26553. }(jQuery);
  26554. /* ========================================================================
  26555. * Bootstrap: scrollspy.js v3.3.7
  26556. * http://getbootstrap.com/javascript/#scrollspy
  26557. * ========================================================================
  26558. * Copyright 2011-2016 Twitter, Inc.
  26559. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26560. * ======================================================================== */
  26561. +function ($) {
  26562. 'use strict';
  26563. // SCROLLSPY CLASS DEFINITION
  26564. // ==========================
  26565. function ScrollSpy(element, options) {
  26566. this.$body = $(document.body)
  26567. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  26568. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  26569. this.selector = (this.options.target || '') + ' .nav li > a'
  26570. this.offsets = []
  26571. this.targets = []
  26572. this.activeTarget = null
  26573. this.scrollHeight = 0
  26574. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  26575. this.refresh()
  26576. this.process()
  26577. }
  26578. ScrollSpy.VERSION = '3.3.7'
  26579. ScrollSpy.DEFAULTS = {
  26580. offset: 10
  26581. }
  26582. ScrollSpy.prototype.getScrollHeight = function () {
  26583. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  26584. }
  26585. ScrollSpy.prototype.refresh = function () {
  26586. var that = this
  26587. var offsetMethod = 'offset'
  26588. var offsetBase = 0
  26589. this.offsets = []
  26590. this.targets = []
  26591. this.scrollHeight = this.getScrollHeight()
  26592. if (!$.isWindow(this.$scrollElement[0])) {
  26593. offsetMethod = 'position'
  26594. offsetBase = this.$scrollElement.scrollTop()
  26595. }
  26596. this.$body
  26597. .find(this.selector)
  26598. .map(function () {
  26599. var $el = $(this)
  26600. var href = $el.data('target') || $el.attr('href')
  26601. var $href = /^#./.test(href) && $(href)
  26602. return ($href
  26603. && $href.length
  26604. && $href.is(':visible')
  26605. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  26606. })
  26607. .sort(function (a, b) { return a[0] - b[0] })
  26608. .each(function () {
  26609. that.offsets.push(this[0])
  26610. that.targets.push(this[1])
  26611. })
  26612. }
  26613. ScrollSpy.prototype.process = function () {
  26614. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  26615. var scrollHeight = this.getScrollHeight()
  26616. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  26617. var offsets = this.offsets
  26618. var targets = this.targets
  26619. var activeTarget = this.activeTarget
  26620. var i
  26621. if (this.scrollHeight != scrollHeight) {
  26622. this.refresh()
  26623. }
  26624. if (scrollTop >= maxScroll) {
  26625. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  26626. }
  26627. if (activeTarget && scrollTop < offsets[0]) {
  26628. this.activeTarget = null
  26629. return this.clear()
  26630. }
  26631. for (i = offsets.length; i--;) {
  26632. activeTarget != targets[i]
  26633. && scrollTop >= offsets[i]
  26634. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  26635. && this.activate(targets[i])
  26636. }
  26637. }
  26638. ScrollSpy.prototype.activate = function (target) {
  26639. this.activeTarget = target
  26640. this.clear()
  26641. var selector = this.selector +
  26642. '[data-target="' + target + '"],' +
  26643. this.selector + '[href="' + target + '"]'
  26644. var active = $(selector)
  26645. .parents('li')
  26646. .addClass('active')
  26647. if (active.parent('.dropdown-menu').length) {
  26648. active = active
  26649. .closest('li.dropdown')
  26650. .addClass('active')
  26651. }
  26652. active.trigger('activate.bs.scrollspy')
  26653. }
  26654. ScrollSpy.prototype.clear = function () {
  26655. $(this.selector)
  26656. .parentsUntil(this.options.target, '.active')
  26657. .removeClass('active')
  26658. }
  26659. // SCROLLSPY PLUGIN DEFINITION
  26660. // ===========================
  26661. function Plugin(option) {
  26662. return this.each(function () {
  26663. var $this = $(this)
  26664. var data = $this.data('bs.scrollspy')
  26665. var options = typeof option == 'object' && option
  26666. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  26667. if (typeof option == 'string') data[option]()
  26668. })
  26669. }
  26670. var old = $.fn.scrollspy
  26671. $.fn.scrollspy = Plugin
  26672. $.fn.scrollspy.Constructor = ScrollSpy
  26673. // SCROLLSPY NO CONFLICT
  26674. // =====================
  26675. $.fn.scrollspy.noConflict = function () {
  26676. $.fn.scrollspy = old
  26677. return this
  26678. }
  26679. // SCROLLSPY DATA-API
  26680. // ==================
  26681. $(window).on('load.bs.scrollspy.data-api', function () {
  26682. $('[data-spy="scroll"]').each(function () {
  26683. var $spy = $(this)
  26684. Plugin.call($spy, $spy.data())
  26685. })
  26686. })
  26687. }(jQuery);
  26688. /* ========================================================================
  26689. * Bootstrap: tab.js v3.3.7
  26690. * http://getbootstrap.com/javascript/#tabs
  26691. * ========================================================================
  26692. * Copyright 2011-2016 Twitter, Inc.
  26693. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26694. * ======================================================================== */
  26695. +function ($) {
  26696. 'use strict';
  26697. // TAB CLASS DEFINITION
  26698. // ====================
  26699. var Tab = function (element) {
  26700. // jscs:disable requireDollarBeforejQueryAssignment
  26701. this.element = $(element)
  26702. // jscs:enable requireDollarBeforejQueryAssignment
  26703. }
  26704. Tab.VERSION = '3.3.7'
  26705. Tab.TRANSITION_DURATION = 150
  26706. Tab.prototype.show = function () {
  26707. var $this = this.element
  26708. var $ul = $this.closest('ul:not(.dropdown-menu)')
  26709. var selector = $this.data('target')
  26710. if (!selector) {
  26711. selector = $this.attr('href')
  26712. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  26713. }
  26714. if ($this.parent('li').hasClass('active')) return
  26715. var $previous = $ul.find('.active:last a')
  26716. var hideEvent = $.Event('hide.bs.tab', {
  26717. relatedTarget: $this[0]
  26718. })
  26719. var showEvent = $.Event('show.bs.tab', {
  26720. relatedTarget: $previous[0]
  26721. })
  26722. $previous.trigger(hideEvent)
  26723. $this.trigger(showEvent)
  26724. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  26725. var $target = $(selector)
  26726. this.activate($this.closest('li'), $ul)
  26727. this.activate($target, $target.parent(), function () {
  26728. $previous.trigger({
  26729. type: 'hidden.bs.tab',
  26730. relatedTarget: $this[0]
  26731. })
  26732. $this.trigger({
  26733. type: 'shown.bs.tab',
  26734. relatedTarget: $previous[0]
  26735. })
  26736. })
  26737. }
  26738. Tab.prototype.activate = function (element, container, callback) {
  26739. var $active = container.find('> .active')
  26740. var transition = callback
  26741. && $.support.transition
  26742. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  26743. function next() {
  26744. $active
  26745. .removeClass('active')
  26746. .find('> .dropdown-menu > .active')
  26747. .removeClass('active')
  26748. .end()
  26749. .find('[data-toggle="tab"]')
  26750. .attr('aria-expanded', false)
  26751. element
  26752. .addClass('active')
  26753. .find('[data-toggle="tab"]')
  26754. .attr('aria-expanded', true)
  26755. if (transition) {
  26756. element[0].offsetWidth // reflow for transition
  26757. element.addClass('in')
  26758. } else {
  26759. element.removeClass('fade')
  26760. }
  26761. if (element.parent('.dropdown-menu').length) {
  26762. element
  26763. .closest('li.dropdown')
  26764. .addClass('active')
  26765. .end()
  26766. .find('[data-toggle="tab"]')
  26767. .attr('aria-expanded', true)
  26768. }
  26769. callback && callback()
  26770. }
  26771. $active.length && transition ?
  26772. $active
  26773. .one('bsTransitionEnd', next)
  26774. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  26775. next()
  26776. $active.removeClass('in')
  26777. }
  26778. // TAB PLUGIN DEFINITION
  26779. // =====================
  26780. function Plugin(option) {
  26781. return this.each(function () {
  26782. var $this = $(this)
  26783. var data = $this.data('bs.tab')
  26784. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  26785. if (typeof option == 'string') data[option]()
  26786. })
  26787. }
  26788. var old = $.fn.tab
  26789. $.fn.tab = Plugin
  26790. $.fn.tab.Constructor = Tab
  26791. // TAB NO CONFLICT
  26792. // ===============
  26793. $.fn.tab.noConflict = function () {
  26794. $.fn.tab = old
  26795. return this
  26796. }
  26797. // TAB DATA-API
  26798. // ============
  26799. var clickHandler = function (e) {
  26800. e.preventDefault()
  26801. Plugin.call($(this), 'show')
  26802. }
  26803. $(document)
  26804. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  26805. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  26806. }(jQuery);
  26807. /* ========================================================================
  26808. * Bootstrap: affix.js v3.3.7
  26809. * http://getbootstrap.com/javascript/#affix
  26810. * ========================================================================
  26811. * Copyright 2011-2016 Twitter, Inc.
  26812. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26813. * ======================================================================== */
  26814. +function ($) {
  26815. 'use strict';
  26816. // AFFIX CLASS DEFINITION
  26817. // ======================
  26818. var Affix = function (element, options) {
  26819. this.options = $.extend({}, Affix.DEFAULTS, options)
  26820. this.$target = $(this.options.target)
  26821. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  26822. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  26823. this.$element = $(element)
  26824. this.affixed = null
  26825. this.unpin = null
  26826. this.pinnedOffset = null
  26827. this.checkPosition()
  26828. }
  26829. Affix.VERSION = '3.3.7'
  26830. Affix.RESET = 'affix affix-top affix-bottom'
  26831. Affix.DEFAULTS = {
  26832. offset: 0,
  26833. target: window
  26834. }
  26835. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  26836. var scrollTop = this.$target.scrollTop()
  26837. var position = this.$element.offset()
  26838. var targetHeight = this.$target.height()
  26839. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  26840. if (this.affixed == 'bottom') {
  26841. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  26842. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  26843. }
  26844. var initializing = this.affixed == null
  26845. var colliderTop = initializing ? scrollTop : position.top
  26846. var colliderHeight = initializing ? targetHeight : height
  26847. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  26848. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  26849. return false
  26850. }
  26851. Affix.prototype.getPinnedOffset = function () {
  26852. if (this.pinnedOffset) return this.pinnedOffset
  26853. this.$element.removeClass(Affix.RESET).addClass('affix')
  26854. var scrollTop = this.$target.scrollTop()
  26855. var position = this.$element.offset()
  26856. return (this.pinnedOffset = position.top - scrollTop)
  26857. }
  26858. Affix.prototype.checkPositionWithEventLoop = function () {
  26859. setTimeout($.proxy(this.checkPosition, this), 1)
  26860. }
  26861. Affix.prototype.checkPosition = function () {
  26862. if (!this.$element.is(':visible')) return
  26863. var height = this.$element.height()
  26864. var offset = this.options.offset
  26865. var offsetTop = offset.top
  26866. var offsetBottom = offset.bottom
  26867. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  26868. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  26869. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  26870. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  26871. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  26872. if (this.affixed != affix) {
  26873. if (this.unpin != null) this.$element.css('top', '')
  26874. var affixType = 'affix' + (affix ? '-' + affix : '')
  26875. var e = $.Event(affixType + '.bs.affix')
  26876. this.$element.trigger(e)
  26877. if (e.isDefaultPrevented()) return
  26878. this.affixed = affix
  26879. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  26880. this.$element
  26881. .removeClass(Affix.RESET)
  26882. .addClass(affixType)
  26883. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  26884. }
  26885. if (affix == 'bottom') {
  26886. this.$element.offset({
  26887. top: scrollHeight - height - offsetBottom
  26888. })
  26889. }
  26890. }
  26891. // AFFIX PLUGIN DEFINITION
  26892. // =======================
  26893. function Plugin(option) {
  26894. return this.each(function () {
  26895. var $this = $(this)
  26896. var data = $this.data('bs.affix')
  26897. var options = typeof option == 'object' && option
  26898. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  26899. if (typeof option == 'string') data[option]()
  26900. })
  26901. }
  26902. var old = $.fn.affix
  26903. $.fn.affix = Plugin
  26904. $.fn.affix.Constructor = Affix
  26905. // AFFIX NO CONFLICT
  26906. // =================
  26907. $.fn.affix.noConflict = function () {
  26908. $.fn.affix = old
  26909. return this
  26910. }
  26911. // AFFIX DATA-API
  26912. // ==============
  26913. $(window).on('load', function () {
  26914. $('[data-spy="affix"]').each(function () {
  26915. var $spy = $(this)
  26916. var data = $spy.data()
  26917. data.offset = data.offset || {}
  26918. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  26919. if (data.offsetTop != null) data.offset.top = data.offsetTop
  26920. Plugin.call($spy, data)
  26921. })
  26922. })
  26923. }(jQuery);
  26924. /***/ }),
  26925. /* 15 */
  26926. /***/ (function(module, exports, __webpack_require__) {
  26927. module.exports = __webpack_require__(16);
  26928. /***/ }),
  26929. /* 16 */
  26930. /***/ (function(module, exports, __webpack_require__) {
  26931. "use strict";
  26932. var utils = __webpack_require__(0);
  26933. var bind = __webpack_require__(3);
  26934. var Axios = __webpack_require__(18);
  26935. var defaults = __webpack_require__(1);
  26936. /**
  26937. * Create an instance of Axios
  26938. *
  26939. * @param {Object} defaultConfig The default config for the instance
  26940. * @return {Axios} A new instance of Axios
  26941. */
  26942. function createInstance(defaultConfig) {
  26943. var context = new Axios(defaultConfig);
  26944. var instance = bind(Axios.prototype.request, context);
  26945. // Copy axios.prototype to instance
  26946. utils.extend(instance, Axios.prototype, context);
  26947. // Copy context to instance
  26948. utils.extend(instance, context);
  26949. return instance;
  26950. }
  26951. // Create the default instance to be exported
  26952. var axios = createInstance(defaults);
  26953. // Expose Axios class to allow class inheritance
  26954. axios.Axios = Axios;
  26955. // Factory for creating new instances
  26956. axios.create = function create(instanceConfig) {
  26957. return createInstance(utils.merge(defaults, instanceConfig));
  26958. };
  26959. // Expose Cancel & CancelToken
  26960. axios.Cancel = __webpack_require__(7);
  26961. axios.CancelToken = __webpack_require__(33);
  26962. axios.isCancel = __webpack_require__(6);
  26963. // Expose all/spread
  26964. axios.all = function all(promises) {
  26965. return Promise.all(promises);
  26966. };
  26967. axios.spread = __webpack_require__(34);
  26968. module.exports = axios;
  26969. // Allow use of default import syntax in TypeScript
  26970. module.exports.default = axios;
  26971. /***/ }),
  26972. /* 17 */
  26973. /***/ (function(module, exports) {
  26974. /*!
  26975. * Determine if an object is a Buffer
  26976. *
  26977. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  26978. * @license MIT
  26979. */
  26980. // The _isBuffer check is for Safari 5-7 support, because it's missing
  26981. // Object.prototype.constructor. Remove this eventually
  26982. module.exports = function (obj) {
  26983. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  26984. }
  26985. function isBuffer (obj) {
  26986. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  26987. }
  26988. // For Node v0.10 support. Remove this eventually.
  26989. function isSlowBuffer (obj) {
  26990. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  26991. }
  26992. /***/ }),
  26993. /* 18 */
  26994. /***/ (function(module, exports, __webpack_require__) {
  26995. "use strict";
  26996. var defaults = __webpack_require__(1);
  26997. var utils = __webpack_require__(0);
  26998. var InterceptorManager = __webpack_require__(28);
  26999. var dispatchRequest = __webpack_require__(29);
  27000. var isAbsoluteURL = __webpack_require__(31);
  27001. var combineURLs = __webpack_require__(32);
  27002. /**
  27003. * Create a new instance of Axios
  27004. *
  27005. * @param {Object} instanceConfig The default config for the instance
  27006. */
  27007. function Axios(instanceConfig) {
  27008. this.defaults = instanceConfig;
  27009. this.interceptors = {
  27010. request: new InterceptorManager(),
  27011. response: new InterceptorManager()
  27012. };
  27013. }
  27014. /**
  27015. * Dispatch a request
  27016. *
  27017. * @param {Object} config The config specific for this request (merged with this.defaults)
  27018. */
  27019. Axios.prototype.request = function request(config) {
  27020. /*eslint no-param-reassign:0*/
  27021. // Allow for axios('example/url'[, config]) a la fetch API
  27022. if (typeof config === 'string') {
  27023. config = utils.merge({
  27024. url: arguments[0]
  27025. }, arguments[1]);
  27026. }
  27027. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  27028. config.method = config.method.toLowerCase();
  27029. // Support baseURL config
  27030. if (config.baseURL && !isAbsoluteURL(config.url)) {
  27031. config.url = combineURLs(config.baseURL, config.url);
  27032. }
  27033. // Hook up interceptors middleware
  27034. var chain = [dispatchRequest, undefined];
  27035. var promise = Promise.resolve(config);
  27036. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  27037. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  27038. });
  27039. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  27040. chain.push(interceptor.fulfilled, interceptor.rejected);
  27041. });
  27042. while (chain.length) {
  27043. promise = promise.then(chain.shift(), chain.shift());
  27044. }
  27045. return promise;
  27046. };
  27047. // Provide aliases for supported request methods
  27048. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  27049. /*eslint func-names:0*/
  27050. Axios.prototype[method] = function(url, config) {
  27051. return this.request(utils.merge(config || {}, {
  27052. method: method,
  27053. url: url
  27054. }));
  27055. };
  27056. });
  27057. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  27058. /*eslint func-names:0*/
  27059. Axios.prototype[method] = function(url, data, config) {
  27060. return this.request(utils.merge(config || {}, {
  27061. method: method,
  27062. url: url,
  27063. data: data
  27064. }));
  27065. };
  27066. });
  27067. module.exports = Axios;
  27068. /***/ }),
  27069. /* 19 */
  27070. /***/ (function(module, exports) {
  27071. // shim for using process in browser
  27072. var process = module.exports = {};
  27073. // cached from whatever global is present so that test runners that stub it
  27074. // don't break things. But we need to wrap it in a try catch in case it is
  27075. // wrapped in strict mode code which doesn't define any globals. It's inside a
  27076. // function because try/catches deoptimize in certain engines.
  27077. var cachedSetTimeout;
  27078. var cachedClearTimeout;
  27079. function defaultSetTimout() {
  27080. throw new Error('setTimeout has not been defined');
  27081. }
  27082. function defaultClearTimeout () {
  27083. throw new Error('clearTimeout has not been defined');
  27084. }
  27085. (function () {
  27086. try {
  27087. if (typeof setTimeout === 'function') {
  27088. cachedSetTimeout = setTimeout;
  27089. } else {
  27090. cachedSetTimeout = defaultSetTimout;
  27091. }
  27092. } catch (e) {
  27093. cachedSetTimeout = defaultSetTimout;
  27094. }
  27095. try {
  27096. if (typeof clearTimeout === 'function') {
  27097. cachedClearTimeout = clearTimeout;
  27098. } else {
  27099. cachedClearTimeout = defaultClearTimeout;
  27100. }
  27101. } catch (e) {
  27102. cachedClearTimeout = defaultClearTimeout;
  27103. }
  27104. } ())
  27105. function runTimeout(fun) {
  27106. if (cachedSetTimeout === setTimeout) {
  27107. //normal enviroments in sane situations
  27108. return setTimeout(fun, 0);
  27109. }
  27110. // if setTimeout wasn't available but was latter defined
  27111. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  27112. cachedSetTimeout = setTimeout;
  27113. return setTimeout(fun, 0);
  27114. }
  27115. try {
  27116. // when when somebody has screwed with setTimeout but no I.E. maddness
  27117. return cachedSetTimeout(fun, 0);
  27118. } catch(e){
  27119. try {
  27120. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  27121. return cachedSetTimeout.call(null, fun, 0);
  27122. } catch(e){
  27123. // 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
  27124. return cachedSetTimeout.call(this, fun, 0);
  27125. }
  27126. }
  27127. }
  27128. function runClearTimeout(marker) {
  27129. if (cachedClearTimeout === clearTimeout) {
  27130. //normal enviroments in sane situations
  27131. return clearTimeout(marker);
  27132. }
  27133. // if clearTimeout wasn't available but was latter defined
  27134. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  27135. cachedClearTimeout = clearTimeout;
  27136. return clearTimeout(marker);
  27137. }
  27138. try {
  27139. // when when somebody has screwed with setTimeout but no I.E. maddness
  27140. return cachedClearTimeout(marker);
  27141. } catch (e){
  27142. try {
  27143. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  27144. return cachedClearTimeout.call(null, marker);
  27145. } catch (e){
  27146. // 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.
  27147. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  27148. return cachedClearTimeout.call(this, marker);
  27149. }
  27150. }
  27151. }
  27152. var queue = [];
  27153. var draining = false;
  27154. var currentQueue;
  27155. var queueIndex = -1;
  27156. function cleanUpNextTick() {
  27157. if (!draining || !currentQueue) {
  27158. return;
  27159. }
  27160. draining = false;
  27161. if (currentQueue.length) {
  27162. queue = currentQueue.concat(queue);
  27163. } else {
  27164. queueIndex = -1;
  27165. }
  27166. if (queue.length) {
  27167. drainQueue();
  27168. }
  27169. }
  27170. function drainQueue() {
  27171. if (draining) {
  27172. return;
  27173. }
  27174. var timeout = runTimeout(cleanUpNextTick);
  27175. draining = true;
  27176. var len = queue.length;
  27177. while(len) {
  27178. currentQueue = queue;
  27179. queue = [];
  27180. while (++queueIndex < len) {
  27181. if (currentQueue) {
  27182. currentQueue[queueIndex].run();
  27183. }
  27184. }
  27185. queueIndex = -1;
  27186. len = queue.length;
  27187. }
  27188. currentQueue = null;
  27189. draining = false;
  27190. runClearTimeout(timeout);
  27191. }
  27192. process.nextTick = function (fun) {
  27193. var args = new Array(arguments.length - 1);
  27194. if (arguments.length > 1) {
  27195. for (var i = 1; i < arguments.length; i++) {
  27196. args[i - 1] = arguments[i];
  27197. }
  27198. }
  27199. queue.push(new Item(fun, args));
  27200. if (queue.length === 1 && !draining) {
  27201. runTimeout(drainQueue);
  27202. }
  27203. };
  27204. // v8 likes predictible objects
  27205. function Item(fun, array) {
  27206. this.fun = fun;
  27207. this.array = array;
  27208. }
  27209. Item.prototype.run = function () {
  27210. this.fun.apply(null, this.array);
  27211. };
  27212. process.title = 'browser';
  27213. process.browser = true;
  27214. process.env = {};
  27215. process.argv = [];
  27216. process.version = ''; // empty string to avoid regexp issues
  27217. process.versions = {};
  27218. function noop() {}
  27219. process.on = noop;
  27220. process.addListener = noop;
  27221. process.once = noop;
  27222. process.off = noop;
  27223. process.removeListener = noop;
  27224. process.removeAllListeners = noop;
  27225. process.emit = noop;
  27226. process.prependListener = noop;
  27227. process.prependOnceListener = noop;
  27228. process.listeners = function (name) { return [] }
  27229. process.binding = function (name) {
  27230. throw new Error('process.binding is not supported');
  27231. };
  27232. process.cwd = function () { return '/' };
  27233. process.chdir = function (dir) {
  27234. throw new Error('process.chdir is not supported');
  27235. };
  27236. process.umask = function() { return 0; };
  27237. /***/ }),
  27238. /* 20 */
  27239. /***/ (function(module, exports, __webpack_require__) {
  27240. "use strict";
  27241. var utils = __webpack_require__(0);
  27242. module.exports = function normalizeHeaderName(headers, normalizedName) {
  27243. utils.forEach(headers, function processHeader(value, name) {
  27244. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  27245. headers[normalizedName] = value;
  27246. delete headers[name];
  27247. }
  27248. });
  27249. };
  27250. /***/ }),
  27251. /* 21 */
  27252. /***/ (function(module, exports, __webpack_require__) {
  27253. "use strict";
  27254. var createError = __webpack_require__(5);
  27255. /**
  27256. * Resolve or reject a Promise based on response status.
  27257. *
  27258. * @param {Function} resolve A function that resolves the promise.
  27259. * @param {Function} reject A function that rejects the promise.
  27260. * @param {object} response The response.
  27261. */
  27262. module.exports = function settle(resolve, reject, response) {
  27263. var validateStatus = response.config.validateStatus;
  27264. // Note: status is not exposed by XDomainRequest
  27265. if (!response.status || !validateStatus || validateStatus(response.status)) {
  27266. resolve(response);
  27267. } else {
  27268. reject(createError(
  27269. 'Request failed with status code ' + response.status,
  27270. response.config,
  27271. null,
  27272. response.request,
  27273. response
  27274. ));
  27275. }
  27276. };
  27277. /***/ }),
  27278. /* 22 */
  27279. /***/ (function(module, exports, __webpack_require__) {
  27280. "use strict";
  27281. /**
  27282. * Update an Error with the specified config, error code, and response.
  27283. *
  27284. * @param {Error} error The error to update.
  27285. * @param {Object} config The config.
  27286. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  27287. * @param {Object} [request] The request.
  27288. * @param {Object} [response] The response.
  27289. * @returns {Error} The error.
  27290. */
  27291. module.exports = function enhanceError(error, config, code, request, response) {
  27292. error.config = config;
  27293. if (code) {
  27294. error.code = code;
  27295. }
  27296. error.request = request;
  27297. error.response = response;
  27298. return error;
  27299. };
  27300. /***/ }),
  27301. /* 23 */
  27302. /***/ (function(module, exports, __webpack_require__) {
  27303. "use strict";
  27304. var utils = __webpack_require__(0);
  27305. function encode(val) {
  27306. return encodeURIComponent(val).
  27307. replace(/%40/gi, '@').
  27308. replace(/%3A/gi, ':').
  27309. replace(/%24/g, '$').
  27310. replace(/%2C/gi, ',').
  27311. replace(/%20/g, '+').
  27312. replace(/%5B/gi, '[').
  27313. replace(/%5D/gi, ']');
  27314. }
  27315. /**
  27316. * Build a URL by appending params to the end
  27317. *
  27318. * @param {string} url The base of the url (e.g., http://www.google.com)
  27319. * @param {object} [params] The params to be appended
  27320. * @returns {string} The formatted url
  27321. */
  27322. module.exports = function buildURL(url, params, paramsSerializer) {
  27323. /*eslint no-param-reassign:0*/
  27324. if (!params) {
  27325. return url;
  27326. }
  27327. var serializedParams;
  27328. if (paramsSerializer) {
  27329. serializedParams = paramsSerializer(params);
  27330. } else if (utils.isURLSearchParams(params)) {
  27331. serializedParams = params.toString();
  27332. } else {
  27333. var parts = [];
  27334. utils.forEach(params, function serialize(val, key) {
  27335. if (val === null || typeof val === 'undefined') {
  27336. return;
  27337. }
  27338. if (utils.isArray(val)) {
  27339. key = key + '[]';
  27340. }
  27341. if (!utils.isArray(val)) {
  27342. val = [val];
  27343. }
  27344. utils.forEach(val, function parseValue(v) {
  27345. if (utils.isDate(v)) {
  27346. v = v.toISOString();
  27347. } else if (utils.isObject(v)) {
  27348. v = JSON.stringify(v);
  27349. }
  27350. parts.push(encode(key) + '=' + encode(v));
  27351. });
  27352. });
  27353. serializedParams = parts.join('&');
  27354. }
  27355. if (serializedParams) {
  27356. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  27357. }
  27358. return url;
  27359. };
  27360. /***/ }),
  27361. /* 24 */
  27362. /***/ (function(module, exports, __webpack_require__) {
  27363. "use strict";
  27364. var utils = __webpack_require__(0);
  27365. /**
  27366. * Parse headers into an object
  27367. *
  27368. * ```
  27369. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  27370. * Content-Type: application/json
  27371. * Connection: keep-alive
  27372. * Transfer-Encoding: chunked
  27373. * ```
  27374. *
  27375. * @param {String} headers Headers needing to be parsed
  27376. * @returns {Object} Headers parsed into an object
  27377. */
  27378. module.exports = function parseHeaders(headers) {
  27379. var parsed = {};
  27380. var key;
  27381. var val;
  27382. var i;
  27383. if (!headers) { return parsed; }
  27384. utils.forEach(headers.split('\n'), function parser(line) {
  27385. i = line.indexOf(':');
  27386. key = utils.trim(line.substr(0, i)).toLowerCase();
  27387. val = utils.trim(line.substr(i + 1));
  27388. if (key) {
  27389. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  27390. }
  27391. });
  27392. return parsed;
  27393. };
  27394. /***/ }),
  27395. /* 25 */
  27396. /***/ (function(module, exports, __webpack_require__) {
  27397. "use strict";
  27398. var utils = __webpack_require__(0);
  27399. module.exports = (
  27400. utils.isStandardBrowserEnv() ?
  27401. // Standard browser envs have full support of the APIs needed to test
  27402. // whether the request URL is of the same origin as current location.
  27403. (function standardBrowserEnv() {
  27404. var msie = /(msie|trident)/i.test(navigator.userAgent);
  27405. var urlParsingNode = document.createElement('a');
  27406. var originURL;
  27407. /**
  27408. * Parse a URL to discover it's components
  27409. *
  27410. * @param {String} url The URL to be parsed
  27411. * @returns {Object}
  27412. */
  27413. function resolveURL(url) {
  27414. var href = url;
  27415. if (msie) {
  27416. // IE needs attribute set twice to normalize properties
  27417. urlParsingNode.setAttribute('href', href);
  27418. href = urlParsingNode.href;
  27419. }
  27420. urlParsingNode.setAttribute('href', href);
  27421. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  27422. return {
  27423. href: urlParsingNode.href,
  27424. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  27425. host: urlParsingNode.host,
  27426. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  27427. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  27428. hostname: urlParsingNode.hostname,
  27429. port: urlParsingNode.port,
  27430. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  27431. urlParsingNode.pathname :
  27432. '/' + urlParsingNode.pathname
  27433. };
  27434. }
  27435. originURL = resolveURL(window.location.href);
  27436. /**
  27437. * Determine if a URL shares the same origin as the current location
  27438. *
  27439. * @param {String} requestURL The URL to test
  27440. * @returns {boolean} True if URL shares the same origin, otherwise false
  27441. */
  27442. return function isURLSameOrigin(requestURL) {
  27443. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  27444. return (parsed.protocol === originURL.protocol &&
  27445. parsed.host === originURL.host);
  27446. };
  27447. })() :
  27448. // Non standard browser envs (web workers, react-native) lack needed support.
  27449. (function nonStandardBrowserEnv() {
  27450. return function isURLSameOrigin() {
  27451. return true;
  27452. };
  27453. })()
  27454. );
  27455. /***/ }),
  27456. /* 26 */
  27457. /***/ (function(module, exports, __webpack_require__) {
  27458. "use strict";
  27459. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  27460. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  27461. function E() {
  27462. this.message = 'String contains an invalid character';
  27463. }
  27464. E.prototype = new Error;
  27465. E.prototype.code = 5;
  27466. E.prototype.name = 'InvalidCharacterError';
  27467. function btoa(input) {
  27468. var str = String(input);
  27469. var output = '';
  27470. for (
  27471. // initialize result and counter
  27472. var block, charCode, idx = 0, map = chars;
  27473. // if the next str index does not exist:
  27474. // change the mapping table to "="
  27475. // check if d has no fractional digits
  27476. str.charAt(idx | 0) || (map = '=', idx % 1);
  27477. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  27478. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  27479. ) {
  27480. charCode = str.charCodeAt(idx += 3 / 4);
  27481. if (charCode > 0xFF) {
  27482. throw new E();
  27483. }
  27484. block = block << 8 | charCode;
  27485. }
  27486. return output;
  27487. }
  27488. module.exports = btoa;
  27489. /***/ }),
  27490. /* 27 */
  27491. /***/ (function(module, exports, __webpack_require__) {
  27492. "use strict";
  27493. var utils = __webpack_require__(0);
  27494. module.exports = (
  27495. utils.isStandardBrowserEnv() ?
  27496. // Standard browser envs support document.cookie
  27497. (function standardBrowserEnv() {
  27498. return {
  27499. write: function write(name, value, expires, path, domain, secure) {
  27500. var cookie = [];
  27501. cookie.push(name + '=' + encodeURIComponent(value));
  27502. if (utils.isNumber(expires)) {
  27503. cookie.push('expires=' + new Date(expires).toGMTString());
  27504. }
  27505. if (utils.isString(path)) {
  27506. cookie.push('path=' + path);
  27507. }
  27508. if (utils.isString(domain)) {
  27509. cookie.push('domain=' + domain);
  27510. }
  27511. if (secure === true) {
  27512. cookie.push('secure');
  27513. }
  27514. document.cookie = cookie.join('; ');
  27515. },
  27516. read: function read(name) {
  27517. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  27518. return (match ? decodeURIComponent(match[3]) : null);
  27519. },
  27520. remove: function remove(name) {
  27521. this.write(name, '', Date.now() - 86400000);
  27522. }
  27523. };
  27524. })() :
  27525. // Non standard browser env (web workers, react-native) lack needed support.
  27526. (function nonStandardBrowserEnv() {
  27527. return {
  27528. write: function write() {},
  27529. read: function read() { return null; },
  27530. remove: function remove() {}
  27531. };
  27532. })()
  27533. );
  27534. /***/ }),
  27535. /* 28 */
  27536. /***/ (function(module, exports, __webpack_require__) {
  27537. "use strict";
  27538. var utils = __webpack_require__(0);
  27539. function InterceptorManager() {
  27540. this.handlers = [];
  27541. }
  27542. /**
  27543. * Add a new interceptor to the stack
  27544. *
  27545. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  27546. * @param {Function} rejected The function to handle `reject` for a `Promise`
  27547. *
  27548. * @return {Number} An ID used to remove interceptor later
  27549. */
  27550. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  27551. this.handlers.push({
  27552. fulfilled: fulfilled,
  27553. rejected: rejected
  27554. });
  27555. return this.handlers.length - 1;
  27556. };
  27557. /**
  27558. * Remove an interceptor from the stack
  27559. *
  27560. * @param {Number} id The ID that was returned by `use`
  27561. */
  27562. InterceptorManager.prototype.eject = function eject(id) {
  27563. if (this.handlers[id]) {
  27564. this.handlers[id] = null;
  27565. }
  27566. };
  27567. /**
  27568. * Iterate over all the registered interceptors
  27569. *
  27570. * This method is particularly useful for skipping over any
  27571. * interceptors that may have become `null` calling `eject`.
  27572. *
  27573. * @param {Function} fn The function to call for each interceptor
  27574. */
  27575. InterceptorManager.prototype.forEach = function forEach(fn) {
  27576. utils.forEach(this.handlers, function forEachHandler(h) {
  27577. if (h !== null) {
  27578. fn(h);
  27579. }
  27580. });
  27581. };
  27582. module.exports = InterceptorManager;
  27583. /***/ }),
  27584. /* 29 */
  27585. /***/ (function(module, exports, __webpack_require__) {
  27586. "use strict";
  27587. var utils = __webpack_require__(0);
  27588. var transformData = __webpack_require__(30);
  27589. var isCancel = __webpack_require__(6);
  27590. var defaults = __webpack_require__(1);
  27591. /**
  27592. * Throws a `Cancel` if cancellation has been requested.
  27593. */
  27594. function throwIfCancellationRequested(config) {
  27595. if (config.cancelToken) {
  27596. config.cancelToken.throwIfRequested();
  27597. }
  27598. }
  27599. /**
  27600. * Dispatch a request to the server using the configured adapter.
  27601. *
  27602. * @param {object} config The config that is to be used for the request
  27603. * @returns {Promise} The Promise to be fulfilled
  27604. */
  27605. module.exports = function dispatchRequest(config) {
  27606. throwIfCancellationRequested(config);
  27607. // Ensure headers exist
  27608. config.headers = config.headers || {};
  27609. // Transform request data
  27610. config.data = transformData(
  27611. config.data,
  27612. config.headers,
  27613. config.transformRequest
  27614. );
  27615. // Flatten headers
  27616. config.headers = utils.merge(
  27617. config.headers.common || {},
  27618. config.headers[config.method] || {},
  27619. config.headers || {}
  27620. );
  27621. utils.forEach(
  27622. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  27623. function cleanHeaderConfig(method) {
  27624. delete config.headers[method];
  27625. }
  27626. );
  27627. var adapter = config.adapter || defaults.adapter;
  27628. return adapter(config).then(function onAdapterResolution(response) {
  27629. throwIfCancellationRequested(config);
  27630. // Transform response data
  27631. response.data = transformData(
  27632. response.data,
  27633. response.headers,
  27634. config.transformResponse
  27635. );
  27636. return response;
  27637. }, function onAdapterRejection(reason) {
  27638. if (!isCancel(reason)) {
  27639. throwIfCancellationRequested(config);
  27640. // Transform response data
  27641. if (reason && reason.response) {
  27642. reason.response.data = transformData(
  27643. reason.response.data,
  27644. reason.response.headers,
  27645. config.transformResponse
  27646. );
  27647. }
  27648. }
  27649. return Promise.reject(reason);
  27650. });
  27651. };
  27652. /***/ }),
  27653. /* 30 */
  27654. /***/ (function(module, exports, __webpack_require__) {
  27655. "use strict";
  27656. var utils = __webpack_require__(0);
  27657. /**
  27658. * Transform the data for a request or a response
  27659. *
  27660. * @param {Object|String} data The data to be transformed
  27661. * @param {Array} headers The headers for the request or response
  27662. * @param {Array|Function} fns A single function or Array of functions
  27663. * @returns {*} The resulting transformed data
  27664. */
  27665. module.exports = function transformData(data, headers, fns) {
  27666. /*eslint no-param-reassign:0*/
  27667. utils.forEach(fns, function transform(fn) {
  27668. data = fn(data, headers);
  27669. });
  27670. return data;
  27671. };
  27672. /***/ }),
  27673. /* 31 */
  27674. /***/ (function(module, exports, __webpack_require__) {
  27675. "use strict";
  27676. /**
  27677. * Determines whether the specified URL is absolute
  27678. *
  27679. * @param {string} url The URL to test
  27680. * @returns {boolean} True if the specified URL is absolute, otherwise false
  27681. */
  27682. module.exports = function isAbsoluteURL(url) {
  27683. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  27684. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  27685. // by any combination of letters, digits, plus, period, or hyphen.
  27686. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  27687. };
  27688. /***/ }),
  27689. /* 32 */
  27690. /***/ (function(module, exports, __webpack_require__) {
  27691. "use strict";
  27692. /**
  27693. * Creates a new URL by combining the specified URLs
  27694. *
  27695. * @param {string} baseURL The base URL
  27696. * @param {string} relativeURL The relative URL
  27697. * @returns {string} The combined URL
  27698. */
  27699. module.exports = function combineURLs(baseURL, relativeURL) {
  27700. return relativeURL
  27701. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  27702. : baseURL;
  27703. };
  27704. /***/ }),
  27705. /* 33 */
  27706. /***/ (function(module, exports, __webpack_require__) {
  27707. "use strict";
  27708. var Cancel = __webpack_require__(7);
  27709. /**
  27710. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  27711. *
  27712. * @class
  27713. * @param {Function} executor The executor function.
  27714. */
  27715. function CancelToken(executor) {
  27716. if (typeof executor !== 'function') {
  27717. throw new TypeError('executor must be a function.');
  27718. }
  27719. var resolvePromise;
  27720. this.promise = new Promise(function promiseExecutor(resolve) {
  27721. resolvePromise = resolve;
  27722. });
  27723. var token = this;
  27724. executor(function cancel(message) {
  27725. if (token.reason) {
  27726. // Cancellation has already been requested
  27727. return;
  27728. }
  27729. token.reason = new Cancel(message);
  27730. resolvePromise(token.reason);
  27731. });
  27732. }
  27733. /**
  27734. * Throws a `Cancel` if cancellation has been requested.
  27735. */
  27736. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  27737. if (this.reason) {
  27738. throw this.reason;
  27739. }
  27740. };
  27741. /**
  27742. * Returns an object that contains a new `CancelToken` and a function that, when called,
  27743. * cancels the `CancelToken`.
  27744. */
  27745. CancelToken.source = function source() {
  27746. var cancel;
  27747. var token = new CancelToken(function executor(c) {
  27748. cancel = c;
  27749. });
  27750. return {
  27751. token: token,
  27752. cancel: cancel
  27753. };
  27754. };
  27755. module.exports = CancelToken;
  27756. /***/ }),
  27757. /* 34 */
  27758. /***/ (function(module, exports, __webpack_require__) {
  27759. "use strict";
  27760. /**
  27761. * Syntactic sugar for invoking a function and expanding an array for arguments.
  27762. *
  27763. * Common use case would be to use `Function.prototype.apply`.
  27764. *
  27765. * ```js
  27766. * function f(x, y, z) {}
  27767. * var args = [1, 2, 3];
  27768. * f.apply(null, args);
  27769. * ```
  27770. *
  27771. * With `spread` this example can be re-written.
  27772. *
  27773. * ```js
  27774. * spread(function(x, y, z) {})([1, 2, 3]);
  27775. * ```
  27776. *
  27777. * @param {Function} callback
  27778. * @returns {Function}
  27779. */
  27780. module.exports = function spread(callback) {
  27781. return function wrap(arr) {
  27782. return callback.apply(null, arr);
  27783. };
  27784. };
  27785. /***/ }),
  27786. /* 35 */
  27787. /***/ (function(module, exports, __webpack_require__) {
  27788. "use strict";
  27789. /* WEBPACK VAR INJECTION */(function(global) {/*!
  27790. * Vue.js v2.4.2
  27791. * (c) 2014-2017 Evan You
  27792. * Released under the MIT License.
  27793. */
  27794. /* */
  27795. // these helpers produces better vm code in JS engines due to their
  27796. // explicitness and function inlining
  27797. function isUndef (v) {
  27798. return v === undefined || v === null
  27799. }
  27800. function isDef (v) {
  27801. return v !== undefined && v !== null
  27802. }
  27803. function isTrue (v) {
  27804. return v === true
  27805. }
  27806. function isFalse (v) {
  27807. return v === false
  27808. }
  27809. /**
  27810. * Check if value is primitive
  27811. */
  27812. function isPrimitive (value) {
  27813. return (
  27814. typeof value === 'string' ||
  27815. typeof value === 'number' ||
  27816. typeof value === 'boolean'
  27817. )
  27818. }
  27819. /**
  27820. * Quick object check - this is primarily used to tell
  27821. * Objects from primitive values when we know the value
  27822. * is a JSON-compliant type.
  27823. */
  27824. function isObject (obj) {
  27825. return obj !== null && typeof obj === 'object'
  27826. }
  27827. var _toString = Object.prototype.toString;
  27828. /**
  27829. * Strict object type check. Only returns true
  27830. * for plain JavaScript objects.
  27831. */
  27832. function isPlainObject (obj) {
  27833. return _toString.call(obj) === '[object Object]'
  27834. }
  27835. function isRegExp (v) {
  27836. return _toString.call(v) === '[object RegExp]'
  27837. }
  27838. /**
  27839. * Check if val is a valid array index.
  27840. */
  27841. function isValidArrayIndex (val) {
  27842. var n = parseFloat(val);
  27843. return n >= 0 && Math.floor(n) === n && isFinite(val)
  27844. }
  27845. /**
  27846. * Convert a value to a string that is actually rendered.
  27847. */
  27848. function toString (val) {
  27849. return val == null
  27850. ? ''
  27851. : typeof val === 'object'
  27852. ? JSON.stringify(val, null, 2)
  27853. : String(val)
  27854. }
  27855. /**
  27856. * Convert a input value to a number for persistence.
  27857. * If the conversion fails, return original string.
  27858. */
  27859. function toNumber (val) {
  27860. var n = parseFloat(val);
  27861. return isNaN(n) ? val : n
  27862. }
  27863. /**
  27864. * Make a map and return a function for checking if a key
  27865. * is in that map.
  27866. */
  27867. function makeMap (
  27868. str,
  27869. expectsLowerCase
  27870. ) {
  27871. var map = Object.create(null);
  27872. var list = str.split(',');
  27873. for (var i = 0; i < list.length; i++) {
  27874. map[list[i]] = true;
  27875. }
  27876. return expectsLowerCase
  27877. ? function (val) { return map[val.toLowerCase()]; }
  27878. : function (val) { return map[val]; }
  27879. }
  27880. /**
  27881. * Check if a tag is a built-in tag.
  27882. */
  27883. var isBuiltInTag = makeMap('slot,component', true);
  27884. /**
  27885. * Check if a attribute is a reserved attribute.
  27886. */
  27887. var isReservedAttribute = makeMap('key,ref,slot,is');
  27888. /**
  27889. * Remove an item from an array
  27890. */
  27891. function remove (arr, item) {
  27892. if (arr.length) {
  27893. var index = arr.indexOf(item);
  27894. if (index > -1) {
  27895. return arr.splice(index, 1)
  27896. }
  27897. }
  27898. }
  27899. /**
  27900. * Check whether the object has the property.
  27901. */
  27902. var hasOwnProperty = Object.prototype.hasOwnProperty;
  27903. function hasOwn (obj, key) {
  27904. return hasOwnProperty.call(obj, key)
  27905. }
  27906. /**
  27907. * Create a cached version of a pure function.
  27908. */
  27909. function cached (fn) {
  27910. var cache = Object.create(null);
  27911. return (function cachedFn (str) {
  27912. var hit = cache[str];
  27913. return hit || (cache[str] = fn(str))
  27914. })
  27915. }
  27916. /**
  27917. * Camelize a hyphen-delimited string.
  27918. */
  27919. var camelizeRE = /-(\w)/g;
  27920. var camelize = cached(function (str) {
  27921. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  27922. });
  27923. /**
  27924. * Capitalize a string.
  27925. */
  27926. var capitalize = cached(function (str) {
  27927. return str.charAt(0).toUpperCase() + str.slice(1)
  27928. });
  27929. /**
  27930. * Hyphenate a camelCase string.
  27931. */
  27932. var hyphenateRE = /([^-])([A-Z])/g;
  27933. var hyphenate = cached(function (str) {
  27934. return str
  27935. .replace(hyphenateRE, '$1-$2')
  27936. .replace(hyphenateRE, '$1-$2')
  27937. .toLowerCase()
  27938. });
  27939. /**
  27940. * Simple bind, faster than native
  27941. */
  27942. function bind (fn, ctx) {
  27943. function boundFn (a) {
  27944. var l = arguments.length;
  27945. return l
  27946. ? l > 1
  27947. ? fn.apply(ctx, arguments)
  27948. : fn.call(ctx, a)
  27949. : fn.call(ctx)
  27950. }
  27951. // record original fn length
  27952. boundFn._length = fn.length;
  27953. return boundFn
  27954. }
  27955. /**
  27956. * Convert an Array-like object to a real Array.
  27957. */
  27958. function toArray (list, start) {
  27959. start = start || 0;
  27960. var i = list.length - start;
  27961. var ret = new Array(i);
  27962. while (i--) {
  27963. ret[i] = list[i + start];
  27964. }
  27965. return ret
  27966. }
  27967. /**
  27968. * Mix properties into target object.
  27969. */
  27970. function extend (to, _from) {
  27971. for (var key in _from) {
  27972. to[key] = _from[key];
  27973. }
  27974. return to
  27975. }
  27976. /**
  27977. * Merge an Array of Objects into a single Object.
  27978. */
  27979. function toObject (arr) {
  27980. var res = {};
  27981. for (var i = 0; i < arr.length; i++) {
  27982. if (arr[i]) {
  27983. extend(res, arr[i]);
  27984. }
  27985. }
  27986. return res
  27987. }
  27988. /**
  27989. * Perform no operation.
  27990. * Stubbing args to make Flow happy without leaving useless transpiled code
  27991. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  27992. */
  27993. function noop (a, b, c) {}
  27994. /**
  27995. * Always return false.
  27996. */
  27997. var no = function (a, b, c) { return false; };
  27998. /**
  27999. * Return same value
  28000. */
  28001. var identity = function (_) { return _; };
  28002. /**
  28003. * Generate a static keys string from compiler modules.
  28004. */
  28005. function genStaticKeys (modules) {
  28006. return modules.reduce(function (keys, m) {
  28007. return keys.concat(m.staticKeys || [])
  28008. }, []).join(',')
  28009. }
  28010. /**
  28011. * Check if two values are loosely equal - that is,
  28012. * if they are plain objects, do they have the same shape?
  28013. */
  28014. function looseEqual (a, b) {
  28015. if (a === b) { return true }
  28016. var isObjectA = isObject(a);
  28017. var isObjectB = isObject(b);
  28018. if (isObjectA && isObjectB) {
  28019. try {
  28020. var isArrayA = Array.isArray(a);
  28021. var isArrayB = Array.isArray(b);
  28022. if (isArrayA && isArrayB) {
  28023. return a.length === b.length && a.every(function (e, i) {
  28024. return looseEqual(e, b[i])
  28025. })
  28026. } else if (!isArrayA && !isArrayB) {
  28027. var keysA = Object.keys(a);
  28028. var keysB = Object.keys(b);
  28029. return keysA.length === keysB.length && keysA.every(function (key) {
  28030. return looseEqual(a[key], b[key])
  28031. })
  28032. } else {
  28033. /* istanbul ignore next */
  28034. return false
  28035. }
  28036. } catch (e) {
  28037. /* istanbul ignore next */
  28038. return false
  28039. }
  28040. } else if (!isObjectA && !isObjectB) {
  28041. return String(a) === String(b)
  28042. } else {
  28043. return false
  28044. }
  28045. }
  28046. function looseIndexOf (arr, val) {
  28047. for (var i = 0; i < arr.length; i++) {
  28048. if (looseEqual(arr[i], val)) { return i }
  28049. }
  28050. return -1
  28051. }
  28052. /**
  28053. * Ensure a function is called only once.
  28054. */
  28055. function once (fn) {
  28056. var called = false;
  28057. return function () {
  28058. if (!called) {
  28059. called = true;
  28060. fn.apply(this, arguments);
  28061. }
  28062. }
  28063. }
  28064. var SSR_ATTR = 'data-server-rendered';
  28065. var ASSET_TYPES = [
  28066. 'component',
  28067. 'directive',
  28068. 'filter'
  28069. ];
  28070. var LIFECYCLE_HOOKS = [
  28071. 'beforeCreate',
  28072. 'created',
  28073. 'beforeMount',
  28074. 'mounted',
  28075. 'beforeUpdate',
  28076. 'updated',
  28077. 'beforeDestroy',
  28078. 'destroyed',
  28079. 'activated',
  28080. 'deactivated'
  28081. ];
  28082. /* */
  28083. var config = ({
  28084. /**
  28085. * Option merge strategies (used in core/util/options)
  28086. */
  28087. optionMergeStrategies: Object.create(null),
  28088. /**
  28089. * Whether to suppress warnings.
  28090. */
  28091. silent: false,
  28092. /**
  28093. * Show production mode tip message on boot?
  28094. */
  28095. productionTip: "development" !== 'production',
  28096. /**
  28097. * Whether to enable devtools
  28098. */
  28099. devtools: "development" !== 'production',
  28100. /**
  28101. * Whether to record perf
  28102. */
  28103. performance: false,
  28104. /**
  28105. * Error handler for watcher errors
  28106. */
  28107. errorHandler: null,
  28108. /**
  28109. * Warn handler for watcher warns
  28110. */
  28111. warnHandler: null,
  28112. /**
  28113. * Ignore certain custom elements
  28114. */
  28115. ignoredElements: [],
  28116. /**
  28117. * Custom user key aliases for v-on
  28118. */
  28119. keyCodes: Object.create(null),
  28120. /**
  28121. * Check if a tag is reserved so that it cannot be registered as a
  28122. * component. This is platform-dependent and may be overwritten.
  28123. */
  28124. isReservedTag: no,
  28125. /**
  28126. * Check if an attribute is reserved so that it cannot be used as a component
  28127. * prop. This is platform-dependent and may be overwritten.
  28128. */
  28129. isReservedAttr: no,
  28130. /**
  28131. * Check if a tag is an unknown element.
  28132. * Platform-dependent.
  28133. */
  28134. isUnknownElement: no,
  28135. /**
  28136. * Get the namespace of an element
  28137. */
  28138. getTagNamespace: noop,
  28139. /**
  28140. * Parse the real tag name for the specific platform.
  28141. */
  28142. parsePlatformTagName: identity,
  28143. /**
  28144. * Check if an attribute must be bound using property, e.g. value
  28145. * Platform-dependent.
  28146. */
  28147. mustUseProp: no,
  28148. /**
  28149. * Exposed for legacy reasons
  28150. */
  28151. _lifecycleHooks: LIFECYCLE_HOOKS
  28152. });
  28153. /* */
  28154. var emptyObject = Object.freeze({});
  28155. /**
  28156. * Check if a string starts with $ or _
  28157. */
  28158. function isReserved (str) {
  28159. var c = (str + '').charCodeAt(0);
  28160. return c === 0x24 || c === 0x5F
  28161. }
  28162. /**
  28163. * Define a property.
  28164. */
  28165. function def (obj, key, val, enumerable) {
  28166. Object.defineProperty(obj, key, {
  28167. value: val,
  28168. enumerable: !!enumerable,
  28169. writable: true,
  28170. configurable: true
  28171. });
  28172. }
  28173. /**
  28174. * Parse simple path.
  28175. */
  28176. var bailRE = /[^\w.$]/;
  28177. function parsePath (path) {
  28178. if (bailRE.test(path)) {
  28179. return
  28180. }
  28181. var segments = path.split('.');
  28182. return function (obj) {
  28183. for (var i = 0; i < segments.length; i++) {
  28184. if (!obj) { return }
  28185. obj = obj[segments[i]];
  28186. }
  28187. return obj
  28188. }
  28189. }
  28190. /* */
  28191. var warn = noop;
  28192. var tip = noop;
  28193. var formatComponentName = (null); // work around flow check
  28194. if (true) {
  28195. var hasConsole = typeof console !== 'undefined';
  28196. var classifyRE = /(?:^|[-_])(\w)/g;
  28197. var classify = function (str) { return str
  28198. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  28199. .replace(/[-_]/g, ''); };
  28200. warn = function (msg, vm) {
  28201. var trace = vm ? generateComponentTrace(vm) : '';
  28202. if (config.warnHandler) {
  28203. config.warnHandler.call(null, msg, vm, trace);
  28204. } else if (hasConsole && (!config.silent)) {
  28205. console.error(("[Vue warn]: " + msg + trace));
  28206. }
  28207. };
  28208. tip = function (msg, vm) {
  28209. if (hasConsole && (!config.silent)) {
  28210. console.warn("[Vue tip]: " + msg + (
  28211. vm ? generateComponentTrace(vm) : ''
  28212. ));
  28213. }
  28214. };
  28215. formatComponentName = function (vm, includeFile) {
  28216. if (vm.$root === vm) {
  28217. return '<Root>'
  28218. }
  28219. var name = typeof vm === 'string'
  28220. ? vm
  28221. : typeof vm === 'function' && vm.options
  28222. ? vm.options.name
  28223. : vm._isVue
  28224. ? vm.$options.name || vm.$options._componentTag
  28225. : vm.name;
  28226. var file = vm._isVue && vm.$options.__file;
  28227. if (!name && file) {
  28228. var match = file.match(/([^/\\]+)\.vue$/);
  28229. name = match && match[1];
  28230. }
  28231. return (
  28232. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  28233. (file && includeFile !== false ? (" at " + file) : '')
  28234. )
  28235. };
  28236. var repeat = function (str, n) {
  28237. var res = '';
  28238. while (n) {
  28239. if (n % 2 === 1) { res += str; }
  28240. if (n > 1) { str += str; }
  28241. n >>= 1;
  28242. }
  28243. return res
  28244. };
  28245. var generateComponentTrace = function (vm) {
  28246. if (vm._isVue && vm.$parent) {
  28247. var tree = [];
  28248. var currentRecursiveSequence = 0;
  28249. while (vm) {
  28250. if (tree.length > 0) {
  28251. var last = tree[tree.length - 1];
  28252. if (last.constructor === vm.constructor) {
  28253. currentRecursiveSequence++;
  28254. vm = vm.$parent;
  28255. continue
  28256. } else if (currentRecursiveSequence > 0) {
  28257. tree[tree.length - 1] = [last, currentRecursiveSequence];
  28258. currentRecursiveSequence = 0;
  28259. }
  28260. }
  28261. tree.push(vm);
  28262. vm = vm.$parent;
  28263. }
  28264. return '\n\nfound in\n\n' + tree
  28265. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  28266. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  28267. : formatComponentName(vm))); })
  28268. .join('\n')
  28269. } else {
  28270. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  28271. }
  28272. };
  28273. }
  28274. /* */
  28275. function handleError (err, vm, info) {
  28276. if (config.errorHandler) {
  28277. config.errorHandler.call(null, err, vm, info);
  28278. } else {
  28279. if (true) {
  28280. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  28281. }
  28282. /* istanbul ignore else */
  28283. if (inBrowser && typeof console !== 'undefined') {
  28284. console.error(err);
  28285. } else {
  28286. throw err
  28287. }
  28288. }
  28289. }
  28290. /* */
  28291. /* globals MutationObserver */
  28292. // can we use __proto__?
  28293. var hasProto = '__proto__' in {};
  28294. // Browser environment sniffing
  28295. var inBrowser = typeof window !== 'undefined';
  28296. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  28297. var isIE = UA && /msie|trident/.test(UA);
  28298. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  28299. var isEdge = UA && UA.indexOf('edge/') > 0;
  28300. var isAndroid = UA && UA.indexOf('android') > 0;
  28301. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  28302. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  28303. // Firefix has a "watch" function on Object.prototype...
  28304. var nativeWatch = ({}).watch;
  28305. var supportsPassive = false;
  28306. if (inBrowser) {
  28307. try {
  28308. var opts = {};
  28309. Object.defineProperty(opts, 'passive', ({
  28310. get: function get () {
  28311. /* istanbul ignore next */
  28312. supportsPassive = true;
  28313. }
  28314. })); // https://github.com/facebook/flow/issues/285
  28315. window.addEventListener('test-passive', null, opts);
  28316. } catch (e) {}
  28317. }
  28318. // this needs to be lazy-evaled because vue may be required before
  28319. // vue-server-renderer can set VUE_ENV
  28320. var _isServer;
  28321. var isServerRendering = function () {
  28322. if (_isServer === undefined) {
  28323. /* istanbul ignore if */
  28324. if (!inBrowser && typeof global !== 'undefined') {
  28325. // detect presence of vue-server-renderer and avoid
  28326. // Webpack shimming the process
  28327. _isServer = global['process'].env.VUE_ENV === 'server';
  28328. } else {
  28329. _isServer = false;
  28330. }
  28331. }
  28332. return _isServer
  28333. };
  28334. // detect devtools
  28335. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  28336. /* istanbul ignore next */
  28337. function isNative (Ctor) {
  28338. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  28339. }
  28340. var hasSymbol =
  28341. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  28342. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  28343. /**
  28344. * Defer a task to execute it asynchronously.
  28345. */
  28346. var nextTick = (function () {
  28347. var callbacks = [];
  28348. var pending = false;
  28349. var timerFunc;
  28350. function nextTickHandler () {
  28351. pending = false;
  28352. var copies = callbacks.slice(0);
  28353. callbacks.length = 0;
  28354. for (var i = 0; i < copies.length; i++) {
  28355. copies[i]();
  28356. }
  28357. }
  28358. // the nextTick behavior leverages the microtask queue, which can be accessed
  28359. // via either native Promise.then or MutationObserver.
  28360. // MutationObserver has wider support, however it is seriously bugged in
  28361. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  28362. // completely stops working after triggering a few times... so, if native
  28363. // Promise is available, we will use it:
  28364. /* istanbul ignore if */
  28365. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  28366. var p = Promise.resolve();
  28367. var logError = function (err) { console.error(err); };
  28368. timerFunc = function () {
  28369. p.then(nextTickHandler).catch(logError);
  28370. // in problematic UIWebViews, Promise.then doesn't completely break, but
  28371. // it can get stuck in a weird state where callbacks are pushed into the
  28372. // microtask queue but the queue isn't being flushed, until the browser
  28373. // needs to do some other work, e.g. handle a timer. Therefore we can
  28374. // "force" the microtask queue to be flushed by adding an empty timer.
  28375. if (isIOS) { setTimeout(noop); }
  28376. };
  28377. } else if (typeof MutationObserver !== 'undefined' && (
  28378. isNative(MutationObserver) ||
  28379. // PhantomJS and iOS 7.x
  28380. MutationObserver.toString() === '[object MutationObserverConstructor]'
  28381. )) {
  28382. // use MutationObserver where native Promise is not available,
  28383. // e.g. PhantomJS IE11, iOS7, Android 4.4
  28384. var counter = 1;
  28385. var observer = new MutationObserver(nextTickHandler);
  28386. var textNode = document.createTextNode(String(counter));
  28387. observer.observe(textNode, {
  28388. characterData: true
  28389. });
  28390. timerFunc = function () {
  28391. counter = (counter + 1) % 2;
  28392. textNode.data = String(counter);
  28393. };
  28394. } else {
  28395. // fallback to setTimeout
  28396. /* istanbul ignore next */
  28397. timerFunc = function () {
  28398. setTimeout(nextTickHandler, 0);
  28399. };
  28400. }
  28401. return function queueNextTick (cb, ctx) {
  28402. var _resolve;
  28403. callbacks.push(function () {
  28404. if (cb) {
  28405. try {
  28406. cb.call(ctx);
  28407. } catch (e) {
  28408. handleError(e, ctx, 'nextTick');
  28409. }
  28410. } else if (_resolve) {
  28411. _resolve(ctx);
  28412. }
  28413. });
  28414. if (!pending) {
  28415. pending = true;
  28416. timerFunc();
  28417. }
  28418. if (!cb && typeof Promise !== 'undefined') {
  28419. return new Promise(function (resolve, reject) {
  28420. _resolve = resolve;
  28421. })
  28422. }
  28423. }
  28424. })();
  28425. var _Set;
  28426. /* istanbul ignore if */
  28427. if (typeof Set !== 'undefined' && isNative(Set)) {
  28428. // use native Set when available.
  28429. _Set = Set;
  28430. } else {
  28431. // a non-standard Set polyfill that only works with primitive keys.
  28432. _Set = (function () {
  28433. function Set () {
  28434. this.set = Object.create(null);
  28435. }
  28436. Set.prototype.has = function has (key) {
  28437. return this.set[key] === true
  28438. };
  28439. Set.prototype.add = function add (key) {
  28440. this.set[key] = true;
  28441. };
  28442. Set.prototype.clear = function clear () {
  28443. this.set = Object.create(null);
  28444. };
  28445. return Set;
  28446. }());
  28447. }
  28448. /* */
  28449. var uid = 0;
  28450. /**
  28451. * A dep is an observable that can have multiple
  28452. * directives subscribing to it.
  28453. */
  28454. var Dep = function Dep () {
  28455. this.id = uid++;
  28456. this.subs = [];
  28457. };
  28458. Dep.prototype.addSub = function addSub (sub) {
  28459. this.subs.push(sub);
  28460. };
  28461. Dep.prototype.removeSub = function removeSub (sub) {
  28462. remove(this.subs, sub);
  28463. };
  28464. Dep.prototype.depend = function depend () {
  28465. if (Dep.target) {
  28466. Dep.target.addDep(this);
  28467. }
  28468. };
  28469. Dep.prototype.notify = function notify () {
  28470. // stabilize the subscriber list first
  28471. var subs = this.subs.slice();
  28472. for (var i = 0, l = subs.length; i < l; i++) {
  28473. subs[i].update();
  28474. }
  28475. };
  28476. // the current target watcher being evaluated.
  28477. // this is globally unique because there could be only one
  28478. // watcher being evaluated at any time.
  28479. Dep.target = null;
  28480. var targetStack = [];
  28481. function pushTarget (_target) {
  28482. if (Dep.target) { targetStack.push(Dep.target); }
  28483. Dep.target = _target;
  28484. }
  28485. function popTarget () {
  28486. Dep.target = targetStack.pop();
  28487. }
  28488. /*
  28489. * not type checking this file because flow doesn't play well with
  28490. * dynamically accessing methods on Array prototype
  28491. */
  28492. var arrayProto = Array.prototype;
  28493. var arrayMethods = Object.create(arrayProto);[
  28494. 'push',
  28495. 'pop',
  28496. 'shift',
  28497. 'unshift',
  28498. 'splice',
  28499. 'sort',
  28500. 'reverse'
  28501. ]
  28502. .forEach(function (method) {
  28503. // cache original method
  28504. var original = arrayProto[method];
  28505. def(arrayMethods, method, function mutator () {
  28506. var args = [], len = arguments.length;
  28507. while ( len-- ) args[ len ] = arguments[ len ];
  28508. var result = original.apply(this, args);
  28509. var ob = this.__ob__;
  28510. var inserted;
  28511. switch (method) {
  28512. case 'push':
  28513. case 'unshift':
  28514. inserted = args;
  28515. break
  28516. case 'splice':
  28517. inserted = args.slice(2);
  28518. break
  28519. }
  28520. if (inserted) { ob.observeArray(inserted); }
  28521. // notify change
  28522. ob.dep.notify();
  28523. return result
  28524. });
  28525. });
  28526. /* */
  28527. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  28528. /**
  28529. * By default, when a reactive property is set, the new value is
  28530. * also converted to become reactive. However when passing down props,
  28531. * we don't want to force conversion because the value may be a nested value
  28532. * under a frozen data structure. Converting it would defeat the optimization.
  28533. */
  28534. var observerState = {
  28535. shouldConvert: true
  28536. };
  28537. /**
  28538. * Observer class that are attached to each observed
  28539. * object. Once attached, the observer converts target
  28540. * object's property keys into getter/setters that
  28541. * collect dependencies and dispatches updates.
  28542. */
  28543. var Observer = function Observer (value) {
  28544. this.value = value;
  28545. this.dep = new Dep();
  28546. this.vmCount = 0;
  28547. def(value, '__ob__', this);
  28548. if (Array.isArray(value)) {
  28549. var augment = hasProto
  28550. ? protoAugment
  28551. : copyAugment;
  28552. augment(value, arrayMethods, arrayKeys);
  28553. this.observeArray(value);
  28554. } else {
  28555. this.walk(value);
  28556. }
  28557. };
  28558. /**
  28559. * Walk through each property and convert them into
  28560. * getter/setters. This method should only be called when
  28561. * value type is Object.
  28562. */
  28563. Observer.prototype.walk = function walk (obj) {
  28564. var keys = Object.keys(obj);
  28565. for (var i = 0; i < keys.length; i++) {
  28566. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  28567. }
  28568. };
  28569. /**
  28570. * Observe a list of Array items.
  28571. */
  28572. Observer.prototype.observeArray = function observeArray (items) {
  28573. for (var i = 0, l = items.length; i < l; i++) {
  28574. observe(items[i]);
  28575. }
  28576. };
  28577. // helpers
  28578. /**
  28579. * Augment an target Object or Array by intercepting
  28580. * the prototype chain using __proto__
  28581. */
  28582. function protoAugment (target, src, keys) {
  28583. /* eslint-disable no-proto */
  28584. target.__proto__ = src;
  28585. /* eslint-enable no-proto */
  28586. }
  28587. /**
  28588. * Augment an target Object or Array by defining
  28589. * hidden properties.
  28590. */
  28591. /* istanbul ignore next */
  28592. function copyAugment (target, src, keys) {
  28593. for (var i = 0, l = keys.length; i < l; i++) {
  28594. var key = keys[i];
  28595. def(target, key, src[key]);
  28596. }
  28597. }
  28598. /**
  28599. * Attempt to create an observer instance for a value,
  28600. * returns the new observer if successfully observed,
  28601. * or the existing observer if the value already has one.
  28602. */
  28603. function observe (value, asRootData) {
  28604. if (!isObject(value)) {
  28605. return
  28606. }
  28607. var ob;
  28608. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  28609. ob = value.__ob__;
  28610. } else if (
  28611. observerState.shouldConvert &&
  28612. !isServerRendering() &&
  28613. (Array.isArray(value) || isPlainObject(value)) &&
  28614. Object.isExtensible(value) &&
  28615. !value._isVue
  28616. ) {
  28617. ob = new Observer(value);
  28618. }
  28619. if (asRootData && ob) {
  28620. ob.vmCount++;
  28621. }
  28622. return ob
  28623. }
  28624. /**
  28625. * Define a reactive property on an Object.
  28626. */
  28627. function defineReactive$$1 (
  28628. obj,
  28629. key,
  28630. val,
  28631. customSetter,
  28632. shallow
  28633. ) {
  28634. var dep = new Dep();
  28635. var property = Object.getOwnPropertyDescriptor(obj, key);
  28636. if (property && property.configurable === false) {
  28637. return
  28638. }
  28639. // cater for pre-defined getter/setters
  28640. var getter = property && property.get;
  28641. var setter = property && property.set;
  28642. var childOb = !shallow && observe(val);
  28643. Object.defineProperty(obj, key, {
  28644. enumerable: true,
  28645. configurable: true,
  28646. get: function reactiveGetter () {
  28647. var value = getter ? getter.call(obj) : val;
  28648. if (Dep.target) {
  28649. dep.depend();
  28650. if (childOb) {
  28651. childOb.dep.depend();
  28652. }
  28653. if (Array.isArray(value)) {
  28654. dependArray(value);
  28655. }
  28656. }
  28657. return value
  28658. },
  28659. set: function reactiveSetter (newVal) {
  28660. var value = getter ? getter.call(obj) : val;
  28661. /* eslint-disable no-self-compare */
  28662. if (newVal === value || (newVal !== newVal && value !== value)) {
  28663. return
  28664. }
  28665. /* eslint-enable no-self-compare */
  28666. if ("development" !== 'production' && customSetter) {
  28667. customSetter();
  28668. }
  28669. if (setter) {
  28670. setter.call(obj, newVal);
  28671. } else {
  28672. val = newVal;
  28673. }
  28674. childOb = !shallow && observe(newVal);
  28675. dep.notify();
  28676. }
  28677. });
  28678. }
  28679. /**
  28680. * Set a property on an object. Adds the new property and
  28681. * triggers change notification if the property doesn't
  28682. * already exist.
  28683. */
  28684. function set (target, key, val) {
  28685. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28686. target.length = Math.max(target.length, key);
  28687. target.splice(key, 1, val);
  28688. return val
  28689. }
  28690. if (hasOwn(target, key)) {
  28691. target[key] = val;
  28692. return val
  28693. }
  28694. var ob = (target).__ob__;
  28695. if (target._isVue || (ob && ob.vmCount)) {
  28696. "development" !== 'production' && warn(
  28697. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  28698. 'at runtime - declare it upfront in the data option.'
  28699. );
  28700. return val
  28701. }
  28702. if (!ob) {
  28703. target[key] = val;
  28704. return val
  28705. }
  28706. defineReactive$$1(ob.value, key, val);
  28707. ob.dep.notify();
  28708. return val
  28709. }
  28710. /**
  28711. * Delete a property and trigger change if necessary.
  28712. */
  28713. function del (target, key) {
  28714. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28715. target.splice(key, 1);
  28716. return
  28717. }
  28718. var ob = (target).__ob__;
  28719. if (target._isVue || (ob && ob.vmCount)) {
  28720. "development" !== 'production' && warn(
  28721. 'Avoid deleting properties on a Vue instance or its root $data ' +
  28722. '- just set it to null.'
  28723. );
  28724. return
  28725. }
  28726. if (!hasOwn(target, key)) {
  28727. return
  28728. }
  28729. delete target[key];
  28730. if (!ob) {
  28731. return
  28732. }
  28733. ob.dep.notify();
  28734. }
  28735. /**
  28736. * Collect dependencies on array elements when the array is touched, since
  28737. * we cannot intercept array element access like property getters.
  28738. */
  28739. function dependArray (value) {
  28740. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  28741. e = value[i];
  28742. e && e.__ob__ && e.__ob__.dep.depend();
  28743. if (Array.isArray(e)) {
  28744. dependArray(e);
  28745. }
  28746. }
  28747. }
  28748. /* */
  28749. /**
  28750. * Option overwriting strategies are functions that handle
  28751. * how to merge a parent option value and a child option
  28752. * value into the final value.
  28753. */
  28754. var strats = config.optionMergeStrategies;
  28755. /**
  28756. * Options with restrictions
  28757. */
  28758. if (true) {
  28759. strats.el = strats.propsData = function (parent, child, vm, key) {
  28760. if (!vm) {
  28761. warn(
  28762. "option \"" + key + "\" can only be used during instance " +
  28763. 'creation with the `new` keyword.'
  28764. );
  28765. }
  28766. return defaultStrat(parent, child)
  28767. };
  28768. }
  28769. /**
  28770. * Helper that recursively merges two data objects together.
  28771. */
  28772. function mergeData (to, from) {
  28773. if (!from) { return to }
  28774. var key, toVal, fromVal;
  28775. var keys = Object.keys(from);
  28776. for (var i = 0; i < keys.length; i++) {
  28777. key = keys[i];
  28778. toVal = to[key];
  28779. fromVal = from[key];
  28780. if (!hasOwn(to, key)) {
  28781. set(to, key, fromVal);
  28782. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  28783. mergeData(toVal, fromVal);
  28784. }
  28785. }
  28786. return to
  28787. }
  28788. /**
  28789. * Data
  28790. */
  28791. function mergeDataOrFn (
  28792. parentVal,
  28793. childVal,
  28794. vm
  28795. ) {
  28796. if (!vm) {
  28797. // in a Vue.extend merge, both should be functions
  28798. if (!childVal) {
  28799. return parentVal
  28800. }
  28801. if (!parentVal) {
  28802. return childVal
  28803. }
  28804. // when parentVal & childVal are both present,
  28805. // we need to return a function that returns the
  28806. // merged result of both functions... no need to
  28807. // check if parentVal is a function here because
  28808. // it has to be a function to pass previous merges.
  28809. return function mergedDataFn () {
  28810. return mergeData(
  28811. typeof childVal === 'function' ? childVal.call(this) : childVal,
  28812. typeof parentVal === 'function' ? parentVal.call(this) : parentVal
  28813. )
  28814. }
  28815. } else if (parentVal || childVal) {
  28816. return function mergedInstanceDataFn () {
  28817. // instance merge
  28818. var instanceData = typeof childVal === 'function'
  28819. ? childVal.call(vm)
  28820. : childVal;
  28821. var defaultData = typeof parentVal === 'function'
  28822. ? parentVal.call(vm)
  28823. : undefined;
  28824. if (instanceData) {
  28825. return mergeData(instanceData, defaultData)
  28826. } else {
  28827. return defaultData
  28828. }
  28829. }
  28830. }
  28831. }
  28832. strats.data = function (
  28833. parentVal,
  28834. childVal,
  28835. vm
  28836. ) {
  28837. if (!vm) {
  28838. if (childVal && typeof childVal !== 'function') {
  28839. "development" !== 'production' && warn(
  28840. 'The "data" option should be a function ' +
  28841. 'that returns a per-instance value in component ' +
  28842. 'definitions.',
  28843. vm
  28844. );
  28845. return parentVal
  28846. }
  28847. return mergeDataOrFn.call(this, parentVal, childVal)
  28848. }
  28849. return mergeDataOrFn(parentVal, childVal, vm)
  28850. };
  28851. /**
  28852. * Hooks and props are merged as arrays.
  28853. */
  28854. function mergeHook (
  28855. parentVal,
  28856. childVal
  28857. ) {
  28858. return childVal
  28859. ? parentVal
  28860. ? parentVal.concat(childVal)
  28861. : Array.isArray(childVal)
  28862. ? childVal
  28863. : [childVal]
  28864. : parentVal
  28865. }
  28866. LIFECYCLE_HOOKS.forEach(function (hook) {
  28867. strats[hook] = mergeHook;
  28868. });
  28869. /**
  28870. * Assets
  28871. *
  28872. * When a vm is present (instance creation), we need to do
  28873. * a three-way merge between constructor options, instance
  28874. * options and parent options.
  28875. */
  28876. function mergeAssets (parentVal, childVal) {
  28877. var res = Object.create(parentVal || null);
  28878. return childVal
  28879. ? extend(res, childVal)
  28880. : res
  28881. }
  28882. ASSET_TYPES.forEach(function (type) {
  28883. strats[type + 's'] = mergeAssets;
  28884. });
  28885. /**
  28886. * Watchers.
  28887. *
  28888. * Watchers hashes should not overwrite one
  28889. * another, so we merge them as arrays.
  28890. */
  28891. strats.watch = function (parentVal, childVal) {
  28892. // work around Firefox's Object.prototype.watch...
  28893. if (parentVal === nativeWatch) { parentVal = undefined; }
  28894. if (childVal === nativeWatch) { childVal = undefined; }
  28895. /* istanbul ignore if */
  28896. if (!childVal) { return Object.create(parentVal || null) }
  28897. if (!parentVal) { return childVal }
  28898. var ret = {};
  28899. extend(ret, parentVal);
  28900. for (var key in childVal) {
  28901. var parent = ret[key];
  28902. var child = childVal[key];
  28903. if (parent && !Array.isArray(parent)) {
  28904. parent = [parent];
  28905. }
  28906. ret[key] = parent
  28907. ? parent.concat(child)
  28908. : Array.isArray(child) ? child : [child];
  28909. }
  28910. return ret
  28911. };
  28912. /**
  28913. * Other object hashes.
  28914. */
  28915. strats.props =
  28916. strats.methods =
  28917. strats.inject =
  28918. strats.computed = function (parentVal, childVal) {
  28919. if (!parentVal) { return childVal }
  28920. var ret = Object.create(null);
  28921. extend(ret, parentVal);
  28922. if (childVal) { extend(ret, childVal); }
  28923. return ret
  28924. };
  28925. strats.provide = mergeDataOrFn;
  28926. /**
  28927. * Default strategy.
  28928. */
  28929. var defaultStrat = function (parentVal, childVal) {
  28930. return childVal === undefined
  28931. ? parentVal
  28932. : childVal
  28933. };
  28934. /**
  28935. * Validate component names
  28936. */
  28937. function checkComponents (options) {
  28938. for (var key in options.components) {
  28939. var lower = key.toLowerCase();
  28940. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  28941. warn(
  28942. 'Do not use built-in or reserved HTML elements as component ' +
  28943. 'id: ' + key
  28944. );
  28945. }
  28946. }
  28947. }
  28948. /**
  28949. * Ensure all props option syntax are normalized into the
  28950. * Object-based format.
  28951. */
  28952. function normalizeProps (options) {
  28953. var props = options.props;
  28954. if (!props) { return }
  28955. var res = {};
  28956. var i, val, name;
  28957. if (Array.isArray(props)) {
  28958. i = props.length;
  28959. while (i--) {
  28960. val = props[i];
  28961. if (typeof val === 'string') {
  28962. name = camelize(val);
  28963. res[name] = { type: null };
  28964. } else if (true) {
  28965. warn('props must be strings when using array syntax.');
  28966. }
  28967. }
  28968. } else if (isPlainObject(props)) {
  28969. for (var key in props) {
  28970. val = props[key];
  28971. name = camelize(key);
  28972. res[name] = isPlainObject(val)
  28973. ? val
  28974. : { type: val };
  28975. }
  28976. }
  28977. options.props = res;
  28978. }
  28979. /**
  28980. * Normalize all injections into Object-based format
  28981. */
  28982. function normalizeInject (options) {
  28983. var inject = options.inject;
  28984. if (Array.isArray(inject)) {
  28985. var normalized = options.inject = {};
  28986. for (var i = 0; i < inject.length; i++) {
  28987. normalized[inject[i]] = inject[i];
  28988. }
  28989. }
  28990. }
  28991. /**
  28992. * Normalize raw function directives into object format.
  28993. */
  28994. function normalizeDirectives (options) {
  28995. var dirs = options.directives;
  28996. if (dirs) {
  28997. for (var key in dirs) {
  28998. var def = dirs[key];
  28999. if (typeof def === 'function') {
  29000. dirs[key] = { bind: def, update: def };
  29001. }
  29002. }
  29003. }
  29004. }
  29005. /**
  29006. * Merge two option objects into a new one.
  29007. * Core utility used in both instantiation and inheritance.
  29008. */
  29009. function mergeOptions (
  29010. parent,
  29011. child,
  29012. vm
  29013. ) {
  29014. if (true) {
  29015. checkComponents(child);
  29016. }
  29017. if (typeof child === 'function') {
  29018. child = child.options;
  29019. }
  29020. normalizeProps(child);
  29021. normalizeInject(child);
  29022. normalizeDirectives(child);
  29023. var extendsFrom = child.extends;
  29024. if (extendsFrom) {
  29025. parent = mergeOptions(parent, extendsFrom, vm);
  29026. }
  29027. if (child.mixins) {
  29028. for (var i = 0, l = child.mixins.length; i < l; i++) {
  29029. parent = mergeOptions(parent, child.mixins[i], vm);
  29030. }
  29031. }
  29032. var options = {};
  29033. var key;
  29034. for (key in parent) {
  29035. mergeField(key);
  29036. }
  29037. for (key in child) {
  29038. if (!hasOwn(parent, key)) {
  29039. mergeField(key);
  29040. }
  29041. }
  29042. function mergeField (key) {
  29043. var strat = strats[key] || defaultStrat;
  29044. options[key] = strat(parent[key], child[key], vm, key);
  29045. }
  29046. return options
  29047. }
  29048. /**
  29049. * Resolve an asset.
  29050. * This function is used because child instances need access
  29051. * to assets defined in its ancestor chain.
  29052. */
  29053. function resolveAsset (
  29054. options,
  29055. type,
  29056. id,
  29057. warnMissing
  29058. ) {
  29059. /* istanbul ignore if */
  29060. if (typeof id !== 'string') {
  29061. return
  29062. }
  29063. var assets = options[type];
  29064. // check local registration variations first
  29065. if (hasOwn(assets, id)) { return assets[id] }
  29066. var camelizedId = camelize(id);
  29067. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  29068. var PascalCaseId = capitalize(camelizedId);
  29069. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  29070. // fallback to prototype chain
  29071. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  29072. if ("development" !== 'production' && warnMissing && !res) {
  29073. warn(
  29074. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  29075. options
  29076. );
  29077. }
  29078. return res
  29079. }
  29080. /* */
  29081. function validateProp (
  29082. key,
  29083. propOptions,
  29084. propsData,
  29085. vm
  29086. ) {
  29087. var prop = propOptions[key];
  29088. var absent = !hasOwn(propsData, key);
  29089. var value = propsData[key];
  29090. // handle boolean props
  29091. if (isType(Boolean, prop.type)) {
  29092. if (absent && !hasOwn(prop, 'default')) {
  29093. value = false;
  29094. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  29095. value = true;
  29096. }
  29097. }
  29098. // check default value
  29099. if (value === undefined) {
  29100. value = getPropDefaultValue(vm, prop, key);
  29101. // since the default value is a fresh copy,
  29102. // make sure to observe it.
  29103. var prevShouldConvert = observerState.shouldConvert;
  29104. observerState.shouldConvert = true;
  29105. observe(value);
  29106. observerState.shouldConvert = prevShouldConvert;
  29107. }
  29108. if (true) {
  29109. assertProp(prop, key, value, vm, absent);
  29110. }
  29111. return value
  29112. }
  29113. /**
  29114. * Get the default value of a prop.
  29115. */
  29116. function getPropDefaultValue (vm, prop, key) {
  29117. // no default, return undefined
  29118. if (!hasOwn(prop, 'default')) {
  29119. return undefined
  29120. }
  29121. var def = prop.default;
  29122. // warn against non-factory defaults for Object & Array
  29123. if ("development" !== 'production' && isObject(def)) {
  29124. warn(
  29125. 'Invalid default value for prop "' + key + '": ' +
  29126. 'Props with type Object/Array must use a factory function ' +
  29127. 'to return the default value.',
  29128. vm
  29129. );
  29130. }
  29131. // the raw prop value was also undefined from previous render,
  29132. // return previous default value to avoid unnecessary watcher trigger
  29133. if (vm && vm.$options.propsData &&
  29134. vm.$options.propsData[key] === undefined &&
  29135. vm._props[key] !== undefined
  29136. ) {
  29137. return vm._props[key]
  29138. }
  29139. // call factory function for non-Function types
  29140. // a value is Function if its prototype is function even across different execution context
  29141. return typeof def === 'function' && getType(prop.type) !== 'Function'
  29142. ? def.call(vm)
  29143. : def
  29144. }
  29145. /**
  29146. * Assert whether a prop is valid.
  29147. */
  29148. function assertProp (
  29149. prop,
  29150. name,
  29151. value,
  29152. vm,
  29153. absent
  29154. ) {
  29155. if (prop.required && absent) {
  29156. warn(
  29157. 'Missing required prop: "' + name + '"',
  29158. vm
  29159. );
  29160. return
  29161. }
  29162. if (value == null && !prop.required) {
  29163. return
  29164. }
  29165. var type = prop.type;
  29166. var valid = !type || type === true;
  29167. var expectedTypes = [];
  29168. if (type) {
  29169. if (!Array.isArray(type)) {
  29170. type = [type];
  29171. }
  29172. for (var i = 0; i < type.length && !valid; i++) {
  29173. var assertedType = assertType(value, type[i]);
  29174. expectedTypes.push(assertedType.expectedType || '');
  29175. valid = assertedType.valid;
  29176. }
  29177. }
  29178. if (!valid) {
  29179. warn(
  29180. 'Invalid prop: type check failed for prop "' + name + '".' +
  29181. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  29182. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  29183. vm
  29184. );
  29185. return
  29186. }
  29187. var validator = prop.validator;
  29188. if (validator) {
  29189. if (!validator(value)) {
  29190. warn(
  29191. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  29192. vm
  29193. );
  29194. }
  29195. }
  29196. }
  29197. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  29198. function assertType (value, type) {
  29199. var valid;
  29200. var expectedType = getType(type);
  29201. if (simpleCheckRE.test(expectedType)) {
  29202. valid = typeof value === expectedType.toLowerCase();
  29203. } else if (expectedType === 'Object') {
  29204. valid = isPlainObject(value);
  29205. } else if (expectedType === 'Array') {
  29206. valid = Array.isArray(value);
  29207. } else {
  29208. valid = value instanceof type;
  29209. }
  29210. return {
  29211. valid: valid,
  29212. expectedType: expectedType
  29213. }
  29214. }
  29215. /**
  29216. * Use function string name to check built-in types,
  29217. * because a simple equality check will fail when running
  29218. * across different vms / iframes.
  29219. */
  29220. function getType (fn) {
  29221. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  29222. return match ? match[1] : ''
  29223. }
  29224. function isType (type, fn) {
  29225. if (!Array.isArray(fn)) {
  29226. return getType(fn) === getType(type)
  29227. }
  29228. for (var i = 0, len = fn.length; i < len; i++) {
  29229. if (getType(fn[i]) === getType(type)) {
  29230. return true
  29231. }
  29232. }
  29233. /* istanbul ignore next */
  29234. return false
  29235. }
  29236. /* */
  29237. var mark;
  29238. var measure;
  29239. if (true) {
  29240. var perf = inBrowser && window.performance;
  29241. /* istanbul ignore if */
  29242. if (
  29243. perf &&
  29244. perf.mark &&
  29245. perf.measure &&
  29246. perf.clearMarks &&
  29247. perf.clearMeasures
  29248. ) {
  29249. mark = function (tag) { return perf.mark(tag); };
  29250. measure = function (name, startTag, endTag) {
  29251. perf.measure(name, startTag, endTag);
  29252. perf.clearMarks(startTag);
  29253. perf.clearMarks(endTag);
  29254. perf.clearMeasures(name);
  29255. };
  29256. }
  29257. }
  29258. /* not type checking this file because flow doesn't play well with Proxy */
  29259. var initProxy;
  29260. if (true) {
  29261. var allowedGlobals = makeMap(
  29262. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  29263. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  29264. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  29265. 'require' // for Webpack/Browserify
  29266. );
  29267. var warnNonPresent = function (target, key) {
  29268. warn(
  29269. "Property or method \"" + key + "\" is not defined on the instance but " +
  29270. "referenced during render. Make sure to declare reactive data " +
  29271. "properties in the data option.",
  29272. target
  29273. );
  29274. };
  29275. var hasProxy =
  29276. typeof Proxy !== 'undefined' &&
  29277. Proxy.toString().match(/native code/);
  29278. if (hasProxy) {
  29279. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  29280. config.keyCodes = new Proxy(config.keyCodes, {
  29281. set: function set (target, key, value) {
  29282. if (isBuiltInModifier(key)) {
  29283. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  29284. return false
  29285. } else {
  29286. target[key] = value;
  29287. return true
  29288. }
  29289. }
  29290. });
  29291. }
  29292. var hasHandler = {
  29293. has: function has (target, key) {
  29294. var has = key in target;
  29295. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  29296. if (!has && !isAllowed) {
  29297. warnNonPresent(target, key);
  29298. }
  29299. return has || !isAllowed
  29300. }
  29301. };
  29302. var getHandler = {
  29303. get: function get (target, key) {
  29304. if (typeof key === 'string' && !(key in target)) {
  29305. warnNonPresent(target, key);
  29306. }
  29307. return target[key]
  29308. }
  29309. };
  29310. initProxy = function initProxy (vm) {
  29311. if (hasProxy) {
  29312. // determine which proxy handler to use
  29313. var options = vm.$options;
  29314. var handlers = options.render && options.render._withStripped
  29315. ? getHandler
  29316. : hasHandler;
  29317. vm._renderProxy = new Proxy(vm, handlers);
  29318. } else {
  29319. vm._renderProxy = vm;
  29320. }
  29321. };
  29322. }
  29323. /* */
  29324. var VNode = function VNode (
  29325. tag,
  29326. data,
  29327. children,
  29328. text,
  29329. elm,
  29330. context,
  29331. componentOptions,
  29332. asyncFactory
  29333. ) {
  29334. this.tag = tag;
  29335. this.data = data;
  29336. this.children = children;
  29337. this.text = text;
  29338. this.elm = elm;
  29339. this.ns = undefined;
  29340. this.context = context;
  29341. this.functionalContext = undefined;
  29342. this.key = data && data.key;
  29343. this.componentOptions = componentOptions;
  29344. this.componentInstance = undefined;
  29345. this.parent = undefined;
  29346. this.raw = false;
  29347. this.isStatic = false;
  29348. this.isRootInsert = true;
  29349. this.isComment = false;
  29350. this.isCloned = false;
  29351. this.isOnce = false;
  29352. this.asyncFactory = asyncFactory;
  29353. this.asyncMeta = undefined;
  29354. this.isAsyncPlaceholder = false;
  29355. };
  29356. var prototypeAccessors = { child: {} };
  29357. // DEPRECATED: alias for componentInstance for backwards compat.
  29358. /* istanbul ignore next */
  29359. prototypeAccessors.child.get = function () {
  29360. return this.componentInstance
  29361. };
  29362. Object.defineProperties( VNode.prototype, prototypeAccessors );
  29363. var createEmptyVNode = function (text) {
  29364. if ( text === void 0 ) text = '';
  29365. var node = new VNode();
  29366. node.text = text;
  29367. node.isComment = true;
  29368. return node
  29369. };
  29370. function createTextVNode (val) {
  29371. return new VNode(undefined, undefined, undefined, String(val))
  29372. }
  29373. // optimized shallow clone
  29374. // used for static nodes and slot nodes because they may be reused across
  29375. // multiple renders, cloning them avoids errors when DOM manipulations rely
  29376. // on their elm reference.
  29377. function cloneVNode (vnode) {
  29378. var cloned = new VNode(
  29379. vnode.tag,
  29380. vnode.data,
  29381. vnode.children,
  29382. vnode.text,
  29383. vnode.elm,
  29384. vnode.context,
  29385. vnode.componentOptions,
  29386. vnode.asyncFactory
  29387. );
  29388. cloned.ns = vnode.ns;
  29389. cloned.isStatic = vnode.isStatic;
  29390. cloned.key = vnode.key;
  29391. cloned.isComment = vnode.isComment;
  29392. cloned.isCloned = true;
  29393. return cloned
  29394. }
  29395. function cloneVNodes (vnodes) {
  29396. var len = vnodes.length;
  29397. var res = new Array(len);
  29398. for (var i = 0; i < len; i++) {
  29399. res[i] = cloneVNode(vnodes[i]);
  29400. }
  29401. return res
  29402. }
  29403. /* */
  29404. var normalizeEvent = cached(function (name) {
  29405. var passive = name.charAt(0) === '&';
  29406. name = passive ? name.slice(1) : name;
  29407. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  29408. name = once$$1 ? name.slice(1) : name;
  29409. var capture = name.charAt(0) === '!';
  29410. name = capture ? name.slice(1) : name;
  29411. return {
  29412. name: name,
  29413. once: once$$1,
  29414. capture: capture,
  29415. passive: passive
  29416. }
  29417. });
  29418. function createFnInvoker (fns) {
  29419. function invoker () {
  29420. var arguments$1 = arguments;
  29421. var fns = invoker.fns;
  29422. if (Array.isArray(fns)) {
  29423. var cloned = fns.slice();
  29424. for (var i = 0; i < cloned.length; i++) {
  29425. cloned[i].apply(null, arguments$1);
  29426. }
  29427. } else {
  29428. // return handler return value for single handlers
  29429. return fns.apply(null, arguments)
  29430. }
  29431. }
  29432. invoker.fns = fns;
  29433. return invoker
  29434. }
  29435. function updateListeners (
  29436. on,
  29437. oldOn,
  29438. add,
  29439. remove$$1,
  29440. vm
  29441. ) {
  29442. var name, cur, old, event;
  29443. for (name in on) {
  29444. cur = on[name];
  29445. old = oldOn[name];
  29446. event = normalizeEvent(name);
  29447. if (isUndef(cur)) {
  29448. "development" !== 'production' && warn(
  29449. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  29450. vm
  29451. );
  29452. } else if (isUndef(old)) {
  29453. if (isUndef(cur.fns)) {
  29454. cur = on[name] = createFnInvoker(cur);
  29455. }
  29456. add(event.name, cur, event.once, event.capture, event.passive);
  29457. } else if (cur !== old) {
  29458. old.fns = cur;
  29459. on[name] = old;
  29460. }
  29461. }
  29462. for (name in oldOn) {
  29463. if (isUndef(on[name])) {
  29464. event = normalizeEvent(name);
  29465. remove$$1(event.name, oldOn[name], event.capture);
  29466. }
  29467. }
  29468. }
  29469. /* */
  29470. function mergeVNodeHook (def, hookKey, hook) {
  29471. var invoker;
  29472. var oldHook = def[hookKey];
  29473. function wrappedHook () {
  29474. hook.apply(this, arguments);
  29475. // important: remove merged hook to ensure it's called only once
  29476. // and prevent memory leak
  29477. remove(invoker.fns, wrappedHook);
  29478. }
  29479. if (isUndef(oldHook)) {
  29480. // no existing hook
  29481. invoker = createFnInvoker([wrappedHook]);
  29482. } else {
  29483. /* istanbul ignore if */
  29484. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  29485. // already a merged invoker
  29486. invoker = oldHook;
  29487. invoker.fns.push(wrappedHook);
  29488. } else {
  29489. // existing plain hook
  29490. invoker = createFnInvoker([oldHook, wrappedHook]);
  29491. }
  29492. }
  29493. invoker.merged = true;
  29494. def[hookKey] = invoker;
  29495. }
  29496. /* */
  29497. function extractPropsFromVNodeData (
  29498. data,
  29499. Ctor,
  29500. tag
  29501. ) {
  29502. // we are only extracting raw values here.
  29503. // validation and default values are handled in the child
  29504. // component itself.
  29505. var propOptions = Ctor.options.props;
  29506. if (isUndef(propOptions)) {
  29507. return
  29508. }
  29509. var res = {};
  29510. var attrs = data.attrs;
  29511. var props = data.props;
  29512. if (isDef(attrs) || isDef(props)) {
  29513. for (var key in propOptions) {
  29514. var altKey = hyphenate(key);
  29515. if (true) {
  29516. var keyInLowerCase = key.toLowerCase();
  29517. if (
  29518. key !== keyInLowerCase &&
  29519. attrs && hasOwn(attrs, keyInLowerCase)
  29520. ) {
  29521. tip(
  29522. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  29523. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  29524. " \"" + key + "\". " +
  29525. "Note that HTML attributes are case-insensitive and camelCased " +
  29526. "props need to use their kebab-case equivalents when using in-DOM " +
  29527. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  29528. );
  29529. }
  29530. }
  29531. checkProp(res, props, key, altKey, true) ||
  29532. checkProp(res, attrs, key, altKey, false);
  29533. }
  29534. }
  29535. return res
  29536. }
  29537. function checkProp (
  29538. res,
  29539. hash,
  29540. key,
  29541. altKey,
  29542. preserve
  29543. ) {
  29544. if (isDef(hash)) {
  29545. if (hasOwn(hash, key)) {
  29546. res[key] = hash[key];
  29547. if (!preserve) {
  29548. delete hash[key];
  29549. }
  29550. return true
  29551. } else if (hasOwn(hash, altKey)) {
  29552. res[key] = hash[altKey];
  29553. if (!preserve) {
  29554. delete hash[altKey];
  29555. }
  29556. return true
  29557. }
  29558. }
  29559. return false
  29560. }
  29561. /* */
  29562. // The template compiler attempts to minimize the need for normalization by
  29563. // statically analyzing the template at compile time.
  29564. //
  29565. // For plain HTML markup, normalization can be completely skipped because the
  29566. // generated render function is guaranteed to return Array<VNode>. There are
  29567. // two cases where extra normalization is needed:
  29568. // 1. When the children contains components - because a functional component
  29569. // may return an Array instead of a single root. In this case, just a simple
  29570. // normalization is needed - if any child is an Array, we flatten the whole
  29571. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  29572. // because functional components already normalize their own children.
  29573. function simpleNormalizeChildren (children) {
  29574. for (var i = 0; i < children.length; i++) {
  29575. if (Array.isArray(children[i])) {
  29576. return Array.prototype.concat.apply([], children)
  29577. }
  29578. }
  29579. return children
  29580. }
  29581. // 2. When the children contains constructs that always generated nested Arrays,
  29582. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  29583. // with hand-written render functions / JSX. In such cases a full normalization
  29584. // is needed to cater to all possible types of children values.
  29585. function normalizeChildren (children) {
  29586. return isPrimitive(children)
  29587. ? [createTextVNode(children)]
  29588. : Array.isArray(children)
  29589. ? normalizeArrayChildren(children)
  29590. : undefined
  29591. }
  29592. function isTextNode (node) {
  29593. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  29594. }
  29595. function normalizeArrayChildren (children, nestedIndex) {
  29596. var res = [];
  29597. var i, c, last;
  29598. for (i = 0; i < children.length; i++) {
  29599. c = children[i];
  29600. if (isUndef(c) || typeof c === 'boolean') { continue }
  29601. last = res[res.length - 1];
  29602. // nested
  29603. if (Array.isArray(c)) {
  29604. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  29605. } else if (isPrimitive(c)) {
  29606. if (isTextNode(last)) {
  29607. // merge adjacent text nodes
  29608. // this is necessary for SSR hydration because text nodes are
  29609. // essentially merged when rendered to HTML strings
  29610. (last).text += String(c);
  29611. } else if (c !== '') {
  29612. // convert primitive to vnode
  29613. res.push(createTextVNode(c));
  29614. }
  29615. } else {
  29616. if (isTextNode(c) && isTextNode(last)) {
  29617. // merge adjacent text nodes
  29618. res[res.length - 1] = createTextVNode(last.text + c.text);
  29619. } else {
  29620. // default key for nested array children (likely generated by v-for)
  29621. if (isTrue(children._isVList) &&
  29622. isDef(c.tag) &&
  29623. isUndef(c.key) &&
  29624. isDef(nestedIndex)) {
  29625. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  29626. }
  29627. res.push(c);
  29628. }
  29629. }
  29630. }
  29631. return res
  29632. }
  29633. /* */
  29634. function ensureCtor (comp, base) {
  29635. if (comp.__esModule && comp.default) {
  29636. comp = comp.default;
  29637. }
  29638. return isObject(comp)
  29639. ? base.extend(comp)
  29640. : comp
  29641. }
  29642. function createAsyncPlaceholder (
  29643. factory,
  29644. data,
  29645. context,
  29646. children,
  29647. tag
  29648. ) {
  29649. var node = createEmptyVNode();
  29650. node.asyncFactory = factory;
  29651. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  29652. return node
  29653. }
  29654. function resolveAsyncComponent (
  29655. factory,
  29656. baseCtor,
  29657. context
  29658. ) {
  29659. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  29660. return factory.errorComp
  29661. }
  29662. if (isDef(factory.resolved)) {
  29663. return factory.resolved
  29664. }
  29665. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  29666. return factory.loadingComp
  29667. }
  29668. if (isDef(factory.contexts)) {
  29669. // already pending
  29670. factory.contexts.push(context);
  29671. } else {
  29672. var contexts = factory.contexts = [context];
  29673. var sync = true;
  29674. var forceRender = function () {
  29675. for (var i = 0, l = contexts.length; i < l; i++) {
  29676. contexts[i].$forceUpdate();
  29677. }
  29678. };
  29679. var resolve = once(function (res) {
  29680. // cache resolved
  29681. factory.resolved = ensureCtor(res, baseCtor);
  29682. // invoke callbacks only if this is not a synchronous resolve
  29683. // (async resolves are shimmed as synchronous during SSR)
  29684. if (!sync) {
  29685. forceRender();
  29686. }
  29687. });
  29688. var reject = once(function (reason) {
  29689. "development" !== 'production' && warn(
  29690. "Failed to resolve async component: " + (String(factory)) +
  29691. (reason ? ("\nReason: " + reason) : '')
  29692. );
  29693. if (isDef(factory.errorComp)) {
  29694. factory.error = true;
  29695. forceRender();
  29696. }
  29697. });
  29698. var res = factory(resolve, reject);
  29699. if (isObject(res)) {
  29700. if (typeof res.then === 'function') {
  29701. // () => Promise
  29702. if (isUndef(factory.resolved)) {
  29703. res.then(resolve, reject);
  29704. }
  29705. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  29706. res.component.then(resolve, reject);
  29707. if (isDef(res.error)) {
  29708. factory.errorComp = ensureCtor(res.error, baseCtor);
  29709. }
  29710. if (isDef(res.loading)) {
  29711. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  29712. if (res.delay === 0) {
  29713. factory.loading = true;
  29714. } else {
  29715. setTimeout(function () {
  29716. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  29717. factory.loading = true;
  29718. forceRender();
  29719. }
  29720. }, res.delay || 200);
  29721. }
  29722. }
  29723. if (isDef(res.timeout)) {
  29724. setTimeout(function () {
  29725. if (isUndef(factory.resolved)) {
  29726. reject(
  29727. true
  29728. ? ("timeout (" + (res.timeout) + "ms)")
  29729. : null
  29730. );
  29731. }
  29732. }, res.timeout);
  29733. }
  29734. }
  29735. }
  29736. sync = false;
  29737. // return in case resolved synchronously
  29738. return factory.loading
  29739. ? factory.loadingComp
  29740. : factory.resolved
  29741. }
  29742. }
  29743. /* */
  29744. function getFirstComponentChild (children) {
  29745. if (Array.isArray(children)) {
  29746. for (var i = 0; i < children.length; i++) {
  29747. var c = children[i];
  29748. if (isDef(c) && isDef(c.componentOptions)) {
  29749. return c
  29750. }
  29751. }
  29752. }
  29753. }
  29754. /* */
  29755. /* */
  29756. function initEvents (vm) {
  29757. vm._events = Object.create(null);
  29758. vm._hasHookEvent = false;
  29759. // init parent attached events
  29760. var listeners = vm.$options._parentListeners;
  29761. if (listeners) {
  29762. updateComponentListeners(vm, listeners);
  29763. }
  29764. }
  29765. var target;
  29766. function add (event, fn, once$$1) {
  29767. if (once$$1) {
  29768. target.$once(event, fn);
  29769. } else {
  29770. target.$on(event, fn);
  29771. }
  29772. }
  29773. function remove$1 (event, fn) {
  29774. target.$off(event, fn);
  29775. }
  29776. function updateComponentListeners (
  29777. vm,
  29778. listeners,
  29779. oldListeners
  29780. ) {
  29781. target = vm;
  29782. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  29783. }
  29784. function eventsMixin (Vue) {
  29785. var hookRE = /^hook:/;
  29786. Vue.prototype.$on = function (event, fn) {
  29787. var this$1 = this;
  29788. var vm = this;
  29789. if (Array.isArray(event)) {
  29790. for (var i = 0, l = event.length; i < l; i++) {
  29791. this$1.$on(event[i], fn);
  29792. }
  29793. } else {
  29794. (vm._events[event] || (vm._events[event] = [])).push(fn);
  29795. // optimize hook:event cost by using a boolean flag marked at registration
  29796. // instead of a hash lookup
  29797. if (hookRE.test(event)) {
  29798. vm._hasHookEvent = true;
  29799. }
  29800. }
  29801. return vm
  29802. };
  29803. Vue.prototype.$once = function (event, fn) {
  29804. var vm = this;
  29805. function on () {
  29806. vm.$off(event, on);
  29807. fn.apply(vm, arguments);
  29808. }
  29809. on.fn = fn;
  29810. vm.$on(event, on);
  29811. return vm
  29812. };
  29813. Vue.prototype.$off = function (event, fn) {
  29814. var this$1 = this;
  29815. var vm = this;
  29816. // all
  29817. if (!arguments.length) {
  29818. vm._events = Object.create(null);
  29819. return vm
  29820. }
  29821. // array of events
  29822. if (Array.isArray(event)) {
  29823. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  29824. this$1.$off(event[i$1], fn);
  29825. }
  29826. return vm
  29827. }
  29828. // specific event
  29829. var cbs = vm._events[event];
  29830. if (!cbs) {
  29831. return vm
  29832. }
  29833. if (arguments.length === 1) {
  29834. vm._events[event] = null;
  29835. return vm
  29836. }
  29837. // specific handler
  29838. var cb;
  29839. var i = cbs.length;
  29840. while (i--) {
  29841. cb = cbs[i];
  29842. if (cb === fn || cb.fn === fn) {
  29843. cbs.splice(i, 1);
  29844. break
  29845. }
  29846. }
  29847. return vm
  29848. };
  29849. Vue.prototype.$emit = function (event) {
  29850. var vm = this;
  29851. if (true) {
  29852. var lowerCaseEvent = event.toLowerCase();
  29853. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  29854. tip(
  29855. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  29856. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  29857. "Note that HTML attributes are case-insensitive and you cannot use " +
  29858. "v-on to listen to camelCase events when using in-DOM templates. " +
  29859. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  29860. );
  29861. }
  29862. }
  29863. var cbs = vm._events[event];
  29864. if (cbs) {
  29865. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  29866. var args = toArray(arguments, 1);
  29867. for (var i = 0, l = cbs.length; i < l; i++) {
  29868. try {
  29869. cbs[i].apply(vm, args);
  29870. } catch (e) {
  29871. handleError(e, vm, ("event handler for \"" + event + "\""));
  29872. }
  29873. }
  29874. }
  29875. return vm
  29876. };
  29877. }
  29878. /* */
  29879. /**
  29880. * Runtime helper for resolving raw children VNodes into a slot object.
  29881. */
  29882. function resolveSlots (
  29883. children,
  29884. context
  29885. ) {
  29886. var slots = {};
  29887. if (!children) {
  29888. return slots
  29889. }
  29890. var defaultSlot = [];
  29891. for (var i = 0, l = children.length; i < l; i++) {
  29892. var child = children[i];
  29893. // named slots should only be respected if the vnode was rendered in the
  29894. // same context.
  29895. if ((child.context === context || child.functionalContext === context) &&
  29896. child.data && child.data.slot != null
  29897. ) {
  29898. var name = child.data.slot;
  29899. var slot = (slots[name] || (slots[name] = []));
  29900. if (child.tag === 'template') {
  29901. slot.push.apply(slot, child.children);
  29902. } else {
  29903. slot.push(child);
  29904. }
  29905. } else {
  29906. defaultSlot.push(child);
  29907. }
  29908. }
  29909. // ignore whitespace
  29910. if (!defaultSlot.every(isWhitespace)) {
  29911. slots.default = defaultSlot;
  29912. }
  29913. return slots
  29914. }
  29915. function isWhitespace (node) {
  29916. return node.isComment || node.text === ' '
  29917. }
  29918. function resolveScopedSlots (
  29919. fns, // see flow/vnode
  29920. res
  29921. ) {
  29922. res = res || {};
  29923. for (var i = 0; i < fns.length; i++) {
  29924. if (Array.isArray(fns[i])) {
  29925. resolveScopedSlots(fns[i], res);
  29926. } else {
  29927. res[fns[i].key] = fns[i].fn;
  29928. }
  29929. }
  29930. return res
  29931. }
  29932. /* */
  29933. var activeInstance = null;
  29934. var isUpdatingChildComponent = false;
  29935. function initLifecycle (vm) {
  29936. var options = vm.$options;
  29937. // locate first non-abstract parent
  29938. var parent = options.parent;
  29939. if (parent && !options.abstract) {
  29940. while (parent.$options.abstract && parent.$parent) {
  29941. parent = parent.$parent;
  29942. }
  29943. parent.$children.push(vm);
  29944. }
  29945. vm.$parent = parent;
  29946. vm.$root = parent ? parent.$root : vm;
  29947. vm.$children = [];
  29948. vm.$refs = {};
  29949. vm._watcher = null;
  29950. vm._inactive = null;
  29951. vm._directInactive = false;
  29952. vm._isMounted = false;
  29953. vm._isDestroyed = false;
  29954. vm._isBeingDestroyed = false;
  29955. }
  29956. function lifecycleMixin (Vue) {
  29957. Vue.prototype._update = function (vnode, hydrating) {
  29958. var vm = this;
  29959. if (vm._isMounted) {
  29960. callHook(vm, 'beforeUpdate');
  29961. }
  29962. var prevEl = vm.$el;
  29963. var prevVnode = vm._vnode;
  29964. var prevActiveInstance = activeInstance;
  29965. activeInstance = vm;
  29966. vm._vnode = vnode;
  29967. // Vue.prototype.__patch__ is injected in entry points
  29968. // based on the rendering backend used.
  29969. if (!prevVnode) {
  29970. // initial render
  29971. vm.$el = vm.__patch__(
  29972. vm.$el, vnode, hydrating, false /* removeOnly */,
  29973. vm.$options._parentElm,
  29974. vm.$options._refElm
  29975. );
  29976. // no need for the ref nodes after initial patch
  29977. // this prevents keeping a detached DOM tree in memory (#5851)
  29978. vm.$options._parentElm = vm.$options._refElm = null;
  29979. } else {
  29980. // updates
  29981. vm.$el = vm.__patch__(prevVnode, vnode);
  29982. }
  29983. activeInstance = prevActiveInstance;
  29984. // update __vue__ reference
  29985. if (prevEl) {
  29986. prevEl.__vue__ = null;
  29987. }
  29988. if (vm.$el) {
  29989. vm.$el.__vue__ = vm;
  29990. }
  29991. // if parent is an HOC, update its $el as well
  29992. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  29993. vm.$parent.$el = vm.$el;
  29994. }
  29995. // updated hook is called by the scheduler to ensure that children are
  29996. // updated in a parent's updated hook.
  29997. };
  29998. Vue.prototype.$forceUpdate = function () {
  29999. var vm = this;
  30000. if (vm._watcher) {
  30001. vm._watcher.update();
  30002. }
  30003. };
  30004. Vue.prototype.$destroy = function () {
  30005. var vm = this;
  30006. if (vm._isBeingDestroyed) {
  30007. return
  30008. }
  30009. callHook(vm, 'beforeDestroy');
  30010. vm._isBeingDestroyed = true;
  30011. // remove self from parent
  30012. var parent = vm.$parent;
  30013. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  30014. remove(parent.$children, vm);
  30015. }
  30016. // teardown watchers
  30017. if (vm._watcher) {
  30018. vm._watcher.teardown();
  30019. }
  30020. var i = vm._watchers.length;
  30021. while (i--) {
  30022. vm._watchers[i].teardown();
  30023. }
  30024. // remove reference from data ob
  30025. // frozen object may not have observer.
  30026. if (vm._data.__ob__) {
  30027. vm._data.__ob__.vmCount--;
  30028. }
  30029. // call the last hook...
  30030. vm._isDestroyed = true;
  30031. // invoke destroy hooks on current rendered tree
  30032. vm.__patch__(vm._vnode, null);
  30033. // fire destroyed hook
  30034. callHook(vm, 'destroyed');
  30035. // turn off all instance listeners.
  30036. vm.$off();
  30037. // remove __vue__ reference
  30038. if (vm.$el) {
  30039. vm.$el.__vue__ = null;
  30040. }
  30041. };
  30042. }
  30043. function mountComponent (
  30044. vm,
  30045. el,
  30046. hydrating
  30047. ) {
  30048. vm.$el = el;
  30049. if (!vm.$options.render) {
  30050. vm.$options.render = createEmptyVNode;
  30051. if (true) {
  30052. /* istanbul ignore if */
  30053. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  30054. vm.$options.el || el) {
  30055. warn(
  30056. 'You are using the runtime-only build of Vue where the template ' +
  30057. 'compiler is not available. Either pre-compile the templates into ' +
  30058. 'render functions, or use the compiler-included build.',
  30059. vm
  30060. );
  30061. } else {
  30062. warn(
  30063. 'Failed to mount component: template or render function not defined.',
  30064. vm
  30065. );
  30066. }
  30067. }
  30068. }
  30069. callHook(vm, 'beforeMount');
  30070. var updateComponent;
  30071. /* istanbul ignore if */
  30072. if ("development" !== 'production' && config.performance && mark) {
  30073. updateComponent = function () {
  30074. var name = vm._name;
  30075. var id = vm._uid;
  30076. var startTag = "vue-perf-start:" + id;
  30077. var endTag = "vue-perf-end:" + id;
  30078. mark(startTag);
  30079. var vnode = vm._render();
  30080. mark(endTag);
  30081. measure((name + " render"), startTag, endTag);
  30082. mark(startTag);
  30083. vm._update(vnode, hydrating);
  30084. mark(endTag);
  30085. measure((name + " patch"), startTag, endTag);
  30086. };
  30087. } else {
  30088. updateComponent = function () {
  30089. vm._update(vm._render(), hydrating);
  30090. };
  30091. }
  30092. vm._watcher = new Watcher(vm, updateComponent, noop);
  30093. hydrating = false;
  30094. // manually mounted instance, call mounted on self
  30095. // mounted is called for render-created child components in its inserted hook
  30096. if (vm.$vnode == null) {
  30097. vm._isMounted = true;
  30098. callHook(vm, 'mounted');
  30099. }
  30100. return vm
  30101. }
  30102. function updateChildComponent (
  30103. vm,
  30104. propsData,
  30105. listeners,
  30106. parentVnode,
  30107. renderChildren
  30108. ) {
  30109. if (true) {
  30110. isUpdatingChildComponent = true;
  30111. }
  30112. // determine whether component has slot children
  30113. // we need to do this before overwriting $options._renderChildren
  30114. var hasChildren = !!(
  30115. renderChildren || // has new static slots
  30116. vm.$options._renderChildren || // has old static slots
  30117. parentVnode.data.scopedSlots || // has new scoped slots
  30118. vm.$scopedSlots !== emptyObject // has old scoped slots
  30119. );
  30120. vm.$options._parentVnode = parentVnode;
  30121. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  30122. if (vm._vnode) { // update child tree's parent
  30123. vm._vnode.parent = parentVnode;
  30124. }
  30125. vm.$options._renderChildren = renderChildren;
  30126. // update $attrs and $listensers hash
  30127. // these are also reactive so they may trigger child update if the child
  30128. // used them during render
  30129. vm.$attrs = parentVnode.data && parentVnode.data.attrs;
  30130. vm.$listeners = listeners;
  30131. // update props
  30132. if (propsData && vm.$options.props) {
  30133. observerState.shouldConvert = false;
  30134. var props = vm._props;
  30135. var propKeys = vm.$options._propKeys || [];
  30136. for (var i = 0; i < propKeys.length; i++) {
  30137. var key = propKeys[i];
  30138. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  30139. }
  30140. observerState.shouldConvert = true;
  30141. // keep a copy of raw propsData
  30142. vm.$options.propsData = propsData;
  30143. }
  30144. // update listeners
  30145. if (listeners) {
  30146. var oldListeners = vm.$options._parentListeners;
  30147. vm.$options._parentListeners = listeners;
  30148. updateComponentListeners(vm, listeners, oldListeners);
  30149. }
  30150. // resolve slots + force update if has children
  30151. if (hasChildren) {
  30152. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  30153. vm.$forceUpdate();
  30154. }
  30155. if (true) {
  30156. isUpdatingChildComponent = false;
  30157. }
  30158. }
  30159. function isInInactiveTree (vm) {
  30160. while (vm && (vm = vm.$parent)) {
  30161. if (vm._inactive) { return true }
  30162. }
  30163. return false
  30164. }
  30165. function activateChildComponent (vm, direct) {
  30166. if (direct) {
  30167. vm._directInactive = false;
  30168. if (isInInactiveTree(vm)) {
  30169. return
  30170. }
  30171. } else if (vm._directInactive) {
  30172. return
  30173. }
  30174. if (vm._inactive || vm._inactive === null) {
  30175. vm._inactive = false;
  30176. for (var i = 0; i < vm.$children.length; i++) {
  30177. activateChildComponent(vm.$children[i]);
  30178. }
  30179. callHook(vm, 'activated');
  30180. }
  30181. }
  30182. function deactivateChildComponent (vm, direct) {
  30183. if (direct) {
  30184. vm._directInactive = true;
  30185. if (isInInactiveTree(vm)) {
  30186. return
  30187. }
  30188. }
  30189. if (!vm._inactive) {
  30190. vm._inactive = true;
  30191. for (var i = 0; i < vm.$children.length; i++) {
  30192. deactivateChildComponent(vm.$children[i]);
  30193. }
  30194. callHook(vm, 'deactivated');
  30195. }
  30196. }
  30197. function callHook (vm, hook) {
  30198. var handlers = vm.$options[hook];
  30199. if (handlers) {
  30200. for (var i = 0, j = handlers.length; i < j; i++) {
  30201. try {
  30202. handlers[i].call(vm);
  30203. } catch (e) {
  30204. handleError(e, vm, (hook + " hook"));
  30205. }
  30206. }
  30207. }
  30208. if (vm._hasHookEvent) {
  30209. vm.$emit('hook:' + hook);
  30210. }
  30211. }
  30212. /* */
  30213. var MAX_UPDATE_COUNT = 100;
  30214. var queue = [];
  30215. var activatedChildren = [];
  30216. var has = {};
  30217. var circular = {};
  30218. var waiting = false;
  30219. var flushing = false;
  30220. var index = 0;
  30221. /**
  30222. * Reset the scheduler's state.
  30223. */
  30224. function resetSchedulerState () {
  30225. index = queue.length = activatedChildren.length = 0;
  30226. has = {};
  30227. if (true) {
  30228. circular = {};
  30229. }
  30230. waiting = flushing = false;
  30231. }
  30232. /**
  30233. * Flush both queues and run the watchers.
  30234. */
  30235. function flushSchedulerQueue () {
  30236. flushing = true;
  30237. var watcher, id;
  30238. // Sort queue before flush.
  30239. // This ensures that:
  30240. // 1. Components are updated from parent to child. (because parent is always
  30241. // created before the child)
  30242. // 2. A component's user watchers are run before its render watcher (because
  30243. // user watchers are created before the render watcher)
  30244. // 3. If a component is destroyed during a parent component's watcher run,
  30245. // its watchers can be skipped.
  30246. queue.sort(function (a, b) { return a.id - b.id; });
  30247. // do not cache length because more watchers might be pushed
  30248. // as we run existing watchers
  30249. for (index = 0; index < queue.length; index++) {
  30250. watcher = queue[index];
  30251. id = watcher.id;
  30252. has[id] = null;
  30253. watcher.run();
  30254. // in dev build, check and stop circular updates.
  30255. if ("development" !== 'production' && has[id] != null) {
  30256. circular[id] = (circular[id] || 0) + 1;
  30257. if (circular[id] > MAX_UPDATE_COUNT) {
  30258. warn(
  30259. 'You may have an infinite update loop ' + (
  30260. watcher.user
  30261. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  30262. : "in a component render function."
  30263. ),
  30264. watcher.vm
  30265. );
  30266. break
  30267. }
  30268. }
  30269. }
  30270. // keep copies of post queues before resetting state
  30271. var activatedQueue = activatedChildren.slice();
  30272. var updatedQueue = queue.slice();
  30273. resetSchedulerState();
  30274. // call component updated and activated hooks
  30275. callActivatedHooks(activatedQueue);
  30276. callUpdatedHooks(updatedQueue);
  30277. // devtool hook
  30278. /* istanbul ignore if */
  30279. if (devtools && config.devtools) {
  30280. devtools.emit('flush');
  30281. }
  30282. }
  30283. function callUpdatedHooks (queue) {
  30284. var i = queue.length;
  30285. while (i--) {
  30286. var watcher = queue[i];
  30287. var vm = watcher.vm;
  30288. if (vm._watcher === watcher && vm._isMounted) {
  30289. callHook(vm, 'updated');
  30290. }
  30291. }
  30292. }
  30293. /**
  30294. * Queue a kept-alive component that was activated during patch.
  30295. * The queue will be processed after the entire tree has been patched.
  30296. */
  30297. function queueActivatedComponent (vm) {
  30298. // setting _inactive to false here so that a render function can
  30299. // rely on checking whether it's in an inactive tree (e.g. router-view)
  30300. vm._inactive = false;
  30301. activatedChildren.push(vm);
  30302. }
  30303. function callActivatedHooks (queue) {
  30304. for (var i = 0; i < queue.length; i++) {
  30305. queue[i]._inactive = true;
  30306. activateChildComponent(queue[i], true /* true */);
  30307. }
  30308. }
  30309. /**
  30310. * Push a watcher into the watcher queue.
  30311. * Jobs with duplicate IDs will be skipped unless it's
  30312. * pushed when the queue is being flushed.
  30313. */
  30314. function queueWatcher (watcher) {
  30315. var id = watcher.id;
  30316. if (has[id] == null) {
  30317. has[id] = true;
  30318. if (!flushing) {
  30319. queue.push(watcher);
  30320. } else {
  30321. // if already flushing, splice the watcher based on its id
  30322. // if already past its id, it will be run next immediately.
  30323. var i = queue.length - 1;
  30324. while (i > index && queue[i].id > watcher.id) {
  30325. i--;
  30326. }
  30327. queue.splice(i + 1, 0, watcher);
  30328. }
  30329. // queue the flush
  30330. if (!waiting) {
  30331. waiting = true;
  30332. nextTick(flushSchedulerQueue);
  30333. }
  30334. }
  30335. }
  30336. /* */
  30337. var uid$2 = 0;
  30338. /**
  30339. * A watcher parses an expression, collects dependencies,
  30340. * and fires callback when the expression value changes.
  30341. * This is used for both the $watch() api and directives.
  30342. */
  30343. var Watcher = function Watcher (
  30344. vm,
  30345. expOrFn,
  30346. cb,
  30347. options
  30348. ) {
  30349. this.vm = vm;
  30350. vm._watchers.push(this);
  30351. // options
  30352. if (options) {
  30353. this.deep = !!options.deep;
  30354. this.user = !!options.user;
  30355. this.lazy = !!options.lazy;
  30356. this.sync = !!options.sync;
  30357. } else {
  30358. this.deep = this.user = this.lazy = this.sync = false;
  30359. }
  30360. this.cb = cb;
  30361. this.id = ++uid$2; // uid for batching
  30362. this.active = true;
  30363. this.dirty = this.lazy; // for lazy watchers
  30364. this.deps = [];
  30365. this.newDeps = [];
  30366. this.depIds = new _Set();
  30367. this.newDepIds = new _Set();
  30368. this.expression = true
  30369. ? expOrFn.toString()
  30370. : '';
  30371. // parse expression for getter
  30372. if (typeof expOrFn === 'function') {
  30373. this.getter = expOrFn;
  30374. } else {
  30375. this.getter = parsePath(expOrFn);
  30376. if (!this.getter) {
  30377. this.getter = function () {};
  30378. "development" !== 'production' && warn(
  30379. "Failed watching path: \"" + expOrFn + "\" " +
  30380. 'Watcher only accepts simple dot-delimited paths. ' +
  30381. 'For full control, use a function instead.',
  30382. vm
  30383. );
  30384. }
  30385. }
  30386. this.value = this.lazy
  30387. ? undefined
  30388. : this.get();
  30389. };
  30390. /**
  30391. * Evaluate the getter, and re-collect dependencies.
  30392. */
  30393. Watcher.prototype.get = function get () {
  30394. pushTarget(this);
  30395. var value;
  30396. var vm = this.vm;
  30397. try {
  30398. value = this.getter.call(vm, vm);
  30399. } catch (e) {
  30400. if (this.user) {
  30401. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  30402. } else {
  30403. throw e
  30404. }
  30405. } finally {
  30406. // "touch" every property so they are all tracked as
  30407. // dependencies for deep watching
  30408. if (this.deep) {
  30409. traverse(value);
  30410. }
  30411. popTarget();
  30412. this.cleanupDeps();
  30413. }
  30414. return value
  30415. };
  30416. /**
  30417. * Add a dependency to this directive.
  30418. */
  30419. Watcher.prototype.addDep = function addDep (dep) {
  30420. var id = dep.id;
  30421. if (!this.newDepIds.has(id)) {
  30422. this.newDepIds.add(id);
  30423. this.newDeps.push(dep);
  30424. if (!this.depIds.has(id)) {
  30425. dep.addSub(this);
  30426. }
  30427. }
  30428. };
  30429. /**
  30430. * Clean up for dependency collection.
  30431. */
  30432. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  30433. var this$1 = this;
  30434. var i = this.deps.length;
  30435. while (i--) {
  30436. var dep = this$1.deps[i];
  30437. if (!this$1.newDepIds.has(dep.id)) {
  30438. dep.removeSub(this$1);
  30439. }
  30440. }
  30441. var tmp = this.depIds;
  30442. this.depIds = this.newDepIds;
  30443. this.newDepIds = tmp;
  30444. this.newDepIds.clear();
  30445. tmp = this.deps;
  30446. this.deps = this.newDeps;
  30447. this.newDeps = tmp;
  30448. this.newDeps.length = 0;
  30449. };
  30450. /**
  30451. * Subscriber interface.
  30452. * Will be called when a dependency changes.
  30453. */
  30454. Watcher.prototype.update = function update () {
  30455. /* istanbul ignore else */
  30456. if (this.lazy) {
  30457. this.dirty = true;
  30458. } else if (this.sync) {
  30459. this.run();
  30460. } else {
  30461. queueWatcher(this);
  30462. }
  30463. };
  30464. /**
  30465. * Scheduler job interface.
  30466. * Will be called by the scheduler.
  30467. */
  30468. Watcher.prototype.run = function run () {
  30469. if (this.active) {
  30470. var value = this.get();
  30471. if (
  30472. value !== this.value ||
  30473. // Deep watchers and watchers on Object/Arrays should fire even
  30474. // when the value is the same, because the value may
  30475. // have mutated.
  30476. isObject(value) ||
  30477. this.deep
  30478. ) {
  30479. // set new value
  30480. var oldValue = this.value;
  30481. this.value = value;
  30482. if (this.user) {
  30483. try {
  30484. this.cb.call(this.vm, value, oldValue);
  30485. } catch (e) {
  30486. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  30487. }
  30488. } else {
  30489. this.cb.call(this.vm, value, oldValue);
  30490. }
  30491. }
  30492. }
  30493. };
  30494. /**
  30495. * Evaluate the value of the watcher.
  30496. * This only gets called for lazy watchers.
  30497. */
  30498. Watcher.prototype.evaluate = function evaluate () {
  30499. this.value = this.get();
  30500. this.dirty = false;
  30501. };
  30502. /**
  30503. * Depend on all deps collected by this watcher.
  30504. */
  30505. Watcher.prototype.depend = function depend () {
  30506. var this$1 = this;
  30507. var i = this.deps.length;
  30508. while (i--) {
  30509. this$1.deps[i].depend();
  30510. }
  30511. };
  30512. /**
  30513. * Remove self from all dependencies' subscriber list.
  30514. */
  30515. Watcher.prototype.teardown = function teardown () {
  30516. var this$1 = this;
  30517. if (this.active) {
  30518. // remove self from vm's watcher list
  30519. // this is a somewhat expensive operation so we skip it
  30520. // if the vm is being destroyed.
  30521. if (!this.vm._isBeingDestroyed) {
  30522. remove(this.vm._watchers, this);
  30523. }
  30524. var i = this.deps.length;
  30525. while (i--) {
  30526. this$1.deps[i].removeSub(this$1);
  30527. }
  30528. this.active = false;
  30529. }
  30530. };
  30531. /**
  30532. * Recursively traverse an object to evoke all converted
  30533. * getters, so that every nested property inside the object
  30534. * is collected as a "deep" dependency.
  30535. */
  30536. var seenObjects = new _Set();
  30537. function traverse (val) {
  30538. seenObjects.clear();
  30539. _traverse(val, seenObjects);
  30540. }
  30541. function _traverse (val, seen) {
  30542. var i, keys;
  30543. var isA = Array.isArray(val);
  30544. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  30545. return
  30546. }
  30547. if (val.__ob__) {
  30548. var depId = val.__ob__.dep.id;
  30549. if (seen.has(depId)) {
  30550. return
  30551. }
  30552. seen.add(depId);
  30553. }
  30554. if (isA) {
  30555. i = val.length;
  30556. while (i--) { _traverse(val[i], seen); }
  30557. } else {
  30558. keys = Object.keys(val);
  30559. i = keys.length;
  30560. while (i--) { _traverse(val[keys[i]], seen); }
  30561. }
  30562. }
  30563. /* */
  30564. var sharedPropertyDefinition = {
  30565. enumerable: true,
  30566. configurable: true,
  30567. get: noop,
  30568. set: noop
  30569. };
  30570. function proxy (target, sourceKey, key) {
  30571. sharedPropertyDefinition.get = function proxyGetter () {
  30572. return this[sourceKey][key]
  30573. };
  30574. sharedPropertyDefinition.set = function proxySetter (val) {
  30575. this[sourceKey][key] = val;
  30576. };
  30577. Object.defineProperty(target, key, sharedPropertyDefinition);
  30578. }
  30579. function initState (vm) {
  30580. vm._watchers = [];
  30581. var opts = vm.$options;
  30582. if (opts.props) { initProps(vm, opts.props); }
  30583. if (opts.methods) { initMethods(vm, opts.methods); }
  30584. if (opts.data) {
  30585. initData(vm);
  30586. } else {
  30587. observe(vm._data = {}, true /* asRootData */);
  30588. }
  30589. if (opts.computed) { initComputed(vm, opts.computed); }
  30590. if (opts.watch && opts.watch !== nativeWatch) {
  30591. initWatch(vm, opts.watch);
  30592. }
  30593. }
  30594. function checkOptionType (vm, name) {
  30595. var option = vm.$options[name];
  30596. if (!isPlainObject(option)) {
  30597. warn(
  30598. ("component option \"" + name + "\" should be an object."),
  30599. vm
  30600. );
  30601. }
  30602. }
  30603. function initProps (vm, propsOptions) {
  30604. var propsData = vm.$options.propsData || {};
  30605. var props = vm._props = {};
  30606. // cache prop keys so that future props updates can iterate using Array
  30607. // instead of dynamic object key enumeration.
  30608. var keys = vm.$options._propKeys = [];
  30609. var isRoot = !vm.$parent;
  30610. // root instance props should be converted
  30611. observerState.shouldConvert = isRoot;
  30612. var loop = function ( key ) {
  30613. keys.push(key);
  30614. var value = validateProp(key, propsOptions, propsData, vm);
  30615. /* istanbul ignore else */
  30616. if (true) {
  30617. if (isReservedAttribute(key) || config.isReservedAttr(key)) {
  30618. warn(
  30619. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  30620. vm
  30621. );
  30622. }
  30623. defineReactive$$1(props, key, value, function () {
  30624. if (vm.$parent && !isUpdatingChildComponent) {
  30625. warn(
  30626. "Avoid mutating a prop directly since the value will be " +
  30627. "overwritten whenever the parent component re-renders. " +
  30628. "Instead, use a data or computed property based on the prop's " +
  30629. "value. Prop being mutated: \"" + key + "\"",
  30630. vm
  30631. );
  30632. }
  30633. });
  30634. } else {
  30635. defineReactive$$1(props, key, value);
  30636. }
  30637. // static props are already proxied on the component's prototype
  30638. // during Vue.extend(). We only need to proxy props defined at
  30639. // instantiation here.
  30640. if (!(key in vm)) {
  30641. proxy(vm, "_props", key);
  30642. }
  30643. };
  30644. for (var key in propsOptions) loop( key );
  30645. observerState.shouldConvert = true;
  30646. }
  30647. function initData (vm) {
  30648. var data = vm.$options.data;
  30649. data = vm._data = typeof data === 'function'
  30650. ? getData(data, vm)
  30651. : data || {};
  30652. if (!isPlainObject(data)) {
  30653. data = {};
  30654. "development" !== 'production' && warn(
  30655. 'data functions should return an object:\n' +
  30656. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  30657. vm
  30658. );
  30659. }
  30660. // proxy data on instance
  30661. var keys = Object.keys(data);
  30662. var props = vm.$options.props;
  30663. var methods = vm.$options.methods;
  30664. var i = keys.length;
  30665. while (i--) {
  30666. var key = keys[i];
  30667. if (true) {
  30668. if (methods && hasOwn(methods, key)) {
  30669. warn(
  30670. ("method \"" + key + "\" has already been defined as a data property."),
  30671. vm
  30672. );
  30673. }
  30674. }
  30675. if (props && hasOwn(props, key)) {
  30676. "development" !== 'production' && warn(
  30677. "The data property \"" + key + "\" is already declared as a prop. " +
  30678. "Use prop default value instead.",
  30679. vm
  30680. );
  30681. } else if (!isReserved(key)) {
  30682. proxy(vm, "_data", key);
  30683. }
  30684. }
  30685. // observe data
  30686. observe(data, true /* asRootData */);
  30687. }
  30688. function getData (data, vm) {
  30689. try {
  30690. return data.call(vm)
  30691. } catch (e) {
  30692. handleError(e, vm, "data()");
  30693. return {}
  30694. }
  30695. }
  30696. var computedWatcherOptions = { lazy: true };
  30697. function initComputed (vm, computed) {
  30698. "development" !== 'production' && checkOptionType(vm, 'computed');
  30699. var watchers = vm._computedWatchers = Object.create(null);
  30700. for (var key in computed) {
  30701. var userDef = computed[key];
  30702. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  30703. if ("development" !== 'production' && getter == null) {
  30704. warn(
  30705. ("Getter is missing for computed property \"" + key + "\"."),
  30706. vm
  30707. );
  30708. }
  30709. // create internal watcher for the computed property.
  30710. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  30711. // component-defined computed properties are already defined on the
  30712. // component prototype. We only need to define computed properties defined
  30713. // at instantiation here.
  30714. if (!(key in vm)) {
  30715. defineComputed(vm, key, userDef);
  30716. } else if (true) {
  30717. if (key in vm.$data) {
  30718. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  30719. } else if (vm.$options.props && key in vm.$options.props) {
  30720. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  30721. }
  30722. }
  30723. }
  30724. }
  30725. function defineComputed (target, key, userDef) {
  30726. if (typeof userDef === 'function') {
  30727. sharedPropertyDefinition.get = createComputedGetter(key);
  30728. sharedPropertyDefinition.set = noop;
  30729. } else {
  30730. sharedPropertyDefinition.get = userDef.get
  30731. ? userDef.cache !== false
  30732. ? createComputedGetter(key)
  30733. : userDef.get
  30734. : noop;
  30735. sharedPropertyDefinition.set = userDef.set
  30736. ? userDef.set
  30737. : noop;
  30738. }
  30739. if ("development" !== 'production' &&
  30740. sharedPropertyDefinition.set === noop) {
  30741. sharedPropertyDefinition.set = function () {
  30742. warn(
  30743. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  30744. this
  30745. );
  30746. };
  30747. }
  30748. Object.defineProperty(target, key, sharedPropertyDefinition);
  30749. }
  30750. function createComputedGetter (key) {
  30751. return function computedGetter () {
  30752. var watcher = this._computedWatchers && this._computedWatchers[key];
  30753. if (watcher) {
  30754. if (watcher.dirty) {
  30755. watcher.evaluate();
  30756. }
  30757. if (Dep.target) {
  30758. watcher.depend();
  30759. }
  30760. return watcher.value
  30761. }
  30762. }
  30763. }
  30764. function initMethods (vm, methods) {
  30765. "development" !== 'production' && checkOptionType(vm, 'methods');
  30766. var props = vm.$options.props;
  30767. for (var key in methods) {
  30768. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  30769. if (true) {
  30770. if (methods[key] == null) {
  30771. warn(
  30772. "method \"" + key + "\" has an undefined value in the component definition. " +
  30773. "Did you reference the function correctly?",
  30774. vm
  30775. );
  30776. }
  30777. if (props && hasOwn(props, key)) {
  30778. warn(
  30779. ("method \"" + key + "\" has already been defined as a prop."),
  30780. vm
  30781. );
  30782. }
  30783. }
  30784. }
  30785. }
  30786. function initWatch (vm, watch) {
  30787. "development" !== 'production' && checkOptionType(vm, 'watch');
  30788. for (var key in watch) {
  30789. var handler = watch[key];
  30790. if (Array.isArray(handler)) {
  30791. for (var i = 0; i < handler.length; i++) {
  30792. createWatcher(vm, key, handler[i]);
  30793. }
  30794. } else {
  30795. createWatcher(vm, key, handler);
  30796. }
  30797. }
  30798. }
  30799. function createWatcher (
  30800. vm,
  30801. keyOrFn,
  30802. handler,
  30803. options
  30804. ) {
  30805. if (isPlainObject(handler)) {
  30806. options = handler;
  30807. handler = handler.handler;
  30808. }
  30809. if (typeof handler === 'string') {
  30810. handler = vm[handler];
  30811. }
  30812. return vm.$watch(keyOrFn, handler, options)
  30813. }
  30814. function stateMixin (Vue) {
  30815. // flow somehow has problems with directly declared definition object
  30816. // when using Object.defineProperty, so we have to procedurally build up
  30817. // the object here.
  30818. var dataDef = {};
  30819. dataDef.get = function () { return this._data };
  30820. var propsDef = {};
  30821. propsDef.get = function () { return this._props };
  30822. if (true) {
  30823. dataDef.set = function (newData) {
  30824. warn(
  30825. 'Avoid replacing instance root $data. ' +
  30826. 'Use nested data properties instead.',
  30827. this
  30828. );
  30829. };
  30830. propsDef.set = function () {
  30831. warn("$props is readonly.", this);
  30832. };
  30833. }
  30834. Object.defineProperty(Vue.prototype, '$data', dataDef);
  30835. Object.defineProperty(Vue.prototype, '$props', propsDef);
  30836. Vue.prototype.$set = set;
  30837. Vue.prototype.$delete = del;
  30838. Vue.prototype.$watch = function (
  30839. expOrFn,
  30840. cb,
  30841. options
  30842. ) {
  30843. var vm = this;
  30844. if (isPlainObject(cb)) {
  30845. return createWatcher(vm, expOrFn, cb, options)
  30846. }
  30847. options = options || {};
  30848. options.user = true;
  30849. var watcher = new Watcher(vm, expOrFn, cb, options);
  30850. if (options.immediate) {
  30851. cb.call(vm, watcher.value);
  30852. }
  30853. return function unwatchFn () {
  30854. watcher.teardown();
  30855. }
  30856. };
  30857. }
  30858. /* */
  30859. function initProvide (vm) {
  30860. var provide = vm.$options.provide;
  30861. if (provide) {
  30862. vm._provided = typeof provide === 'function'
  30863. ? provide.call(vm)
  30864. : provide;
  30865. }
  30866. }
  30867. function initInjections (vm) {
  30868. var result = resolveInject(vm.$options.inject, vm);
  30869. if (result) {
  30870. observerState.shouldConvert = false;
  30871. Object.keys(result).forEach(function (key) {
  30872. /* istanbul ignore else */
  30873. if (true) {
  30874. defineReactive$$1(vm, key, result[key], function () {
  30875. warn(
  30876. "Avoid mutating an injected value directly since the changes will be " +
  30877. "overwritten whenever the provided component re-renders. " +
  30878. "injection being mutated: \"" + key + "\"",
  30879. vm
  30880. );
  30881. });
  30882. } else {
  30883. defineReactive$$1(vm, key, result[key]);
  30884. }
  30885. });
  30886. observerState.shouldConvert = true;
  30887. }
  30888. }
  30889. function resolveInject (inject, vm) {
  30890. if (inject) {
  30891. // inject is :any because flow is not smart enough to figure out cached
  30892. var result = Object.create(null);
  30893. var keys = hasSymbol
  30894. ? Reflect.ownKeys(inject)
  30895. : Object.keys(inject);
  30896. for (var i = 0; i < keys.length; i++) {
  30897. var key = keys[i];
  30898. var provideKey = inject[key];
  30899. var source = vm;
  30900. while (source) {
  30901. if (source._provided && provideKey in source._provided) {
  30902. result[key] = source._provided[provideKey];
  30903. break
  30904. }
  30905. source = source.$parent;
  30906. }
  30907. if ("development" !== 'production' && !source) {
  30908. warn(("Injection \"" + key + "\" not found"), vm);
  30909. }
  30910. }
  30911. return result
  30912. }
  30913. }
  30914. /* */
  30915. function createFunctionalComponent (
  30916. Ctor,
  30917. propsData,
  30918. data,
  30919. context,
  30920. children
  30921. ) {
  30922. var props = {};
  30923. var propOptions = Ctor.options.props;
  30924. if (isDef(propOptions)) {
  30925. for (var key in propOptions) {
  30926. props[key] = validateProp(key, propOptions, propsData || {});
  30927. }
  30928. } else {
  30929. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  30930. if (isDef(data.props)) { mergeProps(props, data.props); }
  30931. }
  30932. // ensure the createElement function in functional components
  30933. // gets a unique context - this is necessary for correct named slot check
  30934. var _context = Object.create(context);
  30935. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  30936. var vnode = Ctor.options.render.call(null, h, {
  30937. data: data,
  30938. props: props,
  30939. children: children,
  30940. parent: context,
  30941. listeners: data.on || {},
  30942. injections: resolveInject(Ctor.options.inject, context),
  30943. slots: function () { return resolveSlots(children, context); }
  30944. });
  30945. if (vnode instanceof VNode) {
  30946. vnode.functionalContext = context;
  30947. vnode.functionalOptions = Ctor.options;
  30948. if (data.slot) {
  30949. (vnode.data || (vnode.data = {})).slot = data.slot;
  30950. }
  30951. }
  30952. return vnode
  30953. }
  30954. function mergeProps (to, from) {
  30955. for (var key in from) {
  30956. to[camelize(key)] = from[key];
  30957. }
  30958. }
  30959. /* */
  30960. // hooks to be invoked on component VNodes during patch
  30961. var componentVNodeHooks = {
  30962. init: function init (
  30963. vnode,
  30964. hydrating,
  30965. parentElm,
  30966. refElm
  30967. ) {
  30968. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  30969. var child = vnode.componentInstance = createComponentInstanceForVnode(
  30970. vnode,
  30971. activeInstance,
  30972. parentElm,
  30973. refElm
  30974. );
  30975. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  30976. } else if (vnode.data.keepAlive) {
  30977. // kept-alive components, treat as a patch
  30978. var mountedNode = vnode; // work around flow
  30979. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  30980. }
  30981. },
  30982. prepatch: function prepatch (oldVnode, vnode) {
  30983. var options = vnode.componentOptions;
  30984. var child = vnode.componentInstance = oldVnode.componentInstance;
  30985. updateChildComponent(
  30986. child,
  30987. options.propsData, // updated props
  30988. options.listeners, // updated listeners
  30989. vnode, // new parent vnode
  30990. options.children // new children
  30991. );
  30992. },
  30993. insert: function insert (vnode) {
  30994. var context = vnode.context;
  30995. var componentInstance = vnode.componentInstance;
  30996. if (!componentInstance._isMounted) {
  30997. componentInstance._isMounted = true;
  30998. callHook(componentInstance, 'mounted');
  30999. }
  31000. if (vnode.data.keepAlive) {
  31001. if (context._isMounted) {
  31002. // vue-router#1212
  31003. // During updates, a kept-alive component's child components may
  31004. // change, so directly walking the tree here may call activated hooks
  31005. // on incorrect children. Instead we push them into a queue which will
  31006. // be processed after the whole patch process ended.
  31007. queueActivatedComponent(componentInstance);
  31008. } else {
  31009. activateChildComponent(componentInstance, true /* direct */);
  31010. }
  31011. }
  31012. },
  31013. destroy: function destroy (vnode) {
  31014. var componentInstance = vnode.componentInstance;
  31015. if (!componentInstance._isDestroyed) {
  31016. if (!vnode.data.keepAlive) {
  31017. componentInstance.$destroy();
  31018. } else {
  31019. deactivateChildComponent(componentInstance, true /* direct */);
  31020. }
  31021. }
  31022. }
  31023. };
  31024. var hooksToMerge = Object.keys(componentVNodeHooks);
  31025. function createComponent (
  31026. Ctor,
  31027. data,
  31028. context,
  31029. children,
  31030. tag
  31031. ) {
  31032. if (isUndef(Ctor)) {
  31033. return
  31034. }
  31035. var baseCtor = context.$options._base;
  31036. // plain options object: turn it into a constructor
  31037. if (isObject(Ctor)) {
  31038. Ctor = baseCtor.extend(Ctor);
  31039. }
  31040. // if at this stage it's not a constructor or an async component factory,
  31041. // reject.
  31042. if (typeof Ctor !== 'function') {
  31043. if (true) {
  31044. warn(("Invalid Component definition: " + (String(Ctor))), context);
  31045. }
  31046. return
  31047. }
  31048. // async component
  31049. var asyncFactory;
  31050. if (isUndef(Ctor.cid)) {
  31051. asyncFactory = Ctor;
  31052. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  31053. if (Ctor === undefined) {
  31054. // return a placeholder node for async component, which is rendered
  31055. // as a comment node but preserves all the raw information for the node.
  31056. // the information will be used for async server-rendering and hydration.
  31057. return createAsyncPlaceholder(
  31058. asyncFactory,
  31059. data,
  31060. context,
  31061. children,
  31062. tag
  31063. )
  31064. }
  31065. }
  31066. data = data || {};
  31067. // resolve constructor options in case global mixins are applied after
  31068. // component constructor creation
  31069. resolveConstructorOptions(Ctor);
  31070. // transform component v-model data into props & events
  31071. if (isDef(data.model)) {
  31072. transformModel(Ctor.options, data);
  31073. }
  31074. // extract props
  31075. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  31076. // functional component
  31077. if (isTrue(Ctor.options.functional)) {
  31078. return createFunctionalComponent(Ctor, propsData, data, context, children)
  31079. }
  31080. // extract listeners, since these needs to be treated as
  31081. // child component listeners instead of DOM listeners
  31082. var listeners = data.on;
  31083. // replace with listeners with .native modifier
  31084. // so it gets processed during parent component patch.
  31085. data.on = data.nativeOn;
  31086. if (isTrue(Ctor.options.abstract)) {
  31087. // abstract components do not keep anything
  31088. // other than props & listeners & slot
  31089. // work around flow
  31090. var slot = data.slot;
  31091. data = {};
  31092. if (slot) {
  31093. data.slot = slot;
  31094. }
  31095. }
  31096. // merge component management hooks onto the placeholder node
  31097. mergeHooks(data);
  31098. // return a placeholder vnode
  31099. var name = Ctor.options.name || tag;
  31100. var vnode = new VNode(
  31101. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31102. data, undefined, undefined, undefined, context,
  31103. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31104. asyncFactory
  31105. );
  31106. return vnode
  31107. }
  31108. function createComponentInstanceForVnode (
  31109. vnode, // we know it's MountedComponentVNode but flow doesn't
  31110. parent, // activeInstance in lifecycle state
  31111. parentElm,
  31112. refElm
  31113. ) {
  31114. var vnodeComponentOptions = vnode.componentOptions;
  31115. var options = {
  31116. _isComponent: true,
  31117. parent: parent,
  31118. propsData: vnodeComponentOptions.propsData,
  31119. _componentTag: vnodeComponentOptions.tag,
  31120. _parentVnode: vnode,
  31121. _parentListeners: vnodeComponentOptions.listeners,
  31122. _renderChildren: vnodeComponentOptions.children,
  31123. _parentElm: parentElm || null,
  31124. _refElm: refElm || null
  31125. };
  31126. // check inline-template render functions
  31127. var inlineTemplate = vnode.data.inlineTemplate;
  31128. if (isDef(inlineTemplate)) {
  31129. options.render = inlineTemplate.render;
  31130. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31131. }
  31132. return new vnodeComponentOptions.Ctor(options)
  31133. }
  31134. function mergeHooks (data) {
  31135. if (!data.hook) {
  31136. data.hook = {};
  31137. }
  31138. for (var i = 0; i < hooksToMerge.length; i++) {
  31139. var key = hooksToMerge[i];
  31140. var fromParent = data.hook[key];
  31141. var ours = componentVNodeHooks[key];
  31142. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  31143. }
  31144. }
  31145. function mergeHook$1 (one, two) {
  31146. return function (a, b, c, d) {
  31147. one(a, b, c, d);
  31148. two(a, b, c, d);
  31149. }
  31150. }
  31151. // transform component v-model info (value and callback) into
  31152. // prop and event handler respectively.
  31153. function transformModel (options, data) {
  31154. var prop = (options.model && options.model.prop) || 'value';
  31155. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  31156. var on = data.on || (data.on = {});
  31157. if (isDef(on[event])) {
  31158. on[event] = [data.model.callback].concat(on[event]);
  31159. } else {
  31160. on[event] = data.model.callback;
  31161. }
  31162. }
  31163. /* */
  31164. var SIMPLE_NORMALIZE = 1;
  31165. var ALWAYS_NORMALIZE = 2;
  31166. // wrapper function for providing a more flexible interface
  31167. // without getting yelled at by flow
  31168. function createElement (
  31169. context,
  31170. tag,
  31171. data,
  31172. children,
  31173. normalizationType,
  31174. alwaysNormalize
  31175. ) {
  31176. if (Array.isArray(data) || isPrimitive(data)) {
  31177. normalizationType = children;
  31178. children = data;
  31179. data = undefined;
  31180. }
  31181. if (isTrue(alwaysNormalize)) {
  31182. normalizationType = ALWAYS_NORMALIZE;
  31183. }
  31184. return _createElement(context, tag, data, children, normalizationType)
  31185. }
  31186. function _createElement (
  31187. context,
  31188. tag,
  31189. data,
  31190. children,
  31191. normalizationType
  31192. ) {
  31193. if (isDef(data) && isDef((data).__ob__)) {
  31194. "development" !== 'production' && warn(
  31195. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31196. 'Always create fresh vnode data objects in each render!',
  31197. context
  31198. );
  31199. return createEmptyVNode()
  31200. }
  31201. // object syntax in v-bind
  31202. if (isDef(data) && isDef(data.is)) {
  31203. tag = data.is;
  31204. }
  31205. if (!tag) {
  31206. // in case of component :is set to falsy value
  31207. return createEmptyVNode()
  31208. }
  31209. // warn against non-primitive key
  31210. if ("development" !== 'production' &&
  31211. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31212. ) {
  31213. warn(
  31214. 'Avoid using non-primitive value as key, ' +
  31215. 'use string/number value instead.',
  31216. context
  31217. );
  31218. }
  31219. // support single function children as default scoped slot
  31220. if (Array.isArray(children) &&
  31221. typeof children[0] === 'function'
  31222. ) {
  31223. data = data || {};
  31224. data.scopedSlots = { default: children[0] };
  31225. children.length = 0;
  31226. }
  31227. if (normalizationType === ALWAYS_NORMALIZE) {
  31228. children = normalizeChildren(children);
  31229. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31230. children = simpleNormalizeChildren(children);
  31231. }
  31232. var vnode, ns;
  31233. if (typeof tag === 'string') {
  31234. var Ctor;
  31235. ns = config.getTagNamespace(tag);
  31236. if (config.isReservedTag(tag)) {
  31237. // platform built-in elements
  31238. vnode = new VNode(
  31239. config.parsePlatformTagName(tag), data, children,
  31240. undefined, undefined, context
  31241. );
  31242. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31243. // component
  31244. vnode = createComponent(Ctor, data, context, children, tag);
  31245. } else {
  31246. // unknown or unlisted namespaced elements
  31247. // check at runtime because it may get assigned a namespace when its
  31248. // parent normalizes children
  31249. vnode = new VNode(
  31250. tag, data, children,
  31251. undefined, undefined, context
  31252. );
  31253. }
  31254. } else {
  31255. // direct component options / constructor
  31256. vnode = createComponent(tag, data, context, children);
  31257. }
  31258. if (isDef(vnode)) {
  31259. if (ns) { applyNS(vnode, ns); }
  31260. return vnode
  31261. } else {
  31262. return createEmptyVNode()
  31263. }
  31264. }
  31265. function applyNS (vnode, ns) {
  31266. vnode.ns = ns;
  31267. if (vnode.tag === 'foreignObject') {
  31268. // use default namespace inside foreignObject
  31269. return
  31270. }
  31271. if (isDef(vnode.children)) {
  31272. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31273. var child = vnode.children[i];
  31274. if (isDef(child.tag) && isUndef(child.ns)) {
  31275. applyNS(child, ns);
  31276. }
  31277. }
  31278. }
  31279. }
  31280. /* */
  31281. /**
  31282. * Runtime helper for rendering v-for lists.
  31283. */
  31284. function renderList (
  31285. val,
  31286. render
  31287. ) {
  31288. var ret, i, l, keys, key;
  31289. if (Array.isArray(val) || typeof val === 'string') {
  31290. ret = new Array(val.length);
  31291. for (i = 0, l = val.length; i < l; i++) {
  31292. ret[i] = render(val[i], i);
  31293. }
  31294. } else if (typeof val === 'number') {
  31295. ret = new Array(val);
  31296. for (i = 0; i < val; i++) {
  31297. ret[i] = render(i + 1, i);
  31298. }
  31299. } else if (isObject(val)) {
  31300. keys = Object.keys(val);
  31301. ret = new Array(keys.length);
  31302. for (i = 0, l = keys.length; i < l; i++) {
  31303. key = keys[i];
  31304. ret[i] = render(val[key], key, i);
  31305. }
  31306. }
  31307. if (isDef(ret)) {
  31308. (ret)._isVList = true;
  31309. }
  31310. return ret
  31311. }
  31312. /* */
  31313. /**
  31314. * Runtime helper for rendering <slot>
  31315. */
  31316. function renderSlot (
  31317. name,
  31318. fallback,
  31319. props,
  31320. bindObject
  31321. ) {
  31322. var scopedSlotFn = this.$scopedSlots[name];
  31323. if (scopedSlotFn) { // scoped slot
  31324. props = props || {};
  31325. if (bindObject) {
  31326. props = extend(extend({}, bindObject), props);
  31327. }
  31328. return scopedSlotFn(props) || fallback
  31329. } else {
  31330. var slotNodes = this.$slots[name];
  31331. // warn duplicate slot usage
  31332. if (slotNodes && "development" !== 'production') {
  31333. slotNodes._rendered && warn(
  31334. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  31335. "- this will likely cause render errors.",
  31336. this
  31337. );
  31338. slotNodes._rendered = true;
  31339. }
  31340. return slotNodes || fallback
  31341. }
  31342. }
  31343. /* */
  31344. /**
  31345. * Runtime helper for resolving filters
  31346. */
  31347. function resolveFilter (id) {
  31348. return resolveAsset(this.$options, 'filters', id, true) || identity
  31349. }
  31350. /* */
  31351. /**
  31352. * Runtime helper for checking keyCodes from config.
  31353. */
  31354. function checkKeyCodes (
  31355. eventKeyCode,
  31356. key,
  31357. builtInAlias
  31358. ) {
  31359. var keyCodes = config.keyCodes[key] || builtInAlias;
  31360. if (Array.isArray(keyCodes)) {
  31361. return keyCodes.indexOf(eventKeyCode) === -1
  31362. } else {
  31363. return keyCodes !== eventKeyCode
  31364. }
  31365. }
  31366. /* */
  31367. /**
  31368. * Runtime helper for merging v-bind="object" into a VNode's data.
  31369. */
  31370. function bindObjectProps (
  31371. data,
  31372. tag,
  31373. value,
  31374. asProp,
  31375. isSync
  31376. ) {
  31377. if (value) {
  31378. if (!isObject(value)) {
  31379. "development" !== 'production' && warn(
  31380. 'v-bind without argument expects an Object or Array value',
  31381. this
  31382. );
  31383. } else {
  31384. if (Array.isArray(value)) {
  31385. value = toObject(value);
  31386. }
  31387. var hash;
  31388. var loop = function ( key ) {
  31389. if (
  31390. key === 'class' ||
  31391. key === 'style' ||
  31392. isReservedAttribute(key)
  31393. ) {
  31394. hash = data;
  31395. } else {
  31396. var type = data.attrs && data.attrs.type;
  31397. hash = asProp || config.mustUseProp(tag, type, key)
  31398. ? data.domProps || (data.domProps = {})
  31399. : data.attrs || (data.attrs = {});
  31400. }
  31401. if (!(key in hash)) {
  31402. hash[key] = value[key];
  31403. if (isSync) {
  31404. var on = data.on || (data.on = {});
  31405. on[("update:" + key)] = function ($event) {
  31406. value[key] = $event;
  31407. };
  31408. }
  31409. }
  31410. };
  31411. for (var key in value) loop( key );
  31412. }
  31413. }
  31414. return data
  31415. }
  31416. /* */
  31417. /**
  31418. * Runtime helper for rendering static trees.
  31419. */
  31420. function renderStatic (
  31421. index,
  31422. isInFor
  31423. ) {
  31424. var tree = this._staticTrees[index];
  31425. // if has already-rendered static tree and not inside v-for,
  31426. // we can reuse the same tree by doing a shallow clone.
  31427. if (tree && !isInFor) {
  31428. return Array.isArray(tree)
  31429. ? cloneVNodes(tree)
  31430. : cloneVNode(tree)
  31431. }
  31432. // otherwise, render a fresh tree.
  31433. tree = this._staticTrees[index] =
  31434. this.$options.staticRenderFns[index].call(this._renderProxy);
  31435. markStatic(tree, ("__static__" + index), false);
  31436. return tree
  31437. }
  31438. /**
  31439. * Runtime helper for v-once.
  31440. * Effectively it means marking the node as static with a unique key.
  31441. */
  31442. function markOnce (
  31443. tree,
  31444. index,
  31445. key
  31446. ) {
  31447. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  31448. return tree
  31449. }
  31450. function markStatic (
  31451. tree,
  31452. key,
  31453. isOnce
  31454. ) {
  31455. if (Array.isArray(tree)) {
  31456. for (var i = 0; i < tree.length; i++) {
  31457. if (tree[i] && typeof tree[i] !== 'string') {
  31458. markStaticNode(tree[i], (key + "_" + i), isOnce);
  31459. }
  31460. }
  31461. } else {
  31462. markStaticNode(tree, key, isOnce);
  31463. }
  31464. }
  31465. function markStaticNode (node, key, isOnce) {
  31466. node.isStatic = true;
  31467. node.key = key;
  31468. node.isOnce = isOnce;
  31469. }
  31470. /* */
  31471. function bindObjectListeners (data, value) {
  31472. if (value) {
  31473. if (!isPlainObject(value)) {
  31474. "development" !== 'production' && warn(
  31475. 'v-on without argument expects an Object value',
  31476. this
  31477. );
  31478. } else {
  31479. var on = data.on = data.on ? extend({}, data.on) : {};
  31480. for (var key in value) {
  31481. var existing = on[key];
  31482. var ours = value[key];
  31483. on[key] = existing ? [].concat(ours, existing) : ours;
  31484. }
  31485. }
  31486. }
  31487. return data
  31488. }
  31489. /* */
  31490. function initRender (vm) {
  31491. vm._vnode = null; // the root of the child tree
  31492. vm._staticTrees = null;
  31493. var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
  31494. var renderContext = parentVnode && parentVnode.context;
  31495. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  31496. vm.$scopedSlots = emptyObject;
  31497. // bind the createElement fn to this instance
  31498. // so that we get proper render context inside it.
  31499. // args order: tag, data, children, normalizationType, alwaysNormalize
  31500. // internal version is used by render functions compiled from templates
  31501. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31502. // normalization is always applied for the public version, used in
  31503. // user-written render functions.
  31504. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31505. // $attrs & $listeners are exposed for easier HOC creation.
  31506. // they need to be reactive so that HOCs using them are always updated
  31507. var parentData = parentVnode && parentVnode.data;
  31508. /* istanbul ignore else */
  31509. if (true) {
  31510. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
  31511. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31512. }, true);
  31513. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
  31514. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31515. }, true);
  31516. } else {
  31517. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
  31518. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
  31519. }
  31520. }
  31521. function renderMixin (Vue) {
  31522. Vue.prototype.$nextTick = function (fn) {
  31523. return nextTick(fn, this)
  31524. };
  31525. Vue.prototype._render = function () {
  31526. var vm = this;
  31527. var ref = vm.$options;
  31528. var render = ref.render;
  31529. var staticRenderFns = ref.staticRenderFns;
  31530. var _parentVnode = ref._parentVnode;
  31531. if (vm._isMounted) {
  31532. // clone slot nodes on re-renders
  31533. for (var key in vm.$slots) {
  31534. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  31535. }
  31536. }
  31537. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  31538. if (staticRenderFns && !vm._staticTrees) {
  31539. vm._staticTrees = [];
  31540. }
  31541. // set parent vnode. this allows render functions to have access
  31542. // to the data on the placeholder node.
  31543. vm.$vnode = _parentVnode;
  31544. // render self
  31545. var vnode;
  31546. try {
  31547. vnode = render.call(vm._renderProxy, vm.$createElement);
  31548. } catch (e) {
  31549. handleError(e, vm, "render function");
  31550. // return error render result,
  31551. // or previous vnode to prevent render error causing blank component
  31552. /* istanbul ignore else */
  31553. if (true) {
  31554. vnode = vm.$options.renderError
  31555. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  31556. : vm._vnode;
  31557. } else {
  31558. vnode = vm._vnode;
  31559. }
  31560. }
  31561. // return empty vnode in case the render function errored out
  31562. if (!(vnode instanceof VNode)) {
  31563. if ("development" !== 'production' && Array.isArray(vnode)) {
  31564. warn(
  31565. 'Multiple root nodes returned from render function. Render function ' +
  31566. 'should return a single root node.',
  31567. vm
  31568. );
  31569. }
  31570. vnode = createEmptyVNode();
  31571. }
  31572. // set parent
  31573. vnode.parent = _parentVnode;
  31574. return vnode
  31575. };
  31576. // internal render helpers.
  31577. // these are exposed on the instance prototype to reduce generated render
  31578. // code size.
  31579. Vue.prototype._o = markOnce;
  31580. Vue.prototype._n = toNumber;
  31581. Vue.prototype._s = toString;
  31582. Vue.prototype._l = renderList;
  31583. Vue.prototype._t = renderSlot;
  31584. Vue.prototype._q = looseEqual;
  31585. Vue.prototype._i = looseIndexOf;
  31586. Vue.prototype._m = renderStatic;
  31587. Vue.prototype._f = resolveFilter;
  31588. Vue.prototype._k = checkKeyCodes;
  31589. Vue.prototype._b = bindObjectProps;
  31590. Vue.prototype._v = createTextVNode;
  31591. Vue.prototype._e = createEmptyVNode;
  31592. Vue.prototype._u = resolveScopedSlots;
  31593. Vue.prototype._g = bindObjectListeners;
  31594. }
  31595. /* */
  31596. var uid$1 = 0;
  31597. function initMixin (Vue) {
  31598. Vue.prototype._init = function (options) {
  31599. var vm = this;
  31600. // a uid
  31601. vm._uid = uid$1++;
  31602. var startTag, endTag;
  31603. /* istanbul ignore if */
  31604. if ("development" !== 'production' && config.performance && mark) {
  31605. startTag = "vue-perf-init:" + (vm._uid);
  31606. endTag = "vue-perf-end:" + (vm._uid);
  31607. mark(startTag);
  31608. }
  31609. // a flag to avoid this being observed
  31610. vm._isVue = true;
  31611. // merge options
  31612. if (options && options._isComponent) {
  31613. // optimize internal component instantiation
  31614. // since dynamic options merging is pretty slow, and none of the
  31615. // internal component options needs special treatment.
  31616. initInternalComponent(vm, options);
  31617. } else {
  31618. vm.$options = mergeOptions(
  31619. resolveConstructorOptions(vm.constructor),
  31620. options || {},
  31621. vm
  31622. );
  31623. }
  31624. /* istanbul ignore else */
  31625. if (true) {
  31626. initProxy(vm);
  31627. } else {
  31628. vm._renderProxy = vm;
  31629. }
  31630. // expose real self
  31631. vm._self = vm;
  31632. initLifecycle(vm);
  31633. initEvents(vm);
  31634. initRender(vm);
  31635. callHook(vm, 'beforeCreate');
  31636. initInjections(vm); // resolve injections before data/props
  31637. initState(vm);
  31638. initProvide(vm); // resolve provide after data/props
  31639. callHook(vm, 'created');
  31640. /* istanbul ignore if */
  31641. if ("development" !== 'production' && config.performance && mark) {
  31642. vm._name = formatComponentName(vm, false);
  31643. mark(endTag);
  31644. measure(((vm._name) + " init"), startTag, endTag);
  31645. }
  31646. if (vm.$options.el) {
  31647. vm.$mount(vm.$options.el);
  31648. }
  31649. };
  31650. }
  31651. function initInternalComponent (vm, options) {
  31652. var opts = vm.$options = Object.create(vm.constructor.options);
  31653. // doing this because it's faster than dynamic enumeration.
  31654. opts.parent = options.parent;
  31655. opts.propsData = options.propsData;
  31656. opts._parentVnode = options._parentVnode;
  31657. opts._parentListeners = options._parentListeners;
  31658. opts._renderChildren = options._renderChildren;
  31659. opts._componentTag = options._componentTag;
  31660. opts._parentElm = options._parentElm;
  31661. opts._refElm = options._refElm;
  31662. if (options.render) {
  31663. opts.render = options.render;
  31664. opts.staticRenderFns = options.staticRenderFns;
  31665. }
  31666. }
  31667. function resolveConstructorOptions (Ctor) {
  31668. var options = Ctor.options;
  31669. if (Ctor.super) {
  31670. var superOptions = resolveConstructorOptions(Ctor.super);
  31671. var cachedSuperOptions = Ctor.superOptions;
  31672. if (superOptions !== cachedSuperOptions) {
  31673. // super option changed,
  31674. // need to resolve new options.
  31675. Ctor.superOptions = superOptions;
  31676. // check if there are any late-modified/attached options (#4976)
  31677. var modifiedOptions = resolveModifiedOptions(Ctor);
  31678. // update base extend options
  31679. if (modifiedOptions) {
  31680. extend(Ctor.extendOptions, modifiedOptions);
  31681. }
  31682. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  31683. if (options.name) {
  31684. options.components[options.name] = Ctor;
  31685. }
  31686. }
  31687. }
  31688. return options
  31689. }
  31690. function resolveModifiedOptions (Ctor) {
  31691. var modified;
  31692. var latest = Ctor.options;
  31693. var extended = Ctor.extendOptions;
  31694. var sealed = Ctor.sealedOptions;
  31695. for (var key in latest) {
  31696. if (latest[key] !== sealed[key]) {
  31697. if (!modified) { modified = {}; }
  31698. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  31699. }
  31700. }
  31701. return modified
  31702. }
  31703. function dedupe (latest, extended, sealed) {
  31704. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  31705. // between merges
  31706. if (Array.isArray(latest)) {
  31707. var res = [];
  31708. sealed = Array.isArray(sealed) ? sealed : [sealed];
  31709. extended = Array.isArray(extended) ? extended : [extended];
  31710. for (var i = 0; i < latest.length; i++) {
  31711. // push original options and not sealed options to exclude duplicated options
  31712. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  31713. res.push(latest[i]);
  31714. }
  31715. }
  31716. return res
  31717. } else {
  31718. return latest
  31719. }
  31720. }
  31721. function Vue$3 (options) {
  31722. if ("development" !== 'production' &&
  31723. !(this instanceof Vue$3)
  31724. ) {
  31725. warn('Vue is a constructor and should be called with the `new` keyword');
  31726. }
  31727. this._init(options);
  31728. }
  31729. initMixin(Vue$3);
  31730. stateMixin(Vue$3);
  31731. eventsMixin(Vue$3);
  31732. lifecycleMixin(Vue$3);
  31733. renderMixin(Vue$3);
  31734. /* */
  31735. function initUse (Vue) {
  31736. Vue.use = function (plugin) {
  31737. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  31738. if (installedPlugins.indexOf(plugin) > -1) {
  31739. return this
  31740. }
  31741. // additional parameters
  31742. var args = toArray(arguments, 1);
  31743. args.unshift(this);
  31744. if (typeof plugin.install === 'function') {
  31745. plugin.install.apply(plugin, args);
  31746. } else if (typeof plugin === 'function') {
  31747. plugin.apply(null, args);
  31748. }
  31749. installedPlugins.push(plugin);
  31750. return this
  31751. };
  31752. }
  31753. /* */
  31754. function initMixin$1 (Vue) {
  31755. Vue.mixin = function (mixin) {
  31756. this.options = mergeOptions(this.options, mixin);
  31757. return this
  31758. };
  31759. }
  31760. /* */
  31761. function initExtend (Vue) {
  31762. /**
  31763. * Each instance constructor, including Vue, has a unique
  31764. * cid. This enables us to create wrapped "child
  31765. * constructors" for prototypal inheritance and cache them.
  31766. */
  31767. Vue.cid = 0;
  31768. var cid = 1;
  31769. /**
  31770. * Class inheritance
  31771. */
  31772. Vue.extend = function (extendOptions) {
  31773. extendOptions = extendOptions || {};
  31774. var Super = this;
  31775. var SuperId = Super.cid;
  31776. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  31777. if (cachedCtors[SuperId]) {
  31778. return cachedCtors[SuperId]
  31779. }
  31780. var name = extendOptions.name || Super.options.name;
  31781. if (true) {
  31782. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  31783. warn(
  31784. 'Invalid component name: "' + name + '". Component names ' +
  31785. 'can only contain alphanumeric characters and the hyphen, ' +
  31786. 'and must start with a letter.'
  31787. );
  31788. }
  31789. }
  31790. var Sub = function VueComponent (options) {
  31791. this._init(options);
  31792. };
  31793. Sub.prototype = Object.create(Super.prototype);
  31794. Sub.prototype.constructor = Sub;
  31795. Sub.cid = cid++;
  31796. Sub.options = mergeOptions(
  31797. Super.options,
  31798. extendOptions
  31799. );
  31800. Sub['super'] = Super;
  31801. // For props and computed properties, we define the proxy getters on
  31802. // the Vue instances at extension time, on the extended prototype. This
  31803. // avoids Object.defineProperty calls for each instance created.
  31804. if (Sub.options.props) {
  31805. initProps$1(Sub);
  31806. }
  31807. if (Sub.options.computed) {
  31808. initComputed$1(Sub);
  31809. }
  31810. // allow further extension/mixin/plugin usage
  31811. Sub.extend = Super.extend;
  31812. Sub.mixin = Super.mixin;
  31813. Sub.use = Super.use;
  31814. // create asset registers, so extended classes
  31815. // can have their private assets too.
  31816. ASSET_TYPES.forEach(function (type) {
  31817. Sub[type] = Super[type];
  31818. });
  31819. // enable recursive self-lookup
  31820. if (name) {
  31821. Sub.options.components[name] = Sub;
  31822. }
  31823. // keep a reference to the super options at extension time.
  31824. // later at instantiation we can check if Super's options have
  31825. // been updated.
  31826. Sub.superOptions = Super.options;
  31827. Sub.extendOptions = extendOptions;
  31828. Sub.sealedOptions = extend({}, Sub.options);
  31829. // cache constructor
  31830. cachedCtors[SuperId] = Sub;
  31831. return Sub
  31832. };
  31833. }
  31834. function initProps$1 (Comp) {
  31835. var props = Comp.options.props;
  31836. for (var key in props) {
  31837. proxy(Comp.prototype, "_props", key);
  31838. }
  31839. }
  31840. function initComputed$1 (Comp) {
  31841. var computed = Comp.options.computed;
  31842. for (var key in computed) {
  31843. defineComputed(Comp.prototype, key, computed[key]);
  31844. }
  31845. }
  31846. /* */
  31847. function initAssetRegisters (Vue) {
  31848. /**
  31849. * Create asset registration methods.
  31850. */
  31851. ASSET_TYPES.forEach(function (type) {
  31852. Vue[type] = function (
  31853. id,
  31854. definition
  31855. ) {
  31856. if (!definition) {
  31857. return this.options[type + 's'][id]
  31858. } else {
  31859. /* istanbul ignore if */
  31860. if (true) {
  31861. if (type === 'component' && config.isReservedTag(id)) {
  31862. warn(
  31863. 'Do not use built-in or reserved HTML elements as component ' +
  31864. 'id: ' + id
  31865. );
  31866. }
  31867. }
  31868. if (type === 'component' && isPlainObject(definition)) {
  31869. definition.name = definition.name || id;
  31870. definition = this.options._base.extend(definition);
  31871. }
  31872. if (type === 'directive' && typeof definition === 'function') {
  31873. definition = { bind: definition, update: definition };
  31874. }
  31875. this.options[type + 's'][id] = definition;
  31876. return definition
  31877. }
  31878. };
  31879. });
  31880. }
  31881. /* */
  31882. var patternTypes = [String, RegExp, Array];
  31883. function getComponentName (opts) {
  31884. return opts && (opts.Ctor.options.name || opts.tag)
  31885. }
  31886. function matches (pattern, name) {
  31887. if (Array.isArray(pattern)) {
  31888. return pattern.indexOf(name) > -1
  31889. } else if (typeof pattern === 'string') {
  31890. return pattern.split(',').indexOf(name) > -1
  31891. } else if (isRegExp(pattern)) {
  31892. return pattern.test(name)
  31893. }
  31894. /* istanbul ignore next */
  31895. return false
  31896. }
  31897. function pruneCache (cache, current, filter) {
  31898. for (var key in cache) {
  31899. var cachedNode = cache[key];
  31900. if (cachedNode) {
  31901. var name = getComponentName(cachedNode.componentOptions);
  31902. if (name && !filter(name)) {
  31903. if (cachedNode !== current) {
  31904. pruneCacheEntry(cachedNode);
  31905. }
  31906. cache[key] = null;
  31907. }
  31908. }
  31909. }
  31910. }
  31911. function pruneCacheEntry (vnode) {
  31912. if (vnode) {
  31913. vnode.componentInstance.$destroy();
  31914. }
  31915. }
  31916. var KeepAlive = {
  31917. name: 'keep-alive',
  31918. abstract: true,
  31919. props: {
  31920. include: patternTypes,
  31921. exclude: patternTypes
  31922. },
  31923. created: function created () {
  31924. this.cache = Object.create(null);
  31925. },
  31926. destroyed: function destroyed () {
  31927. var this$1 = this;
  31928. for (var key in this$1.cache) {
  31929. pruneCacheEntry(this$1.cache[key]);
  31930. }
  31931. },
  31932. watch: {
  31933. include: function include (val) {
  31934. pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
  31935. },
  31936. exclude: function exclude (val) {
  31937. pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
  31938. }
  31939. },
  31940. render: function render () {
  31941. var vnode = getFirstComponentChild(this.$slots.default);
  31942. var componentOptions = vnode && vnode.componentOptions;
  31943. if (componentOptions) {
  31944. // check pattern
  31945. var name = getComponentName(componentOptions);
  31946. if (name && (
  31947. (this.include && !matches(this.include, name)) ||
  31948. (this.exclude && matches(this.exclude, name))
  31949. )) {
  31950. return vnode
  31951. }
  31952. var key = vnode.key == null
  31953. // same constructor may get registered as different local components
  31954. // so cid alone is not enough (#3269)
  31955. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  31956. : vnode.key;
  31957. if (this.cache[key]) {
  31958. vnode.componentInstance = this.cache[key].componentInstance;
  31959. } else {
  31960. this.cache[key] = vnode;
  31961. }
  31962. vnode.data.keepAlive = true;
  31963. }
  31964. return vnode
  31965. }
  31966. };
  31967. var builtInComponents = {
  31968. KeepAlive: KeepAlive
  31969. };
  31970. /* */
  31971. function initGlobalAPI (Vue) {
  31972. // config
  31973. var configDef = {};
  31974. configDef.get = function () { return config; };
  31975. if (true) {
  31976. configDef.set = function () {
  31977. warn(
  31978. 'Do not replace the Vue.config object, set individual fields instead.'
  31979. );
  31980. };
  31981. }
  31982. Object.defineProperty(Vue, 'config', configDef);
  31983. // exposed util methods.
  31984. // NOTE: these are not considered part of the public API - avoid relying on
  31985. // them unless you are aware of the risk.
  31986. Vue.util = {
  31987. warn: warn,
  31988. extend: extend,
  31989. mergeOptions: mergeOptions,
  31990. defineReactive: defineReactive$$1
  31991. };
  31992. Vue.set = set;
  31993. Vue.delete = del;
  31994. Vue.nextTick = nextTick;
  31995. Vue.options = Object.create(null);
  31996. ASSET_TYPES.forEach(function (type) {
  31997. Vue.options[type + 's'] = Object.create(null);
  31998. });
  31999. // this is used to identify the "base" constructor to extend all plain-object
  32000. // components with in Weex's multi-instance scenarios.
  32001. Vue.options._base = Vue;
  32002. extend(Vue.options.components, builtInComponents);
  32003. initUse(Vue);
  32004. initMixin$1(Vue);
  32005. initExtend(Vue);
  32006. initAssetRegisters(Vue);
  32007. }
  32008. initGlobalAPI(Vue$3);
  32009. Object.defineProperty(Vue$3.prototype, '$isServer', {
  32010. get: isServerRendering
  32011. });
  32012. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  32013. get: function get () {
  32014. /* istanbul ignore next */
  32015. return this.$vnode && this.$vnode.ssrContext
  32016. }
  32017. });
  32018. Vue$3.version = '2.4.2';
  32019. /* */
  32020. // these are reserved for web because they are directly compiled away
  32021. // during template compilation
  32022. var isReservedAttr = makeMap('style,class');
  32023. // attributes that should be using props for binding
  32024. var acceptValue = makeMap('input,textarea,option,select');
  32025. var mustUseProp = function (tag, type, attr) {
  32026. return (
  32027. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  32028. (attr === 'selected' && tag === 'option') ||
  32029. (attr === 'checked' && tag === 'input') ||
  32030. (attr === 'muted' && tag === 'video')
  32031. )
  32032. };
  32033. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  32034. var isBooleanAttr = makeMap(
  32035. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  32036. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  32037. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  32038. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  32039. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  32040. 'truespeed,typemustmatch,visible'
  32041. );
  32042. var xlinkNS = 'http://www.w3.org/1999/xlink';
  32043. var isXlink = function (name) {
  32044. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  32045. };
  32046. var getXlinkProp = function (name) {
  32047. return isXlink(name) ? name.slice(6, name.length) : ''
  32048. };
  32049. var isFalsyAttrValue = function (val) {
  32050. return val == null || val === false
  32051. };
  32052. /* */
  32053. function genClassForVnode (vnode) {
  32054. var data = vnode.data;
  32055. var parentNode = vnode;
  32056. var childNode = vnode;
  32057. while (isDef(childNode.componentInstance)) {
  32058. childNode = childNode.componentInstance._vnode;
  32059. if (childNode.data) {
  32060. data = mergeClassData(childNode.data, data);
  32061. }
  32062. }
  32063. while (isDef(parentNode = parentNode.parent)) {
  32064. if (parentNode.data) {
  32065. data = mergeClassData(data, parentNode.data);
  32066. }
  32067. }
  32068. return renderClass(data.staticClass, data.class)
  32069. }
  32070. function mergeClassData (child, parent) {
  32071. return {
  32072. staticClass: concat(child.staticClass, parent.staticClass),
  32073. class: isDef(child.class)
  32074. ? [child.class, parent.class]
  32075. : parent.class
  32076. }
  32077. }
  32078. function renderClass (
  32079. staticClass,
  32080. dynamicClass
  32081. ) {
  32082. if (isDef(staticClass) || isDef(dynamicClass)) {
  32083. return concat(staticClass, stringifyClass(dynamicClass))
  32084. }
  32085. /* istanbul ignore next */
  32086. return ''
  32087. }
  32088. function concat (a, b) {
  32089. return a ? b ? (a + ' ' + b) : a : (b || '')
  32090. }
  32091. function stringifyClass (value) {
  32092. if (Array.isArray(value)) {
  32093. return stringifyArray(value)
  32094. }
  32095. if (isObject(value)) {
  32096. return stringifyObject(value)
  32097. }
  32098. if (typeof value === 'string') {
  32099. return value
  32100. }
  32101. /* istanbul ignore next */
  32102. return ''
  32103. }
  32104. function stringifyArray (value) {
  32105. var res = '';
  32106. var stringified;
  32107. for (var i = 0, l = value.length; i < l; i++) {
  32108. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  32109. if (res) { res += ' '; }
  32110. res += stringified;
  32111. }
  32112. }
  32113. return res
  32114. }
  32115. function stringifyObject (value) {
  32116. var res = '';
  32117. for (var key in value) {
  32118. if (value[key]) {
  32119. if (res) { res += ' '; }
  32120. res += key;
  32121. }
  32122. }
  32123. return res
  32124. }
  32125. /* */
  32126. var namespaceMap = {
  32127. svg: 'http://www.w3.org/2000/svg',
  32128. math: 'http://www.w3.org/1998/Math/MathML'
  32129. };
  32130. var isHTMLTag = makeMap(
  32131. 'html,body,base,head,link,meta,style,title,' +
  32132. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  32133. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  32134. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  32135. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  32136. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  32137. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  32138. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  32139. 'output,progress,select,textarea,' +
  32140. 'details,dialog,menu,menuitem,summary,' +
  32141. 'content,element,shadow,template,blockquote,iframe,tfoot'
  32142. );
  32143. // this map is intentionally selective, only covering SVG elements that may
  32144. // contain child elements.
  32145. var isSVG = makeMap(
  32146. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  32147. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  32148. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  32149. true
  32150. );
  32151. var isPreTag = function (tag) { return tag === 'pre'; };
  32152. var isReservedTag = function (tag) {
  32153. return isHTMLTag(tag) || isSVG(tag)
  32154. };
  32155. function getTagNamespace (tag) {
  32156. if (isSVG(tag)) {
  32157. return 'svg'
  32158. }
  32159. // basic support for MathML
  32160. // note it doesn't support other MathML elements being component roots
  32161. if (tag === 'math') {
  32162. return 'math'
  32163. }
  32164. }
  32165. var unknownElementCache = Object.create(null);
  32166. function isUnknownElement (tag) {
  32167. /* istanbul ignore if */
  32168. if (!inBrowser) {
  32169. return true
  32170. }
  32171. if (isReservedTag(tag)) {
  32172. return false
  32173. }
  32174. tag = tag.toLowerCase();
  32175. /* istanbul ignore if */
  32176. if (unknownElementCache[tag] != null) {
  32177. return unknownElementCache[tag]
  32178. }
  32179. var el = document.createElement(tag);
  32180. if (tag.indexOf('-') > -1) {
  32181. // http://stackoverflow.com/a/28210364/1070244
  32182. return (unknownElementCache[tag] = (
  32183. el.constructor === window.HTMLUnknownElement ||
  32184. el.constructor === window.HTMLElement
  32185. ))
  32186. } else {
  32187. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  32188. }
  32189. }
  32190. /* */
  32191. /**
  32192. * Query an element selector if it's not an element already.
  32193. */
  32194. function query (el) {
  32195. if (typeof el === 'string') {
  32196. var selected = document.querySelector(el);
  32197. if (!selected) {
  32198. "development" !== 'production' && warn(
  32199. 'Cannot find element: ' + el
  32200. );
  32201. return document.createElement('div')
  32202. }
  32203. return selected
  32204. } else {
  32205. return el
  32206. }
  32207. }
  32208. /* */
  32209. function createElement$1 (tagName, vnode) {
  32210. var elm = document.createElement(tagName);
  32211. if (tagName !== 'select') {
  32212. return elm
  32213. }
  32214. // false or null will remove the attribute but undefined will not
  32215. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  32216. elm.setAttribute('multiple', 'multiple');
  32217. }
  32218. return elm
  32219. }
  32220. function createElementNS (namespace, tagName) {
  32221. return document.createElementNS(namespaceMap[namespace], tagName)
  32222. }
  32223. function createTextNode (text) {
  32224. return document.createTextNode(text)
  32225. }
  32226. function createComment (text) {
  32227. return document.createComment(text)
  32228. }
  32229. function insertBefore (parentNode, newNode, referenceNode) {
  32230. parentNode.insertBefore(newNode, referenceNode);
  32231. }
  32232. function removeChild (node, child) {
  32233. node.removeChild(child);
  32234. }
  32235. function appendChild (node, child) {
  32236. node.appendChild(child);
  32237. }
  32238. function parentNode (node) {
  32239. return node.parentNode
  32240. }
  32241. function nextSibling (node) {
  32242. return node.nextSibling
  32243. }
  32244. function tagName (node) {
  32245. return node.tagName
  32246. }
  32247. function setTextContent (node, text) {
  32248. node.textContent = text;
  32249. }
  32250. function setAttribute (node, key, val) {
  32251. node.setAttribute(key, val);
  32252. }
  32253. var nodeOps = Object.freeze({
  32254. createElement: createElement$1,
  32255. createElementNS: createElementNS,
  32256. createTextNode: createTextNode,
  32257. createComment: createComment,
  32258. insertBefore: insertBefore,
  32259. removeChild: removeChild,
  32260. appendChild: appendChild,
  32261. parentNode: parentNode,
  32262. nextSibling: nextSibling,
  32263. tagName: tagName,
  32264. setTextContent: setTextContent,
  32265. setAttribute: setAttribute
  32266. });
  32267. /* */
  32268. var ref = {
  32269. create: function create (_, vnode) {
  32270. registerRef(vnode);
  32271. },
  32272. update: function update (oldVnode, vnode) {
  32273. if (oldVnode.data.ref !== vnode.data.ref) {
  32274. registerRef(oldVnode, true);
  32275. registerRef(vnode);
  32276. }
  32277. },
  32278. destroy: function destroy (vnode) {
  32279. registerRef(vnode, true);
  32280. }
  32281. };
  32282. function registerRef (vnode, isRemoval) {
  32283. var key = vnode.data.ref;
  32284. if (!key) { return }
  32285. var vm = vnode.context;
  32286. var ref = vnode.componentInstance || vnode.elm;
  32287. var refs = vm.$refs;
  32288. if (isRemoval) {
  32289. if (Array.isArray(refs[key])) {
  32290. remove(refs[key], ref);
  32291. } else if (refs[key] === ref) {
  32292. refs[key] = undefined;
  32293. }
  32294. } else {
  32295. if (vnode.data.refInFor) {
  32296. if (!Array.isArray(refs[key])) {
  32297. refs[key] = [ref];
  32298. } else if (refs[key].indexOf(ref) < 0) {
  32299. // $flow-disable-line
  32300. refs[key].push(ref);
  32301. }
  32302. } else {
  32303. refs[key] = ref;
  32304. }
  32305. }
  32306. }
  32307. /**
  32308. * Virtual DOM patching algorithm based on Snabbdom by
  32309. * Simon Friis Vindum (@paldepind)
  32310. * Licensed under the MIT License
  32311. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  32312. *
  32313. * modified by Evan You (@yyx990803)
  32314. *
  32315. /*
  32316. * Not type-checking this because this file is perf-critical and the cost
  32317. * of making flow understand it is not worth it.
  32318. */
  32319. var emptyNode = new VNode('', {}, []);
  32320. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  32321. function sameVnode (a, b) {
  32322. return (
  32323. a.key === b.key && (
  32324. (
  32325. a.tag === b.tag &&
  32326. a.isComment === b.isComment &&
  32327. isDef(a.data) === isDef(b.data) &&
  32328. sameInputType(a, b)
  32329. ) || (
  32330. isTrue(a.isAsyncPlaceholder) &&
  32331. a.asyncFactory === b.asyncFactory &&
  32332. isUndef(b.asyncFactory.error)
  32333. )
  32334. )
  32335. )
  32336. }
  32337. // Some browsers do not support dynamically changing type for <input>
  32338. // so they need to be treated as different nodes
  32339. function sameInputType (a, b) {
  32340. if (a.tag !== 'input') { return true }
  32341. var i;
  32342. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  32343. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  32344. return typeA === typeB
  32345. }
  32346. function createKeyToOldIdx (children, beginIdx, endIdx) {
  32347. var i, key;
  32348. var map = {};
  32349. for (i = beginIdx; i <= endIdx; ++i) {
  32350. key = children[i].key;
  32351. if (isDef(key)) { map[key] = i; }
  32352. }
  32353. return map
  32354. }
  32355. function createPatchFunction (backend) {
  32356. var i, j;
  32357. var cbs = {};
  32358. var modules = backend.modules;
  32359. var nodeOps = backend.nodeOps;
  32360. for (i = 0; i < hooks.length; ++i) {
  32361. cbs[hooks[i]] = [];
  32362. for (j = 0; j < modules.length; ++j) {
  32363. if (isDef(modules[j][hooks[i]])) {
  32364. cbs[hooks[i]].push(modules[j][hooks[i]]);
  32365. }
  32366. }
  32367. }
  32368. function emptyNodeAt (elm) {
  32369. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  32370. }
  32371. function createRmCb (childElm, listeners) {
  32372. function remove$$1 () {
  32373. if (--remove$$1.listeners === 0) {
  32374. removeNode(childElm);
  32375. }
  32376. }
  32377. remove$$1.listeners = listeners;
  32378. return remove$$1
  32379. }
  32380. function removeNode (el) {
  32381. var parent = nodeOps.parentNode(el);
  32382. // element may have already been removed due to v-html / v-text
  32383. if (isDef(parent)) {
  32384. nodeOps.removeChild(parent, el);
  32385. }
  32386. }
  32387. var inPre = 0;
  32388. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  32389. vnode.isRootInsert = !nested; // for transition enter check
  32390. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  32391. return
  32392. }
  32393. var data = vnode.data;
  32394. var children = vnode.children;
  32395. var tag = vnode.tag;
  32396. if (isDef(tag)) {
  32397. if (true) {
  32398. if (data && data.pre) {
  32399. inPre++;
  32400. }
  32401. if (
  32402. !inPre &&
  32403. !vnode.ns &&
  32404. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  32405. config.isUnknownElement(tag)
  32406. ) {
  32407. warn(
  32408. 'Unknown custom element: <' + tag + '> - did you ' +
  32409. 'register the component correctly? For recursive components, ' +
  32410. 'make sure to provide the "name" option.',
  32411. vnode.context
  32412. );
  32413. }
  32414. }
  32415. vnode.elm = vnode.ns
  32416. ? nodeOps.createElementNS(vnode.ns, tag)
  32417. : nodeOps.createElement(tag, vnode);
  32418. setScope(vnode);
  32419. /* istanbul ignore if */
  32420. {
  32421. createChildren(vnode, children, insertedVnodeQueue);
  32422. if (isDef(data)) {
  32423. invokeCreateHooks(vnode, insertedVnodeQueue);
  32424. }
  32425. insert(parentElm, vnode.elm, refElm);
  32426. }
  32427. if ("development" !== 'production' && data && data.pre) {
  32428. inPre--;
  32429. }
  32430. } else if (isTrue(vnode.isComment)) {
  32431. vnode.elm = nodeOps.createComment(vnode.text);
  32432. insert(parentElm, vnode.elm, refElm);
  32433. } else {
  32434. vnode.elm = nodeOps.createTextNode(vnode.text);
  32435. insert(parentElm, vnode.elm, refElm);
  32436. }
  32437. }
  32438. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32439. var i = vnode.data;
  32440. if (isDef(i)) {
  32441. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  32442. if (isDef(i = i.hook) && isDef(i = i.init)) {
  32443. i(vnode, false /* hydrating */, parentElm, refElm);
  32444. }
  32445. // after calling the init hook, if the vnode is a child component
  32446. // it should've created a child instance and mounted it. the child
  32447. // component also has set the placeholder vnode's elm.
  32448. // in that case we can just return the element and be done.
  32449. if (isDef(vnode.componentInstance)) {
  32450. initComponent(vnode, insertedVnodeQueue);
  32451. if (isTrue(isReactivated)) {
  32452. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  32453. }
  32454. return true
  32455. }
  32456. }
  32457. }
  32458. function initComponent (vnode, insertedVnodeQueue) {
  32459. if (isDef(vnode.data.pendingInsert)) {
  32460. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  32461. vnode.data.pendingInsert = null;
  32462. }
  32463. vnode.elm = vnode.componentInstance.$el;
  32464. if (isPatchable(vnode)) {
  32465. invokeCreateHooks(vnode, insertedVnodeQueue);
  32466. setScope(vnode);
  32467. } else {
  32468. // empty component root.
  32469. // skip all element-related modules except for ref (#3455)
  32470. registerRef(vnode);
  32471. // make sure to invoke the insert hook
  32472. insertedVnodeQueue.push(vnode);
  32473. }
  32474. }
  32475. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32476. var i;
  32477. // hack for #4339: a reactivated component with inner transition
  32478. // does not trigger because the inner node's created hooks are not called
  32479. // again. It's not ideal to involve module-specific logic in here but
  32480. // there doesn't seem to be a better way to do it.
  32481. var innerNode = vnode;
  32482. while (innerNode.componentInstance) {
  32483. innerNode = innerNode.componentInstance._vnode;
  32484. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  32485. for (i = 0; i < cbs.activate.length; ++i) {
  32486. cbs.activate[i](emptyNode, innerNode);
  32487. }
  32488. insertedVnodeQueue.push(innerNode);
  32489. break
  32490. }
  32491. }
  32492. // unlike a newly created component,
  32493. // a reactivated keep-alive component doesn't insert itself
  32494. insert(parentElm, vnode.elm, refElm);
  32495. }
  32496. function insert (parent, elm, ref$$1) {
  32497. if (isDef(parent)) {
  32498. if (isDef(ref$$1)) {
  32499. if (ref$$1.parentNode === parent) {
  32500. nodeOps.insertBefore(parent, elm, ref$$1);
  32501. }
  32502. } else {
  32503. nodeOps.appendChild(parent, elm);
  32504. }
  32505. }
  32506. }
  32507. function createChildren (vnode, children, insertedVnodeQueue) {
  32508. if (Array.isArray(children)) {
  32509. for (var i = 0; i < children.length; ++i) {
  32510. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  32511. }
  32512. } else if (isPrimitive(vnode.text)) {
  32513. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  32514. }
  32515. }
  32516. function isPatchable (vnode) {
  32517. while (vnode.componentInstance) {
  32518. vnode = vnode.componentInstance._vnode;
  32519. }
  32520. return isDef(vnode.tag)
  32521. }
  32522. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  32523. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32524. cbs.create[i$1](emptyNode, vnode);
  32525. }
  32526. i = vnode.data.hook; // Reuse variable
  32527. if (isDef(i)) {
  32528. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  32529. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  32530. }
  32531. }
  32532. // set scope id attribute for scoped CSS.
  32533. // this is implemented as a special case to avoid the overhead
  32534. // of going through the normal attribute patching process.
  32535. function setScope (vnode) {
  32536. var i;
  32537. var ancestor = vnode;
  32538. while (ancestor) {
  32539. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  32540. nodeOps.setAttribute(vnode.elm, i, '');
  32541. }
  32542. ancestor = ancestor.parent;
  32543. }
  32544. // for slot content they should also get the scopeId from the host instance.
  32545. if (isDef(i = activeInstance) &&
  32546. i !== vnode.context &&
  32547. isDef(i = i.$options._scopeId)
  32548. ) {
  32549. nodeOps.setAttribute(vnode.elm, i, '');
  32550. }
  32551. }
  32552. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  32553. for (; startIdx <= endIdx; ++startIdx) {
  32554. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  32555. }
  32556. }
  32557. function invokeDestroyHook (vnode) {
  32558. var i, j;
  32559. var data = vnode.data;
  32560. if (isDef(data)) {
  32561. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  32562. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  32563. }
  32564. if (isDef(i = vnode.children)) {
  32565. for (j = 0; j < vnode.children.length; ++j) {
  32566. invokeDestroyHook(vnode.children[j]);
  32567. }
  32568. }
  32569. }
  32570. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  32571. for (; startIdx <= endIdx; ++startIdx) {
  32572. var ch = vnodes[startIdx];
  32573. if (isDef(ch)) {
  32574. if (isDef(ch.tag)) {
  32575. removeAndInvokeRemoveHook(ch);
  32576. invokeDestroyHook(ch);
  32577. } else { // Text node
  32578. removeNode(ch.elm);
  32579. }
  32580. }
  32581. }
  32582. }
  32583. function removeAndInvokeRemoveHook (vnode, rm) {
  32584. if (isDef(rm) || isDef(vnode.data)) {
  32585. var i;
  32586. var listeners = cbs.remove.length + 1;
  32587. if (isDef(rm)) {
  32588. // we have a recursively passed down rm callback
  32589. // increase the listeners count
  32590. rm.listeners += listeners;
  32591. } else {
  32592. // directly removing
  32593. rm = createRmCb(vnode.elm, listeners);
  32594. }
  32595. // recursively invoke hooks on child component root node
  32596. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  32597. removeAndInvokeRemoveHook(i, rm);
  32598. }
  32599. for (i = 0; i < cbs.remove.length; ++i) {
  32600. cbs.remove[i](vnode, rm);
  32601. }
  32602. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  32603. i(vnode, rm);
  32604. } else {
  32605. rm();
  32606. }
  32607. } else {
  32608. removeNode(vnode.elm);
  32609. }
  32610. }
  32611. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  32612. var oldStartIdx = 0;
  32613. var newStartIdx = 0;
  32614. var oldEndIdx = oldCh.length - 1;
  32615. var oldStartVnode = oldCh[0];
  32616. var oldEndVnode = oldCh[oldEndIdx];
  32617. var newEndIdx = newCh.length - 1;
  32618. var newStartVnode = newCh[0];
  32619. var newEndVnode = newCh[newEndIdx];
  32620. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  32621. // removeOnly is a special flag used only by <transition-group>
  32622. // to ensure removed elements stay in correct relative positions
  32623. // during leaving transitions
  32624. var canMove = !removeOnly;
  32625. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  32626. if (isUndef(oldStartVnode)) {
  32627. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  32628. } else if (isUndef(oldEndVnode)) {
  32629. oldEndVnode = oldCh[--oldEndIdx];
  32630. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  32631. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  32632. oldStartVnode = oldCh[++oldStartIdx];
  32633. newStartVnode = newCh[++newStartIdx];
  32634. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  32635. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  32636. oldEndVnode = oldCh[--oldEndIdx];
  32637. newEndVnode = newCh[--newEndIdx];
  32638. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  32639. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  32640. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  32641. oldStartVnode = oldCh[++oldStartIdx];
  32642. newEndVnode = newCh[--newEndIdx];
  32643. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  32644. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  32645. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  32646. oldEndVnode = oldCh[--oldEndIdx];
  32647. newStartVnode = newCh[++newStartIdx];
  32648. } else {
  32649. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  32650. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  32651. if (isUndef(idxInOld)) { // New element
  32652. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32653. newStartVnode = newCh[++newStartIdx];
  32654. } else {
  32655. elmToMove = oldCh[idxInOld];
  32656. /* istanbul ignore if */
  32657. if ("development" !== 'production' && !elmToMove) {
  32658. warn(
  32659. 'It seems there are duplicate keys that is causing an update error. ' +
  32660. 'Make sure each v-for item has a unique key.'
  32661. );
  32662. }
  32663. if (sameVnode(elmToMove, newStartVnode)) {
  32664. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  32665. oldCh[idxInOld] = undefined;
  32666. canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
  32667. newStartVnode = newCh[++newStartIdx];
  32668. } else {
  32669. // same key but different element. treat as new element
  32670. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32671. newStartVnode = newCh[++newStartIdx];
  32672. }
  32673. }
  32674. }
  32675. }
  32676. if (oldStartIdx > oldEndIdx) {
  32677. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  32678. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  32679. } else if (newStartIdx > newEndIdx) {
  32680. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  32681. }
  32682. }
  32683. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  32684. if (oldVnode === vnode) {
  32685. return
  32686. }
  32687. var elm = vnode.elm = oldVnode.elm;
  32688. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  32689. if (isDef(vnode.asyncFactory.resolved)) {
  32690. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  32691. } else {
  32692. vnode.isAsyncPlaceholder = true;
  32693. }
  32694. return
  32695. }
  32696. // reuse element for static trees.
  32697. // note we only do this if the vnode is cloned -
  32698. // if the new node is not cloned it means the render functions have been
  32699. // reset by the hot-reload-api and we need to do a proper re-render.
  32700. if (isTrue(vnode.isStatic) &&
  32701. isTrue(oldVnode.isStatic) &&
  32702. vnode.key === oldVnode.key &&
  32703. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  32704. ) {
  32705. vnode.componentInstance = oldVnode.componentInstance;
  32706. return
  32707. }
  32708. var i;
  32709. var data = vnode.data;
  32710. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  32711. i(oldVnode, vnode);
  32712. }
  32713. var oldCh = oldVnode.children;
  32714. var ch = vnode.children;
  32715. if (isDef(data) && isPatchable(vnode)) {
  32716. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  32717. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  32718. }
  32719. if (isUndef(vnode.text)) {
  32720. if (isDef(oldCh) && isDef(ch)) {
  32721. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  32722. } else if (isDef(ch)) {
  32723. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  32724. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  32725. } else if (isDef(oldCh)) {
  32726. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  32727. } else if (isDef(oldVnode.text)) {
  32728. nodeOps.setTextContent(elm, '');
  32729. }
  32730. } else if (oldVnode.text !== vnode.text) {
  32731. nodeOps.setTextContent(elm, vnode.text);
  32732. }
  32733. if (isDef(data)) {
  32734. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  32735. }
  32736. }
  32737. function invokeInsertHook (vnode, queue, initial) {
  32738. // delay insert hooks for component root nodes, invoke them after the
  32739. // element is really inserted
  32740. if (isTrue(initial) && isDef(vnode.parent)) {
  32741. vnode.parent.data.pendingInsert = queue;
  32742. } else {
  32743. for (var i = 0; i < queue.length; ++i) {
  32744. queue[i].data.hook.insert(queue[i]);
  32745. }
  32746. }
  32747. }
  32748. var bailed = false;
  32749. // list of modules that can skip create hook during hydration because they
  32750. // are already rendered on the client or has no need for initialization
  32751. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  32752. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  32753. function hydrate (elm, vnode, insertedVnodeQueue) {
  32754. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  32755. vnode.elm = elm;
  32756. vnode.isAsyncPlaceholder = true;
  32757. return true
  32758. }
  32759. if (true) {
  32760. if (!assertNodeMatch(elm, vnode)) {
  32761. return false
  32762. }
  32763. }
  32764. vnode.elm = elm;
  32765. var tag = vnode.tag;
  32766. var data = vnode.data;
  32767. var children = vnode.children;
  32768. if (isDef(data)) {
  32769. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  32770. if (isDef(i = vnode.componentInstance)) {
  32771. // child component. it should have hydrated its own tree.
  32772. initComponent(vnode, insertedVnodeQueue);
  32773. return true
  32774. }
  32775. }
  32776. if (isDef(tag)) {
  32777. if (isDef(children)) {
  32778. // empty element, allow client to pick up and populate children
  32779. if (!elm.hasChildNodes()) {
  32780. createChildren(vnode, children, insertedVnodeQueue);
  32781. } else {
  32782. var childrenMatch = true;
  32783. var childNode = elm.firstChild;
  32784. for (var i$1 = 0; i$1 < children.length; i$1++) {
  32785. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  32786. childrenMatch = false;
  32787. break
  32788. }
  32789. childNode = childNode.nextSibling;
  32790. }
  32791. // if childNode is not null, it means the actual childNodes list is
  32792. // longer than the virtual children list.
  32793. if (!childrenMatch || childNode) {
  32794. if ("development" !== 'production' &&
  32795. typeof console !== 'undefined' &&
  32796. !bailed
  32797. ) {
  32798. bailed = true;
  32799. console.warn('Parent: ', elm);
  32800. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  32801. }
  32802. return false
  32803. }
  32804. }
  32805. }
  32806. if (isDef(data)) {
  32807. for (var key in data) {
  32808. if (!isRenderedModule(key)) {
  32809. invokeCreateHooks(vnode, insertedVnodeQueue);
  32810. break
  32811. }
  32812. }
  32813. }
  32814. } else if (elm.data !== vnode.text) {
  32815. elm.data = vnode.text;
  32816. }
  32817. return true
  32818. }
  32819. function assertNodeMatch (node, vnode) {
  32820. if (isDef(vnode.tag)) {
  32821. return (
  32822. vnode.tag.indexOf('vue-component') === 0 ||
  32823. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  32824. )
  32825. } else {
  32826. return node.nodeType === (vnode.isComment ? 8 : 3)
  32827. }
  32828. }
  32829. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  32830. if (isUndef(vnode)) {
  32831. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  32832. return
  32833. }
  32834. var isInitialPatch = false;
  32835. var insertedVnodeQueue = [];
  32836. if (isUndef(oldVnode)) {
  32837. // empty mount (likely as component), create new root element
  32838. isInitialPatch = true;
  32839. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  32840. } else {
  32841. var isRealElement = isDef(oldVnode.nodeType);
  32842. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  32843. // patch existing root node
  32844. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  32845. } else {
  32846. if (isRealElement) {
  32847. // mounting to a real element
  32848. // check if this is server-rendered content and if we can perform
  32849. // a successful hydration.
  32850. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  32851. oldVnode.removeAttribute(SSR_ATTR);
  32852. hydrating = true;
  32853. }
  32854. if (isTrue(hydrating)) {
  32855. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  32856. invokeInsertHook(vnode, insertedVnodeQueue, true);
  32857. return oldVnode
  32858. } else if (true) {
  32859. warn(
  32860. 'The client-side rendered virtual DOM tree is not matching ' +
  32861. 'server-rendered content. This is likely caused by incorrect ' +
  32862. 'HTML markup, for example nesting block-level elements inside ' +
  32863. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  32864. 'full client-side render.'
  32865. );
  32866. }
  32867. }
  32868. // either not server-rendered, or hydration failed.
  32869. // create an empty node and replace it
  32870. oldVnode = emptyNodeAt(oldVnode);
  32871. }
  32872. // replacing existing element
  32873. var oldElm = oldVnode.elm;
  32874. var parentElm$1 = nodeOps.parentNode(oldElm);
  32875. createElm(
  32876. vnode,
  32877. insertedVnodeQueue,
  32878. // extremely rare edge case: do not insert if old element is in a
  32879. // leaving transition. Only happens when combining transition +
  32880. // keep-alive + HOCs. (#4590)
  32881. oldElm._leaveCb ? null : parentElm$1,
  32882. nodeOps.nextSibling(oldElm)
  32883. );
  32884. if (isDef(vnode.parent)) {
  32885. // component root element replaced.
  32886. // update parent placeholder node element, recursively
  32887. var ancestor = vnode.parent;
  32888. while (ancestor) {
  32889. ancestor.elm = vnode.elm;
  32890. ancestor = ancestor.parent;
  32891. }
  32892. if (isPatchable(vnode)) {
  32893. for (var i = 0; i < cbs.create.length; ++i) {
  32894. cbs.create[i](emptyNode, vnode.parent);
  32895. }
  32896. }
  32897. }
  32898. if (isDef(parentElm$1)) {
  32899. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  32900. } else if (isDef(oldVnode.tag)) {
  32901. invokeDestroyHook(oldVnode);
  32902. }
  32903. }
  32904. }
  32905. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  32906. return vnode.elm
  32907. }
  32908. }
  32909. /* */
  32910. var directives = {
  32911. create: updateDirectives,
  32912. update: updateDirectives,
  32913. destroy: function unbindDirectives (vnode) {
  32914. updateDirectives(vnode, emptyNode);
  32915. }
  32916. };
  32917. function updateDirectives (oldVnode, vnode) {
  32918. if (oldVnode.data.directives || vnode.data.directives) {
  32919. _update(oldVnode, vnode);
  32920. }
  32921. }
  32922. function _update (oldVnode, vnode) {
  32923. var isCreate = oldVnode === emptyNode;
  32924. var isDestroy = vnode === emptyNode;
  32925. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  32926. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  32927. var dirsWithInsert = [];
  32928. var dirsWithPostpatch = [];
  32929. var key, oldDir, dir;
  32930. for (key in newDirs) {
  32931. oldDir = oldDirs[key];
  32932. dir = newDirs[key];
  32933. if (!oldDir) {
  32934. // new directive, bind
  32935. callHook$1(dir, 'bind', vnode, oldVnode);
  32936. if (dir.def && dir.def.inserted) {
  32937. dirsWithInsert.push(dir);
  32938. }
  32939. } else {
  32940. // existing directive, update
  32941. dir.oldValue = oldDir.value;
  32942. callHook$1(dir, 'update', vnode, oldVnode);
  32943. if (dir.def && dir.def.componentUpdated) {
  32944. dirsWithPostpatch.push(dir);
  32945. }
  32946. }
  32947. }
  32948. if (dirsWithInsert.length) {
  32949. var callInsert = function () {
  32950. for (var i = 0; i < dirsWithInsert.length; i++) {
  32951. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  32952. }
  32953. };
  32954. if (isCreate) {
  32955. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  32956. } else {
  32957. callInsert();
  32958. }
  32959. }
  32960. if (dirsWithPostpatch.length) {
  32961. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  32962. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  32963. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  32964. }
  32965. });
  32966. }
  32967. if (!isCreate) {
  32968. for (key in oldDirs) {
  32969. if (!newDirs[key]) {
  32970. // no longer present, unbind
  32971. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  32972. }
  32973. }
  32974. }
  32975. }
  32976. var emptyModifiers = Object.create(null);
  32977. function normalizeDirectives$1 (
  32978. dirs,
  32979. vm
  32980. ) {
  32981. var res = Object.create(null);
  32982. if (!dirs) {
  32983. return res
  32984. }
  32985. var i, dir;
  32986. for (i = 0; i < dirs.length; i++) {
  32987. dir = dirs[i];
  32988. if (!dir.modifiers) {
  32989. dir.modifiers = emptyModifiers;
  32990. }
  32991. res[getRawDirName(dir)] = dir;
  32992. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  32993. }
  32994. return res
  32995. }
  32996. function getRawDirName (dir) {
  32997. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  32998. }
  32999. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  33000. var fn = dir.def && dir.def[hook];
  33001. if (fn) {
  33002. try {
  33003. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  33004. } catch (e) {
  33005. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  33006. }
  33007. }
  33008. }
  33009. var baseModules = [
  33010. ref,
  33011. directives
  33012. ];
  33013. /* */
  33014. function updateAttrs (oldVnode, vnode) {
  33015. var opts = vnode.componentOptions;
  33016. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  33017. return
  33018. }
  33019. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  33020. return
  33021. }
  33022. var key, cur, old;
  33023. var elm = vnode.elm;
  33024. var oldAttrs = oldVnode.data.attrs || {};
  33025. var attrs = vnode.data.attrs || {};
  33026. // clone observed objects, as the user probably wants to mutate it
  33027. if (isDef(attrs.__ob__)) {
  33028. attrs = vnode.data.attrs = extend({}, attrs);
  33029. }
  33030. for (key in attrs) {
  33031. cur = attrs[key];
  33032. old = oldAttrs[key];
  33033. if (old !== cur) {
  33034. setAttr(elm, key, cur);
  33035. }
  33036. }
  33037. // #4391: in IE9, setting type can reset value for input[type=radio]
  33038. /* istanbul ignore if */
  33039. if (isIE9 && attrs.value !== oldAttrs.value) {
  33040. setAttr(elm, 'value', attrs.value);
  33041. }
  33042. for (key in oldAttrs) {
  33043. if (isUndef(attrs[key])) {
  33044. if (isXlink(key)) {
  33045. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33046. } else if (!isEnumeratedAttr(key)) {
  33047. elm.removeAttribute(key);
  33048. }
  33049. }
  33050. }
  33051. }
  33052. function setAttr (el, key, value) {
  33053. if (isBooleanAttr(key)) {
  33054. // set attribute for blank value
  33055. // e.g. <option disabled>Select one</option>
  33056. if (isFalsyAttrValue(value)) {
  33057. el.removeAttribute(key);
  33058. } else {
  33059. el.setAttribute(key, key);
  33060. }
  33061. } else if (isEnumeratedAttr(key)) {
  33062. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  33063. } else if (isXlink(key)) {
  33064. if (isFalsyAttrValue(value)) {
  33065. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33066. } else {
  33067. el.setAttributeNS(xlinkNS, key, value);
  33068. }
  33069. } else {
  33070. if (isFalsyAttrValue(value)) {
  33071. el.removeAttribute(key);
  33072. } else {
  33073. el.setAttribute(key, value);
  33074. }
  33075. }
  33076. }
  33077. var attrs = {
  33078. create: updateAttrs,
  33079. update: updateAttrs
  33080. };
  33081. /* */
  33082. function updateClass (oldVnode, vnode) {
  33083. var el = vnode.elm;
  33084. var data = vnode.data;
  33085. var oldData = oldVnode.data;
  33086. if (
  33087. isUndef(data.staticClass) &&
  33088. isUndef(data.class) && (
  33089. isUndef(oldData) || (
  33090. isUndef(oldData.staticClass) &&
  33091. isUndef(oldData.class)
  33092. )
  33093. )
  33094. ) {
  33095. return
  33096. }
  33097. var cls = genClassForVnode(vnode);
  33098. // handle transition classes
  33099. var transitionClass = el._transitionClasses;
  33100. if (isDef(transitionClass)) {
  33101. cls = concat(cls, stringifyClass(transitionClass));
  33102. }
  33103. // set the class
  33104. if (cls !== el._prevClass) {
  33105. el.setAttribute('class', cls);
  33106. el._prevClass = cls;
  33107. }
  33108. }
  33109. var klass = {
  33110. create: updateClass,
  33111. update: updateClass
  33112. };
  33113. /* */
  33114. var validDivisionCharRE = /[\w).+\-_$\]]/;
  33115. function parseFilters (exp) {
  33116. var inSingle = false;
  33117. var inDouble = false;
  33118. var inTemplateString = false;
  33119. var inRegex = false;
  33120. var curly = 0;
  33121. var square = 0;
  33122. var paren = 0;
  33123. var lastFilterIndex = 0;
  33124. var c, prev, i, expression, filters;
  33125. for (i = 0; i < exp.length; i++) {
  33126. prev = c;
  33127. c = exp.charCodeAt(i);
  33128. if (inSingle) {
  33129. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  33130. } else if (inDouble) {
  33131. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  33132. } else if (inTemplateString) {
  33133. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  33134. } else if (inRegex) {
  33135. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  33136. } else if (
  33137. c === 0x7C && // pipe
  33138. exp.charCodeAt(i + 1) !== 0x7C &&
  33139. exp.charCodeAt(i - 1) !== 0x7C &&
  33140. !curly && !square && !paren
  33141. ) {
  33142. if (expression === undefined) {
  33143. // first filter, end of expression
  33144. lastFilterIndex = i + 1;
  33145. expression = exp.slice(0, i).trim();
  33146. } else {
  33147. pushFilter();
  33148. }
  33149. } else {
  33150. switch (c) {
  33151. case 0x22: inDouble = true; break // "
  33152. case 0x27: inSingle = true; break // '
  33153. case 0x60: inTemplateString = true; break // `
  33154. case 0x28: paren++; break // (
  33155. case 0x29: paren--; break // )
  33156. case 0x5B: square++; break // [
  33157. case 0x5D: square--; break // ]
  33158. case 0x7B: curly++; break // {
  33159. case 0x7D: curly--; break // }
  33160. }
  33161. if (c === 0x2f) { // /
  33162. var j = i - 1;
  33163. var p = (void 0);
  33164. // find first non-whitespace prev char
  33165. for (; j >= 0; j--) {
  33166. p = exp.charAt(j);
  33167. if (p !== ' ') { break }
  33168. }
  33169. if (!p || !validDivisionCharRE.test(p)) {
  33170. inRegex = true;
  33171. }
  33172. }
  33173. }
  33174. }
  33175. if (expression === undefined) {
  33176. expression = exp.slice(0, i).trim();
  33177. } else if (lastFilterIndex !== 0) {
  33178. pushFilter();
  33179. }
  33180. function pushFilter () {
  33181. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  33182. lastFilterIndex = i + 1;
  33183. }
  33184. if (filters) {
  33185. for (i = 0; i < filters.length; i++) {
  33186. expression = wrapFilter(expression, filters[i]);
  33187. }
  33188. }
  33189. return expression
  33190. }
  33191. function wrapFilter (exp, filter) {
  33192. var i = filter.indexOf('(');
  33193. if (i < 0) {
  33194. // _f: resolveFilter
  33195. return ("_f(\"" + filter + "\")(" + exp + ")")
  33196. } else {
  33197. var name = filter.slice(0, i);
  33198. var args = filter.slice(i + 1);
  33199. return ("_f(\"" + name + "\")(" + exp + "," + args)
  33200. }
  33201. }
  33202. /* */
  33203. function baseWarn (msg) {
  33204. console.error(("[Vue compiler]: " + msg));
  33205. }
  33206. function pluckModuleFunction (
  33207. modules,
  33208. key
  33209. ) {
  33210. return modules
  33211. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  33212. : []
  33213. }
  33214. function addProp (el, name, value) {
  33215. (el.props || (el.props = [])).push({ name: name, value: value });
  33216. }
  33217. function addAttr (el, name, value) {
  33218. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  33219. }
  33220. function addDirective (
  33221. el,
  33222. name,
  33223. rawName,
  33224. value,
  33225. arg,
  33226. modifiers
  33227. ) {
  33228. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  33229. }
  33230. function addHandler (
  33231. el,
  33232. name,
  33233. value,
  33234. modifiers,
  33235. important,
  33236. warn
  33237. ) {
  33238. // warn prevent and passive modifier
  33239. /* istanbul ignore if */
  33240. if (
  33241. "development" !== 'production' && warn &&
  33242. modifiers && modifiers.prevent && modifiers.passive
  33243. ) {
  33244. warn(
  33245. 'passive and prevent can\'t be used together. ' +
  33246. 'Passive handler can\'t prevent default event.'
  33247. );
  33248. }
  33249. // check capture modifier
  33250. if (modifiers && modifiers.capture) {
  33251. delete modifiers.capture;
  33252. name = '!' + name; // mark the event as captured
  33253. }
  33254. if (modifiers && modifiers.once) {
  33255. delete modifiers.once;
  33256. name = '~' + name; // mark the event as once
  33257. }
  33258. /* istanbul ignore if */
  33259. if (modifiers && modifiers.passive) {
  33260. delete modifiers.passive;
  33261. name = '&' + name; // mark the event as passive
  33262. }
  33263. var events;
  33264. if (modifiers && modifiers.native) {
  33265. delete modifiers.native;
  33266. events = el.nativeEvents || (el.nativeEvents = {});
  33267. } else {
  33268. events = el.events || (el.events = {});
  33269. }
  33270. var newHandler = { value: value, modifiers: modifiers };
  33271. var handlers = events[name];
  33272. /* istanbul ignore if */
  33273. if (Array.isArray(handlers)) {
  33274. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  33275. } else if (handlers) {
  33276. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  33277. } else {
  33278. events[name] = newHandler;
  33279. }
  33280. }
  33281. function getBindingAttr (
  33282. el,
  33283. name,
  33284. getStatic
  33285. ) {
  33286. var dynamicValue =
  33287. getAndRemoveAttr(el, ':' + name) ||
  33288. getAndRemoveAttr(el, 'v-bind:' + name);
  33289. if (dynamicValue != null) {
  33290. return parseFilters(dynamicValue)
  33291. } else if (getStatic !== false) {
  33292. var staticValue = getAndRemoveAttr(el, name);
  33293. if (staticValue != null) {
  33294. return JSON.stringify(staticValue)
  33295. }
  33296. }
  33297. }
  33298. function getAndRemoveAttr (el, name) {
  33299. var val;
  33300. if ((val = el.attrsMap[name]) != null) {
  33301. var list = el.attrsList;
  33302. for (var i = 0, l = list.length; i < l; i++) {
  33303. if (list[i].name === name) {
  33304. list.splice(i, 1);
  33305. break
  33306. }
  33307. }
  33308. }
  33309. return val
  33310. }
  33311. /* */
  33312. /**
  33313. * Cross-platform code generation for component v-model
  33314. */
  33315. function genComponentModel (
  33316. el,
  33317. value,
  33318. modifiers
  33319. ) {
  33320. var ref = modifiers || {};
  33321. var number = ref.number;
  33322. var trim = ref.trim;
  33323. var baseValueExpression = '$$v';
  33324. var valueExpression = baseValueExpression;
  33325. if (trim) {
  33326. valueExpression =
  33327. "(typeof " + baseValueExpression + " === 'string'" +
  33328. "? " + baseValueExpression + ".trim()" +
  33329. ": " + baseValueExpression + ")";
  33330. }
  33331. if (number) {
  33332. valueExpression = "_n(" + valueExpression + ")";
  33333. }
  33334. var assignment = genAssignmentCode(value, valueExpression);
  33335. el.model = {
  33336. value: ("(" + value + ")"),
  33337. expression: ("\"" + value + "\""),
  33338. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  33339. };
  33340. }
  33341. /**
  33342. * Cross-platform codegen helper for generating v-model value assignment code.
  33343. */
  33344. function genAssignmentCode (
  33345. value,
  33346. assignment
  33347. ) {
  33348. var modelRs = parseModel(value);
  33349. if (modelRs.idx === null) {
  33350. return (value + "=" + assignment)
  33351. } else {
  33352. return ("$set(" + (modelRs.exp) + ", " + (modelRs.idx) + ", " + assignment + ")")
  33353. }
  33354. }
  33355. /**
  33356. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  33357. *
  33358. * for loop possible cases:
  33359. *
  33360. * - test
  33361. * - test[idx]
  33362. * - test[test1[idx]]
  33363. * - test["a"][idx]
  33364. * - xxx.test[a[a].test1[idx]]
  33365. * - test.xxx.a["asa"][test1[idx]]
  33366. *
  33367. */
  33368. var len;
  33369. var str;
  33370. var chr;
  33371. var index$1;
  33372. var expressionPos;
  33373. var expressionEndPos;
  33374. function parseModel (val) {
  33375. str = val;
  33376. len = str.length;
  33377. index$1 = expressionPos = expressionEndPos = 0;
  33378. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  33379. return {
  33380. exp: val,
  33381. idx: null
  33382. }
  33383. }
  33384. while (!eof()) {
  33385. chr = next();
  33386. /* istanbul ignore if */
  33387. if (isStringStart(chr)) {
  33388. parseString(chr);
  33389. } else if (chr === 0x5B) {
  33390. parseBracket(chr);
  33391. }
  33392. }
  33393. return {
  33394. exp: val.substring(0, expressionPos),
  33395. idx: val.substring(expressionPos + 1, expressionEndPos)
  33396. }
  33397. }
  33398. function next () {
  33399. return str.charCodeAt(++index$1)
  33400. }
  33401. function eof () {
  33402. return index$1 >= len
  33403. }
  33404. function isStringStart (chr) {
  33405. return chr === 0x22 || chr === 0x27
  33406. }
  33407. function parseBracket (chr) {
  33408. var inBracket = 1;
  33409. expressionPos = index$1;
  33410. while (!eof()) {
  33411. chr = next();
  33412. if (isStringStart(chr)) {
  33413. parseString(chr);
  33414. continue
  33415. }
  33416. if (chr === 0x5B) { inBracket++; }
  33417. if (chr === 0x5D) { inBracket--; }
  33418. if (inBracket === 0) {
  33419. expressionEndPos = index$1;
  33420. break
  33421. }
  33422. }
  33423. }
  33424. function parseString (chr) {
  33425. var stringQuote = chr;
  33426. while (!eof()) {
  33427. chr = next();
  33428. if (chr === stringQuote) {
  33429. break
  33430. }
  33431. }
  33432. }
  33433. /* */
  33434. var warn$1;
  33435. // in some cases, the event used has to be determined at runtime
  33436. // so we used some reserved tokens during compile.
  33437. var RANGE_TOKEN = '__r';
  33438. var CHECKBOX_RADIO_TOKEN = '__c';
  33439. function model (
  33440. el,
  33441. dir,
  33442. _warn
  33443. ) {
  33444. warn$1 = _warn;
  33445. var value = dir.value;
  33446. var modifiers = dir.modifiers;
  33447. var tag = el.tag;
  33448. var type = el.attrsMap.type;
  33449. if (true) {
  33450. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  33451. if (tag === 'input' && dynamicType) {
  33452. warn$1(
  33453. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  33454. "v-model does not support dynamic input types. Use v-if branches instead."
  33455. );
  33456. }
  33457. // inputs with type="file" are read only and setting the input's
  33458. // value will throw an error.
  33459. if (tag === 'input' && type === 'file') {
  33460. warn$1(
  33461. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  33462. "File inputs are read only. Use a v-on:change listener instead."
  33463. );
  33464. }
  33465. }
  33466. if (el.component) {
  33467. genComponentModel(el, value, modifiers);
  33468. // component v-model doesn't need extra runtime
  33469. return false
  33470. } else if (tag === 'select') {
  33471. genSelect(el, value, modifiers);
  33472. } else if (tag === 'input' && type === 'checkbox') {
  33473. genCheckboxModel(el, value, modifiers);
  33474. } else if (tag === 'input' && type === 'radio') {
  33475. genRadioModel(el, value, modifiers);
  33476. } else if (tag === 'input' || tag === 'textarea') {
  33477. genDefaultModel(el, value, modifiers);
  33478. } else if (!config.isReservedTag(tag)) {
  33479. genComponentModel(el, value, modifiers);
  33480. // component v-model doesn't need extra runtime
  33481. return false
  33482. } else if (true) {
  33483. warn$1(
  33484. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  33485. "v-model is not supported on this element type. " +
  33486. 'If you are working with contenteditable, it\'s recommended to ' +
  33487. 'wrap a library dedicated for that purpose inside a custom component.'
  33488. );
  33489. }
  33490. // ensure runtime directive metadata
  33491. return true
  33492. }
  33493. function genCheckboxModel (
  33494. el,
  33495. value,
  33496. modifiers
  33497. ) {
  33498. var number = modifiers && modifiers.number;
  33499. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33500. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  33501. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  33502. addProp(el, 'checked',
  33503. "Array.isArray(" + value + ")" +
  33504. "?_i(" + value + "," + valueBinding + ")>-1" + (
  33505. trueValueBinding === 'true'
  33506. ? (":(" + value + ")")
  33507. : (":_q(" + value + "," + trueValueBinding + ")")
  33508. )
  33509. );
  33510. addHandler(el, CHECKBOX_RADIO_TOKEN,
  33511. "var $$a=" + value + "," +
  33512. '$$el=$event.target,' +
  33513. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  33514. 'if(Array.isArray($$a)){' +
  33515. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  33516. '$$i=_i($$a,$$v);' +
  33517. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  33518. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  33519. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  33520. null, true
  33521. );
  33522. }
  33523. function genRadioModel (
  33524. el,
  33525. value,
  33526. modifiers
  33527. ) {
  33528. var number = modifiers && modifiers.number;
  33529. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33530. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  33531. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  33532. addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
  33533. }
  33534. function genSelect (
  33535. el,
  33536. value,
  33537. modifiers
  33538. ) {
  33539. var number = modifiers && modifiers.number;
  33540. var selectedVal = "Array.prototype.filter" +
  33541. ".call($event.target.options,function(o){return o.selected})" +
  33542. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  33543. "return " + (number ? '_n(val)' : 'val') + "})";
  33544. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  33545. var code = "var $$selectedVal = " + selectedVal + ";";
  33546. code = code + " " + (genAssignmentCode(value, assignment));
  33547. addHandler(el, 'change', code, null, true);
  33548. }
  33549. function genDefaultModel (
  33550. el,
  33551. value,
  33552. modifiers
  33553. ) {
  33554. var type = el.attrsMap.type;
  33555. var ref = modifiers || {};
  33556. var lazy = ref.lazy;
  33557. var number = ref.number;
  33558. var trim = ref.trim;
  33559. var needCompositionGuard = !lazy && type !== 'range';
  33560. var event = lazy
  33561. ? 'change'
  33562. : type === 'range'
  33563. ? RANGE_TOKEN
  33564. : 'input';
  33565. var valueExpression = '$event.target.value';
  33566. if (trim) {
  33567. valueExpression = "$event.target.value.trim()";
  33568. }
  33569. if (number) {
  33570. valueExpression = "_n(" + valueExpression + ")";
  33571. }
  33572. var code = genAssignmentCode(value, valueExpression);
  33573. if (needCompositionGuard) {
  33574. code = "if($event.target.composing)return;" + code;
  33575. }
  33576. addProp(el, 'value', ("(" + value + ")"));
  33577. addHandler(el, event, code, null, true);
  33578. if (trim || number) {
  33579. addHandler(el, 'blur', '$forceUpdate()');
  33580. }
  33581. }
  33582. /* */
  33583. // normalize v-model event tokens that can only be determined at runtime.
  33584. // it's important to place the event as the first in the array because
  33585. // the whole point is ensuring the v-model callback gets called before
  33586. // user-attached handlers.
  33587. function normalizeEvents (on) {
  33588. var event;
  33589. /* istanbul ignore if */
  33590. if (isDef(on[RANGE_TOKEN])) {
  33591. // IE input[type=range] only supports `change` event
  33592. event = isIE ? 'change' : 'input';
  33593. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  33594. delete on[RANGE_TOKEN];
  33595. }
  33596. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  33597. // Chrome fires microtasks in between click/change, leads to #4521
  33598. event = isChrome ? 'click' : 'change';
  33599. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  33600. delete on[CHECKBOX_RADIO_TOKEN];
  33601. }
  33602. }
  33603. var target$1;
  33604. function add$1 (
  33605. event,
  33606. handler,
  33607. once$$1,
  33608. capture,
  33609. passive
  33610. ) {
  33611. if (once$$1) {
  33612. var oldHandler = handler;
  33613. var _target = target$1; // save current target element in closure
  33614. handler = function (ev) {
  33615. var res = arguments.length === 1
  33616. ? oldHandler(ev)
  33617. : oldHandler.apply(null, arguments);
  33618. if (res !== null) {
  33619. remove$2(event, handler, capture, _target);
  33620. }
  33621. };
  33622. }
  33623. target$1.addEventListener(
  33624. event,
  33625. handler,
  33626. supportsPassive
  33627. ? { capture: capture, passive: passive }
  33628. : capture
  33629. );
  33630. }
  33631. function remove$2 (
  33632. event,
  33633. handler,
  33634. capture,
  33635. _target
  33636. ) {
  33637. (_target || target$1).removeEventListener(event, handler, capture);
  33638. }
  33639. function updateDOMListeners (oldVnode, vnode) {
  33640. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  33641. return
  33642. }
  33643. var on = vnode.data.on || {};
  33644. var oldOn = oldVnode.data.on || {};
  33645. target$1 = vnode.elm;
  33646. normalizeEvents(on);
  33647. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  33648. }
  33649. var events = {
  33650. create: updateDOMListeners,
  33651. update: updateDOMListeners
  33652. };
  33653. /* */
  33654. function updateDOMProps (oldVnode, vnode) {
  33655. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  33656. return
  33657. }
  33658. var key, cur;
  33659. var elm = vnode.elm;
  33660. var oldProps = oldVnode.data.domProps || {};
  33661. var props = vnode.data.domProps || {};
  33662. // clone observed objects, as the user probably wants to mutate it
  33663. if (isDef(props.__ob__)) {
  33664. props = vnode.data.domProps = extend({}, props);
  33665. }
  33666. for (key in oldProps) {
  33667. if (isUndef(props[key])) {
  33668. elm[key] = '';
  33669. }
  33670. }
  33671. for (key in props) {
  33672. cur = props[key];
  33673. // ignore children if the node has textContent or innerHTML,
  33674. // as these will throw away existing DOM nodes and cause removal errors
  33675. // on subsequent patches (#3360)
  33676. if (key === 'textContent' || key === 'innerHTML') {
  33677. if (vnode.children) { vnode.children.length = 0; }
  33678. if (cur === oldProps[key]) { continue }
  33679. }
  33680. if (key === 'value') {
  33681. // store value as _value as well since
  33682. // non-string values will be stringified
  33683. elm._value = cur;
  33684. // avoid resetting cursor position when value is the same
  33685. var strCur = isUndef(cur) ? '' : String(cur);
  33686. if (shouldUpdateValue(elm, vnode, strCur)) {
  33687. elm.value = strCur;
  33688. }
  33689. } else {
  33690. elm[key] = cur;
  33691. }
  33692. }
  33693. }
  33694. // check platforms/web/util/attrs.js acceptValue
  33695. function shouldUpdateValue (
  33696. elm,
  33697. vnode,
  33698. checkVal
  33699. ) {
  33700. return (!elm.composing && (
  33701. vnode.tag === 'option' ||
  33702. isDirty(elm, checkVal) ||
  33703. isInputChanged(elm, checkVal)
  33704. ))
  33705. }
  33706. function isDirty (elm, checkVal) {
  33707. // return true when textbox (.number and .trim) loses focus and its value is
  33708. // not equal to the updated value
  33709. var notInFocus = true;
  33710. // #6157
  33711. // work around IE bug when accessing document.activeElement in an iframe
  33712. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  33713. return notInFocus && elm.value !== checkVal
  33714. }
  33715. function isInputChanged (elm, newVal) {
  33716. var value = elm.value;
  33717. var modifiers = elm._vModifiers; // injected by v-model runtime
  33718. if (isDef(modifiers) && modifiers.number) {
  33719. return toNumber(value) !== toNumber(newVal)
  33720. }
  33721. if (isDef(modifiers) && modifiers.trim) {
  33722. return value.trim() !== newVal.trim()
  33723. }
  33724. return value !== newVal
  33725. }
  33726. var domProps = {
  33727. create: updateDOMProps,
  33728. update: updateDOMProps
  33729. };
  33730. /* */
  33731. var parseStyleText = cached(function (cssText) {
  33732. var res = {};
  33733. var listDelimiter = /;(?![^(]*\))/g;
  33734. var propertyDelimiter = /:(.+)/;
  33735. cssText.split(listDelimiter).forEach(function (item) {
  33736. if (item) {
  33737. var tmp = item.split(propertyDelimiter);
  33738. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  33739. }
  33740. });
  33741. return res
  33742. });
  33743. // merge static and dynamic style data on the same vnode
  33744. function normalizeStyleData (data) {
  33745. var style = normalizeStyleBinding(data.style);
  33746. // static style is pre-processed into an object during compilation
  33747. // and is always a fresh object, so it's safe to merge into it
  33748. return data.staticStyle
  33749. ? extend(data.staticStyle, style)
  33750. : style
  33751. }
  33752. // normalize possible array / string values into Object
  33753. function normalizeStyleBinding (bindingStyle) {
  33754. if (Array.isArray(bindingStyle)) {
  33755. return toObject(bindingStyle)
  33756. }
  33757. if (typeof bindingStyle === 'string') {
  33758. return parseStyleText(bindingStyle)
  33759. }
  33760. return bindingStyle
  33761. }
  33762. /**
  33763. * parent component style should be after child's
  33764. * so that parent component's style could override it
  33765. */
  33766. function getStyle (vnode, checkChild) {
  33767. var res = {};
  33768. var styleData;
  33769. if (checkChild) {
  33770. var childNode = vnode;
  33771. while (childNode.componentInstance) {
  33772. childNode = childNode.componentInstance._vnode;
  33773. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  33774. extend(res, styleData);
  33775. }
  33776. }
  33777. }
  33778. if ((styleData = normalizeStyleData(vnode.data))) {
  33779. extend(res, styleData);
  33780. }
  33781. var parentNode = vnode;
  33782. while ((parentNode = parentNode.parent)) {
  33783. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  33784. extend(res, styleData);
  33785. }
  33786. }
  33787. return res
  33788. }
  33789. /* */
  33790. var cssVarRE = /^--/;
  33791. var importantRE = /\s*!important$/;
  33792. var setProp = function (el, name, val) {
  33793. /* istanbul ignore if */
  33794. if (cssVarRE.test(name)) {
  33795. el.style.setProperty(name, val);
  33796. } else if (importantRE.test(val)) {
  33797. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  33798. } else {
  33799. var normalizedName = normalize(name);
  33800. if (Array.isArray(val)) {
  33801. // Support values array created by autoprefixer, e.g.
  33802. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  33803. // Set them one by one, and the browser will only set those it can recognize
  33804. for (var i = 0, len = val.length; i < len; i++) {
  33805. el.style[normalizedName] = val[i];
  33806. }
  33807. } else {
  33808. el.style[normalizedName] = val;
  33809. }
  33810. }
  33811. };
  33812. var vendorNames = ['Webkit', 'Moz', 'ms'];
  33813. var emptyStyle;
  33814. var normalize = cached(function (prop) {
  33815. emptyStyle = emptyStyle || document.createElement('div').style;
  33816. prop = camelize(prop);
  33817. if (prop !== 'filter' && (prop in emptyStyle)) {
  33818. return prop
  33819. }
  33820. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  33821. for (var i = 0; i < vendorNames.length; i++) {
  33822. var name = vendorNames[i] + capName;
  33823. if (name in emptyStyle) {
  33824. return name
  33825. }
  33826. }
  33827. });
  33828. function updateStyle (oldVnode, vnode) {
  33829. var data = vnode.data;
  33830. var oldData = oldVnode.data;
  33831. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  33832. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  33833. ) {
  33834. return
  33835. }
  33836. var cur, name;
  33837. var el = vnode.elm;
  33838. var oldStaticStyle = oldData.staticStyle;
  33839. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  33840. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  33841. var oldStyle = oldStaticStyle || oldStyleBinding;
  33842. var style = normalizeStyleBinding(vnode.data.style) || {};
  33843. // store normalized style under a different key for next diff
  33844. // make sure to clone it if it's reactive, since the user likley wants
  33845. // to mutate it.
  33846. vnode.data.normalizedStyle = isDef(style.__ob__)
  33847. ? extend({}, style)
  33848. : style;
  33849. var newStyle = getStyle(vnode, true);
  33850. for (name in oldStyle) {
  33851. if (isUndef(newStyle[name])) {
  33852. setProp(el, name, '');
  33853. }
  33854. }
  33855. for (name in newStyle) {
  33856. cur = newStyle[name];
  33857. if (cur !== oldStyle[name]) {
  33858. // ie9 setting to null has no effect, must use empty string
  33859. setProp(el, name, cur == null ? '' : cur);
  33860. }
  33861. }
  33862. }
  33863. var style = {
  33864. create: updateStyle,
  33865. update: updateStyle
  33866. };
  33867. /* */
  33868. /**
  33869. * Add class with compatibility for SVG since classList is not supported on
  33870. * SVG elements in IE
  33871. */
  33872. function addClass (el, cls) {
  33873. /* istanbul ignore if */
  33874. if (!cls || !(cls = cls.trim())) {
  33875. return
  33876. }
  33877. /* istanbul ignore else */
  33878. if (el.classList) {
  33879. if (cls.indexOf(' ') > -1) {
  33880. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  33881. } else {
  33882. el.classList.add(cls);
  33883. }
  33884. } else {
  33885. var cur = " " + (el.getAttribute('class') || '') + " ";
  33886. if (cur.indexOf(' ' + cls + ' ') < 0) {
  33887. el.setAttribute('class', (cur + cls).trim());
  33888. }
  33889. }
  33890. }
  33891. /**
  33892. * Remove class with compatibility for SVG since classList is not supported on
  33893. * SVG elements in IE
  33894. */
  33895. function removeClass (el, cls) {
  33896. /* istanbul ignore if */
  33897. if (!cls || !(cls = cls.trim())) {
  33898. return
  33899. }
  33900. /* istanbul ignore else */
  33901. if (el.classList) {
  33902. if (cls.indexOf(' ') > -1) {
  33903. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  33904. } else {
  33905. el.classList.remove(cls);
  33906. }
  33907. if (!el.classList.length) {
  33908. el.removeAttribute('class');
  33909. }
  33910. } else {
  33911. var cur = " " + (el.getAttribute('class') || '') + " ";
  33912. var tar = ' ' + cls + ' ';
  33913. while (cur.indexOf(tar) >= 0) {
  33914. cur = cur.replace(tar, ' ');
  33915. }
  33916. cur = cur.trim();
  33917. if (cur) {
  33918. el.setAttribute('class', cur);
  33919. } else {
  33920. el.removeAttribute('class');
  33921. }
  33922. }
  33923. }
  33924. /* */
  33925. function resolveTransition (def$$1) {
  33926. if (!def$$1) {
  33927. return
  33928. }
  33929. /* istanbul ignore else */
  33930. if (typeof def$$1 === 'object') {
  33931. var res = {};
  33932. if (def$$1.css !== false) {
  33933. extend(res, autoCssTransition(def$$1.name || 'v'));
  33934. }
  33935. extend(res, def$$1);
  33936. return res
  33937. } else if (typeof def$$1 === 'string') {
  33938. return autoCssTransition(def$$1)
  33939. }
  33940. }
  33941. var autoCssTransition = cached(function (name) {
  33942. return {
  33943. enterClass: (name + "-enter"),
  33944. enterToClass: (name + "-enter-to"),
  33945. enterActiveClass: (name + "-enter-active"),
  33946. leaveClass: (name + "-leave"),
  33947. leaveToClass: (name + "-leave-to"),
  33948. leaveActiveClass: (name + "-leave-active")
  33949. }
  33950. });
  33951. var hasTransition = inBrowser && !isIE9;
  33952. var TRANSITION = 'transition';
  33953. var ANIMATION = 'animation';
  33954. // Transition property/event sniffing
  33955. var transitionProp = 'transition';
  33956. var transitionEndEvent = 'transitionend';
  33957. var animationProp = 'animation';
  33958. var animationEndEvent = 'animationend';
  33959. if (hasTransition) {
  33960. /* istanbul ignore if */
  33961. if (window.ontransitionend === undefined &&
  33962. window.onwebkittransitionend !== undefined
  33963. ) {
  33964. transitionProp = 'WebkitTransition';
  33965. transitionEndEvent = 'webkitTransitionEnd';
  33966. }
  33967. if (window.onanimationend === undefined &&
  33968. window.onwebkitanimationend !== undefined
  33969. ) {
  33970. animationProp = 'WebkitAnimation';
  33971. animationEndEvent = 'webkitAnimationEnd';
  33972. }
  33973. }
  33974. // binding to window is necessary to make hot reload work in IE in strict mode
  33975. var raf = inBrowser && window.requestAnimationFrame
  33976. ? window.requestAnimationFrame.bind(window)
  33977. : setTimeout;
  33978. function nextFrame (fn) {
  33979. raf(function () {
  33980. raf(fn);
  33981. });
  33982. }
  33983. function addTransitionClass (el, cls) {
  33984. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  33985. if (transitionClasses.indexOf(cls) < 0) {
  33986. transitionClasses.push(cls);
  33987. addClass(el, cls);
  33988. }
  33989. }
  33990. function removeTransitionClass (el, cls) {
  33991. if (el._transitionClasses) {
  33992. remove(el._transitionClasses, cls);
  33993. }
  33994. removeClass(el, cls);
  33995. }
  33996. function whenTransitionEnds (
  33997. el,
  33998. expectedType,
  33999. cb
  34000. ) {
  34001. var ref = getTransitionInfo(el, expectedType);
  34002. var type = ref.type;
  34003. var timeout = ref.timeout;
  34004. var propCount = ref.propCount;
  34005. if (!type) { return cb() }
  34006. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  34007. var ended = 0;
  34008. var end = function () {
  34009. el.removeEventListener(event, onEnd);
  34010. cb();
  34011. };
  34012. var onEnd = function (e) {
  34013. if (e.target === el) {
  34014. if (++ended >= propCount) {
  34015. end();
  34016. }
  34017. }
  34018. };
  34019. setTimeout(function () {
  34020. if (ended < propCount) {
  34021. end();
  34022. }
  34023. }, timeout + 1);
  34024. el.addEventListener(event, onEnd);
  34025. }
  34026. var transformRE = /\b(transform|all)(,|$)/;
  34027. function getTransitionInfo (el, expectedType) {
  34028. var styles = window.getComputedStyle(el);
  34029. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  34030. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  34031. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  34032. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  34033. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  34034. var animationTimeout = getTimeout(animationDelays, animationDurations);
  34035. var type;
  34036. var timeout = 0;
  34037. var propCount = 0;
  34038. /* istanbul ignore if */
  34039. if (expectedType === TRANSITION) {
  34040. if (transitionTimeout > 0) {
  34041. type = TRANSITION;
  34042. timeout = transitionTimeout;
  34043. propCount = transitionDurations.length;
  34044. }
  34045. } else if (expectedType === ANIMATION) {
  34046. if (animationTimeout > 0) {
  34047. type = ANIMATION;
  34048. timeout = animationTimeout;
  34049. propCount = animationDurations.length;
  34050. }
  34051. } else {
  34052. timeout = Math.max(transitionTimeout, animationTimeout);
  34053. type = timeout > 0
  34054. ? transitionTimeout > animationTimeout
  34055. ? TRANSITION
  34056. : ANIMATION
  34057. : null;
  34058. propCount = type
  34059. ? type === TRANSITION
  34060. ? transitionDurations.length
  34061. : animationDurations.length
  34062. : 0;
  34063. }
  34064. var hasTransform =
  34065. type === TRANSITION &&
  34066. transformRE.test(styles[transitionProp + 'Property']);
  34067. return {
  34068. type: type,
  34069. timeout: timeout,
  34070. propCount: propCount,
  34071. hasTransform: hasTransform
  34072. }
  34073. }
  34074. function getTimeout (delays, durations) {
  34075. /* istanbul ignore next */
  34076. while (delays.length < durations.length) {
  34077. delays = delays.concat(delays);
  34078. }
  34079. return Math.max.apply(null, durations.map(function (d, i) {
  34080. return toMs(d) + toMs(delays[i])
  34081. }))
  34082. }
  34083. function toMs (s) {
  34084. return Number(s.slice(0, -1)) * 1000
  34085. }
  34086. /* */
  34087. function enter (vnode, toggleDisplay) {
  34088. var el = vnode.elm;
  34089. // call leave callback now
  34090. if (isDef(el._leaveCb)) {
  34091. el._leaveCb.cancelled = true;
  34092. el._leaveCb();
  34093. }
  34094. var data = resolveTransition(vnode.data.transition);
  34095. if (isUndef(data)) {
  34096. return
  34097. }
  34098. /* istanbul ignore if */
  34099. if (isDef(el._enterCb) || el.nodeType !== 1) {
  34100. return
  34101. }
  34102. var css = data.css;
  34103. var type = data.type;
  34104. var enterClass = data.enterClass;
  34105. var enterToClass = data.enterToClass;
  34106. var enterActiveClass = data.enterActiveClass;
  34107. var appearClass = data.appearClass;
  34108. var appearToClass = data.appearToClass;
  34109. var appearActiveClass = data.appearActiveClass;
  34110. var beforeEnter = data.beforeEnter;
  34111. var enter = data.enter;
  34112. var afterEnter = data.afterEnter;
  34113. var enterCancelled = data.enterCancelled;
  34114. var beforeAppear = data.beforeAppear;
  34115. var appear = data.appear;
  34116. var afterAppear = data.afterAppear;
  34117. var appearCancelled = data.appearCancelled;
  34118. var duration = data.duration;
  34119. // activeInstance will always be the <transition> component managing this
  34120. // transition. One edge case to check is when the <transition> is placed
  34121. // as the root node of a child component. In that case we need to check
  34122. // <transition>'s parent for appear check.
  34123. var context = activeInstance;
  34124. var transitionNode = activeInstance.$vnode;
  34125. while (transitionNode && transitionNode.parent) {
  34126. transitionNode = transitionNode.parent;
  34127. context = transitionNode.context;
  34128. }
  34129. var isAppear = !context._isMounted || !vnode.isRootInsert;
  34130. if (isAppear && !appear && appear !== '') {
  34131. return
  34132. }
  34133. var startClass = isAppear && appearClass
  34134. ? appearClass
  34135. : enterClass;
  34136. var activeClass = isAppear && appearActiveClass
  34137. ? appearActiveClass
  34138. : enterActiveClass;
  34139. var toClass = isAppear && appearToClass
  34140. ? appearToClass
  34141. : enterToClass;
  34142. var beforeEnterHook = isAppear
  34143. ? (beforeAppear || beforeEnter)
  34144. : beforeEnter;
  34145. var enterHook = isAppear
  34146. ? (typeof appear === 'function' ? appear : enter)
  34147. : enter;
  34148. var afterEnterHook = isAppear
  34149. ? (afterAppear || afterEnter)
  34150. : afterEnter;
  34151. var enterCancelledHook = isAppear
  34152. ? (appearCancelled || enterCancelled)
  34153. : enterCancelled;
  34154. var explicitEnterDuration = toNumber(
  34155. isObject(duration)
  34156. ? duration.enter
  34157. : duration
  34158. );
  34159. if ("development" !== 'production' && explicitEnterDuration != null) {
  34160. checkDuration(explicitEnterDuration, 'enter', vnode);
  34161. }
  34162. var expectsCSS = css !== false && !isIE9;
  34163. var userWantsControl = getHookArgumentsLength(enterHook);
  34164. var cb = el._enterCb = once(function () {
  34165. if (expectsCSS) {
  34166. removeTransitionClass(el, toClass);
  34167. removeTransitionClass(el, activeClass);
  34168. }
  34169. if (cb.cancelled) {
  34170. if (expectsCSS) {
  34171. removeTransitionClass(el, startClass);
  34172. }
  34173. enterCancelledHook && enterCancelledHook(el);
  34174. } else {
  34175. afterEnterHook && afterEnterHook(el);
  34176. }
  34177. el._enterCb = null;
  34178. });
  34179. if (!vnode.data.show) {
  34180. // remove pending leave element on enter by injecting an insert hook
  34181. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  34182. var parent = el.parentNode;
  34183. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  34184. if (pendingNode &&
  34185. pendingNode.tag === vnode.tag &&
  34186. pendingNode.elm._leaveCb
  34187. ) {
  34188. pendingNode.elm._leaveCb();
  34189. }
  34190. enterHook && enterHook(el, cb);
  34191. });
  34192. }
  34193. // start enter transition
  34194. beforeEnterHook && beforeEnterHook(el);
  34195. if (expectsCSS) {
  34196. addTransitionClass(el, startClass);
  34197. addTransitionClass(el, activeClass);
  34198. nextFrame(function () {
  34199. addTransitionClass(el, toClass);
  34200. removeTransitionClass(el, startClass);
  34201. if (!cb.cancelled && !userWantsControl) {
  34202. if (isValidDuration(explicitEnterDuration)) {
  34203. setTimeout(cb, explicitEnterDuration);
  34204. } else {
  34205. whenTransitionEnds(el, type, cb);
  34206. }
  34207. }
  34208. });
  34209. }
  34210. if (vnode.data.show) {
  34211. toggleDisplay && toggleDisplay();
  34212. enterHook && enterHook(el, cb);
  34213. }
  34214. if (!expectsCSS && !userWantsControl) {
  34215. cb();
  34216. }
  34217. }
  34218. function leave (vnode, rm) {
  34219. var el = vnode.elm;
  34220. // call enter callback now
  34221. if (isDef(el._enterCb)) {
  34222. el._enterCb.cancelled = true;
  34223. el._enterCb();
  34224. }
  34225. var data = resolveTransition(vnode.data.transition);
  34226. if (isUndef(data)) {
  34227. return rm()
  34228. }
  34229. /* istanbul ignore if */
  34230. if (isDef(el._leaveCb) || el.nodeType !== 1) {
  34231. return
  34232. }
  34233. var css = data.css;
  34234. var type = data.type;
  34235. var leaveClass = data.leaveClass;
  34236. var leaveToClass = data.leaveToClass;
  34237. var leaveActiveClass = data.leaveActiveClass;
  34238. var beforeLeave = data.beforeLeave;
  34239. var leave = data.leave;
  34240. var afterLeave = data.afterLeave;
  34241. var leaveCancelled = data.leaveCancelled;
  34242. var delayLeave = data.delayLeave;
  34243. var duration = data.duration;
  34244. var expectsCSS = css !== false && !isIE9;
  34245. var userWantsControl = getHookArgumentsLength(leave);
  34246. var explicitLeaveDuration = toNumber(
  34247. isObject(duration)
  34248. ? duration.leave
  34249. : duration
  34250. );
  34251. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  34252. checkDuration(explicitLeaveDuration, 'leave', vnode);
  34253. }
  34254. var cb = el._leaveCb = once(function () {
  34255. if (el.parentNode && el.parentNode._pending) {
  34256. el.parentNode._pending[vnode.key] = null;
  34257. }
  34258. if (expectsCSS) {
  34259. removeTransitionClass(el, leaveToClass);
  34260. removeTransitionClass(el, leaveActiveClass);
  34261. }
  34262. if (cb.cancelled) {
  34263. if (expectsCSS) {
  34264. removeTransitionClass(el, leaveClass);
  34265. }
  34266. leaveCancelled && leaveCancelled(el);
  34267. } else {
  34268. rm();
  34269. afterLeave && afterLeave(el);
  34270. }
  34271. el._leaveCb = null;
  34272. });
  34273. if (delayLeave) {
  34274. delayLeave(performLeave);
  34275. } else {
  34276. performLeave();
  34277. }
  34278. function performLeave () {
  34279. // the delayed leave may have already been cancelled
  34280. if (cb.cancelled) {
  34281. return
  34282. }
  34283. // record leaving element
  34284. if (!vnode.data.show) {
  34285. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  34286. }
  34287. beforeLeave && beforeLeave(el);
  34288. if (expectsCSS) {
  34289. addTransitionClass(el, leaveClass);
  34290. addTransitionClass(el, leaveActiveClass);
  34291. nextFrame(function () {
  34292. addTransitionClass(el, leaveToClass);
  34293. removeTransitionClass(el, leaveClass);
  34294. if (!cb.cancelled && !userWantsControl) {
  34295. if (isValidDuration(explicitLeaveDuration)) {
  34296. setTimeout(cb, explicitLeaveDuration);
  34297. } else {
  34298. whenTransitionEnds(el, type, cb);
  34299. }
  34300. }
  34301. });
  34302. }
  34303. leave && leave(el, cb);
  34304. if (!expectsCSS && !userWantsControl) {
  34305. cb();
  34306. }
  34307. }
  34308. }
  34309. // only used in dev mode
  34310. function checkDuration (val, name, vnode) {
  34311. if (typeof val !== 'number') {
  34312. warn(
  34313. "<transition> explicit " + name + " duration is not a valid number - " +
  34314. "got " + (JSON.stringify(val)) + ".",
  34315. vnode.context
  34316. );
  34317. } else if (isNaN(val)) {
  34318. warn(
  34319. "<transition> explicit " + name + " duration is NaN - " +
  34320. 'the duration expression might be incorrect.',
  34321. vnode.context
  34322. );
  34323. }
  34324. }
  34325. function isValidDuration (val) {
  34326. return typeof val === 'number' && !isNaN(val)
  34327. }
  34328. /**
  34329. * Normalize a transition hook's argument length. The hook may be:
  34330. * - a merged hook (invoker) with the original in .fns
  34331. * - a wrapped component method (check ._length)
  34332. * - a plain function (.length)
  34333. */
  34334. function getHookArgumentsLength (fn) {
  34335. if (isUndef(fn)) {
  34336. return false
  34337. }
  34338. var invokerFns = fn.fns;
  34339. if (isDef(invokerFns)) {
  34340. // invoker
  34341. return getHookArgumentsLength(
  34342. Array.isArray(invokerFns)
  34343. ? invokerFns[0]
  34344. : invokerFns
  34345. )
  34346. } else {
  34347. return (fn._length || fn.length) > 1
  34348. }
  34349. }
  34350. function _enter (_, vnode) {
  34351. if (vnode.data.show !== true) {
  34352. enter(vnode);
  34353. }
  34354. }
  34355. var transition = inBrowser ? {
  34356. create: _enter,
  34357. activate: _enter,
  34358. remove: function remove$$1 (vnode, rm) {
  34359. /* istanbul ignore else */
  34360. if (vnode.data.show !== true) {
  34361. leave(vnode, rm);
  34362. } else {
  34363. rm();
  34364. }
  34365. }
  34366. } : {};
  34367. var platformModules = [
  34368. attrs,
  34369. klass,
  34370. events,
  34371. domProps,
  34372. style,
  34373. transition
  34374. ];
  34375. /* */
  34376. // the directive module should be applied last, after all
  34377. // built-in modules have been applied.
  34378. var modules = platformModules.concat(baseModules);
  34379. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  34380. /**
  34381. * Not type checking this file because flow doesn't like attaching
  34382. * properties to Elements.
  34383. */
  34384. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  34385. /* istanbul ignore if */
  34386. if (isIE9) {
  34387. // http://www.matts411.com/post/internet-explorer-9-oninput/
  34388. document.addEventListener('selectionchange', function () {
  34389. var el = document.activeElement;
  34390. if (el && el.vmodel) {
  34391. trigger(el, 'input');
  34392. }
  34393. });
  34394. }
  34395. var model$1 = {
  34396. inserted: function inserted (el, binding, vnode) {
  34397. if (vnode.tag === 'select') {
  34398. var cb = function () {
  34399. setSelected(el, binding, vnode.context);
  34400. };
  34401. cb();
  34402. /* istanbul ignore if */
  34403. if (isIE || isEdge) {
  34404. setTimeout(cb, 0);
  34405. }
  34406. el._vOptions = [].map.call(el.options, getValue);
  34407. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  34408. el._vModifiers = binding.modifiers;
  34409. if (!binding.modifiers.lazy) {
  34410. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  34411. // switching focus before confirming composition choice
  34412. // this also fixes the issue where some browsers e.g. iOS Chrome
  34413. // fires "change" instead of "input" on autocomplete.
  34414. el.addEventListener('change', onCompositionEnd);
  34415. if (!isAndroid) {
  34416. el.addEventListener('compositionstart', onCompositionStart);
  34417. el.addEventListener('compositionend', onCompositionEnd);
  34418. }
  34419. /* istanbul ignore if */
  34420. if (isIE9) {
  34421. el.vmodel = true;
  34422. }
  34423. }
  34424. }
  34425. },
  34426. componentUpdated: function componentUpdated (el, binding, vnode) {
  34427. if (vnode.tag === 'select') {
  34428. setSelected(el, binding, vnode.context);
  34429. // in case the options rendered by v-for have changed,
  34430. // it's possible that the value is out-of-sync with the rendered options.
  34431. // detect such cases and filter out values that no longer has a matching
  34432. // option in the DOM.
  34433. var prevOptions = el._vOptions;
  34434. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  34435. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  34436. trigger(el, 'change');
  34437. }
  34438. }
  34439. }
  34440. };
  34441. function setSelected (el, binding, vm) {
  34442. var value = binding.value;
  34443. var isMultiple = el.multiple;
  34444. if (isMultiple && !Array.isArray(value)) {
  34445. "development" !== 'production' && warn(
  34446. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  34447. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  34448. vm
  34449. );
  34450. return
  34451. }
  34452. var selected, option;
  34453. for (var i = 0, l = el.options.length; i < l; i++) {
  34454. option = el.options[i];
  34455. if (isMultiple) {
  34456. selected = looseIndexOf(value, getValue(option)) > -1;
  34457. if (option.selected !== selected) {
  34458. option.selected = selected;
  34459. }
  34460. } else {
  34461. if (looseEqual(getValue(option), value)) {
  34462. if (el.selectedIndex !== i) {
  34463. el.selectedIndex = i;
  34464. }
  34465. return
  34466. }
  34467. }
  34468. }
  34469. if (!isMultiple) {
  34470. el.selectedIndex = -1;
  34471. }
  34472. }
  34473. function getValue (option) {
  34474. return '_value' in option
  34475. ? option._value
  34476. : option.value
  34477. }
  34478. function onCompositionStart (e) {
  34479. e.target.composing = true;
  34480. }
  34481. function onCompositionEnd (e) {
  34482. // prevent triggering an input event for no reason
  34483. if (!e.target.composing) { return }
  34484. e.target.composing = false;
  34485. trigger(e.target, 'input');
  34486. }
  34487. function trigger (el, type) {
  34488. var e = document.createEvent('HTMLEvents');
  34489. e.initEvent(type, true, true);
  34490. el.dispatchEvent(e);
  34491. }
  34492. /* */
  34493. // recursively search for possible transition defined inside the component root
  34494. function locateNode (vnode) {
  34495. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  34496. ? locateNode(vnode.componentInstance._vnode)
  34497. : vnode
  34498. }
  34499. var show = {
  34500. bind: function bind (el, ref, vnode) {
  34501. var value = ref.value;
  34502. vnode = locateNode(vnode);
  34503. var transition$$1 = vnode.data && vnode.data.transition;
  34504. var originalDisplay = el.__vOriginalDisplay =
  34505. el.style.display === 'none' ? '' : el.style.display;
  34506. if (value && transition$$1) {
  34507. vnode.data.show = true;
  34508. enter(vnode, function () {
  34509. el.style.display = originalDisplay;
  34510. });
  34511. } else {
  34512. el.style.display = value ? originalDisplay : 'none';
  34513. }
  34514. },
  34515. update: function update (el, ref, vnode) {
  34516. var value = ref.value;
  34517. var oldValue = ref.oldValue;
  34518. /* istanbul ignore if */
  34519. if (value === oldValue) { return }
  34520. vnode = locateNode(vnode);
  34521. var transition$$1 = vnode.data && vnode.data.transition;
  34522. if (transition$$1) {
  34523. vnode.data.show = true;
  34524. if (value) {
  34525. enter(vnode, function () {
  34526. el.style.display = el.__vOriginalDisplay;
  34527. });
  34528. } else {
  34529. leave(vnode, function () {
  34530. el.style.display = 'none';
  34531. });
  34532. }
  34533. } else {
  34534. el.style.display = value ? el.__vOriginalDisplay : 'none';
  34535. }
  34536. },
  34537. unbind: function unbind (
  34538. el,
  34539. binding,
  34540. vnode,
  34541. oldVnode,
  34542. isDestroy
  34543. ) {
  34544. if (!isDestroy) {
  34545. el.style.display = el.__vOriginalDisplay;
  34546. }
  34547. }
  34548. };
  34549. var platformDirectives = {
  34550. model: model$1,
  34551. show: show
  34552. };
  34553. /* */
  34554. // Provides transition support for a single element/component.
  34555. // supports transition mode (out-in / in-out)
  34556. var transitionProps = {
  34557. name: String,
  34558. appear: Boolean,
  34559. css: Boolean,
  34560. mode: String,
  34561. type: String,
  34562. enterClass: String,
  34563. leaveClass: String,
  34564. enterToClass: String,
  34565. leaveToClass: String,
  34566. enterActiveClass: String,
  34567. leaveActiveClass: String,
  34568. appearClass: String,
  34569. appearActiveClass: String,
  34570. appearToClass: String,
  34571. duration: [Number, String, Object]
  34572. };
  34573. // in case the child is also an abstract component, e.g. <keep-alive>
  34574. // we want to recursively retrieve the real component to be rendered
  34575. function getRealChild (vnode) {
  34576. var compOptions = vnode && vnode.componentOptions;
  34577. if (compOptions && compOptions.Ctor.options.abstract) {
  34578. return getRealChild(getFirstComponentChild(compOptions.children))
  34579. } else {
  34580. return vnode
  34581. }
  34582. }
  34583. function extractTransitionData (comp) {
  34584. var data = {};
  34585. var options = comp.$options;
  34586. // props
  34587. for (var key in options.propsData) {
  34588. data[key] = comp[key];
  34589. }
  34590. // events.
  34591. // extract listeners and pass them directly to the transition methods
  34592. var listeners = options._parentListeners;
  34593. for (var key$1 in listeners) {
  34594. data[camelize(key$1)] = listeners[key$1];
  34595. }
  34596. return data
  34597. }
  34598. function placeholder (h, rawChild) {
  34599. if (/\d-keep-alive$/.test(rawChild.tag)) {
  34600. return h('keep-alive', {
  34601. props: rawChild.componentOptions.propsData
  34602. })
  34603. }
  34604. }
  34605. function hasParentTransition (vnode) {
  34606. while ((vnode = vnode.parent)) {
  34607. if (vnode.data.transition) {
  34608. return true
  34609. }
  34610. }
  34611. }
  34612. function isSameChild (child, oldChild) {
  34613. return oldChild.key === child.key && oldChild.tag === child.tag
  34614. }
  34615. function isAsyncPlaceholder (node) {
  34616. return node.isComment && node.asyncFactory
  34617. }
  34618. var Transition = {
  34619. name: 'transition',
  34620. props: transitionProps,
  34621. abstract: true,
  34622. render: function render (h) {
  34623. var this$1 = this;
  34624. var children = this.$options._renderChildren;
  34625. if (!children) {
  34626. return
  34627. }
  34628. // filter out text nodes (possible whitespaces)
  34629. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  34630. /* istanbul ignore if */
  34631. if (!children.length) {
  34632. return
  34633. }
  34634. // warn multiple elements
  34635. if ("development" !== 'production' && children.length > 1) {
  34636. warn(
  34637. '<transition> can only be used on a single element. Use ' +
  34638. '<transition-group> for lists.',
  34639. this.$parent
  34640. );
  34641. }
  34642. var mode = this.mode;
  34643. // warn invalid mode
  34644. if ("development" !== 'production' &&
  34645. mode && mode !== 'in-out' && mode !== 'out-in'
  34646. ) {
  34647. warn(
  34648. 'invalid <transition> mode: ' + mode,
  34649. this.$parent
  34650. );
  34651. }
  34652. var rawChild = children[0];
  34653. // if this is a component root node and the component's
  34654. // parent container node also has transition, skip.
  34655. if (hasParentTransition(this.$vnode)) {
  34656. return rawChild
  34657. }
  34658. // apply transition data to child
  34659. // use getRealChild() to ignore abstract components e.g. keep-alive
  34660. var child = getRealChild(rawChild);
  34661. /* istanbul ignore if */
  34662. if (!child) {
  34663. return rawChild
  34664. }
  34665. if (this._leaving) {
  34666. return placeholder(h, rawChild)
  34667. }
  34668. // ensure a key that is unique to the vnode type and to this transition
  34669. // component instance. This key will be used to remove pending leaving nodes
  34670. // during entering.
  34671. var id = "__transition-" + (this._uid) + "-";
  34672. child.key = child.key == null
  34673. ? child.isComment
  34674. ? id + 'comment'
  34675. : id + child.tag
  34676. : isPrimitive(child.key)
  34677. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  34678. : child.key;
  34679. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  34680. var oldRawChild = this._vnode;
  34681. var oldChild = getRealChild(oldRawChild);
  34682. // mark v-show
  34683. // so that the transition module can hand over the control to the directive
  34684. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  34685. child.data.show = true;
  34686. }
  34687. if (
  34688. oldChild &&
  34689. oldChild.data &&
  34690. !isSameChild(child, oldChild) &&
  34691. !isAsyncPlaceholder(oldChild)
  34692. ) {
  34693. // replace old child transition data with fresh one
  34694. // important for dynamic transitions!
  34695. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  34696. // handle transition mode
  34697. if (mode === 'out-in') {
  34698. // return placeholder node and queue update when leave finishes
  34699. this._leaving = true;
  34700. mergeVNodeHook(oldData, 'afterLeave', function () {
  34701. this$1._leaving = false;
  34702. this$1.$forceUpdate();
  34703. });
  34704. return placeholder(h, rawChild)
  34705. } else if (mode === 'in-out') {
  34706. if (isAsyncPlaceholder(child)) {
  34707. return oldRawChild
  34708. }
  34709. var delayedLeave;
  34710. var performLeave = function () { delayedLeave(); };
  34711. mergeVNodeHook(data, 'afterEnter', performLeave);
  34712. mergeVNodeHook(data, 'enterCancelled', performLeave);
  34713. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  34714. }
  34715. }
  34716. return rawChild
  34717. }
  34718. };
  34719. /* */
  34720. // Provides transition support for list items.
  34721. // supports move transitions using the FLIP technique.
  34722. // Because the vdom's children update algorithm is "unstable" - i.e.
  34723. // it doesn't guarantee the relative positioning of removed elements,
  34724. // we force transition-group to update its children into two passes:
  34725. // in the first pass, we remove all nodes that need to be removed,
  34726. // triggering their leaving transition; in the second pass, we insert/move
  34727. // into the final desired state. This way in the second pass removed
  34728. // nodes will remain where they should be.
  34729. var props = extend({
  34730. tag: String,
  34731. moveClass: String
  34732. }, transitionProps);
  34733. delete props.mode;
  34734. var TransitionGroup = {
  34735. props: props,
  34736. render: function render (h) {
  34737. var tag = this.tag || this.$vnode.data.tag || 'span';
  34738. var map = Object.create(null);
  34739. var prevChildren = this.prevChildren = this.children;
  34740. var rawChildren = this.$slots.default || [];
  34741. var children = this.children = [];
  34742. var transitionData = extractTransitionData(this);
  34743. for (var i = 0; i < rawChildren.length; i++) {
  34744. var c = rawChildren[i];
  34745. if (c.tag) {
  34746. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  34747. children.push(c);
  34748. map[c.key] = c
  34749. ;(c.data || (c.data = {})).transition = transitionData;
  34750. } else if (true) {
  34751. var opts = c.componentOptions;
  34752. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  34753. warn(("<transition-group> children must be keyed: <" + name + ">"));
  34754. }
  34755. }
  34756. }
  34757. if (prevChildren) {
  34758. var kept = [];
  34759. var removed = [];
  34760. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  34761. var c$1 = prevChildren[i$1];
  34762. c$1.data.transition = transitionData;
  34763. c$1.data.pos = c$1.elm.getBoundingClientRect();
  34764. if (map[c$1.key]) {
  34765. kept.push(c$1);
  34766. } else {
  34767. removed.push(c$1);
  34768. }
  34769. }
  34770. this.kept = h(tag, null, kept);
  34771. this.removed = removed;
  34772. }
  34773. return h(tag, null, children)
  34774. },
  34775. beforeUpdate: function beforeUpdate () {
  34776. // force removing pass
  34777. this.__patch__(
  34778. this._vnode,
  34779. this.kept,
  34780. false, // hydrating
  34781. true // removeOnly (!important, avoids unnecessary moves)
  34782. );
  34783. this._vnode = this.kept;
  34784. },
  34785. updated: function updated () {
  34786. var children = this.prevChildren;
  34787. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  34788. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  34789. return
  34790. }
  34791. // we divide the work into three loops to avoid mixing DOM reads and writes
  34792. // in each iteration - which helps prevent layout thrashing.
  34793. children.forEach(callPendingCbs);
  34794. children.forEach(recordPosition);
  34795. children.forEach(applyTranslation);
  34796. // force reflow to put everything in position
  34797. var body = document.body;
  34798. var f = body.offsetHeight; // eslint-disable-line
  34799. children.forEach(function (c) {
  34800. if (c.data.moved) {
  34801. var el = c.elm;
  34802. var s = el.style;
  34803. addTransitionClass(el, moveClass);
  34804. s.transform = s.WebkitTransform = s.transitionDuration = '';
  34805. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  34806. if (!e || /transform$/.test(e.propertyName)) {
  34807. el.removeEventListener(transitionEndEvent, cb);
  34808. el._moveCb = null;
  34809. removeTransitionClass(el, moveClass);
  34810. }
  34811. });
  34812. }
  34813. });
  34814. },
  34815. methods: {
  34816. hasMove: function hasMove (el, moveClass) {
  34817. /* istanbul ignore if */
  34818. if (!hasTransition) {
  34819. return false
  34820. }
  34821. /* istanbul ignore if */
  34822. if (this._hasMove) {
  34823. return this._hasMove
  34824. }
  34825. // Detect whether an element with the move class applied has
  34826. // CSS transitions. Since the element may be inside an entering
  34827. // transition at this very moment, we make a clone of it and remove
  34828. // all other transition classes applied to ensure only the move class
  34829. // is applied.
  34830. var clone = el.cloneNode();
  34831. if (el._transitionClasses) {
  34832. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  34833. }
  34834. addClass(clone, moveClass);
  34835. clone.style.display = 'none';
  34836. this.$el.appendChild(clone);
  34837. var info = getTransitionInfo(clone);
  34838. this.$el.removeChild(clone);
  34839. return (this._hasMove = info.hasTransform)
  34840. }
  34841. }
  34842. };
  34843. function callPendingCbs (c) {
  34844. /* istanbul ignore if */
  34845. if (c.elm._moveCb) {
  34846. c.elm._moveCb();
  34847. }
  34848. /* istanbul ignore if */
  34849. if (c.elm._enterCb) {
  34850. c.elm._enterCb();
  34851. }
  34852. }
  34853. function recordPosition (c) {
  34854. c.data.newPos = c.elm.getBoundingClientRect();
  34855. }
  34856. function applyTranslation (c) {
  34857. var oldPos = c.data.pos;
  34858. var newPos = c.data.newPos;
  34859. var dx = oldPos.left - newPos.left;
  34860. var dy = oldPos.top - newPos.top;
  34861. if (dx || dy) {
  34862. c.data.moved = true;
  34863. var s = c.elm.style;
  34864. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  34865. s.transitionDuration = '0s';
  34866. }
  34867. }
  34868. var platformComponents = {
  34869. Transition: Transition,
  34870. TransitionGroup: TransitionGroup
  34871. };
  34872. /* */
  34873. // install platform specific utils
  34874. Vue$3.config.mustUseProp = mustUseProp;
  34875. Vue$3.config.isReservedTag = isReservedTag;
  34876. Vue$3.config.isReservedAttr = isReservedAttr;
  34877. Vue$3.config.getTagNamespace = getTagNamespace;
  34878. Vue$3.config.isUnknownElement = isUnknownElement;
  34879. // install platform runtime directives & components
  34880. extend(Vue$3.options.directives, platformDirectives);
  34881. extend(Vue$3.options.components, platformComponents);
  34882. // install platform patch function
  34883. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  34884. // public mount method
  34885. Vue$3.prototype.$mount = function (
  34886. el,
  34887. hydrating
  34888. ) {
  34889. el = el && inBrowser ? query(el) : undefined;
  34890. return mountComponent(this, el, hydrating)
  34891. };
  34892. // devtools global hook
  34893. /* istanbul ignore next */
  34894. setTimeout(function () {
  34895. if (config.devtools) {
  34896. if (devtools) {
  34897. devtools.emit('init', Vue$3);
  34898. } else if ("development" !== 'production' && isChrome) {
  34899. console[console.info ? 'info' : 'log'](
  34900. 'Download the Vue Devtools extension for a better development experience:\n' +
  34901. 'https://github.com/vuejs/vue-devtools'
  34902. );
  34903. }
  34904. }
  34905. if ("development" !== 'production' &&
  34906. config.productionTip !== false &&
  34907. inBrowser && typeof console !== 'undefined'
  34908. ) {
  34909. console[console.info ? 'info' : 'log'](
  34910. "You are running Vue in development mode.\n" +
  34911. "Make sure to turn on production mode when deploying for production.\n" +
  34912. "See more tips at https://vuejs.org/guide/deployment.html"
  34913. );
  34914. }
  34915. }, 0);
  34916. /* */
  34917. // check whether current browser encodes a char inside attribute values
  34918. function shouldDecode (content, encoded) {
  34919. var div = document.createElement('div');
  34920. div.innerHTML = "<div a=\"" + content + "\"/>";
  34921. return div.innerHTML.indexOf(encoded) > 0
  34922. }
  34923. // #3663
  34924. // IE encodes newlines inside attribute values while other browsers don't
  34925. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  34926. /* */
  34927. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  34928. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  34929. var buildRegex = cached(function (delimiters) {
  34930. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  34931. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  34932. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  34933. });
  34934. function parseText (
  34935. text,
  34936. delimiters
  34937. ) {
  34938. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  34939. if (!tagRE.test(text)) {
  34940. return
  34941. }
  34942. var tokens = [];
  34943. var lastIndex = tagRE.lastIndex = 0;
  34944. var match, index;
  34945. while ((match = tagRE.exec(text))) {
  34946. index = match.index;
  34947. // push text token
  34948. if (index > lastIndex) {
  34949. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  34950. }
  34951. // tag token
  34952. var exp = parseFilters(match[1].trim());
  34953. tokens.push(("_s(" + exp + ")"));
  34954. lastIndex = index + match[0].length;
  34955. }
  34956. if (lastIndex < text.length) {
  34957. tokens.push(JSON.stringify(text.slice(lastIndex)));
  34958. }
  34959. return tokens.join('+')
  34960. }
  34961. /* */
  34962. function transformNode (el, options) {
  34963. var warn = options.warn || baseWarn;
  34964. var staticClass = getAndRemoveAttr(el, 'class');
  34965. if ("development" !== 'production' && staticClass) {
  34966. var expression = parseText(staticClass, options.delimiters);
  34967. if (expression) {
  34968. warn(
  34969. "class=\"" + staticClass + "\": " +
  34970. 'Interpolation inside attributes has been removed. ' +
  34971. 'Use v-bind or the colon shorthand instead. For example, ' +
  34972. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  34973. );
  34974. }
  34975. }
  34976. if (staticClass) {
  34977. el.staticClass = JSON.stringify(staticClass);
  34978. }
  34979. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  34980. if (classBinding) {
  34981. el.classBinding = classBinding;
  34982. }
  34983. }
  34984. function genData (el) {
  34985. var data = '';
  34986. if (el.staticClass) {
  34987. data += "staticClass:" + (el.staticClass) + ",";
  34988. }
  34989. if (el.classBinding) {
  34990. data += "class:" + (el.classBinding) + ",";
  34991. }
  34992. return data
  34993. }
  34994. var klass$1 = {
  34995. staticKeys: ['staticClass'],
  34996. transformNode: transformNode,
  34997. genData: genData
  34998. };
  34999. /* */
  35000. function transformNode$1 (el, options) {
  35001. var warn = options.warn || baseWarn;
  35002. var staticStyle = getAndRemoveAttr(el, 'style');
  35003. if (staticStyle) {
  35004. /* istanbul ignore if */
  35005. if (true) {
  35006. var expression = parseText(staticStyle, options.delimiters);
  35007. if (expression) {
  35008. warn(
  35009. "style=\"" + staticStyle + "\": " +
  35010. 'Interpolation inside attributes has been removed. ' +
  35011. 'Use v-bind or the colon shorthand instead. For example, ' +
  35012. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  35013. );
  35014. }
  35015. }
  35016. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  35017. }
  35018. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  35019. if (styleBinding) {
  35020. el.styleBinding = styleBinding;
  35021. }
  35022. }
  35023. function genData$1 (el) {
  35024. var data = '';
  35025. if (el.staticStyle) {
  35026. data += "staticStyle:" + (el.staticStyle) + ",";
  35027. }
  35028. if (el.styleBinding) {
  35029. data += "style:(" + (el.styleBinding) + "),";
  35030. }
  35031. return data
  35032. }
  35033. var style$1 = {
  35034. staticKeys: ['staticStyle'],
  35035. transformNode: transformNode$1,
  35036. genData: genData$1
  35037. };
  35038. var modules$1 = [
  35039. klass$1,
  35040. style$1
  35041. ];
  35042. /* */
  35043. function text (el, dir) {
  35044. if (dir.value) {
  35045. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  35046. }
  35047. }
  35048. /* */
  35049. function html (el, dir) {
  35050. if (dir.value) {
  35051. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  35052. }
  35053. }
  35054. var directives$1 = {
  35055. model: model,
  35056. text: text,
  35057. html: html
  35058. };
  35059. /* */
  35060. var isUnaryTag = makeMap(
  35061. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  35062. 'link,meta,param,source,track,wbr'
  35063. );
  35064. // Elements that you can, intentionally, leave open
  35065. // (and which close themselves)
  35066. var canBeLeftOpenTag = makeMap(
  35067. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  35068. );
  35069. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  35070. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  35071. var isNonPhrasingTag = makeMap(
  35072. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  35073. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  35074. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  35075. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  35076. 'title,tr,track'
  35077. );
  35078. /* */
  35079. var baseOptions = {
  35080. expectHTML: true,
  35081. modules: modules$1,
  35082. directives: directives$1,
  35083. isPreTag: isPreTag,
  35084. isUnaryTag: isUnaryTag,
  35085. mustUseProp: mustUseProp,
  35086. canBeLeftOpenTag: canBeLeftOpenTag,
  35087. isReservedTag: isReservedTag,
  35088. getTagNamespace: getTagNamespace,
  35089. staticKeys: genStaticKeys(modules$1)
  35090. };
  35091. /* */
  35092. var decoder;
  35093. var he = {
  35094. decode: function decode (html) {
  35095. decoder = decoder || document.createElement('div');
  35096. decoder.innerHTML = html;
  35097. return decoder.textContent
  35098. }
  35099. };
  35100. /**
  35101. * Not type-checking this file because it's mostly vendor code.
  35102. */
  35103. /*!
  35104. * HTML Parser By John Resig (ejohn.org)
  35105. * Modified by Juriy "kangax" Zaytsev
  35106. * Original code by Erik Arvidsson, Mozilla Public License
  35107. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  35108. */
  35109. // Regular Expressions for parsing tags and attributes
  35110. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  35111. var singleAttrAssign = /(?:=)/;
  35112. var singleAttrValues = [
  35113. // attr value double quotes
  35114. /"([^"]*)"+/.source,
  35115. // attr value, single quotes
  35116. /'([^']*)'+/.source,
  35117. // attr value, no quotes
  35118. /([^\s"'=<>`]+)/.source
  35119. ];
  35120. var attribute = new RegExp(
  35121. '^\\s*' + singleAttrIdentifier.source +
  35122. '(?:\\s*(' + singleAttrAssign.source + ')' +
  35123. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  35124. );
  35125. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  35126. // but for Vue templates we can enforce a simple charset
  35127. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  35128. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  35129. var startTagOpen = new RegExp('^<' + qnameCapture);
  35130. var startTagClose = /^\s*(\/?)>/;
  35131. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  35132. var doctype = /^<!DOCTYPE [^>]+>/i;
  35133. var comment = /^<!--/;
  35134. var conditionalComment = /^<!\[/;
  35135. var IS_REGEX_CAPTURING_BROKEN = false;
  35136. 'x'.replace(/x(.)?/g, function (m, g) {
  35137. IS_REGEX_CAPTURING_BROKEN = g === '';
  35138. });
  35139. // Special Elements (can contain anything)
  35140. var isPlainTextElement = makeMap('script,style,textarea', true);
  35141. var reCache = {};
  35142. var decodingMap = {
  35143. '&lt;': '<',
  35144. '&gt;': '>',
  35145. '&quot;': '"',
  35146. '&amp;': '&',
  35147. '&#10;': '\n'
  35148. };
  35149. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  35150. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  35151. // #5992
  35152. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  35153. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  35154. function decodeAttr (value, shouldDecodeNewlines) {
  35155. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  35156. return value.replace(re, function (match) { return decodingMap[match]; })
  35157. }
  35158. function parseHTML (html, options) {
  35159. var stack = [];
  35160. var expectHTML = options.expectHTML;
  35161. var isUnaryTag$$1 = options.isUnaryTag || no;
  35162. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  35163. var index = 0;
  35164. var last, lastTag;
  35165. while (html) {
  35166. last = html;
  35167. // Make sure we're not in a plaintext content element like script/style
  35168. if (!lastTag || !isPlainTextElement(lastTag)) {
  35169. var textEnd = html.indexOf('<');
  35170. if (textEnd === 0) {
  35171. // Comment:
  35172. if (comment.test(html)) {
  35173. var commentEnd = html.indexOf('-->');
  35174. if (commentEnd >= 0) {
  35175. if (options.shouldKeepComment) {
  35176. options.comment(html.substring(4, commentEnd));
  35177. }
  35178. advance(commentEnd + 3);
  35179. continue
  35180. }
  35181. }
  35182. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  35183. if (conditionalComment.test(html)) {
  35184. var conditionalEnd = html.indexOf(']>');
  35185. if (conditionalEnd >= 0) {
  35186. advance(conditionalEnd + 2);
  35187. continue
  35188. }
  35189. }
  35190. // Doctype:
  35191. var doctypeMatch = html.match(doctype);
  35192. if (doctypeMatch) {
  35193. advance(doctypeMatch[0].length);
  35194. continue
  35195. }
  35196. // End tag:
  35197. var endTagMatch = html.match(endTag);
  35198. if (endTagMatch) {
  35199. var curIndex = index;
  35200. advance(endTagMatch[0].length);
  35201. parseEndTag(endTagMatch[1], curIndex, index);
  35202. continue
  35203. }
  35204. // Start tag:
  35205. var startTagMatch = parseStartTag();
  35206. if (startTagMatch) {
  35207. handleStartTag(startTagMatch);
  35208. if (shouldIgnoreFirstNewline(lastTag, html)) {
  35209. advance(1);
  35210. }
  35211. continue
  35212. }
  35213. }
  35214. var text = (void 0), rest = (void 0), next = (void 0);
  35215. if (textEnd >= 0) {
  35216. rest = html.slice(textEnd);
  35217. while (
  35218. !endTag.test(rest) &&
  35219. !startTagOpen.test(rest) &&
  35220. !comment.test(rest) &&
  35221. !conditionalComment.test(rest)
  35222. ) {
  35223. // < in plain text, be forgiving and treat it as text
  35224. next = rest.indexOf('<', 1);
  35225. if (next < 0) { break }
  35226. textEnd += next;
  35227. rest = html.slice(textEnd);
  35228. }
  35229. text = html.substring(0, textEnd);
  35230. advance(textEnd);
  35231. }
  35232. if (textEnd < 0) {
  35233. text = html;
  35234. html = '';
  35235. }
  35236. if (options.chars && text) {
  35237. options.chars(text);
  35238. }
  35239. } else {
  35240. var endTagLength = 0;
  35241. var stackedTag = lastTag.toLowerCase();
  35242. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  35243. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  35244. endTagLength = endTag.length;
  35245. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  35246. text = text
  35247. .replace(/<!--([\s\S]*?)-->/g, '$1')
  35248. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  35249. }
  35250. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  35251. text = text.slice(1);
  35252. }
  35253. if (options.chars) {
  35254. options.chars(text);
  35255. }
  35256. return ''
  35257. });
  35258. index += html.length - rest$1.length;
  35259. html = rest$1;
  35260. parseEndTag(stackedTag, index - endTagLength, index);
  35261. }
  35262. if (html === last) {
  35263. options.chars && options.chars(html);
  35264. if ("development" !== 'production' && !stack.length && options.warn) {
  35265. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  35266. }
  35267. break
  35268. }
  35269. }
  35270. // Clean up any remaining tags
  35271. parseEndTag();
  35272. function advance (n) {
  35273. index += n;
  35274. html = html.substring(n);
  35275. }
  35276. function parseStartTag () {
  35277. var start = html.match(startTagOpen);
  35278. if (start) {
  35279. var match = {
  35280. tagName: start[1],
  35281. attrs: [],
  35282. start: index
  35283. };
  35284. advance(start[0].length);
  35285. var end, attr;
  35286. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  35287. advance(attr[0].length);
  35288. match.attrs.push(attr);
  35289. }
  35290. if (end) {
  35291. match.unarySlash = end[1];
  35292. advance(end[0].length);
  35293. match.end = index;
  35294. return match
  35295. }
  35296. }
  35297. }
  35298. function handleStartTag (match) {
  35299. var tagName = match.tagName;
  35300. var unarySlash = match.unarySlash;
  35301. if (expectHTML) {
  35302. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  35303. parseEndTag(lastTag);
  35304. }
  35305. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  35306. parseEndTag(tagName);
  35307. }
  35308. }
  35309. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  35310. var l = match.attrs.length;
  35311. var attrs = new Array(l);
  35312. for (var i = 0; i < l; i++) {
  35313. var args = match.attrs[i];
  35314. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  35315. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  35316. if (args[3] === '') { delete args[3]; }
  35317. if (args[4] === '') { delete args[4]; }
  35318. if (args[5] === '') { delete args[5]; }
  35319. }
  35320. var value = args[3] || args[4] || args[5] || '';
  35321. attrs[i] = {
  35322. name: args[1],
  35323. value: decodeAttr(
  35324. value,
  35325. options.shouldDecodeNewlines
  35326. )
  35327. };
  35328. }
  35329. if (!unary) {
  35330. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  35331. lastTag = tagName;
  35332. }
  35333. if (options.start) {
  35334. options.start(tagName, attrs, unary, match.start, match.end);
  35335. }
  35336. }
  35337. function parseEndTag (tagName, start, end) {
  35338. var pos, lowerCasedTagName;
  35339. if (start == null) { start = index; }
  35340. if (end == null) { end = index; }
  35341. if (tagName) {
  35342. lowerCasedTagName = tagName.toLowerCase();
  35343. }
  35344. // Find the closest opened tag of the same type
  35345. if (tagName) {
  35346. for (pos = stack.length - 1; pos >= 0; pos--) {
  35347. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  35348. break
  35349. }
  35350. }
  35351. } else {
  35352. // If no tag name is provided, clean shop
  35353. pos = 0;
  35354. }
  35355. if (pos >= 0) {
  35356. // Close all the open elements, up the stack
  35357. for (var i = stack.length - 1; i >= pos; i--) {
  35358. if ("development" !== 'production' &&
  35359. (i > pos || !tagName) &&
  35360. options.warn
  35361. ) {
  35362. options.warn(
  35363. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  35364. );
  35365. }
  35366. if (options.end) {
  35367. options.end(stack[i].tag, start, end);
  35368. }
  35369. }
  35370. // Remove the open elements from the stack
  35371. stack.length = pos;
  35372. lastTag = pos && stack[pos - 1].tag;
  35373. } else if (lowerCasedTagName === 'br') {
  35374. if (options.start) {
  35375. options.start(tagName, [], true, start, end);
  35376. }
  35377. } else if (lowerCasedTagName === 'p') {
  35378. if (options.start) {
  35379. options.start(tagName, [], false, start, end);
  35380. }
  35381. if (options.end) {
  35382. options.end(tagName, start, end);
  35383. }
  35384. }
  35385. }
  35386. }
  35387. /* */
  35388. var onRE = /^@|^v-on:/;
  35389. var dirRE = /^v-|^@|^:/;
  35390. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  35391. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  35392. var argRE = /:(.*)$/;
  35393. var bindRE = /^:|^v-bind:/;
  35394. var modifierRE = /\.[^.]+/g;
  35395. var decodeHTMLCached = cached(he.decode);
  35396. // configurable state
  35397. var warn$2;
  35398. var delimiters;
  35399. var transforms;
  35400. var preTransforms;
  35401. var postTransforms;
  35402. var platformIsPreTag;
  35403. var platformMustUseProp;
  35404. var platformGetTagNamespace;
  35405. /**
  35406. * Convert HTML string to AST.
  35407. */
  35408. function parse (
  35409. template,
  35410. options
  35411. ) {
  35412. warn$2 = options.warn || baseWarn;
  35413. platformIsPreTag = options.isPreTag || no;
  35414. platformMustUseProp = options.mustUseProp || no;
  35415. platformGetTagNamespace = options.getTagNamespace || no;
  35416. transforms = pluckModuleFunction(options.modules, 'transformNode');
  35417. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  35418. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  35419. delimiters = options.delimiters;
  35420. var stack = [];
  35421. var preserveWhitespace = options.preserveWhitespace !== false;
  35422. var root;
  35423. var currentParent;
  35424. var inVPre = false;
  35425. var inPre = false;
  35426. var warned = false;
  35427. function warnOnce (msg) {
  35428. if (!warned) {
  35429. warned = true;
  35430. warn$2(msg);
  35431. }
  35432. }
  35433. function endPre (element) {
  35434. // check pre state
  35435. if (element.pre) {
  35436. inVPre = false;
  35437. }
  35438. if (platformIsPreTag(element.tag)) {
  35439. inPre = false;
  35440. }
  35441. }
  35442. parseHTML(template, {
  35443. warn: warn$2,
  35444. expectHTML: options.expectHTML,
  35445. isUnaryTag: options.isUnaryTag,
  35446. canBeLeftOpenTag: options.canBeLeftOpenTag,
  35447. shouldDecodeNewlines: options.shouldDecodeNewlines,
  35448. shouldKeepComment: options.comments,
  35449. start: function start (tag, attrs, unary) {
  35450. // check namespace.
  35451. // inherit parent ns if there is one
  35452. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  35453. // handle IE svg bug
  35454. /* istanbul ignore if */
  35455. if (isIE && ns === 'svg') {
  35456. attrs = guardIESVGBug(attrs);
  35457. }
  35458. var element = {
  35459. type: 1,
  35460. tag: tag,
  35461. attrsList: attrs,
  35462. attrsMap: makeAttrsMap(attrs),
  35463. parent: currentParent,
  35464. children: []
  35465. };
  35466. if (ns) {
  35467. element.ns = ns;
  35468. }
  35469. if (isForbiddenTag(element) && !isServerRendering()) {
  35470. element.forbidden = true;
  35471. "development" !== 'production' && warn$2(
  35472. 'Templates should only be responsible for mapping the state to the ' +
  35473. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  35474. "<" + tag + ">" + ', as they will not be parsed.'
  35475. );
  35476. }
  35477. // apply pre-transforms
  35478. for (var i = 0; i < preTransforms.length; i++) {
  35479. preTransforms[i](element, options);
  35480. }
  35481. if (!inVPre) {
  35482. processPre(element);
  35483. if (element.pre) {
  35484. inVPre = true;
  35485. }
  35486. }
  35487. if (platformIsPreTag(element.tag)) {
  35488. inPre = true;
  35489. }
  35490. if (inVPre) {
  35491. processRawAttrs(element);
  35492. } else {
  35493. processFor(element);
  35494. processIf(element);
  35495. processOnce(element);
  35496. processKey(element);
  35497. // determine whether this is a plain element after
  35498. // removing structural attributes
  35499. element.plain = !element.key && !attrs.length;
  35500. processRef(element);
  35501. processSlot(element);
  35502. processComponent(element);
  35503. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  35504. transforms[i$1](element, options);
  35505. }
  35506. processAttrs(element);
  35507. }
  35508. function checkRootConstraints (el) {
  35509. if (true) {
  35510. if (el.tag === 'slot' || el.tag === 'template') {
  35511. warnOnce(
  35512. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  35513. 'contain multiple nodes.'
  35514. );
  35515. }
  35516. if (el.attrsMap.hasOwnProperty('v-for')) {
  35517. warnOnce(
  35518. 'Cannot use v-for on stateful component root element because ' +
  35519. 'it renders multiple elements.'
  35520. );
  35521. }
  35522. }
  35523. }
  35524. // tree management
  35525. if (!root) {
  35526. root = element;
  35527. checkRootConstraints(root);
  35528. } else if (!stack.length) {
  35529. // allow root elements with v-if, v-else-if and v-else
  35530. if (root.if && (element.elseif || element.else)) {
  35531. checkRootConstraints(element);
  35532. addIfCondition(root, {
  35533. exp: element.elseif,
  35534. block: element
  35535. });
  35536. } else if (true) {
  35537. warnOnce(
  35538. "Component template should contain exactly one root element. " +
  35539. "If you are using v-if on multiple elements, " +
  35540. "use v-else-if to chain them instead."
  35541. );
  35542. }
  35543. }
  35544. if (currentParent && !element.forbidden) {
  35545. if (element.elseif || element.else) {
  35546. processIfConditions(element, currentParent);
  35547. } else if (element.slotScope) { // scoped slot
  35548. currentParent.plain = false;
  35549. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  35550. } else {
  35551. currentParent.children.push(element);
  35552. element.parent = currentParent;
  35553. }
  35554. }
  35555. if (!unary) {
  35556. currentParent = element;
  35557. stack.push(element);
  35558. } else {
  35559. endPre(element);
  35560. }
  35561. // apply post-transforms
  35562. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  35563. postTransforms[i$2](element, options);
  35564. }
  35565. },
  35566. end: function end () {
  35567. // remove trailing whitespace
  35568. var element = stack[stack.length - 1];
  35569. var lastNode = element.children[element.children.length - 1];
  35570. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  35571. element.children.pop();
  35572. }
  35573. // pop stack
  35574. stack.length -= 1;
  35575. currentParent = stack[stack.length - 1];
  35576. endPre(element);
  35577. },
  35578. chars: function chars (text) {
  35579. if (!currentParent) {
  35580. if (true) {
  35581. if (text === template) {
  35582. warnOnce(
  35583. 'Component template requires a root element, rather than just text.'
  35584. );
  35585. } else if ((text = text.trim())) {
  35586. warnOnce(
  35587. ("text \"" + text + "\" outside root element will be ignored.")
  35588. );
  35589. }
  35590. }
  35591. return
  35592. }
  35593. // IE textarea placeholder bug
  35594. /* istanbul ignore if */
  35595. if (isIE &&
  35596. currentParent.tag === 'textarea' &&
  35597. currentParent.attrsMap.placeholder === text
  35598. ) {
  35599. return
  35600. }
  35601. var children = currentParent.children;
  35602. text = inPre || text.trim()
  35603. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  35604. // only preserve whitespace if its not right after a starting tag
  35605. : preserveWhitespace && children.length ? ' ' : '';
  35606. if (text) {
  35607. var expression;
  35608. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  35609. children.push({
  35610. type: 2,
  35611. expression: expression,
  35612. text: text
  35613. });
  35614. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  35615. children.push({
  35616. type: 3,
  35617. text: text
  35618. });
  35619. }
  35620. }
  35621. },
  35622. comment: function comment (text) {
  35623. currentParent.children.push({
  35624. type: 3,
  35625. text: text,
  35626. isComment: true
  35627. });
  35628. }
  35629. });
  35630. return root
  35631. }
  35632. function processPre (el) {
  35633. if (getAndRemoveAttr(el, 'v-pre') != null) {
  35634. el.pre = true;
  35635. }
  35636. }
  35637. function processRawAttrs (el) {
  35638. var l = el.attrsList.length;
  35639. if (l) {
  35640. var attrs = el.attrs = new Array(l);
  35641. for (var i = 0; i < l; i++) {
  35642. attrs[i] = {
  35643. name: el.attrsList[i].name,
  35644. value: JSON.stringify(el.attrsList[i].value)
  35645. };
  35646. }
  35647. } else if (!el.pre) {
  35648. // non root node in pre blocks with no attributes
  35649. el.plain = true;
  35650. }
  35651. }
  35652. function processKey (el) {
  35653. var exp = getBindingAttr(el, 'key');
  35654. if (exp) {
  35655. if ("development" !== 'production' && el.tag === 'template') {
  35656. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  35657. }
  35658. el.key = exp;
  35659. }
  35660. }
  35661. function processRef (el) {
  35662. var ref = getBindingAttr(el, 'ref');
  35663. if (ref) {
  35664. el.ref = ref;
  35665. el.refInFor = checkInFor(el);
  35666. }
  35667. }
  35668. function processFor (el) {
  35669. var exp;
  35670. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  35671. var inMatch = exp.match(forAliasRE);
  35672. if (!inMatch) {
  35673. "development" !== 'production' && warn$2(
  35674. ("Invalid v-for expression: " + exp)
  35675. );
  35676. return
  35677. }
  35678. el.for = inMatch[2].trim();
  35679. var alias = inMatch[1].trim();
  35680. var iteratorMatch = alias.match(forIteratorRE);
  35681. if (iteratorMatch) {
  35682. el.alias = iteratorMatch[1].trim();
  35683. el.iterator1 = iteratorMatch[2].trim();
  35684. if (iteratorMatch[3]) {
  35685. el.iterator2 = iteratorMatch[3].trim();
  35686. }
  35687. } else {
  35688. el.alias = alias;
  35689. }
  35690. }
  35691. }
  35692. function processIf (el) {
  35693. var exp = getAndRemoveAttr(el, 'v-if');
  35694. if (exp) {
  35695. el.if = exp;
  35696. addIfCondition(el, {
  35697. exp: exp,
  35698. block: el
  35699. });
  35700. } else {
  35701. if (getAndRemoveAttr(el, 'v-else') != null) {
  35702. el.else = true;
  35703. }
  35704. var elseif = getAndRemoveAttr(el, 'v-else-if');
  35705. if (elseif) {
  35706. el.elseif = elseif;
  35707. }
  35708. }
  35709. }
  35710. function processIfConditions (el, parent) {
  35711. var prev = findPrevElement(parent.children);
  35712. if (prev && prev.if) {
  35713. addIfCondition(prev, {
  35714. exp: el.elseif,
  35715. block: el
  35716. });
  35717. } else if (true) {
  35718. warn$2(
  35719. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  35720. "used on element <" + (el.tag) + "> without corresponding v-if."
  35721. );
  35722. }
  35723. }
  35724. function findPrevElement (children) {
  35725. var i = children.length;
  35726. while (i--) {
  35727. if (children[i].type === 1) {
  35728. return children[i]
  35729. } else {
  35730. if ("development" !== 'production' && children[i].text !== ' ') {
  35731. warn$2(
  35732. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  35733. "will be ignored."
  35734. );
  35735. }
  35736. children.pop();
  35737. }
  35738. }
  35739. }
  35740. function addIfCondition (el, condition) {
  35741. if (!el.ifConditions) {
  35742. el.ifConditions = [];
  35743. }
  35744. el.ifConditions.push(condition);
  35745. }
  35746. function processOnce (el) {
  35747. var once$$1 = getAndRemoveAttr(el, 'v-once');
  35748. if (once$$1 != null) {
  35749. el.once = true;
  35750. }
  35751. }
  35752. function processSlot (el) {
  35753. if (el.tag === 'slot') {
  35754. el.slotName = getBindingAttr(el, 'name');
  35755. if ("development" !== 'production' && el.key) {
  35756. warn$2(
  35757. "`key` does not work on <slot> because slots are abstract outlets " +
  35758. "and can possibly expand into multiple elements. " +
  35759. "Use the key on a wrapping element instead."
  35760. );
  35761. }
  35762. } else {
  35763. var slotTarget = getBindingAttr(el, 'slot');
  35764. if (slotTarget) {
  35765. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  35766. }
  35767. if (el.tag === 'template') {
  35768. el.slotScope = getAndRemoveAttr(el, 'scope');
  35769. }
  35770. }
  35771. }
  35772. function processComponent (el) {
  35773. var binding;
  35774. if ((binding = getBindingAttr(el, 'is'))) {
  35775. el.component = binding;
  35776. }
  35777. if (getAndRemoveAttr(el, 'inline-template') != null) {
  35778. el.inlineTemplate = true;
  35779. }
  35780. }
  35781. function processAttrs (el) {
  35782. var list = el.attrsList;
  35783. var i, l, name, rawName, value, modifiers, isProp;
  35784. for (i = 0, l = list.length; i < l; i++) {
  35785. name = rawName = list[i].name;
  35786. value = list[i].value;
  35787. if (dirRE.test(name)) {
  35788. // mark element as dynamic
  35789. el.hasBindings = true;
  35790. // modifiers
  35791. modifiers = parseModifiers(name);
  35792. if (modifiers) {
  35793. name = name.replace(modifierRE, '');
  35794. }
  35795. if (bindRE.test(name)) { // v-bind
  35796. name = name.replace(bindRE, '');
  35797. value = parseFilters(value);
  35798. isProp = false;
  35799. if (modifiers) {
  35800. if (modifiers.prop) {
  35801. isProp = true;
  35802. name = camelize(name);
  35803. if (name === 'innerHtml') { name = 'innerHTML'; }
  35804. }
  35805. if (modifiers.camel) {
  35806. name = camelize(name);
  35807. }
  35808. if (modifiers.sync) {
  35809. addHandler(
  35810. el,
  35811. ("update:" + (camelize(name))),
  35812. genAssignmentCode(value, "$event")
  35813. );
  35814. }
  35815. }
  35816. if (isProp || (
  35817. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  35818. )) {
  35819. addProp(el, name, value);
  35820. } else {
  35821. addAttr(el, name, value);
  35822. }
  35823. } else if (onRE.test(name)) { // v-on
  35824. name = name.replace(onRE, '');
  35825. addHandler(el, name, value, modifiers, false, warn$2);
  35826. } else { // normal directives
  35827. name = name.replace(dirRE, '');
  35828. // parse arg
  35829. var argMatch = name.match(argRE);
  35830. var arg = argMatch && argMatch[1];
  35831. if (arg) {
  35832. name = name.slice(0, -(arg.length + 1));
  35833. }
  35834. addDirective(el, name, rawName, value, arg, modifiers);
  35835. if ("development" !== 'production' && name === 'model') {
  35836. checkForAliasModel(el, value);
  35837. }
  35838. }
  35839. } else {
  35840. // literal attribute
  35841. if (true) {
  35842. var expression = parseText(value, delimiters);
  35843. if (expression) {
  35844. warn$2(
  35845. name + "=\"" + value + "\": " +
  35846. 'Interpolation inside attributes has been removed. ' +
  35847. 'Use v-bind or the colon shorthand instead. For example, ' +
  35848. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  35849. );
  35850. }
  35851. }
  35852. addAttr(el, name, JSON.stringify(value));
  35853. }
  35854. }
  35855. }
  35856. function checkInFor (el) {
  35857. var parent = el;
  35858. while (parent) {
  35859. if (parent.for !== undefined) {
  35860. return true
  35861. }
  35862. parent = parent.parent;
  35863. }
  35864. return false
  35865. }
  35866. function parseModifiers (name) {
  35867. var match = name.match(modifierRE);
  35868. if (match) {
  35869. var ret = {};
  35870. match.forEach(function (m) { ret[m.slice(1)] = true; });
  35871. return ret
  35872. }
  35873. }
  35874. function makeAttrsMap (attrs) {
  35875. var map = {};
  35876. for (var i = 0, l = attrs.length; i < l; i++) {
  35877. if (
  35878. "development" !== 'production' &&
  35879. map[attrs[i].name] && !isIE && !isEdge
  35880. ) {
  35881. warn$2('duplicate attribute: ' + attrs[i].name);
  35882. }
  35883. map[attrs[i].name] = attrs[i].value;
  35884. }
  35885. return map
  35886. }
  35887. // for script (e.g. type="x/template") or style, do not decode content
  35888. function isTextTag (el) {
  35889. return el.tag === 'script' || el.tag === 'style'
  35890. }
  35891. function isForbiddenTag (el) {
  35892. return (
  35893. el.tag === 'style' ||
  35894. (el.tag === 'script' && (
  35895. !el.attrsMap.type ||
  35896. el.attrsMap.type === 'text/javascript'
  35897. ))
  35898. )
  35899. }
  35900. var ieNSBug = /^xmlns:NS\d+/;
  35901. var ieNSPrefix = /^NS\d+:/;
  35902. /* istanbul ignore next */
  35903. function guardIESVGBug (attrs) {
  35904. var res = [];
  35905. for (var i = 0; i < attrs.length; i++) {
  35906. var attr = attrs[i];
  35907. if (!ieNSBug.test(attr.name)) {
  35908. attr.name = attr.name.replace(ieNSPrefix, '');
  35909. res.push(attr);
  35910. }
  35911. }
  35912. return res
  35913. }
  35914. function checkForAliasModel (el, value) {
  35915. var _el = el;
  35916. while (_el) {
  35917. if (_el.for && _el.alias === value) {
  35918. warn$2(
  35919. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  35920. "You are binding v-model directly to a v-for iteration alias. " +
  35921. "This will not be able to modify the v-for source array because " +
  35922. "writing to the alias is like modifying a function local variable. " +
  35923. "Consider using an array of objects and use v-model on an object property instead."
  35924. );
  35925. }
  35926. _el = _el.parent;
  35927. }
  35928. }
  35929. /* */
  35930. var isStaticKey;
  35931. var isPlatformReservedTag;
  35932. var genStaticKeysCached = cached(genStaticKeys$1);
  35933. /**
  35934. * Goal of the optimizer: walk the generated template AST tree
  35935. * and detect sub-trees that are purely static, i.e. parts of
  35936. * the DOM that never needs to change.
  35937. *
  35938. * Once we detect these sub-trees, we can:
  35939. *
  35940. * 1. Hoist them into constants, so that we no longer need to
  35941. * create fresh nodes for them on each re-render;
  35942. * 2. Completely skip them in the patching process.
  35943. */
  35944. function optimize (root, options) {
  35945. if (!root) { return }
  35946. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  35947. isPlatformReservedTag = options.isReservedTag || no;
  35948. // first pass: mark all non-static nodes.
  35949. markStatic$1(root);
  35950. // second pass: mark static roots.
  35951. markStaticRoots(root, false);
  35952. }
  35953. function genStaticKeys$1 (keys) {
  35954. return makeMap(
  35955. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  35956. (keys ? ',' + keys : '')
  35957. )
  35958. }
  35959. function markStatic$1 (node) {
  35960. node.static = isStatic(node);
  35961. if (node.type === 1) {
  35962. // do not make component slot content static. this avoids
  35963. // 1. components not able to mutate slot nodes
  35964. // 2. static slot content fails for hot-reloading
  35965. if (
  35966. !isPlatformReservedTag(node.tag) &&
  35967. node.tag !== 'slot' &&
  35968. node.attrsMap['inline-template'] == null
  35969. ) {
  35970. return
  35971. }
  35972. for (var i = 0, l = node.children.length; i < l; i++) {
  35973. var child = node.children[i];
  35974. markStatic$1(child);
  35975. if (!child.static) {
  35976. node.static = false;
  35977. }
  35978. }
  35979. if (node.ifConditions) {
  35980. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  35981. var block = node.ifConditions[i$1].block;
  35982. markStatic$1(block);
  35983. if (!block.static) {
  35984. node.static = false;
  35985. }
  35986. }
  35987. }
  35988. }
  35989. }
  35990. function markStaticRoots (node, isInFor) {
  35991. if (node.type === 1) {
  35992. if (node.static || node.once) {
  35993. node.staticInFor = isInFor;
  35994. }
  35995. // For a node to qualify as a static root, it should have children that
  35996. // are not just static text. Otherwise the cost of hoisting out will
  35997. // outweigh the benefits and it's better off to just always render it fresh.
  35998. if (node.static && node.children.length && !(
  35999. node.children.length === 1 &&
  36000. node.children[0].type === 3
  36001. )) {
  36002. node.staticRoot = true;
  36003. return
  36004. } else {
  36005. node.staticRoot = false;
  36006. }
  36007. if (node.children) {
  36008. for (var i = 0, l = node.children.length; i < l; i++) {
  36009. markStaticRoots(node.children[i], isInFor || !!node.for);
  36010. }
  36011. }
  36012. if (node.ifConditions) {
  36013. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36014. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  36015. }
  36016. }
  36017. }
  36018. }
  36019. function isStatic (node) {
  36020. if (node.type === 2) { // expression
  36021. return false
  36022. }
  36023. if (node.type === 3) { // text
  36024. return true
  36025. }
  36026. return !!(node.pre || (
  36027. !node.hasBindings && // no dynamic bindings
  36028. !node.if && !node.for && // not v-if or v-for or v-else
  36029. !isBuiltInTag(node.tag) && // not a built-in
  36030. isPlatformReservedTag(node.tag) && // not a component
  36031. !isDirectChildOfTemplateFor(node) &&
  36032. Object.keys(node).every(isStaticKey)
  36033. ))
  36034. }
  36035. function isDirectChildOfTemplateFor (node) {
  36036. while (node.parent) {
  36037. node = node.parent;
  36038. if (node.tag !== 'template') {
  36039. return false
  36040. }
  36041. if (node.for) {
  36042. return true
  36043. }
  36044. }
  36045. return false
  36046. }
  36047. /* */
  36048. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  36049. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  36050. // keyCode aliases
  36051. var keyCodes = {
  36052. esc: 27,
  36053. tab: 9,
  36054. enter: 13,
  36055. space: 32,
  36056. up: 38,
  36057. left: 37,
  36058. right: 39,
  36059. down: 40,
  36060. 'delete': [8, 46]
  36061. };
  36062. // #4868: modifiers that prevent the execution of the listener
  36063. // need to explicitly return null so that we can determine whether to remove
  36064. // the listener for .once
  36065. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  36066. var modifierCode = {
  36067. stop: '$event.stopPropagation();',
  36068. prevent: '$event.preventDefault();',
  36069. self: genGuard("$event.target !== $event.currentTarget"),
  36070. ctrl: genGuard("!$event.ctrlKey"),
  36071. shift: genGuard("!$event.shiftKey"),
  36072. alt: genGuard("!$event.altKey"),
  36073. meta: genGuard("!$event.metaKey"),
  36074. left: genGuard("'button' in $event && $event.button !== 0"),
  36075. middle: genGuard("'button' in $event && $event.button !== 1"),
  36076. right: genGuard("'button' in $event && $event.button !== 2")
  36077. };
  36078. function genHandlers (
  36079. events,
  36080. isNative,
  36081. warn
  36082. ) {
  36083. var res = isNative ? 'nativeOn:{' : 'on:{';
  36084. for (var name in events) {
  36085. var handler = events[name];
  36086. // #5330: warn click.right, since right clicks do not actually fire click events.
  36087. if ("development" !== 'production' &&
  36088. name === 'click' &&
  36089. handler && handler.modifiers && handler.modifiers.right
  36090. ) {
  36091. warn(
  36092. "Use \"contextmenu\" instead of \"click.right\" since right clicks " +
  36093. "do not actually fire \"click\" events."
  36094. );
  36095. }
  36096. res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
  36097. }
  36098. return res.slice(0, -1) + '}'
  36099. }
  36100. function genHandler (
  36101. name,
  36102. handler
  36103. ) {
  36104. if (!handler) {
  36105. return 'function(){}'
  36106. }
  36107. if (Array.isArray(handler)) {
  36108. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  36109. }
  36110. var isMethodPath = simplePathRE.test(handler.value);
  36111. var isFunctionExpression = fnExpRE.test(handler.value);
  36112. if (!handler.modifiers) {
  36113. return isMethodPath || isFunctionExpression
  36114. ? handler.value
  36115. : ("function($event){" + (handler.value) + "}") // inline statement
  36116. } else {
  36117. var code = '';
  36118. var genModifierCode = '';
  36119. var keys = [];
  36120. for (var key in handler.modifiers) {
  36121. if (modifierCode[key]) {
  36122. genModifierCode += modifierCode[key];
  36123. // left/right
  36124. if (keyCodes[key]) {
  36125. keys.push(key);
  36126. }
  36127. } else {
  36128. keys.push(key);
  36129. }
  36130. }
  36131. if (keys.length) {
  36132. code += genKeyFilter(keys);
  36133. }
  36134. // Make sure modifiers like prevent and stop get executed after key filtering
  36135. if (genModifierCode) {
  36136. code += genModifierCode;
  36137. }
  36138. var handlerCode = isMethodPath
  36139. ? handler.value + '($event)'
  36140. : isFunctionExpression
  36141. ? ("(" + (handler.value) + ")($event)")
  36142. : handler.value;
  36143. return ("function($event){" + code + handlerCode + "}")
  36144. }
  36145. }
  36146. function genKeyFilter (keys) {
  36147. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  36148. }
  36149. function genFilterCode (key) {
  36150. var keyVal = parseInt(key, 10);
  36151. if (keyVal) {
  36152. return ("$event.keyCode!==" + keyVal)
  36153. }
  36154. var alias = keyCodes[key];
  36155. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  36156. }
  36157. /* */
  36158. function on (el, dir) {
  36159. if ("development" !== 'production' && dir.modifiers) {
  36160. warn("v-on without argument does not support modifiers.");
  36161. }
  36162. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  36163. }
  36164. /* */
  36165. function bind$1 (el, dir) {
  36166. el.wrapData = function (code) {
  36167. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  36168. };
  36169. }
  36170. /* */
  36171. var baseDirectives = {
  36172. on: on,
  36173. bind: bind$1,
  36174. cloak: noop
  36175. };
  36176. /* */
  36177. var CodegenState = function CodegenState (options) {
  36178. this.options = options;
  36179. this.warn = options.warn || baseWarn;
  36180. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  36181. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  36182. this.directives = extend(extend({}, baseDirectives), options.directives);
  36183. var isReservedTag = options.isReservedTag || no;
  36184. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  36185. this.onceId = 0;
  36186. this.staticRenderFns = [];
  36187. };
  36188. function generate (
  36189. ast,
  36190. options
  36191. ) {
  36192. var state = new CodegenState(options);
  36193. var code = ast ? genElement(ast, state) : '_c("div")';
  36194. return {
  36195. render: ("with(this){return " + code + "}"),
  36196. staticRenderFns: state.staticRenderFns
  36197. }
  36198. }
  36199. function genElement (el, state) {
  36200. if (el.staticRoot && !el.staticProcessed) {
  36201. return genStatic(el, state)
  36202. } else if (el.once && !el.onceProcessed) {
  36203. return genOnce(el, state)
  36204. } else if (el.for && !el.forProcessed) {
  36205. return genFor(el, state)
  36206. } else if (el.if && !el.ifProcessed) {
  36207. return genIf(el, state)
  36208. } else if (el.tag === 'template' && !el.slotTarget) {
  36209. return genChildren(el, state) || 'void 0'
  36210. } else if (el.tag === 'slot') {
  36211. return genSlot(el, state)
  36212. } else {
  36213. // component or element
  36214. var code;
  36215. if (el.component) {
  36216. code = genComponent(el.component, el, state);
  36217. } else {
  36218. var data = el.plain ? undefined : genData$2(el, state);
  36219. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36220. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  36221. }
  36222. // module transforms
  36223. for (var i = 0; i < state.transforms.length; i++) {
  36224. code = state.transforms[i](el, code);
  36225. }
  36226. return code
  36227. }
  36228. }
  36229. // hoist static sub-trees out
  36230. function genStatic (el, state) {
  36231. el.staticProcessed = true;
  36232. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  36233. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  36234. }
  36235. // v-once
  36236. function genOnce (el, state) {
  36237. el.onceProcessed = true;
  36238. if (el.if && !el.ifProcessed) {
  36239. return genIf(el, state)
  36240. } else if (el.staticInFor) {
  36241. var key = '';
  36242. var parent = el.parent;
  36243. while (parent) {
  36244. if (parent.for) {
  36245. key = parent.key;
  36246. break
  36247. }
  36248. parent = parent.parent;
  36249. }
  36250. if (!key) {
  36251. "development" !== 'production' && state.warn(
  36252. "v-once can only be used inside v-for that is keyed. "
  36253. );
  36254. return genElement(el, state)
  36255. }
  36256. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + (key ? ("," + key) : "") + ")")
  36257. } else {
  36258. return genStatic(el, state)
  36259. }
  36260. }
  36261. function genIf (
  36262. el,
  36263. state,
  36264. altGen,
  36265. altEmpty
  36266. ) {
  36267. el.ifProcessed = true; // avoid recursion
  36268. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  36269. }
  36270. function genIfConditions (
  36271. conditions,
  36272. state,
  36273. altGen,
  36274. altEmpty
  36275. ) {
  36276. if (!conditions.length) {
  36277. return altEmpty || '_e()'
  36278. }
  36279. var condition = conditions.shift();
  36280. if (condition.exp) {
  36281. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  36282. } else {
  36283. return ("" + (genTernaryExp(condition.block)))
  36284. }
  36285. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  36286. function genTernaryExp (el) {
  36287. return altGen
  36288. ? altGen(el, state)
  36289. : el.once
  36290. ? genOnce(el, state)
  36291. : genElement(el, state)
  36292. }
  36293. }
  36294. function genFor (
  36295. el,
  36296. state,
  36297. altGen,
  36298. altHelper
  36299. ) {
  36300. var exp = el.for;
  36301. var alias = el.alias;
  36302. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36303. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36304. if ("development" !== 'production' &&
  36305. state.maybeComponent(el) &&
  36306. el.tag !== 'slot' &&
  36307. el.tag !== 'template' &&
  36308. !el.key
  36309. ) {
  36310. state.warn(
  36311. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  36312. "v-for should have explicit keys. " +
  36313. "See https://vuejs.org/guide/list.html#key for more info.",
  36314. true /* tip */
  36315. );
  36316. }
  36317. el.forProcessed = true; // avoid recursion
  36318. return (altHelper || '_l') + "((" + exp + ")," +
  36319. "function(" + alias + iterator1 + iterator2 + "){" +
  36320. "return " + ((altGen || genElement)(el, state)) +
  36321. '})'
  36322. }
  36323. function genData$2 (el, state) {
  36324. var data = '{';
  36325. // directives first.
  36326. // directives may mutate the el's other properties before they are generated.
  36327. var dirs = genDirectives(el, state);
  36328. if (dirs) { data += dirs + ','; }
  36329. // key
  36330. if (el.key) {
  36331. data += "key:" + (el.key) + ",";
  36332. }
  36333. // ref
  36334. if (el.ref) {
  36335. data += "ref:" + (el.ref) + ",";
  36336. }
  36337. if (el.refInFor) {
  36338. data += "refInFor:true,";
  36339. }
  36340. // pre
  36341. if (el.pre) {
  36342. data += "pre:true,";
  36343. }
  36344. // record original tag name for components using "is" attribute
  36345. if (el.component) {
  36346. data += "tag:\"" + (el.tag) + "\",";
  36347. }
  36348. // module data generation functions
  36349. for (var i = 0; i < state.dataGenFns.length; i++) {
  36350. data += state.dataGenFns[i](el);
  36351. }
  36352. // attributes
  36353. if (el.attrs) {
  36354. data += "attrs:{" + (genProps(el.attrs)) + "},";
  36355. }
  36356. // DOM props
  36357. if (el.props) {
  36358. data += "domProps:{" + (genProps(el.props)) + "},";
  36359. }
  36360. // event handlers
  36361. if (el.events) {
  36362. data += (genHandlers(el.events, false, state.warn)) + ",";
  36363. }
  36364. if (el.nativeEvents) {
  36365. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  36366. }
  36367. // slot target
  36368. if (el.slotTarget) {
  36369. data += "slot:" + (el.slotTarget) + ",";
  36370. }
  36371. // scoped slots
  36372. if (el.scopedSlots) {
  36373. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  36374. }
  36375. // component v-model
  36376. if (el.model) {
  36377. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  36378. }
  36379. // inline-template
  36380. if (el.inlineTemplate) {
  36381. var inlineTemplate = genInlineTemplate(el, state);
  36382. if (inlineTemplate) {
  36383. data += inlineTemplate + ",";
  36384. }
  36385. }
  36386. data = data.replace(/,$/, '') + '}';
  36387. // v-bind data wrap
  36388. if (el.wrapData) {
  36389. data = el.wrapData(data);
  36390. }
  36391. // v-on data wrap
  36392. if (el.wrapListeners) {
  36393. data = el.wrapListeners(data);
  36394. }
  36395. return data
  36396. }
  36397. function genDirectives (el, state) {
  36398. var dirs = el.directives;
  36399. if (!dirs) { return }
  36400. var res = 'directives:[';
  36401. var hasRuntime = false;
  36402. var i, l, dir, needRuntime;
  36403. for (i = 0, l = dirs.length; i < l; i++) {
  36404. dir = dirs[i];
  36405. needRuntime = true;
  36406. var gen = state.directives[dir.name];
  36407. if (gen) {
  36408. // compile-time directive that manipulates AST.
  36409. // returns true if it also needs a runtime counterpart.
  36410. needRuntime = !!gen(el, dir, state.warn);
  36411. }
  36412. if (needRuntime) {
  36413. hasRuntime = true;
  36414. 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))) : '') + "},";
  36415. }
  36416. }
  36417. if (hasRuntime) {
  36418. return res.slice(0, -1) + ']'
  36419. }
  36420. }
  36421. function genInlineTemplate (el, state) {
  36422. var ast = el.children[0];
  36423. if ("development" !== 'production' && (
  36424. el.children.length > 1 || ast.type !== 1
  36425. )) {
  36426. state.warn('Inline-template components must have exactly one child element.');
  36427. }
  36428. if (ast.type === 1) {
  36429. var inlineRenderFns = generate(ast, state.options);
  36430. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  36431. }
  36432. }
  36433. function genScopedSlots (
  36434. slots,
  36435. state
  36436. ) {
  36437. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  36438. return genScopedSlot(key, slots[key], state)
  36439. }).join(',')) + "])")
  36440. }
  36441. function genScopedSlot (
  36442. key,
  36443. el,
  36444. state
  36445. ) {
  36446. if (el.for && !el.forProcessed) {
  36447. return genForScopedSlot(key, el, state)
  36448. }
  36449. return "{key:" + key + ",fn:function(" + (String(el.attrsMap.scope)) + "){" +
  36450. "return " + (el.tag === 'template'
  36451. ? genChildren(el, state) || 'void 0'
  36452. : genElement(el, state)) + "}}"
  36453. }
  36454. function genForScopedSlot (
  36455. key,
  36456. el,
  36457. state
  36458. ) {
  36459. var exp = el.for;
  36460. var alias = el.alias;
  36461. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36462. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36463. el.forProcessed = true; // avoid recursion
  36464. return "_l((" + exp + ")," +
  36465. "function(" + alias + iterator1 + iterator2 + "){" +
  36466. "return " + (genScopedSlot(key, el, state)) +
  36467. '})'
  36468. }
  36469. function genChildren (
  36470. el,
  36471. state,
  36472. checkSkip,
  36473. altGenElement,
  36474. altGenNode
  36475. ) {
  36476. var children = el.children;
  36477. if (children.length) {
  36478. var el$1 = children[0];
  36479. // optimize single v-for
  36480. if (children.length === 1 &&
  36481. el$1.for &&
  36482. el$1.tag !== 'template' &&
  36483. el$1.tag !== 'slot'
  36484. ) {
  36485. return (altGenElement || genElement)(el$1, state)
  36486. }
  36487. var normalizationType = checkSkip
  36488. ? getNormalizationType(children, state.maybeComponent)
  36489. : 0;
  36490. var gen = altGenNode || genNode;
  36491. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  36492. }
  36493. }
  36494. // determine the normalization needed for the children array.
  36495. // 0: no normalization needed
  36496. // 1: simple normalization needed (possible 1-level deep nested array)
  36497. // 2: full normalization needed
  36498. function getNormalizationType (
  36499. children,
  36500. maybeComponent
  36501. ) {
  36502. var res = 0;
  36503. for (var i = 0; i < children.length; i++) {
  36504. var el = children[i];
  36505. if (el.type !== 1) {
  36506. continue
  36507. }
  36508. if (needsNormalization(el) ||
  36509. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  36510. res = 2;
  36511. break
  36512. }
  36513. if (maybeComponent(el) ||
  36514. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  36515. res = 1;
  36516. }
  36517. }
  36518. return res
  36519. }
  36520. function needsNormalization (el) {
  36521. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  36522. }
  36523. function genNode (node, state) {
  36524. if (node.type === 1) {
  36525. return genElement(node, state)
  36526. } if (node.type === 3 && node.isComment) {
  36527. return genComment(node)
  36528. } else {
  36529. return genText(node)
  36530. }
  36531. }
  36532. function genText (text) {
  36533. return ("_v(" + (text.type === 2
  36534. ? text.expression // no need for () because already wrapped in _s()
  36535. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  36536. }
  36537. function genComment (comment) {
  36538. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  36539. }
  36540. function genSlot (el, state) {
  36541. var slotName = el.slotName || '"default"';
  36542. var children = genChildren(el, state);
  36543. var res = "_t(" + slotName + (children ? ("," + children) : '');
  36544. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  36545. var bind$$1 = el.attrsMap['v-bind'];
  36546. if ((attrs || bind$$1) && !children) {
  36547. res += ",null";
  36548. }
  36549. if (attrs) {
  36550. res += "," + attrs;
  36551. }
  36552. if (bind$$1) {
  36553. res += (attrs ? '' : ',null') + "," + bind$$1;
  36554. }
  36555. return res + ')'
  36556. }
  36557. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  36558. function genComponent (
  36559. componentName,
  36560. el,
  36561. state
  36562. ) {
  36563. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36564. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  36565. }
  36566. function genProps (props) {
  36567. var res = '';
  36568. for (var i = 0; i < props.length; i++) {
  36569. var prop = props[i];
  36570. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  36571. }
  36572. return res.slice(0, -1)
  36573. }
  36574. // #3895, #4268
  36575. function transformSpecialNewlines (text) {
  36576. return text
  36577. .replace(/\u2028/g, '\\u2028')
  36578. .replace(/\u2029/g, '\\u2029')
  36579. }
  36580. /* */
  36581. // these keywords should not appear inside expressions, but operators like
  36582. // typeof, instanceof and in are allowed
  36583. var prohibitedKeywordRE = new RegExp('\\b' + (
  36584. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  36585. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  36586. 'extends,finally,continue,debugger,function,arguments'
  36587. ).split(',').join('\\b|\\b') + '\\b');
  36588. // these unary operators should not be used as property/method names
  36589. var unaryOperatorsRE = new RegExp('\\b' + (
  36590. 'delete,typeof,void'
  36591. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  36592. // check valid identifier for v-for
  36593. var identRE = /[A-Za-z_$][\w$]*/;
  36594. // strip strings in expressions
  36595. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  36596. // detect problematic expressions in a template
  36597. function detectErrors (ast) {
  36598. var errors = [];
  36599. if (ast) {
  36600. checkNode(ast, errors);
  36601. }
  36602. return errors
  36603. }
  36604. function checkNode (node, errors) {
  36605. if (node.type === 1) {
  36606. for (var name in node.attrsMap) {
  36607. if (dirRE.test(name)) {
  36608. var value = node.attrsMap[name];
  36609. if (value) {
  36610. if (name === 'v-for') {
  36611. checkFor(node, ("v-for=\"" + value + "\""), errors);
  36612. } else if (onRE.test(name)) {
  36613. checkEvent(value, (name + "=\"" + value + "\""), errors);
  36614. } else {
  36615. checkExpression(value, (name + "=\"" + value + "\""), errors);
  36616. }
  36617. }
  36618. }
  36619. }
  36620. if (node.children) {
  36621. for (var i = 0; i < node.children.length; i++) {
  36622. checkNode(node.children[i], errors);
  36623. }
  36624. }
  36625. } else if (node.type === 2) {
  36626. checkExpression(node.expression, node.text, errors);
  36627. }
  36628. }
  36629. function checkEvent (exp, text, errors) {
  36630. var stipped = exp.replace(stripStringRE, '');
  36631. var keywordMatch = stipped.match(unaryOperatorsRE);
  36632. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  36633. errors.push(
  36634. "avoid using JavaScript unary operator as property name: " +
  36635. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36636. );
  36637. }
  36638. checkExpression(exp, text, errors);
  36639. }
  36640. function checkFor (node, text, errors) {
  36641. checkExpression(node.for || '', text, errors);
  36642. checkIdentifier(node.alias, 'v-for alias', text, errors);
  36643. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  36644. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  36645. }
  36646. function checkIdentifier (ident, type, text, errors) {
  36647. if (typeof ident === 'string' && !identRE.test(ident)) {
  36648. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  36649. }
  36650. }
  36651. function checkExpression (exp, text, errors) {
  36652. try {
  36653. new Function(("return " + exp));
  36654. } catch (e) {
  36655. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  36656. if (keywordMatch) {
  36657. errors.push(
  36658. "avoid using JavaScript keyword as property name: " +
  36659. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36660. );
  36661. } else {
  36662. errors.push(("invalid expression: " + (text.trim())));
  36663. }
  36664. }
  36665. }
  36666. /* */
  36667. function createFunction (code, errors) {
  36668. try {
  36669. return new Function(code)
  36670. } catch (err) {
  36671. errors.push({ err: err, code: code });
  36672. return noop
  36673. }
  36674. }
  36675. function createCompileToFunctionFn (compile) {
  36676. var cache = Object.create(null);
  36677. return function compileToFunctions (
  36678. template,
  36679. options,
  36680. vm
  36681. ) {
  36682. options = options || {};
  36683. /* istanbul ignore if */
  36684. if (true) {
  36685. // detect possible CSP restriction
  36686. try {
  36687. new Function('return 1');
  36688. } catch (e) {
  36689. if (e.toString().match(/unsafe-eval|CSP/)) {
  36690. warn(
  36691. 'It seems you are using the standalone build of Vue.js in an ' +
  36692. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  36693. 'The template compiler cannot work in this environment. Consider ' +
  36694. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  36695. 'templates into render functions.'
  36696. );
  36697. }
  36698. }
  36699. }
  36700. // check cache
  36701. var key = options.delimiters
  36702. ? String(options.delimiters) + template
  36703. : template;
  36704. if (cache[key]) {
  36705. return cache[key]
  36706. }
  36707. // compile
  36708. var compiled = compile(template, options);
  36709. // check compilation errors/tips
  36710. if (true) {
  36711. if (compiled.errors && compiled.errors.length) {
  36712. warn(
  36713. "Error compiling template:\n\n" + template + "\n\n" +
  36714. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  36715. vm
  36716. );
  36717. }
  36718. if (compiled.tips && compiled.tips.length) {
  36719. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  36720. }
  36721. }
  36722. // turn code into functions
  36723. var res = {};
  36724. var fnGenErrors = [];
  36725. res.render = createFunction(compiled.render, fnGenErrors);
  36726. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  36727. return createFunction(code, fnGenErrors)
  36728. });
  36729. // check function generation errors.
  36730. // this should only happen if there is a bug in the compiler itself.
  36731. // mostly for codegen development use
  36732. /* istanbul ignore if */
  36733. if (true) {
  36734. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  36735. warn(
  36736. "Failed to generate render function:\n\n" +
  36737. fnGenErrors.map(function (ref) {
  36738. var err = ref.err;
  36739. var code = ref.code;
  36740. return ((err.toString()) + " in\n\n" + code + "\n");
  36741. }).join('\n'),
  36742. vm
  36743. );
  36744. }
  36745. }
  36746. return (cache[key] = res)
  36747. }
  36748. }
  36749. /* */
  36750. function createCompilerCreator (baseCompile) {
  36751. return function createCompiler (baseOptions) {
  36752. function compile (
  36753. template,
  36754. options
  36755. ) {
  36756. var finalOptions = Object.create(baseOptions);
  36757. var errors = [];
  36758. var tips = [];
  36759. finalOptions.warn = function (msg, tip) {
  36760. (tip ? tips : errors).push(msg);
  36761. };
  36762. if (options) {
  36763. // merge custom modules
  36764. if (options.modules) {
  36765. finalOptions.modules =
  36766. (baseOptions.modules || []).concat(options.modules);
  36767. }
  36768. // merge custom directives
  36769. if (options.directives) {
  36770. finalOptions.directives = extend(
  36771. Object.create(baseOptions.directives),
  36772. options.directives
  36773. );
  36774. }
  36775. // copy other options
  36776. for (var key in options) {
  36777. if (key !== 'modules' && key !== 'directives') {
  36778. finalOptions[key] = options[key];
  36779. }
  36780. }
  36781. }
  36782. var compiled = baseCompile(template, finalOptions);
  36783. if (true) {
  36784. errors.push.apply(errors, detectErrors(compiled.ast));
  36785. }
  36786. compiled.errors = errors;
  36787. compiled.tips = tips;
  36788. return compiled
  36789. }
  36790. return {
  36791. compile: compile,
  36792. compileToFunctions: createCompileToFunctionFn(compile)
  36793. }
  36794. }
  36795. }
  36796. /* */
  36797. // `createCompilerCreator` allows creating compilers that use alternative
  36798. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  36799. // Here we just export a default compiler using the default parts.
  36800. var createCompiler = createCompilerCreator(function baseCompile (
  36801. template,
  36802. options
  36803. ) {
  36804. var ast = parse(template.trim(), options);
  36805. optimize(ast, options);
  36806. var code = generate(ast, options);
  36807. return {
  36808. ast: ast,
  36809. render: code.render,
  36810. staticRenderFns: code.staticRenderFns
  36811. }
  36812. });
  36813. /* */
  36814. var ref$1 = createCompiler(baseOptions);
  36815. var compileToFunctions = ref$1.compileToFunctions;
  36816. /* */
  36817. var idToTemplate = cached(function (id) {
  36818. var el = query(id);
  36819. return el && el.innerHTML
  36820. });
  36821. var mount = Vue$3.prototype.$mount;
  36822. Vue$3.prototype.$mount = function (
  36823. el,
  36824. hydrating
  36825. ) {
  36826. el = el && query(el);
  36827. /* istanbul ignore if */
  36828. if (el === document.body || el === document.documentElement) {
  36829. "development" !== 'production' && warn(
  36830. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  36831. );
  36832. return this
  36833. }
  36834. var options = this.$options;
  36835. // resolve template/el and convert to render function
  36836. if (!options.render) {
  36837. var template = options.template;
  36838. if (template) {
  36839. if (typeof template === 'string') {
  36840. if (template.charAt(0) === '#') {
  36841. template = idToTemplate(template);
  36842. /* istanbul ignore if */
  36843. if ("development" !== 'production' && !template) {
  36844. warn(
  36845. ("Template element not found or is empty: " + (options.template)),
  36846. this
  36847. );
  36848. }
  36849. }
  36850. } else if (template.nodeType) {
  36851. template = template.innerHTML;
  36852. } else {
  36853. if (true) {
  36854. warn('invalid template option:' + template, this);
  36855. }
  36856. return this
  36857. }
  36858. } else if (el) {
  36859. template = getOuterHTML(el);
  36860. }
  36861. if (template) {
  36862. /* istanbul ignore if */
  36863. if ("development" !== 'production' && config.performance && mark) {
  36864. mark('compile');
  36865. }
  36866. var ref = compileToFunctions(template, {
  36867. shouldDecodeNewlines: shouldDecodeNewlines,
  36868. delimiters: options.delimiters,
  36869. comments: options.comments
  36870. }, this);
  36871. var render = ref.render;
  36872. var staticRenderFns = ref.staticRenderFns;
  36873. options.render = render;
  36874. options.staticRenderFns = staticRenderFns;
  36875. /* istanbul ignore if */
  36876. if ("development" !== 'production' && config.performance && mark) {
  36877. mark('compile end');
  36878. measure(((this._name) + " compile"), 'compile', 'compile end');
  36879. }
  36880. }
  36881. }
  36882. return mount.call(this, el, hydrating)
  36883. };
  36884. /**
  36885. * Get outerHTML of elements, taking care
  36886. * of SVG elements in IE as well.
  36887. */
  36888. function getOuterHTML (el) {
  36889. if (el.outerHTML) {
  36890. return el.outerHTML
  36891. } else {
  36892. var container = document.createElement('div');
  36893. container.appendChild(el.cloneNode(true));
  36894. return container.innerHTML
  36895. }
  36896. }
  36897. Vue$3.compile = compileToFunctions;
  36898. module.exports = Vue$3;
  36899. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  36900. /***/ }),
  36901. /* 36 */
  36902. /***/ (function(module, exports, __webpack_require__) {
  36903. var disposed = false
  36904. var Component = __webpack_require__(37)(
  36905. /* script */
  36906. __webpack_require__(38),
  36907. /* template */
  36908. __webpack_require__(39),
  36909. /* styles */
  36910. null,
  36911. /* scopeId */
  36912. null,
  36913. /* moduleIdentifier (server only) */
  36914. null
  36915. )
  36916. Component.options.__file = "/Users/fgm/src/PHP/Laravel/blog/resources/assets/js/components/Example.vue"
  36917. if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
  36918. if (Component.options.functional) {console.error("[vue-loader] Example.vue: functional components are not supported with templates, they should use render functions.")}
  36919. /* hot reload */
  36920. if (false) {(function () {
  36921. var hotAPI = require("vue-hot-reload-api")
  36922. hotAPI.install(require("vue"), false)
  36923. if (!hotAPI.compatible) return
  36924. module.hot.accept()
  36925. if (!module.hot.data) {
  36926. hotAPI.createRecord("data-v-5e8d45e4", Component.options)
  36927. } else {
  36928. hotAPI.reload("data-v-5e8d45e4", Component.options)
  36929. }
  36930. module.hot.dispose(function (data) {
  36931. disposed = true
  36932. })
  36933. })()}
  36934. module.exports = Component.exports
  36935. /***/ }),
  36936. /* 37 */
  36937. /***/ (function(module, exports) {
  36938. /* globals __VUE_SSR_CONTEXT__ */
  36939. // this module is a runtime utility for cleaner component module output and will
  36940. // be included in the final webpack user bundle
  36941. module.exports = function normalizeComponent (
  36942. rawScriptExports,
  36943. compiledTemplate,
  36944. injectStyles,
  36945. scopeId,
  36946. moduleIdentifier /* server only */
  36947. ) {
  36948. var esModule
  36949. var scriptExports = rawScriptExports = rawScriptExports || {}
  36950. // ES6 modules interop
  36951. var type = typeof rawScriptExports.default
  36952. if (type === 'object' || type === 'function') {
  36953. esModule = rawScriptExports
  36954. scriptExports = rawScriptExports.default
  36955. }
  36956. // Vue.extend constructor export interop
  36957. var options = typeof scriptExports === 'function'
  36958. ? scriptExports.options
  36959. : scriptExports
  36960. // render functions
  36961. if (compiledTemplate) {
  36962. options.render = compiledTemplate.render
  36963. options.staticRenderFns = compiledTemplate.staticRenderFns
  36964. }
  36965. // scopedId
  36966. if (scopeId) {
  36967. options._scopeId = scopeId
  36968. }
  36969. var hook
  36970. if (moduleIdentifier) { // server build
  36971. hook = function (context) {
  36972. // 2.3 injection
  36973. context =
  36974. context || // cached call
  36975. (this.$vnode && this.$vnode.ssrContext) || // stateful
  36976. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  36977. // 2.2 with runInNewContext: true
  36978. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  36979. context = __VUE_SSR_CONTEXT__
  36980. }
  36981. // inject component styles
  36982. if (injectStyles) {
  36983. injectStyles.call(this, context)
  36984. }
  36985. // register component module identifier for async chunk inferrence
  36986. if (context && context._registeredComponents) {
  36987. context._registeredComponents.add(moduleIdentifier)
  36988. }
  36989. }
  36990. // used by ssr in case component is cached and beforeCreate
  36991. // never gets called
  36992. options._ssrRegister = hook
  36993. } else if (injectStyles) {
  36994. hook = injectStyles
  36995. }
  36996. if (hook) {
  36997. var functional = options.functional
  36998. var existing = functional
  36999. ? options.render
  37000. : options.beforeCreate
  37001. if (!functional) {
  37002. // inject component registration as beforeCreate hook
  37003. options.beforeCreate = existing
  37004. ? [].concat(existing, hook)
  37005. : [hook]
  37006. } else {
  37007. // register for functioal component in vue file
  37008. options.render = function renderWithStyleInjection (h, context) {
  37009. hook.call(context)
  37010. return existing(h, context)
  37011. }
  37012. }
  37013. }
  37014. return {
  37015. esModule: esModule,
  37016. exports: scriptExports,
  37017. options: options
  37018. }
  37019. }
  37020. /***/ }),
  37021. /* 38 */
  37022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37023. "use strict";
  37024. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  37025. //
  37026. //
  37027. //
  37028. //
  37029. //
  37030. //
  37031. //
  37032. //
  37033. //
  37034. //
  37035. //
  37036. //
  37037. //
  37038. //
  37039. //
  37040. //
  37041. /* harmony default export */ __webpack_exports__["default"] = ({
  37042. mounted: function mounted() {
  37043. console.log('Component mounted.');
  37044. }
  37045. });
  37046. /***/ }),
  37047. /* 39 */
  37048. /***/ (function(module, exports, __webpack_require__) {
  37049. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  37050. return _vm._m(0)
  37051. },staticRenderFns: [function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  37052. return _c('div', {
  37053. staticClass: "container"
  37054. }, [_c('div', {
  37055. staticClass: "row"
  37056. }, [_c('div', {
  37057. staticClass: "col-md-8 col-md-offset-2"
  37058. }, [_c('div', {
  37059. staticClass: "panel panel-default"
  37060. }, [_c('div', {
  37061. staticClass: "panel-heading"
  37062. }, [_vm._v("Example Component")]), _vm._v(" "), _c('div', {
  37063. staticClass: "panel-body"
  37064. }, [_vm._v("\n I'm an example component!\n ")])])])])])
  37065. }]}
  37066. module.exports.render._withStripped = true
  37067. if (false) {
  37068. module.hot.accept()
  37069. if (module.hot.data) {
  37070. require("vue-hot-reload-api").rerender("data-v-5e8d45e4", module.exports)
  37071. }
  37072. }
  37073. /***/ }),
  37074. /* 40 */
  37075. /***/ (function(module, exports) {
  37076. // removed by extract-text-webpack-plugin
  37077. /***/ })
  37078. /******/ ]);