configure.min.js 1.4 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291
  1. (function(FuseBox){FuseBox.$fuse$=FuseBox;
  2. var __fsbx_css = function (__filename, contents) {
  3. if (FuseBox.isServer) {
  4. return;
  5. }
  6. var styleId = __filename.replace(/[\.\/]+/g, '-');
  7. if (styleId.charAt(0) === '-')
  8. styleId = styleId.substring(1);
  9. var exists = document.getElementById(styleId);
  10. if (!exists) {
  11. //<link href="//fonts.googleapis.com/css?family=Covered+By+Your+Grace" rel="stylesheet" type="text/css">
  12. var s = document.createElement(contents ? 'style' : 'link');
  13. s.id = styleId;
  14. s.type = 'text/css';
  15. if (contents) {
  16. s.innerHTML = contents;
  17. }
  18. else {
  19. s.rel = 'stylesheet';
  20. s.href = __filename;
  21. }
  22. document.getElementsByTagName('head')[0].appendChild(s);
  23. }
  24. else {
  25. if (contents) {
  26. exists.innerHTML = contents;
  27. }
  28. }
  29. };
  30. /**
  31. * Listens to 'async' requets and if the name is a css file
  32. * wires it to `__fsbx_css`
  33. */
  34. FuseBox.on('async', function (name) {
  35. if (FuseBox.isServer) {
  36. return;
  37. }
  38. if (/\.css$/.test(name)) {
  39. __fsbx_css(name);
  40. return false;
  41. }
  42. });
  43. FuseBox.pkg("default", {}, function(___scope___){
  44. ___scope___.file("configure.js", function(exports, require, module, __filename, __dirname){
  45. 'use strict';
  46. require('./scss/configure.scss');
  47. require('./js/configure.js');
  48. });
  49. ___scope___.file("scss/configure.scss", function(exports, require, module, __filename, __dirname){
  50. __fsbx_css("scss/configure.scss", "@charset \"UTF-8\";\n/*\r\n\tHTML5 Reset :: style.css\r\n\t----------------------------------------------------------\r\n\tWe have learned much from/been inspired by/taken code where offered from:\r\n\tEric Meyer\t\t\t\t\t:: http://meyerweb.com\r\n\tHTML5 Doctor\t\t\t\t:: http://html5doctor.com\r\n\tand the HTML5 Boilerplate\t:: http://html5boilerplate.com\r\n-------------------------------------------------------------------------------*/\n/* Let's default this puppy out\r\n-------------------------------------------------------------------------------*/\nhtml, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, menu, nav, section, time, mark, audio, video, details, summary {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font-weight: normal;\n vertical-align: baseline;\n background: transparent; }\n\nmain, article, aside, figure, footer, header, nav, section, details, summary {\n display: block; }\n\n/* Handle box-sizing while better addressing child elements:\r\n http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */\nhtml {\n box-sizing: border-box; }\n\n*,\n*:before,\n*:after {\n box-sizing: inherit; }\n\n/* consider resetting the default cursor: https://gist.github.com/murtaugh/5247154 */\n/* Responsive images and other embedded objects */\n/* if you don't have full control over `img` tags (if you have to overcome attributes), consider adding height: auto */\nimg,\nobject,\nembed {\n max-width: 100%; }\n\n/*\r\n Note: keeping IMG here will cause problems if you're using foreground images as sprites.\r\n\tIn fact, it *will* cause problems with Google Maps' controls at small size.\r\n\tIf this is the case for you, try uncommenting the following:\r\n#map img {\r\n\t\tmax-width: none;\r\n}\r\n*/\n/* force a vertical scrollbar to prevent a jumpy page */\nhtml {\n overflow-y: scroll; }\n\n/* we use a lot of ULs that aren't bulleted.\r\n\tyou'll have to restore the bullets within content,\r\n\twhich is fine because they're probably customized anyway */\nul {\n list-style: none; }\n\nblockquote, q {\n quotes: none; }\n\nblockquote:before,\nblockquote:after,\nq:before,\nq:after {\n content: '';\n content: none; }\n\na {\n margin: 0;\n padding: 0;\n font-size: 100%;\n vertical-align: baseline;\n background: transparent; }\n\ndel {\n text-decoration: line-through; }\n\nabbr[title], dfn[title] {\n border-bottom: 1px dotted #000;\n cursor: help; }\n\n/* tables still need cellspacing=\"0\" in the markup */\ntable {\n border-collapse: separate;\n border-spacing: 0; }\n\nth {\n font-weight: bold;\n vertical-align: bottom; }\n\ntd {\n font-weight: normal;\n vertical-align: top; }\n\nhr {\n display: block;\n height: 1px;\n border: 0;\n border-top: 1px solid #ccc;\n margin: 1em 0;\n padding: 0; }\n\ninput, select {\n vertical-align: middle; }\n\npre {\n white-space: pre;\n /* CSS2 */\n white-space: pre-wrap;\n /* CSS 2.1 */\n white-space: pre-line;\n /* CSS 3 (and 2.1 as well, actually) */\n word-wrap: break-word;\n /* IE */ }\n\ninput[type=\"radio\"] {\n vertical-align: text-bottom; }\n\ninput[type=\"checkbox\"] {\n vertical-align: bottom; }\n\n.ie7 input[type=\"checkbox\"] {\n vertical-align: baseline; }\n\n.ie6 input {\n vertical-align: text-bottom; }\n\nselect, input, textarea {\n font: 99% sans-serif; }\n\ntable {\n font-size: inherit;\n font: 100%; }\n\nsmall {\n font-size: 85%; }\n\nstrong {\n font-weight: bold; }\n\ntd, td img {\n vertical-align: top; }\n\n/* Make sure sup and sub don't mess with your line-heights http://gist.github.com/413930 */\nsub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative; }\n\nsup {\n top: -0.5em; }\n\nsub {\n bottom: -0.25em; }\n\n/* standardize any monospaced elements */\npre, code, kbd, samp {\n font-family: monospace, sans-serif; }\n\n/* hand cursor on clickable elements */\n.clickable,\nlabel,\ninput[type=button],\ninput[type=submit],\ninput[type=file],\nbutton {\n cursor: pointer; }\n\n/* Webkit browsers add a 2px margin outside the chrome of form elements */\nbutton, input, select, textarea {\n margin: 0; }\n\n/* make buttons play nice in IE */\nbutton,\ninput[type=button] {\n width: auto;\n overflow: visible; }\n\n/* scale images in IE7 more attractively */\n.ie7 img {\n -ms-interpolation-mode: bicubic; }\n\n/* prevent BG image flicker upon hover\r\n (commented out as usage is rare, and the filter syntax messes with some pre-processors)\r\n.ie6 html {filter: expression(document.execCommand(\"BackgroundImageCache\", false, true));}\r\n*/\n/* let's clear some floats */\n.clearfix:after {\n content: \" \";\n display: block;\n clear: both; }\n\n/**\r\n * Clearfix\r\n *\r\n * @return {string} Clearfix attribute\r\n */\n/**\r\n * Placeholder attribute for inputs\r\n *\r\n * @return {string} Placeholder attributes\r\n */\n/**\r\n * Spinner element\r\n *\r\n * @param {string} $color - Color\r\n * @param {string} $dur - Animation Duration\r\n * @param {int} $width - Width\r\n * @param {int} $height [$width] - height\r\n *\r\n * @return {string} Spinner element\r\n */\n/**\r\n * Prefixes for keyframes\r\n *\r\n * @param {string} $animation-name - The animation name\r\n *\r\n * @return {string} Prefixed keyframes attributes\r\n */\n/**\r\n * Prefix function for browser compatibility\r\n *\r\n * @param {string} $property - Property name\r\n * @param {any} $value - Property value\r\n *\r\n * @return {string} Prefixed attributes\r\n */\n/**\r\n * Layout Mixins\r\n */\n@font-face {\n font-family: 'core-icons';\n src: url(\"/fonts/core-icons.ttf?e6rn1i\") format(\"truetype\"), url(\"/fonts/core-icons.woff?e6rn1i\") format(\"woff\"), url(\"/fonts/core-icons.svg?e6rn1i#core-icons\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n[class^=\"icon-\"], [class*=\" icon-\"] {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'core-icons' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.icon-minus2:before {\n content: \"\"; }\n\n.icon-font:before {\n content: \"\"; }\n\n.icon-bold:before {\n content: \"\"; }\n\n.icon-italic:before {\n content: \"\"; }\n\n.icon-align-left2:before {\n content: \"\"; }\n\n.icon-align-center2:before {\n content: \"\"; }\n\n.icon-align-right2:before {\n content: \"\"; }\n\n.icon-align-justify2:before {\n content: \"\"; }\n\n.icon-list:before {\n content: \"\"; }\n\n.icon-video-camera2:before {\n content: \"\"; }\n\n.icon-image3:before {\n content: \"\"; }\n\n.icon-photo:before {\n content: \"\"; }\n\n.icon-picture-o:before {\n content: \"\"; }\n\n.icon-twitter-square:before {\n content: \"\"; }\n\n.icon-facebook-square:before {\n content: \"\"; }\n\n.icon-linkedin-square:before {\n content: \"\"; }\n\n.icon-github-square:before {\n content: \"\"; }\n\n.icon-twitter:before {\n content: \"\"; }\n\n.icon-facebook:before {\n content: \"\"; }\n\n.icon-facebook-f:before {\n content: \"\"; }\n\n.icon-github:before {\n content: \"\"; }\n\n.icon-chain:before {\n content: \"\"; }\n\n.icon-link3:before {\n content: \"\"; }\n\n.icon-bars:before {\n content: \"\"; }\n\n.icon-navicon:before {\n content: \"\"; }\n\n.icon-reorder:before {\n content: \"\"; }\n\n.icon-list-ul:before {\n content: \"\"; }\n\n.icon-list-ol:before {\n content: \"\"; }\n\n.icon-strikethrough:before {\n content: \"\"; }\n\n.icon-underline:before {\n content: \"\"; }\n\n.icon-table:before {\n content: \"\"; }\n\n.icon-linkedin:before {\n content: \"\"; }\n\n.icon-file-text-o:before {\n content: \"\"; }\n\n.icon-quote-left:before {\n content: \"\"; }\n\n.icon-terminal:before {\n content: \"\"; }\n\n.icon-code:before {\n content: \"\"; }\n\n.icon-youtube-play:before {\n content: \"\"; }\n\n.icon-dropbox:before {\n content: \"\"; }\n\n.icon-stack-overflow:before {\n content: \"\"; }\n\n.icon-bitbucket:before {\n content: \"\"; }\n\n.icon-apple:before {\n content: \"\"; }\n\n.icon-windows2:before {\n content: \"\"; }\n\n.icon-android:before {\n content: \"\"; }\n\n.icon-linux:before {\n content: \"\"; }\n\n.icon-vimeo-square:before {\n content: \"\"; }\n\n.icon-slack:before {\n content: \"\"; }\n\n.icon-google:before {\n content: \"\"; }\n\n.icon-git-square:before {\n content: \"\"; }\n\n.icon-git:before {\n content: \"\"; }\n\n.icon-header:before {\n content: \"\"; }\n\n.icon-safari:before {\n content: \"\"; }\n\n.icon-chrome:before {\n content: \"\"; }\n\n.icon-firefox:before {\n content: \"\"; }\n\n.icon-opera:before {\n content: \"\"; }\n\n.icon-internet-explorer:before {\n content: \"\"; }\n\n.icon-vimeo:before {\n content: \"\"; }\n\n.icon-edge:before {\n content: \"\"; }\n\n.icon-gitlab:before {\n content: \"\"; }\n\n.icon-th-small:before {\n content: \"\"; }\n\n.icon-th-menu:before {\n content: \"\"; }\n\n.icon-th-list:before {\n content: \"\"; }\n\n.icon-th-large:before {\n content: \"\"; }\n\n.icon-home:before {\n content: \"\"; }\n\n.icon-location:before {\n content: \"\"; }\n\n.icon-link:before {\n content: \"\"; }\n\n.icon-starburst:before {\n content: \"\"; }\n\n.icon-starburst-outline:before {\n content: \"\"; }\n\n.icon-star:before {\n content: \"\"; }\n\n.icon-flow-children:before {\n content: \"\"; }\n\n.icon-export:before {\n content: \"\"; }\n\n.icon-delete:before {\n content: \"\"; }\n\n.icon-delete-outline:before {\n content: \"\"; }\n\n.icon-cloud-storage:before {\n content: \"\"; }\n\n.icon-backspace:before {\n content: \"\"; }\n\n.icon-attachment:before {\n content: \"\"; }\n\n.icon-arrow-move:before {\n content: \"\"; }\n\n.icon-warning:before {\n content: \"\"; }\n\n.icon-location-arrow:before {\n content: \"\"; }\n\n.icon-point-of-interest:before {\n content: \"\"; }\n\n.icon-infinity:before {\n content: \"\"; }\n\n.icon-eye:before {\n content: \"\"; }\n\n.icon-refresh:before {\n content: \"\"; }\n\n.icon-pin:before {\n content: \"\"; }\n\n.icon-eject:before {\n content: \"\"; }\n\n.icon-arrow-sync:before {\n content: \"\"; }\n\n.icon-arrow-shuffle:before {\n content: \"\"; }\n\n.icon-arrow-repeat:before {\n content: \"\"; }\n\n.icon-arrow-minimise:before {\n content: \"\"; }\n\n.icon-arrow-maximise:before {\n content: \"\"; }\n\n.icon-arrow-loop:before {\n content: \"\"; }\n\n.icon-spanner:before {\n content: \"\"; }\n\n.icon-power:before {\n content: \"\"; }\n\n.icon-flag:before {\n content: \"\"; }\n\n.icon-th-large-outline:before {\n content: \"\"; }\n\n.icon-th-small-outline:before {\n content: \"\"; }\n\n.icon-th-menu-outline:before {\n content: \"\"; }\n\n.icon-th-list-outline:before {\n content: \"\"; }\n\n.icon-home-outline:before {\n content: \"\"; }\n\n.icon-trash:before {\n content: \"\"; }\n\n.icon-star-outline:before {\n content: \"\"; }\n\n.icon-mail:before {\n content: \"\"; }\n\n.icon-heart-outline:before {\n content: \"\"; }\n\n.icon-flash-outline:before {\n content: \"\"; }\n\n.icon-watch:before {\n content: \"\"; }\n\n.icon-warning-outline:before {\n content: \"\"; }\n\n.icon-location-arrow-outline:before {\n content: \"\"; }\n\n.icon-info-outline:before {\n content: \"\"; }\n\n.icon-backspace-outline:before {\n content: \"\"; }\n\n.icon-upload-outline:before {\n content: \"\"; }\n\n.icon-tag:before {\n content: \"\"; }\n\n.icon-tabs-outline:before {\n content: \"\"; }\n\n.icon-pin-outline:before {\n content: \"\"; }\n\n.icon-pipette:before {\n content: \"\"; }\n\n.icon-pencil:before {\n content: \"\"; }\n\n.icon-folder:before {\n content: \"\"; }\n\n.icon-folder-delete:before {\n content: \"\"; }\n\n.icon-folder-add:before {\n content: \"\"; }\n\n.icon-edit:before {\n content: \"\"; }\n\n.icon-document:before {\n content: \"\"; }\n\n.icon-document-delete:before {\n content: \"\"; }\n\n.icon-document-add:before {\n content: \"\"; }\n\n.icon-brush:before {\n content: \"\"; }\n\n.icon-thumbs-up:before {\n content: \"\"; }\n\n.icon-thumbs-down:before {\n content: \"\"; }\n\n.icon-pen:before {\n content: \"\"; }\n\n.icon-bookmark:before {\n content: \"\"; }\n\n.icon-arrow-up:before {\n content: \"\"; }\n\n.icon-arrow-sync-outline:before {\n content: \"\"; }\n\n.icon-arrow-right:before {\n content: \"\"; }\n\n.icon-arrow-repeat-outline:before {\n content: \"\"; }\n\n.icon-arrow-loop-outline:before {\n content: \"\"; }\n\n.icon-arrow-left:before {\n content: \"\"; }\n\n.icon-flow-switch:before {\n content: \"\"; }\n\n.icon-flow-parallel:before {\n content: \"\"; }\n\n.icon-flow-merge:before {\n content: \"\"; }\n\n.icon-document-text:before {\n content: \"\"; }\n\n.icon-arrow-down:before {\n content: \"\"; }\n\n.icon-bell:before {\n content: \"\"; }\n\n.icon-adjust-contrast:before {\n content: \"\"; }\n\n.icon-lightbulb:before {\n content: \"\"; }\n\n.icon-tags:before {\n content: \"\"; }\n\n.icon-eye2:before {\n content: \"\"; }\n\n.icon-paper-clip:before {\n content: \"\"; }\n\n.icon-mail2:before {\n content: \"\"; }\n\n.icon-toggle:before {\n content: \"\"; }\n\n.icon-layout:before {\n content: \"\"; }\n\n.icon-link2:before {\n content: \"\"; }\n\n.icon-bell2:before {\n content: \"\"; }\n\n.icon-lock:before {\n content: \"\"; }\n\n.icon-unlock:before {\n content: \"\"; }\n\n.icon-ribbon:before {\n content: \"\"; }\n\n.icon-image:before {\n content: \"\"; }\n\n.icon-signal:before {\n content: \"\"; }\n\n.icon-target:before {\n content: \"\"; }\n\n.icon-clipboard:before {\n content: \"\"; }\n\n.icon-clock:before {\n content: \"\"; }\n\n.icon-watch2:before {\n content: \"\"; }\n\n.icon-air-play:before {\n content: \"\"; }\n\n.icon-camera:before {\n content: \"\"; }\n\n.icon-video:before {\n content: \"\"; }\n\n.icon-disc:before {\n content: \"\"; }\n\n.icon-printer:before {\n content: \"\"; }\n\n.icon-monitor:before {\n content: \"\"; }\n\n.icon-server:before {\n content: \"\"; }\n\n.icon-cog:before {\n content: \"\"; }\n\n.icon-heart:before {\n content: \"\"; }\n\n.icon-paragraph:before {\n content: \"\"; }\n\n.icon-align-justify:before {\n content: \"\"; }\n\n.icon-align-left:before {\n content: \"\"; }\n\n.icon-align-center:before {\n content: \"\"; }\n\n.icon-align-right:before {\n content: \"\"; }\n\n.icon-book:before {\n content: \"\"; }\n\n.icon-layers:before {\n content: \"\"; }\n\n.icon-stack:before {\n content: \"\"; }\n\n.icon-stack-2:before {\n content: \"\"; }\n\n.icon-paper:before {\n content: \"\"; }\n\n.icon-paper-stack:before {\n content: \"\"; }\n\n.icon-search:before {\n content: \"\"; }\n\n.icon-zoom-in:before {\n content: \"\"; }\n\n.icon-zoom-out:before {\n content: \"\"; }\n\n.icon-reply:before {\n content: \"\"; }\n\n.icon-circle-plus:before {\n content: \"\"; }\n\n.icon-circle-minus:before {\n content: \"\"; }\n\n.icon-circle-check:before {\n content: \"\"; }\n\n.icon-circle-cross:before {\n content: \"\"; }\n\n.icon-square-plus:before {\n content: \"\"; }\n\n.icon-square-minus:before {\n content: \"\"; }\n\n.icon-square-check:before {\n content: \"\"; }\n\n.icon-square-cross:before {\n content: \"\"; }\n\n.icon-microphone:before {\n content: \"\"; }\n\n.icon-record:before {\n content: \"\"; }\n\n.icon-skip-back:before {\n content: \"\"; }\n\n.icon-rewind:before {\n content: \"\"; }\n\n.icon-play:before {\n content: \"\"; }\n\n.icon-pause:before {\n content: \"\"; }\n\n.icon-stop:before {\n content: \"\"; }\n\n.icon-fast-forward:before {\n content: \"\"; }\n\n.icon-skip-forward:before {\n content: \"\"; }\n\n.icon-shuffle:before {\n content: \"\"; }\n\n.icon-repeat:before {\n content: \"\"; }\n\n.icon-folder2:before {\n content: \"\"; }\n\n.icon-umbrella:before {\n content: \"\"; }\n\n.icon-moon:before {\n content: \"\"; }\n\n.icon-thermometer:before {\n content: \"\"; }\n\n.icon-drop:before {\n content: \"\"; }\n\n.icon-sun:before {\n content: \"\"; }\n\n.icon-cloud:before {\n content: \"\"; }\n\n.icon-cloud-upload:before {\n content: \"\"; }\n\n.icon-cloud-download:before {\n content: \"\"; }\n\n.icon-upload:before {\n content: \"\"; }\n\n.icon-download:before {\n content: \"\"; }\n\n.icon-location2:before {\n content: \"\"; }\n\n.icon-location-2:before {\n content: \"\"; }\n\n.icon-map:before {\n content: \"\"; }\n\n.icon-battery:before {\n content: \"\"; }\n\n.icon-head:before {\n content: \"\"; }\n\n.icon-briefcase:before {\n content: \"\"; }\n\n.icon-speech-bubble:before {\n content: \"\"; }\n\n.icon-anchor:before {\n content: \"\"; }\n\n.icon-globe:before {\n content: \"\"; }\n\n.icon-box:before {\n content: \"\"; }\n\n.icon-reload:before {\n content: \"\"; }\n\n.icon-share:before {\n content: \"\"; }\n\n.icon-marquee:before {\n content: \"\"; }\n\n.icon-marquee-plus:before {\n content: \"\"; }\n\n.icon-marquee-minus:before {\n content: \"\"; }\n\n.icon-tag2:before {\n content: \"\"; }\n\n.icon-power2:before {\n content: \"\"; }\n\n.icon-command:before {\n content: \"\"; }\n\n.icon-alt:before {\n content: \"\"; }\n\n.icon-esc:before {\n content: \"\"; }\n\n.icon-bar-graph:before {\n content: \"\"; }\n\n.icon-bar-graph-2:before {\n content: \"\"; }\n\n.icon-pie-graph:before {\n content: \"\"; }\n\n.icon-star2:before {\n content: \"\"; }\n\n.icon-arrow-left2:before {\n content: \"\"; }\n\n.icon-arrow-right2:before {\n content: \"\"; }\n\n.icon-arrow-up2:before {\n content: \"\"; }\n\n.icon-arrow-down2:before {\n content: \"\"; }\n\n.icon-volume:before {\n content: \"\"; }\n\n.icon-mute:before {\n content: \"\"; }\n\n.icon-content-right:before {\n content: \"\"; }\n\n.icon-content-left:before {\n content: \"\"; }\n\n.icon-grid:before {\n content: \"\"; }\n\n.icon-grid-2:before {\n content: \"\"; }\n\n.icon-columns:before {\n content: \"\"; }\n\n.icon-loader:before {\n content: \"\"; }\n\n.icon-bag:before {\n content: \"\"; }\n\n.icon-ban:before {\n content: \"\"; }\n\n.icon-flag2:before {\n content: \"\"; }\n\n.icon-trash2:before {\n content: \"\"; }\n\n.icon-expand:before {\n content: \"\"; }\n\n.icon-contract:before {\n content: \"\"; }\n\n.icon-maximize:before {\n content: \"\"; }\n\n.icon-minimize:before {\n content: \"\"; }\n\n.icon-plus:before {\n content: \"\"; }\n\n.icon-minus:before {\n content: \"\"; }\n\n.icon-check:before {\n content: \"\"; }\n\n.icon-cross:before {\n content: \"\"; }\n\n.icon-move:before {\n content: \"\"; }\n\n.icon-delete2:before {\n content: \"\"; }\n\n.icon-menu:before {\n content: \"\"; }\n\n.icon-archive:before {\n content: \"\"; }\n\n.icon-inbox:before {\n content: \"\"; }\n\n.icon-outbox:before {\n content: \"\"; }\n\n.icon-file:before {\n content: \"\"; }\n\n.icon-file-add:before {\n content: \"\"; }\n\n.icon-file-subtract:before {\n content: \"\"; }\n\n.icon-help:before {\n content: \"\"; }\n\n.icon-open:before {\n content: \"\"; }\n\n.icon-ellipsis:before {\n content: \"\"; }\n\n.icon-box2:before {\n content: \"\"; }\n\n.icon-write:before {\n content: \"\"; }\n\n.icon-clock2:before {\n content: \"\"; }\n\n.icon-reply2:before {\n content: \"\"; }\n\n.icon-reply-all:before {\n content: \"\"; }\n\n.icon-forward:before {\n content: \"\"; }\n\n.icon-flag3:before {\n content: \"\"; }\n\n.icon-search2:before {\n content: \"\"; }\n\n.icon-trash3:before {\n content: \"\"; }\n\n.icon-envelope:before {\n content: \"\"; }\n\n.icon-bubble:before {\n content: \"\"; }\n\n.icon-bubbles:before {\n content: \"\"; }\n\n.icon-user:before {\n content: \"\"; }\n\n.icon-users:before {\n content: \"\"; }\n\n.icon-cloud2:before {\n content: \"\"; }\n\n.icon-download2:before {\n content: \"\"; }\n\n.icon-upload2:before {\n content: \"\"; }\n\n.icon-rain:before {\n content: \"\"; }\n\n.icon-sun2:before {\n content: \"\"; }\n\n.icon-moon2:before {\n content: \"\"; }\n\n.icon-bell3:before {\n content: \"\"; }\n\n.icon-folder3:before {\n content: \"\"; }\n\n.icon-pin2:before {\n content: \"\"; }\n\n.icon-sound:before {\n content: \"\"; }\n\n.icon-microphone2:before {\n content: \"\"; }\n\n.icon-camera2:before {\n content: \"\"; }\n\n.icon-image2:before {\n content: \"\"; }\n\n.icon-cog2:before {\n content: \"\"; }\n\n.icon-calendar:before {\n content: \"\"; }\n\n.icon-book2:before {\n content: \"\"; }\n\n.icon-map-marker:before {\n content: \"\"; }\n\n.icon-store:before {\n content: \"\"; }\n\n.icon-support:before {\n content: \"\"; }\n\n.icon-tag3:before {\n content: \"\"; }\n\n.icon-heart2:before {\n content: \"\"; }\n\n.icon-video-camera:before {\n content: \"\"; }\n\n.icon-trophy:before {\n content: \"\"; }\n\n.icon-cart:before {\n content: \"\"; }\n\n.icon-eye3:before {\n content: \"\"; }\n\n.icon-cancel:before {\n content: \"\"; }\n\n.icon-chart:before {\n content: \"\"; }\n\n.icon-target2:before {\n content: \"\"; }\n\n.icon-printer2:before {\n content: \"\"; }\n\n.icon-location3:before {\n content: \"\"; }\n\n.icon-bookmark2:before {\n content: \"\"; }\n\n.icon-monitor2:before {\n content: \"\"; }\n\n.icon-cross2:before {\n content: \"\"; }\n\n.icon-plus2:before {\n content: \"\"; }\n\n.icon-left:before {\n content: \"\"; }\n\n.icon-up:before {\n content: \"\"; }\n\n.icon-browser:before {\n content: \"\"; }\n\n.icon-windows:before {\n content: \"\"; }\n\n.icon-switch:before {\n content: \"\"; }\n\n.icon-dashboard:before {\n content: \"\"; }\n\n.icon-play2:before {\n content: \"\"; }\n\n.icon-fast-forward2:before {\n content: \"\"; }\n\n.icon-next:before {\n content: \"\"; }\n\n.icon-refresh2:before {\n content: \"\"; }\n\n.icon-film:before {\n content: \"\"; }\n\n.icon-home2:before {\n content: \"\"; }\n\nhtml {\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"; }\n\n*, *:before, *:after {\n box-sizing: inherit; }\n\n[v-cloak], .is-hidden {\n display: none; }\n\nbody {\n background-color: #cfd8dc; }\n\nmain {\n background-color: #FFF; }\n\na {\n color: #3949ab;\n text-decoration: none; }\n a:hover {\n color: #303f9f;\n text-decoration: underline; }\n\n.has-stickynav {\n padding-top: 50px; }\n\n.container {\n position: relative; }\n @media screen and (min-width: 980px) {\n .container {\n margin: 0 auto;\n max-width: 960px; }\n .container.is-fluid {\n margin: 0;\n max-width: none; } }\n @media screen and (min-width: 1180px) {\n .container {\n max-width: 1200px; } }\n\n.content {\n padding: 20px; }\n\n.is-hidden {\n display: none !important; }\n\n@media screen and (max-width: 768px) {\n .is-hidden-mobile {\n display: none !important; } }\n\n@media screen and (min-width: 769px) {\n .is-hidden-tablet {\n display: none !important; } }\n\n@media screen and (min-width: 769px) and (max-width: 979px) {\n .is-hidden-tablet-only {\n display: none !important; } }\n\n@media screen and (max-width: 979px) {\n .is-hidden-touch {\n display: none !important; } }\n\n@media screen and (min-width: 980px) {\n .is-hidden-desktop {\n display: none !important; } }\n\n@media screen and (min-width: 980px) and (max-width: 1179px) {\n .is-hidden-desktop-only {\n display: none !important; } }\n\n@media screen and (min-width: 1180px) {\n .is-hidden-widescreen {\n display: none !important; } }\n\n/*!\r\n * animate.css -http://daneden.me/animate\r\n * Version - 3.5.1\r\n * Licensed under the MIT license - http://opensource.org/licenses/MIT\r\n *\r\n * Copyright (c) 2016 Daniel Eden\r\n */\n.animated {\n -webkit-animation-duration: 1s;\n animation-duration: 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both; }\n .animated.infinite {\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite; }\n .animated.hinge {\n -webkit-animation-duration: 2s;\n animation-duration: 2s; }\n .animated.flipOutX, .animated.flipOutY, .animated.bounceIn, .animated.bounceOut {\n -webkit-animation-duration: .75s;\n animation-duration: .75s; }\n\n@-webkit-keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n@keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n.bounce {\n -webkit-animation-name: bounce;\n animation-name: bounce;\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom; }\n\n@-webkit-keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n@keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n.flash {\n -webkit-animation-name: flash;\n animation-name: flash; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.pulse {\n -webkit-animation-name: pulse;\n animation-name: pulse; }\n\n@-webkit-keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.rubberBand {\n -webkit-animation-name: rubberBand;\n animation-name: rubberBand; }\n\n@-webkit-keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n@keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n.shake {\n -webkit-animation-name: shake;\n animation-name: shake; }\n\n@-webkit-keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n@keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n.headShake {\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n -webkit-animation-name: headShake;\n animation-name: headShake; }\n\n@-webkit-keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n@keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n.swing {\n -webkit-transform-origin: top center;\n transform-origin: top center;\n -webkit-animation-name: swing;\n animation-name: swing; }\n\n@-webkit-keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.tada {\n -webkit-animation-name: tada;\n animation-name: tada; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.wobble {\n -webkit-animation-name: wobble;\n animation-name: wobble; }\n\n@-webkit-keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n@keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n.jello {\n -webkit-animation-name: jello;\n animation-name: jello;\n -webkit-transform-origin: center;\n transform-origin: center; }\n\n@-webkit-keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.bounceIn {\n -webkit-animation-name: bounceIn;\n animation-name: bounceIn; }\n\n@-webkit-keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInDown {\n -webkit-animation-name: bounceInDown;\n animation-name: bounceInDown; }\n\n@-webkit-keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInLeft {\n -webkit-animation-name: bounceInLeft;\n animation-name: bounceInLeft; }\n\n@-webkit-keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInRight {\n -webkit-animation-name: bounceInRight;\n animation-name: bounceInRight; }\n\n@-webkit-keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.bounceInUp {\n -webkit-animation-name: bounceInUp;\n animation-name: bounceInUp; }\n\n@-webkit-keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n@keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n.bounceOut {\n -webkit-animation-name: bounceOut;\n animation-name: bounceOut; }\n\n@-webkit-keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.bounceOutDown {\n -webkit-animation-name: bounceOutDown;\n animation-name: bounceOutDown; }\n\n@-webkit-keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.bounceOutLeft {\n -webkit-animation-name: bounceOutLeft;\n animation-name: bounceOutLeft; }\n\n@-webkit-keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.bounceOutRight {\n -webkit-animation-name: bounceOutRight;\n animation-name: bounceOutRight; }\n\n@-webkit-keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.bounceOutUp {\n -webkit-animation-name: bounceOutUp;\n animation-name: bounceOutUp; }\n\n@-webkit-keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n@keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n.fadeIn {\n -webkit-animation-name: fadeIn;\n animation-name: fadeIn; }\n\n@-webkit-keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDown {\n -webkit-animation-name: fadeInDown;\n animation-name: fadeInDown; }\n\n@-webkit-keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDownBig {\n -webkit-animation-name: fadeInDownBig;\n animation-name: fadeInDownBig; }\n\n@-webkit-keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeft {\n -webkit-animation-name: fadeInLeft;\n animation-name: fadeInLeft; }\n\n@-webkit-keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeftBig {\n -webkit-animation-name: fadeInLeftBig;\n animation-name: fadeInLeftBig; }\n\n@-webkit-keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRight {\n -webkit-animation-name: fadeInRight;\n animation-name: fadeInRight; }\n\n@-webkit-keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRightBig {\n -webkit-animation-name: fadeInRightBig;\n animation-name: fadeInRightBig; }\n\n@-webkit-keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUp {\n -webkit-animation-name: fadeInUp;\n animation-name: fadeInUp; }\n\n@-webkit-keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUpBig {\n -webkit-animation-name: fadeInUpBig;\n animation-name: fadeInUpBig; }\n\n@-webkit-keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n@keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n.fadeOut {\n -webkit-animation-name: fadeOut;\n animation-name: fadeOut; }\n\n@-webkit-keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.fadeOutDown {\n -webkit-animation-name: fadeOutDown;\n animation-name: fadeOutDown; }\n\n@-webkit-keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.fadeOutDownBig {\n -webkit-animation-name: fadeOutDownBig;\n animation-name: fadeOutDownBig; }\n\n@-webkit-keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.fadeOutLeft {\n -webkit-animation-name: fadeOutLeft;\n animation-name: fadeOutLeft; }\n\n@-webkit-keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.fadeOutLeftBig {\n -webkit-animation-name: fadeOutLeftBig;\n animation-name: fadeOutLeftBig; }\n\n@-webkit-keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.fadeOutRight {\n -webkit-animation-name: fadeOutRight;\n animation-name: fadeOutRight; }\n\n@-webkit-keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.fadeOutRightBig {\n -webkit-animation-name: fadeOutRightBig;\n animation-name: fadeOutRightBig; }\n\n@-webkit-keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.fadeOutUp {\n -webkit-animation-name: fadeOutUp;\n animation-name: fadeOutUp; }\n\n@-webkit-keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.fadeOutUpBig {\n -webkit-animation-name: fadeOutUpBig;\n animation-name: fadeOutUpBig; }\n\n@-webkit-keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n@keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n.animated.flip {\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-animation-name: flip;\n animation-name: flip; }\n\n@-webkit-keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInX {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInX;\n animation-name: flipInX; }\n\n@-webkit-keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInY;\n animation-name: flipInY; }\n\n@-webkit-keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n.flipOutX {\n -webkit-animation-name: flipOutX;\n animation-name: flipOutX;\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important; }\n\n@-webkit-keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n.flipOutY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipOutY;\n animation-name: flipOutY; }\n\n@-webkit-keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.lightSpeedIn {\n -webkit-animation-name: lightSpeedIn;\n animation-name: lightSpeedIn;\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n\n@-webkit-keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n@keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n.lightSpeedOut {\n -webkit-animation-name: lightSpeedOut;\n animation-name: lightSpeedOut;\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n\n@-webkit-keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateIn {\n -webkit-animation-name: rotateIn;\n animation-name: rotateIn; }\n\n@-webkit-keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownLeft {\n -webkit-animation-name: rotateInDownLeft;\n animation-name: rotateInDownLeft; }\n\n@-webkit-keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownRight {\n -webkit-animation-name: rotateInDownRight;\n animation-name: rotateInDownRight; }\n\n@-webkit-keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpLeft {\n -webkit-animation-name: rotateInUpLeft;\n animation-name: rotateInUpLeft; }\n\n@-webkit-keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpRight {\n -webkit-animation-name: rotateInUpRight;\n animation-name: rotateInUpRight; }\n\n@-webkit-keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n@keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n.rotateOut {\n -webkit-animation-name: rotateOut;\n animation-name: rotateOut; }\n\n@-webkit-keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n.rotateOutDownLeft {\n -webkit-animation-name: rotateOutDownLeft;\n animation-name: rotateOutDownLeft; }\n\n@-webkit-keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutDownRight {\n -webkit-animation-name: rotateOutDownRight;\n animation-name: rotateOutDownRight; }\n\n@-webkit-keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutUpLeft {\n -webkit-animation-name: rotateOutUpLeft;\n animation-name: rotateOutUpLeft; }\n\n@-webkit-keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n.rotateOutUpRight {\n -webkit-animation-name: rotateOutUpRight;\n animation-name: rotateOutUpRight; }\n\n@-webkit-keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n@keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n.hinge {\n -webkit-animation-name: hinge;\n animation-name: hinge; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.rollIn {\n -webkit-animation-name: rollIn;\n animation-name: rollIn; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n@keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n.rollOut {\n -webkit-animation-name: rollOut;\n animation-name: rollOut; }\n\n@-webkit-keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n@keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n.zoomIn {\n -webkit-animation-name: zoomIn;\n animation-name: zoomIn; }\n\n@-webkit-keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInDown {\n -webkit-animation-name: zoomInDown;\n animation-name: zoomInDown; }\n\n@-webkit-keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInLeft {\n -webkit-animation-name: zoomInLeft;\n animation-name: zoomInLeft; }\n\n@-webkit-keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInRight {\n -webkit-animation-name: zoomInRight;\n animation-name: zoomInRight; }\n\n@-webkit-keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInUp {\n -webkit-animation-name: zoomInUp;\n animation-name: zoomInUp; }\n\n@-webkit-keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n@keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n.zoomOut {\n -webkit-animation-name: zoomOut;\n animation-name: zoomOut; }\n\n@-webkit-keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutDown {\n -webkit-animation-name: zoomOutDown;\n animation-name: zoomOutDown; }\n\n@-webkit-keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n@keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n.zoomOutLeft {\n -webkit-animation-name: zoomOutLeft;\n animation-name: zoomOutLeft; }\n\n@-webkit-keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n@keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n.zoomOutRight {\n -webkit-animation-name: zoomOutRight;\n animation-name: zoomOutRight; }\n\n@-webkit-keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutUp {\n -webkit-animation-name: zoomOutUp;\n animation-name: zoomOutUp; }\n\n@-webkit-keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInDown {\n -webkit-animation-name: slideInDown;\n animation-name: slideInDown; }\n\n@-webkit-keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInLeft {\n -webkit-animation-name: slideInLeft;\n animation-name: slideInLeft; }\n\n@-webkit-keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInRight {\n -webkit-animation-name: slideInRight;\n animation-name: slideInRight; }\n\n@-webkit-keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInUp {\n -webkit-animation-name: slideInUp;\n animation-name: slideInUp; }\n\n@-webkit-keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.slideOutDown {\n -webkit-animation-name: slideOutDown;\n animation-name: slideOutDown; }\n\n@-webkit-keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.slideOutLeft {\n -webkit-animation-name: slideOutLeft;\n animation-name: slideOutLeft; }\n\n@-webkit-keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.slideOutRight {\n -webkit-animation-name: slideOutRight;\n animation-name: slideOutRight; }\n\n@-webkit-keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.slideOutUp {\n -webkit-animation-name: slideOutUp;\n animation-name: slideOutUp; }\n\n.button {\n background-color: #fb8c00;\n color: #FFF;\n border: 1px solid #f57c00;\n border-radius: 3px;\n display: inline-flex;\n height: 30px;\n align-items: center;\n padding: 0 15px;\n font-size: 13px;\n font-weight: 600;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n margin: 0;\n transition: all .4s ease;\n cursor: pointer;\n text-decoration: none;\n text-transform: uppercase; }\n .button span {\n font-weight: 600;\n display: inline-flex;\n align-items: center;\n line-height: 14px;\n height: 14px; }\n .button i {\n margin-right: 8px;\n font-size: 14px;\n line-height: 14px;\n height: 14px; }\n .button:focus {\n outline: none;\n border-color: #FFF; }\n .button:hover {\n background-color: #ef6c00;\n text-decoration: none; }\n .button.is-red {\n background-color: #e53935;\n border-color: #d32f2f;\n color: #FFF; }\n .button.is-red.is-outlined {\n background-color: #FFF;\n color: #d32f2f; }\n .button.is-red.is-inverted {\n background-color: rgba(198, 40, 40, 0);\n border-color: #f44336; }\n .button.is-red:hover {\n background-color: #c62828;\n color: #FFF;\n animation: none; }\n .button.is-pink {\n background-color: #d81b60;\n border-color: #c2185b;\n color: #FFF; }\n .button.is-pink.is-outlined {\n background-color: #FFF;\n color: #c2185b; }\n .button.is-pink.is-inverted {\n background-color: rgba(173, 20, 87, 0);\n border-color: #e91e63; }\n .button.is-pink:hover {\n background-color: #ad1457;\n color: #FFF;\n animation: none; }\n .button.is-purple {\n background-color: #8e24aa;\n border-color: #7b1fa2;\n color: #FFF; }\n .button.is-purple.is-outlined {\n background-color: #FFF;\n color: #7b1fa2; }\n .button.is-purple.is-inverted {\n background-color: rgba(106, 27, 154, 0);\n border-color: #9c27b0; }\n .button.is-purple:hover {\n background-color: #6a1b9a;\n color: #FFF;\n animation: none; }\n .button.is-deep-purple {\n background-color: #5e35b1;\n border-color: #512da8;\n color: #FFF; }\n .button.is-deep-purple.is-outlined {\n background-color: #FFF;\n color: #512da8; }\n .button.is-deep-purple.is-inverted {\n background-color: rgba(69, 39, 160, 0);\n border-color: #673ab7; }\n .button.is-deep-purple:hover {\n background-color: #4527a0;\n color: #FFF;\n animation: none; }\n .button.is-indigo {\n background-color: #3949ab;\n border-color: #303f9f;\n color: #FFF; }\n .button.is-indigo.is-outlined {\n background-color: #FFF;\n color: #303f9f; }\n .button.is-indigo.is-inverted {\n background-color: rgba(40, 53, 147, 0);\n border-color: #3f51b5; }\n .button.is-indigo:hover {\n background-color: #283593;\n color: #FFF;\n animation: none; }\n .button.is-blue {\n background-color: #1e88e5;\n border-color: #1976d2;\n color: #FFF; }\n .button.is-blue.is-outlined {\n background-color: #FFF;\n color: #1976d2; }\n .button.is-blue.is-inverted {\n background-color: rgba(21, 101, 192, 0);\n border-color: #2196f3; }\n .button.is-blue:hover {\n background-color: #1565c0;\n color: #FFF;\n animation: none; }\n .button.is-light-blue {\n background-color: #039be5;\n border-color: #0288d1;\n color: #FFF; }\n .button.is-light-blue.is-outlined {\n background-color: #FFF;\n color: #0288d1; }\n .button.is-light-blue.is-inverted {\n background-color: rgba(2, 119, 189, 0);\n border-color: #03a9f4; }\n .button.is-light-blue:hover {\n background-color: #0277bd;\n color: #FFF;\n animation: none; }\n .button.is-cyan {\n background-color: #00acc1;\n border-color: #0097a7;\n color: #FFF; }\n .button.is-cyan.is-outlined {\n background-color: #FFF;\n color: #0097a7; }\n .button.is-cyan.is-inverted {\n background-color: rgba(0, 131, 143, 0);\n border-color: #00bcd4; }\n .button.is-cyan:hover {\n background-color: #00838f;\n color: #FFF;\n animation: none; }\n .button.is-teal {\n background-color: #00897b;\n border-color: #00796b;\n color: #FFF; }\n .button.is-teal.is-outlined {\n background-color: #FFF;\n color: #00796b; }\n .button.is-teal.is-inverted {\n background-color: rgba(0, 105, 92, 0);\n border-color: #009688; }\n .button.is-teal:hover {\n background-color: #00695c;\n color: #FFF;\n animation: none; }\n .button.is-green {\n background-color: #43a047;\n border-color: #388e3c;\n color: #FFF; }\n .button.is-green.is-outlined {\n background-color: #FFF;\n color: #388e3c; }\n .button.is-green.is-inverted {\n background-color: rgba(46, 125, 50, 0);\n border-color: #4caf50; }\n .button.is-green:hover {\n background-color: #2e7d32;\n color: #FFF;\n animation: none; }\n .button.is-light-green {\n background-color: #7cb342;\n border-color: #689f38;\n color: #FFF; }\n .button.is-light-green.is-outlined {\n background-color: #FFF;\n color: #689f38; }\n .button.is-light-green.is-inverted {\n background-color: rgba(85, 139, 47, 0);\n border-color: #8bc34a; }\n .button.is-light-green:hover {\n background-color: #558b2f;\n color: #FFF;\n animation: none; }\n .button.is-lime {\n background-color: #c0ca33;\n border-color: #afb42b;\n color: #FFF; }\n .button.is-lime.is-outlined {\n background-color: #FFF;\n color: #afb42b; }\n .button.is-lime.is-inverted {\n background-color: rgba(158, 157, 36, 0);\n border-color: #cddc39; }\n .button.is-lime:hover {\n background-color: #9e9d24;\n color: #FFF;\n animation: none; }\n .button.is-yellow {\n background-color: #fdd835;\n border-color: #fbc02d;\n color: #FFF; }\n .button.is-yellow.is-outlined {\n background-color: #FFF;\n color: #fbc02d; }\n .button.is-yellow.is-inverted {\n background-color: rgba(249, 168, 37, 0);\n border-color: #ffeb3b; }\n .button.is-yellow:hover {\n background-color: #f9a825;\n color: #FFF;\n animation: none; }\n .button.is-amber {\n background-color: #ffb300;\n border-color: #ffa000;\n color: #FFF; }\n .button.is-amber.is-outlined {\n background-color: #FFF;\n color: #ffa000; }\n .button.is-amber.is-inverted {\n background-color: rgba(255, 143, 0, 0);\n border-color: #ffc107; }\n .button.is-amber:hover {\n background-color: #ff8f00;\n color: #FFF;\n animation: none; }\n .button.is-orange {\n background-color: #fb8c00;\n border-color: #f57c00;\n color: #FFF; }\n .button.is-orange.is-outlined {\n background-color: #FFF;\n color: #f57c00; }\n .button.is-orange.is-inverted {\n background-color: rgba(239, 108, 0, 0);\n border-color: #ff9800; }\n .button.is-orange:hover {\n background-color: #ef6c00;\n color: #FFF;\n animation: none; }\n .button.is-deep-orange {\n background-color: #f4511e;\n border-color: #e64a19;\n color: #FFF; }\n .button.is-deep-orange.is-outlined {\n background-color: #FFF;\n color: #e64a19; }\n .button.is-deep-orange.is-inverted {\n background-color: rgba(216, 67, 21, 0);\n border-color: #ff5722; }\n .button.is-deep-orange:hover {\n background-color: #d84315;\n color: #FFF;\n animation: none; }\n .button.is-brown {\n background-color: #6d4c41;\n border-color: #5d4037;\n color: #FFF; }\n .button.is-brown.is-outlined {\n background-color: #FFF;\n color: #5d4037; }\n .button.is-brown.is-inverted {\n background-color: rgba(78, 52, 46, 0);\n border-color: #795548; }\n .button.is-brown:hover {\n background-color: #4e342e;\n color: #FFF;\n animation: none; }\n .button.is-grey {\n background-color: #757575;\n border-color: #616161;\n color: #FFF; }\n .button.is-grey.is-outlined {\n background-color: #FFF;\n color: #616161; }\n .button.is-grey.is-inverted {\n background-color: rgba(66, 66, 66, 0);\n border-color: #9e9e9e; }\n .button.is-grey:hover {\n background-color: #424242;\n color: #FFF;\n animation: none; }\n .button.is-blue-grey {\n background-color: #546e7a;\n border-color: #455a64;\n color: #FFF; }\n .button.is-blue-grey.is-outlined {\n background-color: #FFF;\n color: #455a64; }\n .button.is-blue-grey.is-inverted {\n background-color: rgba(55, 71, 79, 0);\n border-color: #607d8b; }\n .button.is-blue-grey:hover {\n background-color: #37474f;\n color: #FFF;\n animation: none; }\n .button.is-icon-only i {\n margin-right: 0; }\n .button.is-featured {\n animation: btnInvertedPulse .6s ease alternate infinite; }\n .button.is-disabled, .button:disabled {\n background-color: #e0e0e0;\n border: 1px solid #bdbdbd;\n color: #9e9e9e;\n cursor: default;\n transition: none; }\n .button.is-disabled:hover, .button:disabled:hover {\n background-color: #e0e0e0 !important;\n color: #9e9e9e !important; }\n\n.button-group .button {\n border-radius: 0;\n margin-left: 1px; }\n .button-group .button:first-child {\n margin-left: 0;\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .button-group .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n\n@-webkit-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@-moz-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@-o-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n.footer {\n background-color: #eceff1;\n border-bottom: 5px solid #cfd8dc;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 25px;\n font-size: 13px;\n font-weight: 500;\n color: #607d8b; }\n .footer ul {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n justify-content: center;\n align-items: center; }\n .footer ul li {\n padding: 0 15px; }\n\n.control + .control {\n margin-top: 15px; }\n\n.control input[type=text], .control input[type=password] {\n background-color: #FFF;\n display: flex;\n height: 30px;\n align-items: center;\n padding: 0 12px;\n border: 1px solid #bdbdbd;\n border-radius: 3px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 14px;\n color: #616161;\n transition: all .4s ease;\n box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, 0.1); }\n .control input[type=text]:focus, .control input[type=password]:focus {\n outline: none;\n border-color: #03a9f4;\n box-shadow: inset 0 0 5px 0 rgba(3, 169, 244, 0.3); }\n .control input[type=text]:disabled, .control input[type=password]:disabled {\n background-color: #f5f5f5; }\n .control input[type=text].is-dirty.is-invalid, .control input[type=password].is-dirty.is-invalid {\n border-color: #f44336;\n box-shadow: inset 0 0 5px 0 #ffcdd2; }\n\n.control.is-fullwidth input[type=text], .control.is-fullwidth input[type=password], .control.is-fullwidth select, .control.is-fullwidth textarea {\n width: 100%; }\n\n.control select {\n background-color: #FFF;\n display: flex;\n height: 30px;\n align-items: center;\n padding: 0 12px;\n border: 1px solid #bdbdbd;\n border-radius: 3px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 14px;\n color: #616161;\n transition: all .4s ease;\n box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, 0.1);\n cursor: pointer; }\n .control select:focus {\n outline: none;\n border-color: #03a9f4;\n box-shadow: inset 0 0 5px 0 rgba(3, 169, 244, 0.3); }\n .control select:disabled {\n background-color: #f5f5f5; }\n\n.control input[type=radio], .control input[type=checkbox] {\n position: absolute;\n left: -9999px;\n opacity: 0; }\n .control input[type=radio] + label, .control input[type=checkbox] + label {\n position: relative;\n padding: 0 15px 0 25px;\n cursor: pointer;\n display: inline-block;\n height: 25px;\n line-height: 25px;\n font-size: 14px;\n transition: .28s ease;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none; }\n .control input[type=radio] + label:before, .control input[type=radio] + label:after, .control input[type=checkbox] + label:before, .control input[type=checkbox] + label:after {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n margin: 4px;\n border: 2px solid #3949ab;\n margin: 4px;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n z-index: 0;\n transition: .28s ease; }\n .control input[type=radio]:checked + label:before, .control input[type=radio]:checked + label:after, .control input[type=checkbox]:checked + label:before, .control input[type=checkbox]:checked + label:after {\n border-color: #3949ab; }\n .control input[type=radio]:checked + label:after, .control input[type=checkbox]:checked + label:after {\n -webkit-transform: scale(0.5);\n -moz-transform: scale(0.5);\n -ms-transform: scale(0.5);\n -o-transform: scale(0.5);\n transform: scale(0.5);\n background-color: #3949ab; }\n\n.control input[type=checkbox] + label:before, .control input[type=checkbox] + label:after {\n border-radius: 0; }\n\n.control .help {\n font-size: 12px; }\n .control .help.is-red {\n color: #e53935; }\n\n.control + label {\n margin-top: 20px; }\n\n.control > i:first-child {\n margin-right: 8px; }\n\n.label {\n margin-bottom: 5px;\n font-size: 14px;\n font-weight: 500;\n display: block; }\n\n.form-sections section {\n border-top: 1px solid #eeeeee;\n padding: 20px;\n -webkit-animation-duration: 0.6s;\n -moz-animation-duration: 0.6s;\n -ms-animation-duration: 0.6s;\n -o-animation-duration: 0.6s;\n animation-duration: 0.6s; }\n .form-sections section:first-child {\n border-top: none; }\n .form-sections section .button + .button {\n margin-left: 10px; }\n .form-sections section .desc {\n display: inline-block;\n padding: 10px 0 0 0px;\n font-size: 12px;\n color: #9e9e9e; }\n .form-sections section .section-block {\n padding-left: 20px;\n font-size: 14px;\n color: #37474f; }\n .form-sections section .section-block h6 {\n font-size: 14px;\n font-weight: 500;\n color: #546e7a;\n margin-top: 15px;\n border-bottom: 1px dotted #b0bec5; }\n .form-sections section .section-block p {\n padding: 5px 0; }\n .form-sections section .section-block p.is-small {\n font-size: 13px; }\n\n.column {\n flex-basis: 0;\n flex-grow: 1;\n flex-shrink: 1;\n padding: 10px; }\n .columns.is-mobile > .column.is-narrow {\n flex: none; }\n .columns.is-mobile > .column.is-full {\n flex: none;\n width: 100%; }\n .columns.is-mobile > .column.is-three-quarters {\n flex: none;\n width: 75%; }\n .columns.is-mobile > .column.is-two-thirds {\n flex: none;\n width: 66.6666%; }\n .columns.is-mobile > .column.is-half {\n flex: none;\n width: 50%; }\n .columns.is-mobile > .column.is-one-third {\n flex: none;\n width: 33.3333%; }\n .columns.is-mobile > .column.is-one-quarter {\n flex: none;\n width: 25%; }\n .columns.is-mobile > .column.is-offset-three-quarters {\n margin-left: 75%; }\n .columns.is-mobile > .column.is-offset-two-thirds {\n margin-left: 66.6666%; }\n .columns.is-mobile > .column.is-offset-half {\n margin-left: 50%; }\n .columns.is-mobile > .column.is-offset-one-third {\n margin-left: 33.3333%; }\n .columns.is-mobile > .column.is-offset-one-quarter {\n margin-left: 25%; }\n .columns.is-mobile > .column.is-1 {\n flex: none;\n width: 8.33333%; }\n .columns.is-mobile > .column.is-offset-1 {\n margin-left: 8.33333%; }\n .columns.is-mobile > .column.is-2 {\n flex: none;\n width: 16.66667%; }\n .columns.is-mobile > .column.is-offset-2 {\n margin-left: 16.66667%; }\n .columns.is-mobile > .column.is-3 {\n flex: none;\n width: 25%; }\n .columns.is-mobile > .column.is-offset-3 {\n margin-left: 25%; }\n .columns.is-mobile > .column.is-4 {\n flex: none;\n width: 33.33333%; }\n .columns.is-mobile > .column.is-offset-4 {\n margin-left: 33.33333%; }\n .columns.is-mobile > .column.is-5 {\n flex: none;\n width: 41.66667%; }\n .columns.is-mobile > .column.is-offset-5 {\n margin-left: 41.66667%; }\n .columns.is-mobile > .column.is-6 {\n flex: none;\n width: 50%; }\n .columns.is-mobile > .column.is-offset-6 {\n margin-left: 50%; }\n .columns.is-mobile > .column.is-7 {\n flex: none;\n width: 58.33333%; }\n .columns.is-mobile > .column.is-offset-7 {\n margin-left: 58.33333%; }\n .columns.is-mobile > .column.is-8 {\n flex: none;\n width: 66.66667%; }\n .columns.is-mobile > .column.is-offset-8 {\n margin-left: 66.66667%; }\n .columns.is-mobile > .column.is-9 {\n flex: none;\n width: 75%; }\n .columns.is-mobile > .column.is-offset-9 {\n margin-left: 75%; }\n .columns.is-mobile > .column.is-10 {\n flex: none;\n width: 83.33333%; }\n .columns.is-mobile > .column.is-offset-10 {\n margin-left: 83.33333%; }\n .columns.is-mobile > .column.is-11 {\n flex: none;\n width: 91.66667%; }\n .columns.is-mobile > .column.is-offset-11 {\n margin-left: 91.66667%; }\n .columns.is-mobile > .column.is-12 {\n flex: none;\n width: 100%; }\n .columns.is-mobile > .column.is-offset-12 {\n margin-left: 100%; }\n @media screen and (max-width: 768px) {\n .column.is-narrow-mobile {\n flex: none; }\n .column.is-full-mobile {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-mobile {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-mobile {\n flex: none;\n width: 66.6666%; }\n .column.is-half-mobile {\n flex: none;\n width: 50%; }\n .column.is-one-third-mobile {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-mobile {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-mobile {\n margin-left: 75%; }\n .column.is-offset-two-thirds-mobile {\n margin-left: 66.6666%; }\n .column.is-offset-half-mobile {\n margin-left: 50%; }\n .column.is-offset-one-third-mobile {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-mobile {\n margin-left: 25%; }\n .column.is-1-mobile {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-mobile {\n margin-left: 8.33333%; }\n .column.is-2-mobile {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-mobile {\n margin-left: 16.66667%; }\n .column.is-3-mobile {\n flex: none;\n width: 25%; }\n .column.is-offset-3-mobile {\n margin-left: 25%; }\n .column.is-4-mobile {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-mobile {\n margin-left: 33.33333%; }\n .column.is-5-mobile {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-mobile {\n margin-left: 41.66667%; }\n .column.is-6-mobile {\n flex: none;\n width: 50%; }\n .column.is-offset-6-mobile {\n margin-left: 50%; }\n .column.is-7-mobile {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-mobile {\n margin-left: 58.33333%; }\n .column.is-8-mobile {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-mobile {\n margin-left: 66.66667%; }\n .column.is-9-mobile {\n flex: none;\n width: 75%; }\n .column.is-offset-9-mobile {\n margin-left: 75%; }\n .column.is-10-mobile {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-mobile {\n margin-left: 83.33333%; }\n .column.is-11-mobile {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-mobile {\n margin-left: 91.66667%; }\n .column.is-12-mobile {\n flex: none;\n width: 100%; }\n .column.is-offset-12-mobile {\n margin-left: 100%; } }\n @media screen and (min-width: 769px) {\n .column.is-narrow, .column.is-narrow-tablet {\n flex: none; }\n .column.is-full, .column.is-full-tablet {\n flex: none;\n width: 100%; }\n .column.is-three-quarters, .column.is-three-quarters-tablet {\n flex: none;\n width: 75%; }\n .column.is-two-thirds, .column.is-two-thirds-tablet {\n flex: none;\n width: 66.6666%; }\n .column.is-half, .column.is-half-tablet {\n flex: none;\n width: 50%; }\n .column.is-one-third, .column.is-one-third-tablet {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter, .column.is-one-quarter-tablet {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters, .column.is-offset-three-quarters-tablet {\n margin-left: 75%; }\n .column.is-offset-two-thirds, .column.is-offset-two-thirds-tablet {\n margin-left: 66.6666%; }\n .column.is-offset-half, .column.is-offset-half-tablet {\n margin-left: 50%; }\n .column.is-offset-one-third, .column.is-offset-one-third-tablet {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter, .column.is-offset-one-quarter-tablet {\n margin-left: 25%; }\n .column.is-1, .column.is-1-tablet {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1, .column.is-offset-1-tablet {\n margin-left: 8.33333%; }\n .column.is-2, .column.is-2-tablet {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2, .column.is-offset-2-tablet {\n margin-left: 16.66667%; }\n .column.is-3, .column.is-3-tablet {\n flex: none;\n width: 25%; }\n .column.is-offset-3, .column.is-offset-3-tablet {\n margin-left: 25%; }\n .column.is-4, .column.is-4-tablet {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4, .column.is-offset-4-tablet {\n margin-left: 33.33333%; }\n .column.is-5, .column.is-5-tablet {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5, .column.is-offset-5-tablet {\n margin-left: 41.66667%; }\n .column.is-6, .column.is-6-tablet {\n flex: none;\n width: 50%; }\n .column.is-offset-6, .column.is-offset-6-tablet {\n margin-left: 50%; }\n .column.is-7, .column.is-7-tablet {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7, .column.is-offset-7-tablet {\n margin-left: 58.33333%; }\n .column.is-8, .column.is-8-tablet {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8, .column.is-offset-8-tablet {\n margin-left: 66.66667%; }\n .column.is-9, .column.is-9-tablet {\n flex: none;\n width: 75%; }\n .column.is-offset-9, .column.is-offset-9-tablet {\n margin-left: 75%; }\n .column.is-10, .column.is-10-tablet {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10, .column.is-offset-10-tablet {\n margin-left: 83.33333%; }\n .column.is-11, .column.is-11-tablet {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11, .column.is-offset-11-tablet {\n margin-left: 91.66667%; }\n .column.is-12, .column.is-12-tablet {\n flex: none;\n width: 100%; }\n .column.is-offset-12, .column.is-offset-12-tablet {\n margin-left: 100%; } }\n @media screen and (min-width: 980px) {\n .column.is-narrow-desktop {\n flex: none; }\n .column.is-full-desktop {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-desktop {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-desktop {\n flex: none;\n width: 66.6666%; }\n .column.is-half-desktop {\n flex: none;\n width: 50%; }\n .column.is-one-third-desktop {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-desktop {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-desktop {\n margin-left: 75%; }\n .column.is-offset-two-thirds-desktop {\n margin-left: 66.6666%; }\n .column.is-offset-half-desktop {\n margin-left: 50%; }\n .column.is-offset-one-third-desktop {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-desktop {\n margin-left: 25%; }\n .column.is-1-desktop {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-desktop {\n margin-left: 8.33333%; }\n .column.is-2-desktop {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-desktop {\n margin-left: 16.66667%; }\n .column.is-3-desktop {\n flex: none;\n width: 25%; }\n .column.is-offset-3-desktop {\n margin-left: 25%; }\n .column.is-4-desktop {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-desktop {\n margin-left: 33.33333%; }\n .column.is-5-desktop {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-desktop {\n margin-left: 41.66667%; }\n .column.is-6-desktop {\n flex: none;\n width: 50%; }\n .column.is-offset-6-desktop {\n margin-left: 50%; }\n .column.is-7-desktop {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-desktop {\n margin-left: 58.33333%; }\n .column.is-8-desktop {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-desktop {\n margin-left: 66.66667%; }\n .column.is-9-desktop {\n flex: none;\n width: 75%; }\n .column.is-offset-9-desktop {\n margin-left: 75%; }\n .column.is-10-desktop {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-desktop {\n margin-left: 83.33333%; }\n .column.is-11-desktop {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-desktop {\n margin-left: 91.66667%; }\n .column.is-12-desktop {\n flex: none;\n width: 100%; }\n .column.is-offset-12-desktop {\n margin-left: 100%; } }\n @media screen and (min-width: 1180px) {\n .column.is-narrow-widescreen {\n flex: none; }\n .column.is-full-widescreen {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-widescreen {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-widescreen {\n flex: none;\n width: 66.6666%; }\n .column.is-half-widescreen {\n flex: none;\n width: 50%; }\n .column.is-one-third-widescreen {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-widescreen {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-widescreen {\n margin-left: 75%; }\n .column.is-offset-two-thirds-widescreen {\n margin-left: 66.6666%; }\n .column.is-offset-half-widescreen {\n margin-left: 50%; }\n .column.is-offset-one-third-widescreen {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-widescreen {\n margin-left: 25%; }\n .column.is-1-widescreen {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-widescreen {\n margin-left: 8.33333%; }\n .column.is-2-widescreen {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-widescreen {\n margin-left: 16.66667%; }\n .column.is-3-widescreen {\n flex: none;\n width: 25%; }\n .column.is-offset-3-widescreen {\n margin-left: 25%; }\n .column.is-4-widescreen {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-widescreen {\n margin-left: 33.33333%; }\n .column.is-5-widescreen {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-widescreen {\n margin-left: 41.66667%; }\n .column.is-6-widescreen {\n flex: none;\n width: 50%; }\n .column.is-offset-6-widescreen {\n margin-left: 50%; }\n .column.is-7-widescreen {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-widescreen {\n margin-left: 58.33333%; }\n .column.is-8-widescreen {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-widescreen {\n margin-left: 66.66667%; }\n .column.is-9-widescreen {\n flex: none;\n width: 75%; }\n .column.is-offset-9-widescreen {\n margin-left: 75%; }\n .column.is-10-widescreen {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-widescreen {\n margin-left: 83.33333%; }\n .column.is-11-widescreen {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-widescreen {\n margin-left: 91.66667%; }\n .column.is-12-widescreen {\n flex: none;\n width: 100%; }\n .column.is-offset-12-widescreen {\n margin-left: 100%; } }\n\n.columns {\n margin-left: -10px;\n margin-right: -10px;\n margin-top: -10px; }\n .columns:last-child {\n margin-bottom: -10px; }\n .columns:not(:last-child) {\n margin-bottom: 10px; }\n .columns.is-centered {\n justify-content: center; }\n .columns.is-gapless {\n margin-left: 0;\n margin-right: 0;\n margin-top: 0; }\n .columns.is-gapless:last-child {\n margin-bottom: 0; }\n .columns.is-gapless:not(:last-child) {\n margin-bottom: 20px; }\n .columns.is-gapless > .column {\n margin: 0;\n padding: 0; }\n .columns.is-stretched {\n flex-grow: 1;\n align-items: stretch;\n align-self: stretch; }\n @media screen and (min-width: 769px) {\n .columns.is-grid {\n flex-wrap: wrap; }\n .columns.is-grid > .column {\n max-width: 33.3333%;\n padding: 10px;\n width: 33.3333%; }\n .columns.is-grid > .column + .column {\n margin-left: 0; } }\n .columns.is-mobile {\n display: flex; }\n .columns.is-multiline {\n flex-wrap: wrap; }\n .columns.is-vcentered {\n align-items: center; }\n @media screen and (min-width: 769px) {\n .columns:not(.is-desktop) {\n display: flex; } }\n @media screen and (min-width: 980px) {\n .columns.is-desktop {\n display: flex; } }\n\n.tile {\n align-items: stretch;\n flex-basis: auto;\n flex-grow: 1;\n flex-shrink: 1;\n min-height: min-content; }\n .tile.is-ancestor {\n margin-left: -10px;\n margin-right: -10px;\n margin-top: -10px; }\n .tile.is-ancestor:last-child {\n margin-bottom: -10px; }\n .tile.is-ancestor:not(:last-child) {\n margin-bottom: 10px; }\n .tile.is-child {\n margin: 0 !important; }\n .tile.is-parent {\n padding: 10px; }\n .tile.is-vertical {\n flex-direction: column; }\n .tile.is-vertical > .tile.is-child:not(:last-child) {\n margin-bottom: 20px !important; }\n @media screen and (min-width: 769px) {\n .tile:not(.is-child) {\n display: flex; }\n .tile.is-1 {\n flex: none;\n width: 8.33333%; }\n .tile.is-2 {\n flex: none;\n width: 16.66667%; }\n .tile.is-3 {\n flex: none;\n width: 25%; }\n .tile.is-4 {\n flex: none;\n width: 33.33333%; }\n .tile.is-5 {\n flex: none;\n width: 41.66667%; }\n .tile.is-6 {\n flex: none;\n width: 50%; }\n .tile.is-7 {\n flex: none;\n width: 58.33333%; }\n .tile.is-8 {\n flex: none;\n width: 66.66667%; }\n .tile.is-9 {\n flex: none;\n width: 75%; }\n .tile.is-10 {\n flex: none;\n width: 83.33333%; }\n .tile.is-11 {\n flex: none;\n width: 91.66667%; }\n .tile.is-12 {\n flex: none;\n width: 100%; } }\n\n.column.is-white {\n background-color: #FFF; }\n\n.modal {\n align-items: flex-start;\n display: none; }\n .modal.is-active {\n display: block; }\n .modal.is-superimposed .modal-background {\n z-index: 20; }\n .modal.is-superimposed .modal-container {\n z-index: 21; }\n\n.modal-background {\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n position: fixed;\n background-color: rgba(0, 0, 0, 0.85);\n animation: .4s ease fadeIn;\n z-index: 10; }\n\n.modal-container {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 11;\n display: flex;\n justify-content: center;\n align-items: center; }\n\n.modal-content {\n animation: .3s ease zoomIn;\n width: 600px;\n background-color: #FFF; }\n .modal-content.is-expanded {\n align-self: stretch;\n width: 100%;\n margin: 20px;\n display: flex;\n flex-direction: column; }\n .modal-content.is-expanded > section {\n flex-grow: 1; }\n .modal-content header {\n background-color: #00897b;\n color: #FFF;\n display: flex;\n flex-shrink: 0;\n height: 40px;\n align-items: center;\n font-weight: 400;\n font-size: 16px;\n padding: 0 20px;\n position: relative; }\n .modal-content header.is-red {\n background-color: #e53935; }\n .modal-content header.is-pink {\n background-color: #d81b60; }\n .modal-content header.is-purple {\n background-color: #8e24aa; }\n .modal-content header.is-deep-purple {\n background-color: #5e35b1; }\n .modal-content header.is-indigo {\n background-color: #3949ab; }\n .modal-content header.is-blue {\n background-color: #1e88e5; }\n .modal-content header.is-light-blue {\n background-color: #039be5; }\n .modal-content header.is-cyan {\n background-color: #00acc1; }\n .modal-content header.is-teal {\n background-color: #00897b; }\n .modal-content header.is-green {\n background-color: #43a047; }\n .modal-content header.is-light-green {\n background-color: #7cb342; }\n .modal-content header.is-lime {\n background-color: #c0ca33; }\n .modal-content header.is-yellow {\n background-color: #fdd835; }\n .modal-content header.is-amber {\n background-color: #ffb300; }\n .modal-content header.is-orange {\n background-color: #fb8c00; }\n .modal-content header.is-deep-orange {\n background-color: #f4511e; }\n .modal-content header.is-brown {\n background-color: #6d4c41; }\n .modal-content header.is-grey {\n background-color: #757575; }\n .modal-content header.is-blue-grey {\n background-color: #546e7a; }\n .modal-content header .modal-notify {\n position: absolute;\n display: none;\n align-items: center;\n height: 40px;\n right: 20px;\n top: 0; }\n .modal-content header .modal-notify.is-active {\n display: flex; }\n .modal-content header .modal-notify span {\n font-size: 12px;\n letter-spacing: 1px;\n text-transform: uppercase; }\n .modal-content header .modal-notify i {\n margin-left: 15px;\n display: inline-block;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #FFF;\n -webkit-animation: spin 0.5s linear infinite;\n -moz-animation: spin 0.5s linear infinite;\n -ms-animation: spin 0.5s linear infinite;\n -o-animation: spin 0.5s linear infinite;\n animation: spin 0.5s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .modal-content section {\n padding: 20px;\n border-top: 1px dotted #e0e0e0; }\n .modal-content section:first-of-type {\n border-top: none;\n padding-top: 20px; }\n .modal-content section:last-of-type {\n padding-bottom: 20px; }\n .modal-content section.is-gapless {\n padding: 10px;\n display: flex; }\n .modal-content section.modal-loading {\n display: flex;\n flex-direction: column;\n align-items: center; }\n .modal-content section.modal-loading > i {\n display: block;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #2196f3;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite;\n margin-bottom: 10px; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .modal-content section.modal-loading > span {\n color: #757575; }\n .modal-content section.modal-loading > em {\n font-size: 12px;\n color: #9e9e9e;\n font-style: normal; }\n .modal-content section.modal-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #424242; }\n .modal-content section.modal-instructions img {\n height: 100px; }\n .modal-content section.modal-instructions img + * {\n margin-top: 10px; }\n .modal-content section.modal-instructions i.is-huge {\n font-size: 72px;\n margin-bottom: 10px; }\n .modal-content section.modal-instructions > span {\n color: #424242; }\n .modal-content section.modal-instructions > em {\n font-size: 12px;\n color: #757575;\n font-style: normal;\n margin-top: 10px;\n display: block; }\n .modal-content section .bullets {\n list-style-type: square;\n padding: 5px 0 0 30px;\n font-size: 14px;\n color: #424242; }\n .modal-content section .note {\n display: block;\n margin-top: 10px;\n font-size: 14px;\n color: #424242; }\n .modal-content section .note:first-child {\n margin-top: 0; }\n .modal-content section .note ul {\n color: #424242;\n padding-left: 10px; }\n .modal-content section .note ul li {\n margin-top: 5px;\n display: flex;\n align-items: center; }\n .modal-content section .note ul li > i {\n margin-right: 8px;\n font-size: 18px; }\n .modal-content footer {\n padding: 20px;\n text-align: right; }\n .modal-content footer .button {\n margin-left: 10px; }\n\n.modal-toolbar {\n background-color: #00796b;\n padding: 7px 20px;\n display: flex;\n flex-shrink: 0;\n justify-content: center; }\n .modal-toolbar.is-red {\n background-color: #d32f2f; }\n .modal-toolbar.is-red .button {\n border-color: #b71c1c;\n background-color: #b71c1c; }\n .modal-toolbar.is-red .button:hover {\n border-color: #b71c1c;\n background-color: #c62828; }\n .modal-toolbar.is-pink {\n background-color: #c2185b; }\n .modal-toolbar.is-pink .button {\n border-color: #880e4f;\n background-color: #880e4f; }\n .modal-toolbar.is-pink .button:hover {\n border-color: #880e4f;\n background-color: #ad1457; }\n .modal-toolbar.is-purple {\n background-color: #7b1fa2; }\n .modal-toolbar.is-purple .button {\n border-color: #4a148c;\n background-color: #4a148c; }\n .modal-toolbar.is-purple .button:hover {\n border-color: #4a148c;\n background-color: #6a1b9a; }\n .modal-toolbar.is-deep-purple {\n background-color: #512da8; }\n .modal-toolbar.is-deep-purple .button {\n border-color: #311b92;\n background-color: #311b92; }\n .modal-toolbar.is-deep-purple .button:hover {\n border-color: #311b92;\n background-color: #4527a0; }\n .modal-toolbar.is-indigo {\n background-color: #303f9f; }\n .modal-toolbar.is-indigo .button {\n border-color: #1a237e;\n background-color: #1a237e; }\n .modal-toolbar.is-indigo .button:hover {\n border-color: #1a237e;\n background-color: #283593; }\n .modal-toolbar.is-blue {\n background-color: #1976d2; }\n .modal-toolbar.is-blue .button {\n border-color: #0d47a1;\n background-color: #0d47a1; }\n .modal-toolbar.is-blue .button:hover {\n border-color: #0d47a1;\n background-color: #1565c0; }\n .modal-toolbar.is-light-blue {\n background-color: #0288d1; }\n .modal-toolbar.is-light-blue .button {\n border-color: #01579b;\n background-color: #01579b; }\n .modal-toolbar.is-light-blue .button:hover {\n border-color: #01579b;\n background-color: #0277bd; }\n .modal-toolbar.is-cyan {\n background-color: #0097a7; }\n .modal-toolbar.is-cyan .button {\n border-color: #006064;\n background-color: #006064; }\n .modal-toolbar.is-cyan .button:hover {\n border-color: #006064;\n background-color: #00838f; }\n .modal-toolbar.is-teal {\n background-color: #00796b; }\n .modal-toolbar.is-teal .button {\n border-color: #004d40;\n background-color: #004d40; }\n .modal-toolbar.is-teal .button:hover {\n border-color: #004d40;\n background-color: #00695c; }\n .modal-toolbar.is-green {\n background-color: #388e3c; }\n .modal-toolbar.is-green .button {\n border-color: #1b5e20;\n background-color: #1b5e20; }\n .modal-toolbar.is-green .button:hover {\n border-color: #1b5e20;\n background-color: #2e7d32; }\n .modal-toolbar.is-light-green {\n background-color: #689f38; }\n .modal-toolbar.is-light-green .button {\n border-color: #33691e;\n background-color: #33691e; }\n .modal-toolbar.is-light-green .button:hover {\n border-color: #33691e;\n background-color: #558b2f; }\n .modal-toolbar.is-lime {\n background-color: #afb42b; }\n .modal-toolbar.is-lime .button {\n border-color: #827717;\n background-color: #827717; }\n .modal-toolbar.is-lime .button:hover {\n border-color: #827717;\n background-color: #9e9d24; }\n .modal-toolbar.is-yellow {\n background-color: #fbc02d; }\n .modal-toolbar.is-yellow .button {\n border-color: #f57f17;\n background-color: #f57f17; }\n .modal-toolbar.is-yellow .button:hover {\n border-color: #f57f17;\n background-color: #f9a825; }\n .modal-toolbar.is-amber {\n background-color: #ffa000; }\n .modal-toolbar.is-amber .button {\n border-color: #ff6f00;\n background-color: #ff6f00; }\n .modal-toolbar.is-amber .button:hover {\n border-color: #ff6f00;\n background-color: #ff8f00; }\n .modal-toolbar.is-orange {\n background-color: #f57c00; }\n .modal-toolbar.is-orange .button {\n border-color: #e65100;\n background-color: #e65100; }\n .modal-toolbar.is-orange .button:hover {\n border-color: #e65100;\n background-color: #ef6c00; }\n .modal-toolbar.is-deep-orange {\n background-color: #e64a19; }\n .modal-toolbar.is-deep-orange .button {\n border-color: #bf360c;\n background-color: #bf360c; }\n .modal-toolbar.is-deep-orange .button:hover {\n border-color: #bf360c;\n background-color: #d84315; }\n .modal-toolbar.is-brown {\n background-color: #5d4037; }\n .modal-toolbar.is-brown .button {\n border-color: #3e2723;\n background-color: #3e2723; }\n .modal-toolbar.is-brown .button:hover {\n border-color: #3e2723;\n background-color: #4e342e; }\n .modal-toolbar.is-grey {\n background-color: #616161; }\n .modal-toolbar.is-grey .button {\n border-color: #212121;\n background-color: #212121; }\n .modal-toolbar.is-grey .button:hover {\n border-color: #212121;\n background-color: #424242; }\n .modal-toolbar.is-blue-grey {\n background-color: #455a64; }\n .modal-toolbar.is-blue-grey .button {\n border-color: #263238;\n background-color: #263238; }\n .modal-toolbar.is-blue-grey .button:hover {\n border-color: #263238;\n background-color: #37474f; }\n .modal-toolbar .button {\n border: 1px solid #004d40;\n background-color: #004d40;\n transition: all .4s ease;\n color: #FFF;\n border-radius: 0; }\n .modal-toolbar .button:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .modal-toolbar .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .modal-toolbar .button:hover {\n border-color: #004d40;\n background-color: #00695c;\n color: #FFF; }\n .modal-toolbar .button + .button {\n margin-left: 1px; }\n\n.modal-sidebar {\n background-color: #e0f2f1;\n padding: 0; }\n .modal-sidebar.is-red {\n background-color: #ffebee; }\n .modal-sidebar.is-red .model-sidebar-header {\n background-color: #ffcdd2;\n color: #c62828; }\n .modal-sidebar.is-red .model-sidebar-list > li a:hover {\n background-color: #ef9a9a; }\n .modal-sidebar.is-red .model-sidebar-list > li a.is-active {\n background-color: #f44336; }\n .modal-sidebar.is-pink {\n background-color: #fce4ec; }\n .modal-sidebar.is-pink .model-sidebar-header {\n background-color: #f8bbd0;\n color: #ad1457; }\n .modal-sidebar.is-pink .model-sidebar-list > li a:hover {\n background-color: #f48fb1; }\n .modal-sidebar.is-pink .model-sidebar-list > li a.is-active {\n background-color: #e91e63; }\n .modal-sidebar.is-purple {\n background-color: #f3e5f5; }\n .modal-sidebar.is-purple .model-sidebar-header {\n background-color: #e1bee7;\n color: #6a1b9a; }\n .modal-sidebar.is-purple .model-sidebar-list > li a:hover {\n background-color: #ce93d8; }\n .modal-sidebar.is-purple .model-sidebar-list > li a.is-active {\n background-color: #9c27b0; }\n .modal-sidebar.is-deep-purple {\n background-color: #ede7f6; }\n .modal-sidebar.is-deep-purple .model-sidebar-header {\n background-color: #d1c4e9;\n color: #4527a0; }\n .modal-sidebar.is-deep-purple .model-sidebar-list > li a:hover {\n background-color: #b39ddb; }\n .modal-sidebar.is-deep-purple .model-sidebar-list > li a.is-active {\n background-color: #673ab7; }\n .modal-sidebar.is-indigo {\n background-color: #e8eaf6; }\n .modal-sidebar.is-indigo .model-sidebar-header {\n background-color: #c5cae9;\n color: #283593; }\n .modal-sidebar.is-indigo .model-sidebar-list > li a:hover {\n background-color: #9fa8da; }\n .modal-sidebar.is-indigo .model-sidebar-list > li a.is-active {\n background-color: #3f51b5; }\n .modal-sidebar.is-blue {\n background-color: #e3f2fd; }\n .modal-sidebar.is-blue .model-sidebar-header {\n background-color: #bbdefb;\n color: #1565c0; }\n .modal-sidebar.is-blue .model-sidebar-list > li a:hover {\n background-color: #90caf9; }\n .modal-sidebar.is-blue .model-sidebar-list > li a.is-active {\n background-color: #2196f3; }\n .modal-sidebar.is-light-blue {\n background-color: #e1f5fe; }\n .modal-sidebar.is-light-blue .model-sidebar-header {\n background-color: #b3e5fc;\n color: #0277bd; }\n .modal-sidebar.is-light-blue .model-sidebar-list > li a:hover {\n background-color: #81d4fa; }\n .modal-sidebar.is-light-blue .model-sidebar-list > li a.is-active {\n background-color: #03a9f4; }\n .modal-sidebar.is-cyan {\n background-color: #e0f7fa; }\n .modal-sidebar.is-cyan .model-sidebar-header {\n background-color: #b2ebf2;\n color: #00838f; }\n .modal-sidebar.is-cyan .model-sidebar-list > li a:hover {\n background-color: #80deea; }\n .modal-sidebar.is-cyan .model-sidebar-list > li a.is-active {\n background-color: #00bcd4; }\n .modal-sidebar.is-teal {\n background-color: #e0f2f1; }\n .modal-sidebar.is-teal .model-sidebar-header {\n background-color: #b2dfdb;\n color: #00695c; }\n .modal-sidebar.is-teal .model-sidebar-list > li a:hover {\n background-color: #80cbc4; }\n .modal-sidebar.is-teal .model-sidebar-list > li a.is-active {\n background-color: #009688; }\n .modal-sidebar.is-green {\n background-color: #e8f5e9; }\n .modal-sidebar.is-green .model-sidebar-header {\n background-color: #c8e6c9;\n color: #2e7d32; }\n .modal-sidebar.is-green .model-sidebar-list > li a:hover {\n background-color: #a5d6a7; }\n .modal-sidebar.is-green .model-sidebar-list > li a.is-active {\n background-color: #4caf50; }\n .modal-sidebar.is-light-green {\n background-color: #f1f8e9; }\n .modal-sidebar.is-light-green .model-sidebar-header {\n background-color: #dcedc8;\n color: #558b2f; }\n .modal-sidebar.is-light-green .model-sidebar-list > li a:hover {\n background-color: #c5e1a5; }\n .modal-sidebar.is-light-green .model-sidebar-list > li a.is-active {\n background-color: #8bc34a; }\n .modal-sidebar.is-lime {\n background-color: #f9fbe7; }\n .modal-sidebar.is-lime .model-sidebar-header {\n background-color: #f0f4c3;\n color: #9e9d24; }\n .modal-sidebar.is-lime .model-sidebar-list > li a:hover {\n background-color: #e6ee9c; }\n .modal-sidebar.is-lime .model-sidebar-list > li a.is-active {\n background-color: #cddc39; }\n .modal-sidebar.is-yellow {\n background-color: #fffde7; }\n .modal-sidebar.is-yellow .model-sidebar-header {\n background-color: #fff9c4;\n color: #f9a825; }\n .modal-sidebar.is-yellow .model-sidebar-list > li a:hover {\n background-color: #fff59d; }\n .modal-sidebar.is-yellow .model-sidebar-list > li a.is-active {\n background-color: #ffeb3b; }\n .modal-sidebar.is-amber {\n background-color: #fff8e1; }\n .modal-sidebar.is-amber .model-sidebar-header {\n background-color: #ffecb3;\n color: #ff8f00; }\n .modal-sidebar.is-amber .model-sidebar-list > li a:hover {\n background-color: #ffe082; }\n .modal-sidebar.is-amber .model-sidebar-list > li a.is-active {\n background-color: #ffc107; }\n .modal-sidebar.is-orange {\n background-color: #fff3e0; }\n .modal-sidebar.is-orange .model-sidebar-header {\n background-color: #ffe0b2;\n color: #ef6c00; }\n .modal-sidebar.is-orange .model-sidebar-list > li a:hover {\n background-color: #ffcc80; }\n .modal-sidebar.is-orange .model-sidebar-list > li a.is-active {\n background-color: #ff9800; }\n .modal-sidebar.is-deep-orange {\n background-color: #fbe9e7; }\n .modal-sidebar.is-deep-orange .model-sidebar-header {\n background-color: #ffccbc;\n color: #d84315; }\n .modal-sidebar.is-deep-orange .model-sidebar-list > li a:hover {\n background-color: #ffab91; }\n .modal-sidebar.is-deep-orange .model-sidebar-list > li a.is-active {\n background-color: #ff5722; }\n .modal-sidebar.is-brown {\n background-color: #efebe9; }\n .modal-sidebar.is-brown .model-sidebar-header {\n background-color: #d7ccc8;\n color: #4e342e; }\n .modal-sidebar.is-brown .model-sidebar-list > li a:hover {\n background-color: #bcaaa4; }\n .modal-sidebar.is-brown .model-sidebar-list > li a.is-active {\n background-color: #795548; }\n .modal-sidebar.is-grey {\n background-color: #fafafa; }\n .modal-sidebar.is-grey .model-sidebar-header {\n background-color: #f5f5f5;\n color: #424242; }\n .modal-sidebar.is-grey .model-sidebar-list > li a:hover {\n background-color: #eeeeee; }\n .modal-sidebar.is-grey .model-sidebar-list > li a.is-active {\n background-color: #9e9e9e; }\n .modal-sidebar.is-blue-grey {\n background-color: #eceff1; }\n .modal-sidebar.is-blue-grey .model-sidebar-header {\n background-color: #cfd8dc;\n color: #37474f; }\n .modal-sidebar.is-blue-grey .model-sidebar-list > li a:hover {\n background-color: #b0bec5; }\n .modal-sidebar.is-blue-grey .model-sidebar-list > li a.is-active {\n background-color: #607d8b; }\n .modal-sidebar .model-sidebar-header {\n padding: 7px 20px; }\n .modal-sidebar .model-sidebar-content {\n padding: 7px 20px; }\n .modal-sidebar .model-sidebar-list > li {\n padding: 0; }\n .modal-sidebar .model-sidebar-list > li a {\n display: flex;\n align-items: center;\n height: 34px;\n padding: 0 20px;\n cursor: pointer;\n color: #424242; }\n .modal-sidebar .model-sidebar-list > li a:hover {\n background-color: #80cbc4; }\n .modal-sidebar .model-sidebar-list > li a.is-active {\n color: #FFF; }\n .modal-sidebar .model-sidebar-list > li a i {\n margin-right: 7px; }\n\n.modal-content .card-footer-item.featured {\n animation: flash 4s ease 0 infinite; }\n\n.nav {\n align-items: stretch;\n background-color: #3f51b5;\n display: flex;\n min-height: 50px;\n position: relative;\n text-align: center;\n box-shadow: 0 2px 3px rgba(63, 81, 181, 0.2);\n z-index: 2;\n color: #FFF; }\n .nav.is-red {\n background-color: #f44336;\n box-shadow: 0 2px 3px rgba(244, 67, 54, 0.2); }\n .nav.is-red .nav-item .button {\n border: 1px solid #b71c1c;\n background-color: #c62828; }\n .nav.is-red .nav-item .button.is-outlined {\n background-color: #e53935;\n border-color: #c62828;\n color: #ffcdd2; }\n .nav.is-red .nav-item .button:hover {\n border-color: #b71c1c;\n background-color: #b71c1c; }\n .nav.is-pink {\n background-color: #e91e63;\n box-shadow: 0 2px 3px rgba(233, 30, 99, 0.2); }\n .nav.is-pink .nav-item .button {\n border: 1px solid #880e4f;\n background-color: #ad1457; }\n .nav.is-pink .nav-item .button.is-outlined {\n background-color: #d81b60;\n border-color: #ad1457;\n color: #f8bbd0; }\n .nav.is-pink .nav-item .button:hover {\n border-color: #880e4f;\n background-color: #880e4f; }\n .nav.is-purple {\n background-color: #9c27b0;\n box-shadow: 0 2px 3px rgba(156, 39, 176, 0.2); }\n .nav.is-purple .nav-item .button {\n border: 1px solid #4a148c;\n background-color: #6a1b9a; }\n .nav.is-purple .nav-item .button.is-outlined {\n background-color: #8e24aa;\n border-color: #6a1b9a;\n color: #e1bee7; }\n .nav.is-purple .nav-item .button:hover {\n border-color: #4a148c;\n background-color: #4a148c; }\n .nav.is-deep-purple {\n background-color: #673ab7;\n box-shadow: 0 2px 3px rgba(103, 58, 183, 0.2); }\n .nav.is-deep-purple .nav-item .button {\n border: 1px solid #311b92;\n background-color: #4527a0; }\n .nav.is-deep-purple .nav-item .button.is-outlined {\n background-color: #5e35b1;\n border-color: #4527a0;\n color: #d1c4e9; }\n .nav.is-deep-purple .nav-item .button:hover {\n border-color: #311b92;\n background-color: #311b92; }\n .nav.is-indigo {\n background-color: #3f51b5;\n box-shadow: 0 2px 3px rgba(63, 81, 181, 0.2); }\n .nav.is-indigo .nav-item .button {\n border: 1px solid #1a237e;\n background-color: #283593; }\n .nav.is-indigo .nav-item .button.is-outlined {\n background-color: #3949ab;\n border-color: #283593;\n color: #c5cae9; }\n .nav.is-indigo .nav-item .button:hover {\n border-color: #1a237e;\n background-color: #1a237e; }\n .nav.is-blue {\n background-color: #2196f3;\n box-shadow: 0 2px 3px rgba(33, 150, 243, 0.2); }\n .nav.is-blue .nav-item .button {\n border: 1px solid #0d47a1;\n background-color: #1565c0; }\n .nav.is-blue .nav-item .button.is-outlined {\n background-color: #1e88e5;\n border-color: #1565c0;\n color: #bbdefb; }\n .nav.is-blue .nav-item .button:hover {\n border-color: #0d47a1;\n background-color: #0d47a1; }\n .nav.is-light-blue {\n background-color: #03a9f4;\n box-shadow: 0 2px 3px rgba(3, 169, 244, 0.2); }\n .nav.is-light-blue .nav-item .button {\n border: 1px solid #01579b;\n background-color: #0277bd; }\n .nav.is-light-blue .nav-item .button.is-outlined {\n background-color: #039be5;\n border-color: #0277bd;\n color: #b3e5fc; }\n .nav.is-light-blue .nav-item .button:hover {\n border-color: #01579b;\n background-color: #01579b; }\n .nav.is-cyan {\n background-color: #00bcd4;\n box-shadow: 0 2px 3px rgba(0, 188, 212, 0.2); }\n .nav.is-cyan .nav-item .button {\n border: 1px solid #006064;\n background-color: #00838f; }\n .nav.is-cyan .nav-item .button.is-outlined {\n background-color: #00acc1;\n border-color: #00838f;\n color: #b2ebf2; }\n .nav.is-cyan .nav-item .button:hover {\n border-color: #006064;\n background-color: #006064; }\n .nav.is-teal {\n background-color: #009688;\n box-shadow: 0 2px 3px rgba(0, 150, 136, 0.2); }\n .nav.is-teal .nav-item .button {\n border: 1px solid #004d40;\n background-color: #00695c; }\n .nav.is-teal .nav-item .button.is-outlined {\n background-color: #00897b;\n border-color: #00695c;\n color: #b2dfdb; }\n .nav.is-teal .nav-item .button:hover {\n border-color: #004d40;\n background-color: #004d40; }\n .nav.is-green {\n background-color: #4caf50;\n box-shadow: 0 2px 3px rgba(76, 175, 80, 0.2); }\n .nav.is-green .nav-item .button {\n border: 1px solid #1b5e20;\n background-color: #2e7d32; }\n .nav.is-green .nav-item .button.is-outlined {\n background-color: #43a047;\n border-color: #2e7d32;\n color: #c8e6c9; }\n .nav.is-green .nav-item .button:hover {\n border-color: #1b5e20;\n background-color: #1b5e20; }\n .nav.is-light-green {\n background-color: #8bc34a;\n box-shadow: 0 2px 3px rgba(139, 195, 74, 0.2); }\n .nav.is-light-green .nav-item .button {\n border: 1px solid #33691e;\n background-color: #558b2f; }\n .nav.is-light-green .nav-item .button.is-outlined {\n background-color: #7cb342;\n border-color: #558b2f;\n color: #dcedc8; }\n .nav.is-light-green .nav-item .button:hover {\n border-color: #33691e;\n background-color: #33691e; }\n .nav.is-lime {\n background-color: #cddc39;\n box-shadow: 0 2px 3px rgba(205, 220, 57, 0.2); }\n .nav.is-lime .nav-item .button {\n border: 1px solid #827717;\n background-color: #9e9d24; }\n .nav.is-lime .nav-item .button.is-outlined {\n background-color: #c0ca33;\n border-color: #9e9d24;\n color: #f0f4c3; }\n .nav.is-lime .nav-item .button:hover {\n border-color: #827717;\n background-color: #827717; }\n .nav.is-yellow {\n background-color: #ffeb3b;\n box-shadow: 0 2px 3px rgba(255, 235, 59, 0.2); }\n .nav.is-yellow .nav-item .button {\n border: 1px solid #f57f17;\n background-color: #f9a825; }\n .nav.is-yellow .nav-item .button.is-outlined {\n background-color: #fdd835;\n border-color: #f9a825;\n color: #fff9c4; }\n .nav.is-yellow .nav-item .button:hover {\n border-color: #f57f17;\n background-color: #f57f17; }\n .nav.is-amber {\n background-color: #ffc107;\n box-shadow: 0 2px 3px rgba(255, 193, 7, 0.2); }\n .nav.is-amber .nav-item .button {\n border: 1px solid #ff6f00;\n background-color: #ff8f00; }\n .nav.is-amber .nav-item .button.is-outlined {\n background-color: #ffb300;\n border-color: #ff8f00;\n color: #ffecb3; }\n .nav.is-amber .nav-item .button:hover {\n border-color: #ff6f00;\n background-color: #ff6f00; }\n .nav.is-orange {\n background-color: #ff9800;\n box-shadow: 0 2px 3px rgba(255, 152, 0, 0.2); }\n .nav.is-orange .nav-item .button {\n border: 1px solid #e65100;\n background-color: #ef6c00; }\n .nav.is-orange .nav-item .button.is-outlined {\n background-color: #fb8c00;\n border-color: #ef6c00;\n color: #ffe0b2; }\n .nav.is-orange .nav-item .button:hover {\n border-color: #e65100;\n background-color: #e65100; }\n .nav.is-deep-orange {\n background-color: #ff5722;\n box-shadow: 0 2px 3px rgba(255, 87, 34, 0.2); }\n .nav.is-deep-orange .nav-item .button {\n border: 1px solid #bf360c;\n background-color: #d84315; }\n .nav.is-deep-orange .nav-item .button.is-outlined {\n background-color: #f4511e;\n border-color: #d84315;\n color: #ffccbc; }\n .nav.is-deep-orange .nav-item .button:hover {\n border-color: #bf360c;\n background-color: #bf360c; }\n .nav.is-brown {\n background-color: #795548;\n box-shadow: 0 2px 3px rgba(121, 85, 72, 0.2); }\n .nav.is-brown .nav-item .button {\n border: 1px solid #3e2723;\n background-color: #4e342e; }\n .nav.is-brown .nav-item .button.is-outlined {\n background-color: #6d4c41;\n border-color: #4e342e;\n color: #d7ccc8; }\n .nav.is-brown .nav-item .button:hover {\n border-color: #3e2723;\n background-color: #3e2723; }\n .nav.is-grey {\n background-color: #9e9e9e;\n box-shadow: 0 2px 3px rgba(158, 158, 158, 0.2); }\n .nav.is-grey .nav-item .button {\n border: 1px solid #212121;\n background-color: #424242; }\n .nav.is-grey .nav-item .button.is-outlined {\n background-color: #757575;\n border-color: #424242;\n color: #f5f5f5; }\n .nav.is-grey .nav-item .button:hover {\n border-color: #212121;\n background-color: #212121; }\n .nav.is-blue-grey {\n background-color: #607d8b;\n box-shadow: 0 2px 3px rgba(96, 125, 139, 0.2); }\n .nav.is-blue-grey .nav-item .button {\n border: 1px solid #263238;\n background-color: #37474f; }\n .nav.is-blue-grey .nav-item .button.is-outlined {\n background-color: #546e7a;\n border-color: #37474f;\n color: #cfd8dc; }\n .nav.is-blue-grey .nav-item .button:hover {\n border-color: #263238;\n background-color: #263238; }\n\n.nav-left {\n align-items: stretch;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n justify-content: flex-start;\n overflow: hidden;\n overflow-x: auto;\n white-space: nowrap; }\n\n.nav-center {\n align-items: stretch;\n display: flex;\n justify-content: center;\n margin-left: auto;\n margin-right: auto; }\n\n@media screen and (min-width: 769px) {\n .nav-right {\n align-items: stretch;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n justify-content: flex-end; } }\n\n.nav-item {\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 0 10px; }\n .nav-item a, a.nav-item {\n color: #e8eaf6;\n transition: color .4s ease;\n cursor: pointer; }\n .nav-item a:hover, a.nav-item:hover {\n color: #9fa8da;\n text-decoration: none; }\n .nav-item img {\n max-height: 34px; }\n .nav-item h1 {\n font-size: 16px;\n font-weight: 400;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n transition: color .4s ease;\n color: #FFF;\n padding-left: 10px; }\n .nav-item h1 i {\n margin-right: 8px; }\n .nav-item h1:hover {\n color: #c5cae9; }\n h2.nav-item, .nav-item h2 {\n color: #e8eaf6; }\n .nav-item .button {\n border: 1px solid #1a237e;\n background-color: #283593;\n transition: all .4s ease;\n color: #FFF;\n border-radius: 0; }\n .nav-item .button:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .nav-item .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .nav-item .button.is-outlined {\n background-color: #3949ab;\n border-color: #283593;\n color: #c5cae9; }\n .nav-item .button:hover {\n border-color: #1a237e;\n background-color: #1a237e;\n color: #FFF; }\n .nav-item .button + .button {\n margin-left: 1px; }\n .nav-item .control input[type=text] {\n background-color: #283593;\n border-color: #5c6bc0;\n color: #e8eaf6; }\n .nav-item .control input[type=text]:focus {\n border-color: #9fa8da;\n box-shadow: inset 0 0 5px 0 rgba(26, 35, 126, 0.5); }\n .nav-item .control input[type=text]::-webkit-input-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]::-moz-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]:-ms-input-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]:placeholder-shown {\n color: #9fa8da; }\n\n.panel-aside {\n background-color: #37474f;\n border: 1px solid #37474f;\n border-bottom-left-radius: 8px;\n padding: 20px;\n color: #cfd8dc; }\n .panel-aside label {\n color: #FFF; }\n\n.panel {\n background-color: #FFF;\n box-shadow: 0 0 12px 0 rgba(66, 66, 66, 0.1), 1px 6px 8px 0 rgba(66, 66, 66, 0.1);\n padding: 0 0 1px 0;\n border-radius: 4px; }\n .panel .panel-title {\n border-bottom: 1px solid #e4e6f0;\n padding: 0 15px;\n color: mc(\"grey\", \"800\");\n font-size: 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 40px; }\n .panel .panel-title.is-featured {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n background-color: #7986cb;\n border-bottom-color: #5c6bc0;\n color: #FFF; }\n .panel .panel-title.is-featured > i::before {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #FFF;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .panel .panel-title > span {\n font-weight: 500; }\n .panel .panel-title > i {\n display: flex;\n width: 18px;\n align-items: center; }\n .panel .panel-title > i::before {\n content: \" \";\n width: 18px;\n height: 18px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #3f51b5;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .panel .panel-content {\n padding: 0 15px; }\n .panel .panel-content.is-text {\n padding: 25px; }\n .panel .panel-content.is-text p + p, .panel .panel-content.is-text p + h3 {\n margin-top: 25px; }\n .panel .panel-content.is-text h3 {\n margin-bottom: 15px;\n font-weight: 500; }\n .panel .panel-content.is-text ul li {\n color: #616161; }\n .panel .panel-content.is-text strong {\n font-weight: 500;\n color: #283593; }\n .panel .panel-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n height: 50px;\n background-color: #F4F5F9;\n padding: 0 15px;\n margin: 0 1px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n position: relative; }\n .panel .panel-footer .button + .button {\n margin-left: 10px; }\n .panel + .panel {\n margin-top: 25px; }\n\nh1 {\n font-size: 28px; }\n\nh2 {\n font-size: 18px; }\n\nh3 {\n font-size: 16px; }\n\ni.is-red {\n color: #e53935; }\n\ni.is-pink {\n color: #d81b60; }\n\ni.is-purple {\n color: #8e24aa; }\n\ni.is-deep-purple {\n color: #5e35b1; }\n\ni.is-indigo {\n color: #3949ab; }\n\ni.is-blue {\n color: #1e88e5; }\n\ni.is-light-blue {\n color: #039be5; }\n\ni.is-cyan {\n color: #00acc1; }\n\ni.is-teal {\n color: #00897b; }\n\ni.is-green {\n color: #43a047; }\n\ni.is-light-green {\n color: #7cb342; }\n\ni.is-lime {\n color: #c0ca33; }\n\ni.is-yellow {\n color: #fdd835; }\n\ni.is-amber {\n color: #ffb300; }\n\ni.is-orange {\n color: #fb8c00; }\n\ni.is-deep-orange {\n color: #f4511e; }\n\ni.is-brown {\n color: #6d4c41; }\n\ni.is-grey {\n color: #757575; }\n\ni.is-blue-grey {\n color: #546e7a; }\n\n.welcome {\n text-align: center;\n padding: 25px 0 0;\n color: #616161; }\n .welcome h1 {\n margin-top: 5px; }\n .welcome h2 {\n margin: 0; }\n\ni.icon-loader {\n display: inline-block;\n color: #3f51b5; }\n\ni.icon-check {\n color: #4caf50; }\n\ni.icon-square-cross {\n color: #f44336; }\n\ni.icon-warning-outline {\n color: #ff9800; }\n\n.tst-welcome-leave-active, .tst-welcome-enter-active {\n transition: all .5s;\n overflow-y: hidden; }\n\n.tst-welcome-leave, .tst-welcome-enter-to {\n opacity: 1;\n max-height: 200px; }\n\n.tst-welcome-leave-to, .tst-welcome-enter {\n opacity: 0;\n max-height: 0;\n padding-top: 0; }\n\n.progress-bar {\n width: 150px;\n height: 10px;\n background-color: #e8eaf6;\n border: 1px solid #c5cae9;\n border-radius: 3px;\n position: absolute;\n left: 15px;\n top: 21px;\n padding: 1px; }\n .progress-bar > div {\n width: 5px;\n height: 6px;\n background-color: #9fa8da;\n border-radius: 2px;\n transition: all 1s ease; }\n\n/*# sourceMappingURL=configure.scss.map */");
  51. });
  52. ___scope___.file("js/configure.js", function(exports, require, module, __filename, __dirname){
  53. 'use strict';
  54. var _jquery = require("jquery");
  55. var _jquery2 = _interopRequireDefault(_jquery);
  56. var _lodash = require("lodash");
  57. var _lodash2 = _interopRequireDefault(_lodash);
  58. var _vue = require("vue/dist/vue.js");
  59. var _vue2 = _interopRequireDefault(_vue);
  60. var _veeValidate = require("vee-validate");
  61. var _veeValidate2 = _interopRequireDefault(_veeValidate);
  62. var _axios = require("axios");
  63. var _axios2 = _interopRequireDefault(_axios);
  64. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  65. _vue2.default.use(_veeValidate2.default, {
  66. enableAutoClasses: true,
  67. classNames: {
  68. touched: 'is-touched', // the control has been blurred
  69. untouched: 'is-untouched', // the control hasn't been blurred
  70. valid: 'is-valid', // model is valid
  71. invalid: 'is-invalid', // model is invalid
  72. pristine: 'is-pristine', // control has not been interacted with
  73. dirty: 'is-dirty' // control has been interacted with
  74. }
  75. });
  76. (0, _jquery2.default)(document).ready(function ($) {
  77. new _vue2.default({ // eslint-disable-line no-new
  78. el: 'main',
  79. data: {
  80. loading: false,
  81. state: 'welcome',
  82. syscheck: {
  83. ok: false,
  84. error: '',
  85. results: []
  86. },
  87. dbcheck: {
  88. ok: false,
  89. error: ''
  90. },
  91. gitcheck: {
  92. ok: false,
  93. error: ''
  94. },
  95. final: {
  96. ok: false,
  97. error: '',
  98. results: []
  99. },
  100. conf: {
  101. title: 'Wiki',
  102. host: 'http://',
  103. port: 80,
  104. lang: 'en',
  105. db: 'mongodb://localhost:27017/wiki',
  106. pathData: './data',
  107. pathRepo: './repo',
  108. gitUseRemote: true,
  109. gitUrl: '',
  110. gitBranch: 'master',
  111. gitAuthType: 'ssh',
  112. gitAuthSSHKey: '',
  113. gitAuthUser: '',
  114. gitAuthPass: '',
  115. gitAuthSSL: true,
  116. gitSignatureName: '',
  117. gitSignatureEmail: '',
  118. adminEmail: '',
  119. adminPassword: '',
  120. adminPasswordConfirm: ''
  121. },
  122. considerations: {
  123. https: false,
  124. port: false,
  125. localhost: false
  126. }
  127. },
  128. computed: {
  129. currentProgress: function currentProgress() {
  130. var perc = '0%';
  131. switch (this.state) {
  132. case 'welcome':
  133. perc = '0%';
  134. break;
  135. case 'syscheck':
  136. perc = this.syscheck.ok ? '15%' : '5%';
  137. break;
  138. case 'general':
  139. perc = '20%';
  140. break;
  141. case 'considerations':
  142. perc = '30%';
  143. break;
  144. case 'db':
  145. perc = '35%';
  146. break;
  147. case 'dbcheck':
  148. perc = this.dbcheck.ok ? '50%' : '40%';
  149. break;
  150. case 'paths':
  151. perc = '55%';
  152. break;
  153. case 'git':
  154. perc = '60%';
  155. break;
  156. case 'gitcheck':
  157. perc = this.gitcheck.ok ? '75%' : '65%';
  158. break;
  159. case 'admin':
  160. perc = '80%';
  161. break;
  162. }
  163. return perc;
  164. }
  165. },
  166. methods: {
  167. proceedToWelcome: function proceedToWelcome(ev) {
  168. this.state = 'welcome';
  169. this.loading = false;
  170. },
  171. proceedToSyscheck: function proceedToSyscheck(ev) {
  172. var self = this;
  173. this.state = 'syscheck';
  174. this.loading = true;
  175. self.syscheck = {
  176. ok: false,
  177. error: '',
  178. results: []
  179. };
  180. _lodash2.default.delay(function () {
  181. _axios2.default.post('/syscheck').then(function (resp) {
  182. if (resp.data.ok === true) {
  183. self.syscheck.ok = true;
  184. self.syscheck.results = resp.data.results;
  185. } else {
  186. self.syscheck.ok = false;
  187. self.syscheck.error = resp.data.error;
  188. }
  189. self.loading = false;
  190. self.$nextTick();
  191. }).catch(function (err) {
  192. window.alert(err.message);
  193. });
  194. }, 1000);
  195. },
  196. proceedToGeneral: function proceedToGeneral(ev) {
  197. var self = this;
  198. self.state = 'general';
  199. self.loading = false;
  200. self.$nextTick(function () {
  201. self.$validator.validateAll('general');
  202. });
  203. },
  204. proceedToConsiderations: function proceedToConsiderations(ev) {
  205. this.considerations = {
  206. https: !_lodash2.default.startsWith(this.conf.host, 'https'),
  207. port: false, // TODO
  208. localhost: _lodash2.default.includes(this.conf.host, 'localhost')
  209. };
  210. this.state = 'considerations';
  211. this.loading = false;
  212. },
  213. proceedToDb: function proceedToDb(ev) {
  214. var self = this;
  215. self.state = 'db';
  216. self.loading = false;
  217. self.$nextTick(function () {
  218. self.$validator.validateAll('db');
  219. });
  220. },
  221. proceedToDbcheck: function proceedToDbcheck(ev) {
  222. var self = this;
  223. this.state = 'dbcheck';
  224. this.loading = true;
  225. self.dbcheck = {
  226. ok: false,
  227. error: ''
  228. };
  229. _lodash2.default.delay(function () {
  230. _axios2.default.post('/dbcheck', {
  231. db: self.conf.db
  232. }).then(function (resp) {
  233. if (resp.data.ok === true) {
  234. self.dbcheck.ok = true;
  235. } else {
  236. self.dbcheck.ok = false;
  237. self.dbcheck.error = resp.data.error;
  238. }
  239. self.loading = false;
  240. self.$nextTick();
  241. }).catch(function (err) {
  242. window.alert(err.message);
  243. });
  244. }, 1000);
  245. },
  246. proceedToPaths: function proceedToPaths(ev) {
  247. var self = this;
  248. self.state = 'paths';
  249. self.loading = false;
  250. self.$nextTick(function () {
  251. self.$validator.validateAll('paths');
  252. });
  253. },
  254. proceedToGit: function proceedToGit(ev) {
  255. var self = this;
  256. self.state = 'git';
  257. self.loading = false;
  258. self.$nextTick(function () {
  259. self.$validator.validateAll('git');
  260. });
  261. },
  262. proceedToGitCheck: function proceedToGitCheck(ev) {
  263. var self = this;
  264. this.state = 'gitcheck';
  265. this.loading = true;
  266. self.gitcheck = {
  267. ok: false,
  268. results: [],
  269. error: ''
  270. };
  271. _lodash2.default.delay(function () {
  272. _axios2.default.post('/gitcheck', self.conf).then(function (resp) {
  273. if (resp.data.ok === true) {
  274. self.gitcheck.ok = true;
  275. self.gitcheck.results = resp.data.results;
  276. } else {
  277. self.gitcheck.ok = false;
  278. self.gitcheck.error = resp.data.error;
  279. }
  280. self.loading = false;
  281. self.$nextTick();
  282. }).catch(function (err) {
  283. window.alert(err.message);
  284. });
  285. }, 1000);
  286. },
  287. proceedToAdmin: function proceedToAdmin(ev) {
  288. var self = this;
  289. self.state = 'admin';
  290. self.loading = false;
  291. self.$nextTick(function () {
  292. self.$validator.validateAll('admin');
  293. });
  294. },
  295. proceedToFinal: function proceedToFinal(ev) {
  296. var self = this;
  297. self.state = 'final';
  298. self.loading = true;
  299. self.final = {
  300. ok: false,
  301. error: '',
  302. results: []
  303. };
  304. _lodash2.default.delay(function () {
  305. _axios2.default.post('/finalize', self.conf).then(function (resp) {
  306. if (resp.data.ok === true) {
  307. self.final.ok = true;
  308. self.final.results = resp.data.results;
  309. } else {
  310. self.final.ok = false;
  311. self.final.error = resp.data.error;
  312. }
  313. self.loading = false;
  314. self.$nextTick();
  315. }).catch(function (err) {
  316. window.alert(err.message);
  317. });
  318. }, 1000);
  319. },
  320. finish: function finish(ev) {
  321. var self = this;
  322. self.state = 'restart';
  323. _lodash2.default.delay(function () {
  324. _axios2.default.post('/restart', {}).then(function (resp) {
  325. _lodash2.default.delay(function () {
  326. window.location.assign(self.conf.host);
  327. }, 10000);
  328. }).catch(function (err) {
  329. window.alert(err.message);
  330. });
  331. }, 1000);
  332. }
  333. }
  334. });
  335. });
  336. });
  337. });
  338. FuseBox.pkg("fusebox-hot-reload", {}, function(___scope___){
  339. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  340. /**
  341. * @module listens to `source-changed` socket events and actions hot reload
  342. */
  343. "use strict";
  344. Object.defineProperty(exports, "__esModule", { value: true });
  345. var Client = require('fusebox-websocket').SocketClient;
  346. exports.connect = function (port, uri) {
  347. if (FuseBox.isServer) {
  348. return;
  349. }
  350. port = port || window.location.port;
  351. var client = new Client({
  352. port: port,
  353. uri: uri,
  354. });
  355. client.connect();
  356. console.log('connecting...');
  357. client.on('source-changed', function (data) {
  358. console.log("Updating \"" + data.path + "\" ...");
  359. /**
  360. * If a plugin handles this request then we don't have to do anything
  361. **/
  362. for (var index = 0; index < FuseBox.plugins.length; index++) {
  363. var plugin = FuseBox.plugins[index];
  364. if (plugin.hmrUpdate && plugin.hmrUpdate(data)) {
  365. return;
  366. }
  367. }
  368. if (data.type === 'js') {
  369. FuseBox.flush();
  370. FuseBox.dynamic(data.path, data.content);
  371. if (FuseBox.mainFile) {
  372. try {
  373. FuseBox.import(FuseBox.mainFile);
  374. }
  375. catch (e) {
  376. if (typeof e === 'string') {
  377. if (/not found/.test(e)) {
  378. return window.location.reload();
  379. }
  380. }
  381. console.error(e);
  382. }
  383. }
  384. }
  385. if (data.type === 'css' && __fsbx_css) {
  386. __fsbx_css(data.path, data.content);
  387. }
  388. });
  389. client.on('error', function (error) {
  390. console.log(error);
  391. });
  392. };
  393. });
  394. return ___scope___.entry = "index.js";
  395. });
  396. FuseBox.pkg("fusebox-websocket", {}, function(___scope___){
  397. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  398. "use strict";
  399. Object.defineProperty(exports, "__esModule", { value: true });
  400. var events = require('events');
  401. var SocketClient = (function () {
  402. function SocketClient(opts) {
  403. opts = opts || {};
  404. var port = opts.port || window.location.port;
  405. var protocol = location.protocol === 'https:' ? 'wss://' : 'ws://';
  406. var domain = location.hostname || 'localhost';
  407. this.url = opts.host || "" + protocol + domain + ":" + port;
  408. if (opts.uri) {
  409. this.url = opts.uri;
  410. }
  411. this.authSent = false;
  412. this.emitter = new events.EventEmitter();
  413. }
  414. SocketClient.prototype.reconnect = function (fn) {
  415. var _this = this;
  416. setTimeout(function () {
  417. _this.emitter.emit('reconnect', { message: 'Trying to reconnect' });
  418. _this.connect(fn);
  419. }, 5000);
  420. };
  421. SocketClient.prototype.on = function (event, fn) {
  422. this.emitter.on(event, fn);
  423. };
  424. SocketClient.prototype.connect = function (fn) {
  425. var _this = this;
  426. console.log('connect', this.url);
  427. setTimeout(function () {
  428. _this.client = new WebSocket(_this.url);
  429. _this.bindEvents(fn);
  430. }, 0);
  431. };
  432. SocketClient.prototype.close = function () {
  433. this.client.close();
  434. };
  435. SocketClient.prototype.send = function (eventName, data) {
  436. if (this.client.readyState === 1) {
  437. this.client.send(JSON.stringify({ event: eventName, data: data || {} }));
  438. }
  439. };
  440. SocketClient.prototype.error = function (data) {
  441. this.emitter.emit('error', data);
  442. };
  443. /** Wires up the socket client messages to be emitted on our event emitter */
  444. SocketClient.prototype.bindEvents = function (fn) {
  445. var _this = this;
  446. this.client.onopen = function (event) {
  447. if (fn) {
  448. fn(_this);
  449. }
  450. };
  451. this.client.onerror = function (event) {
  452. _this.error({ reason: event.reason, message: 'Socket error' });
  453. };
  454. this.client.onclose = function (event) {
  455. _this.emitter.emit('close', { message: 'Socket closed' });
  456. if (event.code !== 1011) {
  457. _this.reconnect(fn);
  458. }
  459. };
  460. this.client.onmessage = function (event) {
  461. var data = event.data;
  462. if (data) {
  463. var item = JSON.parse(data);
  464. _this.emitter.emit(item.type, item.data);
  465. _this.emitter.emit('*', item);
  466. }
  467. };
  468. };
  469. return SocketClient;
  470. }());
  471. exports.SocketClient = SocketClient;
  472. });
  473. return ___scope___.entry = "index.js";
  474. });
  475. FuseBox.pkg("events", {}, function(___scope___){
  476. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  477. // Copyright Joyent, Inc. and other Node contributors.
  478. //
  479. // Permission is hereby granted, free of charge, to any person obtaining a
  480. // copy of this software and associated documentation files (the
  481. // "Software"), to deal in the Software without restriction, including
  482. // without limitation the rights to use, copy, modify, merge, publish,
  483. // distribute, sublicense, and/or sell copies of the Software, and to permit
  484. // persons to whom the Software is furnished to do so, subject to the
  485. // following conditions:
  486. //
  487. // The above copyright notice and this permission notice shall be included
  488. // in all copies or substantial portions of the Software.
  489. //
  490. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  491. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  492. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  493. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  494. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  495. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  496. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  497. if (FuseBox.isServer) {
  498. module.exports = global.require("events");
  499. } else {
  500. function EventEmitter() {
  501. this._events = this._events || {};
  502. this._maxListeners = this._maxListeners || undefined;
  503. }
  504. module.exports = EventEmitter;
  505. // Backwards-compat with node 0.10.x
  506. EventEmitter.EventEmitter = EventEmitter;
  507. EventEmitter.prototype._events = undefined;
  508. EventEmitter.prototype._maxListeners = undefined;
  509. // By default EventEmitters will print a warning if more than 10 listeners are
  510. // added to it. This is a useful default which helps finding memory leaks.
  511. EventEmitter.defaultMaxListeners = 10;
  512. // Obviously not all Emitters should be limited to 10. This function allows
  513. // that to be increased. Set to zero for unlimited.
  514. EventEmitter.prototype.setMaxListeners = function(n) {
  515. if (!isNumber(n) || n < 0 || isNaN(n))
  516. throw TypeError("n must be a positive number");
  517. this._maxListeners = n;
  518. return this;
  519. };
  520. EventEmitter.prototype.emit = function(type) {
  521. var er, handler, len, args, i, listeners;
  522. if (!this._events)
  523. this._events = {};
  524. // If there is no 'error' event listener then throw.
  525. if (type === "error") {
  526. if (!this._events.error ||
  527. (isObject(this._events.error) && !this._events.error.length)) {
  528. er = arguments[1];
  529. if (er instanceof Error) {
  530. throw er; // Unhandled 'error' event
  531. }
  532. throw TypeError("Uncaught, unspecified \"error\" event.");
  533. }
  534. }
  535. handler = this._events[type];
  536. if (isUndefined(handler))
  537. return false;
  538. if (isFunction(handler)) {
  539. switch (arguments.length) {
  540. // fast cases
  541. case 1:
  542. handler.call(this);
  543. break;
  544. case 2:
  545. handler.call(this, arguments[1]);
  546. break;
  547. case 3:
  548. handler.call(this, arguments[1], arguments[2]);
  549. break;
  550. // slower
  551. default:
  552. args = Array.prototype.slice.call(arguments, 1);
  553. handler.apply(this, args);
  554. }
  555. } else if (isObject(handler)) {
  556. args = Array.prototype.slice.call(arguments, 1);
  557. listeners = handler.slice();
  558. len = listeners.length;
  559. for (i = 0; i < len; i++)
  560. listeners[i].apply(this, args);
  561. }
  562. return true;
  563. };
  564. EventEmitter.prototype.addListener = function(type, listener) {
  565. var m;
  566. if (!isFunction(listener))
  567. throw TypeError("listener must be a function");
  568. if (!this._events)
  569. this._events = {};
  570. // To avoid recursion in the case that type === "newListener"! Before
  571. // adding it to the listeners, first emit "newListener".
  572. if (this._events.newListener)
  573. this.emit("newListener", type,
  574. isFunction(listener.listener) ?
  575. listener.listener : listener);
  576. if (!this._events[type])
  577. // Optimize the case of one listener. Don't need the extra array object.
  578. this._events[type] = listener;
  579. else if (isObject(this._events[type]))
  580. // If we've already got an array, just append.
  581. this._events[type].push(listener);
  582. else
  583. // Adding the second element, need to change to array.
  584. this._events[type] = [this._events[type], listener];
  585. // Check for listener leak
  586. if (isObject(this._events[type]) && !this._events[type].warned) {
  587. if (!isUndefined(this._maxListeners)) {
  588. m = this._maxListeners;
  589. } else {
  590. m = EventEmitter.defaultMaxListeners;
  591. }
  592. if (m && m > 0 && this._events[type].length > m) {
  593. this._events[type].warned = true;
  594. console.error("(node) warning: possible EventEmitter memory " +
  595. "leak detected. %d listeners added. " +
  596. "Use emitter.setMaxListeners() to increase limit.",
  597. this._events[type].length);
  598. if (typeof console.trace === "function") {
  599. // not supported in IE 10
  600. console.trace();
  601. }
  602. }
  603. }
  604. return this;
  605. };
  606. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  607. EventEmitter.prototype.once = function(type, listener) {
  608. if (!isFunction(listener))
  609. throw TypeError("listener must be a function");
  610. var fired = false;
  611. function g() {
  612. this.removeListener(type, g);
  613. if (!fired) {
  614. fired = true;
  615. listener.apply(this, arguments);
  616. }
  617. }
  618. g.listener = listener;
  619. this.on(type, g);
  620. return this;
  621. };
  622. // emits a 'removeListener' event iff the listener was removed
  623. EventEmitter.prototype.removeListener = function(type, listener) {
  624. var list, position, length, i;
  625. if (!isFunction(listener))
  626. throw TypeError("listener must be a function");
  627. if (!this._events || !this._events[type])
  628. return this;
  629. list = this._events[type];
  630. length = list.length;
  631. position = -1;
  632. if (list === listener ||
  633. (isFunction(list.listener) && list.listener === listener)) {
  634. delete this._events[type];
  635. if (this._events.removeListener)
  636. this.emit("removeListener", type, listener);
  637. } else if (isObject(list)) {
  638. for (i = length; i-- > 0;) {
  639. if (list[i] === listener ||
  640. (list[i].listener && list[i].listener === listener)) {
  641. position = i;
  642. break;
  643. }
  644. }
  645. if (position < 0)
  646. return this;
  647. if (list.length === 1) {
  648. list.length = 0;
  649. delete this._events[type];
  650. } else {
  651. list.splice(position, 1);
  652. }
  653. if (this._events.removeListener)
  654. this.emit("removeListener", type, listener);
  655. }
  656. return this;
  657. };
  658. EventEmitter.prototype.removeAllListeners = function(type) {
  659. var key, listeners;
  660. if (!this._events)
  661. return this;
  662. // not listening for removeListener, no need to emit
  663. if (!this._events.removeListener) {
  664. if (arguments.length === 0)
  665. this._events = {};
  666. else if (this._events[type])
  667. delete this._events[type];
  668. return this;
  669. }
  670. // emit removeListener for all listeners on all events
  671. if (arguments.length === 0) {
  672. for (key in this._events) {
  673. if (key === "removeListener") continue;
  674. this.removeAllListeners(key);
  675. }
  676. this.removeAllListeners("removeListener");
  677. this._events = {};
  678. return this;
  679. }
  680. listeners = this._events[type];
  681. if (isFunction(listeners)) {
  682. this.removeListener(type, listeners);
  683. } else if (listeners) {
  684. // LIFO order
  685. while (listeners.length)
  686. this.removeListener(type, listeners[listeners.length - 1]);
  687. }
  688. delete this._events[type];
  689. return this;
  690. };
  691. EventEmitter.prototype.listeners = function(type) {
  692. var ret;
  693. if (!this._events || !this._events[type])
  694. ret = [];
  695. else if (isFunction(this._events[type]))
  696. ret = [this._events[type]];
  697. else
  698. ret = this._events[type].slice();
  699. return ret;
  700. };
  701. EventEmitter.prototype.listenerCount = function(type) {
  702. if (this._events) {
  703. var evlistener = this._events[type];
  704. if (isFunction(evlistener))
  705. return 1;
  706. else if (evlistener)
  707. return evlistener.length;
  708. }
  709. return 0;
  710. };
  711. EventEmitter.listenerCount = function(emitter, type) {
  712. return emitter.listenerCount(type);
  713. };
  714. function isFunction(arg) {
  715. return typeof arg === "function";
  716. }
  717. function isNumber(arg) {
  718. return typeof arg === "number";
  719. }
  720. function isObject(arg) {
  721. return typeof arg === "object" && arg !== null;
  722. }
  723. function isUndefined(arg) {
  724. return arg === void 0;
  725. }
  726. }
  727. });
  728. return ___scope___.entry = "index.js";
  729. });
  730. FuseBox.pkg("jquery", {}, function(___scope___){
  731. ___scope___.file("dist/jquery.js", function(exports, require, module, __filename, __dirname){
  732. /*!
  733. * jQuery JavaScript Library v3.2.1
  734. * https://jquery.com/
  735. *
  736. * Includes Sizzle.js
  737. * https://sizzlejs.com/
  738. *
  739. * Copyright JS Foundation and other contributors
  740. * Released under the MIT license
  741. * https://jquery.org/license
  742. *
  743. * Date: 2017-03-20T18:59Z
  744. */
  745. ( function( global, factory ) {
  746. "use strict";
  747. if ( typeof module === "object" && typeof module.exports === "object" ) {
  748. // For CommonJS and CommonJS-like environments where a proper `window`
  749. // is present, execute the factory and get jQuery.
  750. // For environments that do not have a `window` with a `document`
  751. // (such as Node.js), expose a factory as module.exports.
  752. // This accentuates the need for the creation of a real `window`.
  753. // e.g. var jQuery = require("jquery")(window);
  754. // See ticket #14549 for more info.
  755. module.exports = global.document ?
  756. factory( global, true ) :
  757. function( w ) {
  758. if ( !w.document ) {
  759. throw new Error( "jQuery requires a window with a document" );
  760. }
  761. return factory( w );
  762. };
  763. } else {
  764. factory( global );
  765. }
  766. // Pass this if window is not defined yet
  767. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  768. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  769. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  770. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  771. // enough that all such attempts are guarded in a try block.
  772. "use strict";
  773. var arr = [];
  774. var document = window.document;
  775. var getProto = Object.getPrototypeOf;
  776. var slice = arr.slice;
  777. var concat = arr.concat;
  778. var push = arr.push;
  779. var indexOf = arr.indexOf;
  780. var class2type = {};
  781. var toString = class2type.toString;
  782. var hasOwn = class2type.hasOwnProperty;
  783. var fnToString = hasOwn.toString;
  784. var ObjectFunctionString = fnToString.call( Object );
  785. var support = {};
  786. function DOMEval( code, doc ) {
  787. doc = doc || document;
  788. var script = doc.createElement( "script" );
  789. script.text = code;
  790. doc.head.appendChild( script ).parentNode.removeChild( script );
  791. }
  792. /* global Symbol */
  793. // Defining this global in .eslintrc.json would create a danger of using the global
  794. // unguarded in another place, it seems safer to define global only for this module
  795. var
  796. version = "3.2.1",
  797. // Define a local copy of jQuery
  798. jQuery = function( selector, context ) {
  799. // The jQuery object is actually just the init constructor 'enhanced'
  800. // Need init if jQuery is called (just allow error to be thrown if not included)
  801. return new jQuery.fn.init( selector, context );
  802. },
  803. // Support: Android <=4.0 only
  804. // Make sure we trim BOM and NBSP
  805. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  806. // Matches dashed string for camelizing
  807. rmsPrefix = /^-ms-/,
  808. rdashAlpha = /-([a-z])/g,
  809. // Used by jQuery.camelCase as callback to replace()
  810. fcamelCase = function( all, letter ) {
  811. return letter.toUpperCase();
  812. };
  813. jQuery.fn = jQuery.prototype = {
  814. // The current version of jQuery being used
  815. jquery: version,
  816. constructor: jQuery,
  817. // The default length of a jQuery object is 0
  818. length: 0,
  819. toArray: function() {
  820. return slice.call( this );
  821. },
  822. // Get the Nth element in the matched element set OR
  823. // Get the whole matched element set as a clean array
  824. get: function( num ) {
  825. // Return all the elements in a clean array
  826. if ( num == null ) {
  827. return slice.call( this );
  828. }
  829. // Return just the one element from the set
  830. return num < 0 ? this[ num + this.length ] : this[ num ];
  831. },
  832. // Take an array of elements and push it onto the stack
  833. // (returning the new matched element set)
  834. pushStack: function( elems ) {
  835. // Build a new jQuery matched element set
  836. var ret = jQuery.merge( this.constructor(), elems );
  837. // Add the old object onto the stack (as a reference)
  838. ret.prevObject = this;
  839. // Return the newly-formed element set
  840. return ret;
  841. },
  842. // Execute a callback for every element in the matched set.
  843. each: function( callback ) {
  844. return jQuery.each( this, callback );
  845. },
  846. map: function( callback ) {
  847. return this.pushStack( jQuery.map( this, function( elem, i ) {
  848. return callback.call( elem, i, elem );
  849. } ) );
  850. },
  851. slice: function() {
  852. return this.pushStack( slice.apply( this, arguments ) );
  853. },
  854. first: function() {
  855. return this.eq( 0 );
  856. },
  857. last: function() {
  858. return this.eq( -1 );
  859. },
  860. eq: function( i ) {
  861. var len = this.length,
  862. j = +i + ( i < 0 ? len : 0 );
  863. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  864. },
  865. end: function() {
  866. return this.prevObject || this.constructor();
  867. },
  868. // For internal use only.
  869. // Behaves like an Array's method, not like a jQuery method.
  870. push: push,
  871. sort: arr.sort,
  872. splice: arr.splice
  873. };
  874. jQuery.extend = jQuery.fn.extend = function() {
  875. var options, name, src, copy, copyIsArray, clone,
  876. target = arguments[ 0 ] || {},
  877. i = 1,
  878. length = arguments.length,
  879. deep = false;
  880. // Handle a deep copy situation
  881. if ( typeof target === "boolean" ) {
  882. deep = target;
  883. // Skip the boolean and the target
  884. target = arguments[ i ] || {};
  885. i++;
  886. }
  887. // Handle case when target is a string or something (possible in deep copy)
  888. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  889. target = {};
  890. }
  891. // Extend jQuery itself if only one argument is passed
  892. if ( i === length ) {
  893. target = this;
  894. i--;
  895. }
  896. for ( ; i < length; i++ ) {
  897. // Only deal with non-null/undefined values
  898. if ( ( options = arguments[ i ] ) != null ) {
  899. // Extend the base object
  900. for ( name in options ) {
  901. src = target[ name ];
  902. copy = options[ name ];
  903. // Prevent never-ending loop
  904. if ( target === copy ) {
  905. continue;
  906. }
  907. // Recurse if we're merging plain objects or arrays
  908. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  909. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  910. if ( copyIsArray ) {
  911. copyIsArray = false;
  912. clone = src && Array.isArray( src ) ? src : [];
  913. } else {
  914. clone = src && jQuery.isPlainObject( src ) ? src : {};
  915. }
  916. // Never move original objects, clone them
  917. target[ name ] = jQuery.extend( deep, clone, copy );
  918. // Don't bring in undefined values
  919. } else if ( copy !== undefined ) {
  920. target[ name ] = copy;
  921. }
  922. }
  923. }
  924. }
  925. // Return the modified object
  926. return target;
  927. };
  928. jQuery.extend( {
  929. // Unique for each copy of jQuery on the page
  930. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  931. // Assume jQuery is ready without the ready module
  932. isReady: true,
  933. error: function( msg ) {
  934. throw new Error( msg );
  935. },
  936. noop: function() {},
  937. isFunction: function( obj ) {
  938. return jQuery.type( obj ) === "function";
  939. },
  940. isWindow: function( obj ) {
  941. return obj != null && obj === obj.window;
  942. },
  943. isNumeric: function( obj ) {
  944. // As of jQuery 3.0, isNumeric is limited to
  945. // strings and numbers (primitives or objects)
  946. // that can be coerced to finite numbers (gh-2662)
  947. var type = jQuery.type( obj );
  948. return ( type === "number" || type === "string" ) &&
  949. // parseFloat NaNs numeric-cast false positives ("")
  950. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  951. // subtraction forces infinities to NaN
  952. !isNaN( obj - parseFloat( obj ) );
  953. },
  954. isPlainObject: function( obj ) {
  955. var proto, Ctor;
  956. // Detect obvious negatives
  957. // Use toString instead of jQuery.type to catch host objects
  958. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  959. return false;
  960. }
  961. proto = getProto( obj );
  962. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  963. if ( !proto ) {
  964. return true;
  965. }
  966. // Objects with prototype are plain iff they were constructed by a global Object function
  967. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  968. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  969. },
  970. isEmptyObject: function( obj ) {
  971. /* eslint-disable no-unused-vars */
  972. // See https://github.com/eslint/eslint/issues/6125
  973. var name;
  974. for ( name in obj ) {
  975. return false;
  976. }
  977. return true;
  978. },
  979. type: function( obj ) {
  980. if ( obj == null ) {
  981. return obj + "";
  982. }
  983. // Support: Android <=2.3 only (functionish RegExp)
  984. return typeof obj === "object" || typeof obj === "function" ?
  985. class2type[ toString.call( obj ) ] || "object" :
  986. typeof obj;
  987. },
  988. // Evaluates a script in a global context
  989. globalEval: function( code ) {
  990. DOMEval( code );
  991. },
  992. // Convert dashed to camelCase; used by the css and data modules
  993. // Support: IE <=9 - 11, Edge 12 - 13
  994. // Microsoft forgot to hump their vendor prefix (#9572)
  995. camelCase: function( string ) {
  996. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  997. },
  998. each: function( obj, callback ) {
  999. var length, i = 0;
  1000. if ( isArrayLike( obj ) ) {
  1001. length = obj.length;
  1002. for ( ; i < length; i++ ) {
  1003. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1004. break;
  1005. }
  1006. }
  1007. } else {
  1008. for ( i in obj ) {
  1009. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1010. break;
  1011. }
  1012. }
  1013. }
  1014. return obj;
  1015. },
  1016. // Support: Android <=4.0 only
  1017. trim: function( text ) {
  1018. return text == null ?
  1019. "" :
  1020. ( text + "" ).replace( rtrim, "" );
  1021. },
  1022. // results is for internal usage only
  1023. makeArray: function( arr, results ) {
  1024. var ret = results || [];
  1025. if ( arr != null ) {
  1026. if ( isArrayLike( Object( arr ) ) ) {
  1027. jQuery.merge( ret,
  1028. typeof arr === "string" ?
  1029. [ arr ] : arr
  1030. );
  1031. } else {
  1032. push.call( ret, arr );
  1033. }
  1034. }
  1035. return ret;
  1036. },
  1037. inArray: function( elem, arr, i ) {
  1038. return arr == null ? -1 : indexOf.call( arr, elem, i );
  1039. },
  1040. // Support: Android <=4.0 only, PhantomJS 1 only
  1041. // push.apply(_, arraylike) throws on ancient WebKit
  1042. merge: function( first, second ) {
  1043. var len = +second.length,
  1044. j = 0,
  1045. i = first.length;
  1046. for ( ; j < len; j++ ) {
  1047. first[ i++ ] = second[ j ];
  1048. }
  1049. first.length = i;
  1050. return first;
  1051. },
  1052. grep: function( elems, callback, invert ) {
  1053. var callbackInverse,
  1054. matches = [],
  1055. i = 0,
  1056. length = elems.length,
  1057. callbackExpect = !invert;
  1058. // Go through the array, only saving the items
  1059. // that pass the validator function
  1060. for ( ; i < length; i++ ) {
  1061. callbackInverse = !callback( elems[ i ], i );
  1062. if ( callbackInverse !== callbackExpect ) {
  1063. matches.push( elems[ i ] );
  1064. }
  1065. }
  1066. return matches;
  1067. },
  1068. // arg is for internal usage only
  1069. map: function( elems, callback, arg ) {
  1070. var length, value,
  1071. i = 0,
  1072. ret = [];
  1073. // Go through the array, translating each of the items to their new values
  1074. if ( isArrayLike( elems ) ) {
  1075. length = elems.length;
  1076. for ( ; i < length; i++ ) {
  1077. value = callback( elems[ i ], i, arg );
  1078. if ( value != null ) {
  1079. ret.push( value );
  1080. }
  1081. }
  1082. // Go through every key on the object,
  1083. } else {
  1084. for ( i in elems ) {
  1085. value = callback( elems[ i ], i, arg );
  1086. if ( value != null ) {
  1087. ret.push( value );
  1088. }
  1089. }
  1090. }
  1091. // Flatten any nested arrays
  1092. return concat.apply( [], ret );
  1093. },
  1094. // A global GUID counter for objects
  1095. guid: 1,
  1096. // Bind a function to a context, optionally partially applying any
  1097. // arguments.
  1098. proxy: function( fn, context ) {
  1099. var tmp, args, proxy;
  1100. if ( typeof context === "string" ) {
  1101. tmp = fn[ context ];
  1102. context = fn;
  1103. fn = tmp;
  1104. }
  1105. // Quick check to determine if target is callable, in the spec
  1106. // this throws a TypeError, but we will just return undefined.
  1107. if ( !jQuery.isFunction( fn ) ) {
  1108. return undefined;
  1109. }
  1110. // Simulated bind
  1111. args = slice.call( arguments, 2 );
  1112. proxy = function() {
  1113. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  1114. };
  1115. // Set the guid of unique handler to the same of original handler, so it can be removed
  1116. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  1117. return proxy;
  1118. },
  1119. now: Date.now,
  1120. // jQuery.support is not used in Core but other projects attach their
  1121. // properties to it so it needs to exist.
  1122. support: support
  1123. } );
  1124. if ( typeof Symbol === "function" ) {
  1125. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  1126. }
  1127. // Populate the class2type map
  1128. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1129. function( i, name ) {
  1130. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1131. } );
  1132. function isArrayLike( obj ) {
  1133. // Support: real iOS 8.2 only (not reproducible in simulator)
  1134. // `in` check used to prevent JIT error (gh-2145)
  1135. // hasOwn isn't used here due to false negatives
  1136. // regarding Nodelist length in IE
  1137. var length = !!obj && "length" in obj && obj.length,
  1138. type = jQuery.type( obj );
  1139. if ( type === "function" || jQuery.isWindow( obj ) ) {
  1140. return false;
  1141. }
  1142. return type === "array" || length === 0 ||
  1143. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1144. }
  1145. var Sizzle =
  1146. /*!
  1147. * Sizzle CSS Selector Engine v2.3.3
  1148. * https://sizzlejs.com/
  1149. *
  1150. * Copyright jQuery Foundation and other contributors
  1151. * Released under the MIT license
  1152. * http://jquery.org/license
  1153. *
  1154. * Date: 2016-08-08
  1155. */
  1156. (function( window ) {
  1157. var i,
  1158. support,
  1159. Expr,
  1160. getText,
  1161. isXML,
  1162. tokenize,
  1163. compile,
  1164. select,
  1165. outermostContext,
  1166. sortInput,
  1167. hasDuplicate,
  1168. // Local document vars
  1169. setDocument,
  1170. document,
  1171. docElem,
  1172. documentIsHTML,
  1173. rbuggyQSA,
  1174. rbuggyMatches,
  1175. matches,
  1176. contains,
  1177. // Instance-specific data
  1178. expando = "sizzle" + 1 * new Date(),
  1179. preferredDoc = window.document,
  1180. dirruns = 0,
  1181. done = 0,
  1182. classCache = createCache(),
  1183. tokenCache = createCache(),
  1184. compilerCache = createCache(),
  1185. sortOrder = function( a, b ) {
  1186. if ( a === b ) {
  1187. hasDuplicate = true;
  1188. }
  1189. return 0;
  1190. },
  1191. // Instance methods
  1192. hasOwn = ({}).hasOwnProperty,
  1193. arr = [],
  1194. pop = arr.pop,
  1195. push_native = arr.push,
  1196. push = arr.push,
  1197. slice = arr.slice,
  1198. // Use a stripped-down indexOf as it's faster than native
  1199. // https://jsperf.com/thor-indexof-vs-for/5
  1200. indexOf = function( list, elem ) {
  1201. var i = 0,
  1202. len = list.length;
  1203. for ( ; i < len; i++ ) {
  1204. if ( list[i] === elem ) {
  1205. return i;
  1206. }
  1207. }
  1208. return -1;
  1209. },
  1210. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1211. // Regular expressions
  1212. // http://www.w3.org/TR/css3-selectors/#whitespace
  1213. whitespace = "[\\x20\\t\\r\\n\\f]",
  1214. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1215. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  1216. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1217. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1218. // Operator (capture 2)
  1219. "*([*^$|!~]?=)" + whitespace +
  1220. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1221. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1222. "*\\]",
  1223. pseudos = ":(" + identifier + ")(?:\\((" +
  1224. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1225. // 1. quoted (capture 3; capture 4 or capture 5)
  1226. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1227. // 2. simple (capture 6)
  1228. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1229. // 3. anything else (capture 2)
  1230. ".*" +
  1231. ")\\)|)",
  1232. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1233. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1234. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1235. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1236. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1237. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  1238. rpseudo = new RegExp( pseudos ),
  1239. ridentifier = new RegExp( "^" + identifier + "$" ),
  1240. matchExpr = {
  1241. "ID": new RegExp( "^#(" + identifier + ")" ),
  1242. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1243. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1244. "ATTR": new RegExp( "^" + attributes ),
  1245. "PSEUDO": new RegExp( "^" + pseudos ),
  1246. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1247. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1248. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1249. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1250. // For use in libraries implementing .is()
  1251. // We use this for POS matching in `select`
  1252. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1253. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1254. },
  1255. rinputs = /^(?:input|select|textarea|button)$/i,
  1256. rheader = /^h\d$/i,
  1257. rnative = /^[^{]+\{\s*\[native \w/,
  1258. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1259. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1260. rsibling = /[+~]/,
  1261. // CSS escapes
  1262. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1263. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1264. funescape = function( _, escaped, escapedWhitespace ) {
  1265. var high = "0x" + escaped - 0x10000;
  1266. // NaN means non-codepoint
  1267. // Support: Firefox<24
  1268. // Workaround erroneous numeric interpretation of +"0x"
  1269. return high !== high || escapedWhitespace ?
  1270. escaped :
  1271. high < 0 ?
  1272. // BMP codepoint
  1273. String.fromCharCode( high + 0x10000 ) :
  1274. // Supplemental Plane codepoint (surrogate pair)
  1275. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1276. },
  1277. // CSS string/identifier serialization
  1278. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1279. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  1280. fcssescape = function( ch, asCodePoint ) {
  1281. if ( asCodePoint ) {
  1282. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1283. if ( ch === "\0" ) {
  1284. return "\uFFFD";
  1285. }
  1286. // Control characters and (dependent upon position) numbers get escaped as code points
  1287. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1288. }
  1289. // Other potentially-special ASCII characters get backslash-escaped
  1290. return "\\" + ch;
  1291. },
  1292. // Used for iframes
  1293. // See setDocument()
  1294. // Removing the function wrapper causes a "Permission Denied"
  1295. // error in IE
  1296. unloadHandler = function() {
  1297. setDocument();
  1298. },
  1299. disabledAncestor = addCombinator(
  1300. function( elem ) {
  1301. return elem.disabled === true && ("form" in elem || "label" in elem);
  1302. },
  1303. { dir: "parentNode", next: "legend" }
  1304. );
  1305. // Optimize for push.apply( _, NodeList )
  1306. try {
  1307. push.apply(
  1308. (arr = slice.call( preferredDoc.childNodes )),
  1309. preferredDoc.childNodes
  1310. );
  1311. // Support: Android<4.0
  1312. // Detect silently failing push.apply
  1313. arr[ preferredDoc.childNodes.length ].nodeType;
  1314. } catch ( e ) {
  1315. push = { apply: arr.length ?
  1316. // Leverage slice if possible
  1317. function( target, els ) {
  1318. push_native.apply( target, slice.call(els) );
  1319. } :
  1320. // Support: IE<9
  1321. // Otherwise append directly
  1322. function( target, els ) {
  1323. var j = target.length,
  1324. i = 0;
  1325. // Can't trust NodeList.length
  1326. while ( (target[j++] = els[i++]) ) {}
  1327. target.length = j - 1;
  1328. }
  1329. };
  1330. }
  1331. function Sizzle( selector, context, results, seed ) {
  1332. var m, i, elem, nid, match, groups, newSelector,
  1333. newContext = context && context.ownerDocument,
  1334. // nodeType defaults to 9, since context defaults to document
  1335. nodeType = context ? context.nodeType : 9;
  1336. results = results || [];
  1337. // Return early from calls with invalid selector or context
  1338. if ( typeof selector !== "string" || !selector ||
  1339. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1340. return results;
  1341. }
  1342. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1343. if ( !seed ) {
  1344. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1345. setDocument( context );
  1346. }
  1347. context = context || document;
  1348. if ( documentIsHTML ) {
  1349. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1350. // (excepting DocumentFragment context, where the methods don't exist)
  1351. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1352. // ID selector
  1353. if ( (m = match[1]) ) {
  1354. // Document context
  1355. if ( nodeType === 9 ) {
  1356. if ( (elem = context.getElementById( m )) ) {
  1357. // Support: IE, Opera, Webkit
  1358. // TODO: identify versions
  1359. // getElementById can match elements by name instead of ID
  1360. if ( elem.id === m ) {
  1361. results.push( elem );
  1362. return results;
  1363. }
  1364. } else {
  1365. return results;
  1366. }
  1367. // Element context
  1368. } else {
  1369. // Support: IE, Opera, Webkit
  1370. // TODO: identify versions
  1371. // getElementById can match elements by name instead of ID
  1372. if ( newContext && (elem = newContext.getElementById( m )) &&
  1373. contains( context, elem ) &&
  1374. elem.id === m ) {
  1375. results.push( elem );
  1376. return results;
  1377. }
  1378. }
  1379. // Type selector
  1380. } else if ( match[2] ) {
  1381. push.apply( results, context.getElementsByTagName( selector ) );
  1382. return results;
  1383. // Class selector
  1384. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1385. context.getElementsByClassName ) {
  1386. push.apply( results, context.getElementsByClassName( m ) );
  1387. return results;
  1388. }
  1389. }
  1390. // Take advantage of querySelectorAll
  1391. if ( support.qsa &&
  1392. !compilerCache[ selector + " " ] &&
  1393. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  1394. if ( nodeType !== 1 ) {
  1395. newContext = context;
  1396. newSelector = selector;
  1397. // qSA looks outside Element context, which is not what we want
  1398. // Thanks to Andrew Dupont for this workaround technique
  1399. // Support: IE <=8
  1400. // Exclude object elements
  1401. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  1402. // Capture the context ID, setting it first if necessary
  1403. if ( (nid = context.getAttribute( "id" )) ) {
  1404. nid = nid.replace( rcssescape, fcssescape );
  1405. } else {
  1406. context.setAttribute( "id", (nid = expando) );
  1407. }
  1408. // Prefix every selector in the list
  1409. groups = tokenize( selector );
  1410. i = groups.length;
  1411. while ( i-- ) {
  1412. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  1413. }
  1414. newSelector = groups.join( "," );
  1415. // Expand context for sibling selectors
  1416. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1417. context;
  1418. }
  1419. if ( newSelector ) {
  1420. try {
  1421. push.apply( results,
  1422. newContext.querySelectorAll( newSelector )
  1423. );
  1424. return results;
  1425. } catch ( qsaError ) {
  1426. } finally {
  1427. if ( nid === expando ) {
  1428. context.removeAttribute( "id" );
  1429. }
  1430. }
  1431. }
  1432. }
  1433. }
  1434. }
  1435. // All others
  1436. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1437. }
  1438. /**
  1439. * Create key-value caches of limited size
  1440. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1441. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1442. * deleting the oldest entry
  1443. */
  1444. function createCache() {
  1445. var keys = [];
  1446. function cache( key, value ) {
  1447. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1448. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1449. // Only keep the most recent entries
  1450. delete cache[ keys.shift() ];
  1451. }
  1452. return (cache[ key + " " ] = value);
  1453. }
  1454. return cache;
  1455. }
  1456. /**
  1457. * Mark a function for special use by Sizzle
  1458. * @param {Function} fn The function to mark
  1459. */
  1460. function markFunction( fn ) {
  1461. fn[ expando ] = true;
  1462. return fn;
  1463. }
  1464. /**
  1465. * Support testing using an element
  1466. * @param {Function} fn Passed the created element and returns a boolean result
  1467. */
  1468. function assert( fn ) {
  1469. var el = document.createElement("fieldset");
  1470. try {
  1471. return !!fn( el );
  1472. } catch (e) {
  1473. return false;
  1474. } finally {
  1475. // Remove from its parent by default
  1476. if ( el.parentNode ) {
  1477. el.parentNode.removeChild( el );
  1478. }
  1479. // release memory in IE
  1480. el = null;
  1481. }
  1482. }
  1483. /**
  1484. * Adds the same handler for all of the specified attrs
  1485. * @param {String} attrs Pipe-separated list of attributes
  1486. * @param {Function} handler The method that will be applied
  1487. */
  1488. function addHandle( attrs, handler ) {
  1489. var arr = attrs.split("|"),
  1490. i = arr.length;
  1491. while ( i-- ) {
  1492. Expr.attrHandle[ arr[i] ] = handler;
  1493. }
  1494. }
  1495. /**
  1496. * Checks document order of two siblings
  1497. * @param {Element} a
  1498. * @param {Element} b
  1499. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1500. */
  1501. function siblingCheck( a, b ) {
  1502. var cur = b && a,
  1503. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1504. a.sourceIndex - b.sourceIndex;
  1505. // Use IE sourceIndex if available on both nodes
  1506. if ( diff ) {
  1507. return diff;
  1508. }
  1509. // Check if b follows a
  1510. if ( cur ) {
  1511. while ( (cur = cur.nextSibling) ) {
  1512. if ( cur === b ) {
  1513. return -1;
  1514. }
  1515. }
  1516. }
  1517. return a ? 1 : -1;
  1518. }
  1519. /**
  1520. * Returns a function to use in pseudos for input types
  1521. * @param {String} type
  1522. */
  1523. function createInputPseudo( type ) {
  1524. return function( elem ) {
  1525. var name = elem.nodeName.toLowerCase();
  1526. return name === "input" && elem.type === type;
  1527. };
  1528. }
  1529. /**
  1530. * Returns a function to use in pseudos for buttons
  1531. * @param {String} type
  1532. */
  1533. function createButtonPseudo( type ) {
  1534. return function( elem ) {
  1535. var name = elem.nodeName.toLowerCase();
  1536. return (name === "input" || name === "button") && elem.type === type;
  1537. };
  1538. }
  1539. /**
  1540. * Returns a function to use in pseudos for :enabled/:disabled
  1541. * @param {Boolean} disabled true for :disabled; false for :enabled
  1542. */
  1543. function createDisabledPseudo( disabled ) {
  1544. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1545. return function( elem ) {
  1546. // Only certain elements can match :enabled or :disabled
  1547. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1548. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1549. if ( "form" in elem ) {
  1550. // Check for inherited disabledness on relevant non-disabled elements:
  1551. // * listed form-associated elements in a disabled fieldset
  1552. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1553. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1554. // * option elements in a disabled optgroup
  1555. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1556. // All such elements have a "form" property.
  1557. if ( elem.parentNode && elem.disabled === false ) {
  1558. // Option elements defer to a parent optgroup if present
  1559. if ( "label" in elem ) {
  1560. if ( "label" in elem.parentNode ) {
  1561. return elem.parentNode.disabled === disabled;
  1562. } else {
  1563. return elem.disabled === disabled;
  1564. }
  1565. }
  1566. // Support: IE 6 - 11
  1567. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1568. return elem.isDisabled === disabled ||
  1569. // Where there is no isDisabled, check manually
  1570. /* jshint -W018 */
  1571. elem.isDisabled !== !disabled &&
  1572. disabledAncestor( elem ) === disabled;
  1573. }
  1574. return elem.disabled === disabled;
  1575. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1576. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1577. // even exist on them, let alone have a boolean value.
  1578. } else if ( "label" in elem ) {
  1579. return elem.disabled === disabled;
  1580. }
  1581. // Remaining elements are neither :enabled nor :disabled
  1582. return false;
  1583. };
  1584. }
  1585. /**
  1586. * Returns a function to use in pseudos for positionals
  1587. * @param {Function} fn
  1588. */
  1589. function createPositionalPseudo( fn ) {
  1590. return markFunction(function( argument ) {
  1591. argument = +argument;
  1592. return markFunction(function( seed, matches ) {
  1593. var j,
  1594. matchIndexes = fn( [], seed.length, argument ),
  1595. i = matchIndexes.length;
  1596. // Match elements found at the specified indexes
  1597. while ( i-- ) {
  1598. if ( seed[ (j = matchIndexes[i]) ] ) {
  1599. seed[j] = !(matches[j] = seed[j]);
  1600. }
  1601. }
  1602. });
  1603. });
  1604. }
  1605. /**
  1606. * Checks a node for validity as a Sizzle context
  1607. * @param {Element|Object=} context
  1608. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1609. */
  1610. function testContext( context ) {
  1611. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1612. }
  1613. // Expose support vars for convenience
  1614. support = Sizzle.support = {};
  1615. /**
  1616. * Detects XML nodes
  1617. * @param {Element|Object} elem An element or a document
  1618. * @returns {Boolean} True iff elem is a non-HTML XML node
  1619. */
  1620. isXML = Sizzle.isXML = function( elem ) {
  1621. // documentElement is verified for cases where it doesn't yet exist
  1622. // (such as loading iframes in IE - #4833)
  1623. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  1624. return documentElement ? documentElement.nodeName !== "HTML" : false;
  1625. };
  1626. /**
  1627. * Sets document-related variables once based on the current document
  1628. * @param {Element|Object} [doc] An element or document object to use to set the document
  1629. * @returns {Object} Returns the current document
  1630. */
  1631. setDocument = Sizzle.setDocument = function( node ) {
  1632. var hasCompare, subWindow,
  1633. doc = node ? node.ownerDocument || node : preferredDoc;
  1634. // Return early if doc is invalid or already selected
  1635. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1636. return document;
  1637. }
  1638. // Update global variables
  1639. document = doc;
  1640. docElem = document.documentElement;
  1641. documentIsHTML = !isXML( document );
  1642. // Support: IE 9-11, Edge
  1643. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  1644. if ( preferredDoc !== document &&
  1645. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  1646. // Support: IE 11, Edge
  1647. if ( subWindow.addEventListener ) {
  1648. subWindow.addEventListener( "unload", unloadHandler, false );
  1649. // Support: IE 9 - 10 only
  1650. } else if ( subWindow.attachEvent ) {
  1651. subWindow.attachEvent( "onunload", unloadHandler );
  1652. }
  1653. }
  1654. /* Attributes
  1655. ---------------------------------------------------------------------- */
  1656. // Support: IE<8
  1657. // Verify that getAttribute really returns attributes and not properties
  1658. // (excepting IE8 booleans)
  1659. support.attributes = assert(function( el ) {
  1660. el.className = "i";
  1661. return !el.getAttribute("className");
  1662. });
  1663. /* getElement(s)By*
  1664. ---------------------------------------------------------------------- */
  1665. // Check if getElementsByTagName("*") returns only elements
  1666. support.getElementsByTagName = assert(function( el ) {
  1667. el.appendChild( document.createComment("") );
  1668. return !el.getElementsByTagName("*").length;
  1669. });
  1670. // Support: IE<9
  1671. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  1672. // Support: IE<10
  1673. // Check if getElementById returns elements by name
  1674. // The broken getElementById methods don't pick up programmatically-set names,
  1675. // so use a roundabout getElementsByName test
  1676. support.getById = assert(function( el ) {
  1677. docElem.appendChild( el ).id = expando;
  1678. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  1679. });
  1680. // ID filter and find
  1681. if ( support.getById ) {
  1682. Expr.filter["ID"] = function( id ) {
  1683. var attrId = id.replace( runescape, funescape );
  1684. return function( elem ) {
  1685. return elem.getAttribute("id") === attrId;
  1686. };
  1687. };
  1688. Expr.find["ID"] = function( id, context ) {
  1689. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1690. var elem = context.getElementById( id );
  1691. return elem ? [ elem ] : [];
  1692. }
  1693. };
  1694. } else {
  1695. Expr.filter["ID"] = function( id ) {
  1696. var attrId = id.replace( runescape, funescape );
  1697. return function( elem ) {
  1698. var node = typeof elem.getAttributeNode !== "undefined" &&
  1699. elem.getAttributeNode("id");
  1700. return node && node.value === attrId;
  1701. };
  1702. };
  1703. // Support: IE 6 - 7 only
  1704. // getElementById is not reliable as a find shortcut
  1705. Expr.find["ID"] = function( id, context ) {
  1706. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1707. var node, i, elems,
  1708. elem = context.getElementById( id );
  1709. if ( elem ) {
  1710. // Verify the id attribute
  1711. node = elem.getAttributeNode("id");
  1712. if ( node && node.value === id ) {
  1713. return [ elem ];
  1714. }
  1715. // Fall back on getElementsByName
  1716. elems = context.getElementsByName( id );
  1717. i = 0;
  1718. while ( (elem = elems[i++]) ) {
  1719. node = elem.getAttributeNode("id");
  1720. if ( node && node.value === id ) {
  1721. return [ elem ];
  1722. }
  1723. }
  1724. }
  1725. return [];
  1726. }
  1727. };
  1728. }
  1729. // Tag
  1730. Expr.find["TAG"] = support.getElementsByTagName ?
  1731. function( tag, context ) {
  1732. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1733. return context.getElementsByTagName( tag );
  1734. // DocumentFragment nodes don't have gEBTN
  1735. } else if ( support.qsa ) {
  1736. return context.querySelectorAll( tag );
  1737. }
  1738. } :
  1739. function( tag, context ) {
  1740. var elem,
  1741. tmp = [],
  1742. i = 0,
  1743. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1744. results = context.getElementsByTagName( tag );
  1745. // Filter out possible comments
  1746. if ( tag === "*" ) {
  1747. while ( (elem = results[i++]) ) {
  1748. if ( elem.nodeType === 1 ) {
  1749. tmp.push( elem );
  1750. }
  1751. }
  1752. return tmp;
  1753. }
  1754. return results;
  1755. };
  1756. // Class
  1757. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1758. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1759. return context.getElementsByClassName( className );
  1760. }
  1761. };
  1762. /* QSA/matchesSelector
  1763. ---------------------------------------------------------------------- */
  1764. // QSA and matchesSelector support
  1765. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1766. rbuggyMatches = [];
  1767. // qSa(:focus) reports false when true (Chrome 21)
  1768. // We allow this because of a bug in IE8/9 that throws an error
  1769. // whenever `document.activeElement` is accessed on an iframe
  1770. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1771. // See https://bugs.jquery.com/ticket/13378
  1772. rbuggyQSA = [];
  1773. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1774. // Build QSA regex
  1775. // Regex strategy adopted from Diego Perini
  1776. assert(function( el ) {
  1777. // Select is set to empty string on purpose
  1778. // This is to test IE's treatment of not explicitly
  1779. // setting a boolean content attribute,
  1780. // since its presence should be enough
  1781. // https://bugs.jquery.com/ticket/12359
  1782. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1783. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1784. "<option selected=''></option></select>";
  1785. // Support: IE8, Opera 11-12.16
  1786. // Nothing should be selected when empty strings follow ^= or $= or *=
  1787. // The test attribute must be unknown in Opera but "safe" for WinRT
  1788. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1789. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1790. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1791. }
  1792. // Support: IE8
  1793. // Boolean attributes and "value" are not treated correctly
  1794. if ( !el.querySelectorAll("[selected]").length ) {
  1795. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1796. }
  1797. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1798. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1799. rbuggyQSA.push("~=");
  1800. }
  1801. // Webkit/Opera - :checked should return selected option elements
  1802. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1803. // IE8 throws error here and will not see later tests
  1804. if ( !el.querySelectorAll(":checked").length ) {
  1805. rbuggyQSA.push(":checked");
  1806. }
  1807. // Support: Safari 8+, iOS 8+
  1808. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1809. // In-page `selector#id sibling-combinator selector` fails
  1810. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1811. rbuggyQSA.push(".#.+[+~]");
  1812. }
  1813. });
  1814. assert(function( el ) {
  1815. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1816. "<select disabled='disabled'><option/></select>";
  1817. // Support: Windows 8 Native Apps
  1818. // The type and name attributes are restricted during .innerHTML assignment
  1819. var input = document.createElement("input");
  1820. input.setAttribute( "type", "hidden" );
  1821. el.appendChild( input ).setAttribute( "name", "D" );
  1822. // Support: IE8
  1823. // Enforce case-sensitivity of name attribute
  1824. if ( el.querySelectorAll("[name=d]").length ) {
  1825. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1826. }
  1827. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1828. // IE8 throws error here and will not see later tests
  1829. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1830. rbuggyQSA.push( ":enabled", ":disabled" );
  1831. }
  1832. // Support: IE9-11+
  1833. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1834. docElem.appendChild( el ).disabled = true;
  1835. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1836. rbuggyQSA.push( ":enabled", ":disabled" );
  1837. }
  1838. // Opera 10-11 does not throw on post-comma invalid pseudos
  1839. el.querySelectorAll("*,:x");
  1840. rbuggyQSA.push(",.*:");
  1841. });
  1842. }
  1843. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1844. docElem.webkitMatchesSelector ||
  1845. docElem.mozMatchesSelector ||
  1846. docElem.oMatchesSelector ||
  1847. docElem.msMatchesSelector) )) ) {
  1848. assert(function( el ) {
  1849. // Check to see if it's possible to do matchesSelector
  1850. // on a disconnected node (IE 9)
  1851. support.disconnectedMatch = matches.call( el, "*" );
  1852. // This should fail with an exception
  1853. // Gecko does not error, returns false instead
  1854. matches.call( el, "[s!='']:x" );
  1855. rbuggyMatches.push( "!=", pseudos );
  1856. });
  1857. }
  1858. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1859. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1860. /* Contains
  1861. ---------------------------------------------------------------------- */
  1862. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1863. // Element contains another
  1864. // Purposefully self-exclusive
  1865. // As in, an element does not contain itself
  1866. contains = hasCompare || rnative.test( docElem.contains ) ?
  1867. function( a, b ) {
  1868. var adown = a.nodeType === 9 ? a.documentElement : a,
  1869. bup = b && b.parentNode;
  1870. return a === bup || !!( bup && bup.nodeType === 1 && (
  1871. adown.contains ?
  1872. adown.contains( bup ) :
  1873. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1874. ));
  1875. } :
  1876. function( a, b ) {
  1877. if ( b ) {
  1878. while ( (b = b.parentNode) ) {
  1879. if ( b === a ) {
  1880. return true;
  1881. }
  1882. }
  1883. }
  1884. return false;
  1885. };
  1886. /* Sorting
  1887. ---------------------------------------------------------------------- */
  1888. // Document order sorting
  1889. sortOrder = hasCompare ?
  1890. function( a, b ) {
  1891. // Flag for duplicate removal
  1892. if ( a === b ) {
  1893. hasDuplicate = true;
  1894. return 0;
  1895. }
  1896. // Sort on method existence if only one input has compareDocumentPosition
  1897. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1898. if ( compare ) {
  1899. return compare;
  1900. }
  1901. // Calculate position if both inputs belong to the same document
  1902. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1903. a.compareDocumentPosition( b ) :
  1904. // Otherwise we know they are disconnected
  1905. 1;
  1906. // Disconnected nodes
  1907. if ( compare & 1 ||
  1908. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1909. // Choose the first element that is related to our preferred document
  1910. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1911. return -1;
  1912. }
  1913. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1914. return 1;
  1915. }
  1916. // Maintain original order
  1917. return sortInput ?
  1918. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1919. 0;
  1920. }
  1921. return compare & 4 ? -1 : 1;
  1922. } :
  1923. function( a, b ) {
  1924. // Exit early if the nodes are identical
  1925. if ( a === b ) {
  1926. hasDuplicate = true;
  1927. return 0;
  1928. }
  1929. var cur,
  1930. i = 0,
  1931. aup = a.parentNode,
  1932. bup = b.parentNode,
  1933. ap = [ a ],
  1934. bp = [ b ];
  1935. // Parentless nodes are either documents or disconnected
  1936. if ( !aup || !bup ) {
  1937. return a === document ? -1 :
  1938. b === document ? 1 :
  1939. aup ? -1 :
  1940. bup ? 1 :
  1941. sortInput ?
  1942. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1943. 0;
  1944. // If the nodes are siblings, we can do a quick check
  1945. } else if ( aup === bup ) {
  1946. return siblingCheck( a, b );
  1947. }
  1948. // Otherwise we need full lists of their ancestors for comparison
  1949. cur = a;
  1950. while ( (cur = cur.parentNode) ) {
  1951. ap.unshift( cur );
  1952. }
  1953. cur = b;
  1954. while ( (cur = cur.parentNode) ) {
  1955. bp.unshift( cur );
  1956. }
  1957. // Walk down the tree looking for a discrepancy
  1958. while ( ap[i] === bp[i] ) {
  1959. i++;
  1960. }
  1961. return i ?
  1962. // Do a sibling check if the nodes have a common ancestor
  1963. siblingCheck( ap[i], bp[i] ) :
  1964. // Otherwise nodes in our document sort first
  1965. ap[i] === preferredDoc ? -1 :
  1966. bp[i] === preferredDoc ? 1 :
  1967. 0;
  1968. };
  1969. return document;
  1970. };
  1971. Sizzle.matches = function( expr, elements ) {
  1972. return Sizzle( expr, null, null, elements );
  1973. };
  1974. Sizzle.matchesSelector = function( elem, expr ) {
  1975. // Set document vars if needed
  1976. if ( ( elem.ownerDocument || elem ) !== document ) {
  1977. setDocument( elem );
  1978. }
  1979. // Make sure that attribute selectors are quoted
  1980. expr = expr.replace( rattributeQuotes, "='$1']" );
  1981. if ( support.matchesSelector && documentIsHTML &&
  1982. !compilerCache[ expr + " " ] &&
  1983. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1984. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1985. try {
  1986. var ret = matches.call( elem, expr );
  1987. // IE 9's matchesSelector returns false on disconnected nodes
  1988. if ( ret || support.disconnectedMatch ||
  1989. // As well, disconnected nodes are said to be in a document
  1990. // fragment in IE 9
  1991. elem.document && elem.document.nodeType !== 11 ) {
  1992. return ret;
  1993. }
  1994. } catch (e) {}
  1995. }
  1996. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1997. };
  1998. Sizzle.contains = function( context, elem ) {
  1999. // Set document vars if needed
  2000. if ( ( context.ownerDocument || context ) !== document ) {
  2001. setDocument( context );
  2002. }
  2003. return contains( context, elem );
  2004. };
  2005. Sizzle.attr = function( elem, name ) {
  2006. // Set document vars if needed
  2007. if ( ( elem.ownerDocument || elem ) !== document ) {
  2008. setDocument( elem );
  2009. }
  2010. var fn = Expr.attrHandle[ name.toLowerCase() ],
  2011. // Don't get fooled by Object.prototype properties (jQuery #13807)
  2012. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  2013. fn( elem, name, !documentIsHTML ) :
  2014. undefined;
  2015. return val !== undefined ?
  2016. val :
  2017. support.attributes || !documentIsHTML ?
  2018. elem.getAttribute( name ) :
  2019. (val = elem.getAttributeNode(name)) && val.specified ?
  2020. val.value :
  2021. null;
  2022. };
  2023. Sizzle.escape = function( sel ) {
  2024. return (sel + "").replace( rcssescape, fcssescape );
  2025. };
  2026. Sizzle.error = function( msg ) {
  2027. throw new Error( "Syntax error, unrecognized expression: " + msg );
  2028. };
  2029. /**
  2030. * Document sorting and removing duplicates
  2031. * @param {ArrayLike} results
  2032. */
  2033. Sizzle.uniqueSort = function( results ) {
  2034. var elem,
  2035. duplicates = [],
  2036. j = 0,
  2037. i = 0;
  2038. // Unless we *know* we can detect duplicates, assume their presence
  2039. hasDuplicate = !support.detectDuplicates;
  2040. sortInput = !support.sortStable && results.slice( 0 );
  2041. results.sort( sortOrder );
  2042. if ( hasDuplicate ) {
  2043. while ( (elem = results[i++]) ) {
  2044. if ( elem === results[ i ] ) {
  2045. j = duplicates.push( i );
  2046. }
  2047. }
  2048. while ( j-- ) {
  2049. results.splice( duplicates[ j ], 1 );
  2050. }
  2051. }
  2052. // Clear input after sorting to release objects
  2053. // See https://github.com/jquery/sizzle/pull/225
  2054. sortInput = null;
  2055. return results;
  2056. };
  2057. /**
  2058. * Utility function for retrieving the text value of an array of DOM nodes
  2059. * @param {Array|Element} elem
  2060. */
  2061. getText = Sizzle.getText = function( elem ) {
  2062. var node,
  2063. ret = "",
  2064. i = 0,
  2065. nodeType = elem.nodeType;
  2066. if ( !nodeType ) {
  2067. // If no nodeType, this is expected to be an array
  2068. while ( (node = elem[i++]) ) {
  2069. // Do not traverse comment nodes
  2070. ret += getText( node );
  2071. }
  2072. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  2073. // Use textContent for elements
  2074. // innerText usage removed for consistency of new lines (jQuery #11153)
  2075. if ( typeof elem.textContent === "string" ) {
  2076. return elem.textContent;
  2077. } else {
  2078. // Traverse its children
  2079. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2080. ret += getText( elem );
  2081. }
  2082. }
  2083. } else if ( nodeType === 3 || nodeType === 4 ) {
  2084. return elem.nodeValue;
  2085. }
  2086. // Do not include comment or processing instruction nodes
  2087. return ret;
  2088. };
  2089. Expr = Sizzle.selectors = {
  2090. // Can be adjusted by the user
  2091. cacheLength: 50,
  2092. createPseudo: markFunction,
  2093. match: matchExpr,
  2094. attrHandle: {},
  2095. find: {},
  2096. relative: {
  2097. ">": { dir: "parentNode", first: true },
  2098. " ": { dir: "parentNode" },
  2099. "+": { dir: "previousSibling", first: true },
  2100. "~": { dir: "previousSibling" }
  2101. },
  2102. preFilter: {
  2103. "ATTR": function( match ) {
  2104. match[1] = match[1].replace( runescape, funescape );
  2105. // Move the given value to match[3] whether quoted or unquoted
  2106. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2107. if ( match[2] === "~=" ) {
  2108. match[3] = " " + match[3] + " ";
  2109. }
  2110. return match.slice( 0, 4 );
  2111. },
  2112. "CHILD": function( match ) {
  2113. /* matches from matchExpr["CHILD"]
  2114. 1 type (only|nth|...)
  2115. 2 what (child|of-type)
  2116. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2117. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2118. 5 sign of xn-component
  2119. 6 x of xn-component
  2120. 7 sign of y-component
  2121. 8 y of y-component
  2122. */
  2123. match[1] = match[1].toLowerCase();
  2124. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2125. // nth-* requires argument
  2126. if ( !match[3] ) {
  2127. Sizzle.error( match[0] );
  2128. }
  2129. // numeric x and y parameters for Expr.filter.CHILD
  2130. // remember that false/true cast respectively to 0/1
  2131. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2132. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2133. // other types prohibit arguments
  2134. } else if ( match[3] ) {
  2135. Sizzle.error( match[0] );
  2136. }
  2137. return match;
  2138. },
  2139. "PSEUDO": function( match ) {
  2140. var excess,
  2141. unquoted = !match[6] && match[2];
  2142. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2143. return null;
  2144. }
  2145. // Accept quoted arguments as-is
  2146. if ( match[3] ) {
  2147. match[2] = match[4] || match[5] || "";
  2148. // Strip excess characters from unquoted arguments
  2149. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2150. // Get excess from tokenize (recursively)
  2151. (excess = tokenize( unquoted, true )) &&
  2152. // advance to the next closing parenthesis
  2153. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2154. // excess is a negative index
  2155. match[0] = match[0].slice( 0, excess );
  2156. match[2] = unquoted.slice( 0, excess );
  2157. }
  2158. // Return only captures needed by the pseudo filter method (type and argument)
  2159. return match.slice( 0, 3 );
  2160. }
  2161. },
  2162. filter: {
  2163. "TAG": function( nodeNameSelector ) {
  2164. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2165. return nodeNameSelector === "*" ?
  2166. function() { return true; } :
  2167. function( elem ) {
  2168. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2169. };
  2170. },
  2171. "CLASS": function( className ) {
  2172. var pattern = classCache[ className + " " ];
  2173. return pattern ||
  2174. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2175. classCache( className, function( elem ) {
  2176. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2177. });
  2178. },
  2179. "ATTR": function( name, operator, check ) {
  2180. return function( elem ) {
  2181. var result = Sizzle.attr( elem, name );
  2182. if ( result == null ) {
  2183. return operator === "!=";
  2184. }
  2185. if ( !operator ) {
  2186. return true;
  2187. }
  2188. result += "";
  2189. return operator === "=" ? result === check :
  2190. operator === "!=" ? result !== check :
  2191. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2192. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2193. operator === "$=" ? check && result.slice( -check.length ) === check :
  2194. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2195. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2196. false;
  2197. };
  2198. },
  2199. "CHILD": function( type, what, argument, first, last ) {
  2200. var simple = type.slice( 0, 3 ) !== "nth",
  2201. forward = type.slice( -4 ) !== "last",
  2202. ofType = what === "of-type";
  2203. return first === 1 && last === 0 ?
  2204. // Shortcut for :nth-*(n)
  2205. function( elem ) {
  2206. return !!elem.parentNode;
  2207. } :
  2208. function( elem, context, xml ) {
  2209. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2210. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2211. parent = elem.parentNode,
  2212. name = ofType && elem.nodeName.toLowerCase(),
  2213. useCache = !xml && !ofType,
  2214. diff = false;
  2215. if ( parent ) {
  2216. // :(first|last|only)-(child|of-type)
  2217. if ( simple ) {
  2218. while ( dir ) {
  2219. node = elem;
  2220. while ( (node = node[ dir ]) ) {
  2221. if ( ofType ?
  2222. node.nodeName.toLowerCase() === name :
  2223. node.nodeType === 1 ) {
  2224. return false;
  2225. }
  2226. }
  2227. // Reverse direction for :only-* (if we haven't yet done so)
  2228. start = dir = type === "only" && !start && "nextSibling";
  2229. }
  2230. return true;
  2231. }
  2232. start = [ forward ? parent.firstChild : parent.lastChild ];
  2233. // non-xml :nth-child(...) stores cache data on `parent`
  2234. if ( forward && useCache ) {
  2235. // Seek `elem` from a previously-cached index
  2236. // ...in a gzip-friendly way
  2237. node = parent;
  2238. outerCache = node[ expando ] || (node[ expando ] = {});
  2239. // Support: IE <9 only
  2240. // Defend against cloned attroperties (jQuery gh-1709)
  2241. uniqueCache = outerCache[ node.uniqueID ] ||
  2242. (outerCache[ node.uniqueID ] = {});
  2243. cache = uniqueCache[ type ] || [];
  2244. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2245. diff = nodeIndex && cache[ 2 ];
  2246. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2247. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2248. // Fallback to seeking `elem` from the start
  2249. (diff = nodeIndex = 0) || start.pop()) ) {
  2250. // When found, cache indexes on `parent` and break
  2251. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2252. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2253. break;
  2254. }
  2255. }
  2256. } else {
  2257. // Use previously-cached element index if available
  2258. if ( useCache ) {
  2259. // ...in a gzip-friendly way
  2260. node = elem;
  2261. outerCache = node[ expando ] || (node[ expando ] = {});
  2262. // Support: IE <9 only
  2263. // Defend against cloned attroperties (jQuery gh-1709)
  2264. uniqueCache = outerCache[ node.uniqueID ] ||
  2265. (outerCache[ node.uniqueID ] = {});
  2266. cache = uniqueCache[ type ] || [];
  2267. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2268. diff = nodeIndex;
  2269. }
  2270. // xml :nth-child(...)
  2271. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2272. if ( diff === false ) {
  2273. // Use the same loop as above to seek `elem` from the start
  2274. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2275. (diff = nodeIndex = 0) || start.pop()) ) {
  2276. if ( ( ofType ?
  2277. node.nodeName.toLowerCase() === name :
  2278. node.nodeType === 1 ) &&
  2279. ++diff ) {
  2280. // Cache the index of each encountered element
  2281. if ( useCache ) {
  2282. outerCache = node[ expando ] || (node[ expando ] = {});
  2283. // Support: IE <9 only
  2284. // Defend against cloned attroperties (jQuery gh-1709)
  2285. uniqueCache = outerCache[ node.uniqueID ] ||
  2286. (outerCache[ node.uniqueID ] = {});
  2287. uniqueCache[ type ] = [ dirruns, diff ];
  2288. }
  2289. if ( node === elem ) {
  2290. break;
  2291. }
  2292. }
  2293. }
  2294. }
  2295. }
  2296. // Incorporate the offset, then check against cycle size
  2297. diff -= last;
  2298. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2299. }
  2300. };
  2301. },
  2302. "PSEUDO": function( pseudo, argument ) {
  2303. // pseudo-class names are case-insensitive
  2304. // http://www.w3.org/TR/selectors/#pseudo-classes
  2305. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2306. // Remember that setFilters inherits from pseudos
  2307. var args,
  2308. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2309. Sizzle.error( "unsupported pseudo: " + pseudo );
  2310. // The user may use createPseudo to indicate that
  2311. // arguments are needed to create the filter function
  2312. // just as Sizzle does
  2313. if ( fn[ expando ] ) {
  2314. return fn( argument );
  2315. }
  2316. // But maintain support for old signatures
  2317. if ( fn.length > 1 ) {
  2318. args = [ pseudo, pseudo, "", argument ];
  2319. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2320. markFunction(function( seed, matches ) {
  2321. var idx,
  2322. matched = fn( seed, argument ),
  2323. i = matched.length;
  2324. while ( i-- ) {
  2325. idx = indexOf( seed, matched[i] );
  2326. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2327. }
  2328. }) :
  2329. function( elem ) {
  2330. return fn( elem, 0, args );
  2331. };
  2332. }
  2333. return fn;
  2334. }
  2335. },
  2336. pseudos: {
  2337. // Potentially complex pseudos
  2338. "not": markFunction(function( selector ) {
  2339. // Trim the selector passed to compile
  2340. // to avoid treating leading and trailing
  2341. // spaces as combinators
  2342. var input = [],
  2343. results = [],
  2344. matcher = compile( selector.replace( rtrim, "$1" ) );
  2345. return matcher[ expando ] ?
  2346. markFunction(function( seed, matches, context, xml ) {
  2347. var elem,
  2348. unmatched = matcher( seed, null, xml, [] ),
  2349. i = seed.length;
  2350. // Match elements unmatched by `matcher`
  2351. while ( i-- ) {
  2352. if ( (elem = unmatched[i]) ) {
  2353. seed[i] = !(matches[i] = elem);
  2354. }
  2355. }
  2356. }) :
  2357. function( elem, context, xml ) {
  2358. input[0] = elem;
  2359. matcher( input, null, xml, results );
  2360. // Don't keep the element (issue #299)
  2361. input[0] = null;
  2362. return !results.pop();
  2363. };
  2364. }),
  2365. "has": markFunction(function( selector ) {
  2366. return function( elem ) {
  2367. return Sizzle( selector, elem ).length > 0;
  2368. };
  2369. }),
  2370. "contains": markFunction(function( text ) {
  2371. text = text.replace( runescape, funescape );
  2372. return function( elem ) {
  2373. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  2374. };
  2375. }),
  2376. // "Whether an element is represented by a :lang() selector
  2377. // is based solely on the element's language value
  2378. // being equal to the identifier C,
  2379. // or beginning with the identifier C immediately followed by "-".
  2380. // The matching of C against the element's language value is performed case-insensitively.
  2381. // The identifier C does not have to be a valid language name."
  2382. // http://www.w3.org/TR/selectors/#lang-pseudo
  2383. "lang": markFunction( function( lang ) {
  2384. // lang value must be a valid identifier
  2385. if ( !ridentifier.test(lang || "") ) {
  2386. Sizzle.error( "unsupported lang: " + lang );
  2387. }
  2388. lang = lang.replace( runescape, funescape ).toLowerCase();
  2389. return function( elem ) {
  2390. var elemLang;
  2391. do {
  2392. if ( (elemLang = documentIsHTML ?
  2393. elem.lang :
  2394. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2395. elemLang = elemLang.toLowerCase();
  2396. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2397. }
  2398. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2399. return false;
  2400. };
  2401. }),
  2402. // Miscellaneous
  2403. "target": function( elem ) {
  2404. var hash = window.location && window.location.hash;
  2405. return hash && hash.slice( 1 ) === elem.id;
  2406. },
  2407. "root": function( elem ) {
  2408. return elem === docElem;
  2409. },
  2410. "focus": function( elem ) {
  2411. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2412. },
  2413. // Boolean properties
  2414. "enabled": createDisabledPseudo( false ),
  2415. "disabled": createDisabledPseudo( true ),
  2416. "checked": function( elem ) {
  2417. // In CSS3, :checked should return both checked and selected elements
  2418. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2419. var nodeName = elem.nodeName.toLowerCase();
  2420. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2421. },
  2422. "selected": function( elem ) {
  2423. // Accessing this property makes selected-by-default
  2424. // options in Safari work properly
  2425. if ( elem.parentNode ) {
  2426. elem.parentNode.selectedIndex;
  2427. }
  2428. return elem.selected === true;
  2429. },
  2430. // Contents
  2431. "empty": function( elem ) {
  2432. // http://www.w3.org/TR/selectors/#empty-pseudo
  2433. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2434. // but not by others (comment: 8; processing instruction: 7; etc.)
  2435. // nodeType < 6 works because attributes (2) do not appear as children
  2436. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2437. if ( elem.nodeType < 6 ) {
  2438. return false;
  2439. }
  2440. }
  2441. return true;
  2442. },
  2443. "parent": function( elem ) {
  2444. return !Expr.pseudos["empty"]( elem );
  2445. },
  2446. // Element/input types
  2447. "header": function( elem ) {
  2448. return rheader.test( elem.nodeName );
  2449. },
  2450. "input": function( elem ) {
  2451. return rinputs.test( elem.nodeName );
  2452. },
  2453. "button": function( elem ) {
  2454. var name = elem.nodeName.toLowerCase();
  2455. return name === "input" && elem.type === "button" || name === "button";
  2456. },
  2457. "text": function( elem ) {
  2458. var attr;
  2459. return elem.nodeName.toLowerCase() === "input" &&
  2460. elem.type === "text" &&
  2461. // Support: IE<8
  2462. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  2463. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  2464. },
  2465. // Position-in-collection
  2466. "first": createPositionalPseudo(function() {
  2467. return [ 0 ];
  2468. }),
  2469. "last": createPositionalPseudo(function( matchIndexes, length ) {
  2470. return [ length - 1 ];
  2471. }),
  2472. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2473. return [ argument < 0 ? argument + length : argument ];
  2474. }),
  2475. "even": createPositionalPseudo(function( matchIndexes, length ) {
  2476. var i = 0;
  2477. for ( ; i < length; i += 2 ) {
  2478. matchIndexes.push( i );
  2479. }
  2480. return matchIndexes;
  2481. }),
  2482. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  2483. var i = 1;
  2484. for ( ; i < length; i += 2 ) {
  2485. matchIndexes.push( i );
  2486. }
  2487. return matchIndexes;
  2488. }),
  2489. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2490. var i = argument < 0 ? argument + length : argument;
  2491. for ( ; --i >= 0; ) {
  2492. matchIndexes.push( i );
  2493. }
  2494. return matchIndexes;
  2495. }),
  2496. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2497. var i = argument < 0 ? argument + length : argument;
  2498. for ( ; ++i < length; ) {
  2499. matchIndexes.push( i );
  2500. }
  2501. return matchIndexes;
  2502. })
  2503. }
  2504. };
  2505. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2506. // Add button/input type pseudos
  2507. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2508. Expr.pseudos[ i ] = createInputPseudo( i );
  2509. }
  2510. for ( i in { submit: true, reset: true } ) {
  2511. Expr.pseudos[ i ] = createButtonPseudo( i );
  2512. }
  2513. // Easy API for creating new setFilters
  2514. function setFilters() {}
  2515. setFilters.prototype = Expr.filters = Expr.pseudos;
  2516. Expr.setFilters = new setFilters();
  2517. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  2518. var matched, match, tokens, type,
  2519. soFar, groups, preFilters,
  2520. cached = tokenCache[ selector + " " ];
  2521. if ( cached ) {
  2522. return parseOnly ? 0 : cached.slice( 0 );
  2523. }
  2524. soFar = selector;
  2525. groups = [];
  2526. preFilters = Expr.preFilter;
  2527. while ( soFar ) {
  2528. // Comma and first run
  2529. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2530. if ( match ) {
  2531. // Don't consume trailing commas as valid
  2532. soFar = soFar.slice( match[0].length ) || soFar;
  2533. }
  2534. groups.push( (tokens = []) );
  2535. }
  2536. matched = false;
  2537. // Combinators
  2538. if ( (match = rcombinators.exec( soFar )) ) {
  2539. matched = match.shift();
  2540. tokens.push({
  2541. value: matched,
  2542. // Cast descendant combinators to space
  2543. type: match[0].replace( rtrim, " " )
  2544. });
  2545. soFar = soFar.slice( matched.length );
  2546. }
  2547. // Filters
  2548. for ( type in Expr.filter ) {
  2549. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2550. (match = preFilters[ type ]( match ))) ) {
  2551. matched = match.shift();
  2552. tokens.push({
  2553. value: matched,
  2554. type: type,
  2555. matches: match
  2556. });
  2557. soFar = soFar.slice( matched.length );
  2558. }
  2559. }
  2560. if ( !matched ) {
  2561. break;
  2562. }
  2563. }
  2564. // Return the length of the invalid excess
  2565. // if we're just parsing
  2566. // Otherwise, throw an error or return tokens
  2567. return parseOnly ?
  2568. soFar.length :
  2569. soFar ?
  2570. Sizzle.error( selector ) :
  2571. // Cache the tokens
  2572. tokenCache( selector, groups ).slice( 0 );
  2573. };
  2574. function toSelector( tokens ) {
  2575. var i = 0,
  2576. len = tokens.length,
  2577. selector = "";
  2578. for ( ; i < len; i++ ) {
  2579. selector += tokens[i].value;
  2580. }
  2581. return selector;
  2582. }
  2583. function addCombinator( matcher, combinator, base ) {
  2584. var dir = combinator.dir,
  2585. skip = combinator.next,
  2586. key = skip || dir,
  2587. checkNonElements = base && key === "parentNode",
  2588. doneName = done++;
  2589. return combinator.first ?
  2590. // Check against closest ancestor/preceding element
  2591. function( elem, context, xml ) {
  2592. while ( (elem = elem[ dir ]) ) {
  2593. if ( elem.nodeType === 1 || checkNonElements ) {
  2594. return matcher( elem, context, xml );
  2595. }
  2596. }
  2597. return false;
  2598. } :
  2599. // Check against all ancestor/preceding elements
  2600. function( elem, context, xml ) {
  2601. var oldCache, uniqueCache, outerCache,
  2602. newCache = [ dirruns, doneName ];
  2603. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2604. if ( xml ) {
  2605. while ( (elem = elem[ dir ]) ) {
  2606. if ( elem.nodeType === 1 || checkNonElements ) {
  2607. if ( matcher( elem, context, xml ) ) {
  2608. return true;
  2609. }
  2610. }
  2611. }
  2612. } else {
  2613. while ( (elem = elem[ dir ]) ) {
  2614. if ( elem.nodeType === 1 || checkNonElements ) {
  2615. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2616. // Support: IE <9 only
  2617. // Defend against cloned attroperties (jQuery gh-1709)
  2618. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  2619. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  2620. elem = elem[ dir ] || elem;
  2621. } else if ( (oldCache = uniqueCache[ key ]) &&
  2622. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2623. // Assign to newCache so results back-propagate to previous elements
  2624. return (newCache[ 2 ] = oldCache[ 2 ]);
  2625. } else {
  2626. // Reuse newcache so results back-propagate to previous elements
  2627. uniqueCache[ key ] = newCache;
  2628. // A match means we're done; a fail means we have to keep checking
  2629. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2630. return true;
  2631. }
  2632. }
  2633. }
  2634. }
  2635. }
  2636. return false;
  2637. };
  2638. }
  2639. function elementMatcher( matchers ) {
  2640. return matchers.length > 1 ?
  2641. function( elem, context, xml ) {
  2642. var i = matchers.length;
  2643. while ( i-- ) {
  2644. if ( !matchers[i]( elem, context, xml ) ) {
  2645. return false;
  2646. }
  2647. }
  2648. return true;
  2649. } :
  2650. matchers[0];
  2651. }
  2652. function multipleContexts( selector, contexts, results ) {
  2653. var i = 0,
  2654. len = contexts.length;
  2655. for ( ; i < len; i++ ) {
  2656. Sizzle( selector, contexts[i], results );
  2657. }
  2658. return results;
  2659. }
  2660. function condense( unmatched, map, filter, context, xml ) {
  2661. var elem,
  2662. newUnmatched = [],
  2663. i = 0,
  2664. len = unmatched.length,
  2665. mapped = map != null;
  2666. for ( ; i < len; i++ ) {
  2667. if ( (elem = unmatched[i]) ) {
  2668. if ( !filter || filter( elem, context, xml ) ) {
  2669. newUnmatched.push( elem );
  2670. if ( mapped ) {
  2671. map.push( i );
  2672. }
  2673. }
  2674. }
  2675. }
  2676. return newUnmatched;
  2677. }
  2678. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2679. if ( postFilter && !postFilter[ expando ] ) {
  2680. postFilter = setMatcher( postFilter );
  2681. }
  2682. if ( postFinder && !postFinder[ expando ] ) {
  2683. postFinder = setMatcher( postFinder, postSelector );
  2684. }
  2685. return markFunction(function( seed, results, context, xml ) {
  2686. var temp, i, elem,
  2687. preMap = [],
  2688. postMap = [],
  2689. preexisting = results.length,
  2690. // Get initial elements from seed or context
  2691. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2692. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2693. matcherIn = preFilter && ( seed || !selector ) ?
  2694. condense( elems, preMap, preFilter, context, xml ) :
  2695. elems,
  2696. matcherOut = matcher ?
  2697. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2698. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2699. // ...intermediate processing is necessary
  2700. [] :
  2701. // ...otherwise use results directly
  2702. results :
  2703. matcherIn;
  2704. // Find primary matches
  2705. if ( matcher ) {
  2706. matcher( matcherIn, matcherOut, context, xml );
  2707. }
  2708. // Apply postFilter
  2709. if ( postFilter ) {
  2710. temp = condense( matcherOut, postMap );
  2711. postFilter( temp, [], context, xml );
  2712. // Un-match failing elements by moving them back to matcherIn
  2713. i = temp.length;
  2714. while ( i-- ) {
  2715. if ( (elem = temp[i]) ) {
  2716. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2717. }
  2718. }
  2719. }
  2720. if ( seed ) {
  2721. if ( postFinder || preFilter ) {
  2722. if ( postFinder ) {
  2723. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2724. temp = [];
  2725. i = matcherOut.length;
  2726. while ( i-- ) {
  2727. if ( (elem = matcherOut[i]) ) {
  2728. // Restore matcherIn since elem is not yet a final match
  2729. temp.push( (matcherIn[i] = elem) );
  2730. }
  2731. }
  2732. postFinder( null, (matcherOut = []), temp, xml );
  2733. }
  2734. // Move matched elements from seed to results to keep them synchronized
  2735. i = matcherOut.length;
  2736. while ( i-- ) {
  2737. if ( (elem = matcherOut[i]) &&
  2738. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2739. seed[temp] = !(results[temp] = elem);
  2740. }
  2741. }
  2742. }
  2743. // Add elements to results, through postFinder if defined
  2744. } else {
  2745. matcherOut = condense(
  2746. matcherOut === results ?
  2747. matcherOut.splice( preexisting, matcherOut.length ) :
  2748. matcherOut
  2749. );
  2750. if ( postFinder ) {
  2751. postFinder( null, results, matcherOut, xml );
  2752. } else {
  2753. push.apply( results, matcherOut );
  2754. }
  2755. }
  2756. });
  2757. }
  2758. function matcherFromTokens( tokens ) {
  2759. var checkContext, matcher, j,
  2760. len = tokens.length,
  2761. leadingRelative = Expr.relative[ tokens[0].type ],
  2762. implicitRelative = leadingRelative || Expr.relative[" "],
  2763. i = leadingRelative ? 1 : 0,
  2764. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2765. matchContext = addCombinator( function( elem ) {
  2766. return elem === checkContext;
  2767. }, implicitRelative, true ),
  2768. matchAnyContext = addCombinator( function( elem ) {
  2769. return indexOf( checkContext, elem ) > -1;
  2770. }, implicitRelative, true ),
  2771. matchers = [ function( elem, context, xml ) {
  2772. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2773. (checkContext = context).nodeType ?
  2774. matchContext( elem, context, xml ) :
  2775. matchAnyContext( elem, context, xml ) );
  2776. // Avoid hanging onto element (issue #299)
  2777. checkContext = null;
  2778. return ret;
  2779. } ];
  2780. for ( ; i < len; i++ ) {
  2781. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2782. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2783. } else {
  2784. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2785. // Return special upon seeing a positional matcher
  2786. if ( matcher[ expando ] ) {
  2787. // Find the next relative operator (if any) for proper handling
  2788. j = ++i;
  2789. for ( ; j < len; j++ ) {
  2790. if ( Expr.relative[ tokens[j].type ] ) {
  2791. break;
  2792. }
  2793. }
  2794. return setMatcher(
  2795. i > 1 && elementMatcher( matchers ),
  2796. i > 1 && toSelector(
  2797. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2798. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2799. ).replace( rtrim, "$1" ),
  2800. matcher,
  2801. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2802. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2803. j < len && toSelector( tokens )
  2804. );
  2805. }
  2806. matchers.push( matcher );
  2807. }
  2808. }
  2809. return elementMatcher( matchers );
  2810. }
  2811. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2812. var bySet = setMatchers.length > 0,
  2813. byElement = elementMatchers.length > 0,
  2814. superMatcher = function( seed, context, xml, results, outermost ) {
  2815. var elem, j, matcher,
  2816. matchedCount = 0,
  2817. i = "0",
  2818. unmatched = seed && [],
  2819. setMatched = [],
  2820. contextBackup = outermostContext,
  2821. // We must always have either seed elements or outermost context
  2822. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2823. // Use integer dirruns iff this is the outermost matcher
  2824. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2825. len = elems.length;
  2826. if ( outermost ) {
  2827. outermostContext = context === document || context || outermost;
  2828. }
  2829. // Add elements passing elementMatchers directly to results
  2830. // Support: IE<9, Safari
  2831. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2832. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2833. if ( byElement && elem ) {
  2834. j = 0;
  2835. if ( !context && elem.ownerDocument !== document ) {
  2836. setDocument( elem );
  2837. xml = !documentIsHTML;
  2838. }
  2839. while ( (matcher = elementMatchers[j++]) ) {
  2840. if ( matcher( elem, context || document, xml) ) {
  2841. results.push( elem );
  2842. break;
  2843. }
  2844. }
  2845. if ( outermost ) {
  2846. dirruns = dirrunsUnique;
  2847. }
  2848. }
  2849. // Track unmatched elements for set filters
  2850. if ( bySet ) {
  2851. // They will have gone through all possible matchers
  2852. if ( (elem = !matcher && elem) ) {
  2853. matchedCount--;
  2854. }
  2855. // Lengthen the array for every element, matched or not
  2856. if ( seed ) {
  2857. unmatched.push( elem );
  2858. }
  2859. }
  2860. }
  2861. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2862. // makes the latter nonnegative.
  2863. matchedCount += i;
  2864. // Apply set filters to unmatched elements
  2865. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2866. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2867. // no element matchers and no seed.
  2868. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2869. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2870. // numerically zero.
  2871. if ( bySet && i !== matchedCount ) {
  2872. j = 0;
  2873. while ( (matcher = setMatchers[j++]) ) {
  2874. matcher( unmatched, setMatched, context, xml );
  2875. }
  2876. if ( seed ) {
  2877. // Reintegrate element matches to eliminate the need for sorting
  2878. if ( matchedCount > 0 ) {
  2879. while ( i-- ) {
  2880. if ( !(unmatched[i] || setMatched[i]) ) {
  2881. setMatched[i] = pop.call( results );
  2882. }
  2883. }
  2884. }
  2885. // Discard index placeholder values to get only actual matches
  2886. setMatched = condense( setMatched );
  2887. }
  2888. // Add matches to results
  2889. push.apply( results, setMatched );
  2890. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2891. if ( outermost && !seed && setMatched.length > 0 &&
  2892. ( matchedCount + setMatchers.length ) > 1 ) {
  2893. Sizzle.uniqueSort( results );
  2894. }
  2895. }
  2896. // Override manipulation of globals by nested matchers
  2897. if ( outermost ) {
  2898. dirruns = dirrunsUnique;
  2899. outermostContext = contextBackup;
  2900. }
  2901. return unmatched;
  2902. };
  2903. return bySet ?
  2904. markFunction( superMatcher ) :
  2905. superMatcher;
  2906. }
  2907. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2908. var i,
  2909. setMatchers = [],
  2910. elementMatchers = [],
  2911. cached = compilerCache[ selector + " " ];
  2912. if ( !cached ) {
  2913. // Generate a function of recursive functions that can be used to check each element
  2914. if ( !match ) {
  2915. match = tokenize( selector );
  2916. }
  2917. i = match.length;
  2918. while ( i-- ) {
  2919. cached = matcherFromTokens( match[i] );
  2920. if ( cached[ expando ] ) {
  2921. setMatchers.push( cached );
  2922. } else {
  2923. elementMatchers.push( cached );
  2924. }
  2925. }
  2926. // Cache the compiled function
  2927. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2928. // Save selector and tokenization
  2929. cached.selector = selector;
  2930. }
  2931. return cached;
  2932. };
  2933. /**
  2934. * A low-level selection function that works with Sizzle's compiled
  2935. * selector functions
  2936. * @param {String|Function} selector A selector or a pre-compiled
  2937. * selector function built with Sizzle.compile
  2938. * @param {Element} context
  2939. * @param {Array} [results]
  2940. * @param {Array} [seed] A set of elements to match against
  2941. */
  2942. select = Sizzle.select = function( selector, context, results, seed ) {
  2943. var i, tokens, token, type, find,
  2944. compiled = typeof selector === "function" && selector,
  2945. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2946. results = results || [];
  2947. // Try to minimize operations if there is only one selector in the list and no seed
  2948. // (the latter of which guarantees us context)
  2949. if ( match.length === 1 ) {
  2950. // Reduce context if the leading compound selector is an ID
  2951. tokens = match[0] = match[0].slice( 0 );
  2952. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2953. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2954. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2955. if ( !context ) {
  2956. return results;
  2957. // Precompiled matchers will still verify ancestry, so step up a level
  2958. } else if ( compiled ) {
  2959. context = context.parentNode;
  2960. }
  2961. selector = selector.slice( tokens.shift().value.length );
  2962. }
  2963. // Fetch a seed set for right-to-left matching
  2964. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2965. while ( i-- ) {
  2966. token = tokens[i];
  2967. // Abort if we hit a combinator
  2968. if ( Expr.relative[ (type = token.type) ] ) {
  2969. break;
  2970. }
  2971. if ( (find = Expr.find[ type ]) ) {
  2972. // Search, expanding context for leading sibling combinators
  2973. if ( (seed = find(
  2974. token.matches[0].replace( runescape, funescape ),
  2975. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2976. )) ) {
  2977. // If seed is empty or no tokens remain, we can return early
  2978. tokens.splice( i, 1 );
  2979. selector = seed.length && toSelector( tokens );
  2980. if ( !selector ) {
  2981. push.apply( results, seed );
  2982. return results;
  2983. }
  2984. break;
  2985. }
  2986. }
  2987. }
  2988. }
  2989. // Compile and execute a filtering function if one is not provided
  2990. // Provide `match` to avoid retokenization if we modified the selector above
  2991. ( compiled || compile( selector, match ) )(
  2992. seed,
  2993. context,
  2994. !documentIsHTML,
  2995. results,
  2996. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2997. );
  2998. return results;
  2999. };
  3000. // One-time assignments
  3001. // Sort stability
  3002. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  3003. // Support: Chrome 14-35+
  3004. // Always assume duplicates if they aren't passed to the comparison function
  3005. support.detectDuplicates = !!hasDuplicate;
  3006. // Initialize against the default document
  3007. setDocument();
  3008. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  3009. // Detached nodes confoundingly follow *each other*
  3010. support.sortDetached = assert(function( el ) {
  3011. // Should return 1, but returns 4 (following)
  3012. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  3013. });
  3014. // Support: IE<8
  3015. // Prevent attribute/property "interpolation"
  3016. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  3017. if ( !assert(function( el ) {
  3018. el.innerHTML = "<a href='#'></a>";
  3019. return el.firstChild.getAttribute("href") === "#" ;
  3020. }) ) {
  3021. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  3022. if ( !isXML ) {
  3023. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  3024. }
  3025. });
  3026. }
  3027. // Support: IE<9
  3028. // Use defaultValue in place of getAttribute("value")
  3029. if ( !support.attributes || !assert(function( el ) {
  3030. el.innerHTML = "<input/>";
  3031. el.firstChild.setAttribute( "value", "" );
  3032. return el.firstChild.getAttribute( "value" ) === "";
  3033. }) ) {
  3034. addHandle( "value", function( elem, name, isXML ) {
  3035. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  3036. return elem.defaultValue;
  3037. }
  3038. });
  3039. }
  3040. // Support: IE<9
  3041. // Use getAttributeNode to fetch booleans when getAttribute lies
  3042. if ( !assert(function( el ) {
  3043. return el.getAttribute("disabled") == null;
  3044. }) ) {
  3045. addHandle( booleans, function( elem, name, isXML ) {
  3046. var val;
  3047. if ( !isXML ) {
  3048. return elem[ name ] === true ? name.toLowerCase() :
  3049. (val = elem.getAttributeNode( name )) && val.specified ?
  3050. val.value :
  3051. null;
  3052. }
  3053. });
  3054. }
  3055. return Sizzle;
  3056. })( window );
  3057. jQuery.find = Sizzle;
  3058. jQuery.expr = Sizzle.selectors;
  3059. // Deprecated
  3060. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  3061. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3062. jQuery.text = Sizzle.getText;
  3063. jQuery.isXMLDoc = Sizzle.isXML;
  3064. jQuery.contains = Sizzle.contains;
  3065. jQuery.escapeSelector = Sizzle.escape;
  3066. var dir = function( elem, dir, until ) {
  3067. var matched = [],
  3068. truncate = until !== undefined;
  3069. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  3070. if ( elem.nodeType === 1 ) {
  3071. if ( truncate && jQuery( elem ).is( until ) ) {
  3072. break;
  3073. }
  3074. matched.push( elem );
  3075. }
  3076. }
  3077. return matched;
  3078. };
  3079. var siblings = function( n, elem ) {
  3080. var matched = [];
  3081. for ( ; n; n = n.nextSibling ) {
  3082. if ( n.nodeType === 1 && n !== elem ) {
  3083. matched.push( n );
  3084. }
  3085. }
  3086. return matched;
  3087. };
  3088. var rneedsContext = jQuery.expr.match.needsContext;
  3089. function nodeName( elem, name ) {
  3090. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  3091. };
  3092. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  3093. var risSimple = /^.[^:#\[\.,]*$/;
  3094. // Implement the identical functionality for filter and not
  3095. function winnow( elements, qualifier, not ) {
  3096. if ( jQuery.isFunction( qualifier ) ) {
  3097. return jQuery.grep( elements, function( elem, i ) {
  3098. return !!qualifier.call( elem, i, elem ) !== not;
  3099. } );
  3100. }
  3101. // Single element
  3102. if ( qualifier.nodeType ) {
  3103. return jQuery.grep( elements, function( elem ) {
  3104. return ( elem === qualifier ) !== not;
  3105. } );
  3106. }
  3107. // Arraylike of elements (jQuery, arguments, Array)
  3108. if ( typeof qualifier !== "string" ) {
  3109. return jQuery.grep( elements, function( elem ) {
  3110. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  3111. } );
  3112. }
  3113. // Simple selector that can be filtered directly, removing non-Elements
  3114. if ( risSimple.test( qualifier ) ) {
  3115. return jQuery.filter( qualifier, elements, not );
  3116. }
  3117. // Complex selector, compare the two sets, removing non-Elements
  3118. qualifier = jQuery.filter( qualifier, elements );
  3119. return jQuery.grep( elements, function( elem ) {
  3120. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  3121. } );
  3122. }
  3123. jQuery.filter = function( expr, elems, not ) {
  3124. var elem = elems[ 0 ];
  3125. if ( not ) {
  3126. expr = ":not(" + expr + ")";
  3127. }
  3128. if ( elems.length === 1 && elem.nodeType === 1 ) {
  3129. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  3130. }
  3131. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3132. return elem.nodeType === 1;
  3133. } ) );
  3134. };
  3135. jQuery.fn.extend( {
  3136. find: function( selector ) {
  3137. var i, ret,
  3138. len = this.length,
  3139. self = this;
  3140. if ( typeof selector !== "string" ) {
  3141. return this.pushStack( jQuery( selector ).filter( function() {
  3142. for ( i = 0; i < len; i++ ) {
  3143. if ( jQuery.contains( self[ i ], this ) ) {
  3144. return true;
  3145. }
  3146. }
  3147. } ) );
  3148. }
  3149. ret = this.pushStack( [] );
  3150. for ( i = 0; i < len; i++ ) {
  3151. jQuery.find( selector, self[ i ], ret );
  3152. }
  3153. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  3154. },
  3155. filter: function( selector ) {
  3156. return this.pushStack( winnow( this, selector || [], false ) );
  3157. },
  3158. not: function( selector ) {
  3159. return this.pushStack( winnow( this, selector || [], true ) );
  3160. },
  3161. is: function( selector ) {
  3162. return !!winnow(
  3163. this,
  3164. // If this is a positional/relative selector, check membership in the returned set
  3165. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3166. typeof selector === "string" && rneedsContext.test( selector ) ?
  3167. jQuery( selector ) :
  3168. selector || [],
  3169. false
  3170. ).length;
  3171. }
  3172. } );
  3173. // Initialize a jQuery object
  3174. // A central reference to the root jQuery(document)
  3175. var rootjQuery,
  3176. // A simple way to check for HTML strings
  3177. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3178. // Strict HTML recognition (#11290: must start with <)
  3179. // Shortcut simple #id case for speed
  3180. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  3181. init = jQuery.fn.init = function( selector, context, root ) {
  3182. var match, elem;
  3183. // HANDLE: $(""), $(null), $(undefined), $(false)
  3184. if ( !selector ) {
  3185. return this;
  3186. }
  3187. // Method init() accepts an alternate rootjQuery
  3188. // so migrate can support jQuery.sub (gh-2101)
  3189. root = root || rootjQuery;
  3190. // Handle HTML strings
  3191. if ( typeof selector === "string" ) {
  3192. if ( selector[ 0 ] === "<" &&
  3193. selector[ selector.length - 1 ] === ">" &&
  3194. selector.length >= 3 ) {
  3195. // Assume that strings that start and end with <> are HTML and skip the regex check
  3196. match = [ null, selector, null ];
  3197. } else {
  3198. match = rquickExpr.exec( selector );
  3199. }
  3200. // Match html or make sure no context is specified for #id
  3201. if ( match && ( match[ 1 ] || !context ) ) {
  3202. // HANDLE: $(html) -> $(array)
  3203. if ( match[ 1 ] ) {
  3204. context = context instanceof jQuery ? context[ 0 ] : context;
  3205. // Option to run scripts is true for back-compat
  3206. // Intentionally let the error be thrown if parseHTML is not present
  3207. jQuery.merge( this, jQuery.parseHTML(
  3208. match[ 1 ],
  3209. context && context.nodeType ? context.ownerDocument || context : document,
  3210. true
  3211. ) );
  3212. // HANDLE: $(html, props)
  3213. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3214. for ( match in context ) {
  3215. // Properties of context are called as methods if possible
  3216. if ( jQuery.isFunction( this[ match ] ) ) {
  3217. this[ match ]( context[ match ] );
  3218. // ...and otherwise set as attributes
  3219. } else {
  3220. this.attr( match, context[ match ] );
  3221. }
  3222. }
  3223. }
  3224. return this;
  3225. // HANDLE: $(#id)
  3226. } else {
  3227. elem = document.getElementById( match[ 2 ] );
  3228. if ( elem ) {
  3229. // Inject the element directly into the jQuery object
  3230. this[ 0 ] = elem;
  3231. this.length = 1;
  3232. }
  3233. return this;
  3234. }
  3235. // HANDLE: $(expr, $(...))
  3236. } else if ( !context || context.jquery ) {
  3237. return ( context || root ).find( selector );
  3238. // HANDLE: $(expr, context)
  3239. // (which is just equivalent to: $(context).find(expr)
  3240. } else {
  3241. return this.constructor( context ).find( selector );
  3242. }
  3243. // HANDLE: $(DOMElement)
  3244. } else if ( selector.nodeType ) {
  3245. this[ 0 ] = selector;
  3246. this.length = 1;
  3247. return this;
  3248. // HANDLE: $(function)
  3249. // Shortcut for document ready
  3250. } else if ( jQuery.isFunction( selector ) ) {
  3251. return root.ready !== undefined ?
  3252. root.ready( selector ) :
  3253. // Execute immediately if ready is not present
  3254. selector( jQuery );
  3255. }
  3256. return jQuery.makeArray( selector, this );
  3257. };
  3258. // Give the init function the jQuery prototype for later instantiation
  3259. init.prototype = jQuery.fn;
  3260. // Initialize central reference
  3261. rootjQuery = jQuery( document );
  3262. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3263. // Methods guaranteed to produce a unique set when starting from a unique set
  3264. guaranteedUnique = {
  3265. children: true,
  3266. contents: true,
  3267. next: true,
  3268. prev: true
  3269. };
  3270. jQuery.fn.extend( {
  3271. has: function( target ) {
  3272. var targets = jQuery( target, this ),
  3273. l = targets.length;
  3274. return this.filter( function() {
  3275. var i = 0;
  3276. for ( ; i < l; i++ ) {
  3277. if ( jQuery.contains( this, targets[ i ] ) ) {
  3278. return true;
  3279. }
  3280. }
  3281. } );
  3282. },
  3283. closest: function( selectors, context ) {
  3284. var cur,
  3285. i = 0,
  3286. l = this.length,
  3287. matched = [],
  3288. targets = typeof selectors !== "string" && jQuery( selectors );
  3289. // Positional selectors never match, since there's no _selection_ context
  3290. if ( !rneedsContext.test( selectors ) ) {
  3291. for ( ; i < l; i++ ) {
  3292. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3293. // Always skip document fragments
  3294. if ( cur.nodeType < 11 && ( targets ?
  3295. targets.index( cur ) > -1 :
  3296. // Don't pass non-elements to Sizzle
  3297. cur.nodeType === 1 &&
  3298. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3299. matched.push( cur );
  3300. break;
  3301. }
  3302. }
  3303. }
  3304. }
  3305. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3306. },
  3307. // Determine the position of an element within the set
  3308. index: function( elem ) {
  3309. // No argument, return index in parent
  3310. if ( !elem ) {
  3311. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3312. }
  3313. // Index in selector
  3314. if ( typeof elem === "string" ) {
  3315. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3316. }
  3317. // Locate the position of the desired element
  3318. return indexOf.call( this,
  3319. // If it receives a jQuery object, the first element is used
  3320. elem.jquery ? elem[ 0 ] : elem
  3321. );
  3322. },
  3323. add: function( selector, context ) {
  3324. return this.pushStack(
  3325. jQuery.uniqueSort(
  3326. jQuery.merge( this.get(), jQuery( selector, context ) )
  3327. )
  3328. );
  3329. },
  3330. addBack: function( selector ) {
  3331. return this.add( selector == null ?
  3332. this.prevObject : this.prevObject.filter( selector )
  3333. );
  3334. }
  3335. } );
  3336. function sibling( cur, dir ) {
  3337. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3338. return cur;
  3339. }
  3340. jQuery.each( {
  3341. parent: function( elem ) {
  3342. var parent = elem.parentNode;
  3343. return parent && parent.nodeType !== 11 ? parent : null;
  3344. },
  3345. parents: function( elem ) {
  3346. return dir( elem, "parentNode" );
  3347. },
  3348. parentsUntil: function( elem, i, until ) {
  3349. return dir( elem, "parentNode", until );
  3350. },
  3351. next: function( elem ) {
  3352. return sibling( elem, "nextSibling" );
  3353. },
  3354. prev: function( elem ) {
  3355. return sibling( elem, "previousSibling" );
  3356. },
  3357. nextAll: function( elem ) {
  3358. return dir( elem, "nextSibling" );
  3359. },
  3360. prevAll: function( elem ) {
  3361. return dir( elem, "previousSibling" );
  3362. },
  3363. nextUntil: function( elem, i, until ) {
  3364. return dir( elem, "nextSibling", until );
  3365. },
  3366. prevUntil: function( elem, i, until ) {
  3367. return dir( elem, "previousSibling", until );
  3368. },
  3369. siblings: function( elem ) {
  3370. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3371. },
  3372. children: function( elem ) {
  3373. return siblings( elem.firstChild );
  3374. },
  3375. contents: function( elem ) {
  3376. if ( nodeName( elem, "iframe" ) ) {
  3377. return elem.contentDocument;
  3378. }
  3379. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3380. // Treat the template element as a regular one in browsers that
  3381. // don't support it.
  3382. if ( nodeName( elem, "template" ) ) {
  3383. elem = elem.content || elem;
  3384. }
  3385. return jQuery.merge( [], elem.childNodes );
  3386. }
  3387. }, function( name, fn ) {
  3388. jQuery.fn[ name ] = function( until, selector ) {
  3389. var matched = jQuery.map( this, fn, until );
  3390. if ( name.slice( -5 ) !== "Until" ) {
  3391. selector = until;
  3392. }
  3393. if ( selector && typeof selector === "string" ) {
  3394. matched = jQuery.filter( selector, matched );
  3395. }
  3396. if ( this.length > 1 ) {
  3397. // Remove duplicates
  3398. if ( !guaranteedUnique[ name ] ) {
  3399. jQuery.uniqueSort( matched );
  3400. }
  3401. // Reverse order for parents* and prev-derivatives
  3402. if ( rparentsprev.test( name ) ) {
  3403. matched.reverse();
  3404. }
  3405. }
  3406. return this.pushStack( matched );
  3407. };
  3408. } );
  3409. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3410. // Convert String-formatted options into Object-formatted ones
  3411. function createOptions( options ) {
  3412. var object = {};
  3413. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3414. object[ flag ] = true;
  3415. } );
  3416. return object;
  3417. }
  3418. /*
  3419. * Create a callback list using the following parameters:
  3420. *
  3421. * options: an optional list of space-separated options that will change how
  3422. * the callback list behaves or a more traditional option object
  3423. *
  3424. * By default a callback list will act like an event callback list and can be
  3425. * "fired" multiple times.
  3426. *
  3427. * Possible options:
  3428. *
  3429. * once: will ensure the callback list can only be fired once (like a Deferred)
  3430. *
  3431. * memory: will keep track of previous values and will call any callback added
  3432. * after the list has been fired right away with the latest "memorized"
  3433. * values (like a Deferred)
  3434. *
  3435. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3436. *
  3437. * stopOnFalse: interrupt callings when a callback returns false
  3438. *
  3439. */
  3440. jQuery.Callbacks = function( options ) {
  3441. // Convert options from String-formatted to Object-formatted if needed
  3442. // (we check in cache first)
  3443. options = typeof options === "string" ?
  3444. createOptions( options ) :
  3445. jQuery.extend( {}, options );
  3446. var // Flag to know if list is currently firing
  3447. firing,
  3448. // Last fire value for non-forgettable lists
  3449. memory,
  3450. // Flag to know if list was already fired
  3451. fired,
  3452. // Flag to prevent firing
  3453. locked,
  3454. // Actual callback list
  3455. list = [],
  3456. // Queue of execution data for repeatable lists
  3457. queue = [],
  3458. // Index of currently firing callback (modified by add/remove as needed)
  3459. firingIndex = -1,
  3460. // Fire callbacks
  3461. fire = function() {
  3462. // Enforce single-firing
  3463. locked = locked || options.once;
  3464. // Execute callbacks for all pending executions,
  3465. // respecting firingIndex overrides and runtime changes
  3466. fired = firing = true;
  3467. for ( ; queue.length; firingIndex = -1 ) {
  3468. memory = queue.shift();
  3469. while ( ++firingIndex < list.length ) {
  3470. // Run callback and check for early termination
  3471. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3472. options.stopOnFalse ) {
  3473. // Jump to end and forget the data so .add doesn't re-fire
  3474. firingIndex = list.length;
  3475. memory = false;
  3476. }
  3477. }
  3478. }
  3479. // Forget the data if we're done with it
  3480. if ( !options.memory ) {
  3481. memory = false;
  3482. }
  3483. firing = false;
  3484. // Clean up if we're done firing for good
  3485. if ( locked ) {
  3486. // Keep an empty list if we have data for future add calls
  3487. if ( memory ) {
  3488. list = [];
  3489. // Otherwise, this object is spent
  3490. } else {
  3491. list = "";
  3492. }
  3493. }
  3494. },
  3495. // Actual Callbacks object
  3496. self = {
  3497. // Add a callback or a collection of callbacks to the list
  3498. add: function() {
  3499. if ( list ) {
  3500. // If we have memory from a past run, we should fire after adding
  3501. if ( memory && !firing ) {
  3502. firingIndex = list.length - 1;
  3503. queue.push( memory );
  3504. }
  3505. ( function add( args ) {
  3506. jQuery.each( args, function( _, arg ) {
  3507. if ( jQuery.isFunction( arg ) ) {
  3508. if ( !options.unique || !self.has( arg ) ) {
  3509. list.push( arg );
  3510. }
  3511. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  3512. // Inspect recursively
  3513. add( arg );
  3514. }
  3515. } );
  3516. } )( arguments );
  3517. if ( memory && !firing ) {
  3518. fire();
  3519. }
  3520. }
  3521. return this;
  3522. },
  3523. // Remove a callback from the list
  3524. remove: function() {
  3525. jQuery.each( arguments, function( _, arg ) {
  3526. var index;
  3527. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3528. list.splice( index, 1 );
  3529. // Handle firing indexes
  3530. if ( index <= firingIndex ) {
  3531. firingIndex--;
  3532. }
  3533. }
  3534. } );
  3535. return this;
  3536. },
  3537. // Check if a given callback is in the list.
  3538. // If no argument is given, return whether or not list has callbacks attached.
  3539. has: function( fn ) {
  3540. return fn ?
  3541. jQuery.inArray( fn, list ) > -1 :
  3542. list.length > 0;
  3543. },
  3544. // Remove all callbacks from the list
  3545. empty: function() {
  3546. if ( list ) {
  3547. list = [];
  3548. }
  3549. return this;
  3550. },
  3551. // Disable .fire and .add
  3552. // Abort any current/pending executions
  3553. // Clear all callbacks and values
  3554. disable: function() {
  3555. locked = queue = [];
  3556. list = memory = "";
  3557. return this;
  3558. },
  3559. disabled: function() {
  3560. return !list;
  3561. },
  3562. // Disable .fire
  3563. // Also disable .add unless we have memory (since it would have no effect)
  3564. // Abort any pending executions
  3565. lock: function() {
  3566. locked = queue = [];
  3567. if ( !memory && !firing ) {
  3568. list = memory = "";
  3569. }
  3570. return this;
  3571. },
  3572. locked: function() {
  3573. return !!locked;
  3574. },
  3575. // Call all callbacks with the given context and arguments
  3576. fireWith: function( context, args ) {
  3577. if ( !locked ) {
  3578. args = args || [];
  3579. args = [ context, args.slice ? args.slice() : args ];
  3580. queue.push( args );
  3581. if ( !firing ) {
  3582. fire();
  3583. }
  3584. }
  3585. return this;
  3586. },
  3587. // Call all the callbacks with the given arguments
  3588. fire: function() {
  3589. self.fireWith( this, arguments );
  3590. return this;
  3591. },
  3592. // To know if the callbacks have already been called at least once
  3593. fired: function() {
  3594. return !!fired;
  3595. }
  3596. };
  3597. return self;
  3598. };
  3599. function Identity( v ) {
  3600. return v;
  3601. }
  3602. function Thrower( ex ) {
  3603. throw ex;
  3604. }
  3605. function adoptValue( value, resolve, reject, noValue ) {
  3606. var method;
  3607. try {
  3608. // Check for promise aspect first to privilege synchronous behavior
  3609. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  3610. method.call( value ).done( resolve ).fail( reject );
  3611. // Other thenables
  3612. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  3613. method.call( value, resolve, reject );
  3614. // Other non-thenables
  3615. } else {
  3616. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3617. // * false: [ value ].slice( 0 ) => resolve( value )
  3618. // * true: [ value ].slice( 1 ) => resolve()
  3619. resolve.apply( undefined, [ value ].slice( noValue ) );
  3620. }
  3621. // For Promises/A+, convert exceptions into rejections
  3622. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3623. // Deferred#then to conditionally suppress rejection.
  3624. } catch ( value ) {
  3625. // Support: Android 4.0 only
  3626. // Strict mode functions invoked without .call/.apply get global-object context
  3627. reject.apply( undefined, [ value ] );
  3628. }
  3629. }
  3630. jQuery.extend( {
  3631. Deferred: function( func ) {
  3632. var tuples = [
  3633. // action, add listener, callbacks,
  3634. // ... .then handlers, argument index, [final state]
  3635. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3636. jQuery.Callbacks( "memory" ), 2 ],
  3637. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3638. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3639. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3640. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3641. ],
  3642. state = "pending",
  3643. promise = {
  3644. state: function() {
  3645. return state;
  3646. },
  3647. always: function() {
  3648. deferred.done( arguments ).fail( arguments );
  3649. return this;
  3650. },
  3651. "catch": function( fn ) {
  3652. return promise.then( null, fn );
  3653. },
  3654. // Keep pipe for back-compat
  3655. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3656. var fns = arguments;
  3657. return jQuery.Deferred( function( newDefer ) {
  3658. jQuery.each( tuples, function( i, tuple ) {
  3659. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3660. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3661. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3662. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3663. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3664. deferred[ tuple[ 1 ] ]( function() {
  3665. var returned = fn && fn.apply( this, arguments );
  3666. if ( returned && jQuery.isFunction( returned.promise ) ) {
  3667. returned.promise()
  3668. .progress( newDefer.notify )
  3669. .done( newDefer.resolve )
  3670. .fail( newDefer.reject );
  3671. } else {
  3672. newDefer[ tuple[ 0 ] + "With" ](
  3673. this,
  3674. fn ? [ returned ] : arguments
  3675. );
  3676. }
  3677. } );
  3678. } );
  3679. fns = null;
  3680. } ).promise();
  3681. },
  3682. then: function( onFulfilled, onRejected, onProgress ) {
  3683. var maxDepth = 0;
  3684. function resolve( depth, deferred, handler, special ) {
  3685. return function() {
  3686. var that = this,
  3687. args = arguments,
  3688. mightThrow = function() {
  3689. var returned, then;
  3690. // Support: Promises/A+ section 2.3.3.3.3
  3691. // https://promisesaplus.com/#point-59
  3692. // Ignore double-resolution attempts
  3693. if ( depth < maxDepth ) {
  3694. return;
  3695. }
  3696. returned = handler.apply( that, args );
  3697. // Support: Promises/A+ section 2.3.1
  3698. // https://promisesaplus.com/#point-48
  3699. if ( returned === deferred.promise() ) {
  3700. throw new TypeError( "Thenable self-resolution" );
  3701. }
  3702. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3703. // https://promisesaplus.com/#point-54
  3704. // https://promisesaplus.com/#point-75
  3705. // Retrieve `then` only once
  3706. then = returned &&
  3707. // Support: Promises/A+ section 2.3.4
  3708. // https://promisesaplus.com/#point-64
  3709. // Only check objects and functions for thenability
  3710. ( typeof returned === "object" ||
  3711. typeof returned === "function" ) &&
  3712. returned.then;
  3713. // Handle a returned thenable
  3714. if ( jQuery.isFunction( then ) ) {
  3715. // Special processors (notify) just wait for resolution
  3716. if ( special ) {
  3717. then.call(
  3718. returned,
  3719. resolve( maxDepth, deferred, Identity, special ),
  3720. resolve( maxDepth, deferred, Thrower, special )
  3721. );
  3722. // Normal processors (resolve) also hook into progress
  3723. } else {
  3724. // ...and disregard older resolution values
  3725. maxDepth++;
  3726. then.call(
  3727. returned,
  3728. resolve( maxDepth, deferred, Identity, special ),
  3729. resolve( maxDepth, deferred, Thrower, special ),
  3730. resolve( maxDepth, deferred, Identity,
  3731. deferred.notifyWith )
  3732. );
  3733. }
  3734. // Handle all other returned values
  3735. } else {
  3736. // Only substitute handlers pass on context
  3737. // and multiple values (non-spec behavior)
  3738. if ( handler !== Identity ) {
  3739. that = undefined;
  3740. args = [ returned ];
  3741. }
  3742. // Process the value(s)
  3743. // Default process is resolve
  3744. ( special || deferred.resolveWith )( that, args );
  3745. }
  3746. },
  3747. // Only normal processors (resolve) catch and reject exceptions
  3748. process = special ?
  3749. mightThrow :
  3750. function() {
  3751. try {
  3752. mightThrow();
  3753. } catch ( e ) {
  3754. if ( jQuery.Deferred.exceptionHook ) {
  3755. jQuery.Deferred.exceptionHook( e,
  3756. process.stackTrace );
  3757. }
  3758. // Support: Promises/A+ section 2.3.3.3.4.1
  3759. // https://promisesaplus.com/#point-61
  3760. // Ignore post-resolution exceptions
  3761. if ( depth + 1 >= maxDepth ) {
  3762. // Only substitute handlers pass on context
  3763. // and multiple values (non-spec behavior)
  3764. if ( handler !== Thrower ) {
  3765. that = undefined;
  3766. args = [ e ];
  3767. }
  3768. deferred.rejectWith( that, args );
  3769. }
  3770. }
  3771. };
  3772. // Support: Promises/A+ section 2.3.3.3.1
  3773. // https://promisesaplus.com/#point-57
  3774. // Re-resolve promises immediately to dodge false rejection from
  3775. // subsequent errors
  3776. if ( depth ) {
  3777. process();
  3778. } else {
  3779. // Call an optional hook to record the stack, in case of exception
  3780. // since it's otherwise lost when execution goes async
  3781. if ( jQuery.Deferred.getStackHook ) {
  3782. process.stackTrace = jQuery.Deferred.getStackHook();
  3783. }
  3784. window.setTimeout( process );
  3785. }
  3786. };
  3787. }
  3788. return jQuery.Deferred( function( newDefer ) {
  3789. // progress_handlers.add( ... )
  3790. tuples[ 0 ][ 3 ].add(
  3791. resolve(
  3792. 0,
  3793. newDefer,
  3794. jQuery.isFunction( onProgress ) ?
  3795. onProgress :
  3796. Identity,
  3797. newDefer.notifyWith
  3798. )
  3799. );
  3800. // fulfilled_handlers.add( ... )
  3801. tuples[ 1 ][ 3 ].add(
  3802. resolve(
  3803. 0,
  3804. newDefer,
  3805. jQuery.isFunction( onFulfilled ) ?
  3806. onFulfilled :
  3807. Identity
  3808. )
  3809. );
  3810. // rejected_handlers.add( ... )
  3811. tuples[ 2 ][ 3 ].add(
  3812. resolve(
  3813. 0,
  3814. newDefer,
  3815. jQuery.isFunction( onRejected ) ?
  3816. onRejected :
  3817. Thrower
  3818. )
  3819. );
  3820. } ).promise();
  3821. },
  3822. // Get a promise for this deferred
  3823. // If obj is provided, the promise aspect is added to the object
  3824. promise: function( obj ) {
  3825. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3826. }
  3827. },
  3828. deferred = {};
  3829. // Add list-specific methods
  3830. jQuery.each( tuples, function( i, tuple ) {
  3831. var list = tuple[ 2 ],
  3832. stateString = tuple[ 5 ];
  3833. // promise.progress = list.add
  3834. // promise.done = list.add
  3835. // promise.fail = list.add
  3836. promise[ tuple[ 1 ] ] = list.add;
  3837. // Handle state
  3838. if ( stateString ) {
  3839. list.add(
  3840. function() {
  3841. // state = "resolved" (i.e., fulfilled)
  3842. // state = "rejected"
  3843. state = stateString;
  3844. },
  3845. // rejected_callbacks.disable
  3846. // fulfilled_callbacks.disable
  3847. tuples[ 3 - i ][ 2 ].disable,
  3848. // progress_callbacks.lock
  3849. tuples[ 0 ][ 2 ].lock
  3850. );
  3851. }
  3852. // progress_handlers.fire
  3853. // fulfilled_handlers.fire
  3854. // rejected_handlers.fire
  3855. list.add( tuple[ 3 ].fire );
  3856. // deferred.notify = function() { deferred.notifyWith(...) }
  3857. // deferred.resolve = function() { deferred.resolveWith(...) }
  3858. // deferred.reject = function() { deferred.rejectWith(...) }
  3859. deferred[ tuple[ 0 ] ] = function() {
  3860. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3861. return this;
  3862. };
  3863. // deferred.notifyWith = list.fireWith
  3864. // deferred.resolveWith = list.fireWith
  3865. // deferred.rejectWith = list.fireWith
  3866. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3867. } );
  3868. // Make the deferred a promise
  3869. promise.promise( deferred );
  3870. // Call given func if any
  3871. if ( func ) {
  3872. func.call( deferred, deferred );
  3873. }
  3874. // All done!
  3875. return deferred;
  3876. },
  3877. // Deferred helper
  3878. when: function( singleValue ) {
  3879. var
  3880. // count of uncompleted subordinates
  3881. remaining = arguments.length,
  3882. // count of unprocessed arguments
  3883. i = remaining,
  3884. // subordinate fulfillment data
  3885. resolveContexts = Array( i ),
  3886. resolveValues = slice.call( arguments ),
  3887. // the master Deferred
  3888. master = jQuery.Deferred(),
  3889. // subordinate callback factory
  3890. updateFunc = function( i ) {
  3891. return function( value ) {
  3892. resolveContexts[ i ] = this;
  3893. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3894. if ( !( --remaining ) ) {
  3895. master.resolveWith( resolveContexts, resolveValues );
  3896. }
  3897. };
  3898. };
  3899. // Single- and empty arguments are adopted like Promise.resolve
  3900. if ( remaining <= 1 ) {
  3901. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3902. !remaining );
  3903. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3904. if ( master.state() === "pending" ||
  3905. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3906. return master.then();
  3907. }
  3908. }
  3909. // Multiple arguments are aggregated like Promise.all array elements
  3910. while ( i-- ) {
  3911. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3912. }
  3913. return master.promise();
  3914. }
  3915. } );
  3916. // These usually indicate a programmer mistake during development,
  3917. // warn about them ASAP rather than swallowing them by default.
  3918. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3919. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3920. // Support: IE 8 - 9 only
  3921. // Console exists when dev tools are open, which can happen at any time
  3922. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3923. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3924. }
  3925. };
  3926. jQuery.readyException = function( error ) {
  3927. window.setTimeout( function() {
  3928. throw error;
  3929. } );
  3930. };
  3931. // The deferred used on DOM ready
  3932. var readyList = jQuery.Deferred();
  3933. jQuery.fn.ready = function( fn ) {
  3934. readyList
  3935. .then( fn )
  3936. // Wrap jQuery.readyException in a function so that the lookup
  3937. // happens at the time of error handling instead of callback
  3938. // registration.
  3939. .catch( function( error ) {
  3940. jQuery.readyException( error );
  3941. } );
  3942. return this;
  3943. };
  3944. jQuery.extend( {
  3945. // Is the DOM ready to be used? Set to true once it occurs.
  3946. isReady: false,
  3947. // A counter to track how many items to wait for before
  3948. // the ready event fires. See #6781
  3949. readyWait: 1,
  3950. // Handle when the DOM is ready
  3951. ready: function( wait ) {
  3952. // Abort if there are pending holds or we're already ready
  3953. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3954. return;
  3955. }
  3956. // Remember that the DOM is ready
  3957. jQuery.isReady = true;
  3958. // If a normal DOM Ready event fired, decrement, and wait if need be
  3959. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3960. return;
  3961. }
  3962. // If there are functions bound, to execute
  3963. readyList.resolveWith( document, [ jQuery ] );
  3964. }
  3965. } );
  3966. jQuery.ready.then = readyList.then;
  3967. // The ready event handler and self cleanup method
  3968. function completed() {
  3969. document.removeEventListener( "DOMContentLoaded", completed );
  3970. window.removeEventListener( "load", completed );
  3971. jQuery.ready();
  3972. }
  3973. // Catch cases where $(document).ready() is called
  3974. // after the browser event has already occurred.
  3975. // Support: IE <=9 - 10 only
  3976. // Older IE sometimes signals "interactive" too soon
  3977. if ( document.readyState === "complete" ||
  3978. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3979. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3980. window.setTimeout( jQuery.ready );
  3981. } else {
  3982. // Use the handy event callback
  3983. document.addEventListener( "DOMContentLoaded", completed );
  3984. // A fallback to window.onload, that will always work
  3985. window.addEventListener( "load", completed );
  3986. }
  3987. // Multifunctional method to get and set values of a collection
  3988. // The value/s can optionally be executed if it's a function
  3989. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3990. var i = 0,
  3991. len = elems.length,
  3992. bulk = key == null;
  3993. // Sets many values
  3994. if ( jQuery.type( key ) === "object" ) {
  3995. chainable = true;
  3996. for ( i in key ) {
  3997. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3998. }
  3999. // Sets one value
  4000. } else if ( value !== undefined ) {
  4001. chainable = true;
  4002. if ( !jQuery.isFunction( value ) ) {
  4003. raw = true;
  4004. }
  4005. if ( bulk ) {
  4006. // Bulk operations run against the entire set
  4007. if ( raw ) {
  4008. fn.call( elems, value );
  4009. fn = null;
  4010. // ...except when executing function values
  4011. } else {
  4012. bulk = fn;
  4013. fn = function( elem, key, value ) {
  4014. return bulk.call( jQuery( elem ), value );
  4015. };
  4016. }
  4017. }
  4018. if ( fn ) {
  4019. for ( ; i < len; i++ ) {
  4020. fn(
  4021. elems[ i ], key, raw ?
  4022. value :
  4023. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4024. );
  4025. }
  4026. }
  4027. }
  4028. if ( chainable ) {
  4029. return elems;
  4030. }
  4031. // Gets
  4032. if ( bulk ) {
  4033. return fn.call( elems );
  4034. }
  4035. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4036. };
  4037. var acceptData = function( owner ) {
  4038. // Accepts only:
  4039. // - Node
  4040. // - Node.ELEMENT_NODE
  4041. // - Node.DOCUMENT_NODE
  4042. // - Object
  4043. // - Any
  4044. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4045. };
  4046. function Data() {
  4047. this.expando = jQuery.expando + Data.uid++;
  4048. }
  4049. Data.uid = 1;
  4050. Data.prototype = {
  4051. cache: function( owner ) {
  4052. // Check if the owner object already has a cache
  4053. var value = owner[ this.expando ];
  4054. // If not, create one
  4055. if ( !value ) {
  4056. value = {};
  4057. // We can accept data for non-element nodes in modern browsers,
  4058. // but we should not, see #8335.
  4059. // Always return an empty object.
  4060. if ( acceptData( owner ) ) {
  4061. // If it is a node unlikely to be stringify-ed or looped over
  4062. // use plain assignment
  4063. if ( owner.nodeType ) {
  4064. owner[ this.expando ] = value;
  4065. // Otherwise secure it in a non-enumerable property
  4066. // configurable must be true to allow the property to be
  4067. // deleted when data is removed
  4068. } else {
  4069. Object.defineProperty( owner, this.expando, {
  4070. value: value,
  4071. configurable: true
  4072. } );
  4073. }
  4074. }
  4075. }
  4076. return value;
  4077. },
  4078. set: function( owner, data, value ) {
  4079. var prop,
  4080. cache = this.cache( owner );
  4081. // Handle: [ owner, key, value ] args
  4082. // Always use camelCase key (gh-2257)
  4083. if ( typeof data === "string" ) {
  4084. cache[ jQuery.camelCase( data ) ] = value;
  4085. // Handle: [ owner, { properties } ] args
  4086. } else {
  4087. // Copy the properties one-by-one to the cache object
  4088. for ( prop in data ) {
  4089. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  4090. }
  4091. }
  4092. return cache;
  4093. },
  4094. get: function( owner, key ) {
  4095. return key === undefined ?
  4096. this.cache( owner ) :
  4097. // Always use camelCase key (gh-2257)
  4098. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  4099. },
  4100. access: function( owner, key, value ) {
  4101. // In cases where either:
  4102. //
  4103. // 1. No key was specified
  4104. // 2. A string key was specified, but no value provided
  4105. //
  4106. // Take the "read" path and allow the get method to determine
  4107. // which value to return, respectively either:
  4108. //
  4109. // 1. The entire cache object
  4110. // 2. The data stored at the key
  4111. //
  4112. if ( key === undefined ||
  4113. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4114. return this.get( owner, key );
  4115. }
  4116. // When the key is not a string, or both a key and value
  4117. // are specified, set or extend (existing objects) with either:
  4118. //
  4119. // 1. An object of properties
  4120. // 2. A key and value
  4121. //
  4122. this.set( owner, key, value );
  4123. // Since the "set" path can have two possible entry points
  4124. // return the expected data based on which path was taken[*]
  4125. return value !== undefined ? value : key;
  4126. },
  4127. remove: function( owner, key ) {
  4128. var i,
  4129. cache = owner[ this.expando ];
  4130. if ( cache === undefined ) {
  4131. return;
  4132. }
  4133. if ( key !== undefined ) {
  4134. // Support array or space separated string of keys
  4135. if ( Array.isArray( key ) ) {
  4136. // If key is an array of keys...
  4137. // We always set camelCase keys, so remove that.
  4138. key = key.map( jQuery.camelCase );
  4139. } else {
  4140. key = jQuery.camelCase( key );
  4141. // If a key with the spaces exists, use it.
  4142. // Otherwise, create an array by matching non-whitespace
  4143. key = key in cache ?
  4144. [ key ] :
  4145. ( key.match( rnothtmlwhite ) || [] );
  4146. }
  4147. i = key.length;
  4148. while ( i-- ) {
  4149. delete cache[ key[ i ] ];
  4150. }
  4151. }
  4152. // Remove the expando if there's no more data
  4153. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4154. // Support: Chrome <=35 - 45
  4155. // Webkit & Blink performance suffers when deleting properties
  4156. // from DOM nodes, so set to undefined instead
  4157. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4158. if ( owner.nodeType ) {
  4159. owner[ this.expando ] = undefined;
  4160. } else {
  4161. delete owner[ this.expando ];
  4162. }
  4163. }
  4164. },
  4165. hasData: function( owner ) {
  4166. var cache = owner[ this.expando ];
  4167. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4168. }
  4169. };
  4170. var dataPriv = new Data();
  4171. var dataUser = new Data();
  4172. // Implementation Summary
  4173. //
  4174. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4175. // 2. Improve the module's maintainability by reducing the storage
  4176. // paths to a single mechanism.
  4177. // 3. Use the same single mechanism to support "private" and "user" data.
  4178. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4179. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4180. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4181. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4182. rmultiDash = /[A-Z]/g;
  4183. function getData( data ) {
  4184. if ( data === "true" ) {
  4185. return true;
  4186. }
  4187. if ( data === "false" ) {
  4188. return false;
  4189. }
  4190. if ( data === "null" ) {
  4191. return null;
  4192. }
  4193. // Only convert to a number if it doesn't change the string
  4194. if ( data === +data + "" ) {
  4195. return +data;
  4196. }
  4197. if ( rbrace.test( data ) ) {
  4198. return JSON.parse( data );
  4199. }
  4200. return data;
  4201. }
  4202. function dataAttr( elem, key, data ) {
  4203. var name;
  4204. // If nothing was found internally, try to fetch any
  4205. // data from the HTML5 data-* attribute
  4206. if ( data === undefined && elem.nodeType === 1 ) {
  4207. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4208. data = elem.getAttribute( name );
  4209. if ( typeof data === "string" ) {
  4210. try {
  4211. data = getData( data );
  4212. } catch ( e ) {}
  4213. // Make sure we set the data so it isn't changed later
  4214. dataUser.set( elem, key, data );
  4215. } else {
  4216. data = undefined;
  4217. }
  4218. }
  4219. return data;
  4220. }
  4221. jQuery.extend( {
  4222. hasData: function( elem ) {
  4223. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4224. },
  4225. data: function( elem, name, data ) {
  4226. return dataUser.access( elem, name, data );
  4227. },
  4228. removeData: function( elem, name ) {
  4229. dataUser.remove( elem, name );
  4230. },
  4231. // TODO: Now that all calls to _data and _removeData have been replaced
  4232. // with direct calls to dataPriv methods, these can be deprecated.
  4233. _data: function( elem, name, data ) {
  4234. return dataPriv.access( elem, name, data );
  4235. },
  4236. _removeData: function( elem, name ) {
  4237. dataPriv.remove( elem, name );
  4238. }
  4239. } );
  4240. jQuery.fn.extend( {
  4241. data: function( key, value ) {
  4242. var i, name, data,
  4243. elem = this[ 0 ],
  4244. attrs = elem && elem.attributes;
  4245. // Gets all values
  4246. if ( key === undefined ) {
  4247. if ( this.length ) {
  4248. data = dataUser.get( elem );
  4249. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4250. i = attrs.length;
  4251. while ( i-- ) {
  4252. // Support: IE 11 only
  4253. // The attrs elements can be null (#14894)
  4254. if ( attrs[ i ] ) {
  4255. name = attrs[ i ].name;
  4256. if ( name.indexOf( "data-" ) === 0 ) {
  4257. name = jQuery.camelCase( name.slice( 5 ) );
  4258. dataAttr( elem, name, data[ name ] );
  4259. }
  4260. }
  4261. }
  4262. dataPriv.set( elem, "hasDataAttrs", true );
  4263. }
  4264. }
  4265. return data;
  4266. }
  4267. // Sets multiple values
  4268. if ( typeof key === "object" ) {
  4269. return this.each( function() {
  4270. dataUser.set( this, key );
  4271. } );
  4272. }
  4273. return access( this, function( value ) {
  4274. var data;
  4275. // The calling jQuery object (element matches) is not empty
  4276. // (and therefore has an element appears at this[ 0 ]) and the
  4277. // `value` parameter was not undefined. An empty jQuery object
  4278. // will result in `undefined` for elem = this[ 0 ] which will
  4279. // throw an exception if an attempt to read a data cache is made.
  4280. if ( elem && value === undefined ) {
  4281. // Attempt to get data from the cache
  4282. // The key will always be camelCased in Data
  4283. data = dataUser.get( elem, key );
  4284. if ( data !== undefined ) {
  4285. return data;
  4286. }
  4287. // Attempt to "discover" the data in
  4288. // HTML5 custom data-* attrs
  4289. data = dataAttr( elem, key );
  4290. if ( data !== undefined ) {
  4291. return data;
  4292. }
  4293. // We tried really hard, but the data doesn't exist.
  4294. return;
  4295. }
  4296. // Set the data...
  4297. this.each( function() {
  4298. // We always store the camelCased key
  4299. dataUser.set( this, key, value );
  4300. } );
  4301. }, null, value, arguments.length > 1, null, true );
  4302. },
  4303. removeData: function( key ) {
  4304. return this.each( function() {
  4305. dataUser.remove( this, key );
  4306. } );
  4307. }
  4308. } );
  4309. jQuery.extend( {
  4310. queue: function( elem, type, data ) {
  4311. var queue;
  4312. if ( elem ) {
  4313. type = ( type || "fx" ) + "queue";
  4314. queue = dataPriv.get( elem, type );
  4315. // Speed up dequeue by getting out quickly if this is just a lookup
  4316. if ( data ) {
  4317. if ( !queue || Array.isArray( data ) ) {
  4318. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4319. } else {
  4320. queue.push( data );
  4321. }
  4322. }
  4323. return queue || [];
  4324. }
  4325. },
  4326. dequeue: function( elem, type ) {
  4327. type = type || "fx";
  4328. var queue = jQuery.queue( elem, type ),
  4329. startLength = queue.length,
  4330. fn = queue.shift(),
  4331. hooks = jQuery._queueHooks( elem, type ),
  4332. next = function() {
  4333. jQuery.dequeue( elem, type );
  4334. };
  4335. // If the fx queue is dequeued, always remove the progress sentinel
  4336. if ( fn === "inprogress" ) {
  4337. fn = queue.shift();
  4338. startLength--;
  4339. }
  4340. if ( fn ) {
  4341. // Add a progress sentinel to prevent the fx queue from being
  4342. // automatically dequeued
  4343. if ( type === "fx" ) {
  4344. queue.unshift( "inprogress" );
  4345. }
  4346. // Clear up the last queue stop function
  4347. delete hooks.stop;
  4348. fn.call( elem, next, hooks );
  4349. }
  4350. if ( !startLength && hooks ) {
  4351. hooks.empty.fire();
  4352. }
  4353. },
  4354. // Not public - generate a queueHooks object, or return the current one
  4355. _queueHooks: function( elem, type ) {
  4356. var key = type + "queueHooks";
  4357. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4358. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4359. dataPriv.remove( elem, [ type + "queue", key ] );
  4360. } )
  4361. } );
  4362. }
  4363. } );
  4364. jQuery.fn.extend( {
  4365. queue: function( type, data ) {
  4366. var setter = 2;
  4367. if ( typeof type !== "string" ) {
  4368. data = type;
  4369. type = "fx";
  4370. setter--;
  4371. }
  4372. if ( arguments.length < setter ) {
  4373. return jQuery.queue( this[ 0 ], type );
  4374. }
  4375. return data === undefined ?
  4376. this :
  4377. this.each( function() {
  4378. var queue = jQuery.queue( this, type, data );
  4379. // Ensure a hooks for this queue
  4380. jQuery._queueHooks( this, type );
  4381. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4382. jQuery.dequeue( this, type );
  4383. }
  4384. } );
  4385. },
  4386. dequeue: function( type ) {
  4387. return this.each( function() {
  4388. jQuery.dequeue( this, type );
  4389. } );
  4390. },
  4391. clearQueue: function( type ) {
  4392. return this.queue( type || "fx", [] );
  4393. },
  4394. // Get a promise resolved when queues of a certain type
  4395. // are emptied (fx is the type by default)
  4396. promise: function( type, obj ) {
  4397. var tmp,
  4398. count = 1,
  4399. defer = jQuery.Deferred(),
  4400. elements = this,
  4401. i = this.length,
  4402. resolve = function() {
  4403. if ( !( --count ) ) {
  4404. defer.resolveWith( elements, [ elements ] );
  4405. }
  4406. };
  4407. if ( typeof type !== "string" ) {
  4408. obj = type;
  4409. type = undefined;
  4410. }
  4411. type = type || "fx";
  4412. while ( i-- ) {
  4413. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4414. if ( tmp && tmp.empty ) {
  4415. count++;
  4416. tmp.empty.add( resolve );
  4417. }
  4418. }
  4419. resolve();
  4420. return defer.promise( obj );
  4421. }
  4422. } );
  4423. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4424. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4425. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4426. var isHiddenWithinTree = function( elem, el ) {
  4427. // isHiddenWithinTree might be called from jQuery#filter function;
  4428. // in that case, element will be second argument
  4429. elem = el || elem;
  4430. // Inline style trumps all
  4431. return elem.style.display === "none" ||
  4432. elem.style.display === "" &&
  4433. // Otherwise, check computed style
  4434. // Support: Firefox <=43 - 45
  4435. // Disconnected elements can have computed display: none, so first confirm that elem is
  4436. // in the document.
  4437. jQuery.contains( elem.ownerDocument, elem ) &&
  4438. jQuery.css( elem, "display" ) === "none";
  4439. };
  4440. var swap = function( elem, options, callback, args ) {
  4441. var ret, name,
  4442. old = {};
  4443. // Remember the old values, and insert the new ones
  4444. for ( name in options ) {
  4445. old[ name ] = elem.style[ name ];
  4446. elem.style[ name ] = options[ name ];
  4447. }
  4448. ret = callback.apply( elem, args || [] );
  4449. // Revert the old values
  4450. for ( name in options ) {
  4451. elem.style[ name ] = old[ name ];
  4452. }
  4453. return ret;
  4454. };
  4455. function adjustCSS( elem, prop, valueParts, tween ) {
  4456. var adjusted,
  4457. scale = 1,
  4458. maxIterations = 20,
  4459. currentValue = tween ?
  4460. function() {
  4461. return tween.cur();
  4462. } :
  4463. function() {
  4464. return jQuery.css( elem, prop, "" );
  4465. },
  4466. initial = currentValue(),
  4467. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4468. // Starting value computation is required for potential unit mismatches
  4469. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4470. rcssNum.exec( jQuery.css( elem, prop ) );
  4471. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4472. // Trust units reported by jQuery.css
  4473. unit = unit || initialInUnit[ 3 ];
  4474. // Make sure we update the tween properties later on
  4475. valueParts = valueParts || [];
  4476. // Iteratively approximate from a nonzero starting point
  4477. initialInUnit = +initial || 1;
  4478. do {
  4479. // If previous iteration zeroed out, double until we get *something*.
  4480. // Use string for doubling so we don't accidentally see scale as unchanged below
  4481. scale = scale || ".5";
  4482. // Adjust and apply
  4483. initialInUnit = initialInUnit / scale;
  4484. jQuery.style( elem, prop, initialInUnit + unit );
  4485. // Update scale, tolerating zero or NaN from tween.cur()
  4486. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  4487. } while (
  4488. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  4489. );
  4490. }
  4491. if ( valueParts ) {
  4492. initialInUnit = +initialInUnit || +initial || 0;
  4493. // Apply relative offset (+=/-=) if specified
  4494. adjusted = valueParts[ 1 ] ?
  4495. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4496. +valueParts[ 2 ];
  4497. if ( tween ) {
  4498. tween.unit = unit;
  4499. tween.start = initialInUnit;
  4500. tween.end = adjusted;
  4501. }
  4502. }
  4503. return adjusted;
  4504. }
  4505. var defaultDisplayMap = {};
  4506. function getDefaultDisplay( elem ) {
  4507. var temp,
  4508. doc = elem.ownerDocument,
  4509. nodeName = elem.nodeName,
  4510. display = defaultDisplayMap[ nodeName ];
  4511. if ( display ) {
  4512. return display;
  4513. }
  4514. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4515. display = jQuery.css( temp, "display" );
  4516. temp.parentNode.removeChild( temp );
  4517. if ( display === "none" ) {
  4518. display = "block";
  4519. }
  4520. defaultDisplayMap[ nodeName ] = display;
  4521. return display;
  4522. }
  4523. function showHide( elements, show ) {
  4524. var display, elem,
  4525. values = [],
  4526. index = 0,
  4527. length = elements.length;
  4528. // Determine new display value for elements that need to change
  4529. for ( ; index < length; index++ ) {
  4530. elem = elements[ index ];
  4531. if ( !elem.style ) {
  4532. continue;
  4533. }
  4534. display = elem.style.display;
  4535. if ( show ) {
  4536. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4537. // check is required in this first loop unless we have a nonempty display value (either
  4538. // inline or about-to-be-restored)
  4539. if ( display === "none" ) {
  4540. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4541. if ( !values[ index ] ) {
  4542. elem.style.display = "";
  4543. }
  4544. }
  4545. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4546. values[ index ] = getDefaultDisplay( elem );
  4547. }
  4548. } else {
  4549. if ( display !== "none" ) {
  4550. values[ index ] = "none";
  4551. // Remember what we're overwriting
  4552. dataPriv.set( elem, "display", display );
  4553. }
  4554. }
  4555. }
  4556. // Set the display of the elements in a second loop to avoid constant reflow
  4557. for ( index = 0; index < length; index++ ) {
  4558. if ( values[ index ] != null ) {
  4559. elements[ index ].style.display = values[ index ];
  4560. }
  4561. }
  4562. return elements;
  4563. }
  4564. jQuery.fn.extend( {
  4565. show: function() {
  4566. return showHide( this, true );
  4567. },
  4568. hide: function() {
  4569. return showHide( this );
  4570. },
  4571. toggle: function( state ) {
  4572. if ( typeof state === "boolean" ) {
  4573. return state ? this.show() : this.hide();
  4574. }
  4575. return this.each( function() {
  4576. if ( isHiddenWithinTree( this ) ) {
  4577. jQuery( this ).show();
  4578. } else {
  4579. jQuery( this ).hide();
  4580. }
  4581. } );
  4582. }
  4583. } );
  4584. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4585. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  4586. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  4587. // We have to close these tags to support XHTML (#13200)
  4588. var wrapMap = {
  4589. // Support: IE <=9 only
  4590. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4591. // XHTML parsers do not magically insert elements in the
  4592. // same way that tag soup parsers do. So we cannot shorten
  4593. // this by omitting <tbody> or other required elements.
  4594. thead: [ 1, "<table>", "</table>" ],
  4595. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4596. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4597. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4598. _default: [ 0, "", "" ]
  4599. };
  4600. // Support: IE <=9 only
  4601. wrapMap.optgroup = wrapMap.option;
  4602. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4603. wrapMap.th = wrapMap.td;
  4604. function getAll( context, tag ) {
  4605. // Support: IE <=9 - 11 only
  4606. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4607. var ret;
  4608. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4609. ret = context.getElementsByTagName( tag || "*" );
  4610. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4611. ret = context.querySelectorAll( tag || "*" );
  4612. } else {
  4613. ret = [];
  4614. }
  4615. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4616. return jQuery.merge( [ context ], ret );
  4617. }
  4618. return ret;
  4619. }
  4620. // Mark scripts as having already been evaluated
  4621. function setGlobalEval( elems, refElements ) {
  4622. var i = 0,
  4623. l = elems.length;
  4624. for ( ; i < l; i++ ) {
  4625. dataPriv.set(
  4626. elems[ i ],
  4627. "globalEval",
  4628. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4629. );
  4630. }
  4631. }
  4632. var rhtml = /<|&#?\w+;/;
  4633. function buildFragment( elems, context, scripts, selection, ignored ) {
  4634. var elem, tmp, tag, wrap, contains, j,
  4635. fragment = context.createDocumentFragment(),
  4636. nodes = [],
  4637. i = 0,
  4638. l = elems.length;
  4639. for ( ; i < l; i++ ) {
  4640. elem = elems[ i ];
  4641. if ( elem || elem === 0 ) {
  4642. // Add nodes directly
  4643. if ( jQuery.type( elem ) === "object" ) {
  4644. // Support: Android <=4.0 only, PhantomJS 1 only
  4645. // push.apply(_, arraylike) throws on ancient WebKit
  4646. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4647. // Convert non-html into a text node
  4648. } else if ( !rhtml.test( elem ) ) {
  4649. nodes.push( context.createTextNode( elem ) );
  4650. // Convert html into DOM nodes
  4651. } else {
  4652. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4653. // Deserialize a standard representation
  4654. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4655. wrap = wrapMap[ tag ] || wrapMap._default;
  4656. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4657. // Descend through wrappers to the right content
  4658. j = wrap[ 0 ];
  4659. while ( j-- ) {
  4660. tmp = tmp.lastChild;
  4661. }
  4662. // Support: Android <=4.0 only, PhantomJS 1 only
  4663. // push.apply(_, arraylike) throws on ancient WebKit
  4664. jQuery.merge( nodes, tmp.childNodes );
  4665. // Remember the top-level container
  4666. tmp = fragment.firstChild;
  4667. // Ensure the created nodes are orphaned (#12392)
  4668. tmp.textContent = "";
  4669. }
  4670. }
  4671. }
  4672. // Remove wrapper from fragment
  4673. fragment.textContent = "";
  4674. i = 0;
  4675. while ( ( elem = nodes[ i++ ] ) ) {
  4676. // Skip elements already in the context collection (trac-4087)
  4677. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4678. if ( ignored ) {
  4679. ignored.push( elem );
  4680. }
  4681. continue;
  4682. }
  4683. contains = jQuery.contains( elem.ownerDocument, elem );
  4684. // Append to fragment
  4685. tmp = getAll( fragment.appendChild( elem ), "script" );
  4686. // Preserve script evaluation history
  4687. if ( contains ) {
  4688. setGlobalEval( tmp );
  4689. }
  4690. // Capture executables
  4691. if ( scripts ) {
  4692. j = 0;
  4693. while ( ( elem = tmp[ j++ ] ) ) {
  4694. if ( rscriptType.test( elem.type || "" ) ) {
  4695. scripts.push( elem );
  4696. }
  4697. }
  4698. }
  4699. }
  4700. return fragment;
  4701. }
  4702. ( function() {
  4703. var fragment = document.createDocumentFragment(),
  4704. div = fragment.appendChild( document.createElement( "div" ) ),
  4705. input = document.createElement( "input" );
  4706. // Support: Android 4.0 - 4.3 only
  4707. // Check state lost if the name is set (#11217)
  4708. // Support: Windows Web Apps (WWA)
  4709. // `name` and `type` must use .setAttribute for WWA (#14901)
  4710. input.setAttribute( "type", "radio" );
  4711. input.setAttribute( "checked", "checked" );
  4712. input.setAttribute( "name", "t" );
  4713. div.appendChild( input );
  4714. // Support: Android <=4.1 only
  4715. // Older WebKit doesn't clone checked state correctly in fragments
  4716. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4717. // Support: IE <=11 only
  4718. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4719. div.innerHTML = "<textarea>x</textarea>";
  4720. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4721. } )();
  4722. var documentElement = document.documentElement;
  4723. var
  4724. rkeyEvent = /^key/,
  4725. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  4726. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4727. function returnTrue() {
  4728. return true;
  4729. }
  4730. function returnFalse() {
  4731. return false;
  4732. }
  4733. // Support: IE <=9 only
  4734. // See #13393 for more info
  4735. function safeActiveElement() {
  4736. try {
  4737. return document.activeElement;
  4738. } catch ( err ) { }
  4739. }
  4740. function on( elem, types, selector, data, fn, one ) {
  4741. var origFn, type;
  4742. // Types can be a map of types/handlers
  4743. if ( typeof types === "object" ) {
  4744. // ( types-Object, selector, data )
  4745. if ( typeof selector !== "string" ) {
  4746. // ( types-Object, data )
  4747. data = data || selector;
  4748. selector = undefined;
  4749. }
  4750. for ( type in types ) {
  4751. on( elem, type, selector, data, types[ type ], one );
  4752. }
  4753. return elem;
  4754. }
  4755. if ( data == null && fn == null ) {
  4756. // ( types, fn )
  4757. fn = selector;
  4758. data = selector = undefined;
  4759. } else if ( fn == null ) {
  4760. if ( typeof selector === "string" ) {
  4761. // ( types, selector, fn )
  4762. fn = data;
  4763. data = undefined;
  4764. } else {
  4765. // ( types, data, fn )
  4766. fn = data;
  4767. data = selector;
  4768. selector = undefined;
  4769. }
  4770. }
  4771. if ( fn === false ) {
  4772. fn = returnFalse;
  4773. } else if ( !fn ) {
  4774. return elem;
  4775. }
  4776. if ( one === 1 ) {
  4777. origFn = fn;
  4778. fn = function( event ) {
  4779. // Can use an empty set, since event contains the info
  4780. jQuery().off( event );
  4781. return origFn.apply( this, arguments );
  4782. };
  4783. // Use same guid so caller can remove using origFn
  4784. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4785. }
  4786. return elem.each( function() {
  4787. jQuery.event.add( this, types, fn, data, selector );
  4788. } );
  4789. }
  4790. /*
  4791. * Helper functions for managing events -- not part of the public interface.
  4792. * Props to Dean Edwards' addEvent library for many of the ideas.
  4793. */
  4794. jQuery.event = {
  4795. global: {},
  4796. add: function( elem, types, handler, data, selector ) {
  4797. var handleObjIn, eventHandle, tmp,
  4798. events, t, handleObj,
  4799. special, handlers, type, namespaces, origType,
  4800. elemData = dataPriv.get( elem );
  4801. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4802. if ( !elemData ) {
  4803. return;
  4804. }
  4805. // Caller can pass in an object of custom data in lieu of the handler
  4806. if ( handler.handler ) {
  4807. handleObjIn = handler;
  4808. handler = handleObjIn.handler;
  4809. selector = handleObjIn.selector;
  4810. }
  4811. // Ensure that invalid selectors throw exceptions at attach time
  4812. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4813. if ( selector ) {
  4814. jQuery.find.matchesSelector( documentElement, selector );
  4815. }
  4816. // Make sure that the handler has a unique ID, used to find/remove it later
  4817. if ( !handler.guid ) {
  4818. handler.guid = jQuery.guid++;
  4819. }
  4820. // Init the element's event structure and main handler, if this is the first
  4821. if ( !( events = elemData.events ) ) {
  4822. events = elemData.events = {};
  4823. }
  4824. if ( !( eventHandle = elemData.handle ) ) {
  4825. eventHandle = elemData.handle = function( e ) {
  4826. // Discard the second event of a jQuery.event.trigger() and
  4827. // when an event is called after a page has unloaded
  4828. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4829. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4830. };
  4831. }
  4832. // Handle multiple events separated by a space
  4833. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4834. t = types.length;
  4835. while ( t-- ) {
  4836. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4837. type = origType = tmp[ 1 ];
  4838. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4839. // There *must* be a type, no attaching namespace-only handlers
  4840. if ( !type ) {
  4841. continue;
  4842. }
  4843. // If event changes its type, use the special event handlers for the changed type
  4844. special = jQuery.event.special[ type ] || {};
  4845. // If selector defined, determine special event api type, otherwise given type
  4846. type = ( selector ? special.delegateType : special.bindType ) || type;
  4847. // Update special based on newly reset type
  4848. special = jQuery.event.special[ type ] || {};
  4849. // handleObj is passed to all event handlers
  4850. handleObj = jQuery.extend( {
  4851. type: type,
  4852. origType: origType,
  4853. data: data,
  4854. handler: handler,
  4855. guid: handler.guid,
  4856. selector: selector,
  4857. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4858. namespace: namespaces.join( "." )
  4859. }, handleObjIn );
  4860. // Init the event handler queue if we're the first
  4861. if ( !( handlers = events[ type ] ) ) {
  4862. handlers = events[ type ] = [];
  4863. handlers.delegateCount = 0;
  4864. // Only use addEventListener if the special events handler returns false
  4865. if ( !special.setup ||
  4866. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4867. if ( elem.addEventListener ) {
  4868. elem.addEventListener( type, eventHandle );
  4869. }
  4870. }
  4871. }
  4872. if ( special.add ) {
  4873. special.add.call( elem, handleObj );
  4874. if ( !handleObj.handler.guid ) {
  4875. handleObj.handler.guid = handler.guid;
  4876. }
  4877. }
  4878. // Add to the element's handler list, delegates in front
  4879. if ( selector ) {
  4880. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4881. } else {
  4882. handlers.push( handleObj );
  4883. }
  4884. // Keep track of which events have ever been used, for event optimization
  4885. jQuery.event.global[ type ] = true;
  4886. }
  4887. },
  4888. // Detach an event or set of events from an element
  4889. remove: function( elem, types, handler, selector, mappedTypes ) {
  4890. var j, origCount, tmp,
  4891. events, t, handleObj,
  4892. special, handlers, type, namespaces, origType,
  4893. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4894. if ( !elemData || !( events = elemData.events ) ) {
  4895. return;
  4896. }
  4897. // Once for each type.namespace in types; type may be omitted
  4898. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4899. t = types.length;
  4900. while ( t-- ) {
  4901. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4902. type = origType = tmp[ 1 ];
  4903. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4904. // Unbind all events (on this namespace, if provided) for the element
  4905. if ( !type ) {
  4906. for ( type in events ) {
  4907. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4908. }
  4909. continue;
  4910. }
  4911. special = jQuery.event.special[ type ] || {};
  4912. type = ( selector ? special.delegateType : special.bindType ) || type;
  4913. handlers = events[ type ] || [];
  4914. tmp = tmp[ 2 ] &&
  4915. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4916. // Remove matching events
  4917. origCount = j = handlers.length;
  4918. while ( j-- ) {
  4919. handleObj = handlers[ j ];
  4920. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4921. ( !handler || handler.guid === handleObj.guid ) &&
  4922. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4923. ( !selector || selector === handleObj.selector ||
  4924. selector === "**" && handleObj.selector ) ) {
  4925. handlers.splice( j, 1 );
  4926. if ( handleObj.selector ) {
  4927. handlers.delegateCount--;
  4928. }
  4929. if ( special.remove ) {
  4930. special.remove.call( elem, handleObj );
  4931. }
  4932. }
  4933. }
  4934. // Remove generic event handler if we removed something and no more handlers exist
  4935. // (avoids potential for endless recursion during removal of special event handlers)
  4936. if ( origCount && !handlers.length ) {
  4937. if ( !special.teardown ||
  4938. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4939. jQuery.removeEvent( elem, type, elemData.handle );
  4940. }
  4941. delete events[ type ];
  4942. }
  4943. }
  4944. // Remove data and the expando if it's no longer used
  4945. if ( jQuery.isEmptyObject( events ) ) {
  4946. dataPriv.remove( elem, "handle events" );
  4947. }
  4948. },
  4949. dispatch: function( nativeEvent ) {
  4950. // Make a writable jQuery.Event from the native event object
  4951. var event = jQuery.event.fix( nativeEvent );
  4952. var i, j, ret, matched, handleObj, handlerQueue,
  4953. args = new Array( arguments.length ),
  4954. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4955. special = jQuery.event.special[ event.type ] || {};
  4956. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4957. args[ 0 ] = event;
  4958. for ( i = 1; i < arguments.length; i++ ) {
  4959. args[ i ] = arguments[ i ];
  4960. }
  4961. event.delegateTarget = this;
  4962. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4963. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4964. return;
  4965. }
  4966. // Determine handlers
  4967. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4968. // Run delegates first; they may want to stop propagation beneath us
  4969. i = 0;
  4970. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4971. event.currentTarget = matched.elem;
  4972. j = 0;
  4973. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4974. !event.isImmediatePropagationStopped() ) {
  4975. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4976. // a subset or equal to those in the bound event (both can have no namespace).
  4977. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4978. event.handleObj = handleObj;
  4979. event.data = handleObj.data;
  4980. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4981. handleObj.handler ).apply( matched.elem, args );
  4982. if ( ret !== undefined ) {
  4983. if ( ( event.result = ret ) === false ) {
  4984. event.preventDefault();
  4985. event.stopPropagation();
  4986. }
  4987. }
  4988. }
  4989. }
  4990. }
  4991. // Call the postDispatch hook for the mapped type
  4992. if ( special.postDispatch ) {
  4993. special.postDispatch.call( this, event );
  4994. }
  4995. return event.result;
  4996. },
  4997. handlers: function( event, handlers ) {
  4998. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4999. handlerQueue = [],
  5000. delegateCount = handlers.delegateCount,
  5001. cur = event.target;
  5002. // Find delegate handlers
  5003. if ( delegateCount &&
  5004. // Support: IE <=9
  5005. // Black-hole SVG <use> instance trees (trac-13180)
  5006. cur.nodeType &&
  5007. // Support: Firefox <=42
  5008. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5009. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5010. // Support: IE 11 only
  5011. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5012. !( event.type === "click" && event.button >= 1 ) ) {
  5013. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5014. // Don't check non-elements (#13208)
  5015. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  5016. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5017. matchedHandlers = [];
  5018. matchedSelectors = {};
  5019. for ( i = 0; i < delegateCount; i++ ) {
  5020. handleObj = handlers[ i ];
  5021. // Don't conflict with Object.prototype properties (#13203)
  5022. sel = handleObj.selector + " ";
  5023. if ( matchedSelectors[ sel ] === undefined ) {
  5024. matchedSelectors[ sel ] = handleObj.needsContext ?
  5025. jQuery( sel, this ).index( cur ) > -1 :
  5026. jQuery.find( sel, this, null, [ cur ] ).length;
  5027. }
  5028. if ( matchedSelectors[ sel ] ) {
  5029. matchedHandlers.push( handleObj );
  5030. }
  5031. }
  5032. if ( matchedHandlers.length ) {
  5033. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5034. }
  5035. }
  5036. }
  5037. }
  5038. // Add the remaining (directly-bound) handlers
  5039. cur = this;
  5040. if ( delegateCount < handlers.length ) {
  5041. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5042. }
  5043. return handlerQueue;
  5044. },
  5045. addProp: function( name, hook ) {
  5046. Object.defineProperty( jQuery.Event.prototype, name, {
  5047. enumerable: true,
  5048. configurable: true,
  5049. get: jQuery.isFunction( hook ) ?
  5050. function() {
  5051. if ( this.originalEvent ) {
  5052. return hook( this.originalEvent );
  5053. }
  5054. } :
  5055. function() {
  5056. if ( this.originalEvent ) {
  5057. return this.originalEvent[ name ];
  5058. }
  5059. },
  5060. set: function( value ) {
  5061. Object.defineProperty( this, name, {
  5062. enumerable: true,
  5063. configurable: true,
  5064. writable: true,
  5065. value: value
  5066. } );
  5067. }
  5068. } );
  5069. },
  5070. fix: function( originalEvent ) {
  5071. return originalEvent[ jQuery.expando ] ?
  5072. originalEvent :
  5073. new jQuery.Event( originalEvent );
  5074. },
  5075. special: {
  5076. load: {
  5077. // Prevent triggered image.load events from bubbling to window.load
  5078. noBubble: true
  5079. },
  5080. focus: {
  5081. // Fire native event if possible so blur/focus sequence is correct
  5082. trigger: function() {
  5083. if ( this !== safeActiveElement() && this.focus ) {
  5084. this.focus();
  5085. return false;
  5086. }
  5087. },
  5088. delegateType: "focusin"
  5089. },
  5090. blur: {
  5091. trigger: function() {
  5092. if ( this === safeActiveElement() && this.blur ) {
  5093. this.blur();
  5094. return false;
  5095. }
  5096. },
  5097. delegateType: "focusout"
  5098. },
  5099. click: {
  5100. // For checkbox, fire native event so checked state will be right
  5101. trigger: function() {
  5102. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  5103. this.click();
  5104. return false;
  5105. }
  5106. },
  5107. // For cross-browser consistency, don't fire native .click() on links
  5108. _default: function( event ) {
  5109. return nodeName( event.target, "a" );
  5110. }
  5111. },
  5112. beforeunload: {
  5113. postDispatch: function( event ) {
  5114. // Support: Firefox 20+
  5115. // Firefox doesn't alert if the returnValue field is not set.
  5116. if ( event.result !== undefined && event.originalEvent ) {
  5117. event.originalEvent.returnValue = event.result;
  5118. }
  5119. }
  5120. }
  5121. }
  5122. };
  5123. jQuery.removeEvent = function( elem, type, handle ) {
  5124. // This "if" is needed for plain objects
  5125. if ( elem.removeEventListener ) {
  5126. elem.removeEventListener( type, handle );
  5127. }
  5128. };
  5129. jQuery.Event = function( src, props ) {
  5130. // Allow instantiation without the 'new' keyword
  5131. if ( !( this instanceof jQuery.Event ) ) {
  5132. return new jQuery.Event( src, props );
  5133. }
  5134. // Event object
  5135. if ( src && src.type ) {
  5136. this.originalEvent = src;
  5137. this.type = src.type;
  5138. // Events bubbling up the document may have been marked as prevented
  5139. // by a handler lower down the tree; reflect the correct value.
  5140. this.isDefaultPrevented = src.defaultPrevented ||
  5141. src.defaultPrevented === undefined &&
  5142. // Support: Android <=2.3 only
  5143. src.returnValue === false ?
  5144. returnTrue :
  5145. returnFalse;
  5146. // Create target properties
  5147. // Support: Safari <=6 - 7 only
  5148. // Target should not be a text node (#504, #13143)
  5149. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5150. src.target.parentNode :
  5151. src.target;
  5152. this.currentTarget = src.currentTarget;
  5153. this.relatedTarget = src.relatedTarget;
  5154. // Event type
  5155. } else {
  5156. this.type = src;
  5157. }
  5158. // Put explicitly provided properties onto the event object
  5159. if ( props ) {
  5160. jQuery.extend( this, props );
  5161. }
  5162. // Create a timestamp if incoming event doesn't have one
  5163. this.timeStamp = src && src.timeStamp || jQuery.now();
  5164. // Mark it as fixed
  5165. this[ jQuery.expando ] = true;
  5166. };
  5167. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5168. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5169. jQuery.Event.prototype = {
  5170. constructor: jQuery.Event,
  5171. isDefaultPrevented: returnFalse,
  5172. isPropagationStopped: returnFalse,
  5173. isImmediatePropagationStopped: returnFalse,
  5174. isSimulated: false,
  5175. preventDefault: function() {
  5176. var e = this.originalEvent;
  5177. this.isDefaultPrevented = returnTrue;
  5178. if ( e && !this.isSimulated ) {
  5179. e.preventDefault();
  5180. }
  5181. },
  5182. stopPropagation: function() {
  5183. var e = this.originalEvent;
  5184. this.isPropagationStopped = returnTrue;
  5185. if ( e && !this.isSimulated ) {
  5186. e.stopPropagation();
  5187. }
  5188. },
  5189. stopImmediatePropagation: function() {
  5190. var e = this.originalEvent;
  5191. this.isImmediatePropagationStopped = returnTrue;
  5192. if ( e && !this.isSimulated ) {
  5193. e.stopImmediatePropagation();
  5194. }
  5195. this.stopPropagation();
  5196. }
  5197. };
  5198. // Includes all common event props including KeyEvent and MouseEvent specific props
  5199. jQuery.each( {
  5200. altKey: true,
  5201. bubbles: true,
  5202. cancelable: true,
  5203. changedTouches: true,
  5204. ctrlKey: true,
  5205. detail: true,
  5206. eventPhase: true,
  5207. metaKey: true,
  5208. pageX: true,
  5209. pageY: true,
  5210. shiftKey: true,
  5211. view: true,
  5212. "char": true,
  5213. charCode: true,
  5214. key: true,
  5215. keyCode: true,
  5216. button: true,
  5217. buttons: true,
  5218. clientX: true,
  5219. clientY: true,
  5220. offsetX: true,
  5221. offsetY: true,
  5222. pointerId: true,
  5223. pointerType: true,
  5224. screenX: true,
  5225. screenY: true,
  5226. targetTouches: true,
  5227. toElement: true,
  5228. touches: true,
  5229. which: function( event ) {
  5230. var button = event.button;
  5231. // Add which for key events
  5232. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  5233. return event.charCode != null ? event.charCode : event.keyCode;
  5234. }
  5235. // Add which for click: 1 === left; 2 === middle; 3 === right
  5236. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  5237. if ( button & 1 ) {
  5238. return 1;
  5239. }
  5240. if ( button & 2 ) {
  5241. return 3;
  5242. }
  5243. if ( button & 4 ) {
  5244. return 2;
  5245. }
  5246. return 0;
  5247. }
  5248. return event.which;
  5249. }
  5250. }, jQuery.event.addProp );
  5251. // Create mouseenter/leave events using mouseover/out and event-time checks
  5252. // so that event delegation works in jQuery.
  5253. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5254. //
  5255. // Support: Safari 7 only
  5256. // Safari sends mouseenter too often; see:
  5257. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5258. // for the description of the bug (it existed in older Chrome versions as well).
  5259. jQuery.each( {
  5260. mouseenter: "mouseover",
  5261. mouseleave: "mouseout",
  5262. pointerenter: "pointerover",
  5263. pointerleave: "pointerout"
  5264. }, function( orig, fix ) {
  5265. jQuery.event.special[ orig ] = {
  5266. delegateType: fix,
  5267. bindType: fix,
  5268. handle: function( event ) {
  5269. var ret,
  5270. target = this,
  5271. related = event.relatedTarget,
  5272. handleObj = event.handleObj;
  5273. // For mouseenter/leave call the handler if related is outside the target.
  5274. // NB: No relatedTarget if the mouse left/entered the browser window
  5275. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5276. event.type = handleObj.origType;
  5277. ret = handleObj.handler.apply( this, arguments );
  5278. event.type = fix;
  5279. }
  5280. return ret;
  5281. }
  5282. };
  5283. } );
  5284. jQuery.fn.extend( {
  5285. on: function( types, selector, data, fn ) {
  5286. return on( this, types, selector, data, fn );
  5287. },
  5288. one: function( types, selector, data, fn ) {
  5289. return on( this, types, selector, data, fn, 1 );
  5290. },
  5291. off: function( types, selector, fn ) {
  5292. var handleObj, type;
  5293. if ( types && types.preventDefault && types.handleObj ) {
  5294. // ( event ) dispatched jQuery.Event
  5295. handleObj = types.handleObj;
  5296. jQuery( types.delegateTarget ).off(
  5297. handleObj.namespace ?
  5298. handleObj.origType + "." + handleObj.namespace :
  5299. handleObj.origType,
  5300. handleObj.selector,
  5301. handleObj.handler
  5302. );
  5303. return this;
  5304. }
  5305. if ( typeof types === "object" ) {
  5306. // ( types-object [, selector] )
  5307. for ( type in types ) {
  5308. this.off( type, selector, types[ type ] );
  5309. }
  5310. return this;
  5311. }
  5312. if ( selector === false || typeof selector === "function" ) {
  5313. // ( types [, fn] )
  5314. fn = selector;
  5315. selector = undefined;
  5316. }
  5317. if ( fn === false ) {
  5318. fn = returnFalse;
  5319. }
  5320. return this.each( function() {
  5321. jQuery.event.remove( this, types, fn, selector );
  5322. } );
  5323. }
  5324. } );
  5325. var
  5326. /* eslint-disable max-len */
  5327. // See https://github.com/eslint/eslint/issues/3229
  5328. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  5329. /* eslint-enable */
  5330. // Support: IE <=10 - 11, Edge 12 - 13
  5331. // In IE/Edge using regex groups here causes severe slowdowns.
  5332. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5333. rnoInnerhtml = /<script|<style|<link/i,
  5334. // checked="checked" or checked
  5335. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5336. rscriptTypeMasked = /^true\/(.*)/,
  5337. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  5338. // Prefer a tbody over its parent table for containing new rows
  5339. function manipulationTarget( elem, content ) {
  5340. if ( nodeName( elem, "table" ) &&
  5341. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5342. return jQuery( ">tbody", elem )[ 0 ] || elem;
  5343. }
  5344. return elem;
  5345. }
  5346. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5347. function disableScript( elem ) {
  5348. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5349. return elem;
  5350. }
  5351. function restoreScript( elem ) {
  5352. var match = rscriptTypeMasked.exec( elem.type );
  5353. if ( match ) {
  5354. elem.type = match[ 1 ];
  5355. } else {
  5356. elem.removeAttribute( "type" );
  5357. }
  5358. return elem;
  5359. }
  5360. function cloneCopyEvent( src, dest ) {
  5361. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  5362. if ( dest.nodeType !== 1 ) {
  5363. return;
  5364. }
  5365. // 1. Copy private data: events, handlers, etc.
  5366. if ( dataPriv.hasData( src ) ) {
  5367. pdataOld = dataPriv.access( src );
  5368. pdataCur = dataPriv.set( dest, pdataOld );
  5369. events = pdataOld.events;
  5370. if ( events ) {
  5371. delete pdataCur.handle;
  5372. pdataCur.events = {};
  5373. for ( type in events ) {
  5374. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5375. jQuery.event.add( dest, type, events[ type ][ i ] );
  5376. }
  5377. }
  5378. }
  5379. }
  5380. // 2. Copy user data
  5381. if ( dataUser.hasData( src ) ) {
  5382. udataOld = dataUser.access( src );
  5383. udataCur = jQuery.extend( {}, udataOld );
  5384. dataUser.set( dest, udataCur );
  5385. }
  5386. }
  5387. // Fix IE bugs, see support tests
  5388. function fixInput( src, dest ) {
  5389. var nodeName = dest.nodeName.toLowerCase();
  5390. // Fails to persist the checked state of a cloned checkbox or radio button.
  5391. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5392. dest.checked = src.checked;
  5393. // Fails to return the selected option to the default selected state when cloning options
  5394. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5395. dest.defaultValue = src.defaultValue;
  5396. }
  5397. }
  5398. function domManip( collection, args, callback, ignored ) {
  5399. // Flatten any nested arrays
  5400. args = concat.apply( [], args );
  5401. var fragment, first, scripts, hasScripts, node, doc,
  5402. i = 0,
  5403. l = collection.length,
  5404. iNoClone = l - 1,
  5405. value = args[ 0 ],
  5406. isFunction = jQuery.isFunction( value );
  5407. // We can't cloneNode fragments that contain checked, in WebKit
  5408. if ( isFunction ||
  5409. ( l > 1 && typeof value === "string" &&
  5410. !support.checkClone && rchecked.test( value ) ) ) {
  5411. return collection.each( function( index ) {
  5412. var self = collection.eq( index );
  5413. if ( isFunction ) {
  5414. args[ 0 ] = value.call( this, index, self.html() );
  5415. }
  5416. domManip( self, args, callback, ignored );
  5417. } );
  5418. }
  5419. if ( l ) {
  5420. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  5421. first = fragment.firstChild;
  5422. if ( fragment.childNodes.length === 1 ) {
  5423. fragment = first;
  5424. }
  5425. // Require either new content or an interest in ignored elements to invoke the callback
  5426. if ( first || ignored ) {
  5427. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  5428. hasScripts = scripts.length;
  5429. // Use the original fragment for the last item
  5430. // instead of the first because it can end up
  5431. // being emptied incorrectly in certain situations (#8070).
  5432. for ( ; i < l; i++ ) {
  5433. node = fragment;
  5434. if ( i !== iNoClone ) {
  5435. node = jQuery.clone( node, true, true );
  5436. // Keep references to cloned scripts for later restoration
  5437. if ( hasScripts ) {
  5438. // Support: Android <=4.0 only, PhantomJS 1 only
  5439. // push.apply(_, arraylike) throws on ancient WebKit
  5440. jQuery.merge( scripts, getAll( node, "script" ) );
  5441. }
  5442. }
  5443. callback.call( collection[ i ], node, i );
  5444. }
  5445. if ( hasScripts ) {
  5446. doc = scripts[ scripts.length - 1 ].ownerDocument;
  5447. // Reenable scripts
  5448. jQuery.map( scripts, restoreScript );
  5449. // Evaluate executable scripts on first document insertion
  5450. for ( i = 0; i < hasScripts; i++ ) {
  5451. node = scripts[ i ];
  5452. if ( rscriptType.test( node.type || "" ) &&
  5453. !dataPriv.access( node, "globalEval" ) &&
  5454. jQuery.contains( doc, node ) ) {
  5455. if ( node.src ) {
  5456. // Optional AJAX dependency, but won't run scripts if not present
  5457. if ( jQuery._evalUrl ) {
  5458. jQuery._evalUrl( node.src );
  5459. }
  5460. } else {
  5461. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  5462. }
  5463. }
  5464. }
  5465. }
  5466. }
  5467. }
  5468. return collection;
  5469. }
  5470. function remove( elem, selector, keepData ) {
  5471. var node,
  5472. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  5473. i = 0;
  5474. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  5475. if ( !keepData && node.nodeType === 1 ) {
  5476. jQuery.cleanData( getAll( node ) );
  5477. }
  5478. if ( node.parentNode ) {
  5479. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  5480. setGlobalEval( getAll( node, "script" ) );
  5481. }
  5482. node.parentNode.removeChild( node );
  5483. }
  5484. }
  5485. return elem;
  5486. }
  5487. jQuery.extend( {
  5488. htmlPrefilter: function( html ) {
  5489. return html.replace( rxhtmlTag, "<$1></$2>" );
  5490. },
  5491. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5492. var i, l, srcElements, destElements,
  5493. clone = elem.cloneNode( true ),
  5494. inPage = jQuery.contains( elem.ownerDocument, elem );
  5495. // Fix IE cloning issues
  5496. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5497. !jQuery.isXMLDoc( elem ) ) {
  5498. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5499. destElements = getAll( clone );
  5500. srcElements = getAll( elem );
  5501. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5502. fixInput( srcElements[ i ], destElements[ i ] );
  5503. }
  5504. }
  5505. // Copy the events from the original to the clone
  5506. if ( dataAndEvents ) {
  5507. if ( deepDataAndEvents ) {
  5508. srcElements = srcElements || getAll( elem );
  5509. destElements = destElements || getAll( clone );
  5510. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5511. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5512. }
  5513. } else {
  5514. cloneCopyEvent( elem, clone );
  5515. }
  5516. }
  5517. // Preserve script evaluation history
  5518. destElements = getAll( clone, "script" );
  5519. if ( destElements.length > 0 ) {
  5520. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5521. }
  5522. // Return the cloned set
  5523. return clone;
  5524. },
  5525. cleanData: function( elems ) {
  5526. var data, elem, type,
  5527. special = jQuery.event.special,
  5528. i = 0;
  5529. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5530. if ( acceptData( elem ) ) {
  5531. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5532. if ( data.events ) {
  5533. for ( type in data.events ) {
  5534. if ( special[ type ] ) {
  5535. jQuery.event.remove( elem, type );
  5536. // This is a shortcut to avoid jQuery.event.remove's overhead
  5537. } else {
  5538. jQuery.removeEvent( elem, type, data.handle );
  5539. }
  5540. }
  5541. }
  5542. // Support: Chrome <=35 - 45+
  5543. // Assign undefined instead of using delete, see Data#remove
  5544. elem[ dataPriv.expando ] = undefined;
  5545. }
  5546. if ( elem[ dataUser.expando ] ) {
  5547. // Support: Chrome <=35 - 45+
  5548. // Assign undefined instead of using delete, see Data#remove
  5549. elem[ dataUser.expando ] = undefined;
  5550. }
  5551. }
  5552. }
  5553. }
  5554. } );
  5555. jQuery.fn.extend( {
  5556. detach: function( selector ) {
  5557. return remove( this, selector, true );
  5558. },
  5559. remove: function( selector ) {
  5560. return remove( this, selector );
  5561. },
  5562. text: function( value ) {
  5563. return access( this, function( value ) {
  5564. return value === undefined ?
  5565. jQuery.text( this ) :
  5566. this.empty().each( function() {
  5567. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5568. this.textContent = value;
  5569. }
  5570. } );
  5571. }, null, value, arguments.length );
  5572. },
  5573. append: function() {
  5574. return domManip( this, arguments, function( elem ) {
  5575. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5576. var target = manipulationTarget( this, elem );
  5577. target.appendChild( elem );
  5578. }
  5579. } );
  5580. },
  5581. prepend: function() {
  5582. return domManip( this, arguments, function( elem ) {
  5583. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5584. var target = manipulationTarget( this, elem );
  5585. target.insertBefore( elem, target.firstChild );
  5586. }
  5587. } );
  5588. },
  5589. before: function() {
  5590. return domManip( this, arguments, function( elem ) {
  5591. if ( this.parentNode ) {
  5592. this.parentNode.insertBefore( elem, this );
  5593. }
  5594. } );
  5595. },
  5596. after: function() {
  5597. return domManip( this, arguments, function( elem ) {
  5598. if ( this.parentNode ) {
  5599. this.parentNode.insertBefore( elem, this.nextSibling );
  5600. }
  5601. } );
  5602. },
  5603. empty: function() {
  5604. var elem,
  5605. i = 0;
  5606. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5607. if ( elem.nodeType === 1 ) {
  5608. // Prevent memory leaks
  5609. jQuery.cleanData( getAll( elem, false ) );
  5610. // Remove any remaining nodes
  5611. elem.textContent = "";
  5612. }
  5613. }
  5614. return this;
  5615. },
  5616. clone: function( dataAndEvents, deepDataAndEvents ) {
  5617. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5618. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5619. return this.map( function() {
  5620. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5621. } );
  5622. },
  5623. html: function( value ) {
  5624. return access( this, function( value ) {
  5625. var elem = this[ 0 ] || {},
  5626. i = 0,
  5627. l = this.length;
  5628. if ( value === undefined && elem.nodeType === 1 ) {
  5629. return elem.innerHTML;
  5630. }
  5631. // See if we can take a shortcut and just use innerHTML
  5632. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5633. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5634. value = jQuery.htmlPrefilter( value );
  5635. try {
  5636. for ( ; i < l; i++ ) {
  5637. elem = this[ i ] || {};
  5638. // Remove element nodes and prevent memory leaks
  5639. if ( elem.nodeType === 1 ) {
  5640. jQuery.cleanData( getAll( elem, false ) );
  5641. elem.innerHTML = value;
  5642. }
  5643. }
  5644. elem = 0;
  5645. // If using innerHTML throws an exception, use the fallback method
  5646. } catch ( e ) {}
  5647. }
  5648. if ( elem ) {
  5649. this.empty().append( value );
  5650. }
  5651. }, null, value, arguments.length );
  5652. },
  5653. replaceWith: function() {
  5654. var ignored = [];
  5655. // Make the changes, replacing each non-ignored context element with the new content
  5656. return domManip( this, arguments, function( elem ) {
  5657. var parent = this.parentNode;
  5658. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5659. jQuery.cleanData( getAll( this ) );
  5660. if ( parent ) {
  5661. parent.replaceChild( elem, this );
  5662. }
  5663. }
  5664. // Force callback invocation
  5665. }, ignored );
  5666. }
  5667. } );
  5668. jQuery.each( {
  5669. appendTo: "append",
  5670. prependTo: "prepend",
  5671. insertBefore: "before",
  5672. insertAfter: "after",
  5673. replaceAll: "replaceWith"
  5674. }, function( name, original ) {
  5675. jQuery.fn[ name ] = function( selector ) {
  5676. var elems,
  5677. ret = [],
  5678. insert = jQuery( selector ),
  5679. last = insert.length - 1,
  5680. i = 0;
  5681. for ( ; i <= last; i++ ) {
  5682. elems = i === last ? this : this.clone( true );
  5683. jQuery( insert[ i ] )[ original ]( elems );
  5684. // Support: Android <=4.0 only, PhantomJS 1 only
  5685. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5686. push.apply( ret, elems.get() );
  5687. }
  5688. return this.pushStack( ret );
  5689. };
  5690. } );
  5691. var rmargin = ( /^margin/ );
  5692. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5693. var getStyles = function( elem ) {
  5694. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5695. // IE throws on elements created in popups
  5696. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5697. var view = elem.ownerDocument.defaultView;
  5698. if ( !view || !view.opener ) {
  5699. view = window;
  5700. }
  5701. return view.getComputedStyle( elem );
  5702. };
  5703. ( function() {
  5704. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5705. // so they're executed at the same time to save the second computation.
  5706. function computeStyleTests() {
  5707. // This is a singleton, we need to execute it only once
  5708. if ( !div ) {
  5709. return;
  5710. }
  5711. div.style.cssText =
  5712. "box-sizing:border-box;" +
  5713. "position:relative;display:block;" +
  5714. "margin:auto;border:1px;padding:1px;" +
  5715. "top:1%;width:50%";
  5716. div.innerHTML = "";
  5717. documentElement.appendChild( container );
  5718. var divStyle = window.getComputedStyle( div );
  5719. pixelPositionVal = divStyle.top !== "1%";
  5720. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5721. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  5722. boxSizingReliableVal = divStyle.width === "4px";
  5723. // Support: Android 4.0 - 4.3 only
  5724. // Some styles come back with percentage values, even though they shouldn't
  5725. div.style.marginRight = "50%";
  5726. pixelMarginRightVal = divStyle.marginRight === "4px";
  5727. documentElement.removeChild( container );
  5728. // Nullify the div so it wouldn't be stored in the memory and
  5729. // it will also be a sign that checks already performed
  5730. div = null;
  5731. }
  5732. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  5733. container = document.createElement( "div" ),
  5734. div = document.createElement( "div" );
  5735. // Finish early in limited (non-browser) environments
  5736. if ( !div.style ) {
  5737. return;
  5738. }
  5739. // Support: IE <=9 - 11 only
  5740. // Style of cloned element affects source element cloned (#8908)
  5741. div.style.backgroundClip = "content-box";
  5742. div.cloneNode( true ).style.backgroundClip = "";
  5743. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5744. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5745. "padding:0;margin-top:1px;position:absolute";
  5746. container.appendChild( div );
  5747. jQuery.extend( support, {
  5748. pixelPosition: function() {
  5749. computeStyleTests();
  5750. return pixelPositionVal;
  5751. },
  5752. boxSizingReliable: function() {
  5753. computeStyleTests();
  5754. return boxSizingReliableVal;
  5755. },
  5756. pixelMarginRight: function() {
  5757. computeStyleTests();
  5758. return pixelMarginRightVal;
  5759. },
  5760. reliableMarginLeft: function() {
  5761. computeStyleTests();
  5762. return reliableMarginLeftVal;
  5763. }
  5764. } );
  5765. } )();
  5766. function curCSS( elem, name, computed ) {
  5767. var width, minWidth, maxWidth, ret,
  5768. // Support: Firefox 51+
  5769. // Retrieving style before computed somehow
  5770. // fixes an issue with getting wrong values
  5771. // on detached elements
  5772. style = elem.style;
  5773. computed = computed || getStyles( elem );
  5774. // getPropertyValue is needed for:
  5775. // .css('filter') (IE 9 only, #12537)
  5776. // .css('--customProperty) (#3144)
  5777. if ( computed ) {
  5778. ret = computed.getPropertyValue( name ) || computed[ name ];
  5779. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5780. ret = jQuery.style( elem, name );
  5781. }
  5782. // A tribute to the "awesome hack by Dean Edwards"
  5783. // Android Browser returns percentage for some values,
  5784. // but width seems to be reliably pixels.
  5785. // This is against the CSSOM draft spec:
  5786. // https://drafts.csswg.org/cssom/#resolved-values
  5787. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5788. // Remember the original values
  5789. width = style.width;
  5790. minWidth = style.minWidth;
  5791. maxWidth = style.maxWidth;
  5792. // Put in the new values to get a computed value out
  5793. style.minWidth = style.maxWidth = style.width = ret;
  5794. ret = computed.width;
  5795. // Revert the changed values
  5796. style.width = width;
  5797. style.minWidth = minWidth;
  5798. style.maxWidth = maxWidth;
  5799. }
  5800. }
  5801. return ret !== undefined ?
  5802. // Support: IE <=9 - 11 only
  5803. // IE returns zIndex value as an integer.
  5804. ret + "" :
  5805. ret;
  5806. }
  5807. function addGetHookIf( conditionFn, hookFn ) {
  5808. // Define the hook, we'll check on the first run if it's really needed.
  5809. return {
  5810. get: function() {
  5811. if ( conditionFn() ) {
  5812. // Hook not needed (or it's not possible to use it due
  5813. // to missing dependency), remove it.
  5814. delete this.get;
  5815. return;
  5816. }
  5817. // Hook needed; redefine it so that the support test is not executed again.
  5818. return ( this.get = hookFn ).apply( this, arguments );
  5819. }
  5820. };
  5821. }
  5822. var
  5823. // Swappable if display is none or starts with table
  5824. // except "table", "table-cell", or "table-caption"
  5825. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5826. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5827. rcustomProp = /^--/,
  5828. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5829. cssNormalTransform = {
  5830. letterSpacing: "0",
  5831. fontWeight: "400"
  5832. },
  5833. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5834. emptyStyle = document.createElement( "div" ).style;
  5835. // Return a css property mapped to a potentially vendor prefixed property
  5836. function vendorPropName( name ) {
  5837. // Shortcut for names that are not vendor prefixed
  5838. if ( name in emptyStyle ) {
  5839. return name;
  5840. }
  5841. // Check for vendor prefixed names
  5842. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5843. i = cssPrefixes.length;
  5844. while ( i-- ) {
  5845. name = cssPrefixes[ i ] + capName;
  5846. if ( name in emptyStyle ) {
  5847. return name;
  5848. }
  5849. }
  5850. }
  5851. // Return a property mapped along what jQuery.cssProps suggests or to
  5852. // a vendor prefixed property.
  5853. function finalPropName( name ) {
  5854. var ret = jQuery.cssProps[ name ];
  5855. if ( !ret ) {
  5856. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5857. }
  5858. return ret;
  5859. }
  5860. function setPositiveNumber( elem, value, subtract ) {
  5861. // Any relative (+/-) values have already been
  5862. // normalized at this point
  5863. var matches = rcssNum.exec( value );
  5864. return matches ?
  5865. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5866. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5867. value;
  5868. }
  5869. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5870. var i,
  5871. val = 0;
  5872. // If we already have the right measurement, avoid augmentation
  5873. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  5874. i = 4;
  5875. // Otherwise initialize for horizontal or vertical properties
  5876. } else {
  5877. i = name === "width" ? 1 : 0;
  5878. }
  5879. for ( ; i < 4; i += 2 ) {
  5880. // Both box models exclude margin, so add it if we want it
  5881. if ( extra === "margin" ) {
  5882. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5883. }
  5884. if ( isBorderBox ) {
  5885. // border-box includes padding, so remove it if we want content
  5886. if ( extra === "content" ) {
  5887. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5888. }
  5889. // At this point, extra isn't border nor margin, so remove border
  5890. if ( extra !== "margin" ) {
  5891. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5892. }
  5893. } else {
  5894. // At this point, extra isn't content, so add padding
  5895. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5896. // At this point, extra isn't content nor padding, so add border
  5897. if ( extra !== "padding" ) {
  5898. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5899. }
  5900. }
  5901. }
  5902. return val;
  5903. }
  5904. function getWidthOrHeight( elem, name, extra ) {
  5905. // Start with computed style
  5906. var valueIsBorderBox,
  5907. styles = getStyles( elem ),
  5908. val = curCSS( elem, name, styles ),
  5909. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5910. // Computed unit is not pixels. Stop here and return.
  5911. if ( rnumnonpx.test( val ) ) {
  5912. return val;
  5913. }
  5914. // Check for style in case a browser which returns unreliable values
  5915. // for getComputedStyle silently falls back to the reliable elem.style
  5916. valueIsBorderBox = isBorderBox &&
  5917. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5918. // Fall back to offsetWidth/Height when value is "auto"
  5919. // This happens for inline elements with no explicit setting (gh-3571)
  5920. if ( val === "auto" ) {
  5921. val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
  5922. }
  5923. // Normalize "", auto, and prepare for extra
  5924. val = parseFloat( val ) || 0;
  5925. // Use the active box-sizing model to add/subtract irrelevant styles
  5926. return ( val +
  5927. augmentWidthOrHeight(
  5928. elem,
  5929. name,
  5930. extra || ( isBorderBox ? "border" : "content" ),
  5931. valueIsBorderBox,
  5932. styles
  5933. )
  5934. ) + "px";
  5935. }
  5936. jQuery.extend( {
  5937. // Add in style property hooks for overriding the default
  5938. // behavior of getting and setting a style property
  5939. cssHooks: {
  5940. opacity: {
  5941. get: function( elem, computed ) {
  5942. if ( computed ) {
  5943. // We should always get a number back from opacity
  5944. var ret = curCSS( elem, "opacity" );
  5945. return ret === "" ? "1" : ret;
  5946. }
  5947. }
  5948. }
  5949. },
  5950. // Don't automatically add "px" to these possibly-unitless properties
  5951. cssNumber: {
  5952. "animationIterationCount": true,
  5953. "columnCount": true,
  5954. "fillOpacity": true,
  5955. "flexGrow": true,
  5956. "flexShrink": true,
  5957. "fontWeight": true,
  5958. "lineHeight": true,
  5959. "opacity": true,
  5960. "order": true,
  5961. "orphans": true,
  5962. "widows": true,
  5963. "zIndex": true,
  5964. "zoom": true
  5965. },
  5966. // Add in properties whose names you wish to fix before
  5967. // setting or getting the value
  5968. cssProps: {
  5969. "float": "cssFloat"
  5970. },
  5971. // Get and set the style property on a DOM Node
  5972. style: function( elem, name, value, extra ) {
  5973. // Don't set styles on text and comment nodes
  5974. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5975. return;
  5976. }
  5977. // Make sure that we're working with the right name
  5978. var ret, type, hooks,
  5979. origName = jQuery.camelCase( name ),
  5980. isCustomProp = rcustomProp.test( name ),
  5981. style = elem.style;
  5982. // Make sure that we're working with the right name. We don't
  5983. // want to query the value if it is a CSS custom property
  5984. // since they are user-defined.
  5985. if ( !isCustomProp ) {
  5986. name = finalPropName( origName );
  5987. }
  5988. // Gets hook for the prefixed version, then unprefixed version
  5989. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5990. // Check if we're setting a value
  5991. if ( value !== undefined ) {
  5992. type = typeof value;
  5993. // Convert "+=" or "-=" to relative numbers (#7345)
  5994. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5995. value = adjustCSS( elem, name, ret );
  5996. // Fixes bug #9237
  5997. type = "number";
  5998. }
  5999. // Make sure that null and NaN values aren't set (#7116)
  6000. if ( value == null || value !== value ) {
  6001. return;
  6002. }
  6003. // If a number was passed in, add the unit (except for certain CSS properties)
  6004. if ( type === "number" ) {
  6005. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6006. }
  6007. // background-* props affect original clone's values
  6008. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6009. style[ name ] = "inherit";
  6010. }
  6011. // If a hook was provided, use that value, otherwise just set the specified value
  6012. if ( !hooks || !( "set" in hooks ) ||
  6013. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6014. if ( isCustomProp ) {
  6015. style.setProperty( name, value );
  6016. } else {
  6017. style[ name ] = value;
  6018. }
  6019. }
  6020. } else {
  6021. // If a hook was provided get the non-computed value from there
  6022. if ( hooks && "get" in hooks &&
  6023. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6024. return ret;
  6025. }
  6026. // Otherwise just get the value from the style object
  6027. return style[ name ];
  6028. }
  6029. },
  6030. css: function( elem, name, extra, styles ) {
  6031. var val, num, hooks,
  6032. origName = jQuery.camelCase( name ),
  6033. isCustomProp = rcustomProp.test( name );
  6034. // Make sure that we're working with the right name. We don't
  6035. // want to modify the value if it is a CSS custom property
  6036. // since they are user-defined.
  6037. if ( !isCustomProp ) {
  6038. name = finalPropName( origName );
  6039. }
  6040. // Try prefixed name followed by the unprefixed name
  6041. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6042. // If a hook was provided get the computed value from there
  6043. if ( hooks && "get" in hooks ) {
  6044. val = hooks.get( elem, true, extra );
  6045. }
  6046. // Otherwise, if a way to get the computed value exists, use that
  6047. if ( val === undefined ) {
  6048. val = curCSS( elem, name, styles );
  6049. }
  6050. // Convert "normal" to computed value
  6051. if ( val === "normal" && name in cssNormalTransform ) {
  6052. val = cssNormalTransform[ name ];
  6053. }
  6054. // Make numeric if forced or a qualifier was provided and val looks numeric
  6055. if ( extra === "" || extra ) {
  6056. num = parseFloat( val );
  6057. return extra === true || isFinite( num ) ? num || 0 : val;
  6058. }
  6059. return val;
  6060. }
  6061. } );
  6062. jQuery.each( [ "height", "width" ], function( i, name ) {
  6063. jQuery.cssHooks[ name ] = {
  6064. get: function( elem, computed, extra ) {
  6065. if ( computed ) {
  6066. // Certain elements can have dimension info if we invisibly show them
  6067. // but it must have a current display style that would benefit
  6068. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  6069. // Support: Safari 8+
  6070. // Table columns in Safari have non-zero offsetWidth & zero
  6071. // getBoundingClientRect().width unless display is changed.
  6072. // Support: IE <=11 only
  6073. // Running getBoundingClientRect on a disconnected node
  6074. // in IE throws an error.
  6075. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  6076. swap( elem, cssShow, function() {
  6077. return getWidthOrHeight( elem, name, extra );
  6078. } ) :
  6079. getWidthOrHeight( elem, name, extra );
  6080. }
  6081. },
  6082. set: function( elem, value, extra ) {
  6083. var matches,
  6084. styles = extra && getStyles( elem ),
  6085. subtract = extra && augmentWidthOrHeight(
  6086. elem,
  6087. name,
  6088. extra,
  6089. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6090. styles
  6091. );
  6092. // Convert to pixels if value adjustment is needed
  6093. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  6094. ( matches[ 3 ] || "px" ) !== "px" ) {
  6095. elem.style[ name ] = value;
  6096. value = jQuery.css( elem, name );
  6097. }
  6098. return setPositiveNumber( elem, value, subtract );
  6099. }
  6100. };
  6101. } );
  6102. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  6103. function( elem, computed ) {
  6104. if ( computed ) {
  6105. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  6106. elem.getBoundingClientRect().left -
  6107. swap( elem, { marginLeft: 0 }, function() {
  6108. return elem.getBoundingClientRect().left;
  6109. } )
  6110. ) + "px";
  6111. }
  6112. }
  6113. );
  6114. // These hooks are used by animate to expand properties
  6115. jQuery.each( {
  6116. margin: "",
  6117. padding: "",
  6118. border: "Width"
  6119. }, function( prefix, suffix ) {
  6120. jQuery.cssHooks[ prefix + suffix ] = {
  6121. expand: function( value ) {
  6122. var i = 0,
  6123. expanded = {},
  6124. // Assumes a single number if not a string
  6125. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  6126. for ( ; i < 4; i++ ) {
  6127. expanded[ prefix + cssExpand[ i ] + suffix ] =
  6128. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  6129. }
  6130. return expanded;
  6131. }
  6132. };
  6133. if ( !rmargin.test( prefix ) ) {
  6134. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  6135. }
  6136. } );
  6137. jQuery.fn.extend( {
  6138. css: function( name, value ) {
  6139. return access( this, function( elem, name, value ) {
  6140. var styles, len,
  6141. map = {},
  6142. i = 0;
  6143. if ( Array.isArray( name ) ) {
  6144. styles = getStyles( elem );
  6145. len = name.length;
  6146. for ( ; i < len; i++ ) {
  6147. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  6148. }
  6149. return map;
  6150. }
  6151. return value !== undefined ?
  6152. jQuery.style( elem, name, value ) :
  6153. jQuery.css( elem, name );
  6154. }, name, value, arguments.length > 1 );
  6155. }
  6156. } );
  6157. function Tween( elem, options, prop, end, easing ) {
  6158. return new Tween.prototype.init( elem, options, prop, end, easing );
  6159. }
  6160. jQuery.Tween = Tween;
  6161. Tween.prototype = {
  6162. constructor: Tween,
  6163. init: function( elem, options, prop, end, easing, unit ) {
  6164. this.elem = elem;
  6165. this.prop = prop;
  6166. this.easing = easing || jQuery.easing._default;
  6167. this.options = options;
  6168. this.start = this.now = this.cur();
  6169. this.end = end;
  6170. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6171. },
  6172. cur: function() {
  6173. var hooks = Tween.propHooks[ this.prop ];
  6174. return hooks && hooks.get ?
  6175. hooks.get( this ) :
  6176. Tween.propHooks._default.get( this );
  6177. },
  6178. run: function( percent ) {
  6179. var eased,
  6180. hooks = Tween.propHooks[ this.prop ];
  6181. if ( this.options.duration ) {
  6182. this.pos = eased = jQuery.easing[ this.easing ](
  6183. percent, this.options.duration * percent, 0, 1, this.options.duration
  6184. );
  6185. } else {
  6186. this.pos = eased = percent;
  6187. }
  6188. this.now = ( this.end - this.start ) * eased + this.start;
  6189. if ( this.options.step ) {
  6190. this.options.step.call( this.elem, this.now, this );
  6191. }
  6192. if ( hooks && hooks.set ) {
  6193. hooks.set( this );
  6194. } else {
  6195. Tween.propHooks._default.set( this );
  6196. }
  6197. return this;
  6198. }
  6199. };
  6200. Tween.prototype.init.prototype = Tween.prototype;
  6201. Tween.propHooks = {
  6202. _default: {
  6203. get: function( tween ) {
  6204. var result;
  6205. // Use a property on the element directly when it is not a DOM element,
  6206. // or when there is no matching style property that exists.
  6207. if ( tween.elem.nodeType !== 1 ||
  6208. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6209. return tween.elem[ tween.prop ];
  6210. }
  6211. // Passing an empty string as a 3rd parameter to .css will automatically
  6212. // attempt a parseFloat and fallback to a string if the parse fails.
  6213. // Simple values such as "10px" are parsed to Float;
  6214. // complex values such as "rotate(1rad)" are returned as-is.
  6215. result = jQuery.css( tween.elem, tween.prop, "" );
  6216. // Empty strings, null, undefined and "auto" are converted to 0.
  6217. return !result || result === "auto" ? 0 : result;
  6218. },
  6219. set: function( tween ) {
  6220. // Use step hook for back compat.
  6221. // Use cssHook if its there.
  6222. // Use .style if available and use plain properties where available.
  6223. if ( jQuery.fx.step[ tween.prop ] ) {
  6224. jQuery.fx.step[ tween.prop ]( tween );
  6225. } else if ( tween.elem.nodeType === 1 &&
  6226. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  6227. jQuery.cssHooks[ tween.prop ] ) ) {
  6228. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6229. } else {
  6230. tween.elem[ tween.prop ] = tween.now;
  6231. }
  6232. }
  6233. }
  6234. };
  6235. // Support: IE <=9 only
  6236. // Panic based approach to setting things on disconnected nodes
  6237. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6238. set: function( tween ) {
  6239. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6240. tween.elem[ tween.prop ] = tween.now;
  6241. }
  6242. }
  6243. };
  6244. jQuery.easing = {
  6245. linear: function( p ) {
  6246. return p;
  6247. },
  6248. swing: function( p ) {
  6249. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6250. },
  6251. _default: "swing"
  6252. };
  6253. jQuery.fx = Tween.prototype.init;
  6254. // Back compat <1.8 extension point
  6255. jQuery.fx.step = {};
  6256. var
  6257. fxNow, inProgress,
  6258. rfxtypes = /^(?:toggle|show|hide)$/,
  6259. rrun = /queueHooks$/;
  6260. function schedule() {
  6261. if ( inProgress ) {
  6262. if ( document.hidden === false && window.requestAnimationFrame ) {
  6263. window.requestAnimationFrame( schedule );
  6264. } else {
  6265. window.setTimeout( schedule, jQuery.fx.interval );
  6266. }
  6267. jQuery.fx.tick();
  6268. }
  6269. }
  6270. // Animations created synchronously will run synchronously
  6271. function createFxNow() {
  6272. window.setTimeout( function() {
  6273. fxNow = undefined;
  6274. } );
  6275. return ( fxNow = jQuery.now() );
  6276. }
  6277. // Generate parameters to create a standard animation
  6278. function genFx( type, includeWidth ) {
  6279. var which,
  6280. i = 0,
  6281. attrs = { height: type };
  6282. // If we include width, step value is 1 to do all cssExpand values,
  6283. // otherwise step value is 2 to skip over Left and Right
  6284. includeWidth = includeWidth ? 1 : 0;
  6285. for ( ; i < 4; i += 2 - includeWidth ) {
  6286. which = cssExpand[ i ];
  6287. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6288. }
  6289. if ( includeWidth ) {
  6290. attrs.opacity = attrs.width = type;
  6291. }
  6292. return attrs;
  6293. }
  6294. function createTween( value, prop, animation ) {
  6295. var tween,
  6296. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6297. index = 0,
  6298. length = collection.length;
  6299. for ( ; index < length; index++ ) {
  6300. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6301. // We're done with this property
  6302. return tween;
  6303. }
  6304. }
  6305. }
  6306. function defaultPrefilter( elem, props, opts ) {
  6307. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  6308. isBox = "width" in props || "height" in props,
  6309. anim = this,
  6310. orig = {},
  6311. style = elem.style,
  6312. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  6313. dataShow = dataPriv.get( elem, "fxshow" );
  6314. // Queue-skipping animations hijack the fx hooks
  6315. if ( !opts.queue ) {
  6316. hooks = jQuery._queueHooks( elem, "fx" );
  6317. if ( hooks.unqueued == null ) {
  6318. hooks.unqueued = 0;
  6319. oldfire = hooks.empty.fire;
  6320. hooks.empty.fire = function() {
  6321. if ( !hooks.unqueued ) {
  6322. oldfire();
  6323. }
  6324. };
  6325. }
  6326. hooks.unqueued++;
  6327. anim.always( function() {
  6328. // Ensure the complete handler is called before this completes
  6329. anim.always( function() {
  6330. hooks.unqueued--;
  6331. if ( !jQuery.queue( elem, "fx" ).length ) {
  6332. hooks.empty.fire();
  6333. }
  6334. } );
  6335. } );
  6336. }
  6337. // Detect show/hide animations
  6338. for ( prop in props ) {
  6339. value = props[ prop ];
  6340. if ( rfxtypes.test( value ) ) {
  6341. delete props[ prop ];
  6342. toggle = toggle || value === "toggle";
  6343. if ( value === ( hidden ? "hide" : "show" ) ) {
  6344. // Pretend to be hidden if this is a "show" and
  6345. // there is still data from a stopped show/hide
  6346. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6347. hidden = true;
  6348. // Ignore all other no-op show/hide data
  6349. } else {
  6350. continue;
  6351. }
  6352. }
  6353. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6354. }
  6355. }
  6356. // Bail out if this is a no-op like .hide().hide()
  6357. propTween = !jQuery.isEmptyObject( props );
  6358. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  6359. return;
  6360. }
  6361. // Restrict "overflow" and "display" styles during box animations
  6362. if ( isBox && elem.nodeType === 1 ) {
  6363. // Support: IE <=9 - 11, Edge 12 - 13
  6364. // Record all 3 overflow attributes because IE does not infer the shorthand
  6365. // from identically-valued overflowX and overflowY
  6366. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6367. // Identify a display type, preferring old show/hide data over the CSS cascade
  6368. restoreDisplay = dataShow && dataShow.display;
  6369. if ( restoreDisplay == null ) {
  6370. restoreDisplay = dataPriv.get( elem, "display" );
  6371. }
  6372. display = jQuery.css( elem, "display" );
  6373. if ( display === "none" ) {
  6374. if ( restoreDisplay ) {
  6375. display = restoreDisplay;
  6376. } else {
  6377. // Get nonempty value(s) by temporarily forcing visibility
  6378. showHide( [ elem ], true );
  6379. restoreDisplay = elem.style.display || restoreDisplay;
  6380. display = jQuery.css( elem, "display" );
  6381. showHide( [ elem ] );
  6382. }
  6383. }
  6384. // Animate inline elements as inline-block
  6385. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  6386. if ( jQuery.css( elem, "float" ) === "none" ) {
  6387. // Restore the original display value at the end of pure show/hide animations
  6388. if ( !propTween ) {
  6389. anim.done( function() {
  6390. style.display = restoreDisplay;
  6391. } );
  6392. if ( restoreDisplay == null ) {
  6393. display = style.display;
  6394. restoreDisplay = display === "none" ? "" : display;
  6395. }
  6396. }
  6397. style.display = "inline-block";
  6398. }
  6399. }
  6400. }
  6401. if ( opts.overflow ) {
  6402. style.overflow = "hidden";
  6403. anim.always( function() {
  6404. style.overflow = opts.overflow[ 0 ];
  6405. style.overflowX = opts.overflow[ 1 ];
  6406. style.overflowY = opts.overflow[ 2 ];
  6407. } );
  6408. }
  6409. // Implement show/hide animations
  6410. propTween = false;
  6411. for ( prop in orig ) {
  6412. // General show/hide setup for this element animation
  6413. if ( !propTween ) {
  6414. if ( dataShow ) {
  6415. if ( "hidden" in dataShow ) {
  6416. hidden = dataShow.hidden;
  6417. }
  6418. } else {
  6419. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  6420. }
  6421. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  6422. if ( toggle ) {
  6423. dataShow.hidden = !hidden;
  6424. }
  6425. // Show elements before animating them
  6426. if ( hidden ) {
  6427. showHide( [ elem ], true );
  6428. }
  6429. /* eslint-disable no-loop-func */
  6430. anim.done( function() {
  6431. /* eslint-enable no-loop-func */
  6432. // The final step of a "hide" animation is actually hiding the element
  6433. if ( !hidden ) {
  6434. showHide( [ elem ] );
  6435. }
  6436. dataPriv.remove( elem, "fxshow" );
  6437. for ( prop in orig ) {
  6438. jQuery.style( elem, prop, orig[ prop ] );
  6439. }
  6440. } );
  6441. }
  6442. // Per-property setup
  6443. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6444. if ( !( prop in dataShow ) ) {
  6445. dataShow[ prop ] = propTween.start;
  6446. if ( hidden ) {
  6447. propTween.end = propTween.start;
  6448. propTween.start = 0;
  6449. }
  6450. }
  6451. }
  6452. }
  6453. function propFilter( props, specialEasing ) {
  6454. var index, name, easing, value, hooks;
  6455. // camelCase, specialEasing and expand cssHook pass
  6456. for ( index in props ) {
  6457. name = jQuery.camelCase( index );
  6458. easing = specialEasing[ name ];
  6459. value = props[ index ];
  6460. if ( Array.isArray( value ) ) {
  6461. easing = value[ 1 ];
  6462. value = props[ index ] = value[ 0 ];
  6463. }
  6464. if ( index !== name ) {
  6465. props[ name ] = value;
  6466. delete props[ index ];
  6467. }
  6468. hooks = jQuery.cssHooks[ name ];
  6469. if ( hooks && "expand" in hooks ) {
  6470. value = hooks.expand( value );
  6471. delete props[ name ];
  6472. // Not quite $.extend, this won't overwrite existing keys.
  6473. // Reusing 'index' because we have the correct "name"
  6474. for ( index in value ) {
  6475. if ( !( index in props ) ) {
  6476. props[ index ] = value[ index ];
  6477. specialEasing[ index ] = easing;
  6478. }
  6479. }
  6480. } else {
  6481. specialEasing[ name ] = easing;
  6482. }
  6483. }
  6484. }
  6485. function Animation( elem, properties, options ) {
  6486. var result,
  6487. stopped,
  6488. index = 0,
  6489. length = Animation.prefilters.length,
  6490. deferred = jQuery.Deferred().always( function() {
  6491. // Don't match elem in the :animated selector
  6492. delete tick.elem;
  6493. } ),
  6494. tick = function() {
  6495. if ( stopped ) {
  6496. return false;
  6497. }
  6498. var currentTime = fxNow || createFxNow(),
  6499. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6500. // Support: Android 2.3 only
  6501. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6502. temp = remaining / animation.duration || 0,
  6503. percent = 1 - temp,
  6504. index = 0,
  6505. length = animation.tweens.length;
  6506. for ( ; index < length; index++ ) {
  6507. animation.tweens[ index ].run( percent );
  6508. }
  6509. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6510. // If there's more to do, yield
  6511. if ( percent < 1 && length ) {
  6512. return remaining;
  6513. }
  6514. // If this was an empty animation, synthesize a final progress notification
  6515. if ( !length ) {
  6516. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6517. }
  6518. // Resolve the animation and report its conclusion
  6519. deferred.resolveWith( elem, [ animation ] );
  6520. return false;
  6521. },
  6522. animation = deferred.promise( {
  6523. elem: elem,
  6524. props: jQuery.extend( {}, properties ),
  6525. opts: jQuery.extend( true, {
  6526. specialEasing: {},
  6527. easing: jQuery.easing._default
  6528. }, options ),
  6529. originalProperties: properties,
  6530. originalOptions: options,
  6531. startTime: fxNow || createFxNow(),
  6532. duration: options.duration,
  6533. tweens: [],
  6534. createTween: function( prop, end ) {
  6535. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6536. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6537. animation.tweens.push( tween );
  6538. return tween;
  6539. },
  6540. stop: function( gotoEnd ) {
  6541. var index = 0,
  6542. // If we are going to the end, we want to run all the tweens
  6543. // otherwise we skip this part
  6544. length = gotoEnd ? animation.tweens.length : 0;
  6545. if ( stopped ) {
  6546. return this;
  6547. }
  6548. stopped = true;
  6549. for ( ; index < length; index++ ) {
  6550. animation.tweens[ index ].run( 1 );
  6551. }
  6552. // Resolve when we played the last frame; otherwise, reject
  6553. if ( gotoEnd ) {
  6554. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6555. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6556. } else {
  6557. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6558. }
  6559. return this;
  6560. }
  6561. } ),
  6562. props = animation.props;
  6563. propFilter( props, animation.opts.specialEasing );
  6564. for ( ; index < length; index++ ) {
  6565. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6566. if ( result ) {
  6567. if ( jQuery.isFunction( result.stop ) ) {
  6568. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6569. jQuery.proxy( result.stop, result );
  6570. }
  6571. return result;
  6572. }
  6573. }
  6574. jQuery.map( props, createTween, animation );
  6575. if ( jQuery.isFunction( animation.opts.start ) ) {
  6576. animation.opts.start.call( elem, animation );
  6577. }
  6578. // Attach callbacks from options
  6579. animation
  6580. .progress( animation.opts.progress )
  6581. .done( animation.opts.done, animation.opts.complete )
  6582. .fail( animation.opts.fail )
  6583. .always( animation.opts.always );
  6584. jQuery.fx.timer(
  6585. jQuery.extend( tick, {
  6586. elem: elem,
  6587. anim: animation,
  6588. queue: animation.opts.queue
  6589. } )
  6590. );
  6591. return animation;
  6592. }
  6593. jQuery.Animation = jQuery.extend( Animation, {
  6594. tweeners: {
  6595. "*": [ function( prop, value ) {
  6596. var tween = this.createTween( prop, value );
  6597. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6598. return tween;
  6599. } ]
  6600. },
  6601. tweener: function( props, callback ) {
  6602. if ( jQuery.isFunction( props ) ) {
  6603. callback = props;
  6604. props = [ "*" ];
  6605. } else {
  6606. props = props.match( rnothtmlwhite );
  6607. }
  6608. var prop,
  6609. index = 0,
  6610. length = props.length;
  6611. for ( ; index < length; index++ ) {
  6612. prop = props[ index ];
  6613. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6614. Animation.tweeners[ prop ].unshift( callback );
  6615. }
  6616. },
  6617. prefilters: [ defaultPrefilter ],
  6618. prefilter: function( callback, prepend ) {
  6619. if ( prepend ) {
  6620. Animation.prefilters.unshift( callback );
  6621. } else {
  6622. Animation.prefilters.push( callback );
  6623. }
  6624. }
  6625. } );
  6626. jQuery.speed = function( speed, easing, fn ) {
  6627. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6628. complete: fn || !fn && easing ||
  6629. jQuery.isFunction( speed ) && speed,
  6630. duration: speed,
  6631. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  6632. };
  6633. // Go to the end state if fx are off
  6634. if ( jQuery.fx.off ) {
  6635. opt.duration = 0;
  6636. } else {
  6637. if ( typeof opt.duration !== "number" ) {
  6638. if ( opt.duration in jQuery.fx.speeds ) {
  6639. opt.duration = jQuery.fx.speeds[ opt.duration ];
  6640. } else {
  6641. opt.duration = jQuery.fx.speeds._default;
  6642. }
  6643. }
  6644. }
  6645. // Normalize opt.queue - true/undefined/null -> "fx"
  6646. if ( opt.queue == null || opt.queue === true ) {
  6647. opt.queue = "fx";
  6648. }
  6649. // Queueing
  6650. opt.old = opt.complete;
  6651. opt.complete = function() {
  6652. if ( jQuery.isFunction( opt.old ) ) {
  6653. opt.old.call( this );
  6654. }
  6655. if ( opt.queue ) {
  6656. jQuery.dequeue( this, opt.queue );
  6657. }
  6658. };
  6659. return opt;
  6660. };
  6661. jQuery.fn.extend( {
  6662. fadeTo: function( speed, to, easing, callback ) {
  6663. // Show any hidden elements after setting opacity to 0
  6664. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  6665. // Animate to the value specified
  6666. .end().animate( { opacity: to }, speed, easing, callback );
  6667. },
  6668. animate: function( prop, speed, easing, callback ) {
  6669. var empty = jQuery.isEmptyObject( prop ),
  6670. optall = jQuery.speed( speed, easing, callback ),
  6671. doAnimation = function() {
  6672. // Operate on a copy of prop so per-property easing won't be lost
  6673. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6674. // Empty animations, or finishing resolves immediately
  6675. if ( empty || dataPriv.get( this, "finish" ) ) {
  6676. anim.stop( true );
  6677. }
  6678. };
  6679. doAnimation.finish = doAnimation;
  6680. return empty || optall.queue === false ?
  6681. this.each( doAnimation ) :
  6682. this.queue( optall.queue, doAnimation );
  6683. },
  6684. stop: function( type, clearQueue, gotoEnd ) {
  6685. var stopQueue = function( hooks ) {
  6686. var stop = hooks.stop;
  6687. delete hooks.stop;
  6688. stop( gotoEnd );
  6689. };
  6690. if ( typeof type !== "string" ) {
  6691. gotoEnd = clearQueue;
  6692. clearQueue = type;
  6693. type = undefined;
  6694. }
  6695. if ( clearQueue && type !== false ) {
  6696. this.queue( type || "fx", [] );
  6697. }
  6698. return this.each( function() {
  6699. var dequeue = true,
  6700. index = type != null && type + "queueHooks",
  6701. timers = jQuery.timers,
  6702. data = dataPriv.get( this );
  6703. if ( index ) {
  6704. if ( data[ index ] && data[ index ].stop ) {
  6705. stopQueue( data[ index ] );
  6706. }
  6707. } else {
  6708. for ( index in data ) {
  6709. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6710. stopQueue( data[ index ] );
  6711. }
  6712. }
  6713. }
  6714. for ( index = timers.length; index--; ) {
  6715. if ( timers[ index ].elem === this &&
  6716. ( type == null || timers[ index ].queue === type ) ) {
  6717. timers[ index ].anim.stop( gotoEnd );
  6718. dequeue = false;
  6719. timers.splice( index, 1 );
  6720. }
  6721. }
  6722. // Start the next in the queue if the last step wasn't forced.
  6723. // Timers currently will call their complete callbacks, which
  6724. // will dequeue but only if they were gotoEnd.
  6725. if ( dequeue || !gotoEnd ) {
  6726. jQuery.dequeue( this, type );
  6727. }
  6728. } );
  6729. },
  6730. finish: function( type ) {
  6731. if ( type !== false ) {
  6732. type = type || "fx";
  6733. }
  6734. return this.each( function() {
  6735. var index,
  6736. data = dataPriv.get( this ),
  6737. queue = data[ type + "queue" ],
  6738. hooks = data[ type + "queueHooks" ],
  6739. timers = jQuery.timers,
  6740. length = queue ? queue.length : 0;
  6741. // Enable finishing flag on private data
  6742. data.finish = true;
  6743. // Empty the queue first
  6744. jQuery.queue( this, type, [] );
  6745. if ( hooks && hooks.stop ) {
  6746. hooks.stop.call( this, true );
  6747. }
  6748. // Look for any active animations, and finish them
  6749. for ( index = timers.length; index--; ) {
  6750. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6751. timers[ index ].anim.stop( true );
  6752. timers.splice( index, 1 );
  6753. }
  6754. }
  6755. // Look for any animations in the old queue and finish them
  6756. for ( index = 0; index < length; index++ ) {
  6757. if ( queue[ index ] && queue[ index ].finish ) {
  6758. queue[ index ].finish.call( this );
  6759. }
  6760. }
  6761. // Turn off finishing flag
  6762. delete data.finish;
  6763. } );
  6764. }
  6765. } );
  6766. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6767. var cssFn = jQuery.fn[ name ];
  6768. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6769. return speed == null || typeof speed === "boolean" ?
  6770. cssFn.apply( this, arguments ) :
  6771. this.animate( genFx( name, true ), speed, easing, callback );
  6772. };
  6773. } );
  6774. // Generate shortcuts for custom animations
  6775. jQuery.each( {
  6776. slideDown: genFx( "show" ),
  6777. slideUp: genFx( "hide" ),
  6778. slideToggle: genFx( "toggle" ),
  6779. fadeIn: { opacity: "show" },
  6780. fadeOut: { opacity: "hide" },
  6781. fadeToggle: { opacity: "toggle" }
  6782. }, function( name, props ) {
  6783. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6784. return this.animate( props, speed, easing, callback );
  6785. };
  6786. } );
  6787. jQuery.timers = [];
  6788. jQuery.fx.tick = function() {
  6789. var timer,
  6790. i = 0,
  6791. timers = jQuery.timers;
  6792. fxNow = jQuery.now();
  6793. for ( ; i < timers.length; i++ ) {
  6794. timer = timers[ i ];
  6795. // Run the timer and safely remove it when done (allowing for external removal)
  6796. if ( !timer() && timers[ i ] === timer ) {
  6797. timers.splice( i--, 1 );
  6798. }
  6799. }
  6800. if ( !timers.length ) {
  6801. jQuery.fx.stop();
  6802. }
  6803. fxNow = undefined;
  6804. };
  6805. jQuery.fx.timer = function( timer ) {
  6806. jQuery.timers.push( timer );
  6807. jQuery.fx.start();
  6808. };
  6809. jQuery.fx.interval = 13;
  6810. jQuery.fx.start = function() {
  6811. if ( inProgress ) {
  6812. return;
  6813. }
  6814. inProgress = true;
  6815. schedule();
  6816. };
  6817. jQuery.fx.stop = function() {
  6818. inProgress = null;
  6819. };
  6820. jQuery.fx.speeds = {
  6821. slow: 600,
  6822. fast: 200,
  6823. // Default speed
  6824. _default: 400
  6825. };
  6826. // Based off of the plugin by Clint Helfers, with permission.
  6827. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6828. jQuery.fn.delay = function( time, type ) {
  6829. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6830. type = type || "fx";
  6831. return this.queue( type, function( next, hooks ) {
  6832. var timeout = window.setTimeout( next, time );
  6833. hooks.stop = function() {
  6834. window.clearTimeout( timeout );
  6835. };
  6836. } );
  6837. };
  6838. ( function() {
  6839. var input = document.createElement( "input" ),
  6840. select = document.createElement( "select" ),
  6841. opt = select.appendChild( document.createElement( "option" ) );
  6842. input.type = "checkbox";
  6843. // Support: Android <=4.3 only
  6844. // Default value for a checkbox should be "on"
  6845. support.checkOn = input.value !== "";
  6846. // Support: IE <=11 only
  6847. // Must access selectedIndex to make default options select
  6848. support.optSelected = opt.selected;
  6849. // Support: IE <=11 only
  6850. // An input loses its value after becoming a radio
  6851. input = document.createElement( "input" );
  6852. input.value = "t";
  6853. input.type = "radio";
  6854. support.radioValue = input.value === "t";
  6855. } )();
  6856. var boolHook,
  6857. attrHandle = jQuery.expr.attrHandle;
  6858. jQuery.fn.extend( {
  6859. attr: function( name, value ) {
  6860. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6861. },
  6862. removeAttr: function( name ) {
  6863. return this.each( function() {
  6864. jQuery.removeAttr( this, name );
  6865. } );
  6866. }
  6867. } );
  6868. jQuery.extend( {
  6869. attr: function( elem, name, value ) {
  6870. var ret, hooks,
  6871. nType = elem.nodeType;
  6872. // Don't get/set attributes on text, comment and attribute nodes
  6873. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6874. return;
  6875. }
  6876. // Fallback to prop when attributes are not supported
  6877. if ( typeof elem.getAttribute === "undefined" ) {
  6878. return jQuery.prop( elem, name, value );
  6879. }
  6880. // Attribute hooks are determined by the lowercase version
  6881. // Grab necessary hook if one is defined
  6882. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6883. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6884. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6885. }
  6886. if ( value !== undefined ) {
  6887. if ( value === null ) {
  6888. jQuery.removeAttr( elem, name );
  6889. return;
  6890. }
  6891. if ( hooks && "set" in hooks &&
  6892. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6893. return ret;
  6894. }
  6895. elem.setAttribute( name, value + "" );
  6896. return value;
  6897. }
  6898. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6899. return ret;
  6900. }
  6901. ret = jQuery.find.attr( elem, name );
  6902. // Non-existent attributes return null, we normalize to undefined
  6903. return ret == null ? undefined : ret;
  6904. },
  6905. attrHooks: {
  6906. type: {
  6907. set: function( elem, value ) {
  6908. if ( !support.radioValue && value === "radio" &&
  6909. nodeName( elem, "input" ) ) {
  6910. var val = elem.value;
  6911. elem.setAttribute( "type", value );
  6912. if ( val ) {
  6913. elem.value = val;
  6914. }
  6915. return value;
  6916. }
  6917. }
  6918. }
  6919. },
  6920. removeAttr: function( elem, value ) {
  6921. var name,
  6922. i = 0,
  6923. // Attribute names can contain non-HTML whitespace characters
  6924. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6925. attrNames = value && value.match( rnothtmlwhite );
  6926. if ( attrNames && elem.nodeType === 1 ) {
  6927. while ( ( name = attrNames[ i++ ] ) ) {
  6928. elem.removeAttribute( name );
  6929. }
  6930. }
  6931. }
  6932. } );
  6933. // Hooks for boolean attributes
  6934. boolHook = {
  6935. set: function( elem, value, name ) {
  6936. if ( value === false ) {
  6937. // Remove boolean attributes when set to false
  6938. jQuery.removeAttr( elem, name );
  6939. } else {
  6940. elem.setAttribute( name, name );
  6941. }
  6942. return name;
  6943. }
  6944. };
  6945. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6946. var getter = attrHandle[ name ] || jQuery.find.attr;
  6947. attrHandle[ name ] = function( elem, name, isXML ) {
  6948. var ret, handle,
  6949. lowercaseName = name.toLowerCase();
  6950. if ( !isXML ) {
  6951. // Avoid an infinite loop by temporarily removing this function from the getter
  6952. handle = attrHandle[ lowercaseName ];
  6953. attrHandle[ lowercaseName ] = ret;
  6954. ret = getter( elem, name, isXML ) != null ?
  6955. lowercaseName :
  6956. null;
  6957. attrHandle[ lowercaseName ] = handle;
  6958. }
  6959. return ret;
  6960. };
  6961. } );
  6962. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6963. rclickable = /^(?:a|area)$/i;
  6964. jQuery.fn.extend( {
  6965. prop: function( name, value ) {
  6966. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6967. },
  6968. removeProp: function( name ) {
  6969. return this.each( function() {
  6970. delete this[ jQuery.propFix[ name ] || name ];
  6971. } );
  6972. }
  6973. } );
  6974. jQuery.extend( {
  6975. prop: function( elem, name, value ) {
  6976. var ret, hooks,
  6977. nType = elem.nodeType;
  6978. // Don't get/set properties on text, comment and attribute nodes
  6979. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6980. return;
  6981. }
  6982. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6983. // Fix name and attach hooks
  6984. name = jQuery.propFix[ name ] || name;
  6985. hooks = jQuery.propHooks[ name ];
  6986. }
  6987. if ( value !== undefined ) {
  6988. if ( hooks && "set" in hooks &&
  6989. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6990. return ret;
  6991. }
  6992. return ( elem[ name ] = value );
  6993. }
  6994. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6995. return ret;
  6996. }
  6997. return elem[ name ];
  6998. },
  6999. propHooks: {
  7000. tabIndex: {
  7001. get: function( elem ) {
  7002. // Support: IE <=9 - 11 only
  7003. // elem.tabIndex doesn't always return the
  7004. // correct value when it hasn't been explicitly set
  7005. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7006. // Use proper attribute retrieval(#12072)
  7007. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7008. if ( tabindex ) {
  7009. return parseInt( tabindex, 10 );
  7010. }
  7011. if (
  7012. rfocusable.test( elem.nodeName ) ||
  7013. rclickable.test( elem.nodeName ) &&
  7014. elem.href
  7015. ) {
  7016. return 0;
  7017. }
  7018. return -1;
  7019. }
  7020. }
  7021. },
  7022. propFix: {
  7023. "for": "htmlFor",
  7024. "class": "className"
  7025. }
  7026. } );
  7027. // Support: IE <=11 only
  7028. // Accessing the selectedIndex property
  7029. // forces the browser to respect setting selected
  7030. // on the option
  7031. // The getter ensures a default option is selected
  7032. // when in an optgroup
  7033. // eslint rule "no-unused-expressions" is disabled for this code
  7034. // since it considers such accessions noop
  7035. if ( !support.optSelected ) {
  7036. jQuery.propHooks.selected = {
  7037. get: function( elem ) {
  7038. /* eslint no-unused-expressions: "off" */
  7039. var parent = elem.parentNode;
  7040. if ( parent && parent.parentNode ) {
  7041. parent.parentNode.selectedIndex;
  7042. }
  7043. return null;
  7044. },
  7045. set: function( elem ) {
  7046. /* eslint no-unused-expressions: "off" */
  7047. var parent = elem.parentNode;
  7048. if ( parent ) {
  7049. parent.selectedIndex;
  7050. if ( parent.parentNode ) {
  7051. parent.parentNode.selectedIndex;
  7052. }
  7053. }
  7054. }
  7055. };
  7056. }
  7057. jQuery.each( [
  7058. "tabIndex",
  7059. "readOnly",
  7060. "maxLength",
  7061. "cellSpacing",
  7062. "cellPadding",
  7063. "rowSpan",
  7064. "colSpan",
  7065. "useMap",
  7066. "frameBorder",
  7067. "contentEditable"
  7068. ], function() {
  7069. jQuery.propFix[ this.toLowerCase() ] = this;
  7070. } );
  7071. // Strip and collapse whitespace according to HTML spec
  7072. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  7073. function stripAndCollapse( value ) {
  7074. var tokens = value.match( rnothtmlwhite ) || [];
  7075. return tokens.join( " " );
  7076. }
  7077. function getClass( elem ) {
  7078. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7079. }
  7080. jQuery.fn.extend( {
  7081. addClass: function( value ) {
  7082. var classes, elem, cur, curValue, clazz, j, finalValue,
  7083. i = 0;
  7084. if ( jQuery.isFunction( value ) ) {
  7085. return this.each( function( j ) {
  7086. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7087. } );
  7088. }
  7089. if ( typeof value === "string" && value ) {
  7090. classes = value.match( rnothtmlwhite ) || [];
  7091. while ( ( elem = this[ i++ ] ) ) {
  7092. curValue = getClass( elem );
  7093. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7094. if ( cur ) {
  7095. j = 0;
  7096. while ( ( clazz = classes[ j++ ] ) ) {
  7097. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7098. cur += clazz + " ";
  7099. }
  7100. }
  7101. // Only assign if different to avoid unneeded rendering.
  7102. finalValue = stripAndCollapse( cur );
  7103. if ( curValue !== finalValue ) {
  7104. elem.setAttribute( "class", finalValue );
  7105. }
  7106. }
  7107. }
  7108. }
  7109. return this;
  7110. },
  7111. removeClass: function( value ) {
  7112. var classes, elem, cur, curValue, clazz, j, finalValue,
  7113. i = 0;
  7114. if ( jQuery.isFunction( value ) ) {
  7115. return this.each( function( j ) {
  7116. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7117. } );
  7118. }
  7119. if ( !arguments.length ) {
  7120. return this.attr( "class", "" );
  7121. }
  7122. if ( typeof value === "string" && value ) {
  7123. classes = value.match( rnothtmlwhite ) || [];
  7124. while ( ( elem = this[ i++ ] ) ) {
  7125. curValue = getClass( elem );
  7126. // This expression is here for better compressibility (see addClass)
  7127. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7128. if ( cur ) {
  7129. j = 0;
  7130. while ( ( clazz = classes[ j++ ] ) ) {
  7131. // Remove *all* instances
  7132. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7133. cur = cur.replace( " " + clazz + " ", " " );
  7134. }
  7135. }
  7136. // Only assign if different to avoid unneeded rendering.
  7137. finalValue = stripAndCollapse( cur );
  7138. if ( curValue !== finalValue ) {
  7139. elem.setAttribute( "class", finalValue );
  7140. }
  7141. }
  7142. }
  7143. }
  7144. return this;
  7145. },
  7146. toggleClass: function( value, stateVal ) {
  7147. var type = typeof value;
  7148. if ( typeof stateVal === "boolean" && type === "string" ) {
  7149. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7150. }
  7151. if ( jQuery.isFunction( value ) ) {
  7152. return this.each( function( i ) {
  7153. jQuery( this ).toggleClass(
  7154. value.call( this, i, getClass( this ), stateVal ),
  7155. stateVal
  7156. );
  7157. } );
  7158. }
  7159. return this.each( function() {
  7160. var className, i, self, classNames;
  7161. if ( type === "string" ) {
  7162. // Toggle individual class names
  7163. i = 0;
  7164. self = jQuery( this );
  7165. classNames = value.match( rnothtmlwhite ) || [];
  7166. while ( ( className = classNames[ i++ ] ) ) {
  7167. // Check each className given, space separated list
  7168. if ( self.hasClass( className ) ) {
  7169. self.removeClass( className );
  7170. } else {
  7171. self.addClass( className );
  7172. }
  7173. }
  7174. // Toggle whole class name
  7175. } else if ( value === undefined || type === "boolean" ) {
  7176. className = getClass( this );
  7177. if ( className ) {
  7178. // Store className if set
  7179. dataPriv.set( this, "__className__", className );
  7180. }
  7181. // If the element has a class name or if we're passed `false`,
  7182. // then remove the whole classname (if there was one, the above saved it).
  7183. // Otherwise bring back whatever was previously saved (if anything),
  7184. // falling back to the empty string if nothing was stored.
  7185. if ( this.setAttribute ) {
  7186. this.setAttribute( "class",
  7187. className || value === false ?
  7188. "" :
  7189. dataPriv.get( this, "__className__" ) || ""
  7190. );
  7191. }
  7192. }
  7193. } );
  7194. },
  7195. hasClass: function( selector ) {
  7196. var className, elem,
  7197. i = 0;
  7198. className = " " + selector + " ";
  7199. while ( ( elem = this[ i++ ] ) ) {
  7200. if ( elem.nodeType === 1 &&
  7201. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7202. return true;
  7203. }
  7204. }
  7205. return false;
  7206. }
  7207. } );
  7208. var rreturn = /\r/g;
  7209. jQuery.fn.extend( {
  7210. val: function( value ) {
  7211. var hooks, ret, isFunction,
  7212. elem = this[ 0 ];
  7213. if ( !arguments.length ) {
  7214. if ( elem ) {
  7215. hooks = jQuery.valHooks[ elem.type ] ||
  7216. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7217. if ( hooks &&
  7218. "get" in hooks &&
  7219. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7220. ) {
  7221. return ret;
  7222. }
  7223. ret = elem.value;
  7224. // Handle most common string cases
  7225. if ( typeof ret === "string" ) {
  7226. return ret.replace( rreturn, "" );
  7227. }
  7228. // Handle cases where value is null/undef or number
  7229. return ret == null ? "" : ret;
  7230. }
  7231. return;
  7232. }
  7233. isFunction = jQuery.isFunction( value );
  7234. return this.each( function( i ) {
  7235. var val;
  7236. if ( this.nodeType !== 1 ) {
  7237. return;
  7238. }
  7239. if ( isFunction ) {
  7240. val = value.call( this, i, jQuery( this ).val() );
  7241. } else {
  7242. val = value;
  7243. }
  7244. // Treat null/undefined as ""; convert numbers to string
  7245. if ( val == null ) {
  7246. val = "";
  7247. } else if ( typeof val === "number" ) {
  7248. val += "";
  7249. } else if ( Array.isArray( val ) ) {
  7250. val = jQuery.map( val, function( value ) {
  7251. return value == null ? "" : value + "";
  7252. } );
  7253. }
  7254. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7255. // If set returns undefined, fall back to normal setting
  7256. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7257. this.value = val;
  7258. }
  7259. } );
  7260. }
  7261. } );
  7262. jQuery.extend( {
  7263. valHooks: {
  7264. option: {
  7265. get: function( elem ) {
  7266. var val = jQuery.find.attr( elem, "value" );
  7267. return val != null ?
  7268. val :
  7269. // Support: IE <=10 - 11 only
  7270. // option.text throws exceptions (#14686, #14858)
  7271. // Strip and collapse whitespace
  7272. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7273. stripAndCollapse( jQuery.text( elem ) );
  7274. }
  7275. },
  7276. select: {
  7277. get: function( elem ) {
  7278. var value, option, i,
  7279. options = elem.options,
  7280. index = elem.selectedIndex,
  7281. one = elem.type === "select-one",
  7282. values = one ? null : [],
  7283. max = one ? index + 1 : options.length;
  7284. if ( index < 0 ) {
  7285. i = max;
  7286. } else {
  7287. i = one ? index : 0;
  7288. }
  7289. // Loop through all the selected options
  7290. for ( ; i < max; i++ ) {
  7291. option = options[ i ];
  7292. // Support: IE <=9 only
  7293. // IE8-9 doesn't update selected after form reset (#2551)
  7294. if ( ( option.selected || i === index ) &&
  7295. // Don't return options that are disabled or in a disabled optgroup
  7296. !option.disabled &&
  7297. ( !option.parentNode.disabled ||
  7298. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7299. // Get the specific value for the option
  7300. value = jQuery( option ).val();
  7301. // We don't need an array for one selects
  7302. if ( one ) {
  7303. return value;
  7304. }
  7305. // Multi-Selects return an array
  7306. values.push( value );
  7307. }
  7308. }
  7309. return values;
  7310. },
  7311. set: function( elem, value ) {
  7312. var optionSet, option,
  7313. options = elem.options,
  7314. values = jQuery.makeArray( value ),
  7315. i = options.length;
  7316. while ( i-- ) {
  7317. option = options[ i ];
  7318. /* eslint-disable no-cond-assign */
  7319. if ( option.selected =
  7320. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7321. ) {
  7322. optionSet = true;
  7323. }
  7324. /* eslint-enable no-cond-assign */
  7325. }
  7326. // Force browsers to behave consistently when non-matching value is set
  7327. if ( !optionSet ) {
  7328. elem.selectedIndex = -1;
  7329. }
  7330. return values;
  7331. }
  7332. }
  7333. }
  7334. } );
  7335. // Radios and checkboxes getter/setter
  7336. jQuery.each( [ "radio", "checkbox" ], function() {
  7337. jQuery.valHooks[ this ] = {
  7338. set: function( elem, value ) {
  7339. if ( Array.isArray( value ) ) {
  7340. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7341. }
  7342. }
  7343. };
  7344. if ( !support.checkOn ) {
  7345. jQuery.valHooks[ this ].get = function( elem ) {
  7346. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7347. };
  7348. }
  7349. } );
  7350. // Return jQuery for attributes-only inclusion
  7351. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  7352. jQuery.extend( jQuery.event, {
  7353. trigger: function( event, data, elem, onlyHandlers ) {
  7354. var i, cur, tmp, bubbleType, ontype, handle, special,
  7355. eventPath = [ elem || document ],
  7356. type = hasOwn.call( event, "type" ) ? event.type : event,
  7357. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7358. cur = tmp = elem = elem || document;
  7359. // Don't do events on text and comment nodes
  7360. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7361. return;
  7362. }
  7363. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7364. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7365. return;
  7366. }
  7367. if ( type.indexOf( "." ) > -1 ) {
  7368. // Namespaced trigger; create a regexp to match event type in handle()
  7369. namespaces = type.split( "." );
  7370. type = namespaces.shift();
  7371. namespaces.sort();
  7372. }
  7373. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7374. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7375. event = event[ jQuery.expando ] ?
  7376. event :
  7377. new jQuery.Event( type, typeof event === "object" && event );
  7378. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7379. event.isTrigger = onlyHandlers ? 2 : 3;
  7380. event.namespace = namespaces.join( "." );
  7381. event.rnamespace = event.namespace ?
  7382. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7383. null;
  7384. // Clean up the event in case it is being reused
  7385. event.result = undefined;
  7386. if ( !event.target ) {
  7387. event.target = elem;
  7388. }
  7389. // Clone any incoming data and prepend the event, creating the handler arg list
  7390. data = data == null ?
  7391. [ event ] :
  7392. jQuery.makeArray( data, [ event ] );
  7393. // Allow special events to draw outside the lines
  7394. special = jQuery.event.special[ type ] || {};
  7395. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7396. return;
  7397. }
  7398. // Determine event propagation path in advance, per W3C events spec (#9951)
  7399. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  7400. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  7401. bubbleType = special.delegateType || type;
  7402. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7403. cur = cur.parentNode;
  7404. }
  7405. for ( ; cur; cur = cur.parentNode ) {
  7406. eventPath.push( cur );
  7407. tmp = cur;
  7408. }
  7409. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7410. if ( tmp === ( elem.ownerDocument || document ) ) {
  7411. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7412. }
  7413. }
  7414. // Fire handlers on the event path
  7415. i = 0;
  7416. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7417. event.type = i > 1 ?
  7418. bubbleType :
  7419. special.bindType || type;
  7420. // jQuery handler
  7421. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  7422. dataPriv.get( cur, "handle" );
  7423. if ( handle ) {
  7424. handle.apply( cur, data );
  7425. }
  7426. // Native handler
  7427. handle = ontype && cur[ ontype ];
  7428. if ( handle && handle.apply && acceptData( cur ) ) {
  7429. event.result = handle.apply( cur, data );
  7430. if ( event.result === false ) {
  7431. event.preventDefault();
  7432. }
  7433. }
  7434. }
  7435. event.type = type;
  7436. // If nobody prevented the default action, do it now
  7437. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7438. if ( ( !special._default ||
  7439. special._default.apply( eventPath.pop(), data ) === false ) &&
  7440. acceptData( elem ) ) {
  7441. // Call a native DOM method on the target with the same name as the event.
  7442. // Don't do default actions on window, that's where global variables be (#6170)
  7443. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  7444. // Don't re-trigger an onFOO event when we call its FOO() method
  7445. tmp = elem[ ontype ];
  7446. if ( tmp ) {
  7447. elem[ ontype ] = null;
  7448. }
  7449. // Prevent re-triggering of the same event, since we already bubbled it above
  7450. jQuery.event.triggered = type;
  7451. elem[ type ]();
  7452. jQuery.event.triggered = undefined;
  7453. if ( tmp ) {
  7454. elem[ ontype ] = tmp;
  7455. }
  7456. }
  7457. }
  7458. }
  7459. return event.result;
  7460. },
  7461. // Piggyback on a donor event to simulate a different one
  7462. // Used only for `focus(in | out)` events
  7463. simulate: function( type, elem, event ) {
  7464. var e = jQuery.extend(
  7465. new jQuery.Event(),
  7466. event,
  7467. {
  7468. type: type,
  7469. isSimulated: true
  7470. }
  7471. );
  7472. jQuery.event.trigger( e, null, elem );
  7473. }
  7474. } );
  7475. jQuery.fn.extend( {
  7476. trigger: function( type, data ) {
  7477. return this.each( function() {
  7478. jQuery.event.trigger( type, data, this );
  7479. } );
  7480. },
  7481. triggerHandler: function( type, data ) {
  7482. var elem = this[ 0 ];
  7483. if ( elem ) {
  7484. return jQuery.event.trigger( type, data, elem, true );
  7485. }
  7486. }
  7487. } );
  7488. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  7489. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  7490. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  7491. function( i, name ) {
  7492. // Handle event binding
  7493. jQuery.fn[ name ] = function( data, fn ) {
  7494. return arguments.length > 0 ?
  7495. this.on( name, null, data, fn ) :
  7496. this.trigger( name );
  7497. };
  7498. } );
  7499. jQuery.fn.extend( {
  7500. hover: function( fnOver, fnOut ) {
  7501. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  7502. }
  7503. } );
  7504. support.focusin = "onfocusin" in window;
  7505. // Support: Firefox <=44
  7506. // Firefox doesn't have focus(in | out) events
  7507. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  7508. //
  7509. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  7510. // focus(in | out) events fire after focus & blur events,
  7511. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  7512. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  7513. if ( !support.focusin ) {
  7514. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  7515. // Attach a single capturing handler on the document while someone wants focusin/focusout
  7516. var handler = function( event ) {
  7517. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  7518. };
  7519. jQuery.event.special[ fix ] = {
  7520. setup: function() {
  7521. var doc = this.ownerDocument || this,
  7522. attaches = dataPriv.access( doc, fix );
  7523. if ( !attaches ) {
  7524. doc.addEventListener( orig, handler, true );
  7525. }
  7526. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  7527. },
  7528. teardown: function() {
  7529. var doc = this.ownerDocument || this,
  7530. attaches = dataPriv.access( doc, fix ) - 1;
  7531. if ( !attaches ) {
  7532. doc.removeEventListener( orig, handler, true );
  7533. dataPriv.remove( doc, fix );
  7534. } else {
  7535. dataPriv.access( doc, fix, attaches );
  7536. }
  7537. }
  7538. };
  7539. } );
  7540. }
  7541. var location = window.location;
  7542. var nonce = jQuery.now();
  7543. var rquery = ( /\?/ );
  7544. // Cross-browser xml parsing
  7545. jQuery.parseXML = function( data ) {
  7546. var xml;
  7547. if ( !data || typeof data !== "string" ) {
  7548. return null;
  7549. }
  7550. // Support: IE 9 - 11 only
  7551. // IE throws on parseFromString with invalid input.
  7552. try {
  7553. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7554. } catch ( e ) {
  7555. xml = undefined;
  7556. }
  7557. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  7558. jQuery.error( "Invalid XML: " + data );
  7559. }
  7560. return xml;
  7561. };
  7562. var
  7563. rbracket = /\[\]$/,
  7564. rCRLF = /\r?\n/g,
  7565. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7566. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7567. function buildParams( prefix, obj, traditional, add ) {
  7568. var name;
  7569. if ( Array.isArray( obj ) ) {
  7570. // Serialize array item.
  7571. jQuery.each( obj, function( i, v ) {
  7572. if ( traditional || rbracket.test( prefix ) ) {
  7573. // Treat each array item as a scalar.
  7574. add( prefix, v );
  7575. } else {
  7576. // Item is non-scalar (array or object), encode its numeric index.
  7577. buildParams(
  7578. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  7579. v,
  7580. traditional,
  7581. add
  7582. );
  7583. }
  7584. } );
  7585. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  7586. // Serialize object item.
  7587. for ( name in obj ) {
  7588. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7589. }
  7590. } else {
  7591. // Serialize scalar item.
  7592. add( prefix, obj );
  7593. }
  7594. }
  7595. // Serialize an array of form elements or a set of
  7596. // key/values into a query string
  7597. jQuery.param = function( a, traditional ) {
  7598. var prefix,
  7599. s = [],
  7600. add = function( key, valueOrFunction ) {
  7601. // If value is a function, invoke it and use its return value
  7602. var value = jQuery.isFunction( valueOrFunction ) ?
  7603. valueOrFunction() :
  7604. valueOrFunction;
  7605. s[ s.length ] = encodeURIComponent( key ) + "=" +
  7606. encodeURIComponent( value == null ? "" : value );
  7607. };
  7608. // If an array was passed in, assume that it is an array of form elements.
  7609. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7610. // Serialize the form elements
  7611. jQuery.each( a, function() {
  7612. add( this.name, this.value );
  7613. } );
  7614. } else {
  7615. // If traditional, encode the "old" way (the way 1.3.2 or older
  7616. // did it), otherwise encode params recursively.
  7617. for ( prefix in a ) {
  7618. buildParams( prefix, a[ prefix ], traditional, add );
  7619. }
  7620. }
  7621. // Return the resulting serialization
  7622. return s.join( "&" );
  7623. };
  7624. jQuery.fn.extend( {
  7625. serialize: function() {
  7626. return jQuery.param( this.serializeArray() );
  7627. },
  7628. serializeArray: function() {
  7629. return this.map( function() {
  7630. // Can add propHook for "elements" to filter or add form elements
  7631. var elements = jQuery.prop( this, "elements" );
  7632. return elements ? jQuery.makeArray( elements ) : this;
  7633. } )
  7634. .filter( function() {
  7635. var type = this.type;
  7636. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7637. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7638. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7639. ( this.checked || !rcheckableType.test( type ) );
  7640. } )
  7641. .map( function( i, elem ) {
  7642. var val = jQuery( this ).val();
  7643. if ( val == null ) {
  7644. return null;
  7645. }
  7646. if ( Array.isArray( val ) ) {
  7647. return jQuery.map( val, function( val ) {
  7648. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7649. } );
  7650. }
  7651. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7652. } ).get();
  7653. }
  7654. } );
  7655. var
  7656. r20 = /%20/g,
  7657. rhash = /#.*$/,
  7658. rantiCache = /([?&])_=[^&]*/,
  7659. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  7660. // #7653, #8125, #8152: local protocol detection
  7661. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7662. rnoContent = /^(?:GET|HEAD)$/,
  7663. rprotocol = /^\/\//,
  7664. /* Prefilters
  7665. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7666. * 2) These are called:
  7667. * - BEFORE asking for a transport
  7668. * - AFTER param serialization (s.data is a string if s.processData is true)
  7669. * 3) key is the dataType
  7670. * 4) the catchall symbol "*" can be used
  7671. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7672. */
  7673. prefilters = {},
  7674. /* Transports bindings
  7675. * 1) key is the dataType
  7676. * 2) the catchall symbol "*" can be used
  7677. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7678. */
  7679. transports = {},
  7680. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  7681. allTypes = "*/".concat( "*" ),
  7682. // Anchor tag for parsing the document origin
  7683. originAnchor = document.createElement( "a" );
  7684. originAnchor.href = location.href;
  7685. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  7686. function addToPrefiltersOrTransports( structure ) {
  7687. // dataTypeExpression is optional and defaults to "*"
  7688. return function( dataTypeExpression, func ) {
  7689. if ( typeof dataTypeExpression !== "string" ) {
  7690. func = dataTypeExpression;
  7691. dataTypeExpression = "*";
  7692. }
  7693. var dataType,
  7694. i = 0,
  7695. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  7696. if ( jQuery.isFunction( func ) ) {
  7697. // For each dataType in the dataTypeExpression
  7698. while ( ( dataType = dataTypes[ i++ ] ) ) {
  7699. // Prepend if requested
  7700. if ( dataType[ 0 ] === "+" ) {
  7701. dataType = dataType.slice( 1 ) || "*";
  7702. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7703. // Otherwise append
  7704. } else {
  7705. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7706. }
  7707. }
  7708. }
  7709. };
  7710. }
  7711. // Base inspection function for prefilters and transports
  7712. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7713. var inspected = {},
  7714. seekingTransport = ( structure === transports );
  7715. function inspect( dataType ) {
  7716. var selected;
  7717. inspected[ dataType ] = true;
  7718. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7719. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7720. if ( typeof dataTypeOrTransport === "string" &&
  7721. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7722. options.dataTypes.unshift( dataTypeOrTransport );
  7723. inspect( dataTypeOrTransport );
  7724. return false;
  7725. } else if ( seekingTransport ) {
  7726. return !( selected = dataTypeOrTransport );
  7727. }
  7728. } );
  7729. return selected;
  7730. }
  7731. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7732. }
  7733. // A special extend for ajax options
  7734. // that takes "flat" options (not to be deep extended)
  7735. // Fixes #9887
  7736. function ajaxExtend( target, src ) {
  7737. var key, deep,
  7738. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7739. for ( key in src ) {
  7740. if ( src[ key ] !== undefined ) {
  7741. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7742. }
  7743. }
  7744. if ( deep ) {
  7745. jQuery.extend( true, target, deep );
  7746. }
  7747. return target;
  7748. }
  7749. /* Handles responses to an ajax request:
  7750. * - finds the right dataType (mediates between content-type and expected dataType)
  7751. * - returns the corresponding response
  7752. */
  7753. function ajaxHandleResponses( s, jqXHR, responses ) {
  7754. var ct, type, finalDataType, firstDataType,
  7755. contents = s.contents,
  7756. dataTypes = s.dataTypes;
  7757. // Remove auto dataType and get content-type in the process
  7758. while ( dataTypes[ 0 ] === "*" ) {
  7759. dataTypes.shift();
  7760. if ( ct === undefined ) {
  7761. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7762. }
  7763. }
  7764. // Check if we're dealing with a known content-type
  7765. if ( ct ) {
  7766. for ( type in contents ) {
  7767. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7768. dataTypes.unshift( type );
  7769. break;
  7770. }
  7771. }
  7772. }
  7773. // Check to see if we have a response for the expected dataType
  7774. if ( dataTypes[ 0 ] in responses ) {
  7775. finalDataType = dataTypes[ 0 ];
  7776. } else {
  7777. // Try convertible dataTypes
  7778. for ( type in responses ) {
  7779. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7780. finalDataType = type;
  7781. break;
  7782. }
  7783. if ( !firstDataType ) {
  7784. firstDataType = type;
  7785. }
  7786. }
  7787. // Or just use first one
  7788. finalDataType = finalDataType || firstDataType;
  7789. }
  7790. // If we found a dataType
  7791. // We add the dataType to the list if needed
  7792. // and return the corresponding response
  7793. if ( finalDataType ) {
  7794. if ( finalDataType !== dataTypes[ 0 ] ) {
  7795. dataTypes.unshift( finalDataType );
  7796. }
  7797. return responses[ finalDataType ];
  7798. }
  7799. }
  7800. /* Chain conversions given the request and the original response
  7801. * Also sets the responseXXX fields on the jqXHR instance
  7802. */
  7803. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7804. var conv2, current, conv, tmp, prev,
  7805. converters = {},
  7806. // Work with a copy of dataTypes in case we need to modify it for conversion
  7807. dataTypes = s.dataTypes.slice();
  7808. // Create converters map with lowercased keys
  7809. if ( dataTypes[ 1 ] ) {
  7810. for ( conv in s.converters ) {
  7811. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7812. }
  7813. }
  7814. current = dataTypes.shift();
  7815. // Convert to each sequential dataType
  7816. while ( current ) {
  7817. if ( s.responseFields[ current ] ) {
  7818. jqXHR[ s.responseFields[ current ] ] = response;
  7819. }
  7820. // Apply the dataFilter if provided
  7821. if ( !prev && isSuccess && s.dataFilter ) {
  7822. response = s.dataFilter( response, s.dataType );
  7823. }
  7824. prev = current;
  7825. current = dataTypes.shift();
  7826. if ( current ) {
  7827. // There's only work to do if current dataType is non-auto
  7828. if ( current === "*" ) {
  7829. current = prev;
  7830. // Convert response if prev dataType is non-auto and differs from current
  7831. } else if ( prev !== "*" && prev !== current ) {
  7832. // Seek a direct converter
  7833. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7834. // If none found, seek a pair
  7835. if ( !conv ) {
  7836. for ( conv2 in converters ) {
  7837. // If conv2 outputs current
  7838. tmp = conv2.split( " " );
  7839. if ( tmp[ 1 ] === current ) {
  7840. // If prev can be converted to accepted input
  7841. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7842. converters[ "* " + tmp[ 0 ] ];
  7843. if ( conv ) {
  7844. // Condense equivalence converters
  7845. if ( conv === true ) {
  7846. conv = converters[ conv2 ];
  7847. // Otherwise, insert the intermediate dataType
  7848. } else if ( converters[ conv2 ] !== true ) {
  7849. current = tmp[ 0 ];
  7850. dataTypes.unshift( tmp[ 1 ] );
  7851. }
  7852. break;
  7853. }
  7854. }
  7855. }
  7856. }
  7857. // Apply converter (if not an equivalence)
  7858. if ( conv !== true ) {
  7859. // Unless errors are allowed to bubble, catch and return them
  7860. if ( conv && s.throws ) {
  7861. response = conv( response );
  7862. } else {
  7863. try {
  7864. response = conv( response );
  7865. } catch ( e ) {
  7866. return {
  7867. state: "parsererror",
  7868. error: conv ? e : "No conversion from " + prev + " to " + current
  7869. };
  7870. }
  7871. }
  7872. }
  7873. }
  7874. }
  7875. }
  7876. return { state: "success", data: response };
  7877. }
  7878. jQuery.extend( {
  7879. // Counter for holding the number of active queries
  7880. active: 0,
  7881. // Last-Modified header cache for next request
  7882. lastModified: {},
  7883. etag: {},
  7884. ajaxSettings: {
  7885. url: location.href,
  7886. type: "GET",
  7887. isLocal: rlocalProtocol.test( location.protocol ),
  7888. global: true,
  7889. processData: true,
  7890. async: true,
  7891. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7892. /*
  7893. timeout: 0,
  7894. data: null,
  7895. dataType: null,
  7896. username: null,
  7897. password: null,
  7898. cache: null,
  7899. throws: false,
  7900. traditional: false,
  7901. headers: {},
  7902. */
  7903. accepts: {
  7904. "*": allTypes,
  7905. text: "text/plain",
  7906. html: "text/html",
  7907. xml: "application/xml, text/xml",
  7908. json: "application/json, text/javascript"
  7909. },
  7910. contents: {
  7911. xml: /\bxml\b/,
  7912. html: /\bhtml/,
  7913. json: /\bjson\b/
  7914. },
  7915. responseFields: {
  7916. xml: "responseXML",
  7917. text: "responseText",
  7918. json: "responseJSON"
  7919. },
  7920. // Data converters
  7921. // Keys separate source (or catchall "*") and destination types with a single space
  7922. converters: {
  7923. // Convert anything to text
  7924. "* text": String,
  7925. // Text to html (true = no transformation)
  7926. "text html": true,
  7927. // Evaluate text as a json expression
  7928. "text json": JSON.parse,
  7929. // Parse text as xml
  7930. "text xml": jQuery.parseXML
  7931. },
  7932. // For options that shouldn't be deep extended:
  7933. // you can add your own custom options here if
  7934. // and when you create one that shouldn't be
  7935. // deep extended (see ajaxExtend)
  7936. flatOptions: {
  7937. url: true,
  7938. context: true
  7939. }
  7940. },
  7941. // Creates a full fledged settings object into target
  7942. // with both ajaxSettings and settings fields.
  7943. // If target is omitted, writes into ajaxSettings.
  7944. ajaxSetup: function( target, settings ) {
  7945. return settings ?
  7946. // Building a settings object
  7947. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7948. // Extending ajaxSettings
  7949. ajaxExtend( jQuery.ajaxSettings, target );
  7950. },
  7951. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7952. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7953. // Main method
  7954. ajax: function( url, options ) {
  7955. // If url is an object, simulate pre-1.5 signature
  7956. if ( typeof url === "object" ) {
  7957. options = url;
  7958. url = undefined;
  7959. }
  7960. // Force options to be an object
  7961. options = options || {};
  7962. var transport,
  7963. // URL without anti-cache param
  7964. cacheURL,
  7965. // Response headers
  7966. responseHeadersString,
  7967. responseHeaders,
  7968. // timeout handle
  7969. timeoutTimer,
  7970. // Url cleanup var
  7971. urlAnchor,
  7972. // Request state (becomes false upon send and true upon completion)
  7973. completed,
  7974. // To know if global events are to be dispatched
  7975. fireGlobals,
  7976. // Loop variable
  7977. i,
  7978. // uncached part of the url
  7979. uncached,
  7980. // Create the final options object
  7981. s = jQuery.ajaxSetup( {}, options ),
  7982. // Callbacks context
  7983. callbackContext = s.context || s,
  7984. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7985. globalEventContext = s.context &&
  7986. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7987. jQuery( callbackContext ) :
  7988. jQuery.event,
  7989. // Deferreds
  7990. deferred = jQuery.Deferred(),
  7991. completeDeferred = jQuery.Callbacks( "once memory" ),
  7992. // Status-dependent callbacks
  7993. statusCode = s.statusCode || {},
  7994. // Headers (they are sent all at once)
  7995. requestHeaders = {},
  7996. requestHeadersNames = {},
  7997. // Default abort message
  7998. strAbort = "canceled",
  7999. // Fake xhr
  8000. jqXHR = {
  8001. readyState: 0,
  8002. // Builds headers hashtable if needed
  8003. getResponseHeader: function( key ) {
  8004. var match;
  8005. if ( completed ) {
  8006. if ( !responseHeaders ) {
  8007. responseHeaders = {};
  8008. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  8009. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  8010. }
  8011. }
  8012. match = responseHeaders[ key.toLowerCase() ];
  8013. }
  8014. return match == null ? null : match;
  8015. },
  8016. // Raw string
  8017. getAllResponseHeaders: function() {
  8018. return completed ? responseHeadersString : null;
  8019. },
  8020. // Caches the header
  8021. setRequestHeader: function( name, value ) {
  8022. if ( completed == null ) {
  8023. name = requestHeadersNames[ name.toLowerCase() ] =
  8024. requestHeadersNames[ name.toLowerCase() ] || name;
  8025. requestHeaders[ name ] = value;
  8026. }
  8027. return this;
  8028. },
  8029. // Overrides response content-type header
  8030. overrideMimeType: function( type ) {
  8031. if ( completed == null ) {
  8032. s.mimeType = type;
  8033. }
  8034. return this;
  8035. },
  8036. // Status-dependent callbacks
  8037. statusCode: function( map ) {
  8038. var code;
  8039. if ( map ) {
  8040. if ( completed ) {
  8041. // Execute the appropriate callbacks
  8042. jqXHR.always( map[ jqXHR.status ] );
  8043. } else {
  8044. // Lazy-add the new callbacks in a way that preserves old ones
  8045. for ( code in map ) {
  8046. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  8047. }
  8048. }
  8049. }
  8050. return this;
  8051. },
  8052. // Cancel the request
  8053. abort: function( statusText ) {
  8054. var finalText = statusText || strAbort;
  8055. if ( transport ) {
  8056. transport.abort( finalText );
  8057. }
  8058. done( 0, finalText );
  8059. return this;
  8060. }
  8061. };
  8062. // Attach deferreds
  8063. deferred.promise( jqXHR );
  8064. // Add protocol if not provided (prefilters might expect it)
  8065. // Handle falsy url in the settings object (#10093: consistency with old signature)
  8066. // We also use the url parameter if available
  8067. s.url = ( ( url || s.url || location.href ) + "" )
  8068. .replace( rprotocol, location.protocol + "//" );
  8069. // Alias method option to type as per ticket #12004
  8070. s.type = options.method || options.type || s.method || s.type;
  8071. // Extract dataTypes list
  8072. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  8073. // A cross-domain request is in order when the origin doesn't match the current origin.
  8074. if ( s.crossDomain == null ) {
  8075. urlAnchor = document.createElement( "a" );
  8076. // Support: IE <=8 - 11, Edge 12 - 13
  8077. // IE throws exception on accessing the href property if url is malformed,
  8078. // e.g. http://example.com:80x/
  8079. try {
  8080. urlAnchor.href = s.url;
  8081. // Support: IE <=8 - 11 only
  8082. // Anchor's host property isn't correctly set when s.url is relative
  8083. urlAnchor.href = urlAnchor.href;
  8084. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  8085. urlAnchor.protocol + "//" + urlAnchor.host;
  8086. } catch ( e ) {
  8087. // If there is an error parsing the URL, assume it is crossDomain,
  8088. // it can be rejected by the transport if it is invalid
  8089. s.crossDomain = true;
  8090. }
  8091. }
  8092. // Convert data if not already a string
  8093. if ( s.data && s.processData && typeof s.data !== "string" ) {
  8094. s.data = jQuery.param( s.data, s.traditional );
  8095. }
  8096. // Apply prefilters
  8097. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  8098. // If request was aborted inside a prefilter, stop there
  8099. if ( completed ) {
  8100. return jqXHR;
  8101. }
  8102. // We can fire global events as of now if asked to
  8103. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  8104. fireGlobals = jQuery.event && s.global;
  8105. // Watch for a new set of requests
  8106. if ( fireGlobals && jQuery.active++ === 0 ) {
  8107. jQuery.event.trigger( "ajaxStart" );
  8108. }
  8109. // Uppercase the type
  8110. s.type = s.type.toUpperCase();
  8111. // Determine if request has content
  8112. s.hasContent = !rnoContent.test( s.type );
  8113. // Save the URL in case we're toying with the If-Modified-Since
  8114. // and/or If-None-Match header later on
  8115. // Remove hash to simplify url manipulation
  8116. cacheURL = s.url.replace( rhash, "" );
  8117. // More options handling for requests with no content
  8118. if ( !s.hasContent ) {
  8119. // Remember the hash so we can put it back
  8120. uncached = s.url.slice( cacheURL.length );
  8121. // If data is available, append data to url
  8122. if ( s.data ) {
  8123. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  8124. // #9682: remove data so that it's not used in an eventual retry
  8125. delete s.data;
  8126. }
  8127. // Add or update anti-cache param if needed
  8128. if ( s.cache === false ) {
  8129. cacheURL = cacheURL.replace( rantiCache, "$1" );
  8130. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  8131. }
  8132. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  8133. s.url = cacheURL + uncached;
  8134. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  8135. } else if ( s.data && s.processData &&
  8136. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  8137. s.data = s.data.replace( r20, "+" );
  8138. }
  8139. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8140. if ( s.ifModified ) {
  8141. if ( jQuery.lastModified[ cacheURL ] ) {
  8142. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  8143. }
  8144. if ( jQuery.etag[ cacheURL ] ) {
  8145. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  8146. }
  8147. }
  8148. // Set the correct header, if data is being sent
  8149. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  8150. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  8151. }
  8152. // Set the Accepts header for the server, depending on the dataType
  8153. jqXHR.setRequestHeader(
  8154. "Accept",
  8155. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  8156. s.accepts[ s.dataTypes[ 0 ] ] +
  8157. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  8158. s.accepts[ "*" ]
  8159. );
  8160. // Check for headers option
  8161. for ( i in s.headers ) {
  8162. jqXHR.setRequestHeader( i, s.headers[ i ] );
  8163. }
  8164. // Allow custom headers/mimetypes and early abort
  8165. if ( s.beforeSend &&
  8166. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  8167. // Abort if not done already and return
  8168. return jqXHR.abort();
  8169. }
  8170. // Aborting is no longer a cancellation
  8171. strAbort = "abort";
  8172. // Install callbacks on deferreds
  8173. completeDeferred.add( s.complete );
  8174. jqXHR.done( s.success );
  8175. jqXHR.fail( s.error );
  8176. // Get transport
  8177. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  8178. // If no transport, we auto-abort
  8179. if ( !transport ) {
  8180. done( -1, "No Transport" );
  8181. } else {
  8182. jqXHR.readyState = 1;
  8183. // Send global event
  8184. if ( fireGlobals ) {
  8185. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  8186. }
  8187. // If request was aborted inside ajaxSend, stop there
  8188. if ( completed ) {
  8189. return jqXHR;
  8190. }
  8191. // Timeout
  8192. if ( s.async && s.timeout > 0 ) {
  8193. timeoutTimer = window.setTimeout( function() {
  8194. jqXHR.abort( "timeout" );
  8195. }, s.timeout );
  8196. }
  8197. try {
  8198. completed = false;
  8199. transport.send( requestHeaders, done );
  8200. } catch ( e ) {
  8201. // Rethrow post-completion exceptions
  8202. if ( completed ) {
  8203. throw e;
  8204. }
  8205. // Propagate others as results
  8206. done( -1, e );
  8207. }
  8208. }
  8209. // Callback for when everything is done
  8210. function done( status, nativeStatusText, responses, headers ) {
  8211. var isSuccess, success, error, response, modified,
  8212. statusText = nativeStatusText;
  8213. // Ignore repeat invocations
  8214. if ( completed ) {
  8215. return;
  8216. }
  8217. completed = true;
  8218. // Clear timeout if it exists
  8219. if ( timeoutTimer ) {
  8220. window.clearTimeout( timeoutTimer );
  8221. }
  8222. // Dereference transport for early garbage collection
  8223. // (no matter how long the jqXHR object will be used)
  8224. transport = undefined;
  8225. // Cache response headers
  8226. responseHeadersString = headers || "";
  8227. // Set readyState
  8228. jqXHR.readyState = status > 0 ? 4 : 0;
  8229. // Determine if successful
  8230. isSuccess = status >= 200 && status < 300 || status === 304;
  8231. // Get response data
  8232. if ( responses ) {
  8233. response = ajaxHandleResponses( s, jqXHR, responses );
  8234. }
  8235. // Convert no matter what (that way responseXXX fields are always set)
  8236. response = ajaxConvert( s, response, jqXHR, isSuccess );
  8237. // If successful, handle type chaining
  8238. if ( isSuccess ) {
  8239. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8240. if ( s.ifModified ) {
  8241. modified = jqXHR.getResponseHeader( "Last-Modified" );
  8242. if ( modified ) {
  8243. jQuery.lastModified[ cacheURL ] = modified;
  8244. }
  8245. modified = jqXHR.getResponseHeader( "etag" );
  8246. if ( modified ) {
  8247. jQuery.etag[ cacheURL ] = modified;
  8248. }
  8249. }
  8250. // if no content
  8251. if ( status === 204 || s.type === "HEAD" ) {
  8252. statusText = "nocontent";
  8253. // if not modified
  8254. } else if ( status === 304 ) {
  8255. statusText = "notmodified";
  8256. // If we have data, let's convert it
  8257. } else {
  8258. statusText = response.state;
  8259. success = response.data;
  8260. error = response.error;
  8261. isSuccess = !error;
  8262. }
  8263. } else {
  8264. // Extract error from statusText and normalize for non-aborts
  8265. error = statusText;
  8266. if ( status || !statusText ) {
  8267. statusText = "error";
  8268. if ( status < 0 ) {
  8269. status = 0;
  8270. }
  8271. }
  8272. }
  8273. // Set data for the fake xhr object
  8274. jqXHR.status = status;
  8275. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8276. // Success/Error
  8277. if ( isSuccess ) {
  8278. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8279. } else {
  8280. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8281. }
  8282. // Status-dependent callbacks
  8283. jqXHR.statusCode( statusCode );
  8284. statusCode = undefined;
  8285. if ( fireGlobals ) {
  8286. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8287. [ jqXHR, s, isSuccess ? success : error ] );
  8288. }
  8289. // Complete
  8290. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8291. if ( fireGlobals ) {
  8292. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8293. // Handle the global AJAX counter
  8294. if ( !( --jQuery.active ) ) {
  8295. jQuery.event.trigger( "ajaxStop" );
  8296. }
  8297. }
  8298. }
  8299. return jqXHR;
  8300. },
  8301. getJSON: function( url, data, callback ) {
  8302. return jQuery.get( url, data, callback, "json" );
  8303. },
  8304. getScript: function( url, callback ) {
  8305. return jQuery.get( url, undefined, callback, "script" );
  8306. }
  8307. } );
  8308. jQuery.each( [ "get", "post" ], function( i, method ) {
  8309. jQuery[ method ] = function( url, data, callback, type ) {
  8310. // Shift arguments if data argument was omitted
  8311. if ( jQuery.isFunction( data ) ) {
  8312. type = type || callback;
  8313. callback = data;
  8314. data = undefined;
  8315. }
  8316. // The url can be an options object (which then must have .url)
  8317. return jQuery.ajax( jQuery.extend( {
  8318. url: url,
  8319. type: method,
  8320. dataType: type,
  8321. data: data,
  8322. success: callback
  8323. }, jQuery.isPlainObject( url ) && url ) );
  8324. };
  8325. } );
  8326. jQuery._evalUrl = function( url ) {
  8327. return jQuery.ajax( {
  8328. url: url,
  8329. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8330. type: "GET",
  8331. dataType: "script",
  8332. cache: true,
  8333. async: false,
  8334. global: false,
  8335. "throws": true
  8336. } );
  8337. };
  8338. jQuery.fn.extend( {
  8339. wrapAll: function( html ) {
  8340. var wrap;
  8341. if ( this[ 0 ] ) {
  8342. if ( jQuery.isFunction( html ) ) {
  8343. html = html.call( this[ 0 ] );
  8344. }
  8345. // The elements to wrap the target around
  8346. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8347. if ( this[ 0 ].parentNode ) {
  8348. wrap.insertBefore( this[ 0 ] );
  8349. }
  8350. wrap.map( function() {
  8351. var elem = this;
  8352. while ( elem.firstElementChild ) {
  8353. elem = elem.firstElementChild;
  8354. }
  8355. return elem;
  8356. } ).append( this );
  8357. }
  8358. return this;
  8359. },
  8360. wrapInner: function( html ) {
  8361. if ( jQuery.isFunction( html ) ) {
  8362. return this.each( function( i ) {
  8363. jQuery( this ).wrapInner( html.call( this, i ) );
  8364. } );
  8365. }
  8366. return this.each( function() {
  8367. var self = jQuery( this ),
  8368. contents = self.contents();
  8369. if ( contents.length ) {
  8370. contents.wrapAll( html );
  8371. } else {
  8372. self.append( html );
  8373. }
  8374. } );
  8375. },
  8376. wrap: function( html ) {
  8377. var isFunction = jQuery.isFunction( html );
  8378. return this.each( function( i ) {
  8379. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  8380. } );
  8381. },
  8382. unwrap: function( selector ) {
  8383. this.parent( selector ).not( "body" ).each( function() {
  8384. jQuery( this ).replaceWith( this.childNodes );
  8385. } );
  8386. return this;
  8387. }
  8388. } );
  8389. jQuery.expr.pseudos.hidden = function( elem ) {
  8390. return !jQuery.expr.pseudos.visible( elem );
  8391. };
  8392. jQuery.expr.pseudos.visible = function( elem ) {
  8393. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8394. };
  8395. jQuery.ajaxSettings.xhr = function() {
  8396. try {
  8397. return new window.XMLHttpRequest();
  8398. } catch ( e ) {}
  8399. };
  8400. var xhrSuccessStatus = {
  8401. // File protocol always yields status code 0, assume 200
  8402. 0: 200,
  8403. // Support: IE <=9 only
  8404. // #1450: sometimes IE returns 1223 when it should be 204
  8405. 1223: 204
  8406. },
  8407. xhrSupported = jQuery.ajaxSettings.xhr();
  8408. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8409. support.ajax = xhrSupported = !!xhrSupported;
  8410. jQuery.ajaxTransport( function( options ) {
  8411. var callback, errorCallback;
  8412. // Cross domain only allowed if supported through XMLHttpRequest
  8413. if ( support.cors || xhrSupported && !options.crossDomain ) {
  8414. return {
  8415. send: function( headers, complete ) {
  8416. var i,
  8417. xhr = options.xhr();
  8418. xhr.open(
  8419. options.type,
  8420. options.url,
  8421. options.async,
  8422. options.username,
  8423. options.password
  8424. );
  8425. // Apply custom fields if provided
  8426. if ( options.xhrFields ) {
  8427. for ( i in options.xhrFields ) {
  8428. xhr[ i ] = options.xhrFields[ i ];
  8429. }
  8430. }
  8431. // Override mime type if needed
  8432. if ( options.mimeType && xhr.overrideMimeType ) {
  8433. xhr.overrideMimeType( options.mimeType );
  8434. }
  8435. // X-Requested-With header
  8436. // For cross-domain requests, seeing as conditions for a preflight are
  8437. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8438. // (it can always be set on a per-request basis or even using ajaxSetup)
  8439. // For same-domain requests, won't change header if already provided.
  8440. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8441. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8442. }
  8443. // Set headers
  8444. for ( i in headers ) {
  8445. xhr.setRequestHeader( i, headers[ i ] );
  8446. }
  8447. // Callback
  8448. callback = function( type ) {
  8449. return function() {
  8450. if ( callback ) {
  8451. callback = errorCallback = xhr.onload =
  8452. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  8453. if ( type === "abort" ) {
  8454. xhr.abort();
  8455. } else if ( type === "error" ) {
  8456. // Support: IE <=9 only
  8457. // On a manual native abort, IE9 throws
  8458. // errors on any property access that is not readyState
  8459. if ( typeof xhr.status !== "number" ) {
  8460. complete( 0, "error" );
  8461. } else {
  8462. complete(
  8463. // File: protocol always yields status 0; see #8605, #14207
  8464. xhr.status,
  8465. xhr.statusText
  8466. );
  8467. }
  8468. } else {
  8469. complete(
  8470. xhrSuccessStatus[ xhr.status ] || xhr.status,
  8471. xhr.statusText,
  8472. // Support: IE <=9 only
  8473. // IE9 has no XHR2 but throws on binary (trac-11426)
  8474. // For XHR2 non-text, let the caller handle it (gh-2498)
  8475. ( xhr.responseType || "text" ) !== "text" ||
  8476. typeof xhr.responseText !== "string" ?
  8477. { binary: xhr.response } :
  8478. { text: xhr.responseText },
  8479. xhr.getAllResponseHeaders()
  8480. );
  8481. }
  8482. }
  8483. };
  8484. };
  8485. // Listen to events
  8486. xhr.onload = callback();
  8487. errorCallback = xhr.onerror = callback( "error" );
  8488. // Support: IE 9 only
  8489. // Use onreadystatechange to replace onabort
  8490. // to handle uncaught aborts
  8491. if ( xhr.onabort !== undefined ) {
  8492. xhr.onabort = errorCallback;
  8493. } else {
  8494. xhr.onreadystatechange = function() {
  8495. // Check readyState before timeout as it changes
  8496. if ( xhr.readyState === 4 ) {
  8497. // Allow onerror to be called first,
  8498. // but that will not handle a native abort
  8499. // Also, save errorCallback to a variable
  8500. // as xhr.onerror cannot be accessed
  8501. window.setTimeout( function() {
  8502. if ( callback ) {
  8503. errorCallback();
  8504. }
  8505. } );
  8506. }
  8507. };
  8508. }
  8509. // Create the abort callback
  8510. callback = callback( "abort" );
  8511. try {
  8512. // Do send the request (this may raise an exception)
  8513. xhr.send( options.hasContent && options.data || null );
  8514. } catch ( e ) {
  8515. // #14683: Only rethrow if this hasn't been notified as an error yet
  8516. if ( callback ) {
  8517. throw e;
  8518. }
  8519. }
  8520. },
  8521. abort: function() {
  8522. if ( callback ) {
  8523. callback();
  8524. }
  8525. }
  8526. };
  8527. }
  8528. } );
  8529. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8530. jQuery.ajaxPrefilter( function( s ) {
  8531. if ( s.crossDomain ) {
  8532. s.contents.script = false;
  8533. }
  8534. } );
  8535. // Install script dataType
  8536. jQuery.ajaxSetup( {
  8537. accepts: {
  8538. script: "text/javascript, application/javascript, " +
  8539. "application/ecmascript, application/x-ecmascript"
  8540. },
  8541. contents: {
  8542. script: /\b(?:java|ecma)script\b/
  8543. },
  8544. converters: {
  8545. "text script": function( text ) {
  8546. jQuery.globalEval( text );
  8547. return text;
  8548. }
  8549. }
  8550. } );
  8551. // Handle cache's special case and crossDomain
  8552. jQuery.ajaxPrefilter( "script", function( s ) {
  8553. if ( s.cache === undefined ) {
  8554. s.cache = false;
  8555. }
  8556. if ( s.crossDomain ) {
  8557. s.type = "GET";
  8558. }
  8559. } );
  8560. // Bind script tag hack transport
  8561. jQuery.ajaxTransport( "script", function( s ) {
  8562. // This transport only deals with cross domain requests
  8563. if ( s.crossDomain ) {
  8564. var script, callback;
  8565. return {
  8566. send: function( _, complete ) {
  8567. script = jQuery( "<script>" ).prop( {
  8568. charset: s.scriptCharset,
  8569. src: s.url
  8570. } ).on(
  8571. "load error",
  8572. callback = function( evt ) {
  8573. script.remove();
  8574. callback = null;
  8575. if ( evt ) {
  8576. complete( evt.type === "error" ? 404 : 200, evt.type );
  8577. }
  8578. }
  8579. );
  8580. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8581. document.head.appendChild( script[ 0 ] );
  8582. },
  8583. abort: function() {
  8584. if ( callback ) {
  8585. callback();
  8586. }
  8587. }
  8588. };
  8589. }
  8590. } );
  8591. var oldCallbacks = [],
  8592. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8593. // Default jsonp settings
  8594. jQuery.ajaxSetup( {
  8595. jsonp: "callback",
  8596. jsonpCallback: function() {
  8597. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8598. this[ callback ] = true;
  8599. return callback;
  8600. }
  8601. } );
  8602. // Detect, normalize options and install callbacks for jsonp requests
  8603. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8604. var callbackName, overwritten, responseContainer,
  8605. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8606. "url" :
  8607. typeof s.data === "string" &&
  8608. ( s.contentType || "" )
  8609. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8610. rjsonp.test( s.data ) && "data"
  8611. );
  8612. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8613. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8614. // Get callback name, remembering preexisting value associated with it
  8615. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  8616. s.jsonpCallback() :
  8617. s.jsonpCallback;
  8618. // Insert callback into url or form data
  8619. if ( jsonProp ) {
  8620. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8621. } else if ( s.jsonp !== false ) {
  8622. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8623. }
  8624. // Use data converter to retrieve json after script execution
  8625. s.converters[ "script json" ] = function() {
  8626. if ( !responseContainer ) {
  8627. jQuery.error( callbackName + " was not called" );
  8628. }
  8629. return responseContainer[ 0 ];
  8630. };
  8631. // Force json dataType
  8632. s.dataTypes[ 0 ] = "json";
  8633. // Install callback
  8634. overwritten = window[ callbackName ];
  8635. window[ callbackName ] = function() {
  8636. responseContainer = arguments;
  8637. };
  8638. // Clean-up function (fires after converters)
  8639. jqXHR.always( function() {
  8640. // If previous value didn't exist - remove it
  8641. if ( overwritten === undefined ) {
  8642. jQuery( window ).removeProp( callbackName );
  8643. // Otherwise restore preexisting value
  8644. } else {
  8645. window[ callbackName ] = overwritten;
  8646. }
  8647. // Save back as free
  8648. if ( s[ callbackName ] ) {
  8649. // Make sure that re-using the options doesn't screw things around
  8650. s.jsonpCallback = originalSettings.jsonpCallback;
  8651. // Save the callback name for future use
  8652. oldCallbacks.push( callbackName );
  8653. }
  8654. // Call if it was a function and we have a response
  8655. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  8656. overwritten( responseContainer[ 0 ] );
  8657. }
  8658. responseContainer = overwritten = undefined;
  8659. } );
  8660. // Delegate to script
  8661. return "script";
  8662. }
  8663. } );
  8664. // Support: Safari 8 only
  8665. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8666. // collapse sibling forms: the second one becomes a child of the first one.
  8667. // Because of that, this security measure has to be disabled in Safari 8.
  8668. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8669. support.createHTMLDocument = ( function() {
  8670. var body = document.implementation.createHTMLDocument( "" ).body;
  8671. body.innerHTML = "<form></form><form></form>";
  8672. return body.childNodes.length === 2;
  8673. } )();
  8674. // Argument "data" should be string of html
  8675. // context (optional): If specified, the fragment will be created in this context,
  8676. // defaults to document
  8677. // keepScripts (optional): If true, will include scripts passed in the html string
  8678. jQuery.parseHTML = function( data, context, keepScripts ) {
  8679. if ( typeof data !== "string" ) {
  8680. return [];
  8681. }
  8682. if ( typeof context === "boolean" ) {
  8683. keepScripts = context;
  8684. context = false;
  8685. }
  8686. var base, parsed, scripts;
  8687. if ( !context ) {
  8688. // Stop scripts or inline event handlers from being executed immediately
  8689. // by using document.implementation
  8690. if ( support.createHTMLDocument ) {
  8691. context = document.implementation.createHTMLDocument( "" );
  8692. // Set the base href for the created document
  8693. // so any parsed elements with URLs
  8694. // are based on the document's URL (gh-2965)
  8695. base = context.createElement( "base" );
  8696. base.href = document.location.href;
  8697. context.head.appendChild( base );
  8698. } else {
  8699. context = document;
  8700. }
  8701. }
  8702. parsed = rsingleTag.exec( data );
  8703. scripts = !keepScripts && [];
  8704. // Single tag
  8705. if ( parsed ) {
  8706. return [ context.createElement( parsed[ 1 ] ) ];
  8707. }
  8708. parsed = buildFragment( [ data ], context, scripts );
  8709. if ( scripts && scripts.length ) {
  8710. jQuery( scripts ).remove();
  8711. }
  8712. return jQuery.merge( [], parsed.childNodes );
  8713. };
  8714. /**
  8715. * Load a url into a page
  8716. */
  8717. jQuery.fn.load = function( url, params, callback ) {
  8718. var selector, type, response,
  8719. self = this,
  8720. off = url.indexOf( " " );
  8721. if ( off > -1 ) {
  8722. selector = stripAndCollapse( url.slice( off ) );
  8723. url = url.slice( 0, off );
  8724. }
  8725. // If it's a function
  8726. if ( jQuery.isFunction( params ) ) {
  8727. // We assume that it's the callback
  8728. callback = params;
  8729. params = undefined;
  8730. // Otherwise, build a param string
  8731. } else if ( params && typeof params === "object" ) {
  8732. type = "POST";
  8733. }
  8734. // If we have elements to modify, make the request
  8735. if ( self.length > 0 ) {
  8736. jQuery.ajax( {
  8737. url: url,
  8738. // If "type" variable is undefined, then "GET" method will be used.
  8739. // Make value of this field explicit since
  8740. // user can override it through ajaxSetup method
  8741. type: type || "GET",
  8742. dataType: "html",
  8743. data: params
  8744. } ).done( function( responseText ) {
  8745. // Save response for use in complete callback
  8746. response = arguments;
  8747. self.html( selector ?
  8748. // If a selector was specified, locate the right elements in a dummy div
  8749. // Exclude scripts to avoid IE 'Permission Denied' errors
  8750. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8751. // Otherwise use the full result
  8752. responseText );
  8753. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8754. // but they are ignored because response was set above.
  8755. // If it fails, this function gets "jqXHR", "status", "error"
  8756. } ).always( callback && function( jqXHR, status ) {
  8757. self.each( function() {
  8758. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8759. } );
  8760. } );
  8761. }
  8762. return this;
  8763. };
  8764. // Attach a bunch of functions for handling common AJAX events
  8765. jQuery.each( [
  8766. "ajaxStart",
  8767. "ajaxStop",
  8768. "ajaxComplete",
  8769. "ajaxError",
  8770. "ajaxSuccess",
  8771. "ajaxSend"
  8772. ], function( i, type ) {
  8773. jQuery.fn[ type ] = function( fn ) {
  8774. return this.on( type, fn );
  8775. };
  8776. } );
  8777. jQuery.expr.pseudos.animated = function( elem ) {
  8778. return jQuery.grep( jQuery.timers, function( fn ) {
  8779. return elem === fn.elem;
  8780. } ).length;
  8781. };
  8782. jQuery.offset = {
  8783. setOffset: function( elem, options, i ) {
  8784. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8785. position = jQuery.css( elem, "position" ),
  8786. curElem = jQuery( elem ),
  8787. props = {};
  8788. // Set position first, in-case top/left are set even on static elem
  8789. if ( position === "static" ) {
  8790. elem.style.position = "relative";
  8791. }
  8792. curOffset = curElem.offset();
  8793. curCSSTop = jQuery.css( elem, "top" );
  8794. curCSSLeft = jQuery.css( elem, "left" );
  8795. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8796. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8797. // Need to be able to calculate position if either
  8798. // top or left is auto and position is either absolute or fixed
  8799. if ( calculatePosition ) {
  8800. curPosition = curElem.position();
  8801. curTop = curPosition.top;
  8802. curLeft = curPosition.left;
  8803. } else {
  8804. curTop = parseFloat( curCSSTop ) || 0;
  8805. curLeft = parseFloat( curCSSLeft ) || 0;
  8806. }
  8807. if ( jQuery.isFunction( options ) ) {
  8808. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8809. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8810. }
  8811. if ( options.top != null ) {
  8812. props.top = ( options.top - curOffset.top ) + curTop;
  8813. }
  8814. if ( options.left != null ) {
  8815. props.left = ( options.left - curOffset.left ) + curLeft;
  8816. }
  8817. if ( "using" in options ) {
  8818. options.using.call( elem, props );
  8819. } else {
  8820. curElem.css( props );
  8821. }
  8822. }
  8823. };
  8824. jQuery.fn.extend( {
  8825. offset: function( options ) {
  8826. // Preserve chaining for setter
  8827. if ( arguments.length ) {
  8828. return options === undefined ?
  8829. this :
  8830. this.each( function( i ) {
  8831. jQuery.offset.setOffset( this, options, i );
  8832. } );
  8833. }
  8834. var doc, docElem, rect, win,
  8835. elem = this[ 0 ];
  8836. if ( !elem ) {
  8837. return;
  8838. }
  8839. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8840. // Support: IE <=11 only
  8841. // Running getBoundingClientRect on a
  8842. // disconnected node in IE throws an error
  8843. if ( !elem.getClientRects().length ) {
  8844. return { top: 0, left: 0 };
  8845. }
  8846. rect = elem.getBoundingClientRect();
  8847. doc = elem.ownerDocument;
  8848. docElem = doc.documentElement;
  8849. win = doc.defaultView;
  8850. return {
  8851. top: rect.top + win.pageYOffset - docElem.clientTop,
  8852. left: rect.left + win.pageXOffset - docElem.clientLeft
  8853. };
  8854. },
  8855. position: function() {
  8856. if ( !this[ 0 ] ) {
  8857. return;
  8858. }
  8859. var offsetParent, offset,
  8860. elem = this[ 0 ],
  8861. parentOffset = { top: 0, left: 0 };
  8862. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8863. // because it is its only offset parent
  8864. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8865. // Assume getBoundingClientRect is there when computed position is fixed
  8866. offset = elem.getBoundingClientRect();
  8867. } else {
  8868. // Get *real* offsetParent
  8869. offsetParent = this.offsetParent();
  8870. // Get correct offsets
  8871. offset = this.offset();
  8872. if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
  8873. parentOffset = offsetParent.offset();
  8874. }
  8875. // Add offsetParent borders
  8876. parentOffset = {
  8877. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  8878. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  8879. };
  8880. }
  8881. // Subtract parent offsets and element margins
  8882. return {
  8883. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8884. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8885. };
  8886. },
  8887. // This method will return documentElement in the following cases:
  8888. // 1) For the element inside the iframe without offsetParent, this method will return
  8889. // documentElement of the parent window
  8890. // 2) For the hidden or detached element
  8891. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8892. //
  8893. // but those exceptions were never presented as a real life use-cases
  8894. // and might be considered as more preferable results.
  8895. //
  8896. // This logic, however, is not guaranteed and can change at any point in the future
  8897. offsetParent: function() {
  8898. return this.map( function() {
  8899. var offsetParent = this.offsetParent;
  8900. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8901. offsetParent = offsetParent.offsetParent;
  8902. }
  8903. return offsetParent || documentElement;
  8904. } );
  8905. }
  8906. } );
  8907. // Create scrollLeft and scrollTop methods
  8908. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8909. var top = "pageYOffset" === prop;
  8910. jQuery.fn[ method ] = function( val ) {
  8911. return access( this, function( elem, method, val ) {
  8912. // Coalesce documents and windows
  8913. var win;
  8914. if ( jQuery.isWindow( elem ) ) {
  8915. win = elem;
  8916. } else if ( elem.nodeType === 9 ) {
  8917. win = elem.defaultView;
  8918. }
  8919. if ( val === undefined ) {
  8920. return win ? win[ prop ] : elem[ method ];
  8921. }
  8922. if ( win ) {
  8923. win.scrollTo(
  8924. !top ? val : win.pageXOffset,
  8925. top ? val : win.pageYOffset
  8926. );
  8927. } else {
  8928. elem[ method ] = val;
  8929. }
  8930. }, method, val, arguments.length );
  8931. };
  8932. } );
  8933. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8934. // Add the top/left cssHooks using jQuery.fn.position
  8935. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8936. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8937. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8938. // rather than make the css module depend on the offset module, just check for it here
  8939. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8940. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8941. function( elem, computed ) {
  8942. if ( computed ) {
  8943. computed = curCSS( elem, prop );
  8944. // If curCSS returns percentage, fallback to offset
  8945. return rnumnonpx.test( computed ) ?
  8946. jQuery( elem ).position()[ prop ] + "px" :
  8947. computed;
  8948. }
  8949. }
  8950. );
  8951. } );
  8952. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8953. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8954. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8955. function( defaultExtra, funcName ) {
  8956. // Margin is only for outerHeight, outerWidth
  8957. jQuery.fn[ funcName ] = function( margin, value ) {
  8958. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8959. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8960. return access( this, function( elem, type, value ) {
  8961. var doc;
  8962. if ( jQuery.isWindow( elem ) ) {
  8963. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8964. return funcName.indexOf( "outer" ) === 0 ?
  8965. elem[ "inner" + name ] :
  8966. elem.document.documentElement[ "client" + name ];
  8967. }
  8968. // Get document width or height
  8969. if ( elem.nodeType === 9 ) {
  8970. doc = elem.documentElement;
  8971. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8972. // whichever is greatest
  8973. return Math.max(
  8974. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8975. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8976. doc[ "client" + name ]
  8977. );
  8978. }
  8979. return value === undefined ?
  8980. // Get width or height on the element, requesting but not forcing parseFloat
  8981. jQuery.css( elem, type, extra ) :
  8982. // Set width or height on the element
  8983. jQuery.style( elem, type, value, extra );
  8984. }, type, chainable ? margin : undefined, chainable );
  8985. };
  8986. } );
  8987. } );
  8988. jQuery.fn.extend( {
  8989. bind: function( types, data, fn ) {
  8990. return this.on( types, null, data, fn );
  8991. },
  8992. unbind: function( types, fn ) {
  8993. return this.off( types, null, fn );
  8994. },
  8995. delegate: function( selector, types, data, fn ) {
  8996. return this.on( types, selector, data, fn );
  8997. },
  8998. undelegate: function( selector, types, fn ) {
  8999. // ( namespace ) or ( selector, types [, fn] )
  9000. return arguments.length === 1 ?
  9001. this.off( selector, "**" ) :
  9002. this.off( types, selector || "**", fn );
  9003. }
  9004. } );
  9005. jQuery.holdReady = function( hold ) {
  9006. if ( hold ) {
  9007. jQuery.readyWait++;
  9008. } else {
  9009. jQuery.ready( true );
  9010. }
  9011. };
  9012. jQuery.isArray = Array.isArray;
  9013. jQuery.parseJSON = JSON.parse;
  9014. jQuery.nodeName = nodeName;
  9015. // Register as a named AMD module, since jQuery can be concatenated with other
  9016. // files that may use define, but not via a proper concatenation script that
  9017. // understands anonymous AMD modules. A named AMD is safest and most robust
  9018. // way to register. Lowercase jquery is used because AMD module names are
  9019. // derived from file names, and jQuery is normally delivered in a lowercase
  9020. // file name. Do this after creating the global so that if an AMD module wants
  9021. // to call noConflict to hide this version of jQuery, it will work.
  9022. // Note that for maximum portability, libraries that are not jQuery should
  9023. // declare themselves as anonymous modules, and avoid setting a global if an
  9024. // AMD loader is present. jQuery is a special case. For more information, see
  9025. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  9026. if ( typeof define === "function" && define.amd ) {
  9027. define( "jquery", [], function() {
  9028. return jQuery;
  9029. } );
  9030. }
  9031. var
  9032. // Map over jQuery in case of overwrite
  9033. _jQuery = window.jQuery,
  9034. // Map over the $ in case of overwrite
  9035. _$ = window.$;
  9036. jQuery.noConflict = function( deep ) {
  9037. if ( window.$ === jQuery ) {
  9038. window.$ = _$;
  9039. }
  9040. if ( deep && window.jQuery === jQuery ) {
  9041. window.jQuery = _jQuery;
  9042. }
  9043. return jQuery;
  9044. };
  9045. // Expose jQuery and $ identifiers, even in AMD
  9046. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  9047. // and CommonJS for browser emulators (#13566)
  9048. if ( !noGlobal ) {
  9049. window.jQuery = window.$ = jQuery;
  9050. }
  9051. return jQuery;
  9052. } );
  9053. });
  9054. return ___scope___.entry = "dist/jquery.js";
  9055. });
  9056. FuseBox.pkg("lodash", {}, function(___scope___){
  9057. ___scope___.file("lodash.js", function(exports, require, module, __filename, __dirname){
  9058. /**
  9059. * @license
  9060. * Lodash <https://lodash.com/>
  9061. * Copyright JS Foundation and other contributors <https://js.foundation/>
  9062. * Released under MIT license <https://lodash.com/license>
  9063. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  9064. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  9065. */
  9066. ;(function() {
  9067. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  9068. var undefined;
  9069. /** Used as the semantic version number. */
  9070. var VERSION = '4.17.4';
  9071. /** Used as the size to enable large array optimizations. */
  9072. var LARGE_ARRAY_SIZE = 200;
  9073. /** Error message constants. */
  9074. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  9075. FUNC_ERROR_TEXT = 'Expected a function';
  9076. /** Used to stand-in for `undefined` hash values. */
  9077. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  9078. /** Used as the maximum memoize cache size. */
  9079. var MAX_MEMOIZE_SIZE = 500;
  9080. /** Used as the internal argument placeholder. */
  9081. var PLACEHOLDER = '__lodash_placeholder__';
  9082. /** Used to compose bitmasks for cloning. */
  9083. var CLONE_DEEP_FLAG = 1,
  9084. CLONE_FLAT_FLAG = 2,
  9085. CLONE_SYMBOLS_FLAG = 4;
  9086. /** Used to compose bitmasks for value comparisons. */
  9087. var COMPARE_PARTIAL_FLAG = 1,
  9088. COMPARE_UNORDERED_FLAG = 2;
  9089. /** Used to compose bitmasks for function metadata. */
  9090. var WRAP_BIND_FLAG = 1,
  9091. WRAP_BIND_KEY_FLAG = 2,
  9092. WRAP_CURRY_BOUND_FLAG = 4,
  9093. WRAP_CURRY_FLAG = 8,
  9094. WRAP_CURRY_RIGHT_FLAG = 16,
  9095. WRAP_PARTIAL_FLAG = 32,
  9096. WRAP_PARTIAL_RIGHT_FLAG = 64,
  9097. WRAP_ARY_FLAG = 128,
  9098. WRAP_REARG_FLAG = 256,
  9099. WRAP_FLIP_FLAG = 512;
  9100. /** Used as default options for `_.truncate`. */
  9101. var DEFAULT_TRUNC_LENGTH = 30,
  9102. DEFAULT_TRUNC_OMISSION = '...';
  9103. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  9104. var HOT_COUNT = 800,
  9105. HOT_SPAN = 16;
  9106. /** Used to indicate the type of lazy iteratees. */
  9107. var LAZY_FILTER_FLAG = 1,
  9108. LAZY_MAP_FLAG = 2,
  9109. LAZY_WHILE_FLAG = 3;
  9110. /** Used as references for various `Number` constants. */
  9111. var INFINITY = 1 / 0,
  9112. MAX_SAFE_INTEGER = 9007199254740991,
  9113. MAX_INTEGER = 1.7976931348623157e+308,
  9114. NAN = 0 / 0;
  9115. /** Used as references for the maximum length and index of an array. */
  9116. var MAX_ARRAY_LENGTH = 4294967295,
  9117. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  9118. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  9119. /** Used to associate wrap methods with their bit flags. */
  9120. var wrapFlags = [
  9121. ['ary', WRAP_ARY_FLAG],
  9122. ['bind', WRAP_BIND_FLAG],
  9123. ['bindKey', WRAP_BIND_KEY_FLAG],
  9124. ['curry', WRAP_CURRY_FLAG],
  9125. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  9126. ['flip', WRAP_FLIP_FLAG],
  9127. ['partial', WRAP_PARTIAL_FLAG],
  9128. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  9129. ['rearg', WRAP_REARG_FLAG]
  9130. ];
  9131. /** `Object#toString` result references. */
  9132. var argsTag = '[object Arguments]',
  9133. arrayTag = '[object Array]',
  9134. asyncTag = '[object AsyncFunction]',
  9135. boolTag = '[object Boolean]',
  9136. dateTag = '[object Date]',
  9137. domExcTag = '[object DOMException]',
  9138. errorTag = '[object Error]',
  9139. funcTag = '[object Function]',
  9140. genTag = '[object GeneratorFunction]',
  9141. mapTag = '[object Map]',
  9142. numberTag = '[object Number]',
  9143. nullTag = '[object Null]',
  9144. objectTag = '[object Object]',
  9145. promiseTag = '[object Promise]',
  9146. proxyTag = '[object Proxy]',
  9147. regexpTag = '[object RegExp]',
  9148. setTag = '[object Set]',
  9149. stringTag = '[object String]',
  9150. symbolTag = '[object Symbol]',
  9151. undefinedTag = '[object Undefined]',
  9152. weakMapTag = '[object WeakMap]',
  9153. weakSetTag = '[object WeakSet]';
  9154. var arrayBufferTag = '[object ArrayBuffer]',
  9155. dataViewTag = '[object DataView]',
  9156. float32Tag = '[object Float32Array]',
  9157. float64Tag = '[object Float64Array]',
  9158. int8Tag = '[object Int8Array]',
  9159. int16Tag = '[object Int16Array]',
  9160. int32Tag = '[object Int32Array]',
  9161. uint8Tag = '[object Uint8Array]',
  9162. uint8ClampedTag = '[object Uint8ClampedArray]',
  9163. uint16Tag = '[object Uint16Array]',
  9164. uint32Tag = '[object Uint32Array]';
  9165. /** Used to match empty string literals in compiled template source. */
  9166. var reEmptyStringLeading = /\b__p \+= '';/g,
  9167. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  9168. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  9169. /** Used to match HTML entities and HTML characters. */
  9170. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  9171. reUnescapedHtml = /[&<>"']/g,
  9172. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  9173. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  9174. /** Used to match template delimiters. */
  9175. var reEscape = /<%-([\s\S]+?)%>/g,
  9176. reEvaluate = /<%([\s\S]+?)%>/g,
  9177. reInterpolate = /<%=([\s\S]+?)%>/g;
  9178. /** Used to match property names within property paths. */
  9179. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  9180. reIsPlainProp = /^\w*$/,
  9181. reLeadingDot = /^\./,
  9182. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  9183. /**
  9184. * Used to match `RegExp`
  9185. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  9186. */
  9187. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  9188. reHasRegExpChar = RegExp(reRegExpChar.source);
  9189. /** Used to match leading and trailing whitespace. */
  9190. var reTrim = /^\s+|\s+$/g,
  9191. reTrimStart = /^\s+/,
  9192. reTrimEnd = /\s+$/;
  9193. /** Used to match wrap detail comments. */
  9194. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  9195. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  9196. reSplitDetails = /,? & /;
  9197. /** Used to match words composed of alphanumeric characters. */
  9198. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  9199. /** Used to match backslashes in property paths. */
  9200. var reEscapeChar = /\\(\\)?/g;
  9201. /**
  9202. * Used to match
  9203. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  9204. */
  9205. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  9206. /** Used to match `RegExp` flags from their coerced string values. */
  9207. var reFlags = /\w*$/;
  9208. /** Used to detect bad signed hexadecimal string values. */
  9209. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  9210. /** Used to detect binary string values. */
  9211. var reIsBinary = /^0b[01]+$/i;
  9212. /** Used to detect host constructors (Safari). */
  9213. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  9214. /** Used to detect octal string values. */
  9215. var reIsOctal = /^0o[0-7]+$/i;
  9216. /** Used to detect unsigned integer values. */
  9217. var reIsUint = /^(?:0|[1-9]\d*)$/;
  9218. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  9219. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  9220. /** Used to ensure capturing order of template delimiters. */
  9221. var reNoMatch = /($^)/;
  9222. /** Used to match unescaped characters in compiled string literals. */
  9223. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  9224. /** Used to compose unicode character classes. */
  9225. var rsAstralRange = '\\ud800-\\udfff',
  9226. rsComboMarksRange = '\\u0300-\\u036f',
  9227. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  9228. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  9229. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  9230. rsDingbatRange = '\\u2700-\\u27bf',
  9231. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  9232. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  9233. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  9234. rsPunctuationRange = '\\u2000-\\u206f',
  9235. 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',
  9236. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  9237. rsVarRange = '\\ufe0e\\ufe0f',
  9238. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  9239. /** Used to compose unicode capture groups. */
  9240. var rsApos = "['\u2019]",
  9241. rsAstral = '[' + rsAstralRange + ']',
  9242. rsBreak = '[' + rsBreakRange + ']',
  9243. rsCombo = '[' + rsComboRange + ']',
  9244. rsDigits = '\\d+',
  9245. rsDingbat = '[' + rsDingbatRange + ']',
  9246. rsLower = '[' + rsLowerRange + ']',
  9247. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  9248. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  9249. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  9250. rsNonAstral = '[^' + rsAstralRange + ']',
  9251. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  9252. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  9253. rsUpper = '[' + rsUpperRange + ']',
  9254. rsZWJ = '\\u200d';
  9255. /** Used to compose unicode regexes. */
  9256. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  9257. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  9258. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  9259. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  9260. reOptMod = rsModifier + '?',
  9261. rsOptVar = '[' + rsVarRange + ']?',
  9262. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  9263. rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
  9264. rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
  9265. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  9266. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  9267. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  9268. /** Used to match apostrophes. */
  9269. var reApos = RegExp(rsApos, 'g');
  9270. /**
  9271. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  9272. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  9273. */
  9274. var reComboMark = RegExp(rsCombo, 'g');
  9275. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  9276. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  9277. /** Used to match complex or compound words. */
  9278. var reUnicodeWord = RegExp([
  9279. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  9280. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  9281. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  9282. rsUpper + '+' + rsOptContrUpper,
  9283. rsOrdUpper,
  9284. rsOrdLower,
  9285. rsDigits,
  9286. rsEmoji
  9287. ].join('|'), 'g');
  9288. /** 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/). */
  9289. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  9290. /** Used to detect strings that need a more robust regexp to match words. */
  9291. 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 ]/;
  9292. /** Used to assign default `context` object properties. */
  9293. var contextProps = [
  9294. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  9295. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  9296. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  9297. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  9298. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  9299. ];
  9300. /** Used to make template sourceURLs easier to identify. */
  9301. var templateCounter = -1;
  9302. /** Used to identify `toStringTag` values of typed arrays. */
  9303. var typedArrayTags = {};
  9304. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  9305. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  9306. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  9307. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  9308. typedArrayTags[uint32Tag] = true;
  9309. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  9310. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  9311. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  9312. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  9313. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  9314. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  9315. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  9316. typedArrayTags[weakMapTag] = false;
  9317. /** Used to identify `toStringTag` values supported by `_.clone`. */
  9318. var cloneableTags = {};
  9319. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  9320. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  9321. cloneableTags[boolTag] = cloneableTags[dateTag] =
  9322. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  9323. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  9324. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  9325. cloneableTags[numberTag] = cloneableTags[objectTag] =
  9326. cloneableTags[regexpTag] = cloneableTags[setTag] =
  9327. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  9328. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  9329. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  9330. cloneableTags[errorTag] = cloneableTags[funcTag] =
  9331. cloneableTags[weakMapTag] = false;
  9332. /** Used to map Latin Unicode letters to basic Latin letters. */
  9333. var deburredLetters = {
  9334. // Latin-1 Supplement block.
  9335. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  9336. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  9337. '\xc7': 'C', '\xe7': 'c',
  9338. '\xd0': 'D', '\xf0': 'd',
  9339. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  9340. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  9341. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  9342. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  9343. '\xd1': 'N', '\xf1': 'n',
  9344. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  9345. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  9346. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  9347. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  9348. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  9349. '\xc6': 'Ae', '\xe6': 'ae',
  9350. '\xde': 'Th', '\xfe': 'th',
  9351. '\xdf': 'ss',
  9352. // Latin Extended-A block.
  9353. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  9354. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  9355. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  9356. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  9357. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  9358. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  9359. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  9360. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  9361. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  9362. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  9363. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  9364. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  9365. '\u0134': 'J', '\u0135': 'j',
  9366. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  9367. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  9368. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  9369. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  9370. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  9371. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  9372. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  9373. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  9374. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  9375. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  9376. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  9377. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  9378. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  9379. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  9380. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  9381. '\u0174': 'W', '\u0175': 'w',
  9382. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  9383. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  9384. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  9385. '\u0132': 'IJ', '\u0133': 'ij',
  9386. '\u0152': 'Oe', '\u0153': 'oe',
  9387. '\u0149': "'n", '\u017f': 's'
  9388. };
  9389. /** Used to map characters to HTML entities. */
  9390. var htmlEscapes = {
  9391. '&': '&amp;',
  9392. '<': '&lt;',
  9393. '>': '&gt;',
  9394. '"': '&quot;',
  9395. "'": '&#39;'
  9396. };
  9397. /** Used to map HTML entities to characters. */
  9398. var htmlUnescapes = {
  9399. '&amp;': '&',
  9400. '&lt;': '<',
  9401. '&gt;': '>',
  9402. '&quot;': '"',
  9403. '&#39;': "'"
  9404. };
  9405. /** Used to escape characters for inclusion in compiled string literals. */
  9406. var stringEscapes = {
  9407. '\\': '\\',
  9408. "'": "'",
  9409. '\n': 'n',
  9410. '\r': 'r',
  9411. '\u2028': 'u2028',
  9412. '\u2029': 'u2029'
  9413. };
  9414. /** Built-in method references without a dependency on `root`. */
  9415. var freeParseFloat = parseFloat,
  9416. freeParseInt = parseInt;
  9417. /** Detect free variable `global` from Node.js. */
  9418. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  9419. /** Detect free variable `self`. */
  9420. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  9421. /** Used as a reference to the global object. */
  9422. var root = freeGlobal || freeSelf || Function('return this')();
  9423. /** Detect free variable `exports`. */
  9424. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  9425. /** Detect free variable `module`. */
  9426. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  9427. /** Detect the popular CommonJS extension `module.exports`. */
  9428. var moduleExports = freeModule && freeModule.exports === freeExports;
  9429. /** Detect free variable `process` from Node.js. */
  9430. var freeProcess = moduleExports && freeGlobal.process;
  9431. /** Used to access faster Node.js helpers. */
  9432. var nodeUtil = (function() {
  9433. try {
  9434. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  9435. } catch (e) {}
  9436. }());
  9437. /* Node.js helper references. */
  9438. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  9439. nodeIsDate = nodeUtil && nodeUtil.isDate,
  9440. nodeIsMap = nodeUtil && nodeUtil.isMap,
  9441. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  9442. nodeIsSet = nodeUtil && nodeUtil.isSet,
  9443. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  9444. /*--------------------------------------------------------------------------*/
  9445. /**
  9446. * Adds the key-value `pair` to `map`.
  9447. *
  9448. * @private
  9449. * @param {Object} map The map to modify.
  9450. * @param {Array} pair The key-value pair to add.
  9451. * @returns {Object} Returns `map`.
  9452. */
  9453. function addMapEntry(map, pair) {
  9454. // Don't return `map.set` because it's not chainable in IE 11.
  9455. map.set(pair[0], pair[1]);
  9456. return map;
  9457. }
  9458. /**
  9459. * Adds `value` to `set`.
  9460. *
  9461. * @private
  9462. * @param {Object} set The set to modify.
  9463. * @param {*} value The value to add.
  9464. * @returns {Object} Returns `set`.
  9465. */
  9466. function addSetEntry(set, value) {
  9467. // Don't return `set.add` because it's not chainable in IE 11.
  9468. set.add(value);
  9469. return set;
  9470. }
  9471. /**
  9472. * A faster alternative to `Function#apply`, this function invokes `func`
  9473. * with the `this` binding of `thisArg` and the arguments of `args`.
  9474. *
  9475. * @private
  9476. * @param {Function} func The function to invoke.
  9477. * @param {*} thisArg The `this` binding of `func`.
  9478. * @param {Array} args The arguments to invoke `func` with.
  9479. * @returns {*} Returns the result of `func`.
  9480. */
  9481. function apply(func, thisArg, args) {
  9482. switch (args.length) {
  9483. case 0: return func.call(thisArg);
  9484. case 1: return func.call(thisArg, args[0]);
  9485. case 2: return func.call(thisArg, args[0], args[1]);
  9486. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  9487. }
  9488. return func.apply(thisArg, args);
  9489. }
  9490. /**
  9491. * A specialized version of `baseAggregator` for arrays.
  9492. *
  9493. * @private
  9494. * @param {Array} [array] The array to iterate over.
  9495. * @param {Function} setter The function to set `accumulator` values.
  9496. * @param {Function} iteratee The iteratee to transform keys.
  9497. * @param {Object} accumulator The initial aggregated object.
  9498. * @returns {Function} Returns `accumulator`.
  9499. */
  9500. function arrayAggregator(array, setter, iteratee, accumulator) {
  9501. var index = -1,
  9502. length = array == null ? 0 : array.length;
  9503. while (++index < length) {
  9504. var value = array[index];
  9505. setter(accumulator, value, iteratee(value), array);
  9506. }
  9507. return accumulator;
  9508. }
  9509. /**
  9510. * A specialized version of `_.forEach` for arrays without support for
  9511. * iteratee shorthands.
  9512. *
  9513. * @private
  9514. * @param {Array} [array] The array to iterate over.
  9515. * @param {Function} iteratee The function invoked per iteration.
  9516. * @returns {Array} Returns `array`.
  9517. */
  9518. function arrayEach(array, iteratee) {
  9519. var index = -1,
  9520. length = array == null ? 0 : array.length;
  9521. while (++index < length) {
  9522. if (iteratee(array[index], index, array) === false) {
  9523. break;
  9524. }
  9525. }
  9526. return array;
  9527. }
  9528. /**
  9529. * A specialized version of `_.forEachRight` for arrays without support for
  9530. * iteratee shorthands.
  9531. *
  9532. * @private
  9533. * @param {Array} [array] The array to iterate over.
  9534. * @param {Function} iteratee The function invoked per iteration.
  9535. * @returns {Array} Returns `array`.
  9536. */
  9537. function arrayEachRight(array, iteratee) {
  9538. var length = array == null ? 0 : array.length;
  9539. while (length--) {
  9540. if (iteratee(array[length], length, array) === false) {
  9541. break;
  9542. }
  9543. }
  9544. return array;
  9545. }
  9546. /**
  9547. * A specialized version of `_.every` for arrays without support for
  9548. * iteratee shorthands.
  9549. *
  9550. * @private
  9551. * @param {Array} [array] The array to iterate over.
  9552. * @param {Function} predicate The function invoked per iteration.
  9553. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9554. * else `false`.
  9555. */
  9556. function arrayEvery(array, predicate) {
  9557. var index = -1,
  9558. length = array == null ? 0 : array.length;
  9559. while (++index < length) {
  9560. if (!predicate(array[index], index, array)) {
  9561. return false;
  9562. }
  9563. }
  9564. return true;
  9565. }
  9566. /**
  9567. * A specialized version of `_.filter` for arrays without support for
  9568. * iteratee shorthands.
  9569. *
  9570. * @private
  9571. * @param {Array} [array] The array to iterate over.
  9572. * @param {Function} predicate The function invoked per iteration.
  9573. * @returns {Array} Returns the new filtered array.
  9574. */
  9575. function arrayFilter(array, predicate) {
  9576. var index = -1,
  9577. length = array == null ? 0 : array.length,
  9578. resIndex = 0,
  9579. result = [];
  9580. while (++index < length) {
  9581. var value = array[index];
  9582. if (predicate(value, index, array)) {
  9583. result[resIndex++] = value;
  9584. }
  9585. }
  9586. return result;
  9587. }
  9588. /**
  9589. * A specialized version of `_.includes` for arrays without support for
  9590. * specifying an index to search from.
  9591. *
  9592. * @private
  9593. * @param {Array} [array] The array to inspect.
  9594. * @param {*} target The value to search for.
  9595. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  9596. */
  9597. function arrayIncludes(array, value) {
  9598. var length = array == null ? 0 : array.length;
  9599. return !!length && baseIndexOf(array, value, 0) > -1;
  9600. }
  9601. /**
  9602. * This function is like `arrayIncludes` except that it accepts a comparator.
  9603. *
  9604. * @private
  9605. * @param {Array} [array] The array to inspect.
  9606. * @param {*} target The value to search for.
  9607. * @param {Function} comparator The comparator invoked per element.
  9608. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  9609. */
  9610. function arrayIncludesWith(array, value, comparator) {
  9611. var index = -1,
  9612. length = array == null ? 0 : array.length;
  9613. while (++index < length) {
  9614. if (comparator(value, array[index])) {
  9615. return true;
  9616. }
  9617. }
  9618. return false;
  9619. }
  9620. /**
  9621. * A specialized version of `_.map` for arrays without support for iteratee
  9622. * shorthands.
  9623. *
  9624. * @private
  9625. * @param {Array} [array] The array to iterate over.
  9626. * @param {Function} iteratee The function invoked per iteration.
  9627. * @returns {Array} Returns the new mapped array.
  9628. */
  9629. function arrayMap(array, iteratee) {
  9630. var index = -1,
  9631. length = array == null ? 0 : array.length,
  9632. result = Array(length);
  9633. while (++index < length) {
  9634. result[index] = iteratee(array[index], index, array);
  9635. }
  9636. return result;
  9637. }
  9638. /**
  9639. * Appends the elements of `values` to `array`.
  9640. *
  9641. * @private
  9642. * @param {Array} array The array to modify.
  9643. * @param {Array} values The values to append.
  9644. * @returns {Array} Returns `array`.
  9645. */
  9646. function arrayPush(array, values) {
  9647. var index = -1,
  9648. length = values.length,
  9649. offset = array.length;
  9650. while (++index < length) {
  9651. array[offset + index] = values[index];
  9652. }
  9653. return array;
  9654. }
  9655. /**
  9656. * A specialized version of `_.reduce` for arrays without support for
  9657. * iteratee shorthands.
  9658. *
  9659. * @private
  9660. * @param {Array} [array] The array to iterate over.
  9661. * @param {Function} iteratee The function invoked per iteration.
  9662. * @param {*} [accumulator] The initial value.
  9663. * @param {boolean} [initAccum] Specify using the first element of `array` as
  9664. * the initial value.
  9665. * @returns {*} Returns the accumulated value.
  9666. */
  9667. function arrayReduce(array, iteratee, accumulator, initAccum) {
  9668. var index = -1,
  9669. length = array == null ? 0 : array.length;
  9670. if (initAccum && length) {
  9671. accumulator = array[++index];
  9672. }
  9673. while (++index < length) {
  9674. accumulator = iteratee(accumulator, array[index], index, array);
  9675. }
  9676. return accumulator;
  9677. }
  9678. /**
  9679. * A specialized version of `_.reduceRight` for arrays without support for
  9680. * iteratee shorthands.
  9681. *
  9682. * @private
  9683. * @param {Array} [array] The array to iterate over.
  9684. * @param {Function} iteratee The function invoked per iteration.
  9685. * @param {*} [accumulator] The initial value.
  9686. * @param {boolean} [initAccum] Specify using the last element of `array` as
  9687. * the initial value.
  9688. * @returns {*} Returns the accumulated value.
  9689. */
  9690. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  9691. var length = array == null ? 0 : array.length;
  9692. if (initAccum && length) {
  9693. accumulator = array[--length];
  9694. }
  9695. while (length--) {
  9696. accumulator = iteratee(accumulator, array[length], length, array);
  9697. }
  9698. return accumulator;
  9699. }
  9700. /**
  9701. * A specialized version of `_.some` for arrays without support for iteratee
  9702. * shorthands.
  9703. *
  9704. * @private
  9705. * @param {Array} [array] The array to iterate over.
  9706. * @param {Function} predicate The function invoked per iteration.
  9707. * @returns {boolean} Returns `true` if any element passes the predicate check,
  9708. * else `false`.
  9709. */
  9710. function arraySome(array, predicate) {
  9711. var index = -1,
  9712. length = array == null ? 0 : array.length;
  9713. while (++index < length) {
  9714. if (predicate(array[index], index, array)) {
  9715. return true;
  9716. }
  9717. }
  9718. return false;
  9719. }
  9720. /**
  9721. * Gets the size of an ASCII `string`.
  9722. *
  9723. * @private
  9724. * @param {string} string The string inspect.
  9725. * @returns {number} Returns the string size.
  9726. */
  9727. var asciiSize = baseProperty('length');
  9728. /**
  9729. * Converts an ASCII `string` to an array.
  9730. *
  9731. * @private
  9732. * @param {string} string The string to convert.
  9733. * @returns {Array} Returns the converted array.
  9734. */
  9735. function asciiToArray(string) {
  9736. return string.split('');
  9737. }
  9738. /**
  9739. * Splits an ASCII `string` into an array of its words.
  9740. *
  9741. * @private
  9742. * @param {string} The string to inspect.
  9743. * @returns {Array} Returns the words of `string`.
  9744. */
  9745. function asciiWords(string) {
  9746. return string.match(reAsciiWord) || [];
  9747. }
  9748. /**
  9749. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  9750. * without support for iteratee shorthands, which iterates over `collection`
  9751. * using `eachFunc`.
  9752. *
  9753. * @private
  9754. * @param {Array|Object} collection The collection to inspect.
  9755. * @param {Function} predicate The function invoked per iteration.
  9756. * @param {Function} eachFunc The function to iterate over `collection`.
  9757. * @returns {*} Returns the found element or its key, else `undefined`.
  9758. */
  9759. function baseFindKey(collection, predicate, eachFunc) {
  9760. var result;
  9761. eachFunc(collection, function(value, key, collection) {
  9762. if (predicate(value, key, collection)) {
  9763. result = key;
  9764. return false;
  9765. }
  9766. });
  9767. return result;
  9768. }
  9769. /**
  9770. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  9771. * support for iteratee shorthands.
  9772. *
  9773. * @private
  9774. * @param {Array} array The array to inspect.
  9775. * @param {Function} predicate The function invoked per iteration.
  9776. * @param {number} fromIndex The index to search from.
  9777. * @param {boolean} [fromRight] Specify iterating from right to left.
  9778. * @returns {number} Returns the index of the matched value, else `-1`.
  9779. */
  9780. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  9781. var length = array.length,
  9782. index = fromIndex + (fromRight ? 1 : -1);
  9783. while ((fromRight ? index-- : ++index < length)) {
  9784. if (predicate(array[index], index, array)) {
  9785. return index;
  9786. }
  9787. }
  9788. return -1;
  9789. }
  9790. /**
  9791. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  9792. *
  9793. * @private
  9794. * @param {Array} array The array to inspect.
  9795. * @param {*} value The value to search for.
  9796. * @param {number} fromIndex The index to search from.
  9797. * @returns {number} Returns the index of the matched value, else `-1`.
  9798. */
  9799. function baseIndexOf(array, value, fromIndex) {
  9800. return value === value
  9801. ? strictIndexOf(array, value, fromIndex)
  9802. : baseFindIndex(array, baseIsNaN, fromIndex);
  9803. }
  9804. /**
  9805. * This function is like `baseIndexOf` except that it accepts a comparator.
  9806. *
  9807. * @private
  9808. * @param {Array} array The array to inspect.
  9809. * @param {*} value The value to search for.
  9810. * @param {number} fromIndex The index to search from.
  9811. * @param {Function} comparator The comparator invoked per element.
  9812. * @returns {number} Returns the index of the matched value, else `-1`.
  9813. */
  9814. function baseIndexOfWith(array, value, fromIndex, comparator) {
  9815. var index = fromIndex - 1,
  9816. length = array.length;
  9817. while (++index < length) {
  9818. if (comparator(array[index], value)) {
  9819. return index;
  9820. }
  9821. }
  9822. return -1;
  9823. }
  9824. /**
  9825. * The base implementation of `_.isNaN` without support for number objects.
  9826. *
  9827. * @private
  9828. * @param {*} value The value to check.
  9829. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  9830. */
  9831. function baseIsNaN(value) {
  9832. return value !== value;
  9833. }
  9834. /**
  9835. * The base implementation of `_.mean` and `_.meanBy` without support for
  9836. * iteratee shorthands.
  9837. *
  9838. * @private
  9839. * @param {Array} array The array to iterate over.
  9840. * @param {Function} iteratee The function invoked per iteration.
  9841. * @returns {number} Returns the mean.
  9842. */
  9843. function baseMean(array, iteratee) {
  9844. var length = array == null ? 0 : array.length;
  9845. return length ? (baseSum(array, iteratee) / length) : NAN;
  9846. }
  9847. /**
  9848. * The base implementation of `_.property` without support for deep paths.
  9849. *
  9850. * @private
  9851. * @param {string} key The key of the property to get.
  9852. * @returns {Function} Returns the new accessor function.
  9853. */
  9854. function baseProperty(key) {
  9855. return function(object) {
  9856. return object == null ? undefined : object[key];
  9857. };
  9858. }
  9859. /**
  9860. * The base implementation of `_.propertyOf` without support for deep paths.
  9861. *
  9862. * @private
  9863. * @param {Object} object The object to query.
  9864. * @returns {Function} Returns the new accessor function.
  9865. */
  9866. function basePropertyOf(object) {
  9867. return function(key) {
  9868. return object == null ? undefined : object[key];
  9869. };
  9870. }
  9871. /**
  9872. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  9873. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  9874. *
  9875. * @private
  9876. * @param {Array|Object} collection The collection to iterate over.
  9877. * @param {Function} iteratee The function invoked per iteration.
  9878. * @param {*} accumulator The initial value.
  9879. * @param {boolean} initAccum Specify using the first or last element of
  9880. * `collection` as the initial value.
  9881. * @param {Function} eachFunc The function to iterate over `collection`.
  9882. * @returns {*} Returns the accumulated value.
  9883. */
  9884. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  9885. eachFunc(collection, function(value, index, collection) {
  9886. accumulator = initAccum
  9887. ? (initAccum = false, value)
  9888. : iteratee(accumulator, value, index, collection);
  9889. });
  9890. return accumulator;
  9891. }
  9892. /**
  9893. * The base implementation of `_.sortBy` which uses `comparer` to define the
  9894. * sort order of `array` and replaces criteria objects with their corresponding
  9895. * values.
  9896. *
  9897. * @private
  9898. * @param {Array} array The array to sort.
  9899. * @param {Function} comparer The function to define sort order.
  9900. * @returns {Array} Returns `array`.
  9901. */
  9902. function baseSortBy(array, comparer) {
  9903. var length = array.length;
  9904. array.sort(comparer);
  9905. while (length--) {
  9906. array[length] = array[length].value;
  9907. }
  9908. return array;
  9909. }
  9910. /**
  9911. * The base implementation of `_.sum` and `_.sumBy` without support for
  9912. * iteratee shorthands.
  9913. *
  9914. * @private
  9915. * @param {Array} array The array to iterate over.
  9916. * @param {Function} iteratee The function invoked per iteration.
  9917. * @returns {number} Returns the sum.
  9918. */
  9919. function baseSum(array, iteratee) {
  9920. var result,
  9921. index = -1,
  9922. length = array.length;
  9923. while (++index < length) {
  9924. var current = iteratee(array[index]);
  9925. if (current !== undefined) {
  9926. result = result === undefined ? current : (result + current);
  9927. }
  9928. }
  9929. return result;
  9930. }
  9931. /**
  9932. * The base implementation of `_.times` without support for iteratee shorthands
  9933. * or max array length checks.
  9934. *
  9935. * @private
  9936. * @param {number} n The number of times to invoke `iteratee`.
  9937. * @param {Function} iteratee The function invoked per iteration.
  9938. * @returns {Array} Returns the array of results.
  9939. */
  9940. function baseTimes(n, iteratee) {
  9941. var index = -1,
  9942. result = Array(n);
  9943. while (++index < n) {
  9944. result[index] = iteratee(index);
  9945. }
  9946. return result;
  9947. }
  9948. /**
  9949. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  9950. * of key-value pairs for `object` corresponding to the property names of `props`.
  9951. *
  9952. * @private
  9953. * @param {Object} object The object to query.
  9954. * @param {Array} props The property names to get values for.
  9955. * @returns {Object} Returns the key-value pairs.
  9956. */
  9957. function baseToPairs(object, props) {
  9958. return arrayMap(props, function(key) {
  9959. return [key, object[key]];
  9960. });
  9961. }
  9962. /**
  9963. * The base implementation of `_.unary` without support for storing metadata.
  9964. *
  9965. * @private
  9966. * @param {Function} func The function to cap arguments for.
  9967. * @returns {Function} Returns the new capped function.
  9968. */
  9969. function baseUnary(func) {
  9970. return function(value) {
  9971. return func(value);
  9972. };
  9973. }
  9974. /**
  9975. * The base implementation of `_.values` and `_.valuesIn` which creates an
  9976. * array of `object` property values corresponding to the property names
  9977. * of `props`.
  9978. *
  9979. * @private
  9980. * @param {Object} object The object to query.
  9981. * @param {Array} props The property names to get values for.
  9982. * @returns {Object} Returns the array of property values.
  9983. */
  9984. function baseValues(object, props) {
  9985. return arrayMap(props, function(key) {
  9986. return object[key];
  9987. });
  9988. }
  9989. /**
  9990. * Checks if a `cache` value for `key` exists.
  9991. *
  9992. * @private
  9993. * @param {Object} cache The cache to query.
  9994. * @param {string} key The key of the entry to check.
  9995. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  9996. */
  9997. function cacheHas(cache, key) {
  9998. return cache.has(key);
  9999. }
  10000. /**
  10001. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  10002. * that is not found in the character symbols.
  10003. *
  10004. * @private
  10005. * @param {Array} strSymbols The string symbols to inspect.
  10006. * @param {Array} chrSymbols The character symbols to find.
  10007. * @returns {number} Returns the index of the first unmatched string symbol.
  10008. */
  10009. function charsStartIndex(strSymbols, chrSymbols) {
  10010. var index = -1,
  10011. length = strSymbols.length;
  10012. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  10013. return index;
  10014. }
  10015. /**
  10016. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  10017. * that is not found in the character symbols.
  10018. *
  10019. * @private
  10020. * @param {Array} strSymbols The string symbols to inspect.
  10021. * @param {Array} chrSymbols The character symbols to find.
  10022. * @returns {number} Returns the index of the last unmatched string symbol.
  10023. */
  10024. function charsEndIndex(strSymbols, chrSymbols) {
  10025. var index = strSymbols.length;
  10026. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  10027. return index;
  10028. }
  10029. /**
  10030. * Gets the number of `placeholder` occurrences in `array`.
  10031. *
  10032. * @private
  10033. * @param {Array} array The array to inspect.
  10034. * @param {*} placeholder The placeholder to search for.
  10035. * @returns {number} Returns the placeholder count.
  10036. */
  10037. function countHolders(array, placeholder) {
  10038. var length = array.length,
  10039. result = 0;
  10040. while (length--) {
  10041. if (array[length] === placeholder) {
  10042. ++result;
  10043. }
  10044. }
  10045. return result;
  10046. }
  10047. /**
  10048. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  10049. * letters to basic Latin letters.
  10050. *
  10051. * @private
  10052. * @param {string} letter The matched letter to deburr.
  10053. * @returns {string} Returns the deburred letter.
  10054. */
  10055. var deburrLetter = basePropertyOf(deburredLetters);
  10056. /**
  10057. * Used by `_.escape` to convert characters to HTML entities.
  10058. *
  10059. * @private
  10060. * @param {string} chr The matched character to escape.
  10061. * @returns {string} Returns the escaped character.
  10062. */
  10063. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  10064. /**
  10065. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  10066. *
  10067. * @private
  10068. * @param {string} chr The matched character to escape.
  10069. * @returns {string} Returns the escaped character.
  10070. */
  10071. function escapeStringChar(chr) {
  10072. return '\\' + stringEscapes[chr];
  10073. }
  10074. /**
  10075. * Gets the value at `key` of `object`.
  10076. *
  10077. * @private
  10078. * @param {Object} [object] The object to query.
  10079. * @param {string} key The key of the property to get.
  10080. * @returns {*} Returns the property value.
  10081. */
  10082. function getValue(object, key) {
  10083. return object == null ? undefined : object[key];
  10084. }
  10085. /**
  10086. * Checks if `string` contains Unicode symbols.
  10087. *
  10088. * @private
  10089. * @param {string} string The string to inspect.
  10090. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  10091. */
  10092. function hasUnicode(string) {
  10093. return reHasUnicode.test(string);
  10094. }
  10095. /**
  10096. * Checks if `string` contains a word composed of Unicode symbols.
  10097. *
  10098. * @private
  10099. * @param {string} string The string to inspect.
  10100. * @returns {boolean} Returns `true` if a word is found, else `false`.
  10101. */
  10102. function hasUnicodeWord(string) {
  10103. return reHasUnicodeWord.test(string);
  10104. }
  10105. /**
  10106. * Converts `iterator` to an array.
  10107. *
  10108. * @private
  10109. * @param {Object} iterator The iterator to convert.
  10110. * @returns {Array} Returns the converted array.
  10111. */
  10112. function iteratorToArray(iterator) {
  10113. var data,
  10114. result = [];
  10115. while (!(data = iterator.next()).done) {
  10116. result.push(data.value);
  10117. }
  10118. return result;
  10119. }
  10120. /**
  10121. * Converts `map` to its key-value pairs.
  10122. *
  10123. * @private
  10124. * @param {Object} map The map to convert.
  10125. * @returns {Array} Returns the key-value pairs.
  10126. */
  10127. function mapToArray(map) {
  10128. var index = -1,
  10129. result = Array(map.size);
  10130. map.forEach(function(value, key) {
  10131. result[++index] = [key, value];
  10132. });
  10133. return result;
  10134. }
  10135. /**
  10136. * Creates a unary function that invokes `func` with its argument transformed.
  10137. *
  10138. * @private
  10139. * @param {Function} func The function to wrap.
  10140. * @param {Function} transform The argument transform.
  10141. * @returns {Function} Returns the new function.
  10142. */
  10143. function overArg(func, transform) {
  10144. return function(arg) {
  10145. return func(transform(arg));
  10146. };
  10147. }
  10148. /**
  10149. * Replaces all `placeholder` elements in `array` with an internal placeholder
  10150. * and returns an array of their indexes.
  10151. *
  10152. * @private
  10153. * @param {Array} array The array to modify.
  10154. * @param {*} placeholder The placeholder to replace.
  10155. * @returns {Array} Returns the new array of placeholder indexes.
  10156. */
  10157. function replaceHolders(array, placeholder) {
  10158. var index = -1,
  10159. length = array.length,
  10160. resIndex = 0,
  10161. result = [];
  10162. while (++index < length) {
  10163. var value = array[index];
  10164. if (value === placeholder || value === PLACEHOLDER) {
  10165. array[index] = PLACEHOLDER;
  10166. result[resIndex++] = index;
  10167. }
  10168. }
  10169. return result;
  10170. }
  10171. /**
  10172. * Converts `set` to an array of its values.
  10173. *
  10174. * @private
  10175. * @param {Object} set The set to convert.
  10176. * @returns {Array} Returns the values.
  10177. */
  10178. function setToArray(set) {
  10179. var index = -1,
  10180. result = Array(set.size);
  10181. set.forEach(function(value) {
  10182. result[++index] = value;
  10183. });
  10184. return result;
  10185. }
  10186. /**
  10187. * Converts `set` to its value-value pairs.
  10188. *
  10189. * @private
  10190. * @param {Object} set The set to convert.
  10191. * @returns {Array} Returns the value-value pairs.
  10192. */
  10193. function setToPairs(set) {
  10194. var index = -1,
  10195. result = Array(set.size);
  10196. set.forEach(function(value) {
  10197. result[++index] = [value, value];
  10198. });
  10199. return result;
  10200. }
  10201. /**
  10202. * A specialized version of `_.indexOf` which performs strict equality
  10203. * comparisons of values, i.e. `===`.
  10204. *
  10205. * @private
  10206. * @param {Array} array The array to inspect.
  10207. * @param {*} value The value to search for.
  10208. * @param {number} fromIndex The index to search from.
  10209. * @returns {number} Returns the index of the matched value, else `-1`.
  10210. */
  10211. function strictIndexOf(array, value, fromIndex) {
  10212. var index = fromIndex - 1,
  10213. length = array.length;
  10214. while (++index < length) {
  10215. if (array[index] === value) {
  10216. return index;
  10217. }
  10218. }
  10219. return -1;
  10220. }
  10221. /**
  10222. * A specialized version of `_.lastIndexOf` which performs strict equality
  10223. * comparisons of values, i.e. `===`.
  10224. *
  10225. * @private
  10226. * @param {Array} array The array to inspect.
  10227. * @param {*} value The value to search for.
  10228. * @param {number} fromIndex The index to search from.
  10229. * @returns {number} Returns the index of the matched value, else `-1`.
  10230. */
  10231. function strictLastIndexOf(array, value, fromIndex) {
  10232. var index = fromIndex + 1;
  10233. while (index--) {
  10234. if (array[index] === value) {
  10235. return index;
  10236. }
  10237. }
  10238. return index;
  10239. }
  10240. /**
  10241. * Gets the number of symbols in `string`.
  10242. *
  10243. * @private
  10244. * @param {string} string The string to inspect.
  10245. * @returns {number} Returns the string size.
  10246. */
  10247. function stringSize(string) {
  10248. return hasUnicode(string)
  10249. ? unicodeSize(string)
  10250. : asciiSize(string);
  10251. }
  10252. /**
  10253. * Converts `string` to an array.
  10254. *
  10255. * @private
  10256. * @param {string} string The string to convert.
  10257. * @returns {Array} Returns the converted array.
  10258. */
  10259. function stringToArray(string) {
  10260. return hasUnicode(string)
  10261. ? unicodeToArray(string)
  10262. : asciiToArray(string);
  10263. }
  10264. /**
  10265. * Used by `_.unescape` to convert HTML entities to characters.
  10266. *
  10267. * @private
  10268. * @param {string} chr The matched character to unescape.
  10269. * @returns {string} Returns the unescaped character.
  10270. */
  10271. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  10272. /**
  10273. * Gets the size of a Unicode `string`.
  10274. *
  10275. * @private
  10276. * @param {string} string The string inspect.
  10277. * @returns {number} Returns the string size.
  10278. */
  10279. function unicodeSize(string) {
  10280. var result = reUnicode.lastIndex = 0;
  10281. while (reUnicode.test(string)) {
  10282. ++result;
  10283. }
  10284. return result;
  10285. }
  10286. /**
  10287. * Converts a Unicode `string` to an array.
  10288. *
  10289. * @private
  10290. * @param {string} string The string to convert.
  10291. * @returns {Array} Returns the converted array.
  10292. */
  10293. function unicodeToArray(string) {
  10294. return string.match(reUnicode) || [];
  10295. }
  10296. /**
  10297. * Splits a Unicode `string` into an array of its words.
  10298. *
  10299. * @private
  10300. * @param {string} The string to inspect.
  10301. * @returns {Array} Returns the words of `string`.
  10302. */
  10303. function unicodeWords(string) {
  10304. return string.match(reUnicodeWord) || [];
  10305. }
  10306. /*--------------------------------------------------------------------------*/
  10307. /**
  10308. * Create a new pristine `lodash` function using the `context` object.
  10309. *
  10310. * @static
  10311. * @memberOf _
  10312. * @since 1.1.0
  10313. * @category Util
  10314. * @param {Object} [context=root] The context object.
  10315. * @returns {Function} Returns a new `lodash` function.
  10316. * @example
  10317. *
  10318. * _.mixin({ 'foo': _.constant('foo') });
  10319. *
  10320. * var lodash = _.runInContext();
  10321. * lodash.mixin({ 'bar': lodash.constant('bar') });
  10322. *
  10323. * _.isFunction(_.foo);
  10324. * // => true
  10325. * _.isFunction(_.bar);
  10326. * // => false
  10327. *
  10328. * lodash.isFunction(lodash.foo);
  10329. * // => false
  10330. * lodash.isFunction(lodash.bar);
  10331. * // => true
  10332. *
  10333. * // Create a suped-up `defer` in Node.js.
  10334. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  10335. */
  10336. var runInContext = (function runInContext(context) {
  10337. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  10338. /** Built-in constructor references. */
  10339. var Array = context.Array,
  10340. Date = context.Date,
  10341. Error = context.Error,
  10342. Function = context.Function,
  10343. Math = context.Math,
  10344. Object = context.Object,
  10345. RegExp = context.RegExp,
  10346. String = context.String,
  10347. TypeError = context.TypeError;
  10348. /** Used for built-in method references. */
  10349. var arrayProto = Array.prototype,
  10350. funcProto = Function.prototype,
  10351. objectProto = Object.prototype;
  10352. /** Used to detect overreaching core-js shims. */
  10353. var coreJsData = context['__core-js_shared__'];
  10354. /** Used to resolve the decompiled source of functions. */
  10355. var funcToString = funcProto.toString;
  10356. /** Used to check objects for own properties. */
  10357. var hasOwnProperty = objectProto.hasOwnProperty;
  10358. /** Used to generate unique IDs. */
  10359. var idCounter = 0;
  10360. /** Used to detect methods masquerading as native. */
  10361. var maskSrcKey = (function() {
  10362. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  10363. return uid ? ('Symbol(src)_1.' + uid) : '';
  10364. }());
  10365. /**
  10366. * Used to resolve the
  10367. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  10368. * of values.
  10369. */
  10370. var nativeObjectToString = objectProto.toString;
  10371. /** Used to infer the `Object` constructor. */
  10372. var objectCtorString = funcToString.call(Object);
  10373. /** Used to restore the original `_` reference in `_.noConflict`. */
  10374. var oldDash = root._;
  10375. /** Used to detect if a method is native. */
  10376. var reIsNative = RegExp('^' +
  10377. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  10378. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  10379. );
  10380. /** Built-in value references. */
  10381. var Buffer = moduleExports ? context.Buffer : undefined,
  10382. Symbol = context.Symbol,
  10383. Uint8Array = context.Uint8Array,
  10384. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  10385. getPrototype = overArg(Object.getPrototypeOf, Object),
  10386. objectCreate = Object.create,
  10387. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  10388. splice = arrayProto.splice,
  10389. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  10390. symIterator = Symbol ? Symbol.iterator : undefined,
  10391. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  10392. var defineProperty = (function() {
  10393. try {
  10394. var func = getNative(Object, 'defineProperty');
  10395. func({}, '', {});
  10396. return func;
  10397. } catch (e) {}
  10398. }());
  10399. /** Mocked built-ins. */
  10400. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  10401. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  10402. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  10403. /* Built-in method references for those with the same name as other `lodash` methods. */
  10404. var nativeCeil = Math.ceil,
  10405. nativeFloor = Math.floor,
  10406. nativeGetSymbols = Object.getOwnPropertySymbols,
  10407. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  10408. nativeIsFinite = context.isFinite,
  10409. nativeJoin = arrayProto.join,
  10410. nativeKeys = overArg(Object.keys, Object),
  10411. nativeMax = Math.max,
  10412. nativeMin = Math.min,
  10413. nativeNow = Date.now,
  10414. nativeParseInt = context.parseInt,
  10415. nativeRandom = Math.random,
  10416. nativeReverse = arrayProto.reverse;
  10417. /* Built-in method references that are verified to be native. */
  10418. var DataView = getNative(context, 'DataView'),
  10419. Map = getNative(context, 'Map'),
  10420. Promise = getNative(context, 'Promise'),
  10421. Set = getNative(context, 'Set'),
  10422. WeakMap = getNative(context, 'WeakMap'),
  10423. nativeCreate = getNative(Object, 'create');
  10424. /** Used to store function metadata. */
  10425. var metaMap = WeakMap && new WeakMap;
  10426. /** Used to lookup unminified function names. */
  10427. var realNames = {};
  10428. /** Used to detect maps, sets, and weakmaps. */
  10429. var dataViewCtorString = toSource(DataView),
  10430. mapCtorString = toSource(Map),
  10431. promiseCtorString = toSource(Promise),
  10432. setCtorString = toSource(Set),
  10433. weakMapCtorString = toSource(WeakMap);
  10434. /** Used to convert symbols to primitives and strings. */
  10435. var symbolProto = Symbol ? Symbol.prototype : undefined,
  10436. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  10437. symbolToString = symbolProto ? symbolProto.toString : undefined;
  10438. /*------------------------------------------------------------------------*/
  10439. /**
  10440. * Creates a `lodash` object which wraps `value` to enable implicit method
  10441. * chain sequences. Methods that operate on and return arrays, collections,
  10442. * and functions can be chained together. Methods that retrieve a single value
  10443. * or may return a primitive value will automatically end the chain sequence
  10444. * and return the unwrapped value. Otherwise, the value must be unwrapped
  10445. * with `_#value`.
  10446. *
  10447. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  10448. * enabled using `_.chain`.
  10449. *
  10450. * The execution of chained methods is lazy, that is, it's deferred until
  10451. * `_#value` is implicitly or explicitly called.
  10452. *
  10453. * Lazy evaluation allows several methods to support shortcut fusion.
  10454. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  10455. * the creation of intermediate arrays and can greatly reduce the number of
  10456. * iteratee executions. Sections of a chain sequence qualify for shortcut
  10457. * fusion if the section is applied to an array and iteratees accept only
  10458. * one argument. The heuristic for whether a section qualifies for shortcut
  10459. * fusion is subject to change.
  10460. *
  10461. * Chaining is supported in custom builds as long as the `_#value` method is
  10462. * directly or indirectly included in the build.
  10463. *
  10464. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  10465. *
  10466. * The wrapper `Array` methods are:
  10467. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  10468. *
  10469. * The wrapper `String` methods are:
  10470. * `replace` and `split`
  10471. *
  10472. * The wrapper methods that support shortcut fusion are:
  10473. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  10474. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  10475. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  10476. *
  10477. * The chainable wrapper methods are:
  10478. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  10479. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  10480. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  10481. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  10482. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  10483. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  10484. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  10485. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  10486. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  10487. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  10488. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  10489. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  10490. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  10491. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  10492. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  10493. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  10494. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  10495. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  10496. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  10497. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  10498. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  10499. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  10500. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  10501. * `zipObject`, `zipObjectDeep`, and `zipWith`
  10502. *
  10503. * The wrapper methods that are **not** chainable by default are:
  10504. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  10505. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  10506. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  10507. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  10508. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  10509. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  10510. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  10511. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  10512. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  10513. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  10514. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  10515. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  10516. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  10517. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  10518. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  10519. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  10520. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  10521. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  10522. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  10523. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  10524. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  10525. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  10526. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  10527. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  10528. * `upperFirst`, `value`, and `words`
  10529. *
  10530. * @name _
  10531. * @constructor
  10532. * @category Seq
  10533. * @param {*} value The value to wrap in a `lodash` instance.
  10534. * @returns {Object} Returns the new `lodash` wrapper instance.
  10535. * @example
  10536. *
  10537. * function square(n) {
  10538. * return n * n;
  10539. * }
  10540. *
  10541. * var wrapped = _([1, 2, 3]);
  10542. *
  10543. * // Returns an unwrapped value.
  10544. * wrapped.reduce(_.add);
  10545. * // => 6
  10546. *
  10547. * // Returns a wrapped value.
  10548. * var squares = wrapped.map(square);
  10549. *
  10550. * _.isArray(squares);
  10551. * // => false
  10552. *
  10553. * _.isArray(squares.value());
  10554. * // => true
  10555. */
  10556. function lodash(value) {
  10557. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  10558. if (value instanceof LodashWrapper) {
  10559. return value;
  10560. }
  10561. if (hasOwnProperty.call(value, '__wrapped__')) {
  10562. return wrapperClone(value);
  10563. }
  10564. }
  10565. return new LodashWrapper(value);
  10566. }
  10567. /**
  10568. * The base implementation of `_.create` without support for assigning
  10569. * properties to the created object.
  10570. *
  10571. * @private
  10572. * @param {Object} proto The object to inherit from.
  10573. * @returns {Object} Returns the new object.
  10574. */
  10575. var baseCreate = (function() {
  10576. function object() {}
  10577. return function(proto) {
  10578. if (!isObject(proto)) {
  10579. return {};
  10580. }
  10581. if (objectCreate) {
  10582. return objectCreate(proto);
  10583. }
  10584. object.prototype = proto;
  10585. var result = new object;
  10586. object.prototype = undefined;
  10587. return result;
  10588. };
  10589. }());
  10590. /**
  10591. * The function whose prototype chain sequence wrappers inherit from.
  10592. *
  10593. * @private
  10594. */
  10595. function baseLodash() {
  10596. // No operation performed.
  10597. }
  10598. /**
  10599. * The base constructor for creating `lodash` wrapper objects.
  10600. *
  10601. * @private
  10602. * @param {*} value The value to wrap.
  10603. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  10604. */
  10605. function LodashWrapper(value, chainAll) {
  10606. this.__wrapped__ = value;
  10607. this.__actions__ = [];
  10608. this.__chain__ = !!chainAll;
  10609. this.__index__ = 0;
  10610. this.__values__ = undefined;
  10611. }
  10612. /**
  10613. * By default, the template delimiters used by lodash are like those in
  10614. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  10615. * following template settings to use alternative delimiters.
  10616. *
  10617. * @static
  10618. * @memberOf _
  10619. * @type {Object}
  10620. */
  10621. lodash.templateSettings = {
  10622. /**
  10623. * Used to detect `data` property values to be HTML-escaped.
  10624. *
  10625. * @memberOf _.templateSettings
  10626. * @type {RegExp}
  10627. */
  10628. 'escape': reEscape,
  10629. /**
  10630. * Used to detect code to be evaluated.
  10631. *
  10632. * @memberOf _.templateSettings
  10633. * @type {RegExp}
  10634. */
  10635. 'evaluate': reEvaluate,
  10636. /**
  10637. * Used to detect `data` property values to inject.
  10638. *
  10639. * @memberOf _.templateSettings
  10640. * @type {RegExp}
  10641. */
  10642. 'interpolate': reInterpolate,
  10643. /**
  10644. * Used to reference the data object in the template text.
  10645. *
  10646. * @memberOf _.templateSettings
  10647. * @type {string}
  10648. */
  10649. 'variable': '',
  10650. /**
  10651. * Used to import variables into the compiled template.
  10652. *
  10653. * @memberOf _.templateSettings
  10654. * @type {Object}
  10655. */
  10656. 'imports': {
  10657. /**
  10658. * A reference to the `lodash` function.
  10659. *
  10660. * @memberOf _.templateSettings.imports
  10661. * @type {Function}
  10662. */
  10663. '_': lodash
  10664. }
  10665. };
  10666. // Ensure wrappers are instances of `baseLodash`.
  10667. lodash.prototype = baseLodash.prototype;
  10668. lodash.prototype.constructor = lodash;
  10669. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  10670. LodashWrapper.prototype.constructor = LodashWrapper;
  10671. /*------------------------------------------------------------------------*/
  10672. /**
  10673. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  10674. *
  10675. * @private
  10676. * @constructor
  10677. * @param {*} value The value to wrap.
  10678. */
  10679. function LazyWrapper(value) {
  10680. this.__wrapped__ = value;
  10681. this.__actions__ = [];
  10682. this.__dir__ = 1;
  10683. this.__filtered__ = false;
  10684. this.__iteratees__ = [];
  10685. this.__takeCount__ = MAX_ARRAY_LENGTH;
  10686. this.__views__ = [];
  10687. }
  10688. /**
  10689. * Creates a clone of the lazy wrapper object.
  10690. *
  10691. * @private
  10692. * @name clone
  10693. * @memberOf LazyWrapper
  10694. * @returns {Object} Returns the cloned `LazyWrapper` object.
  10695. */
  10696. function lazyClone() {
  10697. var result = new LazyWrapper(this.__wrapped__);
  10698. result.__actions__ = copyArray(this.__actions__);
  10699. result.__dir__ = this.__dir__;
  10700. result.__filtered__ = this.__filtered__;
  10701. result.__iteratees__ = copyArray(this.__iteratees__);
  10702. result.__takeCount__ = this.__takeCount__;
  10703. result.__views__ = copyArray(this.__views__);
  10704. return result;
  10705. }
  10706. /**
  10707. * Reverses the direction of lazy iteration.
  10708. *
  10709. * @private
  10710. * @name reverse
  10711. * @memberOf LazyWrapper
  10712. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  10713. */
  10714. function lazyReverse() {
  10715. if (this.__filtered__) {
  10716. var result = new LazyWrapper(this);
  10717. result.__dir__ = -1;
  10718. result.__filtered__ = true;
  10719. } else {
  10720. result = this.clone();
  10721. result.__dir__ *= -1;
  10722. }
  10723. return result;
  10724. }
  10725. /**
  10726. * Extracts the unwrapped value from its lazy wrapper.
  10727. *
  10728. * @private
  10729. * @name value
  10730. * @memberOf LazyWrapper
  10731. * @returns {*} Returns the unwrapped value.
  10732. */
  10733. function lazyValue() {
  10734. var array = this.__wrapped__.value(),
  10735. dir = this.__dir__,
  10736. isArr = isArray(array),
  10737. isRight = dir < 0,
  10738. arrLength = isArr ? array.length : 0,
  10739. view = getView(0, arrLength, this.__views__),
  10740. start = view.start,
  10741. end = view.end,
  10742. length = end - start,
  10743. index = isRight ? end : (start - 1),
  10744. iteratees = this.__iteratees__,
  10745. iterLength = iteratees.length,
  10746. resIndex = 0,
  10747. takeCount = nativeMin(length, this.__takeCount__);
  10748. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  10749. return baseWrapperValue(array, this.__actions__);
  10750. }
  10751. var result = [];
  10752. outer:
  10753. while (length-- && resIndex < takeCount) {
  10754. index += dir;
  10755. var iterIndex = -1,
  10756. value = array[index];
  10757. while (++iterIndex < iterLength) {
  10758. var data = iteratees[iterIndex],
  10759. iteratee = data.iteratee,
  10760. type = data.type,
  10761. computed = iteratee(value);
  10762. if (type == LAZY_MAP_FLAG) {
  10763. value = computed;
  10764. } else if (!computed) {
  10765. if (type == LAZY_FILTER_FLAG) {
  10766. continue outer;
  10767. } else {
  10768. break outer;
  10769. }
  10770. }
  10771. }
  10772. result[resIndex++] = value;
  10773. }
  10774. return result;
  10775. }
  10776. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  10777. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  10778. LazyWrapper.prototype.constructor = LazyWrapper;
  10779. /*------------------------------------------------------------------------*/
  10780. /**
  10781. * Creates a hash object.
  10782. *
  10783. * @private
  10784. * @constructor
  10785. * @param {Array} [entries] The key-value pairs to cache.
  10786. */
  10787. function Hash(entries) {
  10788. var index = -1,
  10789. length = entries == null ? 0 : entries.length;
  10790. this.clear();
  10791. while (++index < length) {
  10792. var entry = entries[index];
  10793. this.set(entry[0], entry[1]);
  10794. }
  10795. }
  10796. /**
  10797. * Removes all key-value entries from the hash.
  10798. *
  10799. * @private
  10800. * @name clear
  10801. * @memberOf Hash
  10802. */
  10803. function hashClear() {
  10804. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  10805. this.size = 0;
  10806. }
  10807. /**
  10808. * Removes `key` and its value from the hash.
  10809. *
  10810. * @private
  10811. * @name delete
  10812. * @memberOf Hash
  10813. * @param {Object} hash The hash to modify.
  10814. * @param {string} key The key of the value to remove.
  10815. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  10816. */
  10817. function hashDelete(key) {
  10818. var result = this.has(key) && delete this.__data__[key];
  10819. this.size -= result ? 1 : 0;
  10820. return result;
  10821. }
  10822. /**
  10823. * Gets the hash value for `key`.
  10824. *
  10825. * @private
  10826. * @name get
  10827. * @memberOf Hash
  10828. * @param {string} key The key of the value to get.
  10829. * @returns {*} Returns the entry value.
  10830. */
  10831. function hashGet(key) {
  10832. var data = this.__data__;
  10833. if (nativeCreate) {
  10834. var result = data[key];
  10835. return result === HASH_UNDEFINED ? undefined : result;
  10836. }
  10837. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  10838. }
  10839. /**
  10840. * Checks if a hash value for `key` exists.
  10841. *
  10842. * @private
  10843. * @name has
  10844. * @memberOf Hash
  10845. * @param {string} key The key of the entry to check.
  10846. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  10847. */
  10848. function hashHas(key) {
  10849. var data = this.__data__;
  10850. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  10851. }
  10852. /**
  10853. * Sets the hash `key` to `value`.
  10854. *
  10855. * @private
  10856. * @name set
  10857. * @memberOf Hash
  10858. * @param {string} key The key of the value to set.
  10859. * @param {*} value The value to set.
  10860. * @returns {Object} Returns the hash instance.
  10861. */
  10862. function hashSet(key, value) {
  10863. var data = this.__data__;
  10864. this.size += this.has(key) ? 0 : 1;
  10865. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  10866. return this;
  10867. }
  10868. // Add methods to `Hash`.
  10869. Hash.prototype.clear = hashClear;
  10870. Hash.prototype['delete'] = hashDelete;
  10871. Hash.prototype.get = hashGet;
  10872. Hash.prototype.has = hashHas;
  10873. Hash.prototype.set = hashSet;
  10874. /*------------------------------------------------------------------------*/
  10875. /**
  10876. * Creates an list cache object.
  10877. *
  10878. * @private
  10879. * @constructor
  10880. * @param {Array} [entries] The key-value pairs to cache.
  10881. */
  10882. function ListCache(entries) {
  10883. var index = -1,
  10884. length = entries == null ? 0 : entries.length;
  10885. this.clear();
  10886. while (++index < length) {
  10887. var entry = entries[index];
  10888. this.set(entry[0], entry[1]);
  10889. }
  10890. }
  10891. /**
  10892. * Removes all key-value entries from the list cache.
  10893. *
  10894. * @private
  10895. * @name clear
  10896. * @memberOf ListCache
  10897. */
  10898. function listCacheClear() {
  10899. this.__data__ = [];
  10900. this.size = 0;
  10901. }
  10902. /**
  10903. * Removes `key` and its value from the list cache.
  10904. *
  10905. * @private
  10906. * @name delete
  10907. * @memberOf ListCache
  10908. * @param {string} key The key of the value to remove.
  10909. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  10910. */
  10911. function listCacheDelete(key) {
  10912. var data = this.__data__,
  10913. index = assocIndexOf(data, key);
  10914. if (index < 0) {
  10915. return false;
  10916. }
  10917. var lastIndex = data.length - 1;
  10918. if (index == lastIndex) {
  10919. data.pop();
  10920. } else {
  10921. splice.call(data, index, 1);
  10922. }
  10923. --this.size;
  10924. return true;
  10925. }
  10926. /**
  10927. * Gets the list cache value for `key`.
  10928. *
  10929. * @private
  10930. * @name get
  10931. * @memberOf ListCache
  10932. * @param {string} key The key of the value to get.
  10933. * @returns {*} Returns the entry value.
  10934. */
  10935. function listCacheGet(key) {
  10936. var data = this.__data__,
  10937. index = assocIndexOf(data, key);
  10938. return index < 0 ? undefined : data[index][1];
  10939. }
  10940. /**
  10941. * Checks if a list cache value for `key` exists.
  10942. *
  10943. * @private
  10944. * @name has
  10945. * @memberOf ListCache
  10946. * @param {string} key The key of the entry to check.
  10947. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  10948. */
  10949. function listCacheHas(key) {
  10950. return assocIndexOf(this.__data__, key) > -1;
  10951. }
  10952. /**
  10953. * Sets the list cache `key` to `value`.
  10954. *
  10955. * @private
  10956. * @name set
  10957. * @memberOf ListCache
  10958. * @param {string} key The key of the value to set.
  10959. * @param {*} value The value to set.
  10960. * @returns {Object} Returns the list cache instance.
  10961. */
  10962. function listCacheSet(key, value) {
  10963. var data = this.__data__,
  10964. index = assocIndexOf(data, key);
  10965. if (index < 0) {
  10966. ++this.size;
  10967. data.push([key, value]);
  10968. } else {
  10969. data[index][1] = value;
  10970. }
  10971. return this;
  10972. }
  10973. // Add methods to `ListCache`.
  10974. ListCache.prototype.clear = listCacheClear;
  10975. ListCache.prototype['delete'] = listCacheDelete;
  10976. ListCache.prototype.get = listCacheGet;
  10977. ListCache.prototype.has = listCacheHas;
  10978. ListCache.prototype.set = listCacheSet;
  10979. /*------------------------------------------------------------------------*/
  10980. /**
  10981. * Creates a map cache object to store key-value pairs.
  10982. *
  10983. * @private
  10984. * @constructor
  10985. * @param {Array} [entries] The key-value pairs to cache.
  10986. */
  10987. function MapCache(entries) {
  10988. var index = -1,
  10989. length = entries == null ? 0 : entries.length;
  10990. this.clear();
  10991. while (++index < length) {
  10992. var entry = entries[index];
  10993. this.set(entry[0], entry[1]);
  10994. }
  10995. }
  10996. /**
  10997. * Removes all key-value entries from the map.
  10998. *
  10999. * @private
  11000. * @name clear
  11001. * @memberOf MapCache
  11002. */
  11003. function mapCacheClear() {
  11004. this.size = 0;
  11005. this.__data__ = {
  11006. 'hash': new Hash,
  11007. 'map': new (Map || ListCache),
  11008. 'string': new Hash
  11009. };
  11010. }
  11011. /**
  11012. * Removes `key` and its value from the map.
  11013. *
  11014. * @private
  11015. * @name delete
  11016. * @memberOf MapCache
  11017. * @param {string} key The key of the value to remove.
  11018. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  11019. */
  11020. function mapCacheDelete(key) {
  11021. var result = getMapData(this, key)['delete'](key);
  11022. this.size -= result ? 1 : 0;
  11023. return result;
  11024. }
  11025. /**
  11026. * Gets the map value for `key`.
  11027. *
  11028. * @private
  11029. * @name get
  11030. * @memberOf MapCache
  11031. * @param {string} key The key of the value to get.
  11032. * @returns {*} Returns the entry value.
  11033. */
  11034. function mapCacheGet(key) {
  11035. return getMapData(this, key).get(key);
  11036. }
  11037. /**
  11038. * Checks if a map value for `key` exists.
  11039. *
  11040. * @private
  11041. * @name has
  11042. * @memberOf MapCache
  11043. * @param {string} key The key of the entry to check.
  11044. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  11045. */
  11046. function mapCacheHas(key) {
  11047. return getMapData(this, key).has(key);
  11048. }
  11049. /**
  11050. * Sets the map `key` to `value`.
  11051. *
  11052. * @private
  11053. * @name set
  11054. * @memberOf MapCache
  11055. * @param {string} key The key of the value to set.
  11056. * @param {*} value The value to set.
  11057. * @returns {Object} Returns the map cache instance.
  11058. */
  11059. function mapCacheSet(key, value) {
  11060. var data = getMapData(this, key),
  11061. size = data.size;
  11062. data.set(key, value);
  11063. this.size += data.size == size ? 0 : 1;
  11064. return this;
  11065. }
  11066. // Add methods to `MapCache`.
  11067. MapCache.prototype.clear = mapCacheClear;
  11068. MapCache.prototype['delete'] = mapCacheDelete;
  11069. MapCache.prototype.get = mapCacheGet;
  11070. MapCache.prototype.has = mapCacheHas;
  11071. MapCache.prototype.set = mapCacheSet;
  11072. /*------------------------------------------------------------------------*/
  11073. /**
  11074. *
  11075. * Creates an array cache object to store unique values.
  11076. *
  11077. * @private
  11078. * @constructor
  11079. * @param {Array} [values] The values to cache.
  11080. */
  11081. function SetCache(values) {
  11082. var index = -1,
  11083. length = values == null ? 0 : values.length;
  11084. this.__data__ = new MapCache;
  11085. while (++index < length) {
  11086. this.add(values[index]);
  11087. }
  11088. }
  11089. /**
  11090. * Adds `value` to the array cache.
  11091. *
  11092. * @private
  11093. * @name add
  11094. * @memberOf SetCache
  11095. * @alias push
  11096. * @param {*} value The value to cache.
  11097. * @returns {Object} Returns the cache instance.
  11098. */
  11099. function setCacheAdd(value) {
  11100. this.__data__.set(value, HASH_UNDEFINED);
  11101. return this;
  11102. }
  11103. /**
  11104. * Checks if `value` is in the array cache.
  11105. *
  11106. * @private
  11107. * @name has
  11108. * @memberOf SetCache
  11109. * @param {*} value The value to search for.
  11110. * @returns {number} Returns `true` if `value` is found, else `false`.
  11111. */
  11112. function setCacheHas(value) {
  11113. return this.__data__.has(value);
  11114. }
  11115. // Add methods to `SetCache`.
  11116. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  11117. SetCache.prototype.has = setCacheHas;
  11118. /*------------------------------------------------------------------------*/
  11119. /**
  11120. * Creates a stack cache object to store key-value pairs.
  11121. *
  11122. * @private
  11123. * @constructor
  11124. * @param {Array} [entries] The key-value pairs to cache.
  11125. */
  11126. function Stack(entries) {
  11127. var data = this.__data__ = new ListCache(entries);
  11128. this.size = data.size;
  11129. }
  11130. /**
  11131. * Removes all key-value entries from the stack.
  11132. *
  11133. * @private
  11134. * @name clear
  11135. * @memberOf Stack
  11136. */
  11137. function stackClear() {
  11138. this.__data__ = new ListCache;
  11139. this.size = 0;
  11140. }
  11141. /**
  11142. * Removes `key` and its value from the stack.
  11143. *
  11144. * @private
  11145. * @name delete
  11146. * @memberOf Stack
  11147. * @param {string} key The key of the value to remove.
  11148. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  11149. */
  11150. function stackDelete(key) {
  11151. var data = this.__data__,
  11152. result = data['delete'](key);
  11153. this.size = data.size;
  11154. return result;
  11155. }
  11156. /**
  11157. * Gets the stack value for `key`.
  11158. *
  11159. * @private
  11160. * @name get
  11161. * @memberOf Stack
  11162. * @param {string} key The key of the value to get.
  11163. * @returns {*} Returns the entry value.
  11164. */
  11165. function stackGet(key) {
  11166. return this.__data__.get(key);
  11167. }
  11168. /**
  11169. * Checks if a stack value for `key` exists.
  11170. *
  11171. * @private
  11172. * @name has
  11173. * @memberOf Stack
  11174. * @param {string} key The key of the entry to check.
  11175. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  11176. */
  11177. function stackHas(key) {
  11178. return this.__data__.has(key);
  11179. }
  11180. /**
  11181. * Sets the stack `key` to `value`.
  11182. *
  11183. * @private
  11184. * @name set
  11185. * @memberOf Stack
  11186. * @param {string} key The key of the value to set.
  11187. * @param {*} value The value to set.
  11188. * @returns {Object} Returns the stack cache instance.
  11189. */
  11190. function stackSet(key, value) {
  11191. var data = this.__data__;
  11192. if (data instanceof ListCache) {
  11193. var pairs = data.__data__;
  11194. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  11195. pairs.push([key, value]);
  11196. this.size = ++data.size;
  11197. return this;
  11198. }
  11199. data = this.__data__ = new MapCache(pairs);
  11200. }
  11201. data.set(key, value);
  11202. this.size = data.size;
  11203. return this;
  11204. }
  11205. // Add methods to `Stack`.
  11206. Stack.prototype.clear = stackClear;
  11207. Stack.prototype['delete'] = stackDelete;
  11208. Stack.prototype.get = stackGet;
  11209. Stack.prototype.has = stackHas;
  11210. Stack.prototype.set = stackSet;
  11211. /*------------------------------------------------------------------------*/
  11212. /**
  11213. * Creates an array of the enumerable property names of the array-like `value`.
  11214. *
  11215. * @private
  11216. * @param {*} value The value to query.
  11217. * @param {boolean} inherited Specify returning inherited property names.
  11218. * @returns {Array} Returns the array of property names.
  11219. */
  11220. function arrayLikeKeys(value, inherited) {
  11221. var isArr = isArray(value),
  11222. isArg = !isArr && isArguments(value),
  11223. isBuff = !isArr && !isArg && isBuffer(value),
  11224. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  11225. skipIndexes = isArr || isArg || isBuff || isType,
  11226. result = skipIndexes ? baseTimes(value.length, String) : [],
  11227. length = result.length;
  11228. for (var key in value) {
  11229. if ((inherited || hasOwnProperty.call(value, key)) &&
  11230. !(skipIndexes && (
  11231. // Safari 9 has enumerable `arguments.length` in strict mode.
  11232. key == 'length' ||
  11233. // Node.js 0.10 has enumerable non-index properties on buffers.
  11234. (isBuff && (key == 'offset' || key == 'parent')) ||
  11235. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  11236. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  11237. // Skip index properties.
  11238. isIndex(key, length)
  11239. ))) {
  11240. result.push(key);
  11241. }
  11242. }
  11243. return result;
  11244. }
  11245. /**
  11246. * A specialized version of `_.sample` for arrays.
  11247. *
  11248. * @private
  11249. * @param {Array} array The array to sample.
  11250. * @returns {*} Returns the random element.
  11251. */
  11252. function arraySample(array) {
  11253. var length = array.length;
  11254. return length ? array[baseRandom(0, length - 1)] : undefined;
  11255. }
  11256. /**
  11257. * A specialized version of `_.sampleSize` for arrays.
  11258. *
  11259. * @private
  11260. * @param {Array} array The array to sample.
  11261. * @param {number} n The number of elements to sample.
  11262. * @returns {Array} Returns the random elements.
  11263. */
  11264. function arraySampleSize(array, n) {
  11265. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  11266. }
  11267. /**
  11268. * A specialized version of `_.shuffle` for arrays.
  11269. *
  11270. * @private
  11271. * @param {Array} array The array to shuffle.
  11272. * @returns {Array} Returns the new shuffled array.
  11273. */
  11274. function arrayShuffle(array) {
  11275. return shuffleSelf(copyArray(array));
  11276. }
  11277. /**
  11278. * This function is like `assignValue` except that it doesn't assign
  11279. * `undefined` values.
  11280. *
  11281. * @private
  11282. * @param {Object} object The object to modify.
  11283. * @param {string} key The key of the property to assign.
  11284. * @param {*} value The value to assign.
  11285. */
  11286. function assignMergeValue(object, key, value) {
  11287. if ((value !== undefined && !eq(object[key], value)) ||
  11288. (value === undefined && !(key in object))) {
  11289. baseAssignValue(object, key, value);
  11290. }
  11291. }
  11292. /**
  11293. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  11294. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11295. * for equality comparisons.
  11296. *
  11297. * @private
  11298. * @param {Object} object The object to modify.
  11299. * @param {string} key The key of the property to assign.
  11300. * @param {*} value The value to assign.
  11301. */
  11302. function assignValue(object, key, value) {
  11303. var objValue = object[key];
  11304. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  11305. (value === undefined && !(key in object))) {
  11306. baseAssignValue(object, key, value);
  11307. }
  11308. }
  11309. /**
  11310. * Gets the index at which the `key` is found in `array` of key-value pairs.
  11311. *
  11312. * @private
  11313. * @param {Array} array The array to inspect.
  11314. * @param {*} key The key to search for.
  11315. * @returns {number} Returns the index of the matched value, else `-1`.
  11316. */
  11317. function assocIndexOf(array, key) {
  11318. var length = array.length;
  11319. while (length--) {
  11320. if (eq(array[length][0], key)) {
  11321. return length;
  11322. }
  11323. }
  11324. return -1;
  11325. }
  11326. /**
  11327. * Aggregates elements of `collection` on `accumulator` with keys transformed
  11328. * by `iteratee` and values set by `setter`.
  11329. *
  11330. * @private
  11331. * @param {Array|Object} collection The collection to iterate over.
  11332. * @param {Function} setter The function to set `accumulator` values.
  11333. * @param {Function} iteratee The iteratee to transform keys.
  11334. * @param {Object} accumulator The initial aggregated object.
  11335. * @returns {Function} Returns `accumulator`.
  11336. */
  11337. function baseAggregator(collection, setter, iteratee, accumulator) {
  11338. baseEach(collection, function(value, key, collection) {
  11339. setter(accumulator, value, iteratee(value), collection);
  11340. });
  11341. return accumulator;
  11342. }
  11343. /**
  11344. * The base implementation of `_.assign` without support for multiple sources
  11345. * or `customizer` functions.
  11346. *
  11347. * @private
  11348. * @param {Object} object The destination object.
  11349. * @param {Object} source The source object.
  11350. * @returns {Object} Returns `object`.
  11351. */
  11352. function baseAssign(object, source) {
  11353. return object && copyObject(source, keys(source), object);
  11354. }
  11355. /**
  11356. * The base implementation of `_.assignIn` without support for multiple sources
  11357. * or `customizer` functions.
  11358. *
  11359. * @private
  11360. * @param {Object} object The destination object.
  11361. * @param {Object} source The source object.
  11362. * @returns {Object} Returns `object`.
  11363. */
  11364. function baseAssignIn(object, source) {
  11365. return object && copyObject(source, keysIn(source), object);
  11366. }
  11367. /**
  11368. * The base implementation of `assignValue` and `assignMergeValue` without
  11369. * value checks.
  11370. *
  11371. * @private
  11372. * @param {Object} object The object to modify.
  11373. * @param {string} key The key of the property to assign.
  11374. * @param {*} value The value to assign.
  11375. */
  11376. function baseAssignValue(object, key, value) {
  11377. if (key == '__proto__' && defineProperty) {
  11378. defineProperty(object, key, {
  11379. 'configurable': true,
  11380. 'enumerable': true,
  11381. 'value': value,
  11382. 'writable': true
  11383. });
  11384. } else {
  11385. object[key] = value;
  11386. }
  11387. }
  11388. /**
  11389. * The base implementation of `_.at` without support for individual paths.
  11390. *
  11391. * @private
  11392. * @param {Object} object The object to iterate over.
  11393. * @param {string[]} paths The property paths to pick.
  11394. * @returns {Array} Returns the picked elements.
  11395. */
  11396. function baseAt(object, paths) {
  11397. var index = -1,
  11398. length = paths.length,
  11399. result = Array(length),
  11400. skip = object == null;
  11401. while (++index < length) {
  11402. result[index] = skip ? undefined : get(object, paths[index]);
  11403. }
  11404. return result;
  11405. }
  11406. /**
  11407. * The base implementation of `_.clamp` which doesn't coerce arguments.
  11408. *
  11409. * @private
  11410. * @param {number} number The number to clamp.
  11411. * @param {number} [lower] The lower bound.
  11412. * @param {number} upper The upper bound.
  11413. * @returns {number} Returns the clamped number.
  11414. */
  11415. function baseClamp(number, lower, upper) {
  11416. if (number === number) {
  11417. if (upper !== undefined) {
  11418. number = number <= upper ? number : upper;
  11419. }
  11420. if (lower !== undefined) {
  11421. number = number >= lower ? number : lower;
  11422. }
  11423. }
  11424. return number;
  11425. }
  11426. /**
  11427. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  11428. * traversed objects.
  11429. *
  11430. * @private
  11431. * @param {*} value The value to clone.
  11432. * @param {boolean} bitmask The bitmask flags.
  11433. * 1 - Deep clone
  11434. * 2 - Flatten inherited properties
  11435. * 4 - Clone symbols
  11436. * @param {Function} [customizer] The function to customize cloning.
  11437. * @param {string} [key] The key of `value`.
  11438. * @param {Object} [object] The parent object of `value`.
  11439. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  11440. * @returns {*} Returns the cloned value.
  11441. */
  11442. function baseClone(value, bitmask, customizer, key, object, stack) {
  11443. var result,
  11444. isDeep = bitmask & CLONE_DEEP_FLAG,
  11445. isFlat = bitmask & CLONE_FLAT_FLAG,
  11446. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  11447. if (customizer) {
  11448. result = object ? customizer(value, key, object, stack) : customizer(value);
  11449. }
  11450. if (result !== undefined) {
  11451. return result;
  11452. }
  11453. if (!isObject(value)) {
  11454. return value;
  11455. }
  11456. var isArr = isArray(value);
  11457. if (isArr) {
  11458. result = initCloneArray(value);
  11459. if (!isDeep) {
  11460. return copyArray(value, result);
  11461. }
  11462. } else {
  11463. var tag = getTag(value),
  11464. isFunc = tag == funcTag || tag == genTag;
  11465. if (isBuffer(value)) {
  11466. return cloneBuffer(value, isDeep);
  11467. }
  11468. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  11469. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  11470. if (!isDeep) {
  11471. return isFlat
  11472. ? copySymbolsIn(value, baseAssignIn(result, value))
  11473. : copySymbols(value, baseAssign(result, value));
  11474. }
  11475. } else {
  11476. if (!cloneableTags[tag]) {
  11477. return object ? value : {};
  11478. }
  11479. result = initCloneByTag(value, tag, baseClone, isDeep);
  11480. }
  11481. }
  11482. // Check for circular references and return its corresponding clone.
  11483. stack || (stack = new Stack);
  11484. var stacked = stack.get(value);
  11485. if (stacked) {
  11486. return stacked;
  11487. }
  11488. stack.set(value, result);
  11489. var keysFunc = isFull
  11490. ? (isFlat ? getAllKeysIn : getAllKeys)
  11491. : (isFlat ? keysIn : keys);
  11492. var props = isArr ? undefined : keysFunc(value);
  11493. arrayEach(props || value, function(subValue, key) {
  11494. if (props) {
  11495. key = subValue;
  11496. subValue = value[key];
  11497. }
  11498. // Recursively populate clone (susceptible to call stack limits).
  11499. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  11500. });
  11501. return result;
  11502. }
  11503. /**
  11504. * The base implementation of `_.conforms` which doesn't clone `source`.
  11505. *
  11506. * @private
  11507. * @param {Object} source The object of property predicates to conform to.
  11508. * @returns {Function} Returns the new spec function.
  11509. */
  11510. function baseConforms(source) {
  11511. var props = keys(source);
  11512. return function(object) {
  11513. return baseConformsTo(object, source, props);
  11514. };
  11515. }
  11516. /**
  11517. * The base implementation of `_.conformsTo` which accepts `props` to check.
  11518. *
  11519. * @private
  11520. * @param {Object} object The object to inspect.
  11521. * @param {Object} source The object of property predicates to conform to.
  11522. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11523. */
  11524. function baseConformsTo(object, source, props) {
  11525. var length = props.length;
  11526. if (object == null) {
  11527. return !length;
  11528. }
  11529. object = Object(object);
  11530. while (length--) {
  11531. var key = props[length],
  11532. predicate = source[key],
  11533. value = object[key];
  11534. if ((value === undefined && !(key in object)) || !predicate(value)) {
  11535. return false;
  11536. }
  11537. }
  11538. return true;
  11539. }
  11540. /**
  11541. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  11542. * to provide to `func`.
  11543. *
  11544. * @private
  11545. * @param {Function} func The function to delay.
  11546. * @param {number} wait The number of milliseconds to delay invocation.
  11547. * @param {Array} args The arguments to provide to `func`.
  11548. * @returns {number|Object} Returns the timer id or timeout object.
  11549. */
  11550. function baseDelay(func, wait, args) {
  11551. if (typeof func != 'function') {
  11552. throw new TypeError(FUNC_ERROR_TEXT);
  11553. }
  11554. return setTimeout(function() { func.apply(undefined, args); }, wait);
  11555. }
  11556. /**
  11557. * The base implementation of methods like `_.difference` without support
  11558. * for excluding multiple arrays or iteratee shorthands.
  11559. *
  11560. * @private
  11561. * @param {Array} array The array to inspect.
  11562. * @param {Array} values The values to exclude.
  11563. * @param {Function} [iteratee] The iteratee invoked per element.
  11564. * @param {Function} [comparator] The comparator invoked per element.
  11565. * @returns {Array} Returns the new array of filtered values.
  11566. */
  11567. function baseDifference(array, values, iteratee, comparator) {
  11568. var index = -1,
  11569. includes = arrayIncludes,
  11570. isCommon = true,
  11571. length = array.length,
  11572. result = [],
  11573. valuesLength = values.length;
  11574. if (!length) {
  11575. return result;
  11576. }
  11577. if (iteratee) {
  11578. values = arrayMap(values, baseUnary(iteratee));
  11579. }
  11580. if (comparator) {
  11581. includes = arrayIncludesWith;
  11582. isCommon = false;
  11583. }
  11584. else if (values.length >= LARGE_ARRAY_SIZE) {
  11585. includes = cacheHas;
  11586. isCommon = false;
  11587. values = new SetCache(values);
  11588. }
  11589. outer:
  11590. while (++index < length) {
  11591. var value = array[index],
  11592. computed = iteratee == null ? value : iteratee(value);
  11593. value = (comparator || value !== 0) ? value : 0;
  11594. if (isCommon && computed === computed) {
  11595. var valuesIndex = valuesLength;
  11596. while (valuesIndex--) {
  11597. if (values[valuesIndex] === computed) {
  11598. continue outer;
  11599. }
  11600. }
  11601. result.push(value);
  11602. }
  11603. else if (!includes(values, computed, comparator)) {
  11604. result.push(value);
  11605. }
  11606. }
  11607. return result;
  11608. }
  11609. /**
  11610. * The base implementation of `_.forEach` without support for iteratee shorthands.
  11611. *
  11612. * @private
  11613. * @param {Array|Object} collection The collection to iterate over.
  11614. * @param {Function} iteratee The function invoked per iteration.
  11615. * @returns {Array|Object} Returns `collection`.
  11616. */
  11617. var baseEach = createBaseEach(baseForOwn);
  11618. /**
  11619. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  11620. *
  11621. * @private
  11622. * @param {Array|Object} collection The collection to iterate over.
  11623. * @param {Function} iteratee The function invoked per iteration.
  11624. * @returns {Array|Object} Returns `collection`.
  11625. */
  11626. var baseEachRight = createBaseEach(baseForOwnRight, true);
  11627. /**
  11628. * The base implementation of `_.every` without support for iteratee shorthands.
  11629. *
  11630. * @private
  11631. * @param {Array|Object} collection The collection to iterate over.
  11632. * @param {Function} predicate The function invoked per iteration.
  11633. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  11634. * else `false`
  11635. */
  11636. function baseEvery(collection, predicate) {
  11637. var result = true;
  11638. baseEach(collection, function(value, index, collection) {
  11639. result = !!predicate(value, index, collection);
  11640. return result;
  11641. });
  11642. return result;
  11643. }
  11644. /**
  11645. * The base implementation of methods like `_.max` and `_.min` which accepts a
  11646. * `comparator` to determine the extremum value.
  11647. *
  11648. * @private
  11649. * @param {Array} array The array to iterate over.
  11650. * @param {Function} iteratee The iteratee invoked per iteration.
  11651. * @param {Function} comparator The comparator used to compare values.
  11652. * @returns {*} Returns the extremum value.
  11653. */
  11654. function baseExtremum(array, iteratee, comparator) {
  11655. var index = -1,
  11656. length = array.length;
  11657. while (++index < length) {
  11658. var value = array[index],
  11659. current = iteratee(value);
  11660. if (current != null && (computed === undefined
  11661. ? (current === current && !isSymbol(current))
  11662. : comparator(current, computed)
  11663. )) {
  11664. var computed = current,
  11665. result = value;
  11666. }
  11667. }
  11668. return result;
  11669. }
  11670. /**
  11671. * The base implementation of `_.fill` without an iteratee call guard.
  11672. *
  11673. * @private
  11674. * @param {Array} array The array to fill.
  11675. * @param {*} value The value to fill `array` with.
  11676. * @param {number} [start=0] The start position.
  11677. * @param {number} [end=array.length] The end position.
  11678. * @returns {Array} Returns `array`.
  11679. */
  11680. function baseFill(array, value, start, end) {
  11681. var length = array.length;
  11682. start = toInteger(start);
  11683. if (start < 0) {
  11684. start = -start > length ? 0 : (length + start);
  11685. }
  11686. end = (end === undefined || end > length) ? length : toInteger(end);
  11687. if (end < 0) {
  11688. end += length;
  11689. }
  11690. end = start > end ? 0 : toLength(end);
  11691. while (start < end) {
  11692. array[start++] = value;
  11693. }
  11694. return array;
  11695. }
  11696. /**
  11697. * The base implementation of `_.filter` without support for iteratee shorthands.
  11698. *
  11699. * @private
  11700. * @param {Array|Object} collection The collection to iterate over.
  11701. * @param {Function} predicate The function invoked per iteration.
  11702. * @returns {Array} Returns the new filtered array.
  11703. */
  11704. function baseFilter(collection, predicate) {
  11705. var result = [];
  11706. baseEach(collection, function(value, index, collection) {
  11707. if (predicate(value, index, collection)) {
  11708. result.push(value);
  11709. }
  11710. });
  11711. return result;
  11712. }
  11713. /**
  11714. * The base implementation of `_.flatten` with support for restricting flattening.
  11715. *
  11716. * @private
  11717. * @param {Array} array The array to flatten.
  11718. * @param {number} depth The maximum recursion depth.
  11719. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  11720. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  11721. * @param {Array} [result=[]] The initial result value.
  11722. * @returns {Array} Returns the new flattened array.
  11723. */
  11724. function baseFlatten(array, depth, predicate, isStrict, result) {
  11725. var index = -1,
  11726. length = array.length;
  11727. predicate || (predicate = isFlattenable);
  11728. result || (result = []);
  11729. while (++index < length) {
  11730. var value = array[index];
  11731. if (depth > 0 && predicate(value)) {
  11732. if (depth > 1) {
  11733. // Recursively flatten arrays (susceptible to call stack limits).
  11734. baseFlatten(value, depth - 1, predicate, isStrict, result);
  11735. } else {
  11736. arrayPush(result, value);
  11737. }
  11738. } else if (!isStrict) {
  11739. result[result.length] = value;
  11740. }
  11741. }
  11742. return result;
  11743. }
  11744. /**
  11745. * The base implementation of `baseForOwn` which iterates over `object`
  11746. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  11747. * Iteratee functions may exit iteration early by explicitly returning `false`.
  11748. *
  11749. * @private
  11750. * @param {Object} object The object to iterate over.
  11751. * @param {Function} iteratee The function invoked per iteration.
  11752. * @param {Function} keysFunc The function to get the keys of `object`.
  11753. * @returns {Object} Returns `object`.
  11754. */
  11755. var baseFor = createBaseFor();
  11756. /**
  11757. * This function is like `baseFor` except that it iterates over properties
  11758. * in the opposite order.
  11759. *
  11760. * @private
  11761. * @param {Object} object The object to iterate over.
  11762. * @param {Function} iteratee The function invoked per iteration.
  11763. * @param {Function} keysFunc The function to get the keys of `object`.
  11764. * @returns {Object} Returns `object`.
  11765. */
  11766. var baseForRight = createBaseFor(true);
  11767. /**
  11768. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  11769. *
  11770. * @private
  11771. * @param {Object} object The object to iterate over.
  11772. * @param {Function} iteratee The function invoked per iteration.
  11773. * @returns {Object} Returns `object`.
  11774. */
  11775. function baseForOwn(object, iteratee) {
  11776. return object && baseFor(object, iteratee, keys);
  11777. }
  11778. /**
  11779. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  11780. *
  11781. * @private
  11782. * @param {Object} object The object to iterate over.
  11783. * @param {Function} iteratee The function invoked per iteration.
  11784. * @returns {Object} Returns `object`.
  11785. */
  11786. function baseForOwnRight(object, iteratee) {
  11787. return object && baseForRight(object, iteratee, keys);
  11788. }
  11789. /**
  11790. * The base implementation of `_.functions` which creates an array of
  11791. * `object` function property names filtered from `props`.
  11792. *
  11793. * @private
  11794. * @param {Object} object The object to inspect.
  11795. * @param {Array} props The property names to filter.
  11796. * @returns {Array} Returns the function names.
  11797. */
  11798. function baseFunctions(object, props) {
  11799. return arrayFilter(props, function(key) {
  11800. return isFunction(object[key]);
  11801. });
  11802. }
  11803. /**
  11804. * The base implementation of `_.get` without support for default values.
  11805. *
  11806. * @private
  11807. * @param {Object} object The object to query.
  11808. * @param {Array|string} path The path of the property to get.
  11809. * @returns {*} Returns the resolved value.
  11810. */
  11811. function baseGet(object, path) {
  11812. path = castPath(path, object);
  11813. var index = 0,
  11814. length = path.length;
  11815. while (object != null && index < length) {
  11816. object = object[toKey(path[index++])];
  11817. }
  11818. return (index && index == length) ? object : undefined;
  11819. }
  11820. /**
  11821. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  11822. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  11823. * symbols of `object`.
  11824. *
  11825. * @private
  11826. * @param {Object} object The object to query.
  11827. * @param {Function} keysFunc The function to get the keys of `object`.
  11828. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  11829. * @returns {Array} Returns the array of property names and symbols.
  11830. */
  11831. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  11832. var result = keysFunc(object);
  11833. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  11834. }
  11835. /**
  11836. * The base implementation of `getTag` without fallbacks for buggy environments.
  11837. *
  11838. * @private
  11839. * @param {*} value The value to query.
  11840. * @returns {string} Returns the `toStringTag`.
  11841. */
  11842. function baseGetTag(value) {
  11843. if (value == null) {
  11844. return value === undefined ? undefinedTag : nullTag;
  11845. }
  11846. return (symToStringTag && symToStringTag in Object(value))
  11847. ? getRawTag(value)
  11848. : objectToString(value);
  11849. }
  11850. /**
  11851. * The base implementation of `_.gt` which doesn't coerce arguments.
  11852. *
  11853. * @private
  11854. * @param {*} value The value to compare.
  11855. * @param {*} other The other value to compare.
  11856. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11857. * else `false`.
  11858. */
  11859. function baseGt(value, other) {
  11860. return value > other;
  11861. }
  11862. /**
  11863. * The base implementation of `_.has` without support for deep paths.
  11864. *
  11865. * @private
  11866. * @param {Object} [object] The object to query.
  11867. * @param {Array|string} key The key to check.
  11868. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  11869. */
  11870. function baseHas(object, key) {
  11871. return object != null && hasOwnProperty.call(object, key);
  11872. }
  11873. /**
  11874. * The base implementation of `_.hasIn` without support for deep paths.
  11875. *
  11876. * @private
  11877. * @param {Object} [object] The object to query.
  11878. * @param {Array|string} key The key to check.
  11879. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  11880. */
  11881. function baseHasIn(object, key) {
  11882. return object != null && key in Object(object);
  11883. }
  11884. /**
  11885. * The base implementation of `_.inRange` which doesn't coerce arguments.
  11886. *
  11887. * @private
  11888. * @param {number} number The number to check.
  11889. * @param {number} start The start of the range.
  11890. * @param {number} end The end of the range.
  11891. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  11892. */
  11893. function baseInRange(number, start, end) {
  11894. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  11895. }
  11896. /**
  11897. * The base implementation of methods like `_.intersection`, without support
  11898. * for iteratee shorthands, that accepts an array of arrays to inspect.
  11899. *
  11900. * @private
  11901. * @param {Array} arrays The arrays to inspect.
  11902. * @param {Function} [iteratee] The iteratee invoked per element.
  11903. * @param {Function} [comparator] The comparator invoked per element.
  11904. * @returns {Array} Returns the new array of shared values.
  11905. */
  11906. function baseIntersection(arrays, iteratee, comparator) {
  11907. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  11908. length = arrays[0].length,
  11909. othLength = arrays.length,
  11910. othIndex = othLength,
  11911. caches = Array(othLength),
  11912. maxLength = Infinity,
  11913. result = [];
  11914. while (othIndex--) {
  11915. var array = arrays[othIndex];
  11916. if (othIndex && iteratee) {
  11917. array = arrayMap(array, baseUnary(iteratee));
  11918. }
  11919. maxLength = nativeMin(array.length, maxLength);
  11920. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  11921. ? new SetCache(othIndex && array)
  11922. : undefined;
  11923. }
  11924. array = arrays[0];
  11925. var index = -1,
  11926. seen = caches[0];
  11927. outer:
  11928. while (++index < length && result.length < maxLength) {
  11929. var value = array[index],
  11930. computed = iteratee ? iteratee(value) : value;
  11931. value = (comparator || value !== 0) ? value : 0;
  11932. if (!(seen
  11933. ? cacheHas(seen, computed)
  11934. : includes(result, computed, comparator)
  11935. )) {
  11936. othIndex = othLength;
  11937. while (--othIndex) {
  11938. var cache = caches[othIndex];
  11939. if (!(cache
  11940. ? cacheHas(cache, computed)
  11941. : includes(arrays[othIndex], computed, comparator))
  11942. ) {
  11943. continue outer;
  11944. }
  11945. }
  11946. if (seen) {
  11947. seen.push(computed);
  11948. }
  11949. result.push(value);
  11950. }
  11951. }
  11952. return result;
  11953. }
  11954. /**
  11955. * The base implementation of `_.invert` and `_.invertBy` which inverts
  11956. * `object` with values transformed by `iteratee` and set by `setter`.
  11957. *
  11958. * @private
  11959. * @param {Object} object The object to iterate over.
  11960. * @param {Function} setter The function to set `accumulator` values.
  11961. * @param {Function} iteratee The iteratee to transform values.
  11962. * @param {Object} accumulator The initial inverted object.
  11963. * @returns {Function} Returns `accumulator`.
  11964. */
  11965. function baseInverter(object, setter, iteratee, accumulator) {
  11966. baseForOwn(object, function(value, key, object) {
  11967. setter(accumulator, iteratee(value), key, object);
  11968. });
  11969. return accumulator;
  11970. }
  11971. /**
  11972. * The base implementation of `_.invoke` without support for individual
  11973. * method arguments.
  11974. *
  11975. * @private
  11976. * @param {Object} object The object to query.
  11977. * @param {Array|string} path The path of the method to invoke.
  11978. * @param {Array} args The arguments to invoke the method with.
  11979. * @returns {*} Returns the result of the invoked method.
  11980. */
  11981. function baseInvoke(object, path, args) {
  11982. path = castPath(path, object);
  11983. object = parent(object, path);
  11984. var func = object == null ? object : object[toKey(last(path))];
  11985. return func == null ? undefined : apply(func, object, args);
  11986. }
  11987. /**
  11988. * The base implementation of `_.isArguments`.
  11989. *
  11990. * @private
  11991. * @param {*} value The value to check.
  11992. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11993. */
  11994. function baseIsArguments(value) {
  11995. return isObjectLike(value) && baseGetTag(value) == argsTag;
  11996. }
  11997. /**
  11998. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  11999. *
  12000. * @private
  12001. * @param {*} value The value to check.
  12002. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  12003. */
  12004. function baseIsArrayBuffer(value) {
  12005. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  12006. }
  12007. /**
  12008. * The base implementation of `_.isDate` without Node.js optimizations.
  12009. *
  12010. * @private
  12011. * @param {*} value The value to check.
  12012. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12013. */
  12014. function baseIsDate(value) {
  12015. return isObjectLike(value) && baseGetTag(value) == dateTag;
  12016. }
  12017. /**
  12018. * The base implementation of `_.isEqual` which supports partial comparisons
  12019. * and tracks traversed objects.
  12020. *
  12021. * @private
  12022. * @param {*} value The value to compare.
  12023. * @param {*} other The other value to compare.
  12024. * @param {boolean} bitmask The bitmask flags.
  12025. * 1 - Unordered comparison
  12026. * 2 - Partial comparison
  12027. * @param {Function} [customizer] The function to customize comparisons.
  12028. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  12029. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12030. */
  12031. function baseIsEqual(value, other, bitmask, customizer, stack) {
  12032. if (value === other) {
  12033. return true;
  12034. }
  12035. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  12036. return value !== value && other !== other;
  12037. }
  12038. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  12039. }
  12040. /**
  12041. * A specialized version of `baseIsEqual` for arrays and objects which performs
  12042. * deep comparisons and tracks traversed objects enabling objects with circular
  12043. * references to be compared.
  12044. *
  12045. * @private
  12046. * @param {Object} object The object to compare.
  12047. * @param {Object} other The other object to compare.
  12048. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  12049. * @param {Function} customizer The function to customize comparisons.
  12050. * @param {Function} equalFunc The function to determine equivalents of values.
  12051. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  12052. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  12053. */
  12054. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  12055. var objIsArr = isArray(object),
  12056. othIsArr = isArray(other),
  12057. objTag = objIsArr ? arrayTag : getTag(object),
  12058. othTag = othIsArr ? arrayTag : getTag(other);
  12059. objTag = objTag == argsTag ? objectTag : objTag;
  12060. othTag = othTag == argsTag ? objectTag : othTag;
  12061. var objIsObj = objTag == objectTag,
  12062. othIsObj = othTag == objectTag,
  12063. isSameTag = objTag == othTag;
  12064. if (isSameTag && isBuffer(object)) {
  12065. if (!isBuffer(other)) {
  12066. return false;
  12067. }
  12068. objIsArr = true;
  12069. objIsObj = false;
  12070. }
  12071. if (isSameTag && !objIsObj) {
  12072. stack || (stack = new Stack);
  12073. return (objIsArr || isTypedArray(object))
  12074. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  12075. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  12076. }
  12077. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  12078. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  12079. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  12080. if (objIsWrapped || othIsWrapped) {
  12081. var objUnwrapped = objIsWrapped ? object.value() : object,
  12082. othUnwrapped = othIsWrapped ? other.value() : other;
  12083. stack || (stack = new Stack);
  12084. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  12085. }
  12086. }
  12087. if (!isSameTag) {
  12088. return false;
  12089. }
  12090. stack || (stack = new Stack);
  12091. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  12092. }
  12093. /**
  12094. * The base implementation of `_.isMap` without Node.js optimizations.
  12095. *
  12096. * @private
  12097. * @param {*} value The value to check.
  12098. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12099. */
  12100. function baseIsMap(value) {
  12101. return isObjectLike(value) && getTag(value) == mapTag;
  12102. }
  12103. /**
  12104. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  12105. *
  12106. * @private
  12107. * @param {Object} object The object to inspect.
  12108. * @param {Object} source The object of property values to match.
  12109. * @param {Array} matchData The property names, values, and compare flags to match.
  12110. * @param {Function} [customizer] The function to customize comparisons.
  12111. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12112. */
  12113. function baseIsMatch(object, source, matchData, customizer) {
  12114. var index = matchData.length,
  12115. length = index,
  12116. noCustomizer = !customizer;
  12117. if (object == null) {
  12118. return !length;
  12119. }
  12120. object = Object(object);
  12121. while (index--) {
  12122. var data = matchData[index];
  12123. if ((noCustomizer && data[2])
  12124. ? data[1] !== object[data[0]]
  12125. : !(data[0] in object)
  12126. ) {
  12127. return false;
  12128. }
  12129. }
  12130. while (++index < length) {
  12131. data = matchData[index];
  12132. var key = data[0],
  12133. objValue = object[key],
  12134. srcValue = data[1];
  12135. if (noCustomizer && data[2]) {
  12136. if (objValue === undefined && !(key in object)) {
  12137. return false;
  12138. }
  12139. } else {
  12140. var stack = new Stack;
  12141. if (customizer) {
  12142. var result = customizer(objValue, srcValue, key, object, source, stack);
  12143. }
  12144. if (!(result === undefined
  12145. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  12146. : result
  12147. )) {
  12148. return false;
  12149. }
  12150. }
  12151. }
  12152. return true;
  12153. }
  12154. /**
  12155. * The base implementation of `_.isNative` without bad shim checks.
  12156. *
  12157. * @private
  12158. * @param {*} value The value to check.
  12159. * @returns {boolean} Returns `true` if `value` is a native function,
  12160. * else `false`.
  12161. */
  12162. function baseIsNative(value) {
  12163. if (!isObject(value) || isMasked(value)) {
  12164. return false;
  12165. }
  12166. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  12167. return pattern.test(toSource(value));
  12168. }
  12169. /**
  12170. * The base implementation of `_.isRegExp` without Node.js optimizations.
  12171. *
  12172. * @private
  12173. * @param {*} value The value to check.
  12174. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12175. */
  12176. function baseIsRegExp(value) {
  12177. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  12178. }
  12179. /**
  12180. * The base implementation of `_.isSet` without Node.js optimizations.
  12181. *
  12182. * @private
  12183. * @param {*} value The value to check.
  12184. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12185. */
  12186. function baseIsSet(value) {
  12187. return isObjectLike(value) && getTag(value) == setTag;
  12188. }
  12189. /**
  12190. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  12191. *
  12192. * @private
  12193. * @param {*} value The value to check.
  12194. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12195. */
  12196. function baseIsTypedArray(value) {
  12197. return isObjectLike(value) &&
  12198. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  12199. }
  12200. /**
  12201. * The base implementation of `_.iteratee`.
  12202. *
  12203. * @private
  12204. * @param {*} [value=_.identity] The value to convert to an iteratee.
  12205. * @returns {Function} Returns the iteratee.
  12206. */
  12207. function baseIteratee(value) {
  12208. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  12209. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  12210. if (typeof value == 'function') {
  12211. return value;
  12212. }
  12213. if (value == null) {
  12214. return identity;
  12215. }
  12216. if (typeof value == 'object') {
  12217. return isArray(value)
  12218. ? baseMatchesProperty(value[0], value[1])
  12219. : baseMatches(value);
  12220. }
  12221. return property(value);
  12222. }
  12223. /**
  12224. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  12225. *
  12226. * @private
  12227. * @param {Object} object The object to query.
  12228. * @returns {Array} Returns the array of property names.
  12229. */
  12230. function baseKeys(object) {
  12231. if (!isPrototype(object)) {
  12232. return nativeKeys(object);
  12233. }
  12234. var result = [];
  12235. for (var key in Object(object)) {
  12236. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  12237. result.push(key);
  12238. }
  12239. }
  12240. return result;
  12241. }
  12242. /**
  12243. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  12244. *
  12245. * @private
  12246. * @param {Object} object The object to query.
  12247. * @returns {Array} Returns the array of property names.
  12248. */
  12249. function baseKeysIn(object) {
  12250. if (!isObject(object)) {
  12251. return nativeKeysIn(object);
  12252. }
  12253. var isProto = isPrototype(object),
  12254. result = [];
  12255. for (var key in object) {
  12256. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  12257. result.push(key);
  12258. }
  12259. }
  12260. return result;
  12261. }
  12262. /**
  12263. * The base implementation of `_.lt` which doesn't coerce arguments.
  12264. *
  12265. * @private
  12266. * @param {*} value The value to compare.
  12267. * @param {*} other The other value to compare.
  12268. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12269. * else `false`.
  12270. */
  12271. function baseLt(value, other) {
  12272. return value < other;
  12273. }
  12274. /**
  12275. * The base implementation of `_.map` without support for iteratee shorthands.
  12276. *
  12277. * @private
  12278. * @param {Array|Object} collection The collection to iterate over.
  12279. * @param {Function} iteratee The function invoked per iteration.
  12280. * @returns {Array} Returns the new mapped array.
  12281. */
  12282. function baseMap(collection, iteratee) {
  12283. var index = -1,
  12284. result = isArrayLike(collection) ? Array(collection.length) : [];
  12285. baseEach(collection, function(value, key, collection) {
  12286. result[++index] = iteratee(value, key, collection);
  12287. });
  12288. return result;
  12289. }
  12290. /**
  12291. * The base implementation of `_.matches` which doesn't clone `source`.
  12292. *
  12293. * @private
  12294. * @param {Object} source The object of property values to match.
  12295. * @returns {Function} Returns the new spec function.
  12296. */
  12297. function baseMatches(source) {
  12298. var matchData = getMatchData(source);
  12299. if (matchData.length == 1 && matchData[0][2]) {
  12300. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  12301. }
  12302. return function(object) {
  12303. return object === source || baseIsMatch(object, source, matchData);
  12304. };
  12305. }
  12306. /**
  12307. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  12308. *
  12309. * @private
  12310. * @param {string} path The path of the property to get.
  12311. * @param {*} srcValue The value to match.
  12312. * @returns {Function} Returns the new spec function.
  12313. */
  12314. function baseMatchesProperty(path, srcValue) {
  12315. if (isKey(path) && isStrictComparable(srcValue)) {
  12316. return matchesStrictComparable(toKey(path), srcValue);
  12317. }
  12318. return function(object) {
  12319. var objValue = get(object, path);
  12320. return (objValue === undefined && objValue === srcValue)
  12321. ? hasIn(object, path)
  12322. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  12323. };
  12324. }
  12325. /**
  12326. * The base implementation of `_.merge` without support for multiple sources.
  12327. *
  12328. * @private
  12329. * @param {Object} object The destination object.
  12330. * @param {Object} source The source object.
  12331. * @param {number} srcIndex The index of `source`.
  12332. * @param {Function} [customizer] The function to customize merged values.
  12333. * @param {Object} [stack] Tracks traversed source values and their merged
  12334. * counterparts.
  12335. */
  12336. function baseMerge(object, source, srcIndex, customizer, stack) {
  12337. if (object === source) {
  12338. return;
  12339. }
  12340. baseFor(source, function(srcValue, key) {
  12341. if (isObject(srcValue)) {
  12342. stack || (stack = new Stack);
  12343. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  12344. }
  12345. else {
  12346. var newValue = customizer
  12347. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  12348. : undefined;
  12349. if (newValue === undefined) {
  12350. newValue = srcValue;
  12351. }
  12352. assignMergeValue(object, key, newValue);
  12353. }
  12354. }, keysIn);
  12355. }
  12356. /**
  12357. * A specialized version of `baseMerge` for arrays and objects which performs
  12358. * deep merges and tracks traversed objects enabling objects with circular
  12359. * references to be merged.
  12360. *
  12361. * @private
  12362. * @param {Object} object The destination object.
  12363. * @param {Object} source The source object.
  12364. * @param {string} key The key of the value to merge.
  12365. * @param {number} srcIndex The index of `source`.
  12366. * @param {Function} mergeFunc The function to merge values.
  12367. * @param {Function} [customizer] The function to customize assigned values.
  12368. * @param {Object} [stack] Tracks traversed source values and their merged
  12369. * counterparts.
  12370. */
  12371. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  12372. var objValue = object[key],
  12373. srcValue = source[key],
  12374. stacked = stack.get(srcValue);
  12375. if (stacked) {
  12376. assignMergeValue(object, key, stacked);
  12377. return;
  12378. }
  12379. var newValue = customizer
  12380. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  12381. : undefined;
  12382. var isCommon = newValue === undefined;
  12383. if (isCommon) {
  12384. var isArr = isArray(srcValue),
  12385. isBuff = !isArr && isBuffer(srcValue),
  12386. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  12387. newValue = srcValue;
  12388. if (isArr || isBuff || isTyped) {
  12389. if (isArray(objValue)) {
  12390. newValue = objValue;
  12391. }
  12392. else if (isArrayLikeObject(objValue)) {
  12393. newValue = copyArray(objValue);
  12394. }
  12395. else if (isBuff) {
  12396. isCommon = false;
  12397. newValue = cloneBuffer(srcValue, true);
  12398. }
  12399. else if (isTyped) {
  12400. isCommon = false;
  12401. newValue = cloneTypedArray(srcValue, true);
  12402. }
  12403. else {
  12404. newValue = [];
  12405. }
  12406. }
  12407. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  12408. newValue = objValue;
  12409. if (isArguments(objValue)) {
  12410. newValue = toPlainObject(objValue);
  12411. }
  12412. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  12413. newValue = initCloneObject(srcValue);
  12414. }
  12415. }
  12416. else {
  12417. isCommon = false;
  12418. }
  12419. }
  12420. if (isCommon) {
  12421. // Recursively merge objects and arrays (susceptible to call stack limits).
  12422. stack.set(srcValue, newValue);
  12423. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  12424. stack['delete'](srcValue);
  12425. }
  12426. assignMergeValue(object, key, newValue);
  12427. }
  12428. /**
  12429. * The base implementation of `_.nth` which doesn't coerce arguments.
  12430. *
  12431. * @private
  12432. * @param {Array} array The array to query.
  12433. * @param {number} n The index of the element to return.
  12434. * @returns {*} Returns the nth element of `array`.
  12435. */
  12436. function baseNth(array, n) {
  12437. var length = array.length;
  12438. if (!length) {
  12439. return;
  12440. }
  12441. n += n < 0 ? length : 0;
  12442. return isIndex(n, length) ? array[n] : undefined;
  12443. }
  12444. /**
  12445. * The base implementation of `_.orderBy` without param guards.
  12446. *
  12447. * @private
  12448. * @param {Array|Object} collection The collection to iterate over.
  12449. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  12450. * @param {string[]} orders The sort orders of `iteratees`.
  12451. * @returns {Array} Returns the new sorted array.
  12452. */
  12453. function baseOrderBy(collection, iteratees, orders) {
  12454. var index = -1;
  12455. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  12456. var result = baseMap(collection, function(value, key, collection) {
  12457. var criteria = arrayMap(iteratees, function(iteratee) {
  12458. return iteratee(value);
  12459. });
  12460. return { 'criteria': criteria, 'index': ++index, 'value': value };
  12461. });
  12462. return baseSortBy(result, function(object, other) {
  12463. return compareMultiple(object, other, orders);
  12464. });
  12465. }
  12466. /**
  12467. * The base implementation of `_.pick` without support for individual
  12468. * property identifiers.
  12469. *
  12470. * @private
  12471. * @param {Object} object The source object.
  12472. * @param {string[]} paths The property paths to pick.
  12473. * @returns {Object} Returns the new object.
  12474. */
  12475. function basePick(object, paths) {
  12476. return basePickBy(object, paths, function(value, path) {
  12477. return hasIn(object, path);
  12478. });
  12479. }
  12480. /**
  12481. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  12482. *
  12483. * @private
  12484. * @param {Object} object The source object.
  12485. * @param {string[]} paths The property paths to pick.
  12486. * @param {Function} predicate The function invoked per property.
  12487. * @returns {Object} Returns the new object.
  12488. */
  12489. function basePickBy(object, paths, predicate) {
  12490. var index = -1,
  12491. length = paths.length,
  12492. result = {};
  12493. while (++index < length) {
  12494. var path = paths[index],
  12495. value = baseGet(object, path);
  12496. if (predicate(value, path)) {
  12497. baseSet(result, castPath(path, object), value);
  12498. }
  12499. }
  12500. return result;
  12501. }
  12502. /**
  12503. * A specialized version of `baseProperty` which supports deep paths.
  12504. *
  12505. * @private
  12506. * @param {Array|string} path The path of the property to get.
  12507. * @returns {Function} Returns the new accessor function.
  12508. */
  12509. function basePropertyDeep(path) {
  12510. return function(object) {
  12511. return baseGet(object, path);
  12512. };
  12513. }
  12514. /**
  12515. * The base implementation of `_.pullAllBy` without support for iteratee
  12516. * shorthands.
  12517. *
  12518. * @private
  12519. * @param {Array} array The array to modify.
  12520. * @param {Array} values The values to remove.
  12521. * @param {Function} [iteratee] The iteratee invoked per element.
  12522. * @param {Function} [comparator] The comparator invoked per element.
  12523. * @returns {Array} Returns `array`.
  12524. */
  12525. function basePullAll(array, values, iteratee, comparator) {
  12526. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  12527. index = -1,
  12528. length = values.length,
  12529. seen = array;
  12530. if (array === values) {
  12531. values = copyArray(values);
  12532. }
  12533. if (iteratee) {
  12534. seen = arrayMap(array, baseUnary(iteratee));
  12535. }
  12536. while (++index < length) {
  12537. var fromIndex = 0,
  12538. value = values[index],
  12539. computed = iteratee ? iteratee(value) : value;
  12540. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  12541. if (seen !== array) {
  12542. splice.call(seen, fromIndex, 1);
  12543. }
  12544. splice.call(array, fromIndex, 1);
  12545. }
  12546. }
  12547. return array;
  12548. }
  12549. /**
  12550. * The base implementation of `_.pullAt` without support for individual
  12551. * indexes or capturing the removed elements.
  12552. *
  12553. * @private
  12554. * @param {Array} array The array to modify.
  12555. * @param {number[]} indexes The indexes of elements to remove.
  12556. * @returns {Array} Returns `array`.
  12557. */
  12558. function basePullAt(array, indexes) {
  12559. var length = array ? indexes.length : 0,
  12560. lastIndex = length - 1;
  12561. while (length--) {
  12562. var index = indexes[length];
  12563. if (length == lastIndex || index !== previous) {
  12564. var previous = index;
  12565. if (isIndex(index)) {
  12566. splice.call(array, index, 1);
  12567. } else {
  12568. baseUnset(array, index);
  12569. }
  12570. }
  12571. }
  12572. return array;
  12573. }
  12574. /**
  12575. * The base implementation of `_.random` without support for returning
  12576. * floating-point numbers.
  12577. *
  12578. * @private
  12579. * @param {number} lower The lower bound.
  12580. * @param {number} upper The upper bound.
  12581. * @returns {number} Returns the random number.
  12582. */
  12583. function baseRandom(lower, upper) {
  12584. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  12585. }
  12586. /**
  12587. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  12588. * coerce arguments.
  12589. *
  12590. * @private
  12591. * @param {number} start The start of the range.
  12592. * @param {number} end The end of the range.
  12593. * @param {number} step The value to increment or decrement by.
  12594. * @param {boolean} [fromRight] Specify iterating from right to left.
  12595. * @returns {Array} Returns the range of numbers.
  12596. */
  12597. function baseRange(start, end, step, fromRight) {
  12598. var index = -1,
  12599. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  12600. result = Array(length);
  12601. while (length--) {
  12602. result[fromRight ? length : ++index] = start;
  12603. start += step;
  12604. }
  12605. return result;
  12606. }
  12607. /**
  12608. * The base implementation of `_.repeat` which doesn't coerce arguments.
  12609. *
  12610. * @private
  12611. * @param {string} string The string to repeat.
  12612. * @param {number} n The number of times to repeat the string.
  12613. * @returns {string} Returns the repeated string.
  12614. */
  12615. function baseRepeat(string, n) {
  12616. var result = '';
  12617. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  12618. return result;
  12619. }
  12620. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  12621. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  12622. do {
  12623. if (n % 2) {
  12624. result += string;
  12625. }
  12626. n = nativeFloor(n / 2);
  12627. if (n) {
  12628. string += string;
  12629. }
  12630. } while (n);
  12631. return result;
  12632. }
  12633. /**
  12634. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  12635. *
  12636. * @private
  12637. * @param {Function} func The function to apply a rest parameter to.
  12638. * @param {number} [start=func.length-1] The start position of the rest parameter.
  12639. * @returns {Function} Returns the new function.
  12640. */
  12641. function baseRest(func, start) {
  12642. return setToString(overRest(func, start, identity), func + '');
  12643. }
  12644. /**
  12645. * The base implementation of `_.sample`.
  12646. *
  12647. * @private
  12648. * @param {Array|Object} collection The collection to sample.
  12649. * @returns {*} Returns the random element.
  12650. */
  12651. function baseSample(collection) {
  12652. return arraySample(values(collection));
  12653. }
  12654. /**
  12655. * The base implementation of `_.sampleSize` without param guards.
  12656. *
  12657. * @private
  12658. * @param {Array|Object} collection The collection to sample.
  12659. * @param {number} n The number of elements to sample.
  12660. * @returns {Array} Returns the random elements.
  12661. */
  12662. function baseSampleSize(collection, n) {
  12663. var array = values(collection);
  12664. return shuffleSelf(array, baseClamp(n, 0, array.length));
  12665. }
  12666. /**
  12667. * The base implementation of `_.set`.
  12668. *
  12669. * @private
  12670. * @param {Object} object The object to modify.
  12671. * @param {Array|string} path The path of the property to set.
  12672. * @param {*} value The value to set.
  12673. * @param {Function} [customizer] The function to customize path creation.
  12674. * @returns {Object} Returns `object`.
  12675. */
  12676. function baseSet(object, path, value, customizer) {
  12677. if (!isObject(object)) {
  12678. return object;
  12679. }
  12680. path = castPath(path, object);
  12681. var index = -1,
  12682. length = path.length,
  12683. lastIndex = length - 1,
  12684. nested = object;
  12685. while (nested != null && ++index < length) {
  12686. var key = toKey(path[index]),
  12687. newValue = value;
  12688. if (index != lastIndex) {
  12689. var objValue = nested[key];
  12690. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  12691. if (newValue === undefined) {
  12692. newValue = isObject(objValue)
  12693. ? objValue
  12694. : (isIndex(path[index + 1]) ? [] : {});
  12695. }
  12696. }
  12697. assignValue(nested, key, newValue);
  12698. nested = nested[key];
  12699. }
  12700. return object;
  12701. }
  12702. /**
  12703. * The base implementation of `setData` without support for hot loop shorting.
  12704. *
  12705. * @private
  12706. * @param {Function} func The function to associate metadata with.
  12707. * @param {*} data The metadata.
  12708. * @returns {Function} Returns `func`.
  12709. */
  12710. var baseSetData = !metaMap ? identity : function(func, data) {
  12711. metaMap.set(func, data);
  12712. return func;
  12713. };
  12714. /**
  12715. * The base implementation of `setToString` without support for hot loop shorting.
  12716. *
  12717. * @private
  12718. * @param {Function} func The function to modify.
  12719. * @param {Function} string The `toString` result.
  12720. * @returns {Function} Returns `func`.
  12721. */
  12722. var baseSetToString = !defineProperty ? identity : function(func, string) {
  12723. return defineProperty(func, 'toString', {
  12724. 'configurable': true,
  12725. 'enumerable': false,
  12726. 'value': constant(string),
  12727. 'writable': true
  12728. });
  12729. };
  12730. /**
  12731. * The base implementation of `_.shuffle`.
  12732. *
  12733. * @private
  12734. * @param {Array|Object} collection The collection to shuffle.
  12735. * @returns {Array} Returns the new shuffled array.
  12736. */
  12737. function baseShuffle(collection) {
  12738. return shuffleSelf(values(collection));
  12739. }
  12740. /**
  12741. * The base implementation of `_.slice` without an iteratee call guard.
  12742. *
  12743. * @private
  12744. * @param {Array} array The array to slice.
  12745. * @param {number} [start=0] The start position.
  12746. * @param {number} [end=array.length] The end position.
  12747. * @returns {Array} Returns the slice of `array`.
  12748. */
  12749. function baseSlice(array, start, end) {
  12750. var index = -1,
  12751. length = array.length;
  12752. if (start < 0) {
  12753. start = -start > length ? 0 : (length + start);
  12754. }
  12755. end = end > length ? length : end;
  12756. if (end < 0) {
  12757. end += length;
  12758. }
  12759. length = start > end ? 0 : ((end - start) >>> 0);
  12760. start >>>= 0;
  12761. var result = Array(length);
  12762. while (++index < length) {
  12763. result[index] = array[index + start];
  12764. }
  12765. return result;
  12766. }
  12767. /**
  12768. * The base implementation of `_.some` without support for iteratee shorthands.
  12769. *
  12770. * @private
  12771. * @param {Array|Object} collection The collection to iterate over.
  12772. * @param {Function} predicate The function invoked per iteration.
  12773. * @returns {boolean} Returns `true` if any element passes the predicate check,
  12774. * else `false`.
  12775. */
  12776. function baseSome(collection, predicate) {
  12777. var result;
  12778. baseEach(collection, function(value, index, collection) {
  12779. result = predicate(value, index, collection);
  12780. return !result;
  12781. });
  12782. return !!result;
  12783. }
  12784. /**
  12785. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  12786. * performs a binary search of `array` to determine the index at which `value`
  12787. * should be inserted into `array` in order to maintain its sort order.
  12788. *
  12789. * @private
  12790. * @param {Array} array The sorted array to inspect.
  12791. * @param {*} value The value to evaluate.
  12792. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  12793. * @returns {number} Returns the index at which `value` should be inserted
  12794. * into `array`.
  12795. */
  12796. function baseSortedIndex(array, value, retHighest) {
  12797. var low = 0,
  12798. high = array == null ? low : array.length;
  12799. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  12800. while (low < high) {
  12801. var mid = (low + high) >>> 1,
  12802. computed = array[mid];
  12803. if (computed !== null && !isSymbol(computed) &&
  12804. (retHighest ? (computed <= value) : (computed < value))) {
  12805. low = mid + 1;
  12806. } else {
  12807. high = mid;
  12808. }
  12809. }
  12810. return high;
  12811. }
  12812. return baseSortedIndexBy(array, value, identity, retHighest);
  12813. }
  12814. /**
  12815. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  12816. * which invokes `iteratee` for `value` and each element of `array` to compute
  12817. * their sort ranking. The iteratee is invoked with one argument; (value).
  12818. *
  12819. * @private
  12820. * @param {Array} array The sorted array to inspect.
  12821. * @param {*} value The value to evaluate.
  12822. * @param {Function} iteratee The iteratee invoked per element.
  12823. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  12824. * @returns {number} Returns the index at which `value` should be inserted
  12825. * into `array`.
  12826. */
  12827. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  12828. value = iteratee(value);
  12829. var low = 0,
  12830. high = array == null ? 0 : array.length,
  12831. valIsNaN = value !== value,
  12832. valIsNull = value === null,
  12833. valIsSymbol = isSymbol(value),
  12834. valIsUndefined = value === undefined;
  12835. while (low < high) {
  12836. var mid = nativeFloor((low + high) / 2),
  12837. computed = iteratee(array[mid]),
  12838. othIsDefined = computed !== undefined,
  12839. othIsNull = computed === null,
  12840. othIsReflexive = computed === computed,
  12841. othIsSymbol = isSymbol(computed);
  12842. if (valIsNaN) {
  12843. var setLow = retHighest || othIsReflexive;
  12844. } else if (valIsUndefined) {
  12845. setLow = othIsReflexive && (retHighest || othIsDefined);
  12846. } else if (valIsNull) {
  12847. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  12848. } else if (valIsSymbol) {
  12849. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  12850. } else if (othIsNull || othIsSymbol) {
  12851. setLow = false;
  12852. } else {
  12853. setLow = retHighest ? (computed <= value) : (computed < value);
  12854. }
  12855. if (setLow) {
  12856. low = mid + 1;
  12857. } else {
  12858. high = mid;
  12859. }
  12860. }
  12861. return nativeMin(high, MAX_ARRAY_INDEX);
  12862. }
  12863. /**
  12864. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  12865. * support for iteratee shorthands.
  12866. *
  12867. * @private
  12868. * @param {Array} array The array to inspect.
  12869. * @param {Function} [iteratee] The iteratee invoked per element.
  12870. * @returns {Array} Returns the new duplicate free array.
  12871. */
  12872. function baseSortedUniq(array, iteratee) {
  12873. var index = -1,
  12874. length = array.length,
  12875. resIndex = 0,
  12876. result = [];
  12877. while (++index < length) {
  12878. var value = array[index],
  12879. computed = iteratee ? iteratee(value) : value;
  12880. if (!index || !eq(computed, seen)) {
  12881. var seen = computed;
  12882. result[resIndex++] = value === 0 ? 0 : value;
  12883. }
  12884. }
  12885. return result;
  12886. }
  12887. /**
  12888. * The base implementation of `_.toNumber` which doesn't ensure correct
  12889. * conversions of binary, hexadecimal, or octal string values.
  12890. *
  12891. * @private
  12892. * @param {*} value The value to process.
  12893. * @returns {number} Returns the number.
  12894. */
  12895. function baseToNumber(value) {
  12896. if (typeof value == 'number') {
  12897. return value;
  12898. }
  12899. if (isSymbol(value)) {
  12900. return NAN;
  12901. }
  12902. return +value;
  12903. }
  12904. /**
  12905. * The base implementation of `_.toString` which doesn't convert nullish
  12906. * values to empty strings.
  12907. *
  12908. * @private
  12909. * @param {*} value The value to process.
  12910. * @returns {string} Returns the string.
  12911. */
  12912. function baseToString(value) {
  12913. // Exit early for strings to avoid a performance hit in some environments.
  12914. if (typeof value == 'string') {
  12915. return value;
  12916. }
  12917. if (isArray(value)) {
  12918. // Recursively convert values (susceptible to call stack limits).
  12919. return arrayMap(value, baseToString) + '';
  12920. }
  12921. if (isSymbol(value)) {
  12922. return symbolToString ? symbolToString.call(value) : '';
  12923. }
  12924. var result = (value + '');
  12925. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  12926. }
  12927. /**
  12928. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  12929. *
  12930. * @private
  12931. * @param {Array} array The array to inspect.
  12932. * @param {Function} [iteratee] The iteratee invoked per element.
  12933. * @param {Function} [comparator] The comparator invoked per element.
  12934. * @returns {Array} Returns the new duplicate free array.
  12935. */
  12936. function baseUniq(array, iteratee, comparator) {
  12937. var index = -1,
  12938. includes = arrayIncludes,
  12939. length = array.length,
  12940. isCommon = true,
  12941. result = [],
  12942. seen = result;
  12943. if (comparator) {
  12944. isCommon = false;
  12945. includes = arrayIncludesWith;
  12946. }
  12947. else if (length >= LARGE_ARRAY_SIZE) {
  12948. var set = iteratee ? null : createSet(array);
  12949. if (set) {
  12950. return setToArray(set);
  12951. }
  12952. isCommon = false;
  12953. includes = cacheHas;
  12954. seen = new SetCache;
  12955. }
  12956. else {
  12957. seen = iteratee ? [] : result;
  12958. }
  12959. outer:
  12960. while (++index < length) {
  12961. var value = array[index],
  12962. computed = iteratee ? iteratee(value) : value;
  12963. value = (comparator || value !== 0) ? value : 0;
  12964. if (isCommon && computed === computed) {
  12965. var seenIndex = seen.length;
  12966. while (seenIndex--) {
  12967. if (seen[seenIndex] === computed) {
  12968. continue outer;
  12969. }
  12970. }
  12971. if (iteratee) {
  12972. seen.push(computed);
  12973. }
  12974. result.push(value);
  12975. }
  12976. else if (!includes(seen, computed, comparator)) {
  12977. if (seen !== result) {
  12978. seen.push(computed);
  12979. }
  12980. result.push(value);
  12981. }
  12982. }
  12983. return result;
  12984. }
  12985. /**
  12986. * The base implementation of `_.unset`.
  12987. *
  12988. * @private
  12989. * @param {Object} object The object to modify.
  12990. * @param {Array|string} path The property path to unset.
  12991. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  12992. */
  12993. function baseUnset(object, path) {
  12994. path = castPath(path, object);
  12995. object = parent(object, path);
  12996. return object == null || delete object[toKey(last(path))];
  12997. }
  12998. /**
  12999. * The base implementation of `_.update`.
  13000. *
  13001. * @private
  13002. * @param {Object} object The object to modify.
  13003. * @param {Array|string} path The path of the property to update.
  13004. * @param {Function} updater The function to produce the updated value.
  13005. * @param {Function} [customizer] The function to customize path creation.
  13006. * @returns {Object} Returns `object`.
  13007. */
  13008. function baseUpdate(object, path, updater, customizer) {
  13009. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  13010. }
  13011. /**
  13012. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  13013. * without support for iteratee shorthands.
  13014. *
  13015. * @private
  13016. * @param {Array} array The array to query.
  13017. * @param {Function} predicate The function invoked per iteration.
  13018. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  13019. * @param {boolean} [fromRight] Specify iterating from right to left.
  13020. * @returns {Array} Returns the slice of `array`.
  13021. */
  13022. function baseWhile(array, predicate, isDrop, fromRight) {
  13023. var length = array.length,
  13024. index = fromRight ? length : -1;
  13025. while ((fromRight ? index-- : ++index < length) &&
  13026. predicate(array[index], index, array)) {}
  13027. return isDrop
  13028. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  13029. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  13030. }
  13031. /**
  13032. * The base implementation of `wrapperValue` which returns the result of
  13033. * performing a sequence of actions on the unwrapped `value`, where each
  13034. * successive action is supplied the return value of the previous.
  13035. *
  13036. * @private
  13037. * @param {*} value The unwrapped value.
  13038. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  13039. * @returns {*} Returns the resolved value.
  13040. */
  13041. function baseWrapperValue(value, actions) {
  13042. var result = value;
  13043. if (result instanceof LazyWrapper) {
  13044. result = result.value();
  13045. }
  13046. return arrayReduce(actions, function(result, action) {
  13047. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  13048. }, result);
  13049. }
  13050. /**
  13051. * The base implementation of methods like `_.xor`, without support for
  13052. * iteratee shorthands, that accepts an array of arrays to inspect.
  13053. *
  13054. * @private
  13055. * @param {Array} arrays The arrays to inspect.
  13056. * @param {Function} [iteratee] The iteratee invoked per element.
  13057. * @param {Function} [comparator] The comparator invoked per element.
  13058. * @returns {Array} Returns the new array of values.
  13059. */
  13060. function baseXor(arrays, iteratee, comparator) {
  13061. var length = arrays.length;
  13062. if (length < 2) {
  13063. return length ? baseUniq(arrays[0]) : [];
  13064. }
  13065. var index = -1,
  13066. result = Array(length);
  13067. while (++index < length) {
  13068. var array = arrays[index],
  13069. othIndex = -1;
  13070. while (++othIndex < length) {
  13071. if (othIndex != index) {
  13072. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  13073. }
  13074. }
  13075. }
  13076. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  13077. }
  13078. /**
  13079. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  13080. *
  13081. * @private
  13082. * @param {Array} props The property identifiers.
  13083. * @param {Array} values The property values.
  13084. * @param {Function} assignFunc The function to assign values.
  13085. * @returns {Object} Returns the new object.
  13086. */
  13087. function baseZipObject(props, values, assignFunc) {
  13088. var index = -1,
  13089. length = props.length,
  13090. valsLength = values.length,
  13091. result = {};
  13092. while (++index < length) {
  13093. var value = index < valsLength ? values[index] : undefined;
  13094. assignFunc(result, props[index], value);
  13095. }
  13096. return result;
  13097. }
  13098. /**
  13099. * Casts `value` to an empty array if it's not an array like object.
  13100. *
  13101. * @private
  13102. * @param {*} value The value to inspect.
  13103. * @returns {Array|Object} Returns the cast array-like object.
  13104. */
  13105. function castArrayLikeObject(value) {
  13106. return isArrayLikeObject(value) ? value : [];
  13107. }
  13108. /**
  13109. * Casts `value` to `identity` if it's not a function.
  13110. *
  13111. * @private
  13112. * @param {*} value The value to inspect.
  13113. * @returns {Function} Returns cast function.
  13114. */
  13115. function castFunction(value) {
  13116. return typeof value == 'function' ? value : identity;
  13117. }
  13118. /**
  13119. * Casts `value` to a path array if it's not one.
  13120. *
  13121. * @private
  13122. * @param {*} value The value to inspect.
  13123. * @param {Object} [object] The object to query keys on.
  13124. * @returns {Array} Returns the cast property path array.
  13125. */
  13126. function castPath(value, object) {
  13127. if (isArray(value)) {
  13128. return value;
  13129. }
  13130. return isKey(value, object) ? [value] : stringToPath(toString(value));
  13131. }
  13132. /**
  13133. * A `baseRest` alias which can be replaced with `identity` by module
  13134. * replacement plugins.
  13135. *
  13136. * @private
  13137. * @type {Function}
  13138. * @param {Function} func The function to apply a rest parameter to.
  13139. * @returns {Function} Returns the new function.
  13140. */
  13141. var castRest = baseRest;
  13142. /**
  13143. * Casts `array` to a slice if it's needed.
  13144. *
  13145. * @private
  13146. * @param {Array} array The array to inspect.
  13147. * @param {number} start The start position.
  13148. * @param {number} [end=array.length] The end position.
  13149. * @returns {Array} Returns the cast slice.
  13150. */
  13151. function castSlice(array, start, end) {
  13152. var length = array.length;
  13153. end = end === undefined ? length : end;
  13154. return (!start && end >= length) ? array : baseSlice(array, start, end);
  13155. }
  13156. /**
  13157. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  13158. *
  13159. * @private
  13160. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  13161. */
  13162. var clearTimeout = ctxClearTimeout || function(id) {
  13163. return root.clearTimeout(id);
  13164. };
  13165. /**
  13166. * Creates a clone of `buffer`.
  13167. *
  13168. * @private
  13169. * @param {Buffer} buffer The buffer to clone.
  13170. * @param {boolean} [isDeep] Specify a deep clone.
  13171. * @returns {Buffer} Returns the cloned buffer.
  13172. */
  13173. function cloneBuffer(buffer, isDeep) {
  13174. if (isDeep) {
  13175. return buffer.slice();
  13176. }
  13177. var length = buffer.length,
  13178. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  13179. buffer.copy(result);
  13180. return result;
  13181. }
  13182. /**
  13183. * Creates a clone of `arrayBuffer`.
  13184. *
  13185. * @private
  13186. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  13187. * @returns {ArrayBuffer} Returns the cloned array buffer.
  13188. */
  13189. function cloneArrayBuffer(arrayBuffer) {
  13190. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  13191. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  13192. return result;
  13193. }
  13194. /**
  13195. * Creates a clone of `dataView`.
  13196. *
  13197. * @private
  13198. * @param {Object} dataView The data view to clone.
  13199. * @param {boolean} [isDeep] Specify a deep clone.
  13200. * @returns {Object} Returns the cloned data view.
  13201. */
  13202. function cloneDataView(dataView, isDeep) {
  13203. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  13204. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  13205. }
  13206. /**
  13207. * Creates a clone of `map`.
  13208. *
  13209. * @private
  13210. * @param {Object} map The map to clone.
  13211. * @param {Function} cloneFunc The function to clone values.
  13212. * @param {boolean} [isDeep] Specify a deep clone.
  13213. * @returns {Object} Returns the cloned map.
  13214. */
  13215. function cloneMap(map, isDeep, cloneFunc) {
  13216. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  13217. return arrayReduce(array, addMapEntry, new map.constructor);
  13218. }
  13219. /**
  13220. * Creates a clone of `regexp`.
  13221. *
  13222. * @private
  13223. * @param {Object} regexp The regexp to clone.
  13224. * @returns {Object} Returns the cloned regexp.
  13225. */
  13226. function cloneRegExp(regexp) {
  13227. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  13228. result.lastIndex = regexp.lastIndex;
  13229. return result;
  13230. }
  13231. /**
  13232. * Creates a clone of `set`.
  13233. *
  13234. * @private
  13235. * @param {Object} set The set to clone.
  13236. * @param {Function} cloneFunc The function to clone values.
  13237. * @param {boolean} [isDeep] Specify a deep clone.
  13238. * @returns {Object} Returns the cloned set.
  13239. */
  13240. function cloneSet(set, isDeep, cloneFunc) {
  13241. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  13242. return arrayReduce(array, addSetEntry, new set.constructor);
  13243. }
  13244. /**
  13245. * Creates a clone of the `symbol` object.
  13246. *
  13247. * @private
  13248. * @param {Object} symbol The symbol object to clone.
  13249. * @returns {Object} Returns the cloned symbol object.
  13250. */
  13251. function cloneSymbol(symbol) {
  13252. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  13253. }
  13254. /**
  13255. * Creates a clone of `typedArray`.
  13256. *
  13257. * @private
  13258. * @param {Object} typedArray The typed array to clone.
  13259. * @param {boolean} [isDeep] Specify a deep clone.
  13260. * @returns {Object} Returns the cloned typed array.
  13261. */
  13262. function cloneTypedArray(typedArray, isDeep) {
  13263. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  13264. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  13265. }
  13266. /**
  13267. * Compares values to sort them in ascending order.
  13268. *
  13269. * @private
  13270. * @param {*} value The value to compare.
  13271. * @param {*} other The other value to compare.
  13272. * @returns {number} Returns the sort order indicator for `value`.
  13273. */
  13274. function compareAscending(value, other) {
  13275. if (value !== other) {
  13276. var valIsDefined = value !== undefined,
  13277. valIsNull = value === null,
  13278. valIsReflexive = value === value,
  13279. valIsSymbol = isSymbol(value);
  13280. var othIsDefined = other !== undefined,
  13281. othIsNull = other === null,
  13282. othIsReflexive = other === other,
  13283. othIsSymbol = isSymbol(other);
  13284. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  13285. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  13286. (valIsNull && othIsDefined && othIsReflexive) ||
  13287. (!valIsDefined && othIsReflexive) ||
  13288. !valIsReflexive) {
  13289. return 1;
  13290. }
  13291. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  13292. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  13293. (othIsNull && valIsDefined && valIsReflexive) ||
  13294. (!othIsDefined && valIsReflexive) ||
  13295. !othIsReflexive) {
  13296. return -1;
  13297. }
  13298. }
  13299. return 0;
  13300. }
  13301. /**
  13302. * Used by `_.orderBy` to compare multiple properties of a value to another
  13303. * and stable sort them.
  13304. *
  13305. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  13306. * specify an order of "desc" for descending or "asc" for ascending sort order
  13307. * of corresponding values.
  13308. *
  13309. * @private
  13310. * @param {Object} object The object to compare.
  13311. * @param {Object} other The other object to compare.
  13312. * @param {boolean[]|string[]} orders The order to sort by for each property.
  13313. * @returns {number} Returns the sort order indicator for `object`.
  13314. */
  13315. function compareMultiple(object, other, orders) {
  13316. var index = -1,
  13317. objCriteria = object.criteria,
  13318. othCriteria = other.criteria,
  13319. length = objCriteria.length,
  13320. ordersLength = orders.length;
  13321. while (++index < length) {
  13322. var result = compareAscending(objCriteria[index], othCriteria[index]);
  13323. if (result) {
  13324. if (index >= ordersLength) {
  13325. return result;
  13326. }
  13327. var order = orders[index];
  13328. return result * (order == 'desc' ? -1 : 1);
  13329. }
  13330. }
  13331. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  13332. // that causes it, under certain circumstances, to provide the same value for
  13333. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  13334. // for more details.
  13335. //
  13336. // This also ensures a stable sort in V8 and other engines.
  13337. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  13338. return object.index - other.index;
  13339. }
  13340. /**
  13341. * Creates an array that is the composition of partially applied arguments,
  13342. * placeholders, and provided arguments into a single array of arguments.
  13343. *
  13344. * @private
  13345. * @param {Array} args The provided arguments.
  13346. * @param {Array} partials The arguments to prepend to those provided.
  13347. * @param {Array} holders The `partials` placeholder indexes.
  13348. * @params {boolean} [isCurried] Specify composing for a curried function.
  13349. * @returns {Array} Returns the new array of composed arguments.
  13350. */
  13351. function composeArgs(args, partials, holders, isCurried) {
  13352. var argsIndex = -1,
  13353. argsLength = args.length,
  13354. holdersLength = holders.length,
  13355. leftIndex = -1,
  13356. leftLength = partials.length,
  13357. rangeLength = nativeMax(argsLength - holdersLength, 0),
  13358. result = Array(leftLength + rangeLength),
  13359. isUncurried = !isCurried;
  13360. while (++leftIndex < leftLength) {
  13361. result[leftIndex] = partials[leftIndex];
  13362. }
  13363. while (++argsIndex < holdersLength) {
  13364. if (isUncurried || argsIndex < argsLength) {
  13365. result[holders[argsIndex]] = args[argsIndex];
  13366. }
  13367. }
  13368. while (rangeLength--) {
  13369. result[leftIndex++] = args[argsIndex++];
  13370. }
  13371. return result;
  13372. }
  13373. /**
  13374. * This function is like `composeArgs` except that the arguments composition
  13375. * is tailored for `_.partialRight`.
  13376. *
  13377. * @private
  13378. * @param {Array} args The provided arguments.
  13379. * @param {Array} partials The arguments to append to those provided.
  13380. * @param {Array} holders The `partials` placeholder indexes.
  13381. * @params {boolean} [isCurried] Specify composing for a curried function.
  13382. * @returns {Array} Returns the new array of composed arguments.
  13383. */
  13384. function composeArgsRight(args, partials, holders, isCurried) {
  13385. var argsIndex = -1,
  13386. argsLength = args.length,
  13387. holdersIndex = -1,
  13388. holdersLength = holders.length,
  13389. rightIndex = -1,
  13390. rightLength = partials.length,
  13391. rangeLength = nativeMax(argsLength - holdersLength, 0),
  13392. result = Array(rangeLength + rightLength),
  13393. isUncurried = !isCurried;
  13394. while (++argsIndex < rangeLength) {
  13395. result[argsIndex] = args[argsIndex];
  13396. }
  13397. var offset = argsIndex;
  13398. while (++rightIndex < rightLength) {
  13399. result[offset + rightIndex] = partials[rightIndex];
  13400. }
  13401. while (++holdersIndex < holdersLength) {
  13402. if (isUncurried || argsIndex < argsLength) {
  13403. result[offset + holders[holdersIndex]] = args[argsIndex++];
  13404. }
  13405. }
  13406. return result;
  13407. }
  13408. /**
  13409. * Copies the values of `source` to `array`.
  13410. *
  13411. * @private
  13412. * @param {Array} source The array to copy values from.
  13413. * @param {Array} [array=[]] The array to copy values to.
  13414. * @returns {Array} Returns `array`.
  13415. */
  13416. function copyArray(source, array) {
  13417. var index = -1,
  13418. length = source.length;
  13419. array || (array = Array(length));
  13420. while (++index < length) {
  13421. array[index] = source[index];
  13422. }
  13423. return array;
  13424. }
  13425. /**
  13426. * Copies properties of `source` to `object`.
  13427. *
  13428. * @private
  13429. * @param {Object} source The object to copy properties from.
  13430. * @param {Array} props The property identifiers to copy.
  13431. * @param {Object} [object={}] The object to copy properties to.
  13432. * @param {Function} [customizer] The function to customize copied values.
  13433. * @returns {Object} Returns `object`.
  13434. */
  13435. function copyObject(source, props, object, customizer) {
  13436. var isNew = !object;
  13437. object || (object = {});
  13438. var index = -1,
  13439. length = props.length;
  13440. while (++index < length) {
  13441. var key = props[index];
  13442. var newValue = customizer
  13443. ? customizer(object[key], source[key], key, object, source)
  13444. : undefined;
  13445. if (newValue === undefined) {
  13446. newValue = source[key];
  13447. }
  13448. if (isNew) {
  13449. baseAssignValue(object, key, newValue);
  13450. } else {
  13451. assignValue(object, key, newValue);
  13452. }
  13453. }
  13454. return object;
  13455. }
  13456. /**
  13457. * Copies own symbols of `source` to `object`.
  13458. *
  13459. * @private
  13460. * @param {Object} source The object to copy symbols from.
  13461. * @param {Object} [object={}] The object to copy symbols to.
  13462. * @returns {Object} Returns `object`.
  13463. */
  13464. function copySymbols(source, object) {
  13465. return copyObject(source, getSymbols(source), object);
  13466. }
  13467. /**
  13468. * Copies own and inherited symbols of `source` to `object`.
  13469. *
  13470. * @private
  13471. * @param {Object} source The object to copy symbols from.
  13472. * @param {Object} [object={}] The object to copy symbols to.
  13473. * @returns {Object} Returns `object`.
  13474. */
  13475. function copySymbolsIn(source, object) {
  13476. return copyObject(source, getSymbolsIn(source), object);
  13477. }
  13478. /**
  13479. * Creates a function like `_.groupBy`.
  13480. *
  13481. * @private
  13482. * @param {Function} setter The function to set accumulator values.
  13483. * @param {Function} [initializer] The accumulator object initializer.
  13484. * @returns {Function} Returns the new aggregator function.
  13485. */
  13486. function createAggregator(setter, initializer) {
  13487. return function(collection, iteratee) {
  13488. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  13489. accumulator = initializer ? initializer() : {};
  13490. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  13491. };
  13492. }
  13493. /**
  13494. * Creates a function like `_.assign`.
  13495. *
  13496. * @private
  13497. * @param {Function} assigner The function to assign values.
  13498. * @returns {Function} Returns the new assigner function.
  13499. */
  13500. function createAssigner(assigner) {
  13501. return baseRest(function(object, sources) {
  13502. var index = -1,
  13503. length = sources.length,
  13504. customizer = length > 1 ? sources[length - 1] : undefined,
  13505. guard = length > 2 ? sources[2] : undefined;
  13506. customizer = (assigner.length > 3 && typeof customizer == 'function')
  13507. ? (length--, customizer)
  13508. : undefined;
  13509. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13510. customizer = length < 3 ? undefined : customizer;
  13511. length = 1;
  13512. }
  13513. object = Object(object);
  13514. while (++index < length) {
  13515. var source = sources[index];
  13516. if (source) {
  13517. assigner(object, source, index, customizer);
  13518. }
  13519. }
  13520. return object;
  13521. });
  13522. }
  13523. /**
  13524. * Creates a `baseEach` or `baseEachRight` function.
  13525. *
  13526. * @private
  13527. * @param {Function} eachFunc The function to iterate over a collection.
  13528. * @param {boolean} [fromRight] Specify iterating from right to left.
  13529. * @returns {Function} Returns the new base function.
  13530. */
  13531. function createBaseEach(eachFunc, fromRight) {
  13532. return function(collection, iteratee) {
  13533. if (collection == null) {
  13534. return collection;
  13535. }
  13536. if (!isArrayLike(collection)) {
  13537. return eachFunc(collection, iteratee);
  13538. }
  13539. var length = collection.length,
  13540. index = fromRight ? length : -1,
  13541. iterable = Object(collection);
  13542. while ((fromRight ? index-- : ++index < length)) {
  13543. if (iteratee(iterable[index], index, iterable) === false) {
  13544. break;
  13545. }
  13546. }
  13547. return collection;
  13548. };
  13549. }
  13550. /**
  13551. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  13552. *
  13553. * @private
  13554. * @param {boolean} [fromRight] Specify iterating from right to left.
  13555. * @returns {Function} Returns the new base function.
  13556. */
  13557. function createBaseFor(fromRight) {
  13558. return function(object, iteratee, keysFunc) {
  13559. var index = -1,
  13560. iterable = Object(object),
  13561. props = keysFunc(object),
  13562. length = props.length;
  13563. while (length--) {
  13564. var key = props[fromRight ? length : ++index];
  13565. if (iteratee(iterable[key], key, iterable) === false) {
  13566. break;
  13567. }
  13568. }
  13569. return object;
  13570. };
  13571. }
  13572. /**
  13573. * Creates a function that wraps `func` to invoke it with the optional `this`
  13574. * binding of `thisArg`.
  13575. *
  13576. * @private
  13577. * @param {Function} func The function to wrap.
  13578. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13579. * @param {*} [thisArg] The `this` binding of `func`.
  13580. * @returns {Function} Returns the new wrapped function.
  13581. */
  13582. function createBind(func, bitmask, thisArg) {
  13583. var isBind = bitmask & WRAP_BIND_FLAG,
  13584. Ctor = createCtor(func);
  13585. function wrapper() {
  13586. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13587. return fn.apply(isBind ? thisArg : this, arguments);
  13588. }
  13589. return wrapper;
  13590. }
  13591. /**
  13592. * Creates a function like `_.lowerFirst`.
  13593. *
  13594. * @private
  13595. * @param {string} methodName The name of the `String` case method to use.
  13596. * @returns {Function} Returns the new case function.
  13597. */
  13598. function createCaseFirst(methodName) {
  13599. return function(string) {
  13600. string = toString(string);
  13601. var strSymbols = hasUnicode(string)
  13602. ? stringToArray(string)
  13603. : undefined;
  13604. var chr = strSymbols
  13605. ? strSymbols[0]
  13606. : string.charAt(0);
  13607. var trailing = strSymbols
  13608. ? castSlice(strSymbols, 1).join('')
  13609. : string.slice(1);
  13610. return chr[methodName]() + trailing;
  13611. };
  13612. }
  13613. /**
  13614. * Creates a function like `_.camelCase`.
  13615. *
  13616. * @private
  13617. * @param {Function} callback The function to combine each word.
  13618. * @returns {Function} Returns the new compounder function.
  13619. */
  13620. function createCompounder(callback) {
  13621. return function(string) {
  13622. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  13623. };
  13624. }
  13625. /**
  13626. * Creates a function that produces an instance of `Ctor` regardless of
  13627. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  13628. *
  13629. * @private
  13630. * @param {Function} Ctor The constructor to wrap.
  13631. * @returns {Function} Returns the new wrapped function.
  13632. */
  13633. function createCtor(Ctor) {
  13634. return function() {
  13635. // Use a `switch` statement to work with class constructors. See
  13636. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  13637. // for more details.
  13638. var args = arguments;
  13639. switch (args.length) {
  13640. case 0: return new Ctor;
  13641. case 1: return new Ctor(args[0]);
  13642. case 2: return new Ctor(args[0], args[1]);
  13643. case 3: return new Ctor(args[0], args[1], args[2]);
  13644. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  13645. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  13646. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  13647. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  13648. }
  13649. var thisBinding = baseCreate(Ctor.prototype),
  13650. result = Ctor.apply(thisBinding, args);
  13651. // Mimic the constructor's `return` behavior.
  13652. // See https://es5.github.io/#x13.2.2 for more details.
  13653. return isObject(result) ? result : thisBinding;
  13654. };
  13655. }
  13656. /**
  13657. * Creates a function that wraps `func` to enable currying.
  13658. *
  13659. * @private
  13660. * @param {Function} func The function to wrap.
  13661. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13662. * @param {number} arity The arity of `func`.
  13663. * @returns {Function} Returns the new wrapped function.
  13664. */
  13665. function createCurry(func, bitmask, arity) {
  13666. var Ctor = createCtor(func);
  13667. function wrapper() {
  13668. var length = arguments.length,
  13669. args = Array(length),
  13670. index = length,
  13671. placeholder = getHolder(wrapper);
  13672. while (index--) {
  13673. args[index] = arguments[index];
  13674. }
  13675. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  13676. ? []
  13677. : replaceHolders(args, placeholder);
  13678. length -= holders.length;
  13679. if (length < arity) {
  13680. return createRecurry(
  13681. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  13682. args, holders, undefined, undefined, arity - length);
  13683. }
  13684. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13685. return apply(fn, this, args);
  13686. }
  13687. return wrapper;
  13688. }
  13689. /**
  13690. * Creates a `_.find` or `_.findLast` function.
  13691. *
  13692. * @private
  13693. * @param {Function} findIndexFunc The function to find the collection index.
  13694. * @returns {Function} Returns the new find function.
  13695. */
  13696. function createFind(findIndexFunc) {
  13697. return function(collection, predicate, fromIndex) {
  13698. var iterable = Object(collection);
  13699. if (!isArrayLike(collection)) {
  13700. var iteratee = getIteratee(predicate, 3);
  13701. collection = keys(collection);
  13702. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  13703. }
  13704. var index = findIndexFunc(collection, predicate, fromIndex);
  13705. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  13706. };
  13707. }
  13708. /**
  13709. * Creates a `_.flow` or `_.flowRight` function.
  13710. *
  13711. * @private
  13712. * @param {boolean} [fromRight] Specify iterating from right to left.
  13713. * @returns {Function} Returns the new flow function.
  13714. */
  13715. function createFlow(fromRight) {
  13716. return flatRest(function(funcs) {
  13717. var length = funcs.length,
  13718. index = length,
  13719. prereq = LodashWrapper.prototype.thru;
  13720. if (fromRight) {
  13721. funcs.reverse();
  13722. }
  13723. while (index--) {
  13724. var func = funcs[index];
  13725. if (typeof func != 'function') {
  13726. throw new TypeError(FUNC_ERROR_TEXT);
  13727. }
  13728. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  13729. var wrapper = new LodashWrapper([], true);
  13730. }
  13731. }
  13732. index = wrapper ? index : length;
  13733. while (++index < length) {
  13734. func = funcs[index];
  13735. var funcName = getFuncName(func),
  13736. data = funcName == 'wrapper' ? getData(func) : undefined;
  13737. if (data && isLaziable(data[0]) &&
  13738. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  13739. !data[4].length && data[9] == 1
  13740. ) {
  13741. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  13742. } else {
  13743. wrapper = (func.length == 1 && isLaziable(func))
  13744. ? wrapper[funcName]()
  13745. : wrapper.thru(func);
  13746. }
  13747. }
  13748. return function() {
  13749. var args = arguments,
  13750. value = args[0];
  13751. if (wrapper && args.length == 1 && isArray(value)) {
  13752. return wrapper.plant(value).value();
  13753. }
  13754. var index = 0,
  13755. result = length ? funcs[index].apply(this, args) : value;
  13756. while (++index < length) {
  13757. result = funcs[index].call(this, result);
  13758. }
  13759. return result;
  13760. };
  13761. });
  13762. }
  13763. /**
  13764. * Creates a function that wraps `func` to invoke it with optional `this`
  13765. * binding of `thisArg`, partial application, and currying.
  13766. *
  13767. * @private
  13768. * @param {Function|string} func The function or method name to wrap.
  13769. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13770. * @param {*} [thisArg] The `this` binding of `func`.
  13771. * @param {Array} [partials] The arguments to prepend to those provided to
  13772. * the new function.
  13773. * @param {Array} [holders] The `partials` placeholder indexes.
  13774. * @param {Array} [partialsRight] The arguments to append to those provided
  13775. * to the new function.
  13776. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  13777. * @param {Array} [argPos] The argument positions of the new function.
  13778. * @param {number} [ary] The arity cap of `func`.
  13779. * @param {number} [arity] The arity of `func`.
  13780. * @returns {Function} Returns the new wrapped function.
  13781. */
  13782. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  13783. var isAry = bitmask & WRAP_ARY_FLAG,
  13784. isBind = bitmask & WRAP_BIND_FLAG,
  13785. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  13786. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  13787. isFlip = bitmask & WRAP_FLIP_FLAG,
  13788. Ctor = isBindKey ? undefined : createCtor(func);
  13789. function wrapper() {
  13790. var length = arguments.length,
  13791. args = Array(length),
  13792. index = length;
  13793. while (index--) {
  13794. args[index] = arguments[index];
  13795. }
  13796. if (isCurried) {
  13797. var placeholder = getHolder(wrapper),
  13798. holdersCount = countHolders(args, placeholder);
  13799. }
  13800. if (partials) {
  13801. args = composeArgs(args, partials, holders, isCurried);
  13802. }
  13803. if (partialsRight) {
  13804. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  13805. }
  13806. length -= holdersCount;
  13807. if (isCurried && length < arity) {
  13808. var newHolders = replaceHolders(args, placeholder);
  13809. return createRecurry(
  13810. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  13811. args, newHolders, argPos, ary, arity - length
  13812. );
  13813. }
  13814. var thisBinding = isBind ? thisArg : this,
  13815. fn = isBindKey ? thisBinding[func] : func;
  13816. length = args.length;
  13817. if (argPos) {
  13818. args = reorder(args, argPos);
  13819. } else if (isFlip && length > 1) {
  13820. args.reverse();
  13821. }
  13822. if (isAry && ary < length) {
  13823. args.length = ary;
  13824. }
  13825. if (this && this !== root && this instanceof wrapper) {
  13826. fn = Ctor || createCtor(fn);
  13827. }
  13828. return fn.apply(thisBinding, args);
  13829. }
  13830. return wrapper;
  13831. }
  13832. /**
  13833. * Creates a function like `_.invertBy`.
  13834. *
  13835. * @private
  13836. * @param {Function} setter The function to set accumulator values.
  13837. * @param {Function} toIteratee The function to resolve iteratees.
  13838. * @returns {Function} Returns the new inverter function.
  13839. */
  13840. function createInverter(setter, toIteratee) {
  13841. return function(object, iteratee) {
  13842. return baseInverter(object, setter, toIteratee(iteratee), {});
  13843. };
  13844. }
  13845. /**
  13846. * Creates a function that performs a mathematical operation on two values.
  13847. *
  13848. * @private
  13849. * @param {Function} operator The function to perform the operation.
  13850. * @param {number} [defaultValue] The value used for `undefined` arguments.
  13851. * @returns {Function} Returns the new mathematical operation function.
  13852. */
  13853. function createMathOperation(operator, defaultValue) {
  13854. return function(value, other) {
  13855. var result;
  13856. if (value === undefined && other === undefined) {
  13857. return defaultValue;
  13858. }
  13859. if (value !== undefined) {
  13860. result = value;
  13861. }
  13862. if (other !== undefined) {
  13863. if (result === undefined) {
  13864. return other;
  13865. }
  13866. if (typeof value == 'string' || typeof other == 'string') {
  13867. value = baseToString(value);
  13868. other = baseToString(other);
  13869. } else {
  13870. value = baseToNumber(value);
  13871. other = baseToNumber(other);
  13872. }
  13873. result = operator(value, other);
  13874. }
  13875. return result;
  13876. };
  13877. }
  13878. /**
  13879. * Creates a function like `_.over`.
  13880. *
  13881. * @private
  13882. * @param {Function} arrayFunc The function to iterate over iteratees.
  13883. * @returns {Function} Returns the new over function.
  13884. */
  13885. function createOver(arrayFunc) {
  13886. return flatRest(function(iteratees) {
  13887. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  13888. return baseRest(function(args) {
  13889. var thisArg = this;
  13890. return arrayFunc(iteratees, function(iteratee) {
  13891. return apply(iteratee, thisArg, args);
  13892. });
  13893. });
  13894. });
  13895. }
  13896. /**
  13897. * Creates the padding for `string` based on `length`. The `chars` string
  13898. * is truncated if the number of characters exceeds `length`.
  13899. *
  13900. * @private
  13901. * @param {number} length The padding length.
  13902. * @param {string} [chars=' '] The string used as padding.
  13903. * @returns {string} Returns the padding for `string`.
  13904. */
  13905. function createPadding(length, chars) {
  13906. chars = chars === undefined ? ' ' : baseToString(chars);
  13907. var charsLength = chars.length;
  13908. if (charsLength < 2) {
  13909. return charsLength ? baseRepeat(chars, length) : chars;
  13910. }
  13911. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  13912. return hasUnicode(chars)
  13913. ? castSlice(stringToArray(result), 0, length).join('')
  13914. : result.slice(0, length);
  13915. }
  13916. /**
  13917. * Creates a function that wraps `func` to invoke it with the `this` binding
  13918. * of `thisArg` and `partials` prepended to the arguments it receives.
  13919. *
  13920. * @private
  13921. * @param {Function} func The function to wrap.
  13922. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13923. * @param {*} thisArg The `this` binding of `func`.
  13924. * @param {Array} partials The arguments to prepend to those provided to
  13925. * the new function.
  13926. * @returns {Function} Returns the new wrapped function.
  13927. */
  13928. function createPartial(func, bitmask, thisArg, partials) {
  13929. var isBind = bitmask & WRAP_BIND_FLAG,
  13930. Ctor = createCtor(func);
  13931. function wrapper() {
  13932. var argsIndex = -1,
  13933. argsLength = arguments.length,
  13934. leftIndex = -1,
  13935. leftLength = partials.length,
  13936. args = Array(leftLength + argsLength),
  13937. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13938. while (++leftIndex < leftLength) {
  13939. args[leftIndex] = partials[leftIndex];
  13940. }
  13941. while (argsLength--) {
  13942. args[leftIndex++] = arguments[++argsIndex];
  13943. }
  13944. return apply(fn, isBind ? thisArg : this, args);
  13945. }
  13946. return wrapper;
  13947. }
  13948. /**
  13949. * Creates a `_.range` or `_.rangeRight` function.
  13950. *
  13951. * @private
  13952. * @param {boolean} [fromRight] Specify iterating from right to left.
  13953. * @returns {Function} Returns the new range function.
  13954. */
  13955. function createRange(fromRight) {
  13956. return function(start, end, step) {
  13957. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  13958. end = step = undefined;
  13959. }
  13960. // Ensure the sign of `-0` is preserved.
  13961. start = toFinite(start);
  13962. if (end === undefined) {
  13963. end = start;
  13964. start = 0;
  13965. } else {
  13966. end = toFinite(end);
  13967. }
  13968. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  13969. return baseRange(start, end, step, fromRight);
  13970. };
  13971. }
  13972. /**
  13973. * Creates a function that performs a relational operation on two values.
  13974. *
  13975. * @private
  13976. * @param {Function} operator The function to perform the operation.
  13977. * @returns {Function} Returns the new relational operation function.
  13978. */
  13979. function createRelationalOperation(operator) {
  13980. return function(value, other) {
  13981. if (!(typeof value == 'string' && typeof other == 'string')) {
  13982. value = toNumber(value);
  13983. other = toNumber(other);
  13984. }
  13985. return operator(value, other);
  13986. };
  13987. }
  13988. /**
  13989. * Creates a function that wraps `func` to continue currying.
  13990. *
  13991. * @private
  13992. * @param {Function} func The function to wrap.
  13993. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13994. * @param {Function} wrapFunc The function to create the `func` wrapper.
  13995. * @param {*} placeholder The placeholder value.
  13996. * @param {*} [thisArg] The `this` binding of `func`.
  13997. * @param {Array} [partials] The arguments to prepend to those provided to
  13998. * the new function.
  13999. * @param {Array} [holders] The `partials` placeholder indexes.
  14000. * @param {Array} [argPos] The argument positions of the new function.
  14001. * @param {number} [ary] The arity cap of `func`.
  14002. * @param {number} [arity] The arity of `func`.
  14003. * @returns {Function} Returns the new wrapped function.
  14004. */
  14005. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  14006. var isCurry = bitmask & WRAP_CURRY_FLAG,
  14007. newHolders = isCurry ? holders : undefined,
  14008. newHoldersRight = isCurry ? undefined : holders,
  14009. newPartials = isCurry ? partials : undefined,
  14010. newPartialsRight = isCurry ? undefined : partials;
  14011. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  14012. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  14013. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  14014. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  14015. }
  14016. var newData = [
  14017. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  14018. newHoldersRight, argPos, ary, arity
  14019. ];
  14020. var result = wrapFunc.apply(undefined, newData);
  14021. if (isLaziable(func)) {
  14022. setData(result, newData);
  14023. }
  14024. result.placeholder = placeholder;
  14025. return setWrapToString(result, func, bitmask);
  14026. }
  14027. /**
  14028. * Creates a function like `_.round`.
  14029. *
  14030. * @private
  14031. * @param {string} methodName The name of the `Math` method to use when rounding.
  14032. * @returns {Function} Returns the new round function.
  14033. */
  14034. function createRound(methodName) {
  14035. var func = Math[methodName];
  14036. return function(number, precision) {
  14037. number = toNumber(number);
  14038. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  14039. if (precision) {
  14040. // Shift with exponential notation to avoid floating-point issues.
  14041. // See [MDN](https://mdn.io/round#Examples) for more details.
  14042. var pair = (toString(number) + 'e').split('e'),
  14043. value = func(pair[0] + 'e' + (+pair[1] + precision));
  14044. pair = (toString(value) + 'e').split('e');
  14045. return +(pair[0] + 'e' + (+pair[1] - precision));
  14046. }
  14047. return func(number);
  14048. };
  14049. }
  14050. /**
  14051. * Creates a set object of `values`.
  14052. *
  14053. * @private
  14054. * @param {Array} values The values to add to the set.
  14055. * @returns {Object} Returns the new set.
  14056. */
  14057. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  14058. return new Set(values);
  14059. };
  14060. /**
  14061. * Creates a `_.toPairs` or `_.toPairsIn` function.
  14062. *
  14063. * @private
  14064. * @param {Function} keysFunc The function to get the keys of a given object.
  14065. * @returns {Function} Returns the new pairs function.
  14066. */
  14067. function createToPairs(keysFunc) {
  14068. return function(object) {
  14069. var tag = getTag(object);
  14070. if (tag == mapTag) {
  14071. return mapToArray(object);
  14072. }
  14073. if (tag == setTag) {
  14074. return setToPairs(object);
  14075. }
  14076. return baseToPairs(object, keysFunc(object));
  14077. };
  14078. }
  14079. /**
  14080. * Creates a function that either curries or invokes `func` with optional
  14081. * `this` binding and partially applied arguments.
  14082. *
  14083. * @private
  14084. * @param {Function|string} func The function or method name to wrap.
  14085. * @param {number} bitmask The bitmask flags.
  14086. * 1 - `_.bind`
  14087. * 2 - `_.bindKey`
  14088. * 4 - `_.curry` or `_.curryRight` of a bound function
  14089. * 8 - `_.curry`
  14090. * 16 - `_.curryRight`
  14091. * 32 - `_.partial`
  14092. * 64 - `_.partialRight`
  14093. * 128 - `_.rearg`
  14094. * 256 - `_.ary`
  14095. * 512 - `_.flip`
  14096. * @param {*} [thisArg] The `this` binding of `func`.
  14097. * @param {Array} [partials] The arguments to be partially applied.
  14098. * @param {Array} [holders] The `partials` placeholder indexes.
  14099. * @param {Array} [argPos] The argument positions of the new function.
  14100. * @param {number} [ary] The arity cap of `func`.
  14101. * @param {number} [arity] The arity of `func`.
  14102. * @returns {Function} Returns the new wrapped function.
  14103. */
  14104. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  14105. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  14106. if (!isBindKey && typeof func != 'function') {
  14107. throw new TypeError(FUNC_ERROR_TEXT);
  14108. }
  14109. var length = partials ? partials.length : 0;
  14110. if (!length) {
  14111. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  14112. partials = holders = undefined;
  14113. }
  14114. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  14115. arity = arity === undefined ? arity : toInteger(arity);
  14116. length -= holders ? holders.length : 0;
  14117. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  14118. var partialsRight = partials,
  14119. holdersRight = holders;
  14120. partials = holders = undefined;
  14121. }
  14122. var data = isBindKey ? undefined : getData(func);
  14123. var newData = [
  14124. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  14125. argPos, ary, arity
  14126. ];
  14127. if (data) {
  14128. mergeData(newData, data);
  14129. }
  14130. func = newData[0];
  14131. bitmask = newData[1];
  14132. thisArg = newData[2];
  14133. partials = newData[3];
  14134. holders = newData[4];
  14135. arity = newData[9] = newData[9] === undefined
  14136. ? (isBindKey ? 0 : func.length)
  14137. : nativeMax(newData[9] - length, 0);
  14138. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  14139. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  14140. }
  14141. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  14142. var result = createBind(func, bitmask, thisArg);
  14143. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  14144. result = createCurry(func, bitmask, arity);
  14145. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  14146. result = createPartial(func, bitmask, thisArg, partials);
  14147. } else {
  14148. result = createHybrid.apply(undefined, newData);
  14149. }
  14150. var setter = data ? baseSetData : setData;
  14151. return setWrapToString(setter(result, newData), func, bitmask);
  14152. }
  14153. /**
  14154. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  14155. * of source objects to the destination object for all destination properties
  14156. * that resolve to `undefined`.
  14157. *
  14158. * @private
  14159. * @param {*} objValue The destination value.
  14160. * @param {*} srcValue The source value.
  14161. * @param {string} key The key of the property to assign.
  14162. * @param {Object} object The parent object of `objValue`.
  14163. * @returns {*} Returns the value to assign.
  14164. */
  14165. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  14166. if (objValue === undefined ||
  14167. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  14168. return srcValue;
  14169. }
  14170. return objValue;
  14171. }
  14172. /**
  14173. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  14174. * objects into destination objects that are passed thru.
  14175. *
  14176. * @private
  14177. * @param {*} objValue The destination value.
  14178. * @param {*} srcValue The source value.
  14179. * @param {string} key The key of the property to merge.
  14180. * @param {Object} object The parent object of `objValue`.
  14181. * @param {Object} source The parent object of `srcValue`.
  14182. * @param {Object} [stack] Tracks traversed source values and their merged
  14183. * counterparts.
  14184. * @returns {*} Returns the value to assign.
  14185. */
  14186. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  14187. if (isObject(objValue) && isObject(srcValue)) {
  14188. // Recursively merge objects and arrays (susceptible to call stack limits).
  14189. stack.set(srcValue, objValue);
  14190. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  14191. stack['delete'](srcValue);
  14192. }
  14193. return objValue;
  14194. }
  14195. /**
  14196. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  14197. * objects.
  14198. *
  14199. * @private
  14200. * @param {*} value The value to inspect.
  14201. * @param {string} key The key of the property to inspect.
  14202. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  14203. */
  14204. function customOmitClone(value) {
  14205. return isPlainObject(value) ? undefined : value;
  14206. }
  14207. /**
  14208. * A specialized version of `baseIsEqualDeep` for arrays with support for
  14209. * partial deep comparisons.
  14210. *
  14211. * @private
  14212. * @param {Array} array The array to compare.
  14213. * @param {Array} other The other array to compare.
  14214. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14215. * @param {Function} customizer The function to customize comparisons.
  14216. * @param {Function} equalFunc The function to determine equivalents of values.
  14217. * @param {Object} stack Tracks traversed `array` and `other` objects.
  14218. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  14219. */
  14220. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  14221. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  14222. arrLength = array.length,
  14223. othLength = other.length;
  14224. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  14225. return false;
  14226. }
  14227. // Assume cyclic values are equal.
  14228. var stacked = stack.get(array);
  14229. if (stacked && stack.get(other)) {
  14230. return stacked == other;
  14231. }
  14232. var index = -1,
  14233. result = true,
  14234. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  14235. stack.set(array, other);
  14236. stack.set(other, array);
  14237. // Ignore non-index properties.
  14238. while (++index < arrLength) {
  14239. var arrValue = array[index],
  14240. othValue = other[index];
  14241. if (customizer) {
  14242. var compared = isPartial
  14243. ? customizer(othValue, arrValue, index, other, array, stack)
  14244. : customizer(arrValue, othValue, index, array, other, stack);
  14245. }
  14246. if (compared !== undefined) {
  14247. if (compared) {
  14248. continue;
  14249. }
  14250. result = false;
  14251. break;
  14252. }
  14253. // Recursively compare arrays (susceptible to call stack limits).
  14254. if (seen) {
  14255. if (!arraySome(other, function(othValue, othIndex) {
  14256. if (!cacheHas(seen, othIndex) &&
  14257. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  14258. return seen.push(othIndex);
  14259. }
  14260. })) {
  14261. result = false;
  14262. break;
  14263. }
  14264. } else if (!(
  14265. arrValue === othValue ||
  14266. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  14267. )) {
  14268. result = false;
  14269. break;
  14270. }
  14271. }
  14272. stack['delete'](array);
  14273. stack['delete'](other);
  14274. return result;
  14275. }
  14276. /**
  14277. * A specialized version of `baseIsEqualDeep` for comparing objects of
  14278. * the same `toStringTag`.
  14279. *
  14280. * **Note:** This function only supports comparing values with tags of
  14281. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  14282. *
  14283. * @private
  14284. * @param {Object} object The object to compare.
  14285. * @param {Object} other The other object to compare.
  14286. * @param {string} tag The `toStringTag` of the objects to compare.
  14287. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14288. * @param {Function} customizer The function to customize comparisons.
  14289. * @param {Function} equalFunc The function to determine equivalents of values.
  14290. * @param {Object} stack Tracks traversed `object` and `other` objects.
  14291. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14292. */
  14293. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  14294. switch (tag) {
  14295. case dataViewTag:
  14296. if ((object.byteLength != other.byteLength) ||
  14297. (object.byteOffset != other.byteOffset)) {
  14298. return false;
  14299. }
  14300. object = object.buffer;
  14301. other = other.buffer;
  14302. case arrayBufferTag:
  14303. if ((object.byteLength != other.byteLength) ||
  14304. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  14305. return false;
  14306. }
  14307. return true;
  14308. case boolTag:
  14309. case dateTag:
  14310. case numberTag:
  14311. // Coerce booleans to `1` or `0` and dates to milliseconds.
  14312. // Invalid dates are coerced to `NaN`.
  14313. return eq(+object, +other);
  14314. case errorTag:
  14315. return object.name == other.name && object.message == other.message;
  14316. case regexpTag:
  14317. case stringTag:
  14318. // Coerce regexes to strings and treat strings, primitives and objects,
  14319. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  14320. // for more details.
  14321. return object == (other + '');
  14322. case mapTag:
  14323. var convert = mapToArray;
  14324. case setTag:
  14325. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  14326. convert || (convert = setToArray);
  14327. if (object.size != other.size && !isPartial) {
  14328. return false;
  14329. }
  14330. // Assume cyclic values are equal.
  14331. var stacked = stack.get(object);
  14332. if (stacked) {
  14333. return stacked == other;
  14334. }
  14335. bitmask |= COMPARE_UNORDERED_FLAG;
  14336. // Recursively compare objects (susceptible to call stack limits).
  14337. stack.set(object, other);
  14338. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  14339. stack['delete'](object);
  14340. return result;
  14341. case symbolTag:
  14342. if (symbolValueOf) {
  14343. return symbolValueOf.call(object) == symbolValueOf.call(other);
  14344. }
  14345. }
  14346. return false;
  14347. }
  14348. /**
  14349. * A specialized version of `baseIsEqualDeep` for objects with support for
  14350. * partial deep comparisons.
  14351. *
  14352. * @private
  14353. * @param {Object} object The object to compare.
  14354. * @param {Object} other The other object to compare.
  14355. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14356. * @param {Function} customizer The function to customize comparisons.
  14357. * @param {Function} equalFunc The function to determine equivalents of values.
  14358. * @param {Object} stack Tracks traversed `object` and `other` objects.
  14359. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14360. */
  14361. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  14362. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  14363. objProps = getAllKeys(object),
  14364. objLength = objProps.length,
  14365. othProps = getAllKeys(other),
  14366. othLength = othProps.length;
  14367. if (objLength != othLength && !isPartial) {
  14368. return false;
  14369. }
  14370. var index = objLength;
  14371. while (index--) {
  14372. var key = objProps[index];
  14373. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  14374. return false;
  14375. }
  14376. }
  14377. // Assume cyclic values are equal.
  14378. var stacked = stack.get(object);
  14379. if (stacked && stack.get(other)) {
  14380. return stacked == other;
  14381. }
  14382. var result = true;
  14383. stack.set(object, other);
  14384. stack.set(other, object);
  14385. var skipCtor = isPartial;
  14386. while (++index < objLength) {
  14387. key = objProps[index];
  14388. var objValue = object[key],
  14389. othValue = other[key];
  14390. if (customizer) {
  14391. var compared = isPartial
  14392. ? customizer(othValue, objValue, key, other, object, stack)
  14393. : customizer(objValue, othValue, key, object, other, stack);
  14394. }
  14395. // Recursively compare objects (susceptible to call stack limits).
  14396. if (!(compared === undefined
  14397. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  14398. : compared
  14399. )) {
  14400. result = false;
  14401. break;
  14402. }
  14403. skipCtor || (skipCtor = key == 'constructor');
  14404. }
  14405. if (result && !skipCtor) {
  14406. var objCtor = object.constructor,
  14407. othCtor = other.constructor;
  14408. // Non `Object` object instances with different constructors are not equal.
  14409. if (objCtor != othCtor &&
  14410. ('constructor' in object && 'constructor' in other) &&
  14411. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  14412. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  14413. result = false;
  14414. }
  14415. }
  14416. stack['delete'](object);
  14417. stack['delete'](other);
  14418. return result;
  14419. }
  14420. /**
  14421. * A specialized version of `baseRest` which flattens the rest array.
  14422. *
  14423. * @private
  14424. * @param {Function} func The function to apply a rest parameter to.
  14425. * @returns {Function} Returns the new function.
  14426. */
  14427. function flatRest(func) {
  14428. return setToString(overRest(func, undefined, flatten), func + '');
  14429. }
  14430. /**
  14431. * Creates an array of own enumerable property names and symbols of `object`.
  14432. *
  14433. * @private
  14434. * @param {Object} object The object to query.
  14435. * @returns {Array} Returns the array of property names and symbols.
  14436. */
  14437. function getAllKeys(object) {
  14438. return baseGetAllKeys(object, keys, getSymbols);
  14439. }
  14440. /**
  14441. * Creates an array of own and inherited enumerable property names and
  14442. * symbols of `object`.
  14443. *
  14444. * @private
  14445. * @param {Object} object The object to query.
  14446. * @returns {Array} Returns the array of property names and symbols.
  14447. */
  14448. function getAllKeysIn(object) {
  14449. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  14450. }
  14451. /**
  14452. * Gets metadata for `func`.
  14453. *
  14454. * @private
  14455. * @param {Function} func The function to query.
  14456. * @returns {*} Returns the metadata for `func`.
  14457. */
  14458. var getData = !metaMap ? noop : function(func) {
  14459. return metaMap.get(func);
  14460. };
  14461. /**
  14462. * Gets the name of `func`.
  14463. *
  14464. * @private
  14465. * @param {Function} func The function to query.
  14466. * @returns {string} Returns the function name.
  14467. */
  14468. function getFuncName(func) {
  14469. var result = (func.name + ''),
  14470. array = realNames[result],
  14471. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  14472. while (length--) {
  14473. var data = array[length],
  14474. otherFunc = data.func;
  14475. if (otherFunc == null || otherFunc == func) {
  14476. return data.name;
  14477. }
  14478. }
  14479. return result;
  14480. }
  14481. /**
  14482. * Gets the argument placeholder value for `func`.
  14483. *
  14484. * @private
  14485. * @param {Function} func The function to inspect.
  14486. * @returns {*} Returns the placeholder value.
  14487. */
  14488. function getHolder(func) {
  14489. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  14490. return object.placeholder;
  14491. }
  14492. /**
  14493. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  14494. * this function returns the custom method, otherwise it returns `baseIteratee`.
  14495. * If arguments are provided, the chosen function is invoked with them and
  14496. * its result is returned.
  14497. *
  14498. * @private
  14499. * @param {*} [value] The value to convert to an iteratee.
  14500. * @param {number} [arity] The arity of the created iteratee.
  14501. * @returns {Function} Returns the chosen function or its result.
  14502. */
  14503. function getIteratee() {
  14504. var result = lodash.iteratee || iteratee;
  14505. result = result === iteratee ? baseIteratee : result;
  14506. return arguments.length ? result(arguments[0], arguments[1]) : result;
  14507. }
  14508. /**
  14509. * Gets the data for `map`.
  14510. *
  14511. * @private
  14512. * @param {Object} map The map to query.
  14513. * @param {string} key The reference key.
  14514. * @returns {*} Returns the map data.
  14515. */
  14516. function getMapData(map, key) {
  14517. var data = map.__data__;
  14518. return isKeyable(key)
  14519. ? data[typeof key == 'string' ? 'string' : 'hash']
  14520. : data.map;
  14521. }
  14522. /**
  14523. * Gets the property names, values, and compare flags of `object`.
  14524. *
  14525. * @private
  14526. * @param {Object} object The object to query.
  14527. * @returns {Array} Returns the match data of `object`.
  14528. */
  14529. function getMatchData(object) {
  14530. var result = keys(object),
  14531. length = result.length;
  14532. while (length--) {
  14533. var key = result[length],
  14534. value = object[key];
  14535. result[length] = [key, value, isStrictComparable(value)];
  14536. }
  14537. return result;
  14538. }
  14539. /**
  14540. * Gets the native function at `key` of `object`.
  14541. *
  14542. * @private
  14543. * @param {Object} object The object to query.
  14544. * @param {string} key The key of the method to get.
  14545. * @returns {*} Returns the function if it's native, else `undefined`.
  14546. */
  14547. function getNative(object, key) {
  14548. var value = getValue(object, key);
  14549. return baseIsNative(value) ? value : undefined;
  14550. }
  14551. /**
  14552. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  14553. *
  14554. * @private
  14555. * @param {*} value The value to query.
  14556. * @returns {string} Returns the raw `toStringTag`.
  14557. */
  14558. function getRawTag(value) {
  14559. var isOwn = hasOwnProperty.call(value, symToStringTag),
  14560. tag = value[symToStringTag];
  14561. try {
  14562. value[symToStringTag] = undefined;
  14563. var unmasked = true;
  14564. } catch (e) {}
  14565. var result = nativeObjectToString.call(value);
  14566. if (unmasked) {
  14567. if (isOwn) {
  14568. value[symToStringTag] = tag;
  14569. } else {
  14570. delete value[symToStringTag];
  14571. }
  14572. }
  14573. return result;
  14574. }
  14575. /**
  14576. * Creates an array of the own enumerable symbols of `object`.
  14577. *
  14578. * @private
  14579. * @param {Object} object The object to query.
  14580. * @returns {Array} Returns the array of symbols.
  14581. */
  14582. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  14583. if (object == null) {
  14584. return [];
  14585. }
  14586. object = Object(object);
  14587. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  14588. return propertyIsEnumerable.call(object, symbol);
  14589. });
  14590. };
  14591. /**
  14592. * Creates an array of the own and inherited enumerable symbols of `object`.
  14593. *
  14594. * @private
  14595. * @param {Object} object The object to query.
  14596. * @returns {Array} Returns the array of symbols.
  14597. */
  14598. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  14599. var result = [];
  14600. while (object) {
  14601. arrayPush(result, getSymbols(object));
  14602. object = getPrototype(object);
  14603. }
  14604. return result;
  14605. };
  14606. /**
  14607. * Gets the `toStringTag` of `value`.
  14608. *
  14609. * @private
  14610. * @param {*} value The value to query.
  14611. * @returns {string} Returns the `toStringTag`.
  14612. */
  14613. var getTag = baseGetTag;
  14614. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  14615. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  14616. (Map && getTag(new Map) != mapTag) ||
  14617. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  14618. (Set && getTag(new Set) != setTag) ||
  14619. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  14620. getTag = function(value) {
  14621. var result = baseGetTag(value),
  14622. Ctor = result == objectTag ? value.constructor : undefined,
  14623. ctorString = Ctor ? toSource(Ctor) : '';
  14624. if (ctorString) {
  14625. switch (ctorString) {
  14626. case dataViewCtorString: return dataViewTag;
  14627. case mapCtorString: return mapTag;
  14628. case promiseCtorString: return promiseTag;
  14629. case setCtorString: return setTag;
  14630. case weakMapCtorString: return weakMapTag;
  14631. }
  14632. }
  14633. return result;
  14634. };
  14635. }
  14636. /**
  14637. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  14638. *
  14639. * @private
  14640. * @param {number} start The start of the view.
  14641. * @param {number} end The end of the view.
  14642. * @param {Array} transforms The transformations to apply to the view.
  14643. * @returns {Object} Returns an object containing the `start` and `end`
  14644. * positions of the view.
  14645. */
  14646. function getView(start, end, transforms) {
  14647. var index = -1,
  14648. length = transforms.length;
  14649. while (++index < length) {
  14650. var data = transforms[index],
  14651. size = data.size;
  14652. switch (data.type) {
  14653. case 'drop': start += size; break;
  14654. case 'dropRight': end -= size; break;
  14655. case 'take': end = nativeMin(end, start + size); break;
  14656. case 'takeRight': start = nativeMax(start, end - size); break;
  14657. }
  14658. }
  14659. return { 'start': start, 'end': end };
  14660. }
  14661. /**
  14662. * Extracts wrapper details from the `source` body comment.
  14663. *
  14664. * @private
  14665. * @param {string} source The source to inspect.
  14666. * @returns {Array} Returns the wrapper details.
  14667. */
  14668. function getWrapDetails(source) {
  14669. var match = source.match(reWrapDetails);
  14670. return match ? match[1].split(reSplitDetails) : [];
  14671. }
  14672. /**
  14673. * Checks if `path` exists on `object`.
  14674. *
  14675. * @private
  14676. * @param {Object} object The object to query.
  14677. * @param {Array|string} path The path to check.
  14678. * @param {Function} hasFunc The function to check properties.
  14679. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14680. */
  14681. function hasPath(object, path, hasFunc) {
  14682. path = castPath(path, object);
  14683. var index = -1,
  14684. length = path.length,
  14685. result = false;
  14686. while (++index < length) {
  14687. var key = toKey(path[index]);
  14688. if (!(result = object != null && hasFunc(object, key))) {
  14689. break;
  14690. }
  14691. object = object[key];
  14692. }
  14693. if (result || ++index != length) {
  14694. return result;
  14695. }
  14696. length = object == null ? 0 : object.length;
  14697. return !!length && isLength(length) && isIndex(key, length) &&
  14698. (isArray(object) || isArguments(object));
  14699. }
  14700. /**
  14701. * Initializes an array clone.
  14702. *
  14703. * @private
  14704. * @param {Array} array The array to clone.
  14705. * @returns {Array} Returns the initialized clone.
  14706. */
  14707. function initCloneArray(array) {
  14708. var length = array.length,
  14709. result = array.constructor(length);
  14710. // Add properties assigned by `RegExp#exec`.
  14711. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  14712. result.index = array.index;
  14713. result.input = array.input;
  14714. }
  14715. return result;
  14716. }
  14717. /**
  14718. * Initializes an object clone.
  14719. *
  14720. * @private
  14721. * @param {Object} object The object to clone.
  14722. * @returns {Object} Returns the initialized clone.
  14723. */
  14724. function initCloneObject(object) {
  14725. return (typeof object.constructor == 'function' && !isPrototype(object))
  14726. ? baseCreate(getPrototype(object))
  14727. : {};
  14728. }
  14729. /**
  14730. * Initializes an object clone based on its `toStringTag`.
  14731. *
  14732. * **Note:** This function only supports cloning values with tags of
  14733. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  14734. *
  14735. * @private
  14736. * @param {Object} object The object to clone.
  14737. * @param {string} tag The `toStringTag` of the object to clone.
  14738. * @param {Function} cloneFunc The function to clone values.
  14739. * @param {boolean} [isDeep] Specify a deep clone.
  14740. * @returns {Object} Returns the initialized clone.
  14741. */
  14742. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  14743. var Ctor = object.constructor;
  14744. switch (tag) {
  14745. case arrayBufferTag:
  14746. return cloneArrayBuffer(object);
  14747. case boolTag:
  14748. case dateTag:
  14749. return new Ctor(+object);
  14750. case dataViewTag:
  14751. return cloneDataView(object, isDeep);
  14752. case float32Tag: case float64Tag:
  14753. case int8Tag: case int16Tag: case int32Tag:
  14754. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  14755. return cloneTypedArray(object, isDeep);
  14756. case mapTag:
  14757. return cloneMap(object, isDeep, cloneFunc);
  14758. case numberTag:
  14759. case stringTag:
  14760. return new Ctor(object);
  14761. case regexpTag:
  14762. return cloneRegExp(object);
  14763. case setTag:
  14764. return cloneSet(object, isDeep, cloneFunc);
  14765. case symbolTag:
  14766. return cloneSymbol(object);
  14767. }
  14768. }
  14769. /**
  14770. * Inserts wrapper `details` in a comment at the top of the `source` body.
  14771. *
  14772. * @private
  14773. * @param {string} source The source to modify.
  14774. * @returns {Array} details The details to insert.
  14775. * @returns {string} Returns the modified source.
  14776. */
  14777. function insertWrapDetails(source, details) {
  14778. var length = details.length;
  14779. if (!length) {
  14780. return source;
  14781. }
  14782. var lastIndex = length - 1;
  14783. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  14784. details = details.join(length > 2 ? ', ' : ' ');
  14785. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  14786. }
  14787. /**
  14788. * Checks if `value` is a flattenable `arguments` object or array.
  14789. *
  14790. * @private
  14791. * @param {*} value The value to check.
  14792. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  14793. */
  14794. function isFlattenable(value) {
  14795. return isArray(value) || isArguments(value) ||
  14796. !!(spreadableSymbol && value && value[spreadableSymbol]);
  14797. }
  14798. /**
  14799. * Checks if `value` is a valid array-like index.
  14800. *
  14801. * @private
  14802. * @param {*} value The value to check.
  14803. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  14804. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  14805. */
  14806. function isIndex(value, length) {
  14807. length = length == null ? MAX_SAFE_INTEGER : length;
  14808. return !!length &&
  14809. (typeof value == 'number' || reIsUint.test(value)) &&
  14810. (value > -1 && value % 1 == 0 && value < length);
  14811. }
  14812. /**
  14813. * Checks if the given arguments are from an iteratee call.
  14814. *
  14815. * @private
  14816. * @param {*} value The potential iteratee value argument.
  14817. * @param {*} index The potential iteratee index or key argument.
  14818. * @param {*} object The potential iteratee object argument.
  14819. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  14820. * else `false`.
  14821. */
  14822. function isIterateeCall(value, index, object) {
  14823. if (!isObject(object)) {
  14824. return false;
  14825. }
  14826. var type = typeof index;
  14827. if (type == 'number'
  14828. ? (isArrayLike(object) && isIndex(index, object.length))
  14829. : (type == 'string' && index in object)
  14830. ) {
  14831. return eq(object[index], value);
  14832. }
  14833. return false;
  14834. }
  14835. /**
  14836. * Checks if `value` is a property name and not a property path.
  14837. *
  14838. * @private
  14839. * @param {*} value The value to check.
  14840. * @param {Object} [object] The object to query keys on.
  14841. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  14842. */
  14843. function isKey(value, object) {
  14844. if (isArray(value)) {
  14845. return false;
  14846. }
  14847. var type = typeof value;
  14848. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  14849. value == null || isSymbol(value)) {
  14850. return true;
  14851. }
  14852. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  14853. (object != null && value in Object(object));
  14854. }
  14855. /**
  14856. * Checks if `value` is suitable for use as unique object key.
  14857. *
  14858. * @private
  14859. * @param {*} value The value to check.
  14860. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  14861. */
  14862. function isKeyable(value) {
  14863. var type = typeof value;
  14864. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  14865. ? (value !== '__proto__')
  14866. : (value === null);
  14867. }
  14868. /**
  14869. * Checks if `func` has a lazy counterpart.
  14870. *
  14871. * @private
  14872. * @param {Function} func The function to check.
  14873. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  14874. * else `false`.
  14875. */
  14876. function isLaziable(func) {
  14877. var funcName = getFuncName(func),
  14878. other = lodash[funcName];
  14879. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  14880. return false;
  14881. }
  14882. if (func === other) {
  14883. return true;
  14884. }
  14885. var data = getData(other);
  14886. return !!data && func === data[0];
  14887. }
  14888. /**
  14889. * Checks if `func` has its source masked.
  14890. *
  14891. * @private
  14892. * @param {Function} func The function to check.
  14893. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  14894. */
  14895. function isMasked(func) {
  14896. return !!maskSrcKey && (maskSrcKey in func);
  14897. }
  14898. /**
  14899. * Checks if `func` is capable of being masked.
  14900. *
  14901. * @private
  14902. * @param {*} value The value to check.
  14903. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  14904. */
  14905. var isMaskable = coreJsData ? isFunction : stubFalse;
  14906. /**
  14907. * Checks if `value` is likely a prototype object.
  14908. *
  14909. * @private
  14910. * @param {*} value The value to check.
  14911. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  14912. */
  14913. function isPrototype(value) {
  14914. var Ctor = value && value.constructor,
  14915. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  14916. return value === proto;
  14917. }
  14918. /**
  14919. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  14920. *
  14921. * @private
  14922. * @param {*} value The value to check.
  14923. * @returns {boolean} Returns `true` if `value` if suitable for strict
  14924. * equality comparisons, else `false`.
  14925. */
  14926. function isStrictComparable(value) {
  14927. return value === value && !isObject(value);
  14928. }
  14929. /**
  14930. * A specialized version of `matchesProperty` for source values suitable
  14931. * for strict equality comparisons, i.e. `===`.
  14932. *
  14933. * @private
  14934. * @param {string} key The key of the property to get.
  14935. * @param {*} srcValue The value to match.
  14936. * @returns {Function} Returns the new spec function.
  14937. */
  14938. function matchesStrictComparable(key, srcValue) {
  14939. return function(object) {
  14940. if (object == null) {
  14941. return false;
  14942. }
  14943. return object[key] === srcValue &&
  14944. (srcValue !== undefined || (key in Object(object)));
  14945. };
  14946. }
  14947. /**
  14948. * A specialized version of `_.memoize` which clears the memoized function's
  14949. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  14950. *
  14951. * @private
  14952. * @param {Function} func The function to have its output memoized.
  14953. * @returns {Function} Returns the new memoized function.
  14954. */
  14955. function memoizeCapped(func) {
  14956. var result = memoize(func, function(key) {
  14957. if (cache.size === MAX_MEMOIZE_SIZE) {
  14958. cache.clear();
  14959. }
  14960. return key;
  14961. });
  14962. var cache = result.cache;
  14963. return result;
  14964. }
  14965. /**
  14966. * Merges the function metadata of `source` into `data`.
  14967. *
  14968. * Merging metadata reduces the number of wrappers used to invoke a function.
  14969. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  14970. * may be applied regardless of execution order. Methods like `_.ary` and
  14971. * `_.rearg` modify function arguments, making the order in which they are
  14972. * executed important, preventing the merging of metadata. However, we make
  14973. * an exception for a safe combined case where curried functions have `_.ary`
  14974. * and or `_.rearg` applied.
  14975. *
  14976. * @private
  14977. * @param {Array} data The destination metadata.
  14978. * @param {Array} source The source metadata.
  14979. * @returns {Array} Returns `data`.
  14980. */
  14981. function mergeData(data, source) {
  14982. var bitmask = data[1],
  14983. srcBitmask = source[1],
  14984. newBitmask = bitmask | srcBitmask,
  14985. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  14986. var isCombo =
  14987. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  14988. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  14989. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  14990. // Exit early if metadata can't be merged.
  14991. if (!(isCommon || isCombo)) {
  14992. return data;
  14993. }
  14994. // Use source `thisArg` if available.
  14995. if (srcBitmask & WRAP_BIND_FLAG) {
  14996. data[2] = source[2];
  14997. // Set when currying a bound function.
  14998. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  14999. }
  15000. // Compose partial arguments.
  15001. var value = source[3];
  15002. if (value) {
  15003. var partials = data[3];
  15004. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  15005. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  15006. }
  15007. // Compose partial right arguments.
  15008. value = source[5];
  15009. if (value) {
  15010. partials = data[5];
  15011. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  15012. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  15013. }
  15014. // Use source `argPos` if available.
  15015. value = source[7];
  15016. if (value) {
  15017. data[7] = value;
  15018. }
  15019. // Use source `ary` if it's smaller.
  15020. if (srcBitmask & WRAP_ARY_FLAG) {
  15021. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  15022. }
  15023. // Use source `arity` if one is not provided.
  15024. if (data[9] == null) {
  15025. data[9] = source[9];
  15026. }
  15027. // Use source `func` and merge bitmasks.
  15028. data[0] = source[0];
  15029. data[1] = newBitmask;
  15030. return data;
  15031. }
  15032. /**
  15033. * This function is like
  15034. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  15035. * except that it includes inherited enumerable properties.
  15036. *
  15037. * @private
  15038. * @param {Object} object The object to query.
  15039. * @returns {Array} Returns the array of property names.
  15040. */
  15041. function nativeKeysIn(object) {
  15042. var result = [];
  15043. if (object != null) {
  15044. for (var key in Object(object)) {
  15045. result.push(key);
  15046. }
  15047. }
  15048. return result;
  15049. }
  15050. /**
  15051. * Converts `value` to a string using `Object.prototype.toString`.
  15052. *
  15053. * @private
  15054. * @param {*} value The value to convert.
  15055. * @returns {string} Returns the converted string.
  15056. */
  15057. function objectToString(value) {
  15058. return nativeObjectToString.call(value);
  15059. }
  15060. /**
  15061. * A specialized version of `baseRest` which transforms the rest array.
  15062. *
  15063. * @private
  15064. * @param {Function} func The function to apply a rest parameter to.
  15065. * @param {number} [start=func.length-1] The start position of the rest parameter.
  15066. * @param {Function} transform The rest array transform.
  15067. * @returns {Function} Returns the new function.
  15068. */
  15069. function overRest(func, start, transform) {
  15070. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  15071. return function() {
  15072. var args = arguments,
  15073. index = -1,
  15074. length = nativeMax(args.length - start, 0),
  15075. array = Array(length);
  15076. while (++index < length) {
  15077. array[index] = args[start + index];
  15078. }
  15079. index = -1;
  15080. var otherArgs = Array(start + 1);
  15081. while (++index < start) {
  15082. otherArgs[index] = args[index];
  15083. }
  15084. otherArgs[start] = transform(array);
  15085. return apply(func, this, otherArgs);
  15086. };
  15087. }
  15088. /**
  15089. * Gets the parent value at `path` of `object`.
  15090. *
  15091. * @private
  15092. * @param {Object} object The object to query.
  15093. * @param {Array} path The path to get the parent value of.
  15094. * @returns {*} Returns the parent value.
  15095. */
  15096. function parent(object, path) {
  15097. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  15098. }
  15099. /**
  15100. * Reorder `array` according to the specified indexes where the element at
  15101. * the first index is assigned as the first element, the element at
  15102. * the second index is assigned as the second element, and so on.
  15103. *
  15104. * @private
  15105. * @param {Array} array The array to reorder.
  15106. * @param {Array} indexes The arranged array indexes.
  15107. * @returns {Array} Returns `array`.
  15108. */
  15109. function reorder(array, indexes) {
  15110. var arrLength = array.length,
  15111. length = nativeMin(indexes.length, arrLength),
  15112. oldArray = copyArray(array);
  15113. while (length--) {
  15114. var index = indexes[length];
  15115. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  15116. }
  15117. return array;
  15118. }
  15119. /**
  15120. * Sets metadata for `func`.
  15121. *
  15122. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  15123. * period of time, it will trip its breaker and transition to an identity
  15124. * function to avoid garbage collection pauses in V8. See
  15125. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  15126. * for more details.
  15127. *
  15128. * @private
  15129. * @param {Function} func The function to associate metadata with.
  15130. * @param {*} data The metadata.
  15131. * @returns {Function} Returns `func`.
  15132. */
  15133. var setData = shortOut(baseSetData);
  15134. /**
  15135. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  15136. *
  15137. * @private
  15138. * @param {Function} func The function to delay.
  15139. * @param {number} wait The number of milliseconds to delay invocation.
  15140. * @returns {number|Object} Returns the timer id or timeout object.
  15141. */
  15142. var setTimeout = ctxSetTimeout || function(func, wait) {
  15143. return root.setTimeout(func, wait);
  15144. };
  15145. /**
  15146. * Sets the `toString` method of `func` to return `string`.
  15147. *
  15148. * @private
  15149. * @param {Function} func The function to modify.
  15150. * @param {Function} string The `toString` result.
  15151. * @returns {Function} Returns `func`.
  15152. */
  15153. var setToString = shortOut(baseSetToString);
  15154. /**
  15155. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  15156. * with wrapper details in a comment at the top of the source body.
  15157. *
  15158. * @private
  15159. * @param {Function} wrapper The function to modify.
  15160. * @param {Function} reference The reference function.
  15161. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  15162. * @returns {Function} Returns `wrapper`.
  15163. */
  15164. function setWrapToString(wrapper, reference, bitmask) {
  15165. var source = (reference + '');
  15166. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  15167. }
  15168. /**
  15169. * Creates a function that'll short out and invoke `identity` instead
  15170. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  15171. * milliseconds.
  15172. *
  15173. * @private
  15174. * @param {Function} func The function to restrict.
  15175. * @returns {Function} Returns the new shortable function.
  15176. */
  15177. function shortOut(func) {
  15178. var count = 0,
  15179. lastCalled = 0;
  15180. return function() {
  15181. var stamp = nativeNow(),
  15182. remaining = HOT_SPAN - (stamp - lastCalled);
  15183. lastCalled = stamp;
  15184. if (remaining > 0) {
  15185. if (++count >= HOT_COUNT) {
  15186. return arguments[0];
  15187. }
  15188. } else {
  15189. count = 0;
  15190. }
  15191. return func.apply(undefined, arguments);
  15192. };
  15193. }
  15194. /**
  15195. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  15196. *
  15197. * @private
  15198. * @param {Array} array The array to shuffle.
  15199. * @param {number} [size=array.length] The size of `array`.
  15200. * @returns {Array} Returns `array`.
  15201. */
  15202. function shuffleSelf(array, size) {
  15203. var index = -1,
  15204. length = array.length,
  15205. lastIndex = length - 1;
  15206. size = size === undefined ? length : size;
  15207. while (++index < size) {
  15208. var rand = baseRandom(index, lastIndex),
  15209. value = array[rand];
  15210. array[rand] = array[index];
  15211. array[index] = value;
  15212. }
  15213. array.length = size;
  15214. return array;
  15215. }
  15216. /**
  15217. * Converts `string` to a property path array.
  15218. *
  15219. * @private
  15220. * @param {string} string The string to convert.
  15221. * @returns {Array} Returns the property path array.
  15222. */
  15223. var stringToPath = memoizeCapped(function(string) {
  15224. var result = [];
  15225. if (reLeadingDot.test(string)) {
  15226. result.push('');
  15227. }
  15228. string.replace(rePropName, function(match, number, quote, string) {
  15229. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  15230. });
  15231. return result;
  15232. });
  15233. /**
  15234. * Converts `value` to a string key if it's not a string or symbol.
  15235. *
  15236. * @private
  15237. * @param {*} value The value to inspect.
  15238. * @returns {string|symbol} Returns the key.
  15239. */
  15240. function toKey(value) {
  15241. if (typeof value == 'string' || isSymbol(value)) {
  15242. return value;
  15243. }
  15244. var result = (value + '');
  15245. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  15246. }
  15247. /**
  15248. * Converts `func` to its source code.
  15249. *
  15250. * @private
  15251. * @param {Function} func The function to convert.
  15252. * @returns {string} Returns the source code.
  15253. */
  15254. function toSource(func) {
  15255. if (func != null) {
  15256. try {
  15257. return funcToString.call(func);
  15258. } catch (e) {}
  15259. try {
  15260. return (func + '');
  15261. } catch (e) {}
  15262. }
  15263. return '';
  15264. }
  15265. /**
  15266. * Updates wrapper `details` based on `bitmask` flags.
  15267. *
  15268. * @private
  15269. * @returns {Array} details The details to modify.
  15270. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  15271. * @returns {Array} Returns `details`.
  15272. */
  15273. function updateWrapDetails(details, bitmask) {
  15274. arrayEach(wrapFlags, function(pair) {
  15275. var value = '_.' + pair[0];
  15276. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  15277. details.push(value);
  15278. }
  15279. });
  15280. return details.sort();
  15281. }
  15282. /**
  15283. * Creates a clone of `wrapper`.
  15284. *
  15285. * @private
  15286. * @param {Object} wrapper The wrapper to clone.
  15287. * @returns {Object} Returns the cloned wrapper.
  15288. */
  15289. function wrapperClone(wrapper) {
  15290. if (wrapper instanceof LazyWrapper) {
  15291. return wrapper.clone();
  15292. }
  15293. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  15294. result.__actions__ = copyArray(wrapper.__actions__);
  15295. result.__index__ = wrapper.__index__;
  15296. result.__values__ = wrapper.__values__;
  15297. return result;
  15298. }
  15299. /*------------------------------------------------------------------------*/
  15300. /**
  15301. * Creates an array of elements split into groups the length of `size`.
  15302. * If `array` can't be split evenly, the final chunk will be the remaining
  15303. * elements.
  15304. *
  15305. * @static
  15306. * @memberOf _
  15307. * @since 3.0.0
  15308. * @category Array
  15309. * @param {Array} array The array to process.
  15310. * @param {number} [size=1] The length of each chunk
  15311. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15312. * @returns {Array} Returns the new array of chunks.
  15313. * @example
  15314. *
  15315. * _.chunk(['a', 'b', 'c', 'd'], 2);
  15316. * // => [['a', 'b'], ['c', 'd']]
  15317. *
  15318. * _.chunk(['a', 'b', 'c', 'd'], 3);
  15319. * // => [['a', 'b', 'c'], ['d']]
  15320. */
  15321. function chunk(array, size, guard) {
  15322. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  15323. size = 1;
  15324. } else {
  15325. size = nativeMax(toInteger(size), 0);
  15326. }
  15327. var length = array == null ? 0 : array.length;
  15328. if (!length || size < 1) {
  15329. return [];
  15330. }
  15331. var index = 0,
  15332. resIndex = 0,
  15333. result = Array(nativeCeil(length / size));
  15334. while (index < length) {
  15335. result[resIndex++] = baseSlice(array, index, (index += size));
  15336. }
  15337. return result;
  15338. }
  15339. /**
  15340. * Creates an array with all falsey values removed. The values `false`, `null`,
  15341. * `0`, `""`, `undefined`, and `NaN` are falsey.
  15342. *
  15343. * @static
  15344. * @memberOf _
  15345. * @since 0.1.0
  15346. * @category Array
  15347. * @param {Array} array The array to compact.
  15348. * @returns {Array} Returns the new array of filtered values.
  15349. * @example
  15350. *
  15351. * _.compact([0, 1, false, 2, '', 3]);
  15352. * // => [1, 2, 3]
  15353. */
  15354. function compact(array) {
  15355. var index = -1,
  15356. length = array == null ? 0 : array.length,
  15357. resIndex = 0,
  15358. result = [];
  15359. while (++index < length) {
  15360. var value = array[index];
  15361. if (value) {
  15362. result[resIndex++] = value;
  15363. }
  15364. }
  15365. return result;
  15366. }
  15367. /**
  15368. * Creates a new array concatenating `array` with any additional arrays
  15369. * and/or values.
  15370. *
  15371. * @static
  15372. * @memberOf _
  15373. * @since 4.0.0
  15374. * @category Array
  15375. * @param {Array} array The array to concatenate.
  15376. * @param {...*} [values] The values to concatenate.
  15377. * @returns {Array} Returns the new concatenated array.
  15378. * @example
  15379. *
  15380. * var array = [1];
  15381. * var other = _.concat(array, 2, [3], [[4]]);
  15382. *
  15383. * console.log(other);
  15384. * // => [1, 2, 3, [4]]
  15385. *
  15386. * console.log(array);
  15387. * // => [1]
  15388. */
  15389. function concat() {
  15390. var length = arguments.length;
  15391. if (!length) {
  15392. return [];
  15393. }
  15394. var args = Array(length - 1),
  15395. array = arguments[0],
  15396. index = length;
  15397. while (index--) {
  15398. args[index - 1] = arguments[index];
  15399. }
  15400. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  15401. }
  15402. /**
  15403. * Creates an array of `array` values not included in the other given arrays
  15404. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15405. * for equality comparisons. The order and references of result values are
  15406. * determined by the first array.
  15407. *
  15408. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  15409. *
  15410. * @static
  15411. * @memberOf _
  15412. * @since 0.1.0
  15413. * @category Array
  15414. * @param {Array} array The array to inspect.
  15415. * @param {...Array} [values] The values to exclude.
  15416. * @returns {Array} Returns the new array of filtered values.
  15417. * @see _.without, _.xor
  15418. * @example
  15419. *
  15420. * _.difference([2, 1], [2, 3]);
  15421. * // => [1]
  15422. */
  15423. var difference = baseRest(function(array, values) {
  15424. return isArrayLikeObject(array)
  15425. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  15426. : [];
  15427. });
  15428. /**
  15429. * This method is like `_.difference` except that it accepts `iteratee` which
  15430. * is invoked for each element of `array` and `values` to generate the criterion
  15431. * by which they're compared. The order and references of result values are
  15432. * determined by the first array. The iteratee is invoked with one argument:
  15433. * (value).
  15434. *
  15435. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  15436. *
  15437. * @static
  15438. * @memberOf _
  15439. * @since 4.0.0
  15440. * @category Array
  15441. * @param {Array} array The array to inspect.
  15442. * @param {...Array} [values] The values to exclude.
  15443. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  15444. * @returns {Array} Returns the new array of filtered values.
  15445. * @example
  15446. *
  15447. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  15448. * // => [1.2]
  15449. *
  15450. * // The `_.property` iteratee shorthand.
  15451. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  15452. * // => [{ 'x': 2 }]
  15453. */
  15454. var differenceBy = baseRest(function(array, values) {
  15455. var iteratee = last(values);
  15456. if (isArrayLikeObject(iteratee)) {
  15457. iteratee = undefined;
  15458. }
  15459. return isArrayLikeObject(array)
  15460. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  15461. : [];
  15462. });
  15463. /**
  15464. * This method is like `_.difference` except that it accepts `comparator`
  15465. * which is invoked to compare elements of `array` to `values`. The order and
  15466. * references of result values are determined by the first array. The comparator
  15467. * is invoked with two arguments: (arrVal, othVal).
  15468. *
  15469. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  15470. *
  15471. * @static
  15472. * @memberOf _
  15473. * @since 4.0.0
  15474. * @category Array
  15475. * @param {Array} array The array to inspect.
  15476. * @param {...Array} [values] The values to exclude.
  15477. * @param {Function} [comparator] The comparator invoked per element.
  15478. * @returns {Array} Returns the new array of filtered values.
  15479. * @example
  15480. *
  15481. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  15482. *
  15483. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  15484. * // => [{ 'x': 2, 'y': 1 }]
  15485. */
  15486. var differenceWith = baseRest(function(array, values) {
  15487. var comparator = last(values);
  15488. if (isArrayLikeObject(comparator)) {
  15489. comparator = undefined;
  15490. }
  15491. return isArrayLikeObject(array)
  15492. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  15493. : [];
  15494. });
  15495. /**
  15496. * Creates a slice of `array` with `n` elements dropped from the beginning.
  15497. *
  15498. * @static
  15499. * @memberOf _
  15500. * @since 0.5.0
  15501. * @category Array
  15502. * @param {Array} array The array to query.
  15503. * @param {number} [n=1] The number of elements to drop.
  15504. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15505. * @returns {Array} Returns the slice of `array`.
  15506. * @example
  15507. *
  15508. * _.drop([1, 2, 3]);
  15509. * // => [2, 3]
  15510. *
  15511. * _.drop([1, 2, 3], 2);
  15512. * // => [3]
  15513. *
  15514. * _.drop([1, 2, 3], 5);
  15515. * // => []
  15516. *
  15517. * _.drop([1, 2, 3], 0);
  15518. * // => [1, 2, 3]
  15519. */
  15520. function drop(array, n, guard) {
  15521. var length = array == null ? 0 : array.length;
  15522. if (!length) {
  15523. return [];
  15524. }
  15525. n = (guard || n === undefined) ? 1 : toInteger(n);
  15526. return baseSlice(array, n < 0 ? 0 : n, length);
  15527. }
  15528. /**
  15529. * Creates a slice of `array` with `n` elements dropped from the end.
  15530. *
  15531. * @static
  15532. * @memberOf _
  15533. * @since 3.0.0
  15534. * @category Array
  15535. * @param {Array} array The array to query.
  15536. * @param {number} [n=1] The number of elements to drop.
  15537. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15538. * @returns {Array} Returns the slice of `array`.
  15539. * @example
  15540. *
  15541. * _.dropRight([1, 2, 3]);
  15542. * // => [1, 2]
  15543. *
  15544. * _.dropRight([1, 2, 3], 2);
  15545. * // => [1]
  15546. *
  15547. * _.dropRight([1, 2, 3], 5);
  15548. * // => []
  15549. *
  15550. * _.dropRight([1, 2, 3], 0);
  15551. * // => [1, 2, 3]
  15552. */
  15553. function dropRight(array, n, guard) {
  15554. var length = array == null ? 0 : array.length;
  15555. if (!length) {
  15556. return [];
  15557. }
  15558. n = (guard || n === undefined) ? 1 : toInteger(n);
  15559. n = length - n;
  15560. return baseSlice(array, 0, n < 0 ? 0 : n);
  15561. }
  15562. /**
  15563. * Creates a slice of `array` excluding elements dropped from the end.
  15564. * Elements are dropped until `predicate` returns falsey. The predicate is
  15565. * invoked with three arguments: (value, index, array).
  15566. *
  15567. * @static
  15568. * @memberOf _
  15569. * @since 3.0.0
  15570. * @category Array
  15571. * @param {Array} array The array to query.
  15572. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15573. * @returns {Array} Returns the slice of `array`.
  15574. * @example
  15575. *
  15576. * var users = [
  15577. * { 'user': 'barney', 'active': true },
  15578. * { 'user': 'fred', 'active': false },
  15579. * { 'user': 'pebbles', 'active': false }
  15580. * ];
  15581. *
  15582. * _.dropRightWhile(users, function(o) { return !o.active; });
  15583. * // => objects for ['barney']
  15584. *
  15585. * // The `_.matches` iteratee shorthand.
  15586. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  15587. * // => objects for ['barney', 'fred']
  15588. *
  15589. * // The `_.matchesProperty` iteratee shorthand.
  15590. * _.dropRightWhile(users, ['active', false]);
  15591. * // => objects for ['barney']
  15592. *
  15593. * // The `_.property` iteratee shorthand.
  15594. * _.dropRightWhile(users, 'active');
  15595. * // => objects for ['barney', 'fred', 'pebbles']
  15596. */
  15597. function dropRightWhile(array, predicate) {
  15598. return (array && array.length)
  15599. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  15600. : [];
  15601. }
  15602. /**
  15603. * Creates a slice of `array` excluding elements dropped from the beginning.
  15604. * Elements are dropped until `predicate` returns falsey. The predicate is
  15605. * invoked with three arguments: (value, index, array).
  15606. *
  15607. * @static
  15608. * @memberOf _
  15609. * @since 3.0.0
  15610. * @category Array
  15611. * @param {Array} array The array to query.
  15612. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15613. * @returns {Array} Returns the slice of `array`.
  15614. * @example
  15615. *
  15616. * var users = [
  15617. * { 'user': 'barney', 'active': false },
  15618. * { 'user': 'fred', 'active': false },
  15619. * { 'user': 'pebbles', 'active': true }
  15620. * ];
  15621. *
  15622. * _.dropWhile(users, function(o) { return !o.active; });
  15623. * // => objects for ['pebbles']
  15624. *
  15625. * // The `_.matches` iteratee shorthand.
  15626. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  15627. * // => objects for ['fred', 'pebbles']
  15628. *
  15629. * // The `_.matchesProperty` iteratee shorthand.
  15630. * _.dropWhile(users, ['active', false]);
  15631. * // => objects for ['pebbles']
  15632. *
  15633. * // The `_.property` iteratee shorthand.
  15634. * _.dropWhile(users, 'active');
  15635. * // => objects for ['barney', 'fred', 'pebbles']
  15636. */
  15637. function dropWhile(array, predicate) {
  15638. return (array && array.length)
  15639. ? baseWhile(array, getIteratee(predicate, 3), true)
  15640. : [];
  15641. }
  15642. /**
  15643. * Fills elements of `array` with `value` from `start` up to, but not
  15644. * including, `end`.
  15645. *
  15646. * **Note:** This method mutates `array`.
  15647. *
  15648. * @static
  15649. * @memberOf _
  15650. * @since 3.2.0
  15651. * @category Array
  15652. * @param {Array} array The array to fill.
  15653. * @param {*} value The value to fill `array` with.
  15654. * @param {number} [start=0] The start position.
  15655. * @param {number} [end=array.length] The end position.
  15656. * @returns {Array} Returns `array`.
  15657. * @example
  15658. *
  15659. * var array = [1, 2, 3];
  15660. *
  15661. * _.fill(array, 'a');
  15662. * console.log(array);
  15663. * // => ['a', 'a', 'a']
  15664. *
  15665. * _.fill(Array(3), 2);
  15666. * // => [2, 2, 2]
  15667. *
  15668. * _.fill([4, 6, 8, 10], '*', 1, 3);
  15669. * // => [4, '*', '*', 10]
  15670. */
  15671. function fill(array, value, start, end) {
  15672. var length = array == null ? 0 : array.length;
  15673. if (!length) {
  15674. return [];
  15675. }
  15676. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  15677. start = 0;
  15678. end = length;
  15679. }
  15680. return baseFill(array, value, start, end);
  15681. }
  15682. /**
  15683. * This method is like `_.find` except that it returns the index of the first
  15684. * element `predicate` returns truthy for instead of the element itself.
  15685. *
  15686. * @static
  15687. * @memberOf _
  15688. * @since 1.1.0
  15689. * @category Array
  15690. * @param {Array} array The array to inspect.
  15691. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15692. * @param {number} [fromIndex=0] The index to search from.
  15693. * @returns {number} Returns the index of the found element, else `-1`.
  15694. * @example
  15695. *
  15696. * var users = [
  15697. * { 'user': 'barney', 'active': false },
  15698. * { 'user': 'fred', 'active': false },
  15699. * { 'user': 'pebbles', 'active': true }
  15700. * ];
  15701. *
  15702. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  15703. * // => 0
  15704. *
  15705. * // The `_.matches` iteratee shorthand.
  15706. * _.findIndex(users, { 'user': 'fred', 'active': false });
  15707. * // => 1
  15708. *
  15709. * // The `_.matchesProperty` iteratee shorthand.
  15710. * _.findIndex(users, ['active', false]);
  15711. * // => 0
  15712. *
  15713. * // The `_.property` iteratee shorthand.
  15714. * _.findIndex(users, 'active');
  15715. * // => 2
  15716. */
  15717. function findIndex(array, predicate, fromIndex) {
  15718. var length = array == null ? 0 : array.length;
  15719. if (!length) {
  15720. return -1;
  15721. }
  15722. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  15723. if (index < 0) {
  15724. index = nativeMax(length + index, 0);
  15725. }
  15726. return baseFindIndex(array, getIteratee(predicate, 3), index);
  15727. }
  15728. /**
  15729. * This method is like `_.findIndex` except that it iterates over elements
  15730. * of `collection` from right to left.
  15731. *
  15732. * @static
  15733. * @memberOf _
  15734. * @since 2.0.0
  15735. * @category Array
  15736. * @param {Array} array The array to inspect.
  15737. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15738. * @param {number} [fromIndex=array.length-1] The index to search from.
  15739. * @returns {number} Returns the index of the found element, else `-1`.
  15740. * @example
  15741. *
  15742. * var users = [
  15743. * { 'user': 'barney', 'active': true },
  15744. * { 'user': 'fred', 'active': false },
  15745. * { 'user': 'pebbles', 'active': false }
  15746. * ];
  15747. *
  15748. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  15749. * // => 2
  15750. *
  15751. * // The `_.matches` iteratee shorthand.
  15752. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  15753. * // => 0
  15754. *
  15755. * // The `_.matchesProperty` iteratee shorthand.
  15756. * _.findLastIndex(users, ['active', false]);
  15757. * // => 2
  15758. *
  15759. * // The `_.property` iteratee shorthand.
  15760. * _.findLastIndex(users, 'active');
  15761. * // => 0
  15762. */
  15763. function findLastIndex(array, predicate, fromIndex) {
  15764. var length = array == null ? 0 : array.length;
  15765. if (!length) {
  15766. return -1;
  15767. }
  15768. var index = length - 1;
  15769. if (fromIndex !== undefined) {
  15770. index = toInteger(fromIndex);
  15771. index = fromIndex < 0
  15772. ? nativeMax(length + index, 0)
  15773. : nativeMin(index, length - 1);
  15774. }
  15775. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  15776. }
  15777. /**
  15778. * Flattens `array` a single level deep.
  15779. *
  15780. * @static
  15781. * @memberOf _
  15782. * @since 0.1.0
  15783. * @category Array
  15784. * @param {Array} array The array to flatten.
  15785. * @returns {Array} Returns the new flattened array.
  15786. * @example
  15787. *
  15788. * _.flatten([1, [2, [3, [4]], 5]]);
  15789. * // => [1, 2, [3, [4]], 5]
  15790. */
  15791. function flatten(array) {
  15792. var length = array == null ? 0 : array.length;
  15793. return length ? baseFlatten(array, 1) : [];
  15794. }
  15795. /**
  15796. * Recursively flattens `array`.
  15797. *
  15798. * @static
  15799. * @memberOf _
  15800. * @since 3.0.0
  15801. * @category Array
  15802. * @param {Array} array The array to flatten.
  15803. * @returns {Array} Returns the new flattened array.
  15804. * @example
  15805. *
  15806. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  15807. * // => [1, 2, 3, 4, 5]
  15808. */
  15809. function flattenDeep(array) {
  15810. var length = array == null ? 0 : array.length;
  15811. return length ? baseFlatten(array, INFINITY) : [];
  15812. }
  15813. /**
  15814. * Recursively flatten `array` up to `depth` times.
  15815. *
  15816. * @static
  15817. * @memberOf _
  15818. * @since 4.4.0
  15819. * @category Array
  15820. * @param {Array} array The array to flatten.
  15821. * @param {number} [depth=1] The maximum recursion depth.
  15822. * @returns {Array} Returns the new flattened array.
  15823. * @example
  15824. *
  15825. * var array = [1, [2, [3, [4]], 5]];
  15826. *
  15827. * _.flattenDepth(array, 1);
  15828. * // => [1, 2, [3, [4]], 5]
  15829. *
  15830. * _.flattenDepth(array, 2);
  15831. * // => [1, 2, 3, [4], 5]
  15832. */
  15833. function flattenDepth(array, depth) {
  15834. var length = array == null ? 0 : array.length;
  15835. if (!length) {
  15836. return [];
  15837. }
  15838. depth = depth === undefined ? 1 : toInteger(depth);
  15839. return baseFlatten(array, depth);
  15840. }
  15841. /**
  15842. * The inverse of `_.toPairs`; this method returns an object composed
  15843. * from key-value `pairs`.
  15844. *
  15845. * @static
  15846. * @memberOf _
  15847. * @since 4.0.0
  15848. * @category Array
  15849. * @param {Array} pairs The key-value pairs.
  15850. * @returns {Object} Returns the new object.
  15851. * @example
  15852. *
  15853. * _.fromPairs([['a', 1], ['b', 2]]);
  15854. * // => { 'a': 1, 'b': 2 }
  15855. */
  15856. function fromPairs(pairs) {
  15857. var index = -1,
  15858. length = pairs == null ? 0 : pairs.length,
  15859. result = {};
  15860. while (++index < length) {
  15861. var pair = pairs[index];
  15862. result[pair[0]] = pair[1];
  15863. }
  15864. return result;
  15865. }
  15866. /**
  15867. * Gets the first element of `array`.
  15868. *
  15869. * @static
  15870. * @memberOf _
  15871. * @since 0.1.0
  15872. * @alias first
  15873. * @category Array
  15874. * @param {Array} array The array to query.
  15875. * @returns {*} Returns the first element of `array`.
  15876. * @example
  15877. *
  15878. * _.head([1, 2, 3]);
  15879. * // => 1
  15880. *
  15881. * _.head([]);
  15882. * // => undefined
  15883. */
  15884. function head(array) {
  15885. return (array && array.length) ? array[0] : undefined;
  15886. }
  15887. /**
  15888. * Gets the index at which the first occurrence of `value` is found in `array`
  15889. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15890. * for equality comparisons. If `fromIndex` is negative, it's used as the
  15891. * offset from the end of `array`.
  15892. *
  15893. * @static
  15894. * @memberOf _
  15895. * @since 0.1.0
  15896. * @category Array
  15897. * @param {Array} array The array to inspect.
  15898. * @param {*} value The value to search for.
  15899. * @param {number} [fromIndex=0] The index to search from.
  15900. * @returns {number} Returns the index of the matched value, else `-1`.
  15901. * @example
  15902. *
  15903. * _.indexOf([1, 2, 1, 2], 2);
  15904. * // => 1
  15905. *
  15906. * // Search from the `fromIndex`.
  15907. * _.indexOf([1, 2, 1, 2], 2, 2);
  15908. * // => 3
  15909. */
  15910. function indexOf(array, value, fromIndex) {
  15911. var length = array == null ? 0 : array.length;
  15912. if (!length) {
  15913. return -1;
  15914. }
  15915. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  15916. if (index < 0) {
  15917. index = nativeMax(length + index, 0);
  15918. }
  15919. return baseIndexOf(array, value, index);
  15920. }
  15921. /**
  15922. * Gets all but the last element of `array`.
  15923. *
  15924. * @static
  15925. * @memberOf _
  15926. * @since 0.1.0
  15927. * @category Array
  15928. * @param {Array} array The array to query.
  15929. * @returns {Array} Returns the slice of `array`.
  15930. * @example
  15931. *
  15932. * _.initial([1, 2, 3]);
  15933. * // => [1, 2]
  15934. */
  15935. function initial(array) {
  15936. var length = array == null ? 0 : array.length;
  15937. return length ? baseSlice(array, 0, -1) : [];
  15938. }
  15939. /**
  15940. * Creates an array of unique values that are included in all given arrays
  15941. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15942. * for equality comparisons. The order and references of result values are
  15943. * determined by the first array.
  15944. *
  15945. * @static
  15946. * @memberOf _
  15947. * @since 0.1.0
  15948. * @category Array
  15949. * @param {...Array} [arrays] The arrays to inspect.
  15950. * @returns {Array} Returns the new array of intersecting values.
  15951. * @example
  15952. *
  15953. * _.intersection([2, 1], [2, 3]);
  15954. * // => [2]
  15955. */
  15956. var intersection = baseRest(function(arrays) {
  15957. var mapped = arrayMap(arrays, castArrayLikeObject);
  15958. return (mapped.length && mapped[0] === arrays[0])
  15959. ? baseIntersection(mapped)
  15960. : [];
  15961. });
  15962. /**
  15963. * This method is like `_.intersection` except that it accepts `iteratee`
  15964. * which is invoked for each element of each `arrays` to generate the criterion
  15965. * by which they're compared. The order and references of result values are
  15966. * determined by the first array. The iteratee is invoked with one argument:
  15967. * (value).
  15968. *
  15969. * @static
  15970. * @memberOf _
  15971. * @since 4.0.0
  15972. * @category Array
  15973. * @param {...Array} [arrays] The arrays to inspect.
  15974. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  15975. * @returns {Array} Returns the new array of intersecting values.
  15976. * @example
  15977. *
  15978. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  15979. * // => [2.1]
  15980. *
  15981. * // The `_.property` iteratee shorthand.
  15982. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  15983. * // => [{ 'x': 1 }]
  15984. */
  15985. var intersectionBy = baseRest(function(arrays) {
  15986. var iteratee = last(arrays),
  15987. mapped = arrayMap(arrays, castArrayLikeObject);
  15988. if (iteratee === last(mapped)) {
  15989. iteratee = undefined;
  15990. } else {
  15991. mapped.pop();
  15992. }
  15993. return (mapped.length && mapped[0] === arrays[0])
  15994. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  15995. : [];
  15996. });
  15997. /**
  15998. * This method is like `_.intersection` except that it accepts `comparator`
  15999. * which is invoked to compare elements of `arrays`. The order and references
  16000. * of result values are determined by the first array. The comparator is
  16001. * invoked with two arguments: (arrVal, othVal).
  16002. *
  16003. * @static
  16004. * @memberOf _
  16005. * @since 4.0.0
  16006. * @category Array
  16007. * @param {...Array} [arrays] The arrays to inspect.
  16008. * @param {Function} [comparator] The comparator invoked per element.
  16009. * @returns {Array} Returns the new array of intersecting values.
  16010. * @example
  16011. *
  16012. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  16013. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16014. *
  16015. * _.intersectionWith(objects, others, _.isEqual);
  16016. * // => [{ 'x': 1, 'y': 2 }]
  16017. */
  16018. var intersectionWith = baseRest(function(arrays) {
  16019. var comparator = last(arrays),
  16020. mapped = arrayMap(arrays, castArrayLikeObject);
  16021. comparator = typeof comparator == 'function' ? comparator : undefined;
  16022. if (comparator) {
  16023. mapped.pop();
  16024. }
  16025. return (mapped.length && mapped[0] === arrays[0])
  16026. ? baseIntersection(mapped, undefined, comparator)
  16027. : [];
  16028. });
  16029. /**
  16030. * Converts all elements in `array` into a string separated by `separator`.
  16031. *
  16032. * @static
  16033. * @memberOf _
  16034. * @since 4.0.0
  16035. * @category Array
  16036. * @param {Array} array The array to convert.
  16037. * @param {string} [separator=','] The element separator.
  16038. * @returns {string} Returns the joined string.
  16039. * @example
  16040. *
  16041. * _.join(['a', 'b', 'c'], '~');
  16042. * // => 'a~b~c'
  16043. */
  16044. function join(array, separator) {
  16045. return array == null ? '' : nativeJoin.call(array, separator);
  16046. }
  16047. /**
  16048. * Gets the last element of `array`.
  16049. *
  16050. * @static
  16051. * @memberOf _
  16052. * @since 0.1.0
  16053. * @category Array
  16054. * @param {Array} array The array to query.
  16055. * @returns {*} Returns the last element of `array`.
  16056. * @example
  16057. *
  16058. * _.last([1, 2, 3]);
  16059. * // => 3
  16060. */
  16061. function last(array) {
  16062. var length = array == null ? 0 : array.length;
  16063. return length ? array[length - 1] : undefined;
  16064. }
  16065. /**
  16066. * This method is like `_.indexOf` except that it iterates over elements of
  16067. * `array` from right to left.
  16068. *
  16069. * @static
  16070. * @memberOf _
  16071. * @since 0.1.0
  16072. * @category Array
  16073. * @param {Array} array The array to inspect.
  16074. * @param {*} value The value to search for.
  16075. * @param {number} [fromIndex=array.length-1] The index to search from.
  16076. * @returns {number} Returns the index of the matched value, else `-1`.
  16077. * @example
  16078. *
  16079. * _.lastIndexOf([1, 2, 1, 2], 2);
  16080. * // => 3
  16081. *
  16082. * // Search from the `fromIndex`.
  16083. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  16084. * // => 1
  16085. */
  16086. function lastIndexOf(array, value, fromIndex) {
  16087. var length = array == null ? 0 : array.length;
  16088. if (!length) {
  16089. return -1;
  16090. }
  16091. var index = length;
  16092. if (fromIndex !== undefined) {
  16093. index = toInteger(fromIndex);
  16094. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  16095. }
  16096. return value === value
  16097. ? strictLastIndexOf(array, value, index)
  16098. : baseFindIndex(array, baseIsNaN, index, true);
  16099. }
  16100. /**
  16101. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  16102. * element from the end is returned.
  16103. *
  16104. * @static
  16105. * @memberOf _
  16106. * @since 4.11.0
  16107. * @category Array
  16108. * @param {Array} array The array to query.
  16109. * @param {number} [n=0] The index of the element to return.
  16110. * @returns {*} Returns the nth element of `array`.
  16111. * @example
  16112. *
  16113. * var array = ['a', 'b', 'c', 'd'];
  16114. *
  16115. * _.nth(array, 1);
  16116. * // => 'b'
  16117. *
  16118. * _.nth(array, -2);
  16119. * // => 'c';
  16120. */
  16121. function nth(array, n) {
  16122. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  16123. }
  16124. /**
  16125. * Removes all given values from `array` using
  16126. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16127. * for equality comparisons.
  16128. *
  16129. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  16130. * to remove elements from an array by predicate.
  16131. *
  16132. * @static
  16133. * @memberOf _
  16134. * @since 2.0.0
  16135. * @category Array
  16136. * @param {Array} array The array to modify.
  16137. * @param {...*} [values] The values to remove.
  16138. * @returns {Array} Returns `array`.
  16139. * @example
  16140. *
  16141. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  16142. *
  16143. * _.pull(array, 'a', 'c');
  16144. * console.log(array);
  16145. * // => ['b', 'b']
  16146. */
  16147. var pull = baseRest(pullAll);
  16148. /**
  16149. * This method is like `_.pull` except that it accepts an array of values to remove.
  16150. *
  16151. * **Note:** Unlike `_.difference`, this method mutates `array`.
  16152. *
  16153. * @static
  16154. * @memberOf _
  16155. * @since 4.0.0
  16156. * @category Array
  16157. * @param {Array} array The array to modify.
  16158. * @param {Array} values The values to remove.
  16159. * @returns {Array} Returns `array`.
  16160. * @example
  16161. *
  16162. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  16163. *
  16164. * _.pullAll(array, ['a', 'c']);
  16165. * console.log(array);
  16166. * // => ['b', 'b']
  16167. */
  16168. function pullAll(array, values) {
  16169. return (array && array.length && values && values.length)
  16170. ? basePullAll(array, values)
  16171. : array;
  16172. }
  16173. /**
  16174. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  16175. * invoked for each element of `array` and `values` to generate the criterion
  16176. * by which they're compared. The iteratee is invoked with one argument: (value).
  16177. *
  16178. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  16179. *
  16180. * @static
  16181. * @memberOf _
  16182. * @since 4.0.0
  16183. * @category Array
  16184. * @param {Array} array The array to modify.
  16185. * @param {Array} values The values to remove.
  16186. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16187. * @returns {Array} Returns `array`.
  16188. * @example
  16189. *
  16190. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  16191. *
  16192. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  16193. * console.log(array);
  16194. * // => [{ 'x': 2 }]
  16195. */
  16196. function pullAllBy(array, values, iteratee) {
  16197. return (array && array.length && values && values.length)
  16198. ? basePullAll(array, values, getIteratee(iteratee, 2))
  16199. : array;
  16200. }
  16201. /**
  16202. * This method is like `_.pullAll` except that it accepts `comparator` which
  16203. * is invoked to compare elements of `array` to `values`. The comparator is
  16204. * invoked with two arguments: (arrVal, othVal).
  16205. *
  16206. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  16207. *
  16208. * @static
  16209. * @memberOf _
  16210. * @since 4.6.0
  16211. * @category Array
  16212. * @param {Array} array The array to modify.
  16213. * @param {Array} values The values to remove.
  16214. * @param {Function} [comparator] The comparator invoked per element.
  16215. * @returns {Array} Returns `array`.
  16216. * @example
  16217. *
  16218. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  16219. *
  16220. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  16221. * console.log(array);
  16222. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  16223. */
  16224. function pullAllWith(array, values, comparator) {
  16225. return (array && array.length && values && values.length)
  16226. ? basePullAll(array, values, undefined, comparator)
  16227. : array;
  16228. }
  16229. /**
  16230. * Removes elements from `array` corresponding to `indexes` and returns an
  16231. * array of removed elements.
  16232. *
  16233. * **Note:** Unlike `_.at`, this method mutates `array`.
  16234. *
  16235. * @static
  16236. * @memberOf _
  16237. * @since 3.0.0
  16238. * @category Array
  16239. * @param {Array} array The array to modify.
  16240. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  16241. * @returns {Array} Returns the new array of removed elements.
  16242. * @example
  16243. *
  16244. * var array = ['a', 'b', 'c', 'd'];
  16245. * var pulled = _.pullAt(array, [1, 3]);
  16246. *
  16247. * console.log(array);
  16248. * // => ['a', 'c']
  16249. *
  16250. * console.log(pulled);
  16251. * // => ['b', 'd']
  16252. */
  16253. var pullAt = flatRest(function(array, indexes) {
  16254. var length = array == null ? 0 : array.length,
  16255. result = baseAt(array, indexes);
  16256. basePullAt(array, arrayMap(indexes, function(index) {
  16257. return isIndex(index, length) ? +index : index;
  16258. }).sort(compareAscending));
  16259. return result;
  16260. });
  16261. /**
  16262. * Removes all elements from `array` that `predicate` returns truthy for
  16263. * and returns an array of the removed elements. The predicate is invoked
  16264. * with three arguments: (value, index, array).
  16265. *
  16266. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  16267. * to pull elements from an array by value.
  16268. *
  16269. * @static
  16270. * @memberOf _
  16271. * @since 2.0.0
  16272. * @category Array
  16273. * @param {Array} array The array to modify.
  16274. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16275. * @returns {Array} Returns the new array of removed elements.
  16276. * @example
  16277. *
  16278. * var array = [1, 2, 3, 4];
  16279. * var evens = _.remove(array, function(n) {
  16280. * return n % 2 == 0;
  16281. * });
  16282. *
  16283. * console.log(array);
  16284. * // => [1, 3]
  16285. *
  16286. * console.log(evens);
  16287. * // => [2, 4]
  16288. */
  16289. function remove(array, predicate) {
  16290. var result = [];
  16291. if (!(array && array.length)) {
  16292. return result;
  16293. }
  16294. var index = -1,
  16295. indexes = [],
  16296. length = array.length;
  16297. predicate = getIteratee(predicate, 3);
  16298. while (++index < length) {
  16299. var value = array[index];
  16300. if (predicate(value, index, array)) {
  16301. result.push(value);
  16302. indexes.push(index);
  16303. }
  16304. }
  16305. basePullAt(array, indexes);
  16306. return result;
  16307. }
  16308. /**
  16309. * Reverses `array` so that the first element becomes the last, the second
  16310. * element becomes the second to last, and so on.
  16311. *
  16312. * **Note:** This method mutates `array` and is based on
  16313. * [`Array#reverse`](https://mdn.io/Array/reverse).
  16314. *
  16315. * @static
  16316. * @memberOf _
  16317. * @since 4.0.0
  16318. * @category Array
  16319. * @param {Array} array The array to modify.
  16320. * @returns {Array} Returns `array`.
  16321. * @example
  16322. *
  16323. * var array = [1, 2, 3];
  16324. *
  16325. * _.reverse(array);
  16326. * // => [3, 2, 1]
  16327. *
  16328. * console.log(array);
  16329. * // => [3, 2, 1]
  16330. */
  16331. function reverse(array) {
  16332. return array == null ? array : nativeReverse.call(array);
  16333. }
  16334. /**
  16335. * Creates a slice of `array` from `start` up to, but not including, `end`.
  16336. *
  16337. * **Note:** This method is used instead of
  16338. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  16339. * returned.
  16340. *
  16341. * @static
  16342. * @memberOf _
  16343. * @since 3.0.0
  16344. * @category Array
  16345. * @param {Array} array The array to slice.
  16346. * @param {number} [start=0] The start position.
  16347. * @param {number} [end=array.length] The end position.
  16348. * @returns {Array} Returns the slice of `array`.
  16349. */
  16350. function slice(array, start, end) {
  16351. var length = array == null ? 0 : array.length;
  16352. if (!length) {
  16353. return [];
  16354. }
  16355. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  16356. start = 0;
  16357. end = length;
  16358. }
  16359. else {
  16360. start = start == null ? 0 : toInteger(start);
  16361. end = end === undefined ? length : toInteger(end);
  16362. }
  16363. return baseSlice(array, start, end);
  16364. }
  16365. /**
  16366. * Uses a binary search to determine the lowest index at which `value`
  16367. * should be inserted into `array` in order to maintain its sort order.
  16368. *
  16369. * @static
  16370. * @memberOf _
  16371. * @since 0.1.0
  16372. * @category Array
  16373. * @param {Array} array The sorted array to inspect.
  16374. * @param {*} value The value to evaluate.
  16375. * @returns {number} Returns the index at which `value` should be inserted
  16376. * into `array`.
  16377. * @example
  16378. *
  16379. * _.sortedIndex([30, 50], 40);
  16380. * // => 1
  16381. */
  16382. function sortedIndex(array, value) {
  16383. return baseSortedIndex(array, value);
  16384. }
  16385. /**
  16386. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  16387. * which is invoked for `value` and each element of `array` to compute their
  16388. * sort ranking. The iteratee is invoked with one argument: (value).
  16389. *
  16390. * @static
  16391. * @memberOf _
  16392. * @since 4.0.0
  16393. * @category Array
  16394. * @param {Array} array The sorted array to inspect.
  16395. * @param {*} value The value to evaluate.
  16396. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16397. * @returns {number} Returns the index at which `value` should be inserted
  16398. * into `array`.
  16399. * @example
  16400. *
  16401. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  16402. *
  16403. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  16404. * // => 0
  16405. *
  16406. * // The `_.property` iteratee shorthand.
  16407. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  16408. * // => 0
  16409. */
  16410. function sortedIndexBy(array, value, iteratee) {
  16411. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  16412. }
  16413. /**
  16414. * This method is like `_.indexOf` except that it performs a binary
  16415. * search on a sorted `array`.
  16416. *
  16417. * @static
  16418. * @memberOf _
  16419. * @since 4.0.0
  16420. * @category Array
  16421. * @param {Array} array The array to inspect.
  16422. * @param {*} value The value to search for.
  16423. * @returns {number} Returns the index of the matched value, else `-1`.
  16424. * @example
  16425. *
  16426. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  16427. * // => 1
  16428. */
  16429. function sortedIndexOf(array, value) {
  16430. var length = array == null ? 0 : array.length;
  16431. if (length) {
  16432. var index = baseSortedIndex(array, value);
  16433. if (index < length && eq(array[index], value)) {
  16434. return index;
  16435. }
  16436. }
  16437. return -1;
  16438. }
  16439. /**
  16440. * This method is like `_.sortedIndex` except that it returns the highest
  16441. * index at which `value` should be inserted into `array` in order to
  16442. * maintain its sort order.
  16443. *
  16444. * @static
  16445. * @memberOf _
  16446. * @since 3.0.0
  16447. * @category Array
  16448. * @param {Array} array The sorted array to inspect.
  16449. * @param {*} value The value to evaluate.
  16450. * @returns {number} Returns the index at which `value` should be inserted
  16451. * into `array`.
  16452. * @example
  16453. *
  16454. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  16455. * // => 4
  16456. */
  16457. function sortedLastIndex(array, value) {
  16458. return baseSortedIndex(array, value, true);
  16459. }
  16460. /**
  16461. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  16462. * which is invoked for `value` and each element of `array` to compute their
  16463. * sort ranking. The iteratee is invoked with one argument: (value).
  16464. *
  16465. * @static
  16466. * @memberOf _
  16467. * @since 4.0.0
  16468. * @category Array
  16469. * @param {Array} array The sorted array to inspect.
  16470. * @param {*} value The value to evaluate.
  16471. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16472. * @returns {number} Returns the index at which `value` should be inserted
  16473. * into `array`.
  16474. * @example
  16475. *
  16476. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  16477. *
  16478. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  16479. * // => 1
  16480. *
  16481. * // The `_.property` iteratee shorthand.
  16482. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  16483. * // => 1
  16484. */
  16485. function sortedLastIndexBy(array, value, iteratee) {
  16486. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  16487. }
  16488. /**
  16489. * This method is like `_.lastIndexOf` except that it performs a binary
  16490. * search on a sorted `array`.
  16491. *
  16492. * @static
  16493. * @memberOf _
  16494. * @since 4.0.0
  16495. * @category Array
  16496. * @param {Array} array The array to inspect.
  16497. * @param {*} value The value to search for.
  16498. * @returns {number} Returns the index of the matched value, else `-1`.
  16499. * @example
  16500. *
  16501. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  16502. * // => 3
  16503. */
  16504. function sortedLastIndexOf(array, value) {
  16505. var length = array == null ? 0 : array.length;
  16506. if (length) {
  16507. var index = baseSortedIndex(array, value, true) - 1;
  16508. if (eq(array[index], value)) {
  16509. return index;
  16510. }
  16511. }
  16512. return -1;
  16513. }
  16514. /**
  16515. * This method is like `_.uniq` except that it's designed and optimized
  16516. * for sorted arrays.
  16517. *
  16518. * @static
  16519. * @memberOf _
  16520. * @since 4.0.0
  16521. * @category Array
  16522. * @param {Array} array The array to inspect.
  16523. * @returns {Array} Returns the new duplicate free array.
  16524. * @example
  16525. *
  16526. * _.sortedUniq([1, 1, 2]);
  16527. * // => [1, 2]
  16528. */
  16529. function sortedUniq(array) {
  16530. return (array && array.length)
  16531. ? baseSortedUniq(array)
  16532. : [];
  16533. }
  16534. /**
  16535. * This method is like `_.uniqBy` except that it's designed and optimized
  16536. * for sorted arrays.
  16537. *
  16538. * @static
  16539. * @memberOf _
  16540. * @since 4.0.0
  16541. * @category Array
  16542. * @param {Array} array The array to inspect.
  16543. * @param {Function} [iteratee] The iteratee invoked per element.
  16544. * @returns {Array} Returns the new duplicate free array.
  16545. * @example
  16546. *
  16547. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  16548. * // => [1.1, 2.3]
  16549. */
  16550. function sortedUniqBy(array, iteratee) {
  16551. return (array && array.length)
  16552. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  16553. : [];
  16554. }
  16555. /**
  16556. * Gets all but the first element of `array`.
  16557. *
  16558. * @static
  16559. * @memberOf _
  16560. * @since 4.0.0
  16561. * @category Array
  16562. * @param {Array} array The array to query.
  16563. * @returns {Array} Returns the slice of `array`.
  16564. * @example
  16565. *
  16566. * _.tail([1, 2, 3]);
  16567. * // => [2, 3]
  16568. */
  16569. function tail(array) {
  16570. var length = array == null ? 0 : array.length;
  16571. return length ? baseSlice(array, 1, length) : [];
  16572. }
  16573. /**
  16574. * Creates a slice of `array` with `n` elements taken from the beginning.
  16575. *
  16576. * @static
  16577. * @memberOf _
  16578. * @since 0.1.0
  16579. * @category Array
  16580. * @param {Array} array The array to query.
  16581. * @param {number} [n=1] The number of elements to take.
  16582. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16583. * @returns {Array} Returns the slice of `array`.
  16584. * @example
  16585. *
  16586. * _.take([1, 2, 3]);
  16587. * // => [1]
  16588. *
  16589. * _.take([1, 2, 3], 2);
  16590. * // => [1, 2]
  16591. *
  16592. * _.take([1, 2, 3], 5);
  16593. * // => [1, 2, 3]
  16594. *
  16595. * _.take([1, 2, 3], 0);
  16596. * // => []
  16597. */
  16598. function take(array, n, guard) {
  16599. if (!(array && array.length)) {
  16600. return [];
  16601. }
  16602. n = (guard || n === undefined) ? 1 : toInteger(n);
  16603. return baseSlice(array, 0, n < 0 ? 0 : n);
  16604. }
  16605. /**
  16606. * Creates a slice of `array` with `n` elements taken from the end.
  16607. *
  16608. * @static
  16609. * @memberOf _
  16610. * @since 3.0.0
  16611. * @category Array
  16612. * @param {Array} array The array to query.
  16613. * @param {number} [n=1] The number of elements to take.
  16614. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16615. * @returns {Array} Returns the slice of `array`.
  16616. * @example
  16617. *
  16618. * _.takeRight([1, 2, 3]);
  16619. * // => [3]
  16620. *
  16621. * _.takeRight([1, 2, 3], 2);
  16622. * // => [2, 3]
  16623. *
  16624. * _.takeRight([1, 2, 3], 5);
  16625. * // => [1, 2, 3]
  16626. *
  16627. * _.takeRight([1, 2, 3], 0);
  16628. * // => []
  16629. */
  16630. function takeRight(array, n, guard) {
  16631. var length = array == null ? 0 : array.length;
  16632. if (!length) {
  16633. return [];
  16634. }
  16635. n = (guard || n === undefined) ? 1 : toInteger(n);
  16636. n = length - n;
  16637. return baseSlice(array, n < 0 ? 0 : n, length);
  16638. }
  16639. /**
  16640. * Creates a slice of `array` with elements taken from the end. Elements are
  16641. * taken until `predicate` returns falsey. The predicate is invoked with
  16642. * three arguments: (value, index, array).
  16643. *
  16644. * @static
  16645. * @memberOf _
  16646. * @since 3.0.0
  16647. * @category Array
  16648. * @param {Array} array The array to query.
  16649. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16650. * @returns {Array} Returns the slice of `array`.
  16651. * @example
  16652. *
  16653. * var users = [
  16654. * { 'user': 'barney', 'active': true },
  16655. * { 'user': 'fred', 'active': false },
  16656. * { 'user': 'pebbles', 'active': false }
  16657. * ];
  16658. *
  16659. * _.takeRightWhile(users, function(o) { return !o.active; });
  16660. * // => objects for ['fred', 'pebbles']
  16661. *
  16662. * // The `_.matches` iteratee shorthand.
  16663. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  16664. * // => objects for ['pebbles']
  16665. *
  16666. * // The `_.matchesProperty` iteratee shorthand.
  16667. * _.takeRightWhile(users, ['active', false]);
  16668. * // => objects for ['fred', 'pebbles']
  16669. *
  16670. * // The `_.property` iteratee shorthand.
  16671. * _.takeRightWhile(users, 'active');
  16672. * // => []
  16673. */
  16674. function takeRightWhile(array, predicate) {
  16675. return (array && array.length)
  16676. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  16677. : [];
  16678. }
  16679. /**
  16680. * Creates a slice of `array` with elements taken from the beginning. Elements
  16681. * are taken until `predicate` returns falsey. The predicate is invoked with
  16682. * three arguments: (value, index, array).
  16683. *
  16684. * @static
  16685. * @memberOf _
  16686. * @since 3.0.0
  16687. * @category Array
  16688. * @param {Array} array The array to query.
  16689. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16690. * @returns {Array} Returns the slice of `array`.
  16691. * @example
  16692. *
  16693. * var users = [
  16694. * { 'user': 'barney', 'active': false },
  16695. * { 'user': 'fred', 'active': false },
  16696. * { 'user': 'pebbles', 'active': true }
  16697. * ];
  16698. *
  16699. * _.takeWhile(users, function(o) { return !o.active; });
  16700. * // => objects for ['barney', 'fred']
  16701. *
  16702. * // The `_.matches` iteratee shorthand.
  16703. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  16704. * // => objects for ['barney']
  16705. *
  16706. * // The `_.matchesProperty` iteratee shorthand.
  16707. * _.takeWhile(users, ['active', false]);
  16708. * // => objects for ['barney', 'fred']
  16709. *
  16710. * // The `_.property` iteratee shorthand.
  16711. * _.takeWhile(users, 'active');
  16712. * // => []
  16713. */
  16714. function takeWhile(array, predicate) {
  16715. return (array && array.length)
  16716. ? baseWhile(array, getIteratee(predicate, 3))
  16717. : [];
  16718. }
  16719. /**
  16720. * Creates an array of unique values, in order, from all given arrays using
  16721. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16722. * for equality comparisons.
  16723. *
  16724. * @static
  16725. * @memberOf _
  16726. * @since 0.1.0
  16727. * @category Array
  16728. * @param {...Array} [arrays] The arrays to inspect.
  16729. * @returns {Array} Returns the new array of combined values.
  16730. * @example
  16731. *
  16732. * _.union([2], [1, 2]);
  16733. * // => [2, 1]
  16734. */
  16735. var union = baseRest(function(arrays) {
  16736. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  16737. });
  16738. /**
  16739. * This method is like `_.union` except that it accepts `iteratee` which is
  16740. * invoked for each element of each `arrays` to generate the criterion by
  16741. * which uniqueness is computed. Result values are chosen from the first
  16742. * array in which the value occurs. The iteratee is invoked with one argument:
  16743. * (value).
  16744. *
  16745. * @static
  16746. * @memberOf _
  16747. * @since 4.0.0
  16748. * @category Array
  16749. * @param {...Array} [arrays] The arrays to inspect.
  16750. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16751. * @returns {Array} Returns the new array of combined values.
  16752. * @example
  16753. *
  16754. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  16755. * // => [2.1, 1.2]
  16756. *
  16757. * // The `_.property` iteratee shorthand.
  16758. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  16759. * // => [{ 'x': 1 }, { 'x': 2 }]
  16760. */
  16761. var unionBy = baseRest(function(arrays) {
  16762. var iteratee = last(arrays);
  16763. if (isArrayLikeObject(iteratee)) {
  16764. iteratee = undefined;
  16765. }
  16766. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  16767. });
  16768. /**
  16769. * This method is like `_.union` except that it accepts `comparator` which
  16770. * is invoked to compare elements of `arrays`. Result values are chosen from
  16771. * the first array in which the value occurs. The comparator is invoked
  16772. * with two arguments: (arrVal, othVal).
  16773. *
  16774. * @static
  16775. * @memberOf _
  16776. * @since 4.0.0
  16777. * @category Array
  16778. * @param {...Array} [arrays] The arrays to inspect.
  16779. * @param {Function} [comparator] The comparator invoked per element.
  16780. * @returns {Array} Returns the new array of combined values.
  16781. * @example
  16782. *
  16783. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  16784. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16785. *
  16786. * _.unionWith(objects, others, _.isEqual);
  16787. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  16788. */
  16789. var unionWith = baseRest(function(arrays) {
  16790. var comparator = last(arrays);
  16791. comparator = typeof comparator == 'function' ? comparator : undefined;
  16792. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  16793. });
  16794. /**
  16795. * Creates a duplicate-free version of an array, using
  16796. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16797. * for equality comparisons, in which only the first occurrence of each element
  16798. * is kept. The order of result values is determined by the order they occur
  16799. * in the array.
  16800. *
  16801. * @static
  16802. * @memberOf _
  16803. * @since 0.1.0
  16804. * @category Array
  16805. * @param {Array} array The array to inspect.
  16806. * @returns {Array} Returns the new duplicate free array.
  16807. * @example
  16808. *
  16809. * _.uniq([2, 1, 2]);
  16810. * // => [2, 1]
  16811. */
  16812. function uniq(array) {
  16813. return (array && array.length) ? baseUniq(array) : [];
  16814. }
  16815. /**
  16816. * This method is like `_.uniq` except that it accepts `iteratee` which is
  16817. * invoked for each element in `array` to generate the criterion by which
  16818. * uniqueness is computed. The order of result values is determined by the
  16819. * order they occur in the array. The iteratee is invoked with one argument:
  16820. * (value).
  16821. *
  16822. * @static
  16823. * @memberOf _
  16824. * @since 4.0.0
  16825. * @category Array
  16826. * @param {Array} array The array to inspect.
  16827. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16828. * @returns {Array} Returns the new duplicate free array.
  16829. * @example
  16830. *
  16831. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  16832. * // => [2.1, 1.2]
  16833. *
  16834. * // The `_.property` iteratee shorthand.
  16835. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  16836. * // => [{ 'x': 1 }, { 'x': 2 }]
  16837. */
  16838. function uniqBy(array, iteratee) {
  16839. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  16840. }
  16841. /**
  16842. * This method is like `_.uniq` except that it accepts `comparator` which
  16843. * is invoked to compare elements of `array`. The order of result values is
  16844. * determined by the order they occur in the array.The comparator is invoked
  16845. * with two arguments: (arrVal, othVal).
  16846. *
  16847. * @static
  16848. * @memberOf _
  16849. * @since 4.0.0
  16850. * @category Array
  16851. * @param {Array} array The array to inspect.
  16852. * @param {Function} [comparator] The comparator invoked per element.
  16853. * @returns {Array} Returns the new duplicate free array.
  16854. * @example
  16855. *
  16856. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16857. *
  16858. * _.uniqWith(objects, _.isEqual);
  16859. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  16860. */
  16861. function uniqWith(array, comparator) {
  16862. comparator = typeof comparator == 'function' ? comparator : undefined;
  16863. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  16864. }
  16865. /**
  16866. * This method is like `_.zip` except that it accepts an array of grouped
  16867. * elements and creates an array regrouping the elements to their pre-zip
  16868. * configuration.
  16869. *
  16870. * @static
  16871. * @memberOf _
  16872. * @since 1.2.0
  16873. * @category Array
  16874. * @param {Array} array The array of grouped elements to process.
  16875. * @returns {Array} Returns the new array of regrouped elements.
  16876. * @example
  16877. *
  16878. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  16879. * // => [['a', 1, true], ['b', 2, false]]
  16880. *
  16881. * _.unzip(zipped);
  16882. * // => [['a', 'b'], [1, 2], [true, false]]
  16883. */
  16884. function unzip(array) {
  16885. if (!(array && array.length)) {
  16886. return [];
  16887. }
  16888. var length = 0;
  16889. array = arrayFilter(array, function(group) {
  16890. if (isArrayLikeObject(group)) {
  16891. length = nativeMax(group.length, length);
  16892. return true;
  16893. }
  16894. });
  16895. return baseTimes(length, function(index) {
  16896. return arrayMap(array, baseProperty(index));
  16897. });
  16898. }
  16899. /**
  16900. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  16901. * how regrouped values should be combined. The iteratee is invoked with the
  16902. * elements of each group: (...group).
  16903. *
  16904. * @static
  16905. * @memberOf _
  16906. * @since 3.8.0
  16907. * @category Array
  16908. * @param {Array} array The array of grouped elements to process.
  16909. * @param {Function} [iteratee=_.identity] The function to combine
  16910. * regrouped values.
  16911. * @returns {Array} Returns the new array of regrouped elements.
  16912. * @example
  16913. *
  16914. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  16915. * // => [[1, 10, 100], [2, 20, 200]]
  16916. *
  16917. * _.unzipWith(zipped, _.add);
  16918. * // => [3, 30, 300]
  16919. */
  16920. function unzipWith(array, iteratee) {
  16921. if (!(array && array.length)) {
  16922. return [];
  16923. }
  16924. var result = unzip(array);
  16925. if (iteratee == null) {
  16926. return result;
  16927. }
  16928. return arrayMap(result, function(group) {
  16929. return apply(iteratee, undefined, group);
  16930. });
  16931. }
  16932. /**
  16933. * Creates an array excluding all given values using
  16934. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16935. * for equality comparisons.
  16936. *
  16937. * **Note:** Unlike `_.pull`, this method returns a new array.
  16938. *
  16939. * @static
  16940. * @memberOf _
  16941. * @since 0.1.0
  16942. * @category Array
  16943. * @param {Array} array The array to inspect.
  16944. * @param {...*} [values] The values to exclude.
  16945. * @returns {Array} Returns the new array of filtered values.
  16946. * @see _.difference, _.xor
  16947. * @example
  16948. *
  16949. * _.without([2, 1, 2, 3], 1, 2);
  16950. * // => [3]
  16951. */
  16952. var without = baseRest(function(array, values) {
  16953. return isArrayLikeObject(array)
  16954. ? baseDifference(array, values)
  16955. : [];
  16956. });
  16957. /**
  16958. * Creates an array of unique values that is the
  16959. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  16960. * of the given arrays. The order of result values is determined by the order
  16961. * they occur in the arrays.
  16962. *
  16963. * @static
  16964. * @memberOf _
  16965. * @since 2.4.0
  16966. * @category Array
  16967. * @param {...Array} [arrays] The arrays to inspect.
  16968. * @returns {Array} Returns the new array of filtered values.
  16969. * @see _.difference, _.without
  16970. * @example
  16971. *
  16972. * _.xor([2, 1], [2, 3]);
  16973. * // => [1, 3]
  16974. */
  16975. var xor = baseRest(function(arrays) {
  16976. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  16977. });
  16978. /**
  16979. * This method is like `_.xor` except that it accepts `iteratee` which is
  16980. * invoked for each element of each `arrays` to generate the criterion by
  16981. * which by which they're compared. The order of result values is determined
  16982. * by the order they occur in the arrays. The iteratee is invoked with one
  16983. * argument: (value).
  16984. *
  16985. * @static
  16986. * @memberOf _
  16987. * @since 4.0.0
  16988. * @category Array
  16989. * @param {...Array} [arrays] The arrays to inspect.
  16990. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16991. * @returns {Array} Returns the new array of filtered values.
  16992. * @example
  16993. *
  16994. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  16995. * // => [1.2, 3.4]
  16996. *
  16997. * // The `_.property` iteratee shorthand.
  16998. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  16999. * // => [{ 'x': 2 }]
  17000. */
  17001. var xorBy = baseRest(function(arrays) {
  17002. var iteratee = last(arrays);
  17003. if (isArrayLikeObject(iteratee)) {
  17004. iteratee = undefined;
  17005. }
  17006. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  17007. });
  17008. /**
  17009. * This method is like `_.xor` except that it accepts `comparator` which is
  17010. * invoked to compare elements of `arrays`. The order of result values is
  17011. * determined by the order they occur in the arrays. The comparator is invoked
  17012. * with two arguments: (arrVal, othVal).
  17013. *
  17014. * @static
  17015. * @memberOf _
  17016. * @since 4.0.0
  17017. * @category Array
  17018. * @param {...Array} [arrays] The arrays to inspect.
  17019. * @param {Function} [comparator] The comparator invoked per element.
  17020. * @returns {Array} Returns the new array of filtered values.
  17021. * @example
  17022. *
  17023. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  17024. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  17025. *
  17026. * _.xorWith(objects, others, _.isEqual);
  17027. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  17028. */
  17029. var xorWith = baseRest(function(arrays) {
  17030. var comparator = last(arrays);
  17031. comparator = typeof comparator == 'function' ? comparator : undefined;
  17032. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  17033. });
  17034. /**
  17035. * Creates an array of grouped elements, the first of which contains the
  17036. * first elements of the given arrays, the second of which contains the
  17037. * second elements of the given arrays, and so on.
  17038. *
  17039. * @static
  17040. * @memberOf _
  17041. * @since 0.1.0
  17042. * @category Array
  17043. * @param {...Array} [arrays] The arrays to process.
  17044. * @returns {Array} Returns the new array of grouped elements.
  17045. * @example
  17046. *
  17047. * _.zip(['a', 'b'], [1, 2], [true, false]);
  17048. * // => [['a', 1, true], ['b', 2, false]]
  17049. */
  17050. var zip = baseRest(unzip);
  17051. /**
  17052. * This method is like `_.fromPairs` except that it accepts two arrays,
  17053. * one of property identifiers and one of corresponding values.
  17054. *
  17055. * @static
  17056. * @memberOf _
  17057. * @since 0.4.0
  17058. * @category Array
  17059. * @param {Array} [props=[]] The property identifiers.
  17060. * @param {Array} [values=[]] The property values.
  17061. * @returns {Object} Returns the new object.
  17062. * @example
  17063. *
  17064. * _.zipObject(['a', 'b'], [1, 2]);
  17065. * // => { 'a': 1, 'b': 2 }
  17066. */
  17067. function zipObject(props, values) {
  17068. return baseZipObject(props || [], values || [], assignValue);
  17069. }
  17070. /**
  17071. * This method is like `_.zipObject` except that it supports property paths.
  17072. *
  17073. * @static
  17074. * @memberOf _
  17075. * @since 4.1.0
  17076. * @category Array
  17077. * @param {Array} [props=[]] The property identifiers.
  17078. * @param {Array} [values=[]] The property values.
  17079. * @returns {Object} Returns the new object.
  17080. * @example
  17081. *
  17082. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  17083. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  17084. */
  17085. function zipObjectDeep(props, values) {
  17086. return baseZipObject(props || [], values || [], baseSet);
  17087. }
  17088. /**
  17089. * This method is like `_.zip` except that it accepts `iteratee` to specify
  17090. * how grouped values should be combined. The iteratee is invoked with the
  17091. * elements of each group: (...group).
  17092. *
  17093. * @static
  17094. * @memberOf _
  17095. * @since 3.8.0
  17096. * @category Array
  17097. * @param {...Array} [arrays] The arrays to process.
  17098. * @param {Function} [iteratee=_.identity] The function to combine
  17099. * grouped values.
  17100. * @returns {Array} Returns the new array of grouped elements.
  17101. * @example
  17102. *
  17103. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  17104. * return a + b + c;
  17105. * });
  17106. * // => [111, 222]
  17107. */
  17108. var zipWith = baseRest(function(arrays) {
  17109. var length = arrays.length,
  17110. iteratee = length > 1 ? arrays[length - 1] : undefined;
  17111. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  17112. return unzipWith(arrays, iteratee);
  17113. });
  17114. /*------------------------------------------------------------------------*/
  17115. /**
  17116. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  17117. * chain sequences enabled. The result of such sequences must be unwrapped
  17118. * with `_#value`.
  17119. *
  17120. * @static
  17121. * @memberOf _
  17122. * @since 1.3.0
  17123. * @category Seq
  17124. * @param {*} value The value to wrap.
  17125. * @returns {Object} Returns the new `lodash` wrapper instance.
  17126. * @example
  17127. *
  17128. * var users = [
  17129. * { 'user': 'barney', 'age': 36 },
  17130. * { 'user': 'fred', 'age': 40 },
  17131. * { 'user': 'pebbles', 'age': 1 }
  17132. * ];
  17133. *
  17134. * var youngest = _
  17135. * .chain(users)
  17136. * .sortBy('age')
  17137. * .map(function(o) {
  17138. * return o.user + ' is ' + o.age;
  17139. * })
  17140. * .head()
  17141. * .value();
  17142. * // => 'pebbles is 1'
  17143. */
  17144. function chain(value) {
  17145. var result = lodash(value);
  17146. result.__chain__ = true;
  17147. return result;
  17148. }
  17149. /**
  17150. * This method invokes `interceptor` and returns `value`. The interceptor
  17151. * is invoked with one argument; (value). The purpose of this method is to
  17152. * "tap into" a method chain sequence in order to modify intermediate results.
  17153. *
  17154. * @static
  17155. * @memberOf _
  17156. * @since 0.1.0
  17157. * @category Seq
  17158. * @param {*} value The value to provide to `interceptor`.
  17159. * @param {Function} interceptor The function to invoke.
  17160. * @returns {*} Returns `value`.
  17161. * @example
  17162. *
  17163. * _([1, 2, 3])
  17164. * .tap(function(array) {
  17165. * // Mutate input array.
  17166. * array.pop();
  17167. * })
  17168. * .reverse()
  17169. * .value();
  17170. * // => [2, 1]
  17171. */
  17172. function tap(value, interceptor) {
  17173. interceptor(value);
  17174. return value;
  17175. }
  17176. /**
  17177. * This method is like `_.tap` except that it returns the result of `interceptor`.
  17178. * The purpose of this method is to "pass thru" values replacing intermediate
  17179. * results in a method chain sequence.
  17180. *
  17181. * @static
  17182. * @memberOf _
  17183. * @since 3.0.0
  17184. * @category Seq
  17185. * @param {*} value The value to provide to `interceptor`.
  17186. * @param {Function} interceptor The function to invoke.
  17187. * @returns {*} Returns the result of `interceptor`.
  17188. * @example
  17189. *
  17190. * _(' abc ')
  17191. * .chain()
  17192. * .trim()
  17193. * .thru(function(value) {
  17194. * return [value];
  17195. * })
  17196. * .value();
  17197. * // => ['abc']
  17198. */
  17199. function thru(value, interceptor) {
  17200. return interceptor(value);
  17201. }
  17202. /**
  17203. * This method is the wrapper version of `_.at`.
  17204. *
  17205. * @name at
  17206. * @memberOf _
  17207. * @since 1.0.0
  17208. * @category Seq
  17209. * @param {...(string|string[])} [paths] The property paths to pick.
  17210. * @returns {Object} Returns the new `lodash` wrapper instance.
  17211. * @example
  17212. *
  17213. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  17214. *
  17215. * _(object).at(['a[0].b.c', 'a[1]']).value();
  17216. * // => [3, 4]
  17217. */
  17218. var wrapperAt = flatRest(function(paths) {
  17219. var length = paths.length,
  17220. start = length ? paths[0] : 0,
  17221. value = this.__wrapped__,
  17222. interceptor = function(object) { return baseAt(object, paths); };
  17223. if (length > 1 || this.__actions__.length ||
  17224. !(value instanceof LazyWrapper) || !isIndex(start)) {
  17225. return this.thru(interceptor);
  17226. }
  17227. value = value.slice(start, +start + (length ? 1 : 0));
  17228. value.__actions__.push({
  17229. 'func': thru,
  17230. 'args': [interceptor],
  17231. 'thisArg': undefined
  17232. });
  17233. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  17234. if (length && !array.length) {
  17235. array.push(undefined);
  17236. }
  17237. return array;
  17238. });
  17239. });
  17240. /**
  17241. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  17242. *
  17243. * @name chain
  17244. * @memberOf _
  17245. * @since 0.1.0
  17246. * @category Seq
  17247. * @returns {Object} Returns the new `lodash` wrapper instance.
  17248. * @example
  17249. *
  17250. * var users = [
  17251. * { 'user': 'barney', 'age': 36 },
  17252. * { 'user': 'fred', 'age': 40 }
  17253. * ];
  17254. *
  17255. * // A sequence without explicit chaining.
  17256. * _(users).head();
  17257. * // => { 'user': 'barney', 'age': 36 }
  17258. *
  17259. * // A sequence with explicit chaining.
  17260. * _(users)
  17261. * .chain()
  17262. * .head()
  17263. * .pick('user')
  17264. * .value();
  17265. * // => { 'user': 'barney' }
  17266. */
  17267. function wrapperChain() {
  17268. return chain(this);
  17269. }
  17270. /**
  17271. * Executes the chain sequence and returns the wrapped result.
  17272. *
  17273. * @name commit
  17274. * @memberOf _
  17275. * @since 3.2.0
  17276. * @category Seq
  17277. * @returns {Object} Returns the new `lodash` wrapper instance.
  17278. * @example
  17279. *
  17280. * var array = [1, 2];
  17281. * var wrapped = _(array).push(3);
  17282. *
  17283. * console.log(array);
  17284. * // => [1, 2]
  17285. *
  17286. * wrapped = wrapped.commit();
  17287. * console.log(array);
  17288. * // => [1, 2, 3]
  17289. *
  17290. * wrapped.last();
  17291. * // => 3
  17292. *
  17293. * console.log(array);
  17294. * // => [1, 2, 3]
  17295. */
  17296. function wrapperCommit() {
  17297. return new LodashWrapper(this.value(), this.__chain__);
  17298. }
  17299. /**
  17300. * Gets the next value on a wrapped object following the
  17301. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  17302. *
  17303. * @name next
  17304. * @memberOf _
  17305. * @since 4.0.0
  17306. * @category Seq
  17307. * @returns {Object} Returns the next iterator value.
  17308. * @example
  17309. *
  17310. * var wrapped = _([1, 2]);
  17311. *
  17312. * wrapped.next();
  17313. * // => { 'done': false, 'value': 1 }
  17314. *
  17315. * wrapped.next();
  17316. * // => { 'done': false, 'value': 2 }
  17317. *
  17318. * wrapped.next();
  17319. * // => { 'done': true, 'value': undefined }
  17320. */
  17321. function wrapperNext() {
  17322. if (this.__values__ === undefined) {
  17323. this.__values__ = toArray(this.value());
  17324. }
  17325. var done = this.__index__ >= this.__values__.length,
  17326. value = done ? undefined : this.__values__[this.__index__++];
  17327. return { 'done': done, 'value': value };
  17328. }
  17329. /**
  17330. * Enables the wrapper to be iterable.
  17331. *
  17332. * @name Symbol.iterator
  17333. * @memberOf _
  17334. * @since 4.0.0
  17335. * @category Seq
  17336. * @returns {Object} Returns the wrapper object.
  17337. * @example
  17338. *
  17339. * var wrapped = _([1, 2]);
  17340. *
  17341. * wrapped[Symbol.iterator]() === wrapped;
  17342. * // => true
  17343. *
  17344. * Array.from(wrapped);
  17345. * // => [1, 2]
  17346. */
  17347. function wrapperToIterator() {
  17348. return this;
  17349. }
  17350. /**
  17351. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  17352. *
  17353. * @name plant
  17354. * @memberOf _
  17355. * @since 3.2.0
  17356. * @category Seq
  17357. * @param {*} value The value to plant.
  17358. * @returns {Object} Returns the new `lodash` wrapper instance.
  17359. * @example
  17360. *
  17361. * function square(n) {
  17362. * return n * n;
  17363. * }
  17364. *
  17365. * var wrapped = _([1, 2]).map(square);
  17366. * var other = wrapped.plant([3, 4]);
  17367. *
  17368. * other.value();
  17369. * // => [9, 16]
  17370. *
  17371. * wrapped.value();
  17372. * // => [1, 4]
  17373. */
  17374. function wrapperPlant(value) {
  17375. var result,
  17376. parent = this;
  17377. while (parent instanceof baseLodash) {
  17378. var clone = wrapperClone(parent);
  17379. clone.__index__ = 0;
  17380. clone.__values__ = undefined;
  17381. if (result) {
  17382. previous.__wrapped__ = clone;
  17383. } else {
  17384. result = clone;
  17385. }
  17386. var previous = clone;
  17387. parent = parent.__wrapped__;
  17388. }
  17389. previous.__wrapped__ = value;
  17390. return result;
  17391. }
  17392. /**
  17393. * This method is the wrapper version of `_.reverse`.
  17394. *
  17395. * **Note:** This method mutates the wrapped array.
  17396. *
  17397. * @name reverse
  17398. * @memberOf _
  17399. * @since 0.1.0
  17400. * @category Seq
  17401. * @returns {Object} Returns the new `lodash` wrapper instance.
  17402. * @example
  17403. *
  17404. * var array = [1, 2, 3];
  17405. *
  17406. * _(array).reverse().value()
  17407. * // => [3, 2, 1]
  17408. *
  17409. * console.log(array);
  17410. * // => [3, 2, 1]
  17411. */
  17412. function wrapperReverse() {
  17413. var value = this.__wrapped__;
  17414. if (value instanceof LazyWrapper) {
  17415. var wrapped = value;
  17416. if (this.__actions__.length) {
  17417. wrapped = new LazyWrapper(this);
  17418. }
  17419. wrapped = wrapped.reverse();
  17420. wrapped.__actions__.push({
  17421. 'func': thru,
  17422. 'args': [reverse],
  17423. 'thisArg': undefined
  17424. });
  17425. return new LodashWrapper(wrapped, this.__chain__);
  17426. }
  17427. return this.thru(reverse);
  17428. }
  17429. /**
  17430. * Executes the chain sequence to resolve the unwrapped value.
  17431. *
  17432. * @name value
  17433. * @memberOf _
  17434. * @since 0.1.0
  17435. * @alias toJSON, valueOf
  17436. * @category Seq
  17437. * @returns {*} Returns the resolved unwrapped value.
  17438. * @example
  17439. *
  17440. * _([1, 2, 3]).value();
  17441. * // => [1, 2, 3]
  17442. */
  17443. function wrapperValue() {
  17444. return baseWrapperValue(this.__wrapped__, this.__actions__);
  17445. }
  17446. /*------------------------------------------------------------------------*/
  17447. /**
  17448. * Creates an object composed of keys generated from the results of running
  17449. * each element of `collection` thru `iteratee`. The corresponding value of
  17450. * each key is the number of times the key was returned by `iteratee`. The
  17451. * iteratee is invoked with one argument: (value).
  17452. *
  17453. * @static
  17454. * @memberOf _
  17455. * @since 0.5.0
  17456. * @category Collection
  17457. * @param {Array|Object} collection The collection to iterate over.
  17458. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17459. * @returns {Object} Returns the composed aggregate object.
  17460. * @example
  17461. *
  17462. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  17463. * // => { '4': 1, '6': 2 }
  17464. *
  17465. * // The `_.property` iteratee shorthand.
  17466. * _.countBy(['one', 'two', 'three'], 'length');
  17467. * // => { '3': 2, '5': 1 }
  17468. */
  17469. var countBy = createAggregator(function(result, value, key) {
  17470. if (hasOwnProperty.call(result, key)) {
  17471. ++result[key];
  17472. } else {
  17473. baseAssignValue(result, key, 1);
  17474. }
  17475. });
  17476. /**
  17477. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  17478. * Iteration is stopped once `predicate` returns falsey. The predicate is
  17479. * invoked with three arguments: (value, index|key, collection).
  17480. *
  17481. * **Note:** This method returns `true` for
  17482. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  17483. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  17484. * elements of empty collections.
  17485. *
  17486. * @static
  17487. * @memberOf _
  17488. * @since 0.1.0
  17489. * @category Collection
  17490. * @param {Array|Object} collection The collection to iterate over.
  17491. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17492. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  17493. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  17494. * else `false`.
  17495. * @example
  17496. *
  17497. * _.every([true, 1, null, 'yes'], Boolean);
  17498. * // => false
  17499. *
  17500. * var users = [
  17501. * { 'user': 'barney', 'age': 36, 'active': false },
  17502. * { 'user': 'fred', 'age': 40, 'active': false }
  17503. * ];
  17504. *
  17505. * // The `_.matches` iteratee shorthand.
  17506. * _.every(users, { 'user': 'barney', 'active': false });
  17507. * // => false
  17508. *
  17509. * // The `_.matchesProperty` iteratee shorthand.
  17510. * _.every(users, ['active', false]);
  17511. * // => true
  17512. *
  17513. * // The `_.property` iteratee shorthand.
  17514. * _.every(users, 'active');
  17515. * // => false
  17516. */
  17517. function every(collection, predicate, guard) {
  17518. var func = isArray(collection) ? arrayEvery : baseEvery;
  17519. if (guard && isIterateeCall(collection, predicate, guard)) {
  17520. predicate = undefined;
  17521. }
  17522. return func(collection, getIteratee(predicate, 3));
  17523. }
  17524. /**
  17525. * Iterates over elements of `collection`, returning an array of all elements
  17526. * `predicate` returns truthy for. The predicate is invoked with three
  17527. * arguments: (value, index|key, collection).
  17528. *
  17529. * **Note:** Unlike `_.remove`, this method returns a new array.
  17530. *
  17531. * @static
  17532. * @memberOf _
  17533. * @since 0.1.0
  17534. * @category Collection
  17535. * @param {Array|Object} collection The collection to iterate over.
  17536. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17537. * @returns {Array} Returns the new filtered array.
  17538. * @see _.reject
  17539. * @example
  17540. *
  17541. * var users = [
  17542. * { 'user': 'barney', 'age': 36, 'active': true },
  17543. * { 'user': 'fred', 'age': 40, 'active': false }
  17544. * ];
  17545. *
  17546. * _.filter(users, function(o) { return !o.active; });
  17547. * // => objects for ['fred']
  17548. *
  17549. * // The `_.matches` iteratee shorthand.
  17550. * _.filter(users, { 'age': 36, 'active': true });
  17551. * // => objects for ['barney']
  17552. *
  17553. * // The `_.matchesProperty` iteratee shorthand.
  17554. * _.filter(users, ['active', false]);
  17555. * // => objects for ['fred']
  17556. *
  17557. * // The `_.property` iteratee shorthand.
  17558. * _.filter(users, 'active');
  17559. * // => objects for ['barney']
  17560. */
  17561. function filter(collection, predicate) {
  17562. var func = isArray(collection) ? arrayFilter : baseFilter;
  17563. return func(collection, getIteratee(predicate, 3));
  17564. }
  17565. /**
  17566. * Iterates over elements of `collection`, returning the first element
  17567. * `predicate` returns truthy for. The predicate is invoked with three
  17568. * arguments: (value, index|key, collection).
  17569. *
  17570. * @static
  17571. * @memberOf _
  17572. * @since 0.1.0
  17573. * @category Collection
  17574. * @param {Array|Object} collection The collection to inspect.
  17575. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17576. * @param {number} [fromIndex=0] The index to search from.
  17577. * @returns {*} Returns the matched element, else `undefined`.
  17578. * @example
  17579. *
  17580. * var users = [
  17581. * { 'user': 'barney', 'age': 36, 'active': true },
  17582. * { 'user': 'fred', 'age': 40, 'active': false },
  17583. * { 'user': 'pebbles', 'age': 1, 'active': true }
  17584. * ];
  17585. *
  17586. * _.find(users, function(o) { return o.age < 40; });
  17587. * // => object for 'barney'
  17588. *
  17589. * // The `_.matches` iteratee shorthand.
  17590. * _.find(users, { 'age': 1, 'active': true });
  17591. * // => object for 'pebbles'
  17592. *
  17593. * // The `_.matchesProperty` iteratee shorthand.
  17594. * _.find(users, ['active', false]);
  17595. * // => object for 'fred'
  17596. *
  17597. * // The `_.property` iteratee shorthand.
  17598. * _.find(users, 'active');
  17599. * // => object for 'barney'
  17600. */
  17601. var find = createFind(findIndex);
  17602. /**
  17603. * This method is like `_.find` except that it iterates over elements of
  17604. * `collection` from right to left.
  17605. *
  17606. * @static
  17607. * @memberOf _
  17608. * @since 2.0.0
  17609. * @category Collection
  17610. * @param {Array|Object} collection The collection to inspect.
  17611. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17612. * @param {number} [fromIndex=collection.length-1] The index to search from.
  17613. * @returns {*} Returns the matched element, else `undefined`.
  17614. * @example
  17615. *
  17616. * _.findLast([1, 2, 3, 4], function(n) {
  17617. * return n % 2 == 1;
  17618. * });
  17619. * // => 3
  17620. */
  17621. var findLast = createFind(findLastIndex);
  17622. /**
  17623. * Creates a flattened array of values by running each element in `collection`
  17624. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  17625. * with three arguments: (value, index|key, collection).
  17626. *
  17627. * @static
  17628. * @memberOf _
  17629. * @since 4.0.0
  17630. * @category Collection
  17631. * @param {Array|Object} collection The collection to iterate over.
  17632. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17633. * @returns {Array} Returns the new flattened array.
  17634. * @example
  17635. *
  17636. * function duplicate(n) {
  17637. * return [n, n];
  17638. * }
  17639. *
  17640. * _.flatMap([1, 2], duplicate);
  17641. * // => [1, 1, 2, 2]
  17642. */
  17643. function flatMap(collection, iteratee) {
  17644. return baseFlatten(map(collection, iteratee), 1);
  17645. }
  17646. /**
  17647. * This method is like `_.flatMap` except that it recursively flattens the
  17648. * mapped results.
  17649. *
  17650. * @static
  17651. * @memberOf _
  17652. * @since 4.7.0
  17653. * @category Collection
  17654. * @param {Array|Object} collection The collection to iterate over.
  17655. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17656. * @returns {Array} Returns the new flattened array.
  17657. * @example
  17658. *
  17659. * function duplicate(n) {
  17660. * return [[[n, n]]];
  17661. * }
  17662. *
  17663. * _.flatMapDeep([1, 2], duplicate);
  17664. * // => [1, 1, 2, 2]
  17665. */
  17666. function flatMapDeep(collection, iteratee) {
  17667. return baseFlatten(map(collection, iteratee), INFINITY);
  17668. }
  17669. /**
  17670. * This method is like `_.flatMap` except that it recursively flattens the
  17671. * mapped results up to `depth` times.
  17672. *
  17673. * @static
  17674. * @memberOf _
  17675. * @since 4.7.0
  17676. * @category Collection
  17677. * @param {Array|Object} collection The collection to iterate over.
  17678. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17679. * @param {number} [depth=1] The maximum recursion depth.
  17680. * @returns {Array} Returns the new flattened array.
  17681. * @example
  17682. *
  17683. * function duplicate(n) {
  17684. * return [[[n, n]]];
  17685. * }
  17686. *
  17687. * _.flatMapDepth([1, 2], duplicate, 2);
  17688. * // => [[1, 1], [2, 2]]
  17689. */
  17690. function flatMapDepth(collection, iteratee, depth) {
  17691. depth = depth === undefined ? 1 : toInteger(depth);
  17692. return baseFlatten(map(collection, iteratee), depth);
  17693. }
  17694. /**
  17695. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  17696. * The iteratee is invoked with three arguments: (value, index|key, collection).
  17697. * Iteratee functions may exit iteration early by explicitly returning `false`.
  17698. *
  17699. * **Note:** As with other "Collections" methods, objects with a "length"
  17700. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  17701. * or `_.forOwn` for object iteration.
  17702. *
  17703. * @static
  17704. * @memberOf _
  17705. * @since 0.1.0
  17706. * @alias each
  17707. * @category Collection
  17708. * @param {Array|Object} collection The collection to iterate over.
  17709. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17710. * @returns {Array|Object} Returns `collection`.
  17711. * @see _.forEachRight
  17712. * @example
  17713. *
  17714. * _.forEach([1, 2], function(value) {
  17715. * console.log(value);
  17716. * });
  17717. * // => Logs `1` then `2`.
  17718. *
  17719. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  17720. * console.log(key);
  17721. * });
  17722. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  17723. */
  17724. function forEach(collection, iteratee) {
  17725. var func = isArray(collection) ? arrayEach : baseEach;
  17726. return func(collection, getIteratee(iteratee, 3));
  17727. }
  17728. /**
  17729. * This method is like `_.forEach` except that it iterates over elements of
  17730. * `collection` from right to left.
  17731. *
  17732. * @static
  17733. * @memberOf _
  17734. * @since 2.0.0
  17735. * @alias eachRight
  17736. * @category Collection
  17737. * @param {Array|Object} collection The collection to iterate over.
  17738. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17739. * @returns {Array|Object} Returns `collection`.
  17740. * @see _.forEach
  17741. * @example
  17742. *
  17743. * _.forEachRight([1, 2], function(value) {
  17744. * console.log(value);
  17745. * });
  17746. * // => Logs `2` then `1`.
  17747. */
  17748. function forEachRight(collection, iteratee) {
  17749. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  17750. return func(collection, getIteratee(iteratee, 3));
  17751. }
  17752. /**
  17753. * Creates an object composed of keys generated from the results of running
  17754. * each element of `collection` thru `iteratee`. The order of grouped values
  17755. * is determined by the order they occur in `collection`. The corresponding
  17756. * value of each key is an array of elements responsible for generating the
  17757. * key. The iteratee is invoked with one argument: (value).
  17758. *
  17759. * @static
  17760. * @memberOf _
  17761. * @since 0.1.0
  17762. * @category Collection
  17763. * @param {Array|Object} collection The collection to iterate over.
  17764. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17765. * @returns {Object} Returns the composed aggregate object.
  17766. * @example
  17767. *
  17768. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  17769. * // => { '4': [4.2], '6': [6.1, 6.3] }
  17770. *
  17771. * // The `_.property` iteratee shorthand.
  17772. * _.groupBy(['one', 'two', 'three'], 'length');
  17773. * // => { '3': ['one', 'two'], '5': ['three'] }
  17774. */
  17775. var groupBy = createAggregator(function(result, value, key) {
  17776. if (hasOwnProperty.call(result, key)) {
  17777. result[key].push(value);
  17778. } else {
  17779. baseAssignValue(result, key, [value]);
  17780. }
  17781. });
  17782. /**
  17783. * Checks if `value` is in `collection`. If `collection` is a string, it's
  17784. * checked for a substring of `value`, otherwise
  17785. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  17786. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  17787. * the offset from the end of `collection`.
  17788. *
  17789. * @static
  17790. * @memberOf _
  17791. * @since 0.1.0
  17792. * @category Collection
  17793. * @param {Array|Object|string} collection The collection to inspect.
  17794. * @param {*} value The value to search for.
  17795. * @param {number} [fromIndex=0] The index to search from.
  17796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  17797. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  17798. * @example
  17799. *
  17800. * _.includes([1, 2, 3], 1);
  17801. * // => true
  17802. *
  17803. * _.includes([1, 2, 3], 1, 2);
  17804. * // => false
  17805. *
  17806. * _.includes({ 'a': 1, 'b': 2 }, 1);
  17807. * // => true
  17808. *
  17809. * _.includes('abcd', 'bc');
  17810. * // => true
  17811. */
  17812. function includes(collection, value, fromIndex, guard) {
  17813. collection = isArrayLike(collection) ? collection : values(collection);
  17814. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  17815. var length = collection.length;
  17816. if (fromIndex < 0) {
  17817. fromIndex = nativeMax(length + fromIndex, 0);
  17818. }
  17819. return isString(collection)
  17820. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  17821. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  17822. }
  17823. /**
  17824. * Invokes the method at `path` of each element in `collection`, returning
  17825. * an array of the results of each invoked method. Any additional arguments
  17826. * are provided to each invoked method. If `path` is a function, it's invoked
  17827. * for, and `this` bound to, each element in `collection`.
  17828. *
  17829. * @static
  17830. * @memberOf _
  17831. * @since 4.0.0
  17832. * @category Collection
  17833. * @param {Array|Object} collection The collection to iterate over.
  17834. * @param {Array|Function|string} path The path of the method to invoke or
  17835. * the function invoked per iteration.
  17836. * @param {...*} [args] The arguments to invoke each method with.
  17837. * @returns {Array} Returns the array of results.
  17838. * @example
  17839. *
  17840. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  17841. * // => [[1, 5, 7], [1, 2, 3]]
  17842. *
  17843. * _.invokeMap([123, 456], String.prototype.split, '');
  17844. * // => [['1', '2', '3'], ['4', '5', '6']]
  17845. */
  17846. var invokeMap = baseRest(function(collection, path, args) {
  17847. var index = -1,
  17848. isFunc = typeof path == 'function',
  17849. result = isArrayLike(collection) ? Array(collection.length) : [];
  17850. baseEach(collection, function(value) {
  17851. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  17852. });
  17853. return result;
  17854. });
  17855. /**
  17856. * Creates an object composed of keys generated from the results of running
  17857. * each element of `collection` thru `iteratee`. The corresponding value of
  17858. * each key is the last element responsible for generating the key. The
  17859. * iteratee is invoked with one argument: (value).
  17860. *
  17861. * @static
  17862. * @memberOf _
  17863. * @since 4.0.0
  17864. * @category Collection
  17865. * @param {Array|Object} collection The collection to iterate over.
  17866. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17867. * @returns {Object} Returns the composed aggregate object.
  17868. * @example
  17869. *
  17870. * var array = [
  17871. * { 'dir': 'left', 'code': 97 },
  17872. * { 'dir': 'right', 'code': 100 }
  17873. * ];
  17874. *
  17875. * _.keyBy(array, function(o) {
  17876. * return String.fromCharCode(o.code);
  17877. * });
  17878. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  17879. *
  17880. * _.keyBy(array, 'dir');
  17881. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  17882. */
  17883. var keyBy = createAggregator(function(result, value, key) {
  17884. baseAssignValue(result, key, value);
  17885. });
  17886. /**
  17887. * Creates an array of values by running each element in `collection` thru
  17888. * `iteratee`. The iteratee is invoked with three arguments:
  17889. * (value, index|key, collection).
  17890. *
  17891. * Many lodash methods are guarded to work as iteratees for methods like
  17892. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  17893. *
  17894. * The guarded methods are:
  17895. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  17896. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  17897. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  17898. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  17899. *
  17900. * @static
  17901. * @memberOf _
  17902. * @since 0.1.0
  17903. * @category Collection
  17904. * @param {Array|Object} collection The collection to iterate over.
  17905. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17906. * @returns {Array} Returns the new mapped array.
  17907. * @example
  17908. *
  17909. * function square(n) {
  17910. * return n * n;
  17911. * }
  17912. *
  17913. * _.map([4, 8], square);
  17914. * // => [16, 64]
  17915. *
  17916. * _.map({ 'a': 4, 'b': 8 }, square);
  17917. * // => [16, 64] (iteration order is not guaranteed)
  17918. *
  17919. * var users = [
  17920. * { 'user': 'barney' },
  17921. * { 'user': 'fred' }
  17922. * ];
  17923. *
  17924. * // The `_.property` iteratee shorthand.
  17925. * _.map(users, 'user');
  17926. * // => ['barney', 'fred']
  17927. */
  17928. function map(collection, iteratee) {
  17929. var func = isArray(collection) ? arrayMap : baseMap;
  17930. return func(collection, getIteratee(iteratee, 3));
  17931. }
  17932. /**
  17933. * This method is like `_.sortBy` except that it allows specifying the sort
  17934. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  17935. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  17936. * descending or "asc" for ascending sort order of corresponding values.
  17937. *
  17938. * @static
  17939. * @memberOf _
  17940. * @since 4.0.0
  17941. * @category Collection
  17942. * @param {Array|Object} collection The collection to iterate over.
  17943. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  17944. * The iteratees to sort by.
  17945. * @param {string[]} [orders] The sort orders of `iteratees`.
  17946. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  17947. * @returns {Array} Returns the new sorted array.
  17948. * @example
  17949. *
  17950. * var users = [
  17951. * { 'user': 'fred', 'age': 48 },
  17952. * { 'user': 'barney', 'age': 34 },
  17953. * { 'user': 'fred', 'age': 40 },
  17954. * { 'user': 'barney', 'age': 36 }
  17955. * ];
  17956. *
  17957. * // Sort by `user` in ascending order and by `age` in descending order.
  17958. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  17959. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  17960. */
  17961. function orderBy(collection, iteratees, orders, guard) {
  17962. if (collection == null) {
  17963. return [];
  17964. }
  17965. if (!isArray(iteratees)) {
  17966. iteratees = iteratees == null ? [] : [iteratees];
  17967. }
  17968. orders = guard ? undefined : orders;
  17969. if (!isArray(orders)) {
  17970. orders = orders == null ? [] : [orders];
  17971. }
  17972. return baseOrderBy(collection, iteratees, orders);
  17973. }
  17974. /**
  17975. * Creates an array of elements split into two groups, the first of which
  17976. * contains elements `predicate` returns truthy for, the second of which
  17977. * contains elements `predicate` returns falsey for. The predicate is
  17978. * invoked with one argument: (value).
  17979. *
  17980. * @static
  17981. * @memberOf _
  17982. * @since 3.0.0
  17983. * @category Collection
  17984. * @param {Array|Object} collection The collection to iterate over.
  17985. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17986. * @returns {Array} Returns the array of grouped elements.
  17987. * @example
  17988. *
  17989. * var users = [
  17990. * { 'user': 'barney', 'age': 36, 'active': false },
  17991. * { 'user': 'fred', 'age': 40, 'active': true },
  17992. * { 'user': 'pebbles', 'age': 1, 'active': false }
  17993. * ];
  17994. *
  17995. * _.partition(users, function(o) { return o.active; });
  17996. * // => objects for [['fred'], ['barney', 'pebbles']]
  17997. *
  17998. * // The `_.matches` iteratee shorthand.
  17999. * _.partition(users, { 'age': 1, 'active': false });
  18000. * // => objects for [['pebbles'], ['barney', 'fred']]
  18001. *
  18002. * // The `_.matchesProperty` iteratee shorthand.
  18003. * _.partition(users, ['active', false]);
  18004. * // => objects for [['barney', 'pebbles'], ['fred']]
  18005. *
  18006. * // The `_.property` iteratee shorthand.
  18007. * _.partition(users, 'active');
  18008. * // => objects for [['fred'], ['barney', 'pebbles']]
  18009. */
  18010. var partition = createAggregator(function(result, value, key) {
  18011. result[key ? 0 : 1].push(value);
  18012. }, function() { return [[], []]; });
  18013. /**
  18014. * Reduces `collection` to a value which is the accumulated result of running
  18015. * each element in `collection` thru `iteratee`, where each successive
  18016. * invocation is supplied the return value of the previous. If `accumulator`
  18017. * is not given, the first element of `collection` is used as the initial
  18018. * value. The iteratee is invoked with four arguments:
  18019. * (accumulator, value, index|key, collection).
  18020. *
  18021. * Many lodash methods are guarded to work as iteratees for methods like
  18022. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  18023. *
  18024. * The guarded methods are:
  18025. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  18026. * and `sortBy`
  18027. *
  18028. * @static
  18029. * @memberOf _
  18030. * @since 0.1.0
  18031. * @category Collection
  18032. * @param {Array|Object} collection The collection to iterate over.
  18033. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  18034. * @param {*} [accumulator] The initial value.
  18035. * @returns {*} Returns the accumulated value.
  18036. * @see _.reduceRight
  18037. * @example
  18038. *
  18039. * _.reduce([1, 2], function(sum, n) {
  18040. * return sum + n;
  18041. * }, 0);
  18042. * // => 3
  18043. *
  18044. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  18045. * (result[value] || (result[value] = [])).push(key);
  18046. * return result;
  18047. * }, {});
  18048. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  18049. */
  18050. function reduce(collection, iteratee, accumulator) {
  18051. var func = isArray(collection) ? arrayReduce : baseReduce,
  18052. initAccum = arguments.length < 3;
  18053. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  18054. }
  18055. /**
  18056. * This method is like `_.reduce` except that it iterates over elements of
  18057. * `collection` from right to left.
  18058. *
  18059. * @static
  18060. * @memberOf _
  18061. * @since 0.1.0
  18062. * @category Collection
  18063. * @param {Array|Object} collection The collection to iterate over.
  18064. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  18065. * @param {*} [accumulator] The initial value.
  18066. * @returns {*} Returns the accumulated value.
  18067. * @see _.reduce
  18068. * @example
  18069. *
  18070. * var array = [[0, 1], [2, 3], [4, 5]];
  18071. *
  18072. * _.reduceRight(array, function(flattened, other) {
  18073. * return flattened.concat(other);
  18074. * }, []);
  18075. * // => [4, 5, 2, 3, 0, 1]
  18076. */
  18077. function reduceRight(collection, iteratee, accumulator) {
  18078. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  18079. initAccum = arguments.length < 3;
  18080. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  18081. }
  18082. /**
  18083. * The opposite of `_.filter`; this method returns the elements of `collection`
  18084. * that `predicate` does **not** return truthy for.
  18085. *
  18086. * @static
  18087. * @memberOf _
  18088. * @since 0.1.0
  18089. * @category Collection
  18090. * @param {Array|Object} collection The collection to iterate over.
  18091. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18092. * @returns {Array} Returns the new filtered array.
  18093. * @see _.filter
  18094. * @example
  18095. *
  18096. * var users = [
  18097. * { 'user': 'barney', 'age': 36, 'active': false },
  18098. * { 'user': 'fred', 'age': 40, 'active': true }
  18099. * ];
  18100. *
  18101. * _.reject(users, function(o) { return !o.active; });
  18102. * // => objects for ['fred']
  18103. *
  18104. * // The `_.matches` iteratee shorthand.
  18105. * _.reject(users, { 'age': 40, 'active': true });
  18106. * // => objects for ['barney']
  18107. *
  18108. * // The `_.matchesProperty` iteratee shorthand.
  18109. * _.reject(users, ['active', false]);
  18110. * // => objects for ['fred']
  18111. *
  18112. * // The `_.property` iteratee shorthand.
  18113. * _.reject(users, 'active');
  18114. * // => objects for ['barney']
  18115. */
  18116. function reject(collection, predicate) {
  18117. var func = isArray(collection) ? arrayFilter : baseFilter;
  18118. return func(collection, negate(getIteratee(predicate, 3)));
  18119. }
  18120. /**
  18121. * Gets a random element from `collection`.
  18122. *
  18123. * @static
  18124. * @memberOf _
  18125. * @since 2.0.0
  18126. * @category Collection
  18127. * @param {Array|Object} collection The collection to sample.
  18128. * @returns {*} Returns the random element.
  18129. * @example
  18130. *
  18131. * _.sample([1, 2, 3, 4]);
  18132. * // => 2
  18133. */
  18134. function sample(collection) {
  18135. var func = isArray(collection) ? arraySample : baseSample;
  18136. return func(collection);
  18137. }
  18138. /**
  18139. * Gets `n` random elements at unique keys from `collection` up to the
  18140. * size of `collection`.
  18141. *
  18142. * @static
  18143. * @memberOf _
  18144. * @since 4.0.0
  18145. * @category Collection
  18146. * @param {Array|Object} collection The collection to sample.
  18147. * @param {number} [n=1] The number of elements to sample.
  18148. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18149. * @returns {Array} Returns the random elements.
  18150. * @example
  18151. *
  18152. * _.sampleSize([1, 2, 3], 2);
  18153. * // => [3, 1]
  18154. *
  18155. * _.sampleSize([1, 2, 3], 4);
  18156. * // => [2, 3, 1]
  18157. */
  18158. function sampleSize(collection, n, guard) {
  18159. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  18160. n = 1;
  18161. } else {
  18162. n = toInteger(n);
  18163. }
  18164. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  18165. return func(collection, n);
  18166. }
  18167. /**
  18168. * Creates an array of shuffled values, using a version of the
  18169. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  18170. *
  18171. * @static
  18172. * @memberOf _
  18173. * @since 0.1.0
  18174. * @category Collection
  18175. * @param {Array|Object} collection The collection to shuffle.
  18176. * @returns {Array} Returns the new shuffled array.
  18177. * @example
  18178. *
  18179. * _.shuffle([1, 2, 3, 4]);
  18180. * // => [4, 1, 3, 2]
  18181. */
  18182. function shuffle(collection) {
  18183. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  18184. return func(collection);
  18185. }
  18186. /**
  18187. * Gets the size of `collection` by returning its length for array-like
  18188. * values or the number of own enumerable string keyed properties for objects.
  18189. *
  18190. * @static
  18191. * @memberOf _
  18192. * @since 0.1.0
  18193. * @category Collection
  18194. * @param {Array|Object|string} collection The collection to inspect.
  18195. * @returns {number} Returns the collection size.
  18196. * @example
  18197. *
  18198. * _.size([1, 2, 3]);
  18199. * // => 3
  18200. *
  18201. * _.size({ 'a': 1, 'b': 2 });
  18202. * // => 2
  18203. *
  18204. * _.size('pebbles');
  18205. * // => 7
  18206. */
  18207. function size(collection) {
  18208. if (collection == null) {
  18209. return 0;
  18210. }
  18211. if (isArrayLike(collection)) {
  18212. return isString(collection) ? stringSize(collection) : collection.length;
  18213. }
  18214. var tag = getTag(collection);
  18215. if (tag == mapTag || tag == setTag) {
  18216. return collection.size;
  18217. }
  18218. return baseKeys(collection).length;
  18219. }
  18220. /**
  18221. * Checks if `predicate` returns truthy for **any** element of `collection`.
  18222. * Iteration is stopped once `predicate` returns truthy. The predicate is
  18223. * invoked with three arguments: (value, index|key, collection).
  18224. *
  18225. * @static
  18226. * @memberOf _
  18227. * @since 0.1.0
  18228. * @category Collection
  18229. * @param {Array|Object} collection The collection to iterate over.
  18230. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18231. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18232. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18233. * else `false`.
  18234. * @example
  18235. *
  18236. * _.some([null, 0, 'yes', false], Boolean);
  18237. * // => true
  18238. *
  18239. * var users = [
  18240. * { 'user': 'barney', 'active': true },
  18241. * { 'user': 'fred', 'active': false }
  18242. * ];
  18243. *
  18244. * // The `_.matches` iteratee shorthand.
  18245. * _.some(users, { 'user': 'barney', 'active': false });
  18246. * // => false
  18247. *
  18248. * // The `_.matchesProperty` iteratee shorthand.
  18249. * _.some(users, ['active', false]);
  18250. * // => true
  18251. *
  18252. * // The `_.property` iteratee shorthand.
  18253. * _.some(users, 'active');
  18254. * // => true
  18255. */
  18256. function some(collection, predicate, guard) {
  18257. var func = isArray(collection) ? arraySome : baseSome;
  18258. if (guard && isIterateeCall(collection, predicate, guard)) {
  18259. predicate = undefined;
  18260. }
  18261. return func(collection, getIteratee(predicate, 3));
  18262. }
  18263. /**
  18264. * Creates an array of elements, sorted in ascending order by the results of
  18265. * running each element in a collection thru each iteratee. This method
  18266. * performs a stable sort, that is, it preserves the original sort order of
  18267. * equal elements. The iteratees are invoked with one argument: (value).
  18268. *
  18269. * @static
  18270. * @memberOf _
  18271. * @since 0.1.0
  18272. * @category Collection
  18273. * @param {Array|Object} collection The collection to iterate over.
  18274. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  18275. * The iteratees to sort by.
  18276. * @returns {Array} Returns the new sorted array.
  18277. * @example
  18278. *
  18279. * var users = [
  18280. * { 'user': 'fred', 'age': 48 },
  18281. * { 'user': 'barney', 'age': 36 },
  18282. * { 'user': 'fred', 'age': 40 },
  18283. * { 'user': 'barney', 'age': 34 }
  18284. * ];
  18285. *
  18286. * _.sortBy(users, [function(o) { return o.user; }]);
  18287. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  18288. *
  18289. * _.sortBy(users, ['user', 'age']);
  18290. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  18291. */
  18292. var sortBy = baseRest(function(collection, iteratees) {
  18293. if (collection == null) {
  18294. return [];
  18295. }
  18296. var length = iteratees.length;
  18297. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  18298. iteratees = [];
  18299. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  18300. iteratees = [iteratees[0]];
  18301. }
  18302. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  18303. });
  18304. /*------------------------------------------------------------------------*/
  18305. /**
  18306. * Gets the timestamp of the number of milliseconds that have elapsed since
  18307. * the Unix epoch (1 January 1970 00:00:00 UTC).
  18308. *
  18309. * @static
  18310. * @memberOf _
  18311. * @since 2.4.0
  18312. * @category Date
  18313. * @returns {number} Returns the timestamp.
  18314. * @example
  18315. *
  18316. * _.defer(function(stamp) {
  18317. * console.log(_.now() - stamp);
  18318. * }, _.now());
  18319. * // => Logs the number of milliseconds it took for the deferred invocation.
  18320. */
  18321. var now = ctxNow || function() {
  18322. return root.Date.now();
  18323. };
  18324. /*------------------------------------------------------------------------*/
  18325. /**
  18326. * The opposite of `_.before`; this method creates a function that invokes
  18327. * `func` once it's called `n` or more times.
  18328. *
  18329. * @static
  18330. * @memberOf _
  18331. * @since 0.1.0
  18332. * @category Function
  18333. * @param {number} n The number of calls before `func` is invoked.
  18334. * @param {Function} func The function to restrict.
  18335. * @returns {Function} Returns the new restricted function.
  18336. * @example
  18337. *
  18338. * var saves = ['profile', 'settings'];
  18339. *
  18340. * var done = _.after(saves.length, function() {
  18341. * console.log('done saving!');
  18342. * });
  18343. *
  18344. * _.forEach(saves, function(type) {
  18345. * asyncSave({ 'type': type, 'complete': done });
  18346. * });
  18347. * // => Logs 'done saving!' after the two async saves have completed.
  18348. */
  18349. function after(n, func) {
  18350. if (typeof func != 'function') {
  18351. throw new TypeError(FUNC_ERROR_TEXT);
  18352. }
  18353. n = toInteger(n);
  18354. return function() {
  18355. if (--n < 1) {
  18356. return func.apply(this, arguments);
  18357. }
  18358. };
  18359. }
  18360. /**
  18361. * Creates a function that invokes `func`, with up to `n` arguments,
  18362. * ignoring any additional arguments.
  18363. *
  18364. * @static
  18365. * @memberOf _
  18366. * @since 3.0.0
  18367. * @category Function
  18368. * @param {Function} func The function to cap arguments for.
  18369. * @param {number} [n=func.length] The arity cap.
  18370. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18371. * @returns {Function} Returns the new capped function.
  18372. * @example
  18373. *
  18374. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  18375. * // => [6, 8, 10]
  18376. */
  18377. function ary(func, n, guard) {
  18378. n = guard ? undefined : n;
  18379. n = (func && n == null) ? func.length : n;
  18380. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  18381. }
  18382. /**
  18383. * Creates a function that invokes `func`, with the `this` binding and arguments
  18384. * of the created function, while it's called less than `n` times. Subsequent
  18385. * calls to the created function return the result of the last `func` invocation.
  18386. *
  18387. * @static
  18388. * @memberOf _
  18389. * @since 3.0.0
  18390. * @category Function
  18391. * @param {number} n The number of calls at which `func` is no longer invoked.
  18392. * @param {Function} func The function to restrict.
  18393. * @returns {Function} Returns the new restricted function.
  18394. * @example
  18395. *
  18396. * jQuery(element).on('click', _.before(5, addContactToList));
  18397. * // => Allows adding up to 4 contacts to the list.
  18398. */
  18399. function before(n, func) {
  18400. var result;
  18401. if (typeof func != 'function') {
  18402. throw new TypeError(FUNC_ERROR_TEXT);
  18403. }
  18404. n = toInteger(n);
  18405. return function() {
  18406. if (--n > 0) {
  18407. result = func.apply(this, arguments);
  18408. }
  18409. if (n <= 1) {
  18410. func = undefined;
  18411. }
  18412. return result;
  18413. };
  18414. }
  18415. /**
  18416. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  18417. * and `partials` prepended to the arguments it receives.
  18418. *
  18419. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  18420. * may be used as a placeholder for partially applied arguments.
  18421. *
  18422. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  18423. * property of bound functions.
  18424. *
  18425. * @static
  18426. * @memberOf _
  18427. * @since 0.1.0
  18428. * @category Function
  18429. * @param {Function} func The function to bind.
  18430. * @param {*} thisArg The `this` binding of `func`.
  18431. * @param {...*} [partials] The arguments to be partially applied.
  18432. * @returns {Function} Returns the new bound function.
  18433. * @example
  18434. *
  18435. * function greet(greeting, punctuation) {
  18436. * return greeting + ' ' + this.user + punctuation;
  18437. * }
  18438. *
  18439. * var object = { 'user': 'fred' };
  18440. *
  18441. * var bound = _.bind(greet, object, 'hi');
  18442. * bound('!');
  18443. * // => 'hi fred!'
  18444. *
  18445. * // Bound with placeholders.
  18446. * var bound = _.bind(greet, object, _, '!');
  18447. * bound('hi');
  18448. * // => 'hi fred!'
  18449. */
  18450. var bind = baseRest(function(func, thisArg, partials) {
  18451. var bitmask = WRAP_BIND_FLAG;
  18452. if (partials.length) {
  18453. var holders = replaceHolders(partials, getHolder(bind));
  18454. bitmask |= WRAP_PARTIAL_FLAG;
  18455. }
  18456. return createWrap(func, bitmask, thisArg, partials, holders);
  18457. });
  18458. /**
  18459. * Creates a function that invokes the method at `object[key]` with `partials`
  18460. * prepended to the arguments it receives.
  18461. *
  18462. * This method differs from `_.bind` by allowing bound functions to reference
  18463. * methods that may be redefined or don't yet exist. See
  18464. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  18465. * for more details.
  18466. *
  18467. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  18468. * builds, may be used as a placeholder for partially applied arguments.
  18469. *
  18470. * @static
  18471. * @memberOf _
  18472. * @since 0.10.0
  18473. * @category Function
  18474. * @param {Object} object The object to invoke the method on.
  18475. * @param {string} key The key of the method.
  18476. * @param {...*} [partials] The arguments to be partially applied.
  18477. * @returns {Function} Returns the new bound function.
  18478. * @example
  18479. *
  18480. * var object = {
  18481. * 'user': 'fred',
  18482. * 'greet': function(greeting, punctuation) {
  18483. * return greeting + ' ' + this.user + punctuation;
  18484. * }
  18485. * };
  18486. *
  18487. * var bound = _.bindKey(object, 'greet', 'hi');
  18488. * bound('!');
  18489. * // => 'hi fred!'
  18490. *
  18491. * object.greet = function(greeting, punctuation) {
  18492. * return greeting + 'ya ' + this.user + punctuation;
  18493. * };
  18494. *
  18495. * bound('!');
  18496. * // => 'hiya fred!'
  18497. *
  18498. * // Bound with placeholders.
  18499. * var bound = _.bindKey(object, 'greet', _, '!');
  18500. * bound('hi');
  18501. * // => 'hiya fred!'
  18502. */
  18503. var bindKey = baseRest(function(object, key, partials) {
  18504. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  18505. if (partials.length) {
  18506. var holders = replaceHolders(partials, getHolder(bindKey));
  18507. bitmask |= WRAP_PARTIAL_FLAG;
  18508. }
  18509. return createWrap(key, bitmask, object, partials, holders);
  18510. });
  18511. /**
  18512. * Creates a function that accepts arguments of `func` and either invokes
  18513. * `func` returning its result, if at least `arity` number of arguments have
  18514. * been provided, or returns a function that accepts the remaining `func`
  18515. * arguments, and so on. The arity of `func` may be specified if `func.length`
  18516. * is not sufficient.
  18517. *
  18518. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  18519. * may be used as a placeholder for provided arguments.
  18520. *
  18521. * **Note:** This method doesn't set the "length" property of curried functions.
  18522. *
  18523. * @static
  18524. * @memberOf _
  18525. * @since 2.0.0
  18526. * @category Function
  18527. * @param {Function} func The function to curry.
  18528. * @param {number} [arity=func.length] The arity of `func`.
  18529. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18530. * @returns {Function} Returns the new curried function.
  18531. * @example
  18532. *
  18533. * var abc = function(a, b, c) {
  18534. * return [a, b, c];
  18535. * };
  18536. *
  18537. * var curried = _.curry(abc);
  18538. *
  18539. * curried(1)(2)(3);
  18540. * // => [1, 2, 3]
  18541. *
  18542. * curried(1, 2)(3);
  18543. * // => [1, 2, 3]
  18544. *
  18545. * curried(1, 2, 3);
  18546. * // => [1, 2, 3]
  18547. *
  18548. * // Curried with placeholders.
  18549. * curried(1)(_, 3)(2);
  18550. * // => [1, 2, 3]
  18551. */
  18552. function curry(func, arity, guard) {
  18553. arity = guard ? undefined : arity;
  18554. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  18555. result.placeholder = curry.placeholder;
  18556. return result;
  18557. }
  18558. /**
  18559. * This method is like `_.curry` except that arguments are applied to `func`
  18560. * in the manner of `_.partialRight` instead of `_.partial`.
  18561. *
  18562. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  18563. * builds, may be used as a placeholder for provided arguments.
  18564. *
  18565. * **Note:** This method doesn't set the "length" property of curried functions.
  18566. *
  18567. * @static
  18568. * @memberOf _
  18569. * @since 3.0.0
  18570. * @category Function
  18571. * @param {Function} func The function to curry.
  18572. * @param {number} [arity=func.length] The arity of `func`.
  18573. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18574. * @returns {Function} Returns the new curried function.
  18575. * @example
  18576. *
  18577. * var abc = function(a, b, c) {
  18578. * return [a, b, c];
  18579. * };
  18580. *
  18581. * var curried = _.curryRight(abc);
  18582. *
  18583. * curried(3)(2)(1);
  18584. * // => [1, 2, 3]
  18585. *
  18586. * curried(2, 3)(1);
  18587. * // => [1, 2, 3]
  18588. *
  18589. * curried(1, 2, 3);
  18590. * // => [1, 2, 3]
  18591. *
  18592. * // Curried with placeholders.
  18593. * curried(3)(1, _)(2);
  18594. * // => [1, 2, 3]
  18595. */
  18596. function curryRight(func, arity, guard) {
  18597. arity = guard ? undefined : arity;
  18598. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  18599. result.placeholder = curryRight.placeholder;
  18600. return result;
  18601. }
  18602. /**
  18603. * Creates a debounced function that delays invoking `func` until after `wait`
  18604. * milliseconds have elapsed since the last time the debounced function was
  18605. * invoked. The debounced function comes with a `cancel` method to cancel
  18606. * delayed `func` invocations and a `flush` method to immediately invoke them.
  18607. * Provide `options` to indicate whether `func` should be invoked on the
  18608. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  18609. * with the last arguments provided to the debounced function. Subsequent
  18610. * calls to the debounced function return the result of the last `func`
  18611. * invocation.
  18612. *
  18613. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  18614. * invoked on the trailing edge of the timeout only if the debounced function
  18615. * is invoked more than once during the `wait` timeout.
  18616. *
  18617. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  18618. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  18619. *
  18620. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  18621. * for details over the differences between `_.debounce` and `_.throttle`.
  18622. *
  18623. * @static
  18624. * @memberOf _
  18625. * @since 0.1.0
  18626. * @category Function
  18627. * @param {Function} func The function to debounce.
  18628. * @param {number} [wait=0] The number of milliseconds to delay.
  18629. * @param {Object} [options={}] The options object.
  18630. * @param {boolean} [options.leading=false]
  18631. * Specify invoking on the leading edge of the timeout.
  18632. * @param {number} [options.maxWait]
  18633. * The maximum time `func` is allowed to be delayed before it's invoked.
  18634. * @param {boolean} [options.trailing=true]
  18635. * Specify invoking on the trailing edge of the timeout.
  18636. * @returns {Function} Returns the new debounced function.
  18637. * @example
  18638. *
  18639. * // Avoid costly calculations while the window size is in flux.
  18640. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  18641. *
  18642. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  18643. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  18644. * 'leading': true,
  18645. * 'trailing': false
  18646. * }));
  18647. *
  18648. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  18649. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  18650. * var source = new EventSource('/stream');
  18651. * jQuery(source).on('message', debounced);
  18652. *
  18653. * // Cancel the trailing debounced invocation.
  18654. * jQuery(window).on('popstate', debounced.cancel);
  18655. */
  18656. function debounce(func, wait, options) {
  18657. var lastArgs,
  18658. lastThis,
  18659. maxWait,
  18660. result,
  18661. timerId,
  18662. lastCallTime,
  18663. lastInvokeTime = 0,
  18664. leading = false,
  18665. maxing = false,
  18666. trailing = true;
  18667. if (typeof func != 'function') {
  18668. throw new TypeError(FUNC_ERROR_TEXT);
  18669. }
  18670. wait = toNumber(wait) || 0;
  18671. if (isObject(options)) {
  18672. leading = !!options.leading;
  18673. maxing = 'maxWait' in options;
  18674. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  18675. trailing = 'trailing' in options ? !!options.trailing : trailing;
  18676. }
  18677. function invokeFunc(time) {
  18678. var args = lastArgs,
  18679. thisArg = lastThis;
  18680. lastArgs = lastThis = undefined;
  18681. lastInvokeTime = time;
  18682. result = func.apply(thisArg, args);
  18683. return result;
  18684. }
  18685. function leadingEdge(time) {
  18686. // Reset any `maxWait` timer.
  18687. lastInvokeTime = time;
  18688. // Start the timer for the trailing edge.
  18689. timerId = setTimeout(timerExpired, wait);
  18690. // Invoke the leading edge.
  18691. return leading ? invokeFunc(time) : result;
  18692. }
  18693. function remainingWait(time) {
  18694. var timeSinceLastCall = time - lastCallTime,
  18695. timeSinceLastInvoke = time - lastInvokeTime,
  18696. result = wait - timeSinceLastCall;
  18697. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  18698. }
  18699. function shouldInvoke(time) {
  18700. var timeSinceLastCall = time - lastCallTime,
  18701. timeSinceLastInvoke = time - lastInvokeTime;
  18702. // Either this is the first call, activity has stopped and we're at the
  18703. // trailing edge, the system time has gone backwards and we're treating
  18704. // it as the trailing edge, or we've hit the `maxWait` limit.
  18705. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  18706. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  18707. }
  18708. function timerExpired() {
  18709. var time = now();
  18710. if (shouldInvoke(time)) {
  18711. return trailingEdge(time);
  18712. }
  18713. // Restart the timer.
  18714. timerId = setTimeout(timerExpired, remainingWait(time));
  18715. }
  18716. function trailingEdge(time) {
  18717. timerId = undefined;
  18718. // Only invoke if we have `lastArgs` which means `func` has been
  18719. // debounced at least once.
  18720. if (trailing && lastArgs) {
  18721. return invokeFunc(time);
  18722. }
  18723. lastArgs = lastThis = undefined;
  18724. return result;
  18725. }
  18726. function cancel() {
  18727. if (timerId !== undefined) {
  18728. clearTimeout(timerId);
  18729. }
  18730. lastInvokeTime = 0;
  18731. lastArgs = lastCallTime = lastThis = timerId = undefined;
  18732. }
  18733. function flush() {
  18734. return timerId === undefined ? result : trailingEdge(now());
  18735. }
  18736. function debounced() {
  18737. var time = now(),
  18738. isInvoking = shouldInvoke(time);
  18739. lastArgs = arguments;
  18740. lastThis = this;
  18741. lastCallTime = time;
  18742. if (isInvoking) {
  18743. if (timerId === undefined) {
  18744. return leadingEdge(lastCallTime);
  18745. }
  18746. if (maxing) {
  18747. // Handle invocations in a tight loop.
  18748. timerId = setTimeout(timerExpired, wait);
  18749. return invokeFunc(lastCallTime);
  18750. }
  18751. }
  18752. if (timerId === undefined) {
  18753. timerId = setTimeout(timerExpired, wait);
  18754. }
  18755. return result;
  18756. }
  18757. debounced.cancel = cancel;
  18758. debounced.flush = flush;
  18759. return debounced;
  18760. }
  18761. /**
  18762. * Defers invoking the `func` until the current call stack has cleared. Any
  18763. * additional arguments are provided to `func` when it's invoked.
  18764. *
  18765. * @static
  18766. * @memberOf _
  18767. * @since 0.1.0
  18768. * @category Function
  18769. * @param {Function} func The function to defer.
  18770. * @param {...*} [args] The arguments to invoke `func` with.
  18771. * @returns {number} Returns the timer id.
  18772. * @example
  18773. *
  18774. * _.defer(function(text) {
  18775. * console.log(text);
  18776. * }, 'deferred');
  18777. * // => Logs 'deferred' after one millisecond.
  18778. */
  18779. var defer = baseRest(function(func, args) {
  18780. return baseDelay(func, 1, args);
  18781. });
  18782. /**
  18783. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  18784. * provided to `func` when it's invoked.
  18785. *
  18786. * @static
  18787. * @memberOf _
  18788. * @since 0.1.0
  18789. * @category Function
  18790. * @param {Function} func The function to delay.
  18791. * @param {number} wait The number of milliseconds to delay invocation.
  18792. * @param {...*} [args] The arguments to invoke `func` with.
  18793. * @returns {number} Returns the timer id.
  18794. * @example
  18795. *
  18796. * _.delay(function(text) {
  18797. * console.log(text);
  18798. * }, 1000, 'later');
  18799. * // => Logs 'later' after one second.
  18800. */
  18801. var delay = baseRest(function(func, wait, args) {
  18802. return baseDelay(func, toNumber(wait) || 0, args);
  18803. });
  18804. /**
  18805. * Creates a function that invokes `func` with arguments reversed.
  18806. *
  18807. * @static
  18808. * @memberOf _
  18809. * @since 4.0.0
  18810. * @category Function
  18811. * @param {Function} func The function to flip arguments for.
  18812. * @returns {Function} Returns the new flipped function.
  18813. * @example
  18814. *
  18815. * var flipped = _.flip(function() {
  18816. * return _.toArray(arguments);
  18817. * });
  18818. *
  18819. * flipped('a', 'b', 'c', 'd');
  18820. * // => ['d', 'c', 'b', 'a']
  18821. */
  18822. function flip(func) {
  18823. return createWrap(func, WRAP_FLIP_FLAG);
  18824. }
  18825. /**
  18826. * Creates a function that memoizes the result of `func`. If `resolver` is
  18827. * provided, it determines the cache key for storing the result based on the
  18828. * arguments provided to the memoized function. By default, the first argument
  18829. * provided to the memoized function is used as the map cache key. The `func`
  18830. * is invoked with the `this` binding of the memoized function.
  18831. *
  18832. * **Note:** The cache is exposed as the `cache` property on the memoized
  18833. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  18834. * constructor with one whose instances implement the
  18835. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  18836. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  18837. *
  18838. * @static
  18839. * @memberOf _
  18840. * @since 0.1.0
  18841. * @category Function
  18842. * @param {Function} func The function to have its output memoized.
  18843. * @param {Function} [resolver] The function to resolve the cache key.
  18844. * @returns {Function} Returns the new memoized function.
  18845. * @example
  18846. *
  18847. * var object = { 'a': 1, 'b': 2 };
  18848. * var other = { 'c': 3, 'd': 4 };
  18849. *
  18850. * var values = _.memoize(_.values);
  18851. * values(object);
  18852. * // => [1, 2]
  18853. *
  18854. * values(other);
  18855. * // => [3, 4]
  18856. *
  18857. * object.a = 2;
  18858. * values(object);
  18859. * // => [1, 2]
  18860. *
  18861. * // Modify the result cache.
  18862. * values.cache.set(object, ['a', 'b']);
  18863. * values(object);
  18864. * // => ['a', 'b']
  18865. *
  18866. * // Replace `_.memoize.Cache`.
  18867. * _.memoize.Cache = WeakMap;
  18868. */
  18869. function memoize(func, resolver) {
  18870. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  18871. throw new TypeError(FUNC_ERROR_TEXT);
  18872. }
  18873. var memoized = function() {
  18874. var args = arguments,
  18875. key = resolver ? resolver.apply(this, args) : args[0],
  18876. cache = memoized.cache;
  18877. if (cache.has(key)) {
  18878. return cache.get(key);
  18879. }
  18880. var result = func.apply(this, args);
  18881. memoized.cache = cache.set(key, result) || cache;
  18882. return result;
  18883. };
  18884. memoized.cache = new (memoize.Cache || MapCache);
  18885. return memoized;
  18886. }
  18887. // Expose `MapCache`.
  18888. memoize.Cache = MapCache;
  18889. /**
  18890. * Creates a function that negates the result of the predicate `func`. The
  18891. * `func` predicate is invoked with the `this` binding and arguments of the
  18892. * created function.
  18893. *
  18894. * @static
  18895. * @memberOf _
  18896. * @since 3.0.0
  18897. * @category Function
  18898. * @param {Function} predicate The predicate to negate.
  18899. * @returns {Function} Returns the new negated function.
  18900. * @example
  18901. *
  18902. * function isEven(n) {
  18903. * return n % 2 == 0;
  18904. * }
  18905. *
  18906. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  18907. * // => [1, 3, 5]
  18908. */
  18909. function negate(predicate) {
  18910. if (typeof predicate != 'function') {
  18911. throw new TypeError(FUNC_ERROR_TEXT);
  18912. }
  18913. return function() {
  18914. var args = arguments;
  18915. switch (args.length) {
  18916. case 0: return !predicate.call(this);
  18917. case 1: return !predicate.call(this, args[0]);
  18918. case 2: return !predicate.call(this, args[0], args[1]);
  18919. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  18920. }
  18921. return !predicate.apply(this, args);
  18922. };
  18923. }
  18924. /**
  18925. * Creates a function that is restricted to invoking `func` once. Repeat calls
  18926. * to the function return the value of the first invocation. The `func` is
  18927. * invoked with the `this` binding and arguments of the created function.
  18928. *
  18929. * @static
  18930. * @memberOf _
  18931. * @since 0.1.0
  18932. * @category Function
  18933. * @param {Function} func The function to restrict.
  18934. * @returns {Function} Returns the new restricted function.
  18935. * @example
  18936. *
  18937. * var initialize = _.once(createApplication);
  18938. * initialize();
  18939. * initialize();
  18940. * // => `createApplication` is invoked once
  18941. */
  18942. function once(func) {
  18943. return before(2, func);
  18944. }
  18945. /**
  18946. * Creates a function that invokes `func` with its arguments transformed.
  18947. *
  18948. * @static
  18949. * @since 4.0.0
  18950. * @memberOf _
  18951. * @category Function
  18952. * @param {Function} func The function to wrap.
  18953. * @param {...(Function|Function[])} [transforms=[_.identity]]
  18954. * The argument transforms.
  18955. * @returns {Function} Returns the new function.
  18956. * @example
  18957. *
  18958. * function doubled(n) {
  18959. * return n * 2;
  18960. * }
  18961. *
  18962. * function square(n) {
  18963. * return n * n;
  18964. * }
  18965. *
  18966. * var func = _.overArgs(function(x, y) {
  18967. * return [x, y];
  18968. * }, [square, doubled]);
  18969. *
  18970. * func(9, 3);
  18971. * // => [81, 6]
  18972. *
  18973. * func(10, 5);
  18974. * // => [100, 10]
  18975. */
  18976. var overArgs = castRest(function(func, transforms) {
  18977. transforms = (transforms.length == 1 && isArray(transforms[0]))
  18978. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  18979. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  18980. var funcsLength = transforms.length;
  18981. return baseRest(function(args) {
  18982. var index = -1,
  18983. length = nativeMin(args.length, funcsLength);
  18984. while (++index < length) {
  18985. args[index] = transforms[index].call(this, args[index]);
  18986. }
  18987. return apply(func, this, args);
  18988. });
  18989. });
  18990. /**
  18991. * Creates a function that invokes `func` with `partials` prepended to the
  18992. * arguments it receives. This method is like `_.bind` except it does **not**
  18993. * alter the `this` binding.
  18994. *
  18995. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  18996. * builds, may be used as a placeholder for partially applied arguments.
  18997. *
  18998. * **Note:** This method doesn't set the "length" property of partially
  18999. * applied functions.
  19000. *
  19001. * @static
  19002. * @memberOf _
  19003. * @since 0.2.0
  19004. * @category Function
  19005. * @param {Function} func The function to partially apply arguments to.
  19006. * @param {...*} [partials] The arguments to be partially applied.
  19007. * @returns {Function} Returns the new partially applied function.
  19008. * @example
  19009. *
  19010. * function greet(greeting, name) {
  19011. * return greeting + ' ' + name;
  19012. * }
  19013. *
  19014. * var sayHelloTo = _.partial(greet, 'hello');
  19015. * sayHelloTo('fred');
  19016. * // => 'hello fred'
  19017. *
  19018. * // Partially applied with placeholders.
  19019. * var greetFred = _.partial(greet, _, 'fred');
  19020. * greetFred('hi');
  19021. * // => 'hi fred'
  19022. */
  19023. var partial = baseRest(function(func, partials) {
  19024. var holders = replaceHolders(partials, getHolder(partial));
  19025. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  19026. });
  19027. /**
  19028. * This method is like `_.partial` except that partially applied arguments
  19029. * are appended to the arguments it receives.
  19030. *
  19031. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  19032. * builds, may be used as a placeholder for partially applied arguments.
  19033. *
  19034. * **Note:** This method doesn't set the "length" property of partially
  19035. * applied functions.
  19036. *
  19037. * @static
  19038. * @memberOf _
  19039. * @since 1.0.0
  19040. * @category Function
  19041. * @param {Function} func The function to partially apply arguments to.
  19042. * @param {...*} [partials] The arguments to be partially applied.
  19043. * @returns {Function} Returns the new partially applied function.
  19044. * @example
  19045. *
  19046. * function greet(greeting, name) {
  19047. * return greeting + ' ' + name;
  19048. * }
  19049. *
  19050. * var greetFred = _.partialRight(greet, 'fred');
  19051. * greetFred('hi');
  19052. * // => 'hi fred'
  19053. *
  19054. * // Partially applied with placeholders.
  19055. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  19056. * sayHelloTo('fred');
  19057. * // => 'hello fred'
  19058. */
  19059. var partialRight = baseRest(function(func, partials) {
  19060. var holders = replaceHolders(partials, getHolder(partialRight));
  19061. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  19062. });
  19063. /**
  19064. * Creates a function that invokes `func` with arguments arranged according
  19065. * to the specified `indexes` where the argument value at the first index is
  19066. * provided as the first argument, the argument value at the second index is
  19067. * provided as the second argument, and so on.
  19068. *
  19069. * @static
  19070. * @memberOf _
  19071. * @since 3.0.0
  19072. * @category Function
  19073. * @param {Function} func The function to rearrange arguments for.
  19074. * @param {...(number|number[])} indexes The arranged argument indexes.
  19075. * @returns {Function} Returns the new function.
  19076. * @example
  19077. *
  19078. * var rearged = _.rearg(function(a, b, c) {
  19079. * return [a, b, c];
  19080. * }, [2, 0, 1]);
  19081. *
  19082. * rearged('b', 'c', 'a')
  19083. * // => ['a', 'b', 'c']
  19084. */
  19085. var rearg = flatRest(function(func, indexes) {
  19086. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  19087. });
  19088. /**
  19089. * Creates a function that invokes `func` with the `this` binding of the
  19090. * created function and arguments from `start` and beyond provided as
  19091. * an array.
  19092. *
  19093. * **Note:** This method is based on the
  19094. * [rest parameter](https://mdn.io/rest_parameters).
  19095. *
  19096. * @static
  19097. * @memberOf _
  19098. * @since 4.0.0
  19099. * @category Function
  19100. * @param {Function} func The function to apply a rest parameter to.
  19101. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19102. * @returns {Function} Returns the new function.
  19103. * @example
  19104. *
  19105. * var say = _.rest(function(what, names) {
  19106. * return what + ' ' + _.initial(names).join(', ') +
  19107. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  19108. * });
  19109. *
  19110. * say('hello', 'fred', 'barney', 'pebbles');
  19111. * // => 'hello fred, barney, & pebbles'
  19112. */
  19113. function rest(func, start) {
  19114. if (typeof func != 'function') {
  19115. throw new TypeError(FUNC_ERROR_TEXT);
  19116. }
  19117. start = start === undefined ? start : toInteger(start);
  19118. return baseRest(func, start);
  19119. }
  19120. /**
  19121. * Creates a function that invokes `func` with the `this` binding of the
  19122. * create function and an array of arguments much like
  19123. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  19124. *
  19125. * **Note:** This method is based on the
  19126. * [spread operator](https://mdn.io/spread_operator).
  19127. *
  19128. * @static
  19129. * @memberOf _
  19130. * @since 3.2.0
  19131. * @category Function
  19132. * @param {Function} func The function to spread arguments over.
  19133. * @param {number} [start=0] The start position of the spread.
  19134. * @returns {Function} Returns the new function.
  19135. * @example
  19136. *
  19137. * var say = _.spread(function(who, what) {
  19138. * return who + ' says ' + what;
  19139. * });
  19140. *
  19141. * say(['fred', 'hello']);
  19142. * // => 'fred says hello'
  19143. *
  19144. * var numbers = Promise.all([
  19145. * Promise.resolve(40),
  19146. * Promise.resolve(36)
  19147. * ]);
  19148. *
  19149. * numbers.then(_.spread(function(x, y) {
  19150. * return x + y;
  19151. * }));
  19152. * // => a Promise of 76
  19153. */
  19154. function spread(func, start) {
  19155. if (typeof func != 'function') {
  19156. throw new TypeError(FUNC_ERROR_TEXT);
  19157. }
  19158. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  19159. return baseRest(function(args) {
  19160. var array = args[start],
  19161. otherArgs = castSlice(args, 0, start);
  19162. if (array) {
  19163. arrayPush(otherArgs, array);
  19164. }
  19165. return apply(func, this, otherArgs);
  19166. });
  19167. }
  19168. /**
  19169. * Creates a throttled function that only invokes `func` at most once per
  19170. * every `wait` milliseconds. The throttled function comes with a `cancel`
  19171. * method to cancel delayed `func` invocations and a `flush` method to
  19172. * immediately invoke them. Provide `options` to indicate whether `func`
  19173. * should be invoked on the leading and/or trailing edge of the `wait`
  19174. * timeout. The `func` is invoked with the last arguments provided to the
  19175. * throttled function. Subsequent calls to the throttled function return the
  19176. * result of the last `func` invocation.
  19177. *
  19178. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  19179. * invoked on the trailing edge of the timeout only if the throttled function
  19180. * is invoked more than once during the `wait` timeout.
  19181. *
  19182. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  19183. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  19184. *
  19185. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  19186. * for details over the differences between `_.throttle` and `_.debounce`.
  19187. *
  19188. * @static
  19189. * @memberOf _
  19190. * @since 0.1.0
  19191. * @category Function
  19192. * @param {Function} func The function to throttle.
  19193. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  19194. * @param {Object} [options={}] The options object.
  19195. * @param {boolean} [options.leading=true]
  19196. * Specify invoking on the leading edge of the timeout.
  19197. * @param {boolean} [options.trailing=true]
  19198. * Specify invoking on the trailing edge of the timeout.
  19199. * @returns {Function} Returns the new throttled function.
  19200. * @example
  19201. *
  19202. * // Avoid excessively updating the position while scrolling.
  19203. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  19204. *
  19205. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  19206. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  19207. * jQuery(element).on('click', throttled);
  19208. *
  19209. * // Cancel the trailing throttled invocation.
  19210. * jQuery(window).on('popstate', throttled.cancel);
  19211. */
  19212. function throttle(func, wait, options) {
  19213. var leading = true,
  19214. trailing = true;
  19215. if (typeof func != 'function') {
  19216. throw new TypeError(FUNC_ERROR_TEXT);
  19217. }
  19218. if (isObject(options)) {
  19219. leading = 'leading' in options ? !!options.leading : leading;
  19220. trailing = 'trailing' in options ? !!options.trailing : trailing;
  19221. }
  19222. return debounce(func, wait, {
  19223. 'leading': leading,
  19224. 'maxWait': wait,
  19225. 'trailing': trailing
  19226. });
  19227. }
  19228. /**
  19229. * Creates a function that accepts up to one argument, ignoring any
  19230. * additional arguments.
  19231. *
  19232. * @static
  19233. * @memberOf _
  19234. * @since 4.0.0
  19235. * @category Function
  19236. * @param {Function} func The function to cap arguments for.
  19237. * @returns {Function} Returns the new capped function.
  19238. * @example
  19239. *
  19240. * _.map(['6', '8', '10'], _.unary(parseInt));
  19241. * // => [6, 8, 10]
  19242. */
  19243. function unary(func) {
  19244. return ary(func, 1);
  19245. }
  19246. /**
  19247. * Creates a function that provides `value` to `wrapper` as its first
  19248. * argument. Any additional arguments provided to the function are appended
  19249. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  19250. * binding of the created function.
  19251. *
  19252. * @static
  19253. * @memberOf _
  19254. * @since 0.1.0
  19255. * @category Function
  19256. * @param {*} value The value to wrap.
  19257. * @param {Function} [wrapper=identity] The wrapper function.
  19258. * @returns {Function} Returns the new function.
  19259. * @example
  19260. *
  19261. * var p = _.wrap(_.escape, function(func, text) {
  19262. * return '<p>' + func(text) + '</p>';
  19263. * });
  19264. *
  19265. * p('fred, barney, & pebbles');
  19266. * // => '<p>fred, barney, &amp; pebbles</p>'
  19267. */
  19268. function wrap(value, wrapper) {
  19269. return partial(castFunction(wrapper), value);
  19270. }
  19271. /*------------------------------------------------------------------------*/
  19272. /**
  19273. * Casts `value` as an array if it's not one.
  19274. *
  19275. * @static
  19276. * @memberOf _
  19277. * @since 4.4.0
  19278. * @category Lang
  19279. * @param {*} value The value to inspect.
  19280. * @returns {Array} Returns the cast array.
  19281. * @example
  19282. *
  19283. * _.castArray(1);
  19284. * // => [1]
  19285. *
  19286. * _.castArray({ 'a': 1 });
  19287. * // => [{ 'a': 1 }]
  19288. *
  19289. * _.castArray('abc');
  19290. * // => ['abc']
  19291. *
  19292. * _.castArray(null);
  19293. * // => [null]
  19294. *
  19295. * _.castArray(undefined);
  19296. * // => [undefined]
  19297. *
  19298. * _.castArray();
  19299. * // => []
  19300. *
  19301. * var array = [1, 2, 3];
  19302. * console.log(_.castArray(array) === array);
  19303. * // => true
  19304. */
  19305. function castArray() {
  19306. if (!arguments.length) {
  19307. return [];
  19308. }
  19309. var value = arguments[0];
  19310. return isArray(value) ? value : [value];
  19311. }
  19312. /**
  19313. * Creates a shallow clone of `value`.
  19314. *
  19315. * **Note:** This method is loosely based on the
  19316. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  19317. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  19318. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  19319. * arrays. The own enumerable properties of `arguments` objects are cloned
  19320. * as plain objects. An empty object is returned for uncloneable values such
  19321. * as error objects, functions, DOM nodes, and WeakMaps.
  19322. *
  19323. * @static
  19324. * @memberOf _
  19325. * @since 0.1.0
  19326. * @category Lang
  19327. * @param {*} value The value to clone.
  19328. * @returns {*} Returns the cloned value.
  19329. * @see _.cloneDeep
  19330. * @example
  19331. *
  19332. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  19333. *
  19334. * var shallow = _.clone(objects);
  19335. * console.log(shallow[0] === objects[0]);
  19336. * // => true
  19337. */
  19338. function clone(value) {
  19339. return baseClone(value, CLONE_SYMBOLS_FLAG);
  19340. }
  19341. /**
  19342. * This method is like `_.clone` except that it accepts `customizer` which
  19343. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  19344. * cloning is handled by the method instead. The `customizer` is invoked with
  19345. * up to four arguments; (value [, index|key, object, stack]).
  19346. *
  19347. * @static
  19348. * @memberOf _
  19349. * @since 4.0.0
  19350. * @category Lang
  19351. * @param {*} value The value to clone.
  19352. * @param {Function} [customizer] The function to customize cloning.
  19353. * @returns {*} Returns the cloned value.
  19354. * @see _.cloneDeepWith
  19355. * @example
  19356. *
  19357. * function customizer(value) {
  19358. * if (_.isElement(value)) {
  19359. * return value.cloneNode(false);
  19360. * }
  19361. * }
  19362. *
  19363. * var el = _.cloneWith(document.body, customizer);
  19364. *
  19365. * console.log(el === document.body);
  19366. * // => false
  19367. * console.log(el.nodeName);
  19368. * // => 'BODY'
  19369. * console.log(el.childNodes.length);
  19370. * // => 0
  19371. */
  19372. function cloneWith(value, customizer) {
  19373. customizer = typeof customizer == 'function' ? customizer : undefined;
  19374. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  19375. }
  19376. /**
  19377. * This method is like `_.clone` except that it recursively clones `value`.
  19378. *
  19379. * @static
  19380. * @memberOf _
  19381. * @since 1.0.0
  19382. * @category Lang
  19383. * @param {*} value The value to recursively clone.
  19384. * @returns {*} Returns the deep cloned value.
  19385. * @see _.clone
  19386. * @example
  19387. *
  19388. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  19389. *
  19390. * var deep = _.cloneDeep(objects);
  19391. * console.log(deep[0] === objects[0]);
  19392. * // => false
  19393. */
  19394. function cloneDeep(value) {
  19395. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  19396. }
  19397. /**
  19398. * This method is like `_.cloneWith` except that it recursively clones `value`.
  19399. *
  19400. * @static
  19401. * @memberOf _
  19402. * @since 4.0.0
  19403. * @category Lang
  19404. * @param {*} value The value to recursively clone.
  19405. * @param {Function} [customizer] The function to customize cloning.
  19406. * @returns {*} Returns the deep cloned value.
  19407. * @see _.cloneWith
  19408. * @example
  19409. *
  19410. * function customizer(value) {
  19411. * if (_.isElement(value)) {
  19412. * return value.cloneNode(true);
  19413. * }
  19414. * }
  19415. *
  19416. * var el = _.cloneDeepWith(document.body, customizer);
  19417. *
  19418. * console.log(el === document.body);
  19419. * // => false
  19420. * console.log(el.nodeName);
  19421. * // => 'BODY'
  19422. * console.log(el.childNodes.length);
  19423. * // => 20
  19424. */
  19425. function cloneDeepWith(value, customizer) {
  19426. customizer = typeof customizer == 'function' ? customizer : undefined;
  19427. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  19428. }
  19429. /**
  19430. * Checks if `object` conforms to `source` by invoking the predicate
  19431. * properties of `source` with the corresponding property values of `object`.
  19432. *
  19433. * **Note:** This method is equivalent to `_.conforms` when `source` is
  19434. * partially applied.
  19435. *
  19436. * @static
  19437. * @memberOf _
  19438. * @since 4.14.0
  19439. * @category Lang
  19440. * @param {Object} object The object to inspect.
  19441. * @param {Object} source The object of property predicates to conform to.
  19442. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  19443. * @example
  19444. *
  19445. * var object = { 'a': 1, 'b': 2 };
  19446. *
  19447. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  19448. * // => true
  19449. *
  19450. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  19451. * // => false
  19452. */
  19453. function conformsTo(object, source) {
  19454. return source == null || baseConformsTo(object, source, keys(source));
  19455. }
  19456. /**
  19457. * Performs a
  19458. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19459. * comparison between two values to determine if they are equivalent.
  19460. *
  19461. * @static
  19462. * @memberOf _
  19463. * @since 4.0.0
  19464. * @category Lang
  19465. * @param {*} value The value to compare.
  19466. * @param {*} other The other value to compare.
  19467. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19468. * @example
  19469. *
  19470. * var object = { 'a': 1 };
  19471. * var other = { 'a': 1 };
  19472. *
  19473. * _.eq(object, object);
  19474. * // => true
  19475. *
  19476. * _.eq(object, other);
  19477. * // => false
  19478. *
  19479. * _.eq('a', 'a');
  19480. * // => true
  19481. *
  19482. * _.eq('a', Object('a'));
  19483. * // => false
  19484. *
  19485. * _.eq(NaN, NaN);
  19486. * // => true
  19487. */
  19488. function eq(value, other) {
  19489. return value === other || (value !== value && other !== other);
  19490. }
  19491. /**
  19492. * Checks if `value` is greater than `other`.
  19493. *
  19494. * @static
  19495. * @memberOf _
  19496. * @since 3.9.0
  19497. * @category Lang
  19498. * @param {*} value The value to compare.
  19499. * @param {*} other The other value to compare.
  19500. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  19501. * else `false`.
  19502. * @see _.lt
  19503. * @example
  19504. *
  19505. * _.gt(3, 1);
  19506. * // => true
  19507. *
  19508. * _.gt(3, 3);
  19509. * // => false
  19510. *
  19511. * _.gt(1, 3);
  19512. * // => false
  19513. */
  19514. var gt = createRelationalOperation(baseGt);
  19515. /**
  19516. * Checks if `value` is greater than or equal to `other`.
  19517. *
  19518. * @static
  19519. * @memberOf _
  19520. * @since 3.9.0
  19521. * @category Lang
  19522. * @param {*} value The value to compare.
  19523. * @param {*} other The other value to compare.
  19524. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  19525. * `other`, else `false`.
  19526. * @see _.lte
  19527. * @example
  19528. *
  19529. * _.gte(3, 1);
  19530. * // => true
  19531. *
  19532. * _.gte(3, 3);
  19533. * // => true
  19534. *
  19535. * _.gte(1, 3);
  19536. * // => false
  19537. */
  19538. var gte = createRelationalOperation(function(value, other) {
  19539. return value >= other;
  19540. });
  19541. /**
  19542. * Checks if `value` is likely an `arguments` object.
  19543. *
  19544. * @static
  19545. * @memberOf _
  19546. * @since 0.1.0
  19547. * @category Lang
  19548. * @param {*} value The value to check.
  19549. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  19550. * else `false`.
  19551. * @example
  19552. *
  19553. * _.isArguments(function() { return arguments; }());
  19554. * // => true
  19555. *
  19556. * _.isArguments([1, 2, 3]);
  19557. * // => false
  19558. */
  19559. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  19560. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  19561. !propertyIsEnumerable.call(value, 'callee');
  19562. };
  19563. /**
  19564. * Checks if `value` is classified as an `Array` object.
  19565. *
  19566. * @static
  19567. * @memberOf _
  19568. * @since 0.1.0
  19569. * @category Lang
  19570. * @param {*} value The value to check.
  19571. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  19572. * @example
  19573. *
  19574. * _.isArray([1, 2, 3]);
  19575. * // => true
  19576. *
  19577. * _.isArray(document.body.children);
  19578. * // => false
  19579. *
  19580. * _.isArray('abc');
  19581. * // => false
  19582. *
  19583. * _.isArray(_.noop);
  19584. * // => false
  19585. */
  19586. var isArray = Array.isArray;
  19587. /**
  19588. * Checks if `value` is classified as an `ArrayBuffer` object.
  19589. *
  19590. * @static
  19591. * @memberOf _
  19592. * @since 4.3.0
  19593. * @category Lang
  19594. * @param {*} value The value to check.
  19595. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  19596. * @example
  19597. *
  19598. * _.isArrayBuffer(new ArrayBuffer(2));
  19599. * // => true
  19600. *
  19601. * _.isArrayBuffer(new Array(2));
  19602. * // => false
  19603. */
  19604. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  19605. /**
  19606. * Checks if `value` is array-like. A value is considered array-like if it's
  19607. * not a function and has a `value.length` that's an integer greater than or
  19608. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  19609. *
  19610. * @static
  19611. * @memberOf _
  19612. * @since 4.0.0
  19613. * @category Lang
  19614. * @param {*} value The value to check.
  19615. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  19616. * @example
  19617. *
  19618. * _.isArrayLike([1, 2, 3]);
  19619. * // => true
  19620. *
  19621. * _.isArrayLike(document.body.children);
  19622. * // => true
  19623. *
  19624. * _.isArrayLike('abc');
  19625. * // => true
  19626. *
  19627. * _.isArrayLike(_.noop);
  19628. * // => false
  19629. */
  19630. function isArrayLike(value) {
  19631. return value != null && isLength(value.length) && !isFunction(value);
  19632. }
  19633. /**
  19634. * This method is like `_.isArrayLike` except that it also checks if `value`
  19635. * is an object.
  19636. *
  19637. * @static
  19638. * @memberOf _
  19639. * @since 4.0.0
  19640. * @category Lang
  19641. * @param {*} value The value to check.
  19642. * @returns {boolean} Returns `true` if `value` is an array-like object,
  19643. * else `false`.
  19644. * @example
  19645. *
  19646. * _.isArrayLikeObject([1, 2, 3]);
  19647. * // => true
  19648. *
  19649. * _.isArrayLikeObject(document.body.children);
  19650. * // => true
  19651. *
  19652. * _.isArrayLikeObject('abc');
  19653. * // => false
  19654. *
  19655. * _.isArrayLikeObject(_.noop);
  19656. * // => false
  19657. */
  19658. function isArrayLikeObject(value) {
  19659. return isObjectLike(value) && isArrayLike(value);
  19660. }
  19661. /**
  19662. * Checks if `value` is classified as a boolean primitive or object.
  19663. *
  19664. * @static
  19665. * @memberOf _
  19666. * @since 0.1.0
  19667. * @category Lang
  19668. * @param {*} value The value to check.
  19669. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  19670. * @example
  19671. *
  19672. * _.isBoolean(false);
  19673. * // => true
  19674. *
  19675. * _.isBoolean(null);
  19676. * // => false
  19677. */
  19678. function isBoolean(value) {
  19679. return value === true || value === false ||
  19680. (isObjectLike(value) && baseGetTag(value) == boolTag);
  19681. }
  19682. /**
  19683. * Checks if `value` is a buffer.
  19684. *
  19685. * @static
  19686. * @memberOf _
  19687. * @since 4.3.0
  19688. * @category Lang
  19689. * @param {*} value The value to check.
  19690. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  19691. * @example
  19692. *
  19693. * _.isBuffer(new Buffer(2));
  19694. * // => true
  19695. *
  19696. * _.isBuffer(new Uint8Array(2));
  19697. * // => false
  19698. */
  19699. var isBuffer = nativeIsBuffer || stubFalse;
  19700. /**
  19701. * Checks if `value` is classified as a `Date` object.
  19702. *
  19703. * @static
  19704. * @memberOf _
  19705. * @since 0.1.0
  19706. * @category Lang
  19707. * @param {*} value The value to check.
  19708. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  19709. * @example
  19710. *
  19711. * _.isDate(new Date);
  19712. * // => true
  19713. *
  19714. * _.isDate('Mon April 23 2012');
  19715. * // => false
  19716. */
  19717. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  19718. /**
  19719. * Checks if `value` is likely a DOM element.
  19720. *
  19721. * @static
  19722. * @memberOf _
  19723. * @since 0.1.0
  19724. * @category Lang
  19725. * @param {*} value The value to check.
  19726. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  19727. * @example
  19728. *
  19729. * _.isElement(document.body);
  19730. * // => true
  19731. *
  19732. * _.isElement('<body>');
  19733. * // => false
  19734. */
  19735. function isElement(value) {
  19736. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  19737. }
  19738. /**
  19739. * Checks if `value` is an empty object, collection, map, or set.
  19740. *
  19741. * Objects are considered empty if they have no own enumerable string keyed
  19742. * properties.
  19743. *
  19744. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  19745. * jQuery-like collections are considered empty if they have a `length` of `0`.
  19746. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  19747. *
  19748. * @static
  19749. * @memberOf _
  19750. * @since 0.1.0
  19751. * @category Lang
  19752. * @param {*} value The value to check.
  19753. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  19754. * @example
  19755. *
  19756. * _.isEmpty(null);
  19757. * // => true
  19758. *
  19759. * _.isEmpty(true);
  19760. * // => true
  19761. *
  19762. * _.isEmpty(1);
  19763. * // => true
  19764. *
  19765. * _.isEmpty([1, 2, 3]);
  19766. * // => false
  19767. *
  19768. * _.isEmpty({ 'a': 1 });
  19769. * // => false
  19770. */
  19771. function isEmpty(value) {
  19772. if (value == null) {
  19773. return true;
  19774. }
  19775. if (isArrayLike(value) &&
  19776. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  19777. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  19778. return !value.length;
  19779. }
  19780. var tag = getTag(value);
  19781. if (tag == mapTag || tag == setTag) {
  19782. return !value.size;
  19783. }
  19784. if (isPrototype(value)) {
  19785. return !baseKeys(value).length;
  19786. }
  19787. for (var key in value) {
  19788. if (hasOwnProperty.call(value, key)) {
  19789. return false;
  19790. }
  19791. }
  19792. return true;
  19793. }
  19794. /**
  19795. * Performs a deep comparison between two values to determine if they are
  19796. * equivalent.
  19797. *
  19798. * **Note:** This method supports comparing arrays, array buffers, booleans,
  19799. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  19800. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  19801. * by their own, not inherited, enumerable properties. Functions and DOM
  19802. * nodes are compared by strict equality, i.e. `===`.
  19803. *
  19804. * @static
  19805. * @memberOf _
  19806. * @since 0.1.0
  19807. * @category Lang
  19808. * @param {*} value The value to compare.
  19809. * @param {*} other The other value to compare.
  19810. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19811. * @example
  19812. *
  19813. * var object = { 'a': 1 };
  19814. * var other = { 'a': 1 };
  19815. *
  19816. * _.isEqual(object, other);
  19817. * // => true
  19818. *
  19819. * object === other;
  19820. * // => false
  19821. */
  19822. function isEqual(value, other) {
  19823. return baseIsEqual(value, other);
  19824. }
  19825. /**
  19826. * This method is like `_.isEqual` except that it accepts `customizer` which
  19827. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  19828. * are handled by the method instead. The `customizer` is invoked with up to
  19829. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  19830. *
  19831. * @static
  19832. * @memberOf _
  19833. * @since 4.0.0
  19834. * @category Lang
  19835. * @param {*} value The value to compare.
  19836. * @param {*} other The other value to compare.
  19837. * @param {Function} [customizer] The function to customize comparisons.
  19838. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19839. * @example
  19840. *
  19841. * function isGreeting(value) {
  19842. * return /^h(?:i|ello)$/.test(value);
  19843. * }
  19844. *
  19845. * function customizer(objValue, othValue) {
  19846. * if (isGreeting(objValue) && isGreeting(othValue)) {
  19847. * return true;
  19848. * }
  19849. * }
  19850. *
  19851. * var array = ['hello', 'goodbye'];
  19852. * var other = ['hi', 'goodbye'];
  19853. *
  19854. * _.isEqualWith(array, other, customizer);
  19855. * // => true
  19856. */
  19857. function isEqualWith(value, other, customizer) {
  19858. customizer = typeof customizer == 'function' ? customizer : undefined;
  19859. var result = customizer ? customizer(value, other) : undefined;
  19860. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  19861. }
  19862. /**
  19863. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  19864. * `SyntaxError`, `TypeError`, or `URIError` object.
  19865. *
  19866. * @static
  19867. * @memberOf _
  19868. * @since 3.0.0
  19869. * @category Lang
  19870. * @param {*} value The value to check.
  19871. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  19872. * @example
  19873. *
  19874. * _.isError(new Error);
  19875. * // => true
  19876. *
  19877. * _.isError(Error);
  19878. * // => false
  19879. */
  19880. function isError(value) {
  19881. if (!isObjectLike(value)) {
  19882. return false;
  19883. }
  19884. var tag = baseGetTag(value);
  19885. return tag == errorTag || tag == domExcTag ||
  19886. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  19887. }
  19888. /**
  19889. * Checks if `value` is a finite primitive number.
  19890. *
  19891. * **Note:** This method is based on
  19892. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  19893. *
  19894. * @static
  19895. * @memberOf _
  19896. * @since 0.1.0
  19897. * @category Lang
  19898. * @param {*} value The value to check.
  19899. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  19900. * @example
  19901. *
  19902. * _.isFinite(3);
  19903. * // => true
  19904. *
  19905. * _.isFinite(Number.MIN_VALUE);
  19906. * // => true
  19907. *
  19908. * _.isFinite(Infinity);
  19909. * // => false
  19910. *
  19911. * _.isFinite('3');
  19912. * // => false
  19913. */
  19914. function isFinite(value) {
  19915. return typeof value == 'number' && nativeIsFinite(value);
  19916. }
  19917. /**
  19918. * Checks if `value` is classified as a `Function` object.
  19919. *
  19920. * @static
  19921. * @memberOf _
  19922. * @since 0.1.0
  19923. * @category Lang
  19924. * @param {*} value The value to check.
  19925. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  19926. * @example
  19927. *
  19928. * _.isFunction(_);
  19929. * // => true
  19930. *
  19931. * _.isFunction(/abc/);
  19932. * // => false
  19933. */
  19934. function isFunction(value) {
  19935. if (!isObject(value)) {
  19936. return false;
  19937. }
  19938. // The use of `Object#toString` avoids issues with the `typeof` operator
  19939. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  19940. var tag = baseGetTag(value);
  19941. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  19942. }
  19943. /**
  19944. * Checks if `value` is an integer.
  19945. *
  19946. * **Note:** This method is based on
  19947. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  19948. *
  19949. * @static
  19950. * @memberOf _
  19951. * @since 4.0.0
  19952. * @category Lang
  19953. * @param {*} value The value to check.
  19954. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  19955. * @example
  19956. *
  19957. * _.isInteger(3);
  19958. * // => true
  19959. *
  19960. * _.isInteger(Number.MIN_VALUE);
  19961. * // => false
  19962. *
  19963. * _.isInteger(Infinity);
  19964. * // => false
  19965. *
  19966. * _.isInteger('3');
  19967. * // => false
  19968. */
  19969. function isInteger(value) {
  19970. return typeof value == 'number' && value == toInteger(value);
  19971. }
  19972. /**
  19973. * Checks if `value` is a valid array-like length.
  19974. *
  19975. * **Note:** This method is loosely based on
  19976. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  19977. *
  19978. * @static
  19979. * @memberOf _
  19980. * @since 4.0.0
  19981. * @category Lang
  19982. * @param {*} value The value to check.
  19983. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  19984. * @example
  19985. *
  19986. * _.isLength(3);
  19987. * // => true
  19988. *
  19989. * _.isLength(Number.MIN_VALUE);
  19990. * // => false
  19991. *
  19992. * _.isLength(Infinity);
  19993. * // => false
  19994. *
  19995. * _.isLength('3');
  19996. * // => false
  19997. */
  19998. function isLength(value) {
  19999. return typeof value == 'number' &&
  20000. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  20001. }
  20002. /**
  20003. * Checks if `value` is the
  20004. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  20005. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  20006. *
  20007. * @static
  20008. * @memberOf _
  20009. * @since 0.1.0
  20010. * @category Lang
  20011. * @param {*} value The value to check.
  20012. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  20013. * @example
  20014. *
  20015. * _.isObject({});
  20016. * // => true
  20017. *
  20018. * _.isObject([1, 2, 3]);
  20019. * // => true
  20020. *
  20021. * _.isObject(_.noop);
  20022. * // => true
  20023. *
  20024. * _.isObject(null);
  20025. * // => false
  20026. */
  20027. function isObject(value) {
  20028. var type = typeof value;
  20029. return value != null && (type == 'object' || type == 'function');
  20030. }
  20031. /**
  20032. * Checks if `value` is object-like. A value is object-like if it's not `null`
  20033. * and has a `typeof` result of "object".
  20034. *
  20035. * @static
  20036. * @memberOf _
  20037. * @since 4.0.0
  20038. * @category Lang
  20039. * @param {*} value The value to check.
  20040. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  20041. * @example
  20042. *
  20043. * _.isObjectLike({});
  20044. * // => true
  20045. *
  20046. * _.isObjectLike([1, 2, 3]);
  20047. * // => true
  20048. *
  20049. * _.isObjectLike(_.noop);
  20050. * // => false
  20051. *
  20052. * _.isObjectLike(null);
  20053. * // => false
  20054. */
  20055. function isObjectLike(value) {
  20056. return value != null && typeof value == 'object';
  20057. }
  20058. /**
  20059. * Checks if `value` is classified as a `Map` object.
  20060. *
  20061. * @static
  20062. * @memberOf _
  20063. * @since 4.3.0
  20064. * @category Lang
  20065. * @param {*} value The value to check.
  20066. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20067. * @example
  20068. *
  20069. * _.isMap(new Map);
  20070. * // => true
  20071. *
  20072. * _.isMap(new WeakMap);
  20073. * // => false
  20074. */
  20075. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  20076. /**
  20077. * Performs a partial deep comparison between `object` and `source` to
  20078. * determine if `object` contains equivalent property values.
  20079. *
  20080. * **Note:** This method is equivalent to `_.matches` when `source` is
  20081. * partially applied.
  20082. *
  20083. * Partial comparisons will match empty array and empty object `source`
  20084. * values against any array or object value, respectively. See `_.isEqual`
  20085. * for a list of supported value comparisons.
  20086. *
  20087. * @static
  20088. * @memberOf _
  20089. * @since 3.0.0
  20090. * @category Lang
  20091. * @param {Object} object The object to inspect.
  20092. * @param {Object} source The object of property values to match.
  20093. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20094. * @example
  20095. *
  20096. * var object = { 'a': 1, 'b': 2 };
  20097. *
  20098. * _.isMatch(object, { 'b': 2 });
  20099. * // => true
  20100. *
  20101. * _.isMatch(object, { 'b': 1 });
  20102. * // => false
  20103. */
  20104. function isMatch(object, source) {
  20105. return object === source || baseIsMatch(object, source, getMatchData(source));
  20106. }
  20107. /**
  20108. * This method is like `_.isMatch` except that it accepts `customizer` which
  20109. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  20110. * are handled by the method instead. The `customizer` is invoked with five
  20111. * arguments: (objValue, srcValue, index|key, object, source).
  20112. *
  20113. * @static
  20114. * @memberOf _
  20115. * @since 4.0.0
  20116. * @category Lang
  20117. * @param {Object} object The object to inspect.
  20118. * @param {Object} source The object of property values to match.
  20119. * @param {Function} [customizer] The function to customize comparisons.
  20120. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20121. * @example
  20122. *
  20123. * function isGreeting(value) {
  20124. * return /^h(?:i|ello)$/.test(value);
  20125. * }
  20126. *
  20127. * function customizer(objValue, srcValue) {
  20128. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  20129. * return true;
  20130. * }
  20131. * }
  20132. *
  20133. * var object = { 'greeting': 'hello' };
  20134. * var source = { 'greeting': 'hi' };
  20135. *
  20136. * _.isMatchWith(object, source, customizer);
  20137. * // => true
  20138. */
  20139. function isMatchWith(object, source, customizer) {
  20140. customizer = typeof customizer == 'function' ? customizer : undefined;
  20141. return baseIsMatch(object, source, getMatchData(source), customizer);
  20142. }
  20143. /**
  20144. * Checks if `value` is `NaN`.
  20145. *
  20146. * **Note:** This method is based on
  20147. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  20148. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  20149. * `undefined` and other non-number values.
  20150. *
  20151. * @static
  20152. * @memberOf _
  20153. * @since 0.1.0
  20154. * @category Lang
  20155. * @param {*} value The value to check.
  20156. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  20157. * @example
  20158. *
  20159. * _.isNaN(NaN);
  20160. * // => true
  20161. *
  20162. * _.isNaN(new Number(NaN));
  20163. * // => true
  20164. *
  20165. * isNaN(undefined);
  20166. * // => true
  20167. *
  20168. * _.isNaN(undefined);
  20169. * // => false
  20170. */
  20171. function isNaN(value) {
  20172. // An `NaN` primitive is the only value that is not equal to itself.
  20173. // Perform the `toStringTag` check first to avoid errors with some
  20174. // ActiveX objects in IE.
  20175. return isNumber(value) && value != +value;
  20176. }
  20177. /**
  20178. * Checks if `value` is a pristine native function.
  20179. *
  20180. * **Note:** This method can't reliably detect native functions in the presence
  20181. * of the core-js package because core-js circumvents this kind of detection.
  20182. * Despite multiple requests, the core-js maintainer has made it clear: any
  20183. * attempt to fix the detection will be obstructed. As a result, we're left
  20184. * with little choice but to throw an error. Unfortunately, this also affects
  20185. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  20186. * which rely on core-js.
  20187. *
  20188. * @static
  20189. * @memberOf _
  20190. * @since 3.0.0
  20191. * @category Lang
  20192. * @param {*} value The value to check.
  20193. * @returns {boolean} Returns `true` if `value` is a native function,
  20194. * else `false`.
  20195. * @example
  20196. *
  20197. * _.isNative(Array.prototype.push);
  20198. * // => true
  20199. *
  20200. * _.isNative(_);
  20201. * // => false
  20202. */
  20203. function isNative(value) {
  20204. if (isMaskable(value)) {
  20205. throw new Error(CORE_ERROR_TEXT);
  20206. }
  20207. return baseIsNative(value);
  20208. }
  20209. /**
  20210. * Checks if `value` is `null`.
  20211. *
  20212. * @static
  20213. * @memberOf _
  20214. * @since 0.1.0
  20215. * @category Lang
  20216. * @param {*} value The value to check.
  20217. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  20218. * @example
  20219. *
  20220. * _.isNull(null);
  20221. * // => true
  20222. *
  20223. * _.isNull(void 0);
  20224. * // => false
  20225. */
  20226. function isNull(value) {
  20227. return value === null;
  20228. }
  20229. /**
  20230. * Checks if `value` is `null` or `undefined`.
  20231. *
  20232. * @static
  20233. * @memberOf _
  20234. * @since 4.0.0
  20235. * @category Lang
  20236. * @param {*} value The value to check.
  20237. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  20238. * @example
  20239. *
  20240. * _.isNil(null);
  20241. * // => true
  20242. *
  20243. * _.isNil(void 0);
  20244. * // => true
  20245. *
  20246. * _.isNil(NaN);
  20247. * // => false
  20248. */
  20249. function isNil(value) {
  20250. return value == null;
  20251. }
  20252. /**
  20253. * Checks if `value` is classified as a `Number` primitive or object.
  20254. *
  20255. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  20256. * classified as numbers, use the `_.isFinite` method.
  20257. *
  20258. * @static
  20259. * @memberOf _
  20260. * @since 0.1.0
  20261. * @category Lang
  20262. * @param {*} value The value to check.
  20263. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  20264. * @example
  20265. *
  20266. * _.isNumber(3);
  20267. * // => true
  20268. *
  20269. * _.isNumber(Number.MIN_VALUE);
  20270. * // => true
  20271. *
  20272. * _.isNumber(Infinity);
  20273. * // => true
  20274. *
  20275. * _.isNumber('3');
  20276. * // => false
  20277. */
  20278. function isNumber(value) {
  20279. return typeof value == 'number' ||
  20280. (isObjectLike(value) && baseGetTag(value) == numberTag);
  20281. }
  20282. /**
  20283. * Checks if `value` is a plain object, that is, an object created by the
  20284. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  20285. *
  20286. * @static
  20287. * @memberOf _
  20288. * @since 0.8.0
  20289. * @category Lang
  20290. * @param {*} value The value to check.
  20291. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  20292. * @example
  20293. *
  20294. * function Foo() {
  20295. * this.a = 1;
  20296. * }
  20297. *
  20298. * _.isPlainObject(new Foo);
  20299. * // => false
  20300. *
  20301. * _.isPlainObject([1, 2, 3]);
  20302. * // => false
  20303. *
  20304. * _.isPlainObject({ 'x': 0, 'y': 0 });
  20305. * // => true
  20306. *
  20307. * _.isPlainObject(Object.create(null));
  20308. * // => true
  20309. */
  20310. function isPlainObject(value) {
  20311. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  20312. return false;
  20313. }
  20314. var proto = getPrototype(value);
  20315. if (proto === null) {
  20316. return true;
  20317. }
  20318. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  20319. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  20320. funcToString.call(Ctor) == objectCtorString;
  20321. }
  20322. /**
  20323. * Checks if `value` is classified as a `RegExp` object.
  20324. *
  20325. * @static
  20326. * @memberOf _
  20327. * @since 0.1.0
  20328. * @category Lang
  20329. * @param {*} value The value to check.
  20330. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20331. * @example
  20332. *
  20333. * _.isRegExp(/abc/);
  20334. * // => true
  20335. *
  20336. * _.isRegExp('/abc/');
  20337. * // => false
  20338. */
  20339. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  20340. /**
  20341. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  20342. * double precision number which isn't the result of a rounded unsafe integer.
  20343. *
  20344. * **Note:** This method is based on
  20345. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  20346. *
  20347. * @static
  20348. * @memberOf _
  20349. * @since 4.0.0
  20350. * @category Lang
  20351. * @param {*} value The value to check.
  20352. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  20353. * @example
  20354. *
  20355. * _.isSafeInteger(3);
  20356. * // => true
  20357. *
  20358. * _.isSafeInteger(Number.MIN_VALUE);
  20359. * // => false
  20360. *
  20361. * _.isSafeInteger(Infinity);
  20362. * // => false
  20363. *
  20364. * _.isSafeInteger('3');
  20365. * // => false
  20366. */
  20367. function isSafeInteger(value) {
  20368. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  20369. }
  20370. /**
  20371. * Checks if `value` is classified as a `Set` object.
  20372. *
  20373. * @static
  20374. * @memberOf _
  20375. * @since 4.3.0
  20376. * @category Lang
  20377. * @param {*} value The value to check.
  20378. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20379. * @example
  20380. *
  20381. * _.isSet(new Set);
  20382. * // => true
  20383. *
  20384. * _.isSet(new WeakSet);
  20385. * // => false
  20386. */
  20387. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  20388. /**
  20389. * Checks if `value` is classified as a `String` primitive or object.
  20390. *
  20391. * @static
  20392. * @since 0.1.0
  20393. * @memberOf _
  20394. * @category Lang
  20395. * @param {*} value The value to check.
  20396. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  20397. * @example
  20398. *
  20399. * _.isString('abc');
  20400. * // => true
  20401. *
  20402. * _.isString(1);
  20403. * // => false
  20404. */
  20405. function isString(value) {
  20406. return typeof value == 'string' ||
  20407. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  20408. }
  20409. /**
  20410. * Checks if `value` is classified as a `Symbol` primitive or object.
  20411. *
  20412. * @static
  20413. * @memberOf _
  20414. * @since 4.0.0
  20415. * @category Lang
  20416. * @param {*} value The value to check.
  20417. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  20418. * @example
  20419. *
  20420. * _.isSymbol(Symbol.iterator);
  20421. * // => true
  20422. *
  20423. * _.isSymbol('abc');
  20424. * // => false
  20425. */
  20426. function isSymbol(value) {
  20427. return typeof value == 'symbol' ||
  20428. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  20429. }
  20430. /**
  20431. * Checks if `value` is classified as a typed array.
  20432. *
  20433. * @static
  20434. * @memberOf _
  20435. * @since 3.0.0
  20436. * @category Lang
  20437. * @param {*} value The value to check.
  20438. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20439. * @example
  20440. *
  20441. * _.isTypedArray(new Uint8Array);
  20442. * // => true
  20443. *
  20444. * _.isTypedArray([]);
  20445. * // => false
  20446. */
  20447. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  20448. /**
  20449. * Checks if `value` is `undefined`.
  20450. *
  20451. * @static
  20452. * @since 0.1.0
  20453. * @memberOf _
  20454. * @category Lang
  20455. * @param {*} value The value to check.
  20456. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  20457. * @example
  20458. *
  20459. * _.isUndefined(void 0);
  20460. * // => true
  20461. *
  20462. * _.isUndefined(null);
  20463. * // => false
  20464. */
  20465. function isUndefined(value) {
  20466. return value === undefined;
  20467. }
  20468. /**
  20469. * Checks if `value` is classified as a `WeakMap` object.
  20470. *
  20471. * @static
  20472. * @memberOf _
  20473. * @since 4.3.0
  20474. * @category Lang
  20475. * @param {*} value The value to check.
  20476. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  20477. * @example
  20478. *
  20479. * _.isWeakMap(new WeakMap);
  20480. * // => true
  20481. *
  20482. * _.isWeakMap(new Map);
  20483. * // => false
  20484. */
  20485. function isWeakMap(value) {
  20486. return isObjectLike(value) && getTag(value) == weakMapTag;
  20487. }
  20488. /**
  20489. * Checks if `value` is classified as a `WeakSet` object.
  20490. *
  20491. * @static
  20492. * @memberOf _
  20493. * @since 4.3.0
  20494. * @category Lang
  20495. * @param {*} value The value to check.
  20496. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  20497. * @example
  20498. *
  20499. * _.isWeakSet(new WeakSet);
  20500. * // => true
  20501. *
  20502. * _.isWeakSet(new Set);
  20503. * // => false
  20504. */
  20505. function isWeakSet(value) {
  20506. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  20507. }
  20508. /**
  20509. * Checks if `value` is less than `other`.
  20510. *
  20511. * @static
  20512. * @memberOf _
  20513. * @since 3.9.0
  20514. * @category Lang
  20515. * @param {*} value The value to compare.
  20516. * @param {*} other The other value to compare.
  20517. * @returns {boolean} Returns `true` if `value` is less than `other`,
  20518. * else `false`.
  20519. * @see _.gt
  20520. * @example
  20521. *
  20522. * _.lt(1, 3);
  20523. * // => true
  20524. *
  20525. * _.lt(3, 3);
  20526. * // => false
  20527. *
  20528. * _.lt(3, 1);
  20529. * // => false
  20530. */
  20531. var lt = createRelationalOperation(baseLt);
  20532. /**
  20533. * Checks if `value` is less than or equal to `other`.
  20534. *
  20535. * @static
  20536. * @memberOf _
  20537. * @since 3.9.0
  20538. * @category Lang
  20539. * @param {*} value The value to compare.
  20540. * @param {*} other The other value to compare.
  20541. * @returns {boolean} Returns `true` if `value` is less than or equal to
  20542. * `other`, else `false`.
  20543. * @see _.gte
  20544. * @example
  20545. *
  20546. * _.lte(1, 3);
  20547. * // => true
  20548. *
  20549. * _.lte(3, 3);
  20550. * // => true
  20551. *
  20552. * _.lte(3, 1);
  20553. * // => false
  20554. */
  20555. var lte = createRelationalOperation(function(value, other) {
  20556. return value <= other;
  20557. });
  20558. /**
  20559. * Converts `value` to an array.
  20560. *
  20561. * @static
  20562. * @since 0.1.0
  20563. * @memberOf _
  20564. * @category Lang
  20565. * @param {*} value The value to convert.
  20566. * @returns {Array} Returns the converted array.
  20567. * @example
  20568. *
  20569. * _.toArray({ 'a': 1, 'b': 2 });
  20570. * // => [1, 2]
  20571. *
  20572. * _.toArray('abc');
  20573. * // => ['a', 'b', 'c']
  20574. *
  20575. * _.toArray(1);
  20576. * // => []
  20577. *
  20578. * _.toArray(null);
  20579. * // => []
  20580. */
  20581. function toArray(value) {
  20582. if (!value) {
  20583. return [];
  20584. }
  20585. if (isArrayLike(value)) {
  20586. return isString(value) ? stringToArray(value) : copyArray(value);
  20587. }
  20588. if (symIterator && value[symIterator]) {
  20589. return iteratorToArray(value[symIterator]());
  20590. }
  20591. var tag = getTag(value),
  20592. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  20593. return func(value);
  20594. }
  20595. /**
  20596. * Converts `value` to a finite number.
  20597. *
  20598. * @static
  20599. * @memberOf _
  20600. * @since 4.12.0
  20601. * @category Lang
  20602. * @param {*} value The value to convert.
  20603. * @returns {number} Returns the converted number.
  20604. * @example
  20605. *
  20606. * _.toFinite(3.2);
  20607. * // => 3.2
  20608. *
  20609. * _.toFinite(Number.MIN_VALUE);
  20610. * // => 5e-324
  20611. *
  20612. * _.toFinite(Infinity);
  20613. * // => 1.7976931348623157e+308
  20614. *
  20615. * _.toFinite('3.2');
  20616. * // => 3.2
  20617. */
  20618. function toFinite(value) {
  20619. if (!value) {
  20620. return value === 0 ? value : 0;
  20621. }
  20622. value = toNumber(value);
  20623. if (value === INFINITY || value === -INFINITY) {
  20624. var sign = (value < 0 ? -1 : 1);
  20625. return sign * MAX_INTEGER;
  20626. }
  20627. return value === value ? value : 0;
  20628. }
  20629. /**
  20630. * Converts `value` to an integer.
  20631. *
  20632. * **Note:** This method is loosely based on
  20633. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  20634. *
  20635. * @static
  20636. * @memberOf _
  20637. * @since 4.0.0
  20638. * @category Lang
  20639. * @param {*} value The value to convert.
  20640. * @returns {number} Returns the converted integer.
  20641. * @example
  20642. *
  20643. * _.toInteger(3.2);
  20644. * // => 3
  20645. *
  20646. * _.toInteger(Number.MIN_VALUE);
  20647. * // => 0
  20648. *
  20649. * _.toInteger(Infinity);
  20650. * // => 1.7976931348623157e+308
  20651. *
  20652. * _.toInteger('3.2');
  20653. * // => 3
  20654. */
  20655. function toInteger(value) {
  20656. var result = toFinite(value),
  20657. remainder = result % 1;
  20658. return result === result ? (remainder ? result - remainder : result) : 0;
  20659. }
  20660. /**
  20661. * Converts `value` to an integer suitable for use as the length of an
  20662. * array-like object.
  20663. *
  20664. * **Note:** This method is based on
  20665. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  20666. *
  20667. * @static
  20668. * @memberOf _
  20669. * @since 4.0.0
  20670. * @category Lang
  20671. * @param {*} value The value to convert.
  20672. * @returns {number} Returns the converted integer.
  20673. * @example
  20674. *
  20675. * _.toLength(3.2);
  20676. * // => 3
  20677. *
  20678. * _.toLength(Number.MIN_VALUE);
  20679. * // => 0
  20680. *
  20681. * _.toLength(Infinity);
  20682. * // => 4294967295
  20683. *
  20684. * _.toLength('3.2');
  20685. * // => 3
  20686. */
  20687. function toLength(value) {
  20688. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  20689. }
  20690. /**
  20691. * Converts `value` to a number.
  20692. *
  20693. * @static
  20694. * @memberOf _
  20695. * @since 4.0.0
  20696. * @category Lang
  20697. * @param {*} value The value to process.
  20698. * @returns {number} Returns the number.
  20699. * @example
  20700. *
  20701. * _.toNumber(3.2);
  20702. * // => 3.2
  20703. *
  20704. * _.toNumber(Number.MIN_VALUE);
  20705. * // => 5e-324
  20706. *
  20707. * _.toNumber(Infinity);
  20708. * // => Infinity
  20709. *
  20710. * _.toNumber('3.2');
  20711. * // => 3.2
  20712. */
  20713. function toNumber(value) {
  20714. if (typeof value == 'number') {
  20715. return value;
  20716. }
  20717. if (isSymbol(value)) {
  20718. return NAN;
  20719. }
  20720. if (isObject(value)) {
  20721. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  20722. value = isObject(other) ? (other + '') : other;
  20723. }
  20724. if (typeof value != 'string') {
  20725. return value === 0 ? value : +value;
  20726. }
  20727. value = value.replace(reTrim, '');
  20728. var isBinary = reIsBinary.test(value);
  20729. return (isBinary || reIsOctal.test(value))
  20730. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  20731. : (reIsBadHex.test(value) ? NAN : +value);
  20732. }
  20733. /**
  20734. * Converts `value` to a plain object flattening inherited enumerable string
  20735. * keyed properties of `value` to own properties of the plain object.
  20736. *
  20737. * @static
  20738. * @memberOf _
  20739. * @since 3.0.0
  20740. * @category Lang
  20741. * @param {*} value The value to convert.
  20742. * @returns {Object} Returns the converted plain object.
  20743. * @example
  20744. *
  20745. * function Foo() {
  20746. * this.b = 2;
  20747. * }
  20748. *
  20749. * Foo.prototype.c = 3;
  20750. *
  20751. * _.assign({ 'a': 1 }, new Foo);
  20752. * // => { 'a': 1, 'b': 2 }
  20753. *
  20754. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  20755. * // => { 'a': 1, 'b': 2, 'c': 3 }
  20756. */
  20757. function toPlainObject(value) {
  20758. return copyObject(value, keysIn(value));
  20759. }
  20760. /**
  20761. * Converts `value` to a safe integer. A safe integer can be compared and
  20762. * represented correctly.
  20763. *
  20764. * @static
  20765. * @memberOf _
  20766. * @since 4.0.0
  20767. * @category Lang
  20768. * @param {*} value The value to convert.
  20769. * @returns {number} Returns the converted integer.
  20770. * @example
  20771. *
  20772. * _.toSafeInteger(3.2);
  20773. * // => 3
  20774. *
  20775. * _.toSafeInteger(Number.MIN_VALUE);
  20776. * // => 0
  20777. *
  20778. * _.toSafeInteger(Infinity);
  20779. * // => 9007199254740991
  20780. *
  20781. * _.toSafeInteger('3.2');
  20782. * // => 3
  20783. */
  20784. function toSafeInteger(value) {
  20785. return value
  20786. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  20787. : (value === 0 ? value : 0);
  20788. }
  20789. /**
  20790. * Converts `value` to a string. An empty string is returned for `null`
  20791. * and `undefined` values. The sign of `-0` is preserved.
  20792. *
  20793. * @static
  20794. * @memberOf _
  20795. * @since 4.0.0
  20796. * @category Lang
  20797. * @param {*} value The value to convert.
  20798. * @returns {string} Returns the converted string.
  20799. * @example
  20800. *
  20801. * _.toString(null);
  20802. * // => ''
  20803. *
  20804. * _.toString(-0);
  20805. * // => '-0'
  20806. *
  20807. * _.toString([1, 2, 3]);
  20808. * // => '1,2,3'
  20809. */
  20810. function toString(value) {
  20811. return value == null ? '' : baseToString(value);
  20812. }
  20813. /*------------------------------------------------------------------------*/
  20814. /**
  20815. * Assigns own enumerable string keyed properties of source objects to the
  20816. * destination object. Source objects are applied from left to right.
  20817. * Subsequent sources overwrite property assignments of previous sources.
  20818. *
  20819. * **Note:** This method mutates `object` and is loosely based on
  20820. * [`Object.assign`](https://mdn.io/Object/assign).
  20821. *
  20822. * @static
  20823. * @memberOf _
  20824. * @since 0.10.0
  20825. * @category Object
  20826. * @param {Object} object The destination object.
  20827. * @param {...Object} [sources] The source objects.
  20828. * @returns {Object} Returns `object`.
  20829. * @see _.assignIn
  20830. * @example
  20831. *
  20832. * function Foo() {
  20833. * this.a = 1;
  20834. * }
  20835. *
  20836. * function Bar() {
  20837. * this.c = 3;
  20838. * }
  20839. *
  20840. * Foo.prototype.b = 2;
  20841. * Bar.prototype.d = 4;
  20842. *
  20843. * _.assign({ 'a': 0 }, new Foo, new Bar);
  20844. * // => { 'a': 1, 'c': 3 }
  20845. */
  20846. var assign = createAssigner(function(object, source) {
  20847. if (isPrototype(source) || isArrayLike(source)) {
  20848. copyObject(source, keys(source), object);
  20849. return;
  20850. }
  20851. for (var key in source) {
  20852. if (hasOwnProperty.call(source, key)) {
  20853. assignValue(object, key, source[key]);
  20854. }
  20855. }
  20856. });
  20857. /**
  20858. * This method is like `_.assign` except that it iterates over own and
  20859. * inherited source properties.
  20860. *
  20861. * **Note:** This method mutates `object`.
  20862. *
  20863. * @static
  20864. * @memberOf _
  20865. * @since 4.0.0
  20866. * @alias extend
  20867. * @category Object
  20868. * @param {Object} object The destination object.
  20869. * @param {...Object} [sources] The source objects.
  20870. * @returns {Object} Returns `object`.
  20871. * @see _.assign
  20872. * @example
  20873. *
  20874. * function Foo() {
  20875. * this.a = 1;
  20876. * }
  20877. *
  20878. * function Bar() {
  20879. * this.c = 3;
  20880. * }
  20881. *
  20882. * Foo.prototype.b = 2;
  20883. * Bar.prototype.d = 4;
  20884. *
  20885. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  20886. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  20887. */
  20888. var assignIn = createAssigner(function(object, source) {
  20889. copyObject(source, keysIn(source), object);
  20890. });
  20891. /**
  20892. * This method is like `_.assignIn` except that it accepts `customizer`
  20893. * which is invoked to produce the assigned values. If `customizer` returns
  20894. * `undefined`, assignment is handled by the method instead. The `customizer`
  20895. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  20896. *
  20897. * **Note:** This method mutates `object`.
  20898. *
  20899. * @static
  20900. * @memberOf _
  20901. * @since 4.0.0
  20902. * @alias extendWith
  20903. * @category Object
  20904. * @param {Object} object The destination object.
  20905. * @param {...Object} sources The source objects.
  20906. * @param {Function} [customizer] The function to customize assigned values.
  20907. * @returns {Object} Returns `object`.
  20908. * @see _.assignWith
  20909. * @example
  20910. *
  20911. * function customizer(objValue, srcValue) {
  20912. * return _.isUndefined(objValue) ? srcValue : objValue;
  20913. * }
  20914. *
  20915. * var defaults = _.partialRight(_.assignInWith, customizer);
  20916. *
  20917. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  20918. * // => { 'a': 1, 'b': 2 }
  20919. */
  20920. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  20921. copyObject(source, keysIn(source), object, customizer);
  20922. });
  20923. /**
  20924. * This method is like `_.assign` except that it accepts `customizer`
  20925. * which is invoked to produce the assigned values. If `customizer` returns
  20926. * `undefined`, assignment is handled by the method instead. The `customizer`
  20927. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  20928. *
  20929. * **Note:** This method mutates `object`.
  20930. *
  20931. * @static
  20932. * @memberOf _
  20933. * @since 4.0.0
  20934. * @category Object
  20935. * @param {Object} object The destination object.
  20936. * @param {...Object} sources The source objects.
  20937. * @param {Function} [customizer] The function to customize assigned values.
  20938. * @returns {Object} Returns `object`.
  20939. * @see _.assignInWith
  20940. * @example
  20941. *
  20942. * function customizer(objValue, srcValue) {
  20943. * return _.isUndefined(objValue) ? srcValue : objValue;
  20944. * }
  20945. *
  20946. * var defaults = _.partialRight(_.assignWith, customizer);
  20947. *
  20948. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  20949. * // => { 'a': 1, 'b': 2 }
  20950. */
  20951. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  20952. copyObject(source, keys(source), object, customizer);
  20953. });
  20954. /**
  20955. * Creates an array of values corresponding to `paths` of `object`.
  20956. *
  20957. * @static
  20958. * @memberOf _
  20959. * @since 1.0.0
  20960. * @category Object
  20961. * @param {Object} object The object to iterate over.
  20962. * @param {...(string|string[])} [paths] The property paths to pick.
  20963. * @returns {Array} Returns the picked values.
  20964. * @example
  20965. *
  20966. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  20967. *
  20968. * _.at(object, ['a[0].b.c', 'a[1]']);
  20969. * // => [3, 4]
  20970. */
  20971. var at = flatRest(baseAt);
  20972. /**
  20973. * Creates an object that inherits from the `prototype` object. If a
  20974. * `properties` object is given, its own enumerable string keyed properties
  20975. * are assigned to the created object.
  20976. *
  20977. * @static
  20978. * @memberOf _
  20979. * @since 2.3.0
  20980. * @category Object
  20981. * @param {Object} prototype The object to inherit from.
  20982. * @param {Object} [properties] The properties to assign to the object.
  20983. * @returns {Object} Returns the new object.
  20984. * @example
  20985. *
  20986. * function Shape() {
  20987. * this.x = 0;
  20988. * this.y = 0;
  20989. * }
  20990. *
  20991. * function Circle() {
  20992. * Shape.call(this);
  20993. * }
  20994. *
  20995. * Circle.prototype = _.create(Shape.prototype, {
  20996. * 'constructor': Circle
  20997. * });
  20998. *
  20999. * var circle = new Circle;
  21000. * circle instanceof Circle;
  21001. * // => true
  21002. *
  21003. * circle instanceof Shape;
  21004. * // => true
  21005. */
  21006. function create(prototype, properties) {
  21007. var result = baseCreate(prototype);
  21008. return properties == null ? result : baseAssign(result, properties);
  21009. }
  21010. /**
  21011. * Assigns own and inherited enumerable string keyed properties of source
  21012. * objects to the destination object for all destination properties that
  21013. * resolve to `undefined`. Source objects are applied from left to right.
  21014. * Once a property is set, additional values of the same property are ignored.
  21015. *
  21016. * **Note:** This method mutates `object`.
  21017. *
  21018. * @static
  21019. * @since 0.1.0
  21020. * @memberOf _
  21021. * @category Object
  21022. * @param {Object} object The destination object.
  21023. * @param {...Object} [sources] The source objects.
  21024. * @returns {Object} Returns `object`.
  21025. * @see _.defaultsDeep
  21026. * @example
  21027. *
  21028. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  21029. * // => { 'a': 1, 'b': 2 }
  21030. */
  21031. var defaults = baseRest(function(args) {
  21032. args.push(undefined, customDefaultsAssignIn);
  21033. return apply(assignInWith, undefined, args);
  21034. });
  21035. /**
  21036. * This method is like `_.defaults` except that it recursively assigns
  21037. * default properties.
  21038. *
  21039. * **Note:** This method mutates `object`.
  21040. *
  21041. * @static
  21042. * @memberOf _
  21043. * @since 3.10.0
  21044. * @category Object
  21045. * @param {Object} object The destination object.
  21046. * @param {...Object} [sources] The source objects.
  21047. * @returns {Object} Returns `object`.
  21048. * @see _.defaults
  21049. * @example
  21050. *
  21051. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  21052. * // => { 'a': { 'b': 2, 'c': 3 } }
  21053. */
  21054. var defaultsDeep = baseRest(function(args) {
  21055. args.push(undefined, customDefaultsMerge);
  21056. return apply(mergeWith, undefined, args);
  21057. });
  21058. /**
  21059. * This method is like `_.find` except that it returns the key of the first
  21060. * element `predicate` returns truthy for instead of the element itself.
  21061. *
  21062. * @static
  21063. * @memberOf _
  21064. * @since 1.1.0
  21065. * @category Object
  21066. * @param {Object} object The object to inspect.
  21067. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21068. * @returns {string|undefined} Returns the key of the matched element,
  21069. * else `undefined`.
  21070. * @example
  21071. *
  21072. * var users = {
  21073. * 'barney': { 'age': 36, 'active': true },
  21074. * 'fred': { 'age': 40, 'active': false },
  21075. * 'pebbles': { 'age': 1, 'active': true }
  21076. * };
  21077. *
  21078. * _.findKey(users, function(o) { return o.age < 40; });
  21079. * // => 'barney' (iteration order is not guaranteed)
  21080. *
  21081. * // The `_.matches` iteratee shorthand.
  21082. * _.findKey(users, { 'age': 1, 'active': true });
  21083. * // => 'pebbles'
  21084. *
  21085. * // The `_.matchesProperty` iteratee shorthand.
  21086. * _.findKey(users, ['active', false]);
  21087. * // => 'fred'
  21088. *
  21089. * // The `_.property` iteratee shorthand.
  21090. * _.findKey(users, 'active');
  21091. * // => 'barney'
  21092. */
  21093. function findKey(object, predicate) {
  21094. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  21095. }
  21096. /**
  21097. * This method is like `_.findKey` except that it iterates over elements of
  21098. * a collection in the opposite order.
  21099. *
  21100. * @static
  21101. * @memberOf _
  21102. * @since 2.0.0
  21103. * @category Object
  21104. * @param {Object} object The object to inspect.
  21105. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21106. * @returns {string|undefined} Returns the key of the matched element,
  21107. * else `undefined`.
  21108. * @example
  21109. *
  21110. * var users = {
  21111. * 'barney': { 'age': 36, 'active': true },
  21112. * 'fred': { 'age': 40, 'active': false },
  21113. * 'pebbles': { 'age': 1, 'active': true }
  21114. * };
  21115. *
  21116. * _.findLastKey(users, function(o) { return o.age < 40; });
  21117. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  21118. *
  21119. * // The `_.matches` iteratee shorthand.
  21120. * _.findLastKey(users, { 'age': 36, 'active': true });
  21121. * // => 'barney'
  21122. *
  21123. * // The `_.matchesProperty` iteratee shorthand.
  21124. * _.findLastKey(users, ['active', false]);
  21125. * // => 'fred'
  21126. *
  21127. * // The `_.property` iteratee shorthand.
  21128. * _.findLastKey(users, 'active');
  21129. * // => 'pebbles'
  21130. */
  21131. function findLastKey(object, predicate) {
  21132. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  21133. }
  21134. /**
  21135. * Iterates over own and inherited enumerable string keyed properties of an
  21136. * object and invokes `iteratee` for each property. The iteratee is invoked
  21137. * with three arguments: (value, key, object). Iteratee functions may exit
  21138. * iteration early by explicitly returning `false`.
  21139. *
  21140. * @static
  21141. * @memberOf _
  21142. * @since 0.3.0
  21143. * @category Object
  21144. * @param {Object} object The object to iterate over.
  21145. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21146. * @returns {Object} Returns `object`.
  21147. * @see _.forInRight
  21148. * @example
  21149. *
  21150. * function Foo() {
  21151. * this.a = 1;
  21152. * this.b = 2;
  21153. * }
  21154. *
  21155. * Foo.prototype.c = 3;
  21156. *
  21157. * _.forIn(new Foo, function(value, key) {
  21158. * console.log(key);
  21159. * });
  21160. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  21161. */
  21162. function forIn(object, iteratee) {
  21163. return object == null
  21164. ? object
  21165. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  21166. }
  21167. /**
  21168. * This method is like `_.forIn` except that it iterates over properties of
  21169. * `object` in the opposite order.
  21170. *
  21171. * @static
  21172. * @memberOf _
  21173. * @since 2.0.0
  21174. * @category Object
  21175. * @param {Object} object The object to iterate over.
  21176. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21177. * @returns {Object} Returns `object`.
  21178. * @see _.forIn
  21179. * @example
  21180. *
  21181. * function Foo() {
  21182. * this.a = 1;
  21183. * this.b = 2;
  21184. * }
  21185. *
  21186. * Foo.prototype.c = 3;
  21187. *
  21188. * _.forInRight(new Foo, function(value, key) {
  21189. * console.log(key);
  21190. * });
  21191. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  21192. */
  21193. function forInRight(object, iteratee) {
  21194. return object == null
  21195. ? object
  21196. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  21197. }
  21198. /**
  21199. * Iterates over own enumerable string keyed properties of an object and
  21200. * invokes `iteratee` for each property. The iteratee is invoked with three
  21201. * arguments: (value, key, object). Iteratee functions may exit iteration
  21202. * early by explicitly returning `false`.
  21203. *
  21204. * @static
  21205. * @memberOf _
  21206. * @since 0.3.0
  21207. * @category Object
  21208. * @param {Object} object The object to iterate over.
  21209. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21210. * @returns {Object} Returns `object`.
  21211. * @see _.forOwnRight
  21212. * @example
  21213. *
  21214. * function Foo() {
  21215. * this.a = 1;
  21216. * this.b = 2;
  21217. * }
  21218. *
  21219. * Foo.prototype.c = 3;
  21220. *
  21221. * _.forOwn(new Foo, function(value, key) {
  21222. * console.log(key);
  21223. * });
  21224. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  21225. */
  21226. function forOwn(object, iteratee) {
  21227. return object && baseForOwn(object, getIteratee(iteratee, 3));
  21228. }
  21229. /**
  21230. * This method is like `_.forOwn` except that it iterates over properties of
  21231. * `object` in the opposite order.
  21232. *
  21233. * @static
  21234. * @memberOf _
  21235. * @since 2.0.0
  21236. * @category Object
  21237. * @param {Object} object The object to iterate over.
  21238. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21239. * @returns {Object} Returns `object`.
  21240. * @see _.forOwn
  21241. * @example
  21242. *
  21243. * function Foo() {
  21244. * this.a = 1;
  21245. * this.b = 2;
  21246. * }
  21247. *
  21248. * Foo.prototype.c = 3;
  21249. *
  21250. * _.forOwnRight(new Foo, function(value, key) {
  21251. * console.log(key);
  21252. * });
  21253. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  21254. */
  21255. function forOwnRight(object, iteratee) {
  21256. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  21257. }
  21258. /**
  21259. * Creates an array of function property names from own enumerable properties
  21260. * of `object`.
  21261. *
  21262. * @static
  21263. * @since 0.1.0
  21264. * @memberOf _
  21265. * @category Object
  21266. * @param {Object} object The object to inspect.
  21267. * @returns {Array} Returns the function names.
  21268. * @see _.functionsIn
  21269. * @example
  21270. *
  21271. * function Foo() {
  21272. * this.a = _.constant('a');
  21273. * this.b = _.constant('b');
  21274. * }
  21275. *
  21276. * Foo.prototype.c = _.constant('c');
  21277. *
  21278. * _.functions(new Foo);
  21279. * // => ['a', 'b']
  21280. */
  21281. function functions(object) {
  21282. return object == null ? [] : baseFunctions(object, keys(object));
  21283. }
  21284. /**
  21285. * Creates an array of function property names from own and inherited
  21286. * enumerable properties of `object`.
  21287. *
  21288. * @static
  21289. * @memberOf _
  21290. * @since 4.0.0
  21291. * @category Object
  21292. * @param {Object} object The object to inspect.
  21293. * @returns {Array} Returns the function names.
  21294. * @see _.functions
  21295. * @example
  21296. *
  21297. * function Foo() {
  21298. * this.a = _.constant('a');
  21299. * this.b = _.constant('b');
  21300. * }
  21301. *
  21302. * Foo.prototype.c = _.constant('c');
  21303. *
  21304. * _.functionsIn(new Foo);
  21305. * // => ['a', 'b', 'c']
  21306. */
  21307. function functionsIn(object) {
  21308. return object == null ? [] : baseFunctions(object, keysIn(object));
  21309. }
  21310. /**
  21311. * Gets the value at `path` of `object`. If the resolved value is
  21312. * `undefined`, the `defaultValue` is returned in its place.
  21313. *
  21314. * @static
  21315. * @memberOf _
  21316. * @since 3.7.0
  21317. * @category Object
  21318. * @param {Object} object The object to query.
  21319. * @param {Array|string} path The path of the property to get.
  21320. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  21321. * @returns {*} Returns the resolved value.
  21322. * @example
  21323. *
  21324. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  21325. *
  21326. * _.get(object, 'a[0].b.c');
  21327. * // => 3
  21328. *
  21329. * _.get(object, ['a', '0', 'b', 'c']);
  21330. * // => 3
  21331. *
  21332. * _.get(object, 'a.b.c', 'default');
  21333. * // => 'default'
  21334. */
  21335. function get(object, path, defaultValue) {
  21336. var result = object == null ? undefined : baseGet(object, path);
  21337. return result === undefined ? defaultValue : result;
  21338. }
  21339. /**
  21340. * Checks if `path` is a direct property of `object`.
  21341. *
  21342. * @static
  21343. * @since 0.1.0
  21344. * @memberOf _
  21345. * @category Object
  21346. * @param {Object} object The object to query.
  21347. * @param {Array|string} path The path to check.
  21348. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  21349. * @example
  21350. *
  21351. * var object = { 'a': { 'b': 2 } };
  21352. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  21353. *
  21354. * _.has(object, 'a');
  21355. * // => true
  21356. *
  21357. * _.has(object, 'a.b');
  21358. * // => true
  21359. *
  21360. * _.has(object, ['a', 'b']);
  21361. * // => true
  21362. *
  21363. * _.has(other, 'a');
  21364. * // => false
  21365. */
  21366. function has(object, path) {
  21367. return object != null && hasPath(object, path, baseHas);
  21368. }
  21369. /**
  21370. * Checks if `path` is a direct or inherited property of `object`.
  21371. *
  21372. * @static
  21373. * @memberOf _
  21374. * @since 4.0.0
  21375. * @category Object
  21376. * @param {Object} object The object to query.
  21377. * @param {Array|string} path The path to check.
  21378. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  21379. * @example
  21380. *
  21381. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  21382. *
  21383. * _.hasIn(object, 'a');
  21384. * // => true
  21385. *
  21386. * _.hasIn(object, 'a.b');
  21387. * // => true
  21388. *
  21389. * _.hasIn(object, ['a', 'b']);
  21390. * // => true
  21391. *
  21392. * _.hasIn(object, 'b');
  21393. * // => false
  21394. */
  21395. function hasIn(object, path) {
  21396. return object != null && hasPath(object, path, baseHasIn);
  21397. }
  21398. /**
  21399. * Creates an object composed of the inverted keys and values of `object`.
  21400. * If `object` contains duplicate values, subsequent values overwrite
  21401. * property assignments of previous values.
  21402. *
  21403. * @static
  21404. * @memberOf _
  21405. * @since 0.7.0
  21406. * @category Object
  21407. * @param {Object} object The object to invert.
  21408. * @returns {Object} Returns the new inverted object.
  21409. * @example
  21410. *
  21411. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  21412. *
  21413. * _.invert(object);
  21414. * // => { '1': 'c', '2': 'b' }
  21415. */
  21416. var invert = createInverter(function(result, value, key) {
  21417. result[value] = key;
  21418. }, constant(identity));
  21419. /**
  21420. * This method is like `_.invert` except that the inverted object is generated
  21421. * from the results of running each element of `object` thru `iteratee`. The
  21422. * corresponding inverted value of each inverted key is an array of keys
  21423. * responsible for generating the inverted value. The iteratee is invoked
  21424. * with one argument: (value).
  21425. *
  21426. * @static
  21427. * @memberOf _
  21428. * @since 4.1.0
  21429. * @category Object
  21430. * @param {Object} object The object to invert.
  21431. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21432. * @returns {Object} Returns the new inverted object.
  21433. * @example
  21434. *
  21435. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  21436. *
  21437. * _.invertBy(object);
  21438. * // => { '1': ['a', 'c'], '2': ['b'] }
  21439. *
  21440. * _.invertBy(object, function(value) {
  21441. * return 'group' + value;
  21442. * });
  21443. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  21444. */
  21445. var invertBy = createInverter(function(result, value, key) {
  21446. if (hasOwnProperty.call(result, value)) {
  21447. result[value].push(key);
  21448. } else {
  21449. result[value] = [key];
  21450. }
  21451. }, getIteratee);
  21452. /**
  21453. * Invokes the method at `path` of `object`.
  21454. *
  21455. * @static
  21456. * @memberOf _
  21457. * @since 4.0.0
  21458. * @category Object
  21459. * @param {Object} object The object to query.
  21460. * @param {Array|string} path The path of the method to invoke.
  21461. * @param {...*} [args] The arguments to invoke the method with.
  21462. * @returns {*} Returns the result of the invoked method.
  21463. * @example
  21464. *
  21465. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  21466. *
  21467. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  21468. * // => [2, 3]
  21469. */
  21470. var invoke = baseRest(baseInvoke);
  21471. /**
  21472. * Creates an array of the own enumerable property names of `object`.
  21473. *
  21474. * **Note:** Non-object values are coerced to objects. See the
  21475. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  21476. * for more details.
  21477. *
  21478. * @static
  21479. * @since 0.1.0
  21480. * @memberOf _
  21481. * @category Object
  21482. * @param {Object} object The object to query.
  21483. * @returns {Array} Returns the array of property names.
  21484. * @example
  21485. *
  21486. * function Foo() {
  21487. * this.a = 1;
  21488. * this.b = 2;
  21489. * }
  21490. *
  21491. * Foo.prototype.c = 3;
  21492. *
  21493. * _.keys(new Foo);
  21494. * // => ['a', 'b'] (iteration order is not guaranteed)
  21495. *
  21496. * _.keys('hi');
  21497. * // => ['0', '1']
  21498. */
  21499. function keys(object) {
  21500. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  21501. }
  21502. /**
  21503. * Creates an array of the own and inherited enumerable property names of `object`.
  21504. *
  21505. * **Note:** Non-object values are coerced to objects.
  21506. *
  21507. * @static
  21508. * @memberOf _
  21509. * @since 3.0.0
  21510. * @category Object
  21511. * @param {Object} object The object to query.
  21512. * @returns {Array} Returns the array of property names.
  21513. * @example
  21514. *
  21515. * function Foo() {
  21516. * this.a = 1;
  21517. * this.b = 2;
  21518. * }
  21519. *
  21520. * Foo.prototype.c = 3;
  21521. *
  21522. * _.keysIn(new Foo);
  21523. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  21524. */
  21525. function keysIn(object) {
  21526. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  21527. }
  21528. /**
  21529. * The opposite of `_.mapValues`; this method creates an object with the
  21530. * same values as `object` and keys generated by running each own enumerable
  21531. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  21532. * with three arguments: (value, key, object).
  21533. *
  21534. * @static
  21535. * @memberOf _
  21536. * @since 3.8.0
  21537. * @category Object
  21538. * @param {Object} object The object to iterate over.
  21539. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21540. * @returns {Object} Returns the new mapped object.
  21541. * @see _.mapValues
  21542. * @example
  21543. *
  21544. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  21545. * return key + value;
  21546. * });
  21547. * // => { 'a1': 1, 'b2': 2 }
  21548. */
  21549. function mapKeys(object, iteratee) {
  21550. var result = {};
  21551. iteratee = getIteratee(iteratee, 3);
  21552. baseForOwn(object, function(value, key, object) {
  21553. baseAssignValue(result, iteratee(value, key, object), value);
  21554. });
  21555. return result;
  21556. }
  21557. /**
  21558. * Creates an object with the same keys as `object` and values generated
  21559. * by running each own enumerable string keyed property of `object` thru
  21560. * `iteratee`. The iteratee is invoked with three arguments:
  21561. * (value, key, object).
  21562. *
  21563. * @static
  21564. * @memberOf _
  21565. * @since 2.4.0
  21566. * @category Object
  21567. * @param {Object} object The object to iterate over.
  21568. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21569. * @returns {Object} Returns the new mapped object.
  21570. * @see _.mapKeys
  21571. * @example
  21572. *
  21573. * var users = {
  21574. * 'fred': { 'user': 'fred', 'age': 40 },
  21575. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  21576. * };
  21577. *
  21578. * _.mapValues(users, function(o) { return o.age; });
  21579. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  21580. *
  21581. * // The `_.property` iteratee shorthand.
  21582. * _.mapValues(users, 'age');
  21583. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  21584. */
  21585. function mapValues(object, iteratee) {
  21586. var result = {};
  21587. iteratee = getIteratee(iteratee, 3);
  21588. baseForOwn(object, function(value, key, object) {
  21589. baseAssignValue(result, key, iteratee(value, key, object));
  21590. });
  21591. return result;
  21592. }
  21593. /**
  21594. * This method is like `_.assign` except that it recursively merges own and
  21595. * inherited enumerable string keyed properties of source objects into the
  21596. * destination object. Source properties that resolve to `undefined` are
  21597. * skipped if a destination value exists. Array and plain object properties
  21598. * are merged recursively. Other objects and value types are overridden by
  21599. * assignment. Source objects are applied from left to right. Subsequent
  21600. * sources overwrite property assignments of previous sources.
  21601. *
  21602. * **Note:** This method mutates `object`.
  21603. *
  21604. * @static
  21605. * @memberOf _
  21606. * @since 0.5.0
  21607. * @category Object
  21608. * @param {Object} object The destination object.
  21609. * @param {...Object} [sources] The source objects.
  21610. * @returns {Object} Returns `object`.
  21611. * @example
  21612. *
  21613. * var object = {
  21614. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  21615. * };
  21616. *
  21617. * var other = {
  21618. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  21619. * };
  21620. *
  21621. * _.merge(object, other);
  21622. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  21623. */
  21624. var merge = createAssigner(function(object, source, srcIndex) {
  21625. baseMerge(object, source, srcIndex);
  21626. });
  21627. /**
  21628. * This method is like `_.merge` except that it accepts `customizer` which
  21629. * is invoked to produce the merged values of the destination and source
  21630. * properties. If `customizer` returns `undefined`, merging is handled by the
  21631. * method instead. The `customizer` is invoked with six arguments:
  21632. * (objValue, srcValue, key, object, source, stack).
  21633. *
  21634. * **Note:** This method mutates `object`.
  21635. *
  21636. * @static
  21637. * @memberOf _
  21638. * @since 4.0.0
  21639. * @category Object
  21640. * @param {Object} object The destination object.
  21641. * @param {...Object} sources The source objects.
  21642. * @param {Function} customizer The function to customize assigned values.
  21643. * @returns {Object} Returns `object`.
  21644. * @example
  21645. *
  21646. * function customizer(objValue, srcValue) {
  21647. * if (_.isArray(objValue)) {
  21648. * return objValue.concat(srcValue);
  21649. * }
  21650. * }
  21651. *
  21652. * var object = { 'a': [1], 'b': [2] };
  21653. * var other = { 'a': [3], 'b': [4] };
  21654. *
  21655. * _.mergeWith(object, other, customizer);
  21656. * // => { 'a': [1, 3], 'b': [2, 4] }
  21657. */
  21658. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  21659. baseMerge(object, source, srcIndex, customizer);
  21660. });
  21661. /**
  21662. * The opposite of `_.pick`; this method creates an object composed of the
  21663. * own and inherited enumerable property paths of `object` that are not omitted.
  21664. *
  21665. * **Note:** This method is considerably slower than `_.pick`.
  21666. *
  21667. * @static
  21668. * @since 0.1.0
  21669. * @memberOf _
  21670. * @category Object
  21671. * @param {Object} object The source object.
  21672. * @param {...(string|string[])} [paths] The property paths to omit.
  21673. * @returns {Object} Returns the new object.
  21674. * @example
  21675. *
  21676. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21677. *
  21678. * _.omit(object, ['a', 'c']);
  21679. * // => { 'b': '2' }
  21680. */
  21681. var omit = flatRest(function(object, paths) {
  21682. var result = {};
  21683. if (object == null) {
  21684. return result;
  21685. }
  21686. var isDeep = false;
  21687. paths = arrayMap(paths, function(path) {
  21688. path = castPath(path, object);
  21689. isDeep || (isDeep = path.length > 1);
  21690. return path;
  21691. });
  21692. copyObject(object, getAllKeysIn(object), result);
  21693. if (isDeep) {
  21694. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  21695. }
  21696. var length = paths.length;
  21697. while (length--) {
  21698. baseUnset(result, paths[length]);
  21699. }
  21700. return result;
  21701. });
  21702. /**
  21703. * The opposite of `_.pickBy`; this method creates an object composed of
  21704. * the own and inherited enumerable string keyed properties of `object` that
  21705. * `predicate` doesn't return truthy for. The predicate is invoked with two
  21706. * arguments: (value, key).
  21707. *
  21708. * @static
  21709. * @memberOf _
  21710. * @since 4.0.0
  21711. * @category Object
  21712. * @param {Object} object The source object.
  21713. * @param {Function} [predicate=_.identity] The function invoked per property.
  21714. * @returns {Object} Returns the new object.
  21715. * @example
  21716. *
  21717. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21718. *
  21719. * _.omitBy(object, _.isNumber);
  21720. * // => { 'b': '2' }
  21721. */
  21722. function omitBy(object, predicate) {
  21723. return pickBy(object, negate(getIteratee(predicate)));
  21724. }
  21725. /**
  21726. * Creates an object composed of the picked `object` properties.
  21727. *
  21728. * @static
  21729. * @since 0.1.0
  21730. * @memberOf _
  21731. * @category Object
  21732. * @param {Object} object The source object.
  21733. * @param {...(string|string[])} [paths] The property paths to pick.
  21734. * @returns {Object} Returns the new object.
  21735. * @example
  21736. *
  21737. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21738. *
  21739. * _.pick(object, ['a', 'c']);
  21740. * // => { 'a': 1, 'c': 3 }
  21741. */
  21742. var pick = flatRest(function(object, paths) {
  21743. return object == null ? {} : basePick(object, paths);
  21744. });
  21745. /**
  21746. * Creates an object composed of the `object` properties `predicate` returns
  21747. * truthy for. The predicate is invoked with two arguments: (value, key).
  21748. *
  21749. * @static
  21750. * @memberOf _
  21751. * @since 4.0.0
  21752. * @category Object
  21753. * @param {Object} object The source object.
  21754. * @param {Function} [predicate=_.identity] The function invoked per property.
  21755. * @returns {Object} Returns the new object.
  21756. * @example
  21757. *
  21758. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21759. *
  21760. * _.pickBy(object, _.isNumber);
  21761. * // => { 'a': 1, 'c': 3 }
  21762. */
  21763. function pickBy(object, predicate) {
  21764. if (object == null) {
  21765. return {};
  21766. }
  21767. var props = arrayMap(getAllKeysIn(object), function(prop) {
  21768. return [prop];
  21769. });
  21770. predicate = getIteratee(predicate);
  21771. return basePickBy(object, props, function(value, path) {
  21772. return predicate(value, path[0]);
  21773. });
  21774. }
  21775. /**
  21776. * This method is like `_.get` except that if the resolved value is a
  21777. * function it's invoked with the `this` binding of its parent object and
  21778. * its result is returned.
  21779. *
  21780. * @static
  21781. * @since 0.1.0
  21782. * @memberOf _
  21783. * @category Object
  21784. * @param {Object} object The object to query.
  21785. * @param {Array|string} path The path of the property to resolve.
  21786. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  21787. * @returns {*} Returns the resolved value.
  21788. * @example
  21789. *
  21790. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  21791. *
  21792. * _.result(object, 'a[0].b.c1');
  21793. * // => 3
  21794. *
  21795. * _.result(object, 'a[0].b.c2');
  21796. * // => 4
  21797. *
  21798. * _.result(object, 'a[0].b.c3', 'default');
  21799. * // => 'default'
  21800. *
  21801. * _.result(object, 'a[0].b.c3', _.constant('default'));
  21802. * // => 'default'
  21803. */
  21804. function result(object, path, defaultValue) {
  21805. path = castPath(path, object);
  21806. var index = -1,
  21807. length = path.length;
  21808. // Ensure the loop is entered when path is empty.
  21809. if (!length) {
  21810. length = 1;
  21811. object = undefined;
  21812. }
  21813. while (++index < length) {
  21814. var value = object == null ? undefined : object[toKey(path[index])];
  21815. if (value === undefined) {
  21816. index = length;
  21817. value = defaultValue;
  21818. }
  21819. object = isFunction(value) ? value.call(object) : value;
  21820. }
  21821. return object;
  21822. }
  21823. /**
  21824. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  21825. * it's created. Arrays are created for missing index properties while objects
  21826. * are created for all other missing properties. Use `_.setWith` to customize
  21827. * `path` creation.
  21828. *
  21829. * **Note:** This method mutates `object`.
  21830. *
  21831. * @static
  21832. * @memberOf _
  21833. * @since 3.7.0
  21834. * @category Object
  21835. * @param {Object} object The object to modify.
  21836. * @param {Array|string} path The path of the property to set.
  21837. * @param {*} value The value to set.
  21838. * @returns {Object} Returns `object`.
  21839. * @example
  21840. *
  21841. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  21842. *
  21843. * _.set(object, 'a[0].b.c', 4);
  21844. * console.log(object.a[0].b.c);
  21845. * // => 4
  21846. *
  21847. * _.set(object, ['x', '0', 'y', 'z'], 5);
  21848. * console.log(object.x[0].y.z);
  21849. * // => 5
  21850. */
  21851. function set(object, path, value) {
  21852. return object == null ? object : baseSet(object, path, value);
  21853. }
  21854. /**
  21855. * This method is like `_.set` except that it accepts `customizer` which is
  21856. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  21857. * path creation is handled by the method instead. The `customizer` is invoked
  21858. * with three arguments: (nsValue, key, nsObject).
  21859. *
  21860. * **Note:** This method mutates `object`.
  21861. *
  21862. * @static
  21863. * @memberOf _
  21864. * @since 4.0.0
  21865. * @category Object
  21866. * @param {Object} object The object to modify.
  21867. * @param {Array|string} path The path of the property to set.
  21868. * @param {*} value The value to set.
  21869. * @param {Function} [customizer] The function to customize assigned values.
  21870. * @returns {Object} Returns `object`.
  21871. * @example
  21872. *
  21873. * var object = {};
  21874. *
  21875. * _.setWith(object, '[0][1]', 'a', Object);
  21876. * // => { '0': { '1': 'a' } }
  21877. */
  21878. function setWith(object, path, value, customizer) {
  21879. customizer = typeof customizer == 'function' ? customizer : undefined;
  21880. return object == null ? object : baseSet(object, path, value, customizer);
  21881. }
  21882. /**
  21883. * Creates an array of own enumerable string keyed-value pairs for `object`
  21884. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  21885. * entries are returned.
  21886. *
  21887. * @static
  21888. * @memberOf _
  21889. * @since 4.0.0
  21890. * @alias entries
  21891. * @category Object
  21892. * @param {Object} object The object to query.
  21893. * @returns {Array} Returns the key-value pairs.
  21894. * @example
  21895. *
  21896. * function Foo() {
  21897. * this.a = 1;
  21898. * this.b = 2;
  21899. * }
  21900. *
  21901. * Foo.prototype.c = 3;
  21902. *
  21903. * _.toPairs(new Foo);
  21904. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  21905. */
  21906. var toPairs = createToPairs(keys);
  21907. /**
  21908. * Creates an array of own and inherited enumerable string keyed-value pairs
  21909. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  21910. * or set, its entries are returned.
  21911. *
  21912. * @static
  21913. * @memberOf _
  21914. * @since 4.0.0
  21915. * @alias entriesIn
  21916. * @category Object
  21917. * @param {Object} object The object to query.
  21918. * @returns {Array} Returns the key-value pairs.
  21919. * @example
  21920. *
  21921. * function Foo() {
  21922. * this.a = 1;
  21923. * this.b = 2;
  21924. * }
  21925. *
  21926. * Foo.prototype.c = 3;
  21927. *
  21928. * _.toPairsIn(new Foo);
  21929. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  21930. */
  21931. var toPairsIn = createToPairs(keysIn);
  21932. /**
  21933. * An alternative to `_.reduce`; this method transforms `object` to a new
  21934. * `accumulator` object which is the result of running each of its own
  21935. * enumerable string keyed properties thru `iteratee`, with each invocation
  21936. * potentially mutating the `accumulator` object. If `accumulator` is not
  21937. * provided, a new object with the same `[[Prototype]]` will be used. The
  21938. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  21939. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21940. *
  21941. * @static
  21942. * @memberOf _
  21943. * @since 1.3.0
  21944. * @category Object
  21945. * @param {Object} object The object to iterate over.
  21946. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21947. * @param {*} [accumulator] The custom accumulator value.
  21948. * @returns {*} Returns the accumulated value.
  21949. * @example
  21950. *
  21951. * _.transform([2, 3, 4], function(result, n) {
  21952. * result.push(n *= n);
  21953. * return n % 2 == 0;
  21954. * }, []);
  21955. * // => [4, 9]
  21956. *
  21957. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  21958. * (result[value] || (result[value] = [])).push(key);
  21959. * }, {});
  21960. * // => { '1': ['a', 'c'], '2': ['b'] }
  21961. */
  21962. function transform(object, iteratee, accumulator) {
  21963. var isArr = isArray(object),
  21964. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  21965. iteratee = getIteratee(iteratee, 4);
  21966. if (accumulator == null) {
  21967. var Ctor = object && object.constructor;
  21968. if (isArrLike) {
  21969. accumulator = isArr ? new Ctor : [];
  21970. }
  21971. else if (isObject(object)) {
  21972. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  21973. }
  21974. else {
  21975. accumulator = {};
  21976. }
  21977. }
  21978. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  21979. return iteratee(accumulator, value, index, object);
  21980. });
  21981. return accumulator;
  21982. }
  21983. /**
  21984. * Removes the property at `path` of `object`.
  21985. *
  21986. * **Note:** This method mutates `object`.
  21987. *
  21988. * @static
  21989. * @memberOf _
  21990. * @since 4.0.0
  21991. * @category Object
  21992. * @param {Object} object The object to modify.
  21993. * @param {Array|string} path The path of the property to unset.
  21994. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21995. * @example
  21996. *
  21997. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  21998. * _.unset(object, 'a[0].b.c');
  21999. * // => true
  22000. *
  22001. * console.log(object);
  22002. * // => { 'a': [{ 'b': {} }] };
  22003. *
  22004. * _.unset(object, ['a', '0', 'b', 'c']);
  22005. * // => true
  22006. *
  22007. * console.log(object);
  22008. * // => { 'a': [{ 'b': {} }] };
  22009. */
  22010. function unset(object, path) {
  22011. return object == null ? true : baseUnset(object, path);
  22012. }
  22013. /**
  22014. * This method is like `_.set` except that accepts `updater` to produce the
  22015. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  22016. * is invoked with one argument: (value).
  22017. *
  22018. * **Note:** This method mutates `object`.
  22019. *
  22020. * @static
  22021. * @memberOf _
  22022. * @since 4.6.0
  22023. * @category Object
  22024. * @param {Object} object The object to modify.
  22025. * @param {Array|string} path The path of the property to set.
  22026. * @param {Function} updater The function to produce the updated value.
  22027. * @returns {Object} Returns `object`.
  22028. * @example
  22029. *
  22030. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  22031. *
  22032. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  22033. * console.log(object.a[0].b.c);
  22034. * // => 9
  22035. *
  22036. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  22037. * console.log(object.x[0].y.z);
  22038. * // => 0
  22039. */
  22040. function update(object, path, updater) {
  22041. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  22042. }
  22043. /**
  22044. * This method is like `_.update` except that it accepts `customizer` which is
  22045. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  22046. * path creation is handled by the method instead. The `customizer` is invoked
  22047. * with three arguments: (nsValue, key, nsObject).
  22048. *
  22049. * **Note:** This method mutates `object`.
  22050. *
  22051. * @static
  22052. * @memberOf _
  22053. * @since 4.6.0
  22054. * @category Object
  22055. * @param {Object} object The object to modify.
  22056. * @param {Array|string} path The path of the property to set.
  22057. * @param {Function} updater The function to produce the updated value.
  22058. * @param {Function} [customizer] The function to customize assigned values.
  22059. * @returns {Object} Returns `object`.
  22060. * @example
  22061. *
  22062. * var object = {};
  22063. *
  22064. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  22065. * // => { '0': { '1': 'a' } }
  22066. */
  22067. function updateWith(object, path, updater, customizer) {
  22068. customizer = typeof customizer == 'function' ? customizer : undefined;
  22069. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  22070. }
  22071. /**
  22072. * Creates an array of the own enumerable string keyed property values of `object`.
  22073. *
  22074. * **Note:** Non-object values are coerced to objects.
  22075. *
  22076. * @static
  22077. * @since 0.1.0
  22078. * @memberOf _
  22079. * @category Object
  22080. * @param {Object} object The object to query.
  22081. * @returns {Array} Returns the array of property values.
  22082. * @example
  22083. *
  22084. * function Foo() {
  22085. * this.a = 1;
  22086. * this.b = 2;
  22087. * }
  22088. *
  22089. * Foo.prototype.c = 3;
  22090. *
  22091. * _.values(new Foo);
  22092. * // => [1, 2] (iteration order is not guaranteed)
  22093. *
  22094. * _.values('hi');
  22095. * // => ['h', 'i']
  22096. */
  22097. function values(object) {
  22098. return object == null ? [] : baseValues(object, keys(object));
  22099. }
  22100. /**
  22101. * Creates an array of the own and inherited enumerable string keyed property
  22102. * values of `object`.
  22103. *
  22104. * **Note:** Non-object values are coerced to objects.
  22105. *
  22106. * @static
  22107. * @memberOf _
  22108. * @since 3.0.0
  22109. * @category Object
  22110. * @param {Object} object The object to query.
  22111. * @returns {Array} Returns the array of property values.
  22112. * @example
  22113. *
  22114. * function Foo() {
  22115. * this.a = 1;
  22116. * this.b = 2;
  22117. * }
  22118. *
  22119. * Foo.prototype.c = 3;
  22120. *
  22121. * _.valuesIn(new Foo);
  22122. * // => [1, 2, 3] (iteration order is not guaranteed)
  22123. */
  22124. function valuesIn(object) {
  22125. return object == null ? [] : baseValues(object, keysIn(object));
  22126. }
  22127. /*------------------------------------------------------------------------*/
  22128. /**
  22129. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  22130. *
  22131. * @static
  22132. * @memberOf _
  22133. * @since 4.0.0
  22134. * @category Number
  22135. * @param {number} number The number to clamp.
  22136. * @param {number} [lower] The lower bound.
  22137. * @param {number} upper The upper bound.
  22138. * @returns {number} Returns the clamped number.
  22139. * @example
  22140. *
  22141. * _.clamp(-10, -5, 5);
  22142. * // => -5
  22143. *
  22144. * _.clamp(10, -5, 5);
  22145. * // => 5
  22146. */
  22147. function clamp(number, lower, upper) {
  22148. if (upper === undefined) {
  22149. upper = lower;
  22150. lower = undefined;
  22151. }
  22152. if (upper !== undefined) {
  22153. upper = toNumber(upper);
  22154. upper = upper === upper ? upper : 0;
  22155. }
  22156. if (lower !== undefined) {
  22157. lower = toNumber(lower);
  22158. lower = lower === lower ? lower : 0;
  22159. }
  22160. return baseClamp(toNumber(number), lower, upper);
  22161. }
  22162. /**
  22163. * Checks if `n` is between `start` and up to, but not including, `end`. If
  22164. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  22165. * If `start` is greater than `end` the params are swapped to support
  22166. * negative ranges.
  22167. *
  22168. * @static
  22169. * @memberOf _
  22170. * @since 3.3.0
  22171. * @category Number
  22172. * @param {number} number The number to check.
  22173. * @param {number} [start=0] The start of the range.
  22174. * @param {number} end The end of the range.
  22175. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  22176. * @see _.range, _.rangeRight
  22177. * @example
  22178. *
  22179. * _.inRange(3, 2, 4);
  22180. * // => true
  22181. *
  22182. * _.inRange(4, 8);
  22183. * // => true
  22184. *
  22185. * _.inRange(4, 2);
  22186. * // => false
  22187. *
  22188. * _.inRange(2, 2);
  22189. * // => false
  22190. *
  22191. * _.inRange(1.2, 2);
  22192. * // => true
  22193. *
  22194. * _.inRange(5.2, 4);
  22195. * // => false
  22196. *
  22197. * _.inRange(-3, -2, -6);
  22198. * // => true
  22199. */
  22200. function inRange(number, start, end) {
  22201. start = toFinite(start);
  22202. if (end === undefined) {
  22203. end = start;
  22204. start = 0;
  22205. } else {
  22206. end = toFinite(end);
  22207. }
  22208. number = toNumber(number);
  22209. return baseInRange(number, start, end);
  22210. }
  22211. /**
  22212. * Produces a random number between the inclusive `lower` and `upper` bounds.
  22213. * If only one argument is provided a number between `0` and the given number
  22214. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  22215. * floats, a floating-point number is returned instead of an integer.
  22216. *
  22217. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  22218. * floating-point values which can produce unexpected results.
  22219. *
  22220. * @static
  22221. * @memberOf _
  22222. * @since 0.7.0
  22223. * @category Number
  22224. * @param {number} [lower=0] The lower bound.
  22225. * @param {number} [upper=1] The upper bound.
  22226. * @param {boolean} [floating] Specify returning a floating-point number.
  22227. * @returns {number} Returns the random number.
  22228. * @example
  22229. *
  22230. * _.random(0, 5);
  22231. * // => an integer between 0 and 5
  22232. *
  22233. * _.random(5);
  22234. * // => also an integer between 0 and 5
  22235. *
  22236. * _.random(5, true);
  22237. * // => a floating-point number between 0 and 5
  22238. *
  22239. * _.random(1.2, 5.2);
  22240. * // => a floating-point number between 1.2 and 5.2
  22241. */
  22242. function random(lower, upper, floating) {
  22243. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  22244. upper = floating = undefined;
  22245. }
  22246. if (floating === undefined) {
  22247. if (typeof upper == 'boolean') {
  22248. floating = upper;
  22249. upper = undefined;
  22250. }
  22251. else if (typeof lower == 'boolean') {
  22252. floating = lower;
  22253. lower = undefined;
  22254. }
  22255. }
  22256. if (lower === undefined && upper === undefined) {
  22257. lower = 0;
  22258. upper = 1;
  22259. }
  22260. else {
  22261. lower = toFinite(lower);
  22262. if (upper === undefined) {
  22263. upper = lower;
  22264. lower = 0;
  22265. } else {
  22266. upper = toFinite(upper);
  22267. }
  22268. }
  22269. if (lower > upper) {
  22270. var temp = lower;
  22271. lower = upper;
  22272. upper = temp;
  22273. }
  22274. if (floating || lower % 1 || upper % 1) {
  22275. var rand = nativeRandom();
  22276. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  22277. }
  22278. return baseRandom(lower, upper);
  22279. }
  22280. /*------------------------------------------------------------------------*/
  22281. /**
  22282. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  22283. *
  22284. * @static
  22285. * @memberOf _
  22286. * @since 3.0.0
  22287. * @category String
  22288. * @param {string} [string=''] The string to convert.
  22289. * @returns {string} Returns the camel cased string.
  22290. * @example
  22291. *
  22292. * _.camelCase('Foo Bar');
  22293. * // => 'fooBar'
  22294. *
  22295. * _.camelCase('--foo-bar--');
  22296. * // => 'fooBar'
  22297. *
  22298. * _.camelCase('__FOO_BAR__');
  22299. * // => 'fooBar'
  22300. */
  22301. var camelCase = createCompounder(function(result, word, index) {
  22302. word = word.toLowerCase();
  22303. return result + (index ? capitalize(word) : word);
  22304. });
  22305. /**
  22306. * Converts the first character of `string` to upper case and the remaining
  22307. * to lower case.
  22308. *
  22309. * @static
  22310. * @memberOf _
  22311. * @since 3.0.0
  22312. * @category String
  22313. * @param {string} [string=''] The string to capitalize.
  22314. * @returns {string} Returns the capitalized string.
  22315. * @example
  22316. *
  22317. * _.capitalize('FRED');
  22318. * // => 'Fred'
  22319. */
  22320. function capitalize(string) {
  22321. return upperFirst(toString(string).toLowerCase());
  22322. }
  22323. /**
  22324. * Deburrs `string` by converting
  22325. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  22326. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  22327. * letters to basic Latin letters and removing
  22328. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  22329. *
  22330. * @static
  22331. * @memberOf _
  22332. * @since 3.0.0
  22333. * @category String
  22334. * @param {string} [string=''] The string to deburr.
  22335. * @returns {string} Returns the deburred string.
  22336. * @example
  22337. *
  22338. * _.deburr('déjà vu');
  22339. * // => 'deja vu'
  22340. */
  22341. function deburr(string) {
  22342. string = toString(string);
  22343. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  22344. }
  22345. /**
  22346. * Checks if `string` ends with the given target string.
  22347. *
  22348. * @static
  22349. * @memberOf _
  22350. * @since 3.0.0
  22351. * @category String
  22352. * @param {string} [string=''] The string to inspect.
  22353. * @param {string} [target] The string to search for.
  22354. * @param {number} [position=string.length] The position to search up to.
  22355. * @returns {boolean} Returns `true` if `string` ends with `target`,
  22356. * else `false`.
  22357. * @example
  22358. *
  22359. * _.endsWith('abc', 'c');
  22360. * // => true
  22361. *
  22362. * _.endsWith('abc', 'b');
  22363. * // => false
  22364. *
  22365. * _.endsWith('abc', 'b', 2);
  22366. * // => true
  22367. */
  22368. function endsWith(string, target, position) {
  22369. string = toString(string);
  22370. target = baseToString(target);
  22371. var length = string.length;
  22372. position = position === undefined
  22373. ? length
  22374. : baseClamp(toInteger(position), 0, length);
  22375. var end = position;
  22376. position -= target.length;
  22377. return position >= 0 && string.slice(position, end) == target;
  22378. }
  22379. /**
  22380. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  22381. * corresponding HTML entities.
  22382. *
  22383. * **Note:** No other characters are escaped. To escape additional
  22384. * characters use a third-party library like [_he_](https://mths.be/he).
  22385. *
  22386. * Though the ">" character is escaped for symmetry, characters like
  22387. * ">" and "/" don't need escaping in HTML and have no special meaning
  22388. * unless they're part of a tag or unquoted attribute value. See
  22389. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  22390. * (under "semi-related fun fact") for more details.
  22391. *
  22392. * When working with HTML you should always
  22393. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  22394. * XSS vectors.
  22395. *
  22396. * @static
  22397. * @since 0.1.0
  22398. * @memberOf _
  22399. * @category String
  22400. * @param {string} [string=''] The string to escape.
  22401. * @returns {string} Returns the escaped string.
  22402. * @example
  22403. *
  22404. * _.escape('fred, barney, & pebbles');
  22405. * // => 'fred, barney, &amp; pebbles'
  22406. */
  22407. function escape(string) {
  22408. string = toString(string);
  22409. return (string && reHasUnescapedHtml.test(string))
  22410. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  22411. : string;
  22412. }
  22413. /**
  22414. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  22415. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  22416. *
  22417. * @static
  22418. * @memberOf _
  22419. * @since 3.0.0
  22420. * @category String
  22421. * @param {string} [string=''] The string to escape.
  22422. * @returns {string} Returns the escaped string.
  22423. * @example
  22424. *
  22425. * _.escapeRegExp('[lodash](https://lodash.com/)');
  22426. * // => '\[lodash\]\(https://lodash\.com/\)'
  22427. */
  22428. function escapeRegExp(string) {
  22429. string = toString(string);
  22430. return (string && reHasRegExpChar.test(string))
  22431. ? string.replace(reRegExpChar, '\\$&')
  22432. : string;
  22433. }
  22434. /**
  22435. * Converts `string` to
  22436. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  22437. *
  22438. * @static
  22439. * @memberOf _
  22440. * @since 3.0.0
  22441. * @category String
  22442. * @param {string} [string=''] The string to convert.
  22443. * @returns {string} Returns the kebab cased string.
  22444. * @example
  22445. *
  22446. * _.kebabCase('Foo Bar');
  22447. * // => 'foo-bar'
  22448. *
  22449. * _.kebabCase('fooBar');
  22450. * // => 'foo-bar'
  22451. *
  22452. * _.kebabCase('__FOO_BAR__');
  22453. * // => 'foo-bar'
  22454. */
  22455. var kebabCase = createCompounder(function(result, word, index) {
  22456. return result + (index ? '-' : '') + word.toLowerCase();
  22457. });
  22458. /**
  22459. * Converts `string`, as space separated words, to lower case.
  22460. *
  22461. * @static
  22462. * @memberOf _
  22463. * @since 4.0.0
  22464. * @category String
  22465. * @param {string} [string=''] The string to convert.
  22466. * @returns {string} Returns the lower cased string.
  22467. * @example
  22468. *
  22469. * _.lowerCase('--Foo-Bar--');
  22470. * // => 'foo bar'
  22471. *
  22472. * _.lowerCase('fooBar');
  22473. * // => 'foo bar'
  22474. *
  22475. * _.lowerCase('__FOO_BAR__');
  22476. * // => 'foo bar'
  22477. */
  22478. var lowerCase = createCompounder(function(result, word, index) {
  22479. return result + (index ? ' ' : '') + word.toLowerCase();
  22480. });
  22481. /**
  22482. * Converts the first character of `string` to lower case.
  22483. *
  22484. * @static
  22485. * @memberOf _
  22486. * @since 4.0.0
  22487. * @category String
  22488. * @param {string} [string=''] The string to convert.
  22489. * @returns {string} Returns the converted string.
  22490. * @example
  22491. *
  22492. * _.lowerFirst('Fred');
  22493. * // => 'fred'
  22494. *
  22495. * _.lowerFirst('FRED');
  22496. * // => 'fRED'
  22497. */
  22498. var lowerFirst = createCaseFirst('toLowerCase');
  22499. /**
  22500. * Pads `string` on the left and right sides if it's shorter than `length`.
  22501. * Padding characters are truncated if they can't be evenly divided by `length`.
  22502. *
  22503. * @static
  22504. * @memberOf _
  22505. * @since 3.0.0
  22506. * @category String
  22507. * @param {string} [string=''] The string to pad.
  22508. * @param {number} [length=0] The padding length.
  22509. * @param {string} [chars=' '] The string used as padding.
  22510. * @returns {string} Returns the padded string.
  22511. * @example
  22512. *
  22513. * _.pad('abc', 8);
  22514. * // => ' abc '
  22515. *
  22516. * _.pad('abc', 8, '_-');
  22517. * // => '_-abc_-_'
  22518. *
  22519. * _.pad('abc', 3);
  22520. * // => 'abc'
  22521. */
  22522. function pad(string, length, chars) {
  22523. string = toString(string);
  22524. length = toInteger(length);
  22525. var strLength = length ? stringSize(string) : 0;
  22526. if (!length || strLength >= length) {
  22527. return string;
  22528. }
  22529. var mid = (length - strLength) / 2;
  22530. return (
  22531. createPadding(nativeFloor(mid), chars) +
  22532. string +
  22533. createPadding(nativeCeil(mid), chars)
  22534. );
  22535. }
  22536. /**
  22537. * Pads `string` on the right side if it's shorter than `length`. Padding
  22538. * characters are truncated if they exceed `length`.
  22539. *
  22540. * @static
  22541. * @memberOf _
  22542. * @since 4.0.0
  22543. * @category String
  22544. * @param {string} [string=''] The string to pad.
  22545. * @param {number} [length=0] The padding length.
  22546. * @param {string} [chars=' '] The string used as padding.
  22547. * @returns {string} Returns the padded string.
  22548. * @example
  22549. *
  22550. * _.padEnd('abc', 6);
  22551. * // => 'abc '
  22552. *
  22553. * _.padEnd('abc', 6, '_-');
  22554. * // => 'abc_-_'
  22555. *
  22556. * _.padEnd('abc', 3);
  22557. * // => 'abc'
  22558. */
  22559. function padEnd(string, length, chars) {
  22560. string = toString(string);
  22561. length = toInteger(length);
  22562. var strLength = length ? stringSize(string) : 0;
  22563. return (length && strLength < length)
  22564. ? (string + createPadding(length - strLength, chars))
  22565. : string;
  22566. }
  22567. /**
  22568. * Pads `string` on the left side if it's shorter than `length`. Padding
  22569. * characters are truncated if they exceed `length`.
  22570. *
  22571. * @static
  22572. * @memberOf _
  22573. * @since 4.0.0
  22574. * @category String
  22575. * @param {string} [string=''] The string to pad.
  22576. * @param {number} [length=0] The padding length.
  22577. * @param {string} [chars=' '] The string used as padding.
  22578. * @returns {string} Returns the padded string.
  22579. * @example
  22580. *
  22581. * _.padStart('abc', 6);
  22582. * // => ' abc'
  22583. *
  22584. * _.padStart('abc', 6, '_-');
  22585. * // => '_-_abc'
  22586. *
  22587. * _.padStart('abc', 3);
  22588. * // => 'abc'
  22589. */
  22590. function padStart(string, length, chars) {
  22591. string = toString(string);
  22592. length = toInteger(length);
  22593. var strLength = length ? stringSize(string) : 0;
  22594. return (length && strLength < length)
  22595. ? (createPadding(length - strLength, chars) + string)
  22596. : string;
  22597. }
  22598. /**
  22599. * Converts `string` to an integer of the specified radix. If `radix` is
  22600. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  22601. * hexadecimal, in which case a `radix` of `16` is used.
  22602. *
  22603. * **Note:** This method aligns with the
  22604. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  22605. *
  22606. * @static
  22607. * @memberOf _
  22608. * @since 1.1.0
  22609. * @category String
  22610. * @param {string} string The string to convert.
  22611. * @param {number} [radix=10] The radix to interpret `value` by.
  22612. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22613. * @returns {number} Returns the converted integer.
  22614. * @example
  22615. *
  22616. * _.parseInt('08');
  22617. * // => 8
  22618. *
  22619. * _.map(['6', '08', '10'], _.parseInt);
  22620. * // => [6, 8, 10]
  22621. */
  22622. function parseInt(string, radix, guard) {
  22623. if (guard || radix == null) {
  22624. radix = 0;
  22625. } else if (radix) {
  22626. radix = +radix;
  22627. }
  22628. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  22629. }
  22630. /**
  22631. * Repeats the given string `n` times.
  22632. *
  22633. * @static
  22634. * @memberOf _
  22635. * @since 3.0.0
  22636. * @category String
  22637. * @param {string} [string=''] The string to repeat.
  22638. * @param {number} [n=1] The number of times to repeat the string.
  22639. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22640. * @returns {string} Returns the repeated string.
  22641. * @example
  22642. *
  22643. * _.repeat('*', 3);
  22644. * // => '***'
  22645. *
  22646. * _.repeat('abc', 2);
  22647. * // => 'abcabc'
  22648. *
  22649. * _.repeat('abc', 0);
  22650. * // => ''
  22651. */
  22652. function repeat(string, n, guard) {
  22653. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  22654. n = 1;
  22655. } else {
  22656. n = toInteger(n);
  22657. }
  22658. return baseRepeat(toString(string), n);
  22659. }
  22660. /**
  22661. * Replaces matches for `pattern` in `string` with `replacement`.
  22662. *
  22663. * **Note:** This method is based on
  22664. * [`String#replace`](https://mdn.io/String/replace).
  22665. *
  22666. * @static
  22667. * @memberOf _
  22668. * @since 4.0.0
  22669. * @category String
  22670. * @param {string} [string=''] The string to modify.
  22671. * @param {RegExp|string} pattern The pattern to replace.
  22672. * @param {Function|string} replacement The match replacement.
  22673. * @returns {string} Returns the modified string.
  22674. * @example
  22675. *
  22676. * _.replace('Hi Fred', 'Fred', 'Barney');
  22677. * // => 'Hi Barney'
  22678. */
  22679. function replace() {
  22680. var args = arguments,
  22681. string = toString(args[0]);
  22682. return args.length < 3 ? string : string.replace(args[1], args[2]);
  22683. }
  22684. /**
  22685. * Converts `string` to
  22686. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  22687. *
  22688. * @static
  22689. * @memberOf _
  22690. * @since 3.0.0
  22691. * @category String
  22692. * @param {string} [string=''] The string to convert.
  22693. * @returns {string} Returns the snake cased string.
  22694. * @example
  22695. *
  22696. * _.snakeCase('Foo Bar');
  22697. * // => 'foo_bar'
  22698. *
  22699. * _.snakeCase('fooBar');
  22700. * // => 'foo_bar'
  22701. *
  22702. * _.snakeCase('--FOO-BAR--');
  22703. * // => 'foo_bar'
  22704. */
  22705. var snakeCase = createCompounder(function(result, word, index) {
  22706. return result + (index ? '_' : '') + word.toLowerCase();
  22707. });
  22708. /**
  22709. * Splits `string` by `separator`.
  22710. *
  22711. * **Note:** This method is based on
  22712. * [`String#split`](https://mdn.io/String/split).
  22713. *
  22714. * @static
  22715. * @memberOf _
  22716. * @since 4.0.0
  22717. * @category String
  22718. * @param {string} [string=''] The string to split.
  22719. * @param {RegExp|string} separator The separator pattern to split by.
  22720. * @param {number} [limit] The length to truncate results to.
  22721. * @returns {Array} Returns the string segments.
  22722. * @example
  22723. *
  22724. * _.split('a-b-c', '-', 2);
  22725. * // => ['a', 'b']
  22726. */
  22727. function split(string, separator, limit) {
  22728. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  22729. separator = limit = undefined;
  22730. }
  22731. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  22732. if (!limit) {
  22733. return [];
  22734. }
  22735. string = toString(string);
  22736. if (string && (
  22737. typeof separator == 'string' ||
  22738. (separator != null && !isRegExp(separator))
  22739. )) {
  22740. separator = baseToString(separator);
  22741. if (!separator && hasUnicode(string)) {
  22742. return castSlice(stringToArray(string), 0, limit);
  22743. }
  22744. }
  22745. return string.split(separator, limit);
  22746. }
  22747. /**
  22748. * Converts `string` to
  22749. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  22750. *
  22751. * @static
  22752. * @memberOf _
  22753. * @since 3.1.0
  22754. * @category String
  22755. * @param {string} [string=''] The string to convert.
  22756. * @returns {string} Returns the start cased string.
  22757. * @example
  22758. *
  22759. * _.startCase('--foo-bar--');
  22760. * // => 'Foo Bar'
  22761. *
  22762. * _.startCase('fooBar');
  22763. * // => 'Foo Bar'
  22764. *
  22765. * _.startCase('__FOO_BAR__');
  22766. * // => 'FOO BAR'
  22767. */
  22768. var startCase = createCompounder(function(result, word, index) {
  22769. return result + (index ? ' ' : '') + upperFirst(word);
  22770. });
  22771. /**
  22772. * Checks if `string` starts with the given target string.
  22773. *
  22774. * @static
  22775. * @memberOf _
  22776. * @since 3.0.0
  22777. * @category String
  22778. * @param {string} [string=''] The string to inspect.
  22779. * @param {string} [target] The string to search for.
  22780. * @param {number} [position=0] The position to search from.
  22781. * @returns {boolean} Returns `true` if `string` starts with `target`,
  22782. * else `false`.
  22783. * @example
  22784. *
  22785. * _.startsWith('abc', 'a');
  22786. * // => true
  22787. *
  22788. * _.startsWith('abc', 'b');
  22789. * // => false
  22790. *
  22791. * _.startsWith('abc', 'b', 1);
  22792. * // => true
  22793. */
  22794. function startsWith(string, target, position) {
  22795. string = toString(string);
  22796. position = position == null
  22797. ? 0
  22798. : baseClamp(toInteger(position), 0, string.length);
  22799. target = baseToString(target);
  22800. return string.slice(position, position + target.length) == target;
  22801. }
  22802. /**
  22803. * Creates a compiled template function that can interpolate data properties
  22804. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  22805. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  22806. * properties may be accessed as free variables in the template. If a setting
  22807. * object is given, it takes precedence over `_.templateSettings` values.
  22808. *
  22809. * **Note:** In the development build `_.template` utilizes
  22810. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  22811. * for easier debugging.
  22812. *
  22813. * For more information on precompiling templates see
  22814. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  22815. *
  22816. * For more information on Chrome extension sandboxes see
  22817. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  22818. *
  22819. * @static
  22820. * @since 0.1.0
  22821. * @memberOf _
  22822. * @category String
  22823. * @param {string} [string=''] The template string.
  22824. * @param {Object} [options={}] The options object.
  22825. * @param {RegExp} [options.escape=_.templateSettings.escape]
  22826. * The HTML "escape" delimiter.
  22827. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  22828. * The "evaluate" delimiter.
  22829. * @param {Object} [options.imports=_.templateSettings.imports]
  22830. * An object to import into the template as free variables.
  22831. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  22832. * The "interpolate" delimiter.
  22833. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  22834. * The sourceURL of the compiled template.
  22835. * @param {string} [options.variable='obj']
  22836. * The data object variable name.
  22837. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22838. * @returns {Function} Returns the compiled template function.
  22839. * @example
  22840. *
  22841. * // Use the "interpolate" delimiter to create a compiled template.
  22842. * var compiled = _.template('hello <%= user %>!');
  22843. * compiled({ 'user': 'fred' });
  22844. * // => 'hello fred!'
  22845. *
  22846. * // Use the HTML "escape" delimiter to escape data property values.
  22847. * var compiled = _.template('<b><%- value %></b>');
  22848. * compiled({ 'value': '<script>' });
  22849. * // => '<b>&lt;script&gt;</b>'
  22850. *
  22851. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  22852. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  22853. * compiled({ 'users': ['fred', 'barney'] });
  22854. * // => '<li>fred</li><li>barney</li>'
  22855. *
  22856. * // Use the internal `print` function in "evaluate" delimiters.
  22857. * var compiled = _.template('<% print("hello " + user); %>!');
  22858. * compiled({ 'user': 'barney' });
  22859. * // => 'hello barney!'
  22860. *
  22861. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  22862. * // Disable support by replacing the "interpolate" delimiter.
  22863. * var compiled = _.template('hello ${ user }!');
  22864. * compiled({ 'user': 'pebbles' });
  22865. * // => 'hello pebbles!'
  22866. *
  22867. * // Use backslashes to treat delimiters as plain text.
  22868. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  22869. * compiled({ 'value': 'ignored' });
  22870. * // => '<%- value %>'
  22871. *
  22872. * // Use the `imports` option to import `jQuery` as `jq`.
  22873. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  22874. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  22875. * compiled({ 'users': ['fred', 'barney'] });
  22876. * // => '<li>fred</li><li>barney</li>'
  22877. *
  22878. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  22879. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  22880. * compiled(data);
  22881. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  22882. *
  22883. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  22884. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  22885. * compiled.source;
  22886. * // => function(data) {
  22887. * // var __t, __p = '';
  22888. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  22889. * // return __p;
  22890. * // }
  22891. *
  22892. * // Use custom template delimiters.
  22893. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  22894. * var compiled = _.template('hello {{ user }}!');
  22895. * compiled({ 'user': 'mustache' });
  22896. * // => 'hello mustache!'
  22897. *
  22898. * // Use the `source` property to inline compiled templates for meaningful
  22899. * // line numbers in error messages and stack traces.
  22900. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  22901. * var JST = {\
  22902. * "main": ' + _.template(mainText).source + '\
  22903. * };\
  22904. * ');
  22905. */
  22906. function template(string, options, guard) {
  22907. // Based on John Resig's `tmpl` implementation
  22908. // (http://ejohn.org/blog/javascript-micro-templating/)
  22909. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  22910. var settings = lodash.templateSettings;
  22911. if (guard && isIterateeCall(string, options, guard)) {
  22912. options = undefined;
  22913. }
  22914. string = toString(string);
  22915. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  22916. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  22917. importsKeys = keys(imports),
  22918. importsValues = baseValues(imports, importsKeys);
  22919. var isEscaping,
  22920. isEvaluating,
  22921. index = 0,
  22922. interpolate = options.interpolate || reNoMatch,
  22923. source = "__p += '";
  22924. // Compile the regexp to match each delimiter.
  22925. var reDelimiters = RegExp(
  22926. (options.escape || reNoMatch).source + '|' +
  22927. interpolate.source + '|' +
  22928. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  22929. (options.evaluate || reNoMatch).source + '|$'
  22930. , 'g');
  22931. // Use a sourceURL for easier debugging.
  22932. var sourceURL = '//# sourceURL=' +
  22933. ('sourceURL' in options
  22934. ? options.sourceURL
  22935. : ('lodash.templateSources[' + (++templateCounter) + ']')
  22936. ) + '\n';
  22937. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  22938. interpolateValue || (interpolateValue = esTemplateValue);
  22939. // Escape characters that can't be included in string literals.
  22940. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  22941. // Replace delimiters with snippets.
  22942. if (escapeValue) {
  22943. isEscaping = true;
  22944. source += "' +\n__e(" + escapeValue + ") +\n'";
  22945. }
  22946. if (evaluateValue) {
  22947. isEvaluating = true;
  22948. source += "';\n" + evaluateValue + ";\n__p += '";
  22949. }
  22950. if (interpolateValue) {
  22951. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  22952. }
  22953. index = offset + match.length;
  22954. // The JS engine embedded in Adobe products needs `match` returned in
  22955. // order to produce the correct `offset` value.
  22956. return match;
  22957. });
  22958. source += "';\n";
  22959. // If `variable` is not specified wrap a with-statement around the generated
  22960. // code to add the data object to the top of the scope chain.
  22961. var variable = options.variable;
  22962. if (!variable) {
  22963. source = 'with (obj) {\n' + source + '\n}\n';
  22964. }
  22965. // Cleanup code by stripping empty strings.
  22966. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  22967. .replace(reEmptyStringMiddle, '$1')
  22968. .replace(reEmptyStringTrailing, '$1;');
  22969. // Frame code as the function body.
  22970. source = 'function(' + (variable || 'obj') + ') {\n' +
  22971. (variable
  22972. ? ''
  22973. : 'obj || (obj = {});\n'
  22974. ) +
  22975. "var __t, __p = ''" +
  22976. (isEscaping
  22977. ? ', __e = _.escape'
  22978. : ''
  22979. ) +
  22980. (isEvaluating
  22981. ? ', __j = Array.prototype.join;\n' +
  22982. "function print() { __p += __j.call(arguments, '') }\n"
  22983. : ';\n'
  22984. ) +
  22985. source +
  22986. 'return __p\n}';
  22987. var result = attempt(function() {
  22988. return Function(importsKeys, sourceURL + 'return ' + source)
  22989. .apply(undefined, importsValues);
  22990. });
  22991. // Provide the compiled function's source by its `toString` method or
  22992. // the `source` property as a convenience for inlining compiled templates.
  22993. result.source = source;
  22994. if (isError(result)) {
  22995. throw result;
  22996. }
  22997. return result;
  22998. }
  22999. /**
  23000. * Converts `string`, as a whole, to lower case just like
  23001. * [String#toLowerCase](https://mdn.io/toLowerCase).
  23002. *
  23003. * @static
  23004. * @memberOf _
  23005. * @since 4.0.0
  23006. * @category String
  23007. * @param {string} [string=''] The string to convert.
  23008. * @returns {string} Returns the lower cased string.
  23009. * @example
  23010. *
  23011. * _.toLower('--Foo-Bar--');
  23012. * // => '--foo-bar--'
  23013. *
  23014. * _.toLower('fooBar');
  23015. * // => 'foobar'
  23016. *
  23017. * _.toLower('__FOO_BAR__');
  23018. * // => '__foo_bar__'
  23019. */
  23020. function toLower(value) {
  23021. return toString(value).toLowerCase();
  23022. }
  23023. /**
  23024. * Converts `string`, as a whole, to upper case just like
  23025. * [String#toUpperCase](https://mdn.io/toUpperCase).
  23026. *
  23027. * @static
  23028. * @memberOf _
  23029. * @since 4.0.0
  23030. * @category String
  23031. * @param {string} [string=''] The string to convert.
  23032. * @returns {string} Returns the upper cased string.
  23033. * @example
  23034. *
  23035. * _.toUpper('--foo-bar--');
  23036. * // => '--FOO-BAR--'
  23037. *
  23038. * _.toUpper('fooBar');
  23039. * // => 'FOOBAR'
  23040. *
  23041. * _.toUpper('__foo_bar__');
  23042. * // => '__FOO_BAR__'
  23043. */
  23044. function toUpper(value) {
  23045. return toString(value).toUpperCase();
  23046. }
  23047. /**
  23048. * Removes leading and trailing whitespace or specified characters from `string`.
  23049. *
  23050. * @static
  23051. * @memberOf _
  23052. * @since 3.0.0
  23053. * @category String
  23054. * @param {string} [string=''] The string to trim.
  23055. * @param {string} [chars=whitespace] The characters to trim.
  23056. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23057. * @returns {string} Returns the trimmed string.
  23058. * @example
  23059. *
  23060. * _.trim(' abc ');
  23061. * // => 'abc'
  23062. *
  23063. * _.trim('-_-abc-_-', '_-');
  23064. * // => 'abc'
  23065. *
  23066. * _.map([' foo ', ' bar '], _.trim);
  23067. * // => ['foo', 'bar']
  23068. */
  23069. function trim(string, chars, guard) {
  23070. string = toString(string);
  23071. if (string && (guard || chars === undefined)) {
  23072. return string.replace(reTrim, '');
  23073. }
  23074. if (!string || !(chars = baseToString(chars))) {
  23075. return string;
  23076. }
  23077. var strSymbols = stringToArray(string),
  23078. chrSymbols = stringToArray(chars),
  23079. start = charsStartIndex(strSymbols, chrSymbols),
  23080. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  23081. return castSlice(strSymbols, start, end).join('');
  23082. }
  23083. /**
  23084. * Removes trailing whitespace or specified characters from `string`.
  23085. *
  23086. * @static
  23087. * @memberOf _
  23088. * @since 4.0.0
  23089. * @category String
  23090. * @param {string} [string=''] The string to trim.
  23091. * @param {string} [chars=whitespace] The characters to trim.
  23092. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23093. * @returns {string} Returns the trimmed string.
  23094. * @example
  23095. *
  23096. * _.trimEnd(' abc ');
  23097. * // => ' abc'
  23098. *
  23099. * _.trimEnd('-_-abc-_-', '_-');
  23100. * // => '-_-abc'
  23101. */
  23102. function trimEnd(string, chars, guard) {
  23103. string = toString(string);
  23104. if (string && (guard || chars === undefined)) {
  23105. return string.replace(reTrimEnd, '');
  23106. }
  23107. if (!string || !(chars = baseToString(chars))) {
  23108. return string;
  23109. }
  23110. var strSymbols = stringToArray(string),
  23111. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  23112. return castSlice(strSymbols, 0, end).join('');
  23113. }
  23114. /**
  23115. * Removes leading whitespace or specified characters from `string`.
  23116. *
  23117. * @static
  23118. * @memberOf _
  23119. * @since 4.0.0
  23120. * @category String
  23121. * @param {string} [string=''] The string to trim.
  23122. * @param {string} [chars=whitespace] The characters to trim.
  23123. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23124. * @returns {string} Returns the trimmed string.
  23125. * @example
  23126. *
  23127. * _.trimStart(' abc ');
  23128. * // => 'abc '
  23129. *
  23130. * _.trimStart('-_-abc-_-', '_-');
  23131. * // => 'abc-_-'
  23132. */
  23133. function trimStart(string, chars, guard) {
  23134. string = toString(string);
  23135. if (string && (guard || chars === undefined)) {
  23136. return string.replace(reTrimStart, '');
  23137. }
  23138. if (!string || !(chars = baseToString(chars))) {
  23139. return string;
  23140. }
  23141. var strSymbols = stringToArray(string),
  23142. start = charsStartIndex(strSymbols, stringToArray(chars));
  23143. return castSlice(strSymbols, start).join('');
  23144. }
  23145. /**
  23146. * Truncates `string` if it's longer than the given maximum string length.
  23147. * The last characters of the truncated string are replaced with the omission
  23148. * string which defaults to "...".
  23149. *
  23150. * @static
  23151. * @memberOf _
  23152. * @since 4.0.0
  23153. * @category String
  23154. * @param {string} [string=''] The string to truncate.
  23155. * @param {Object} [options={}] The options object.
  23156. * @param {number} [options.length=30] The maximum string length.
  23157. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  23158. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  23159. * @returns {string} Returns the truncated string.
  23160. * @example
  23161. *
  23162. * _.truncate('hi-diddly-ho there, neighborino');
  23163. * // => 'hi-diddly-ho there, neighbo...'
  23164. *
  23165. * _.truncate('hi-diddly-ho there, neighborino', {
  23166. * 'length': 24,
  23167. * 'separator': ' '
  23168. * });
  23169. * // => 'hi-diddly-ho there,...'
  23170. *
  23171. * _.truncate('hi-diddly-ho there, neighborino', {
  23172. * 'length': 24,
  23173. * 'separator': /,? +/
  23174. * });
  23175. * // => 'hi-diddly-ho there...'
  23176. *
  23177. * _.truncate('hi-diddly-ho there, neighborino', {
  23178. * 'omission': ' [...]'
  23179. * });
  23180. * // => 'hi-diddly-ho there, neig [...]'
  23181. */
  23182. function truncate(string, options) {
  23183. var length = DEFAULT_TRUNC_LENGTH,
  23184. omission = DEFAULT_TRUNC_OMISSION;
  23185. if (isObject(options)) {
  23186. var separator = 'separator' in options ? options.separator : separator;
  23187. length = 'length' in options ? toInteger(options.length) : length;
  23188. omission = 'omission' in options ? baseToString(options.omission) : omission;
  23189. }
  23190. string = toString(string);
  23191. var strLength = string.length;
  23192. if (hasUnicode(string)) {
  23193. var strSymbols = stringToArray(string);
  23194. strLength = strSymbols.length;
  23195. }
  23196. if (length >= strLength) {
  23197. return string;
  23198. }
  23199. var end = length - stringSize(omission);
  23200. if (end < 1) {
  23201. return omission;
  23202. }
  23203. var result = strSymbols
  23204. ? castSlice(strSymbols, 0, end).join('')
  23205. : string.slice(0, end);
  23206. if (separator === undefined) {
  23207. return result + omission;
  23208. }
  23209. if (strSymbols) {
  23210. end += (result.length - end);
  23211. }
  23212. if (isRegExp(separator)) {
  23213. if (string.slice(end).search(separator)) {
  23214. var match,
  23215. substring = result;
  23216. if (!separator.global) {
  23217. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  23218. }
  23219. separator.lastIndex = 0;
  23220. while ((match = separator.exec(substring))) {
  23221. var newEnd = match.index;
  23222. }
  23223. result = result.slice(0, newEnd === undefined ? end : newEnd);
  23224. }
  23225. } else if (string.indexOf(baseToString(separator), end) != end) {
  23226. var index = result.lastIndexOf(separator);
  23227. if (index > -1) {
  23228. result = result.slice(0, index);
  23229. }
  23230. }
  23231. return result + omission;
  23232. }
  23233. /**
  23234. * The inverse of `_.escape`; this method converts the HTML entities
  23235. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  23236. * their corresponding characters.
  23237. *
  23238. * **Note:** No other HTML entities are unescaped. To unescape additional
  23239. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  23240. *
  23241. * @static
  23242. * @memberOf _
  23243. * @since 0.6.0
  23244. * @category String
  23245. * @param {string} [string=''] The string to unescape.
  23246. * @returns {string} Returns the unescaped string.
  23247. * @example
  23248. *
  23249. * _.unescape('fred, barney, &amp; pebbles');
  23250. * // => 'fred, barney, & pebbles'
  23251. */
  23252. function unescape(string) {
  23253. string = toString(string);
  23254. return (string && reHasEscapedHtml.test(string))
  23255. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  23256. : string;
  23257. }
  23258. /**
  23259. * Converts `string`, as space separated words, to upper case.
  23260. *
  23261. * @static
  23262. * @memberOf _
  23263. * @since 4.0.0
  23264. * @category String
  23265. * @param {string} [string=''] The string to convert.
  23266. * @returns {string} Returns the upper cased string.
  23267. * @example
  23268. *
  23269. * _.upperCase('--foo-bar');
  23270. * // => 'FOO BAR'
  23271. *
  23272. * _.upperCase('fooBar');
  23273. * // => 'FOO BAR'
  23274. *
  23275. * _.upperCase('__foo_bar__');
  23276. * // => 'FOO BAR'
  23277. */
  23278. var upperCase = createCompounder(function(result, word, index) {
  23279. return result + (index ? ' ' : '') + word.toUpperCase();
  23280. });
  23281. /**
  23282. * Converts the first character of `string` to upper case.
  23283. *
  23284. * @static
  23285. * @memberOf _
  23286. * @since 4.0.0
  23287. * @category String
  23288. * @param {string} [string=''] The string to convert.
  23289. * @returns {string} Returns the converted string.
  23290. * @example
  23291. *
  23292. * _.upperFirst('fred');
  23293. * // => 'Fred'
  23294. *
  23295. * _.upperFirst('FRED');
  23296. * // => 'FRED'
  23297. */
  23298. var upperFirst = createCaseFirst('toUpperCase');
  23299. /**
  23300. * Splits `string` into an array of its words.
  23301. *
  23302. * @static
  23303. * @memberOf _
  23304. * @since 3.0.0
  23305. * @category String
  23306. * @param {string} [string=''] The string to inspect.
  23307. * @param {RegExp|string} [pattern] The pattern to match words.
  23308. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23309. * @returns {Array} Returns the words of `string`.
  23310. * @example
  23311. *
  23312. * _.words('fred, barney, & pebbles');
  23313. * // => ['fred', 'barney', 'pebbles']
  23314. *
  23315. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  23316. * // => ['fred', 'barney', '&', 'pebbles']
  23317. */
  23318. function words(string, pattern, guard) {
  23319. string = toString(string);
  23320. pattern = guard ? undefined : pattern;
  23321. if (pattern === undefined) {
  23322. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  23323. }
  23324. return string.match(pattern) || [];
  23325. }
  23326. /*------------------------------------------------------------------------*/
  23327. /**
  23328. * Attempts to invoke `func`, returning either the result or the caught error
  23329. * object. Any additional arguments are provided to `func` when it's invoked.
  23330. *
  23331. * @static
  23332. * @memberOf _
  23333. * @since 3.0.0
  23334. * @category Util
  23335. * @param {Function} func The function to attempt.
  23336. * @param {...*} [args] The arguments to invoke `func` with.
  23337. * @returns {*} Returns the `func` result or error object.
  23338. * @example
  23339. *
  23340. * // Avoid throwing errors for invalid selectors.
  23341. * var elements = _.attempt(function(selector) {
  23342. * return document.querySelectorAll(selector);
  23343. * }, '>_>');
  23344. *
  23345. * if (_.isError(elements)) {
  23346. * elements = [];
  23347. * }
  23348. */
  23349. var attempt = baseRest(function(func, args) {
  23350. try {
  23351. return apply(func, undefined, args);
  23352. } catch (e) {
  23353. return isError(e) ? e : new Error(e);
  23354. }
  23355. });
  23356. /**
  23357. * Binds methods of an object to the object itself, overwriting the existing
  23358. * method.
  23359. *
  23360. * **Note:** This method doesn't set the "length" property of bound functions.
  23361. *
  23362. * @static
  23363. * @since 0.1.0
  23364. * @memberOf _
  23365. * @category Util
  23366. * @param {Object} object The object to bind and assign the bound methods to.
  23367. * @param {...(string|string[])} methodNames The object method names to bind.
  23368. * @returns {Object} Returns `object`.
  23369. * @example
  23370. *
  23371. * var view = {
  23372. * 'label': 'docs',
  23373. * 'click': function() {
  23374. * console.log('clicked ' + this.label);
  23375. * }
  23376. * };
  23377. *
  23378. * _.bindAll(view, ['click']);
  23379. * jQuery(element).on('click', view.click);
  23380. * // => Logs 'clicked docs' when clicked.
  23381. */
  23382. var bindAll = flatRest(function(object, methodNames) {
  23383. arrayEach(methodNames, function(key) {
  23384. key = toKey(key);
  23385. baseAssignValue(object, key, bind(object[key], object));
  23386. });
  23387. return object;
  23388. });
  23389. /**
  23390. * Creates a function that iterates over `pairs` and invokes the corresponding
  23391. * function of the first predicate to return truthy. The predicate-function
  23392. * pairs are invoked with the `this` binding and arguments of the created
  23393. * function.
  23394. *
  23395. * @static
  23396. * @memberOf _
  23397. * @since 4.0.0
  23398. * @category Util
  23399. * @param {Array} pairs The predicate-function pairs.
  23400. * @returns {Function} Returns the new composite function.
  23401. * @example
  23402. *
  23403. * var func = _.cond([
  23404. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  23405. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  23406. * [_.stubTrue, _.constant('no match')]
  23407. * ]);
  23408. *
  23409. * func({ 'a': 1, 'b': 2 });
  23410. * // => 'matches A'
  23411. *
  23412. * func({ 'a': 0, 'b': 1 });
  23413. * // => 'matches B'
  23414. *
  23415. * func({ 'a': '1', 'b': '2' });
  23416. * // => 'no match'
  23417. */
  23418. function cond(pairs) {
  23419. var length = pairs == null ? 0 : pairs.length,
  23420. toIteratee = getIteratee();
  23421. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  23422. if (typeof pair[1] != 'function') {
  23423. throw new TypeError(FUNC_ERROR_TEXT);
  23424. }
  23425. return [toIteratee(pair[0]), pair[1]];
  23426. });
  23427. return baseRest(function(args) {
  23428. var index = -1;
  23429. while (++index < length) {
  23430. var pair = pairs[index];
  23431. if (apply(pair[0], this, args)) {
  23432. return apply(pair[1], this, args);
  23433. }
  23434. }
  23435. });
  23436. }
  23437. /**
  23438. * Creates a function that invokes the predicate properties of `source` with
  23439. * the corresponding property values of a given object, returning `true` if
  23440. * all predicates return truthy, else `false`.
  23441. *
  23442. * **Note:** The created function is equivalent to `_.conformsTo` with
  23443. * `source` partially applied.
  23444. *
  23445. * @static
  23446. * @memberOf _
  23447. * @since 4.0.0
  23448. * @category Util
  23449. * @param {Object} source The object of property predicates to conform to.
  23450. * @returns {Function} Returns the new spec function.
  23451. * @example
  23452. *
  23453. * var objects = [
  23454. * { 'a': 2, 'b': 1 },
  23455. * { 'a': 1, 'b': 2 }
  23456. * ];
  23457. *
  23458. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  23459. * // => [{ 'a': 1, 'b': 2 }]
  23460. */
  23461. function conforms(source) {
  23462. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  23463. }
  23464. /**
  23465. * Creates a function that returns `value`.
  23466. *
  23467. * @static
  23468. * @memberOf _
  23469. * @since 2.4.0
  23470. * @category Util
  23471. * @param {*} value The value to return from the new function.
  23472. * @returns {Function} Returns the new constant function.
  23473. * @example
  23474. *
  23475. * var objects = _.times(2, _.constant({ 'a': 1 }));
  23476. *
  23477. * console.log(objects);
  23478. * // => [{ 'a': 1 }, { 'a': 1 }]
  23479. *
  23480. * console.log(objects[0] === objects[1]);
  23481. * // => true
  23482. */
  23483. function constant(value) {
  23484. return function() {
  23485. return value;
  23486. };
  23487. }
  23488. /**
  23489. * Checks `value` to determine whether a default value should be returned in
  23490. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  23491. * or `undefined`.
  23492. *
  23493. * @static
  23494. * @memberOf _
  23495. * @since 4.14.0
  23496. * @category Util
  23497. * @param {*} value The value to check.
  23498. * @param {*} defaultValue The default value.
  23499. * @returns {*} Returns the resolved value.
  23500. * @example
  23501. *
  23502. * _.defaultTo(1, 10);
  23503. * // => 1
  23504. *
  23505. * _.defaultTo(undefined, 10);
  23506. * // => 10
  23507. */
  23508. function defaultTo(value, defaultValue) {
  23509. return (value == null || value !== value) ? defaultValue : value;
  23510. }
  23511. /**
  23512. * Creates a function that returns the result of invoking the given functions
  23513. * with the `this` binding of the created function, where each successive
  23514. * invocation is supplied the return value of the previous.
  23515. *
  23516. * @static
  23517. * @memberOf _
  23518. * @since 3.0.0
  23519. * @category Util
  23520. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  23521. * @returns {Function} Returns the new composite function.
  23522. * @see _.flowRight
  23523. * @example
  23524. *
  23525. * function square(n) {
  23526. * return n * n;
  23527. * }
  23528. *
  23529. * var addSquare = _.flow([_.add, square]);
  23530. * addSquare(1, 2);
  23531. * // => 9
  23532. */
  23533. var flow = createFlow();
  23534. /**
  23535. * This method is like `_.flow` except that it creates a function that
  23536. * invokes the given functions from right to left.
  23537. *
  23538. * @static
  23539. * @since 3.0.0
  23540. * @memberOf _
  23541. * @category Util
  23542. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  23543. * @returns {Function} Returns the new composite function.
  23544. * @see _.flow
  23545. * @example
  23546. *
  23547. * function square(n) {
  23548. * return n * n;
  23549. * }
  23550. *
  23551. * var addSquare = _.flowRight([square, _.add]);
  23552. * addSquare(1, 2);
  23553. * // => 9
  23554. */
  23555. var flowRight = createFlow(true);
  23556. /**
  23557. * This method returns the first argument it receives.
  23558. *
  23559. * @static
  23560. * @since 0.1.0
  23561. * @memberOf _
  23562. * @category Util
  23563. * @param {*} value Any value.
  23564. * @returns {*} Returns `value`.
  23565. * @example
  23566. *
  23567. * var object = { 'a': 1 };
  23568. *
  23569. * console.log(_.identity(object) === object);
  23570. * // => true
  23571. */
  23572. function identity(value) {
  23573. return value;
  23574. }
  23575. /**
  23576. * Creates a function that invokes `func` with the arguments of the created
  23577. * function. If `func` is a property name, the created function returns the
  23578. * property value for a given element. If `func` is an array or object, the
  23579. * created function returns `true` for elements that contain the equivalent
  23580. * source properties, otherwise it returns `false`.
  23581. *
  23582. * @static
  23583. * @since 4.0.0
  23584. * @memberOf _
  23585. * @category Util
  23586. * @param {*} [func=_.identity] The value to convert to a callback.
  23587. * @returns {Function} Returns the callback.
  23588. * @example
  23589. *
  23590. * var users = [
  23591. * { 'user': 'barney', 'age': 36, 'active': true },
  23592. * { 'user': 'fred', 'age': 40, 'active': false }
  23593. * ];
  23594. *
  23595. * // The `_.matches` iteratee shorthand.
  23596. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  23597. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  23598. *
  23599. * // The `_.matchesProperty` iteratee shorthand.
  23600. * _.filter(users, _.iteratee(['user', 'fred']));
  23601. * // => [{ 'user': 'fred', 'age': 40 }]
  23602. *
  23603. * // The `_.property` iteratee shorthand.
  23604. * _.map(users, _.iteratee('user'));
  23605. * // => ['barney', 'fred']
  23606. *
  23607. * // Create custom iteratee shorthands.
  23608. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  23609. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  23610. * return func.test(string);
  23611. * };
  23612. * });
  23613. *
  23614. * _.filter(['abc', 'def'], /ef/);
  23615. * // => ['def']
  23616. */
  23617. function iteratee(func) {
  23618. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  23619. }
  23620. /**
  23621. * Creates a function that performs a partial deep comparison between a given
  23622. * object and `source`, returning `true` if the given object has equivalent
  23623. * property values, else `false`.
  23624. *
  23625. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  23626. * partially applied.
  23627. *
  23628. * Partial comparisons will match empty array and empty object `source`
  23629. * values against any array or object value, respectively. See `_.isEqual`
  23630. * for a list of supported value comparisons.
  23631. *
  23632. * @static
  23633. * @memberOf _
  23634. * @since 3.0.0
  23635. * @category Util
  23636. * @param {Object} source The object of property values to match.
  23637. * @returns {Function} Returns the new spec function.
  23638. * @example
  23639. *
  23640. * var objects = [
  23641. * { 'a': 1, 'b': 2, 'c': 3 },
  23642. * { 'a': 4, 'b': 5, 'c': 6 }
  23643. * ];
  23644. *
  23645. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  23646. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  23647. */
  23648. function matches(source) {
  23649. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  23650. }
  23651. /**
  23652. * Creates a function that performs a partial deep comparison between the
  23653. * value at `path` of a given object to `srcValue`, returning `true` if the
  23654. * object value is equivalent, else `false`.
  23655. *
  23656. * **Note:** Partial comparisons will match empty array and empty object
  23657. * `srcValue` values against any array or object value, respectively. See
  23658. * `_.isEqual` for a list of supported value comparisons.
  23659. *
  23660. * @static
  23661. * @memberOf _
  23662. * @since 3.2.0
  23663. * @category Util
  23664. * @param {Array|string} path The path of the property to get.
  23665. * @param {*} srcValue The value to match.
  23666. * @returns {Function} Returns the new spec function.
  23667. * @example
  23668. *
  23669. * var objects = [
  23670. * { 'a': 1, 'b': 2, 'c': 3 },
  23671. * { 'a': 4, 'b': 5, 'c': 6 }
  23672. * ];
  23673. *
  23674. * _.find(objects, _.matchesProperty('a', 4));
  23675. * // => { 'a': 4, 'b': 5, 'c': 6 }
  23676. */
  23677. function matchesProperty(path, srcValue) {
  23678. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  23679. }
  23680. /**
  23681. * Creates a function that invokes the method at `path` of a given object.
  23682. * Any additional arguments are provided to the invoked method.
  23683. *
  23684. * @static
  23685. * @memberOf _
  23686. * @since 3.7.0
  23687. * @category Util
  23688. * @param {Array|string} path The path of the method to invoke.
  23689. * @param {...*} [args] The arguments to invoke the method with.
  23690. * @returns {Function} Returns the new invoker function.
  23691. * @example
  23692. *
  23693. * var objects = [
  23694. * { 'a': { 'b': _.constant(2) } },
  23695. * { 'a': { 'b': _.constant(1) } }
  23696. * ];
  23697. *
  23698. * _.map(objects, _.method('a.b'));
  23699. * // => [2, 1]
  23700. *
  23701. * _.map(objects, _.method(['a', 'b']));
  23702. * // => [2, 1]
  23703. */
  23704. var method = baseRest(function(path, args) {
  23705. return function(object) {
  23706. return baseInvoke(object, path, args);
  23707. };
  23708. });
  23709. /**
  23710. * The opposite of `_.method`; this method creates a function that invokes
  23711. * the method at a given path of `object`. Any additional arguments are
  23712. * provided to the invoked method.
  23713. *
  23714. * @static
  23715. * @memberOf _
  23716. * @since 3.7.0
  23717. * @category Util
  23718. * @param {Object} object The object to query.
  23719. * @param {...*} [args] The arguments to invoke the method with.
  23720. * @returns {Function} Returns the new invoker function.
  23721. * @example
  23722. *
  23723. * var array = _.times(3, _.constant),
  23724. * object = { 'a': array, 'b': array, 'c': array };
  23725. *
  23726. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  23727. * // => [2, 0]
  23728. *
  23729. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  23730. * // => [2, 0]
  23731. */
  23732. var methodOf = baseRest(function(object, args) {
  23733. return function(path) {
  23734. return baseInvoke(object, path, args);
  23735. };
  23736. });
  23737. /**
  23738. * Adds all own enumerable string keyed function properties of a source
  23739. * object to the destination object. If `object` is a function, then methods
  23740. * are added to its prototype as well.
  23741. *
  23742. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  23743. * avoid conflicts caused by modifying the original.
  23744. *
  23745. * @static
  23746. * @since 0.1.0
  23747. * @memberOf _
  23748. * @category Util
  23749. * @param {Function|Object} [object=lodash] The destination object.
  23750. * @param {Object} source The object of functions to add.
  23751. * @param {Object} [options={}] The options object.
  23752. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  23753. * @returns {Function|Object} Returns `object`.
  23754. * @example
  23755. *
  23756. * function vowels(string) {
  23757. * return _.filter(string, function(v) {
  23758. * return /[aeiou]/i.test(v);
  23759. * });
  23760. * }
  23761. *
  23762. * _.mixin({ 'vowels': vowels });
  23763. * _.vowels('fred');
  23764. * // => ['e']
  23765. *
  23766. * _('fred').vowels().value();
  23767. * // => ['e']
  23768. *
  23769. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  23770. * _('fred').vowels();
  23771. * // => ['e']
  23772. */
  23773. function mixin(object, source, options) {
  23774. var props = keys(source),
  23775. methodNames = baseFunctions(source, props);
  23776. if (options == null &&
  23777. !(isObject(source) && (methodNames.length || !props.length))) {
  23778. options = source;
  23779. source = object;
  23780. object = this;
  23781. methodNames = baseFunctions(source, keys(source));
  23782. }
  23783. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  23784. isFunc = isFunction(object);
  23785. arrayEach(methodNames, function(methodName) {
  23786. var func = source[methodName];
  23787. object[methodName] = func;
  23788. if (isFunc) {
  23789. object.prototype[methodName] = function() {
  23790. var chainAll = this.__chain__;
  23791. if (chain || chainAll) {
  23792. var result = object(this.__wrapped__),
  23793. actions = result.__actions__ = copyArray(this.__actions__);
  23794. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  23795. result.__chain__ = chainAll;
  23796. return result;
  23797. }
  23798. return func.apply(object, arrayPush([this.value()], arguments));
  23799. };
  23800. }
  23801. });
  23802. return object;
  23803. }
  23804. /**
  23805. * Reverts the `_` variable to its previous value and returns a reference to
  23806. * the `lodash` function.
  23807. *
  23808. * @static
  23809. * @since 0.1.0
  23810. * @memberOf _
  23811. * @category Util
  23812. * @returns {Function} Returns the `lodash` function.
  23813. * @example
  23814. *
  23815. * var lodash = _.noConflict();
  23816. */
  23817. function noConflict() {
  23818. if (root._ === this) {
  23819. root._ = oldDash;
  23820. }
  23821. return this;
  23822. }
  23823. /**
  23824. * This method returns `undefined`.
  23825. *
  23826. * @static
  23827. * @memberOf _
  23828. * @since 2.3.0
  23829. * @category Util
  23830. * @example
  23831. *
  23832. * _.times(2, _.noop);
  23833. * // => [undefined, undefined]
  23834. */
  23835. function noop() {
  23836. // No operation performed.
  23837. }
  23838. /**
  23839. * Creates a function that gets the argument at index `n`. If `n` is negative,
  23840. * the nth argument from the end is returned.
  23841. *
  23842. * @static
  23843. * @memberOf _
  23844. * @since 4.0.0
  23845. * @category Util
  23846. * @param {number} [n=0] The index of the argument to return.
  23847. * @returns {Function} Returns the new pass-thru function.
  23848. * @example
  23849. *
  23850. * var func = _.nthArg(1);
  23851. * func('a', 'b', 'c', 'd');
  23852. * // => 'b'
  23853. *
  23854. * var func = _.nthArg(-2);
  23855. * func('a', 'b', 'c', 'd');
  23856. * // => 'c'
  23857. */
  23858. function nthArg(n) {
  23859. n = toInteger(n);
  23860. return baseRest(function(args) {
  23861. return baseNth(args, n);
  23862. });
  23863. }
  23864. /**
  23865. * Creates a function that invokes `iteratees` with the arguments it receives
  23866. * and returns their results.
  23867. *
  23868. * @static
  23869. * @memberOf _
  23870. * @since 4.0.0
  23871. * @category Util
  23872. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23873. * The iteratees to invoke.
  23874. * @returns {Function} Returns the new function.
  23875. * @example
  23876. *
  23877. * var func = _.over([Math.max, Math.min]);
  23878. *
  23879. * func(1, 2, 3, 4);
  23880. * // => [4, 1]
  23881. */
  23882. var over = createOver(arrayMap);
  23883. /**
  23884. * Creates a function that checks if **all** of the `predicates` return
  23885. * truthy when invoked with the arguments it receives.
  23886. *
  23887. * @static
  23888. * @memberOf _
  23889. * @since 4.0.0
  23890. * @category Util
  23891. * @param {...(Function|Function[])} [predicates=[_.identity]]
  23892. * The predicates to check.
  23893. * @returns {Function} Returns the new function.
  23894. * @example
  23895. *
  23896. * var func = _.overEvery([Boolean, isFinite]);
  23897. *
  23898. * func('1');
  23899. * // => true
  23900. *
  23901. * func(null);
  23902. * // => false
  23903. *
  23904. * func(NaN);
  23905. * // => false
  23906. */
  23907. var overEvery = createOver(arrayEvery);
  23908. /**
  23909. * Creates a function that checks if **any** of the `predicates` return
  23910. * truthy when invoked with the arguments it receives.
  23911. *
  23912. * @static
  23913. * @memberOf _
  23914. * @since 4.0.0
  23915. * @category Util
  23916. * @param {...(Function|Function[])} [predicates=[_.identity]]
  23917. * The predicates to check.
  23918. * @returns {Function} Returns the new function.
  23919. * @example
  23920. *
  23921. * var func = _.overSome([Boolean, isFinite]);
  23922. *
  23923. * func('1');
  23924. * // => true
  23925. *
  23926. * func(null);
  23927. * // => true
  23928. *
  23929. * func(NaN);
  23930. * // => false
  23931. */
  23932. var overSome = createOver(arraySome);
  23933. /**
  23934. * Creates a function that returns the value at `path` of a given object.
  23935. *
  23936. * @static
  23937. * @memberOf _
  23938. * @since 2.4.0
  23939. * @category Util
  23940. * @param {Array|string} path The path of the property to get.
  23941. * @returns {Function} Returns the new accessor function.
  23942. * @example
  23943. *
  23944. * var objects = [
  23945. * { 'a': { 'b': 2 } },
  23946. * { 'a': { 'b': 1 } }
  23947. * ];
  23948. *
  23949. * _.map(objects, _.property('a.b'));
  23950. * // => [2, 1]
  23951. *
  23952. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  23953. * // => [1, 2]
  23954. */
  23955. function property(path) {
  23956. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  23957. }
  23958. /**
  23959. * The opposite of `_.property`; this method creates a function that returns
  23960. * the value at a given path of `object`.
  23961. *
  23962. * @static
  23963. * @memberOf _
  23964. * @since 3.0.0
  23965. * @category Util
  23966. * @param {Object} object The object to query.
  23967. * @returns {Function} Returns the new accessor function.
  23968. * @example
  23969. *
  23970. * var array = [0, 1, 2],
  23971. * object = { 'a': array, 'b': array, 'c': array };
  23972. *
  23973. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  23974. * // => [2, 0]
  23975. *
  23976. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  23977. * // => [2, 0]
  23978. */
  23979. function propertyOf(object) {
  23980. return function(path) {
  23981. return object == null ? undefined : baseGet(object, path);
  23982. };
  23983. }
  23984. /**
  23985. * Creates an array of numbers (positive and/or negative) progressing from
  23986. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  23987. * `start` is specified without an `end` or `step`. If `end` is not specified,
  23988. * it's set to `start` with `start` then set to `0`.
  23989. *
  23990. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  23991. * floating-point values which can produce unexpected results.
  23992. *
  23993. * @static
  23994. * @since 0.1.0
  23995. * @memberOf _
  23996. * @category Util
  23997. * @param {number} [start=0] The start of the range.
  23998. * @param {number} end The end of the range.
  23999. * @param {number} [step=1] The value to increment or decrement by.
  24000. * @returns {Array} Returns the range of numbers.
  24001. * @see _.inRange, _.rangeRight
  24002. * @example
  24003. *
  24004. * _.range(4);
  24005. * // => [0, 1, 2, 3]
  24006. *
  24007. * _.range(-4);
  24008. * // => [0, -1, -2, -3]
  24009. *
  24010. * _.range(1, 5);
  24011. * // => [1, 2, 3, 4]
  24012. *
  24013. * _.range(0, 20, 5);
  24014. * // => [0, 5, 10, 15]
  24015. *
  24016. * _.range(0, -4, -1);
  24017. * // => [0, -1, -2, -3]
  24018. *
  24019. * _.range(1, 4, 0);
  24020. * // => [1, 1, 1]
  24021. *
  24022. * _.range(0);
  24023. * // => []
  24024. */
  24025. var range = createRange();
  24026. /**
  24027. * This method is like `_.range` except that it populates values in
  24028. * descending order.
  24029. *
  24030. * @static
  24031. * @memberOf _
  24032. * @since 4.0.0
  24033. * @category Util
  24034. * @param {number} [start=0] The start of the range.
  24035. * @param {number} end The end of the range.
  24036. * @param {number} [step=1] The value to increment or decrement by.
  24037. * @returns {Array} Returns the range of numbers.
  24038. * @see _.inRange, _.range
  24039. * @example
  24040. *
  24041. * _.rangeRight(4);
  24042. * // => [3, 2, 1, 0]
  24043. *
  24044. * _.rangeRight(-4);
  24045. * // => [-3, -2, -1, 0]
  24046. *
  24047. * _.rangeRight(1, 5);
  24048. * // => [4, 3, 2, 1]
  24049. *
  24050. * _.rangeRight(0, 20, 5);
  24051. * // => [15, 10, 5, 0]
  24052. *
  24053. * _.rangeRight(0, -4, -1);
  24054. * // => [-3, -2, -1, 0]
  24055. *
  24056. * _.rangeRight(1, 4, 0);
  24057. * // => [1, 1, 1]
  24058. *
  24059. * _.rangeRight(0);
  24060. * // => []
  24061. */
  24062. var rangeRight = createRange(true);
  24063. /**
  24064. * This method returns a new empty array.
  24065. *
  24066. * @static
  24067. * @memberOf _
  24068. * @since 4.13.0
  24069. * @category Util
  24070. * @returns {Array} Returns the new empty array.
  24071. * @example
  24072. *
  24073. * var arrays = _.times(2, _.stubArray);
  24074. *
  24075. * console.log(arrays);
  24076. * // => [[], []]
  24077. *
  24078. * console.log(arrays[0] === arrays[1]);
  24079. * // => false
  24080. */
  24081. function stubArray() {
  24082. return [];
  24083. }
  24084. /**
  24085. * This method returns `false`.
  24086. *
  24087. * @static
  24088. * @memberOf _
  24089. * @since 4.13.0
  24090. * @category Util
  24091. * @returns {boolean} Returns `false`.
  24092. * @example
  24093. *
  24094. * _.times(2, _.stubFalse);
  24095. * // => [false, false]
  24096. */
  24097. function stubFalse() {
  24098. return false;
  24099. }
  24100. /**
  24101. * This method returns a new empty object.
  24102. *
  24103. * @static
  24104. * @memberOf _
  24105. * @since 4.13.0
  24106. * @category Util
  24107. * @returns {Object} Returns the new empty object.
  24108. * @example
  24109. *
  24110. * var objects = _.times(2, _.stubObject);
  24111. *
  24112. * console.log(objects);
  24113. * // => [{}, {}]
  24114. *
  24115. * console.log(objects[0] === objects[1]);
  24116. * // => false
  24117. */
  24118. function stubObject() {
  24119. return {};
  24120. }
  24121. /**
  24122. * This method returns an empty string.
  24123. *
  24124. * @static
  24125. * @memberOf _
  24126. * @since 4.13.0
  24127. * @category Util
  24128. * @returns {string} Returns the empty string.
  24129. * @example
  24130. *
  24131. * _.times(2, _.stubString);
  24132. * // => ['', '']
  24133. */
  24134. function stubString() {
  24135. return '';
  24136. }
  24137. /**
  24138. * This method returns `true`.
  24139. *
  24140. * @static
  24141. * @memberOf _
  24142. * @since 4.13.0
  24143. * @category Util
  24144. * @returns {boolean} Returns `true`.
  24145. * @example
  24146. *
  24147. * _.times(2, _.stubTrue);
  24148. * // => [true, true]
  24149. */
  24150. function stubTrue() {
  24151. return true;
  24152. }
  24153. /**
  24154. * Invokes the iteratee `n` times, returning an array of the results of
  24155. * each invocation. The iteratee is invoked with one argument; (index).
  24156. *
  24157. * @static
  24158. * @since 0.1.0
  24159. * @memberOf _
  24160. * @category Util
  24161. * @param {number} n The number of times to invoke `iteratee`.
  24162. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24163. * @returns {Array} Returns the array of results.
  24164. * @example
  24165. *
  24166. * _.times(3, String);
  24167. * // => ['0', '1', '2']
  24168. *
  24169. * _.times(4, _.constant(0));
  24170. * // => [0, 0, 0, 0]
  24171. */
  24172. function times(n, iteratee) {
  24173. n = toInteger(n);
  24174. if (n < 1 || n > MAX_SAFE_INTEGER) {
  24175. return [];
  24176. }
  24177. var index = MAX_ARRAY_LENGTH,
  24178. length = nativeMin(n, MAX_ARRAY_LENGTH);
  24179. iteratee = getIteratee(iteratee);
  24180. n -= MAX_ARRAY_LENGTH;
  24181. var result = baseTimes(length, iteratee);
  24182. while (++index < n) {
  24183. iteratee(index);
  24184. }
  24185. return result;
  24186. }
  24187. /**
  24188. * Converts `value` to a property path array.
  24189. *
  24190. * @static
  24191. * @memberOf _
  24192. * @since 4.0.0
  24193. * @category Util
  24194. * @param {*} value The value to convert.
  24195. * @returns {Array} Returns the new property path array.
  24196. * @example
  24197. *
  24198. * _.toPath('a.b.c');
  24199. * // => ['a', 'b', 'c']
  24200. *
  24201. * _.toPath('a[0].b.c');
  24202. * // => ['a', '0', 'b', 'c']
  24203. */
  24204. function toPath(value) {
  24205. if (isArray(value)) {
  24206. return arrayMap(value, toKey);
  24207. }
  24208. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  24209. }
  24210. /**
  24211. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  24212. *
  24213. * @static
  24214. * @since 0.1.0
  24215. * @memberOf _
  24216. * @category Util
  24217. * @param {string} [prefix=''] The value to prefix the ID with.
  24218. * @returns {string} Returns the unique ID.
  24219. * @example
  24220. *
  24221. * _.uniqueId('contact_');
  24222. * // => 'contact_104'
  24223. *
  24224. * _.uniqueId();
  24225. * // => '105'
  24226. */
  24227. function uniqueId(prefix) {
  24228. var id = ++idCounter;
  24229. return toString(prefix) + id;
  24230. }
  24231. /*------------------------------------------------------------------------*/
  24232. /**
  24233. * Adds two numbers.
  24234. *
  24235. * @static
  24236. * @memberOf _
  24237. * @since 3.4.0
  24238. * @category Math
  24239. * @param {number} augend The first number in an addition.
  24240. * @param {number} addend The second number in an addition.
  24241. * @returns {number} Returns the total.
  24242. * @example
  24243. *
  24244. * _.add(6, 4);
  24245. * // => 10
  24246. */
  24247. var add = createMathOperation(function(augend, addend) {
  24248. return augend + addend;
  24249. }, 0);
  24250. /**
  24251. * Computes `number` rounded up to `precision`.
  24252. *
  24253. * @static
  24254. * @memberOf _
  24255. * @since 3.10.0
  24256. * @category Math
  24257. * @param {number} number The number to round up.
  24258. * @param {number} [precision=0] The precision to round up to.
  24259. * @returns {number} Returns the rounded up number.
  24260. * @example
  24261. *
  24262. * _.ceil(4.006);
  24263. * // => 5
  24264. *
  24265. * _.ceil(6.004, 2);
  24266. * // => 6.01
  24267. *
  24268. * _.ceil(6040, -2);
  24269. * // => 6100
  24270. */
  24271. var ceil = createRound('ceil');
  24272. /**
  24273. * Divide two numbers.
  24274. *
  24275. * @static
  24276. * @memberOf _
  24277. * @since 4.7.0
  24278. * @category Math
  24279. * @param {number} dividend The first number in a division.
  24280. * @param {number} divisor The second number in a division.
  24281. * @returns {number} Returns the quotient.
  24282. * @example
  24283. *
  24284. * _.divide(6, 4);
  24285. * // => 1.5
  24286. */
  24287. var divide = createMathOperation(function(dividend, divisor) {
  24288. return dividend / divisor;
  24289. }, 1);
  24290. /**
  24291. * Computes `number` rounded down to `precision`.
  24292. *
  24293. * @static
  24294. * @memberOf _
  24295. * @since 3.10.0
  24296. * @category Math
  24297. * @param {number} number The number to round down.
  24298. * @param {number} [precision=0] The precision to round down to.
  24299. * @returns {number} Returns the rounded down number.
  24300. * @example
  24301. *
  24302. * _.floor(4.006);
  24303. * // => 4
  24304. *
  24305. * _.floor(0.046, 2);
  24306. * // => 0.04
  24307. *
  24308. * _.floor(4060, -2);
  24309. * // => 4000
  24310. */
  24311. var floor = createRound('floor');
  24312. /**
  24313. * Computes the maximum value of `array`. If `array` is empty or falsey,
  24314. * `undefined` is returned.
  24315. *
  24316. * @static
  24317. * @since 0.1.0
  24318. * @memberOf _
  24319. * @category Math
  24320. * @param {Array} array The array to iterate over.
  24321. * @returns {*} Returns the maximum value.
  24322. * @example
  24323. *
  24324. * _.max([4, 2, 8, 6]);
  24325. * // => 8
  24326. *
  24327. * _.max([]);
  24328. * // => undefined
  24329. */
  24330. function max(array) {
  24331. return (array && array.length)
  24332. ? baseExtremum(array, identity, baseGt)
  24333. : undefined;
  24334. }
  24335. /**
  24336. * This method is like `_.max` except that it accepts `iteratee` which is
  24337. * invoked for each element in `array` to generate the criterion by which
  24338. * the value is ranked. The iteratee is invoked with one argument: (value).
  24339. *
  24340. * @static
  24341. * @memberOf _
  24342. * @since 4.0.0
  24343. * @category Math
  24344. * @param {Array} array The array to iterate over.
  24345. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24346. * @returns {*} Returns the maximum value.
  24347. * @example
  24348. *
  24349. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  24350. *
  24351. * _.maxBy(objects, function(o) { return o.n; });
  24352. * // => { 'n': 2 }
  24353. *
  24354. * // The `_.property` iteratee shorthand.
  24355. * _.maxBy(objects, 'n');
  24356. * // => { 'n': 2 }
  24357. */
  24358. function maxBy(array, iteratee) {
  24359. return (array && array.length)
  24360. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  24361. : undefined;
  24362. }
  24363. /**
  24364. * Computes the mean of the values in `array`.
  24365. *
  24366. * @static
  24367. * @memberOf _
  24368. * @since 4.0.0
  24369. * @category Math
  24370. * @param {Array} array The array to iterate over.
  24371. * @returns {number} Returns the mean.
  24372. * @example
  24373. *
  24374. * _.mean([4, 2, 8, 6]);
  24375. * // => 5
  24376. */
  24377. function mean(array) {
  24378. return baseMean(array, identity);
  24379. }
  24380. /**
  24381. * This method is like `_.mean` except that it accepts `iteratee` which is
  24382. * invoked for each element in `array` to generate the value to be averaged.
  24383. * The iteratee is invoked with one argument: (value).
  24384. *
  24385. * @static
  24386. * @memberOf _
  24387. * @since 4.7.0
  24388. * @category Math
  24389. * @param {Array} array The array to iterate over.
  24390. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24391. * @returns {number} Returns the mean.
  24392. * @example
  24393. *
  24394. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  24395. *
  24396. * _.meanBy(objects, function(o) { return o.n; });
  24397. * // => 5
  24398. *
  24399. * // The `_.property` iteratee shorthand.
  24400. * _.meanBy(objects, 'n');
  24401. * // => 5
  24402. */
  24403. function meanBy(array, iteratee) {
  24404. return baseMean(array, getIteratee(iteratee, 2));
  24405. }
  24406. /**
  24407. * Computes the minimum value of `array`. If `array` is empty or falsey,
  24408. * `undefined` is returned.
  24409. *
  24410. * @static
  24411. * @since 0.1.0
  24412. * @memberOf _
  24413. * @category Math
  24414. * @param {Array} array The array to iterate over.
  24415. * @returns {*} Returns the minimum value.
  24416. * @example
  24417. *
  24418. * _.min([4, 2, 8, 6]);
  24419. * // => 2
  24420. *
  24421. * _.min([]);
  24422. * // => undefined
  24423. */
  24424. function min(array) {
  24425. return (array && array.length)
  24426. ? baseExtremum(array, identity, baseLt)
  24427. : undefined;
  24428. }
  24429. /**
  24430. * This method is like `_.min` except that it accepts `iteratee` which is
  24431. * invoked for each element in `array` to generate the criterion by which
  24432. * the value is ranked. The iteratee is invoked with one argument: (value).
  24433. *
  24434. * @static
  24435. * @memberOf _
  24436. * @since 4.0.0
  24437. * @category Math
  24438. * @param {Array} array The array to iterate over.
  24439. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24440. * @returns {*} Returns the minimum value.
  24441. * @example
  24442. *
  24443. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  24444. *
  24445. * _.minBy(objects, function(o) { return o.n; });
  24446. * // => { 'n': 1 }
  24447. *
  24448. * // The `_.property` iteratee shorthand.
  24449. * _.minBy(objects, 'n');
  24450. * // => { 'n': 1 }
  24451. */
  24452. function minBy(array, iteratee) {
  24453. return (array && array.length)
  24454. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  24455. : undefined;
  24456. }
  24457. /**
  24458. * Multiply two numbers.
  24459. *
  24460. * @static
  24461. * @memberOf _
  24462. * @since 4.7.0
  24463. * @category Math
  24464. * @param {number} multiplier The first number in a multiplication.
  24465. * @param {number} multiplicand The second number in a multiplication.
  24466. * @returns {number} Returns the product.
  24467. * @example
  24468. *
  24469. * _.multiply(6, 4);
  24470. * // => 24
  24471. */
  24472. var multiply = createMathOperation(function(multiplier, multiplicand) {
  24473. return multiplier * multiplicand;
  24474. }, 1);
  24475. /**
  24476. * Computes `number` rounded to `precision`.
  24477. *
  24478. * @static
  24479. * @memberOf _
  24480. * @since 3.10.0
  24481. * @category Math
  24482. * @param {number} number The number to round.
  24483. * @param {number} [precision=0] The precision to round to.
  24484. * @returns {number} Returns the rounded number.
  24485. * @example
  24486. *
  24487. * _.round(4.006);
  24488. * // => 4
  24489. *
  24490. * _.round(4.006, 2);
  24491. * // => 4.01
  24492. *
  24493. * _.round(4060, -2);
  24494. * // => 4100
  24495. */
  24496. var round = createRound('round');
  24497. /**
  24498. * Subtract two numbers.
  24499. *
  24500. * @static
  24501. * @memberOf _
  24502. * @since 4.0.0
  24503. * @category Math
  24504. * @param {number} minuend The first number in a subtraction.
  24505. * @param {number} subtrahend The second number in a subtraction.
  24506. * @returns {number} Returns the difference.
  24507. * @example
  24508. *
  24509. * _.subtract(6, 4);
  24510. * // => 2
  24511. */
  24512. var subtract = createMathOperation(function(minuend, subtrahend) {
  24513. return minuend - subtrahend;
  24514. }, 0);
  24515. /**
  24516. * Computes the sum of the values in `array`.
  24517. *
  24518. * @static
  24519. * @memberOf _
  24520. * @since 3.4.0
  24521. * @category Math
  24522. * @param {Array} array The array to iterate over.
  24523. * @returns {number} Returns the sum.
  24524. * @example
  24525. *
  24526. * _.sum([4, 2, 8, 6]);
  24527. * // => 20
  24528. */
  24529. function sum(array) {
  24530. return (array && array.length)
  24531. ? baseSum(array, identity)
  24532. : 0;
  24533. }
  24534. /**
  24535. * This method is like `_.sum` except that it accepts `iteratee` which is
  24536. * invoked for each element in `array` to generate the value to be summed.
  24537. * The iteratee is invoked with one argument: (value).
  24538. *
  24539. * @static
  24540. * @memberOf _
  24541. * @since 4.0.0
  24542. * @category Math
  24543. * @param {Array} array The array to iterate over.
  24544. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24545. * @returns {number} Returns the sum.
  24546. * @example
  24547. *
  24548. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  24549. *
  24550. * _.sumBy(objects, function(o) { return o.n; });
  24551. * // => 20
  24552. *
  24553. * // The `_.property` iteratee shorthand.
  24554. * _.sumBy(objects, 'n');
  24555. * // => 20
  24556. */
  24557. function sumBy(array, iteratee) {
  24558. return (array && array.length)
  24559. ? baseSum(array, getIteratee(iteratee, 2))
  24560. : 0;
  24561. }
  24562. /*------------------------------------------------------------------------*/
  24563. // Add methods that return wrapped values in chain sequences.
  24564. lodash.after = after;
  24565. lodash.ary = ary;
  24566. lodash.assign = assign;
  24567. lodash.assignIn = assignIn;
  24568. lodash.assignInWith = assignInWith;
  24569. lodash.assignWith = assignWith;
  24570. lodash.at = at;
  24571. lodash.before = before;
  24572. lodash.bind = bind;
  24573. lodash.bindAll = bindAll;
  24574. lodash.bindKey = bindKey;
  24575. lodash.castArray = castArray;
  24576. lodash.chain = chain;
  24577. lodash.chunk = chunk;
  24578. lodash.compact = compact;
  24579. lodash.concat = concat;
  24580. lodash.cond = cond;
  24581. lodash.conforms = conforms;
  24582. lodash.constant = constant;
  24583. lodash.countBy = countBy;
  24584. lodash.create = create;
  24585. lodash.curry = curry;
  24586. lodash.curryRight = curryRight;
  24587. lodash.debounce = debounce;
  24588. lodash.defaults = defaults;
  24589. lodash.defaultsDeep = defaultsDeep;
  24590. lodash.defer = defer;
  24591. lodash.delay = delay;
  24592. lodash.difference = difference;
  24593. lodash.differenceBy = differenceBy;
  24594. lodash.differenceWith = differenceWith;
  24595. lodash.drop = drop;
  24596. lodash.dropRight = dropRight;
  24597. lodash.dropRightWhile = dropRightWhile;
  24598. lodash.dropWhile = dropWhile;
  24599. lodash.fill = fill;
  24600. lodash.filter = filter;
  24601. lodash.flatMap = flatMap;
  24602. lodash.flatMapDeep = flatMapDeep;
  24603. lodash.flatMapDepth = flatMapDepth;
  24604. lodash.flatten = flatten;
  24605. lodash.flattenDeep = flattenDeep;
  24606. lodash.flattenDepth = flattenDepth;
  24607. lodash.flip = flip;
  24608. lodash.flow = flow;
  24609. lodash.flowRight = flowRight;
  24610. lodash.fromPairs = fromPairs;
  24611. lodash.functions = functions;
  24612. lodash.functionsIn = functionsIn;
  24613. lodash.groupBy = groupBy;
  24614. lodash.initial = initial;
  24615. lodash.intersection = intersection;
  24616. lodash.intersectionBy = intersectionBy;
  24617. lodash.intersectionWith = intersectionWith;
  24618. lodash.invert = invert;
  24619. lodash.invertBy = invertBy;
  24620. lodash.invokeMap = invokeMap;
  24621. lodash.iteratee = iteratee;
  24622. lodash.keyBy = keyBy;
  24623. lodash.keys = keys;
  24624. lodash.keysIn = keysIn;
  24625. lodash.map = map;
  24626. lodash.mapKeys = mapKeys;
  24627. lodash.mapValues = mapValues;
  24628. lodash.matches = matches;
  24629. lodash.matchesProperty = matchesProperty;
  24630. lodash.memoize = memoize;
  24631. lodash.merge = merge;
  24632. lodash.mergeWith = mergeWith;
  24633. lodash.method = method;
  24634. lodash.methodOf = methodOf;
  24635. lodash.mixin = mixin;
  24636. lodash.negate = negate;
  24637. lodash.nthArg = nthArg;
  24638. lodash.omit = omit;
  24639. lodash.omitBy = omitBy;
  24640. lodash.once = once;
  24641. lodash.orderBy = orderBy;
  24642. lodash.over = over;
  24643. lodash.overArgs = overArgs;
  24644. lodash.overEvery = overEvery;
  24645. lodash.overSome = overSome;
  24646. lodash.partial = partial;
  24647. lodash.partialRight = partialRight;
  24648. lodash.partition = partition;
  24649. lodash.pick = pick;
  24650. lodash.pickBy = pickBy;
  24651. lodash.property = property;
  24652. lodash.propertyOf = propertyOf;
  24653. lodash.pull = pull;
  24654. lodash.pullAll = pullAll;
  24655. lodash.pullAllBy = pullAllBy;
  24656. lodash.pullAllWith = pullAllWith;
  24657. lodash.pullAt = pullAt;
  24658. lodash.range = range;
  24659. lodash.rangeRight = rangeRight;
  24660. lodash.rearg = rearg;
  24661. lodash.reject = reject;
  24662. lodash.remove = remove;
  24663. lodash.rest = rest;
  24664. lodash.reverse = reverse;
  24665. lodash.sampleSize = sampleSize;
  24666. lodash.set = set;
  24667. lodash.setWith = setWith;
  24668. lodash.shuffle = shuffle;
  24669. lodash.slice = slice;
  24670. lodash.sortBy = sortBy;
  24671. lodash.sortedUniq = sortedUniq;
  24672. lodash.sortedUniqBy = sortedUniqBy;
  24673. lodash.split = split;
  24674. lodash.spread = spread;
  24675. lodash.tail = tail;
  24676. lodash.take = take;
  24677. lodash.takeRight = takeRight;
  24678. lodash.takeRightWhile = takeRightWhile;
  24679. lodash.takeWhile = takeWhile;
  24680. lodash.tap = tap;
  24681. lodash.throttle = throttle;
  24682. lodash.thru = thru;
  24683. lodash.toArray = toArray;
  24684. lodash.toPairs = toPairs;
  24685. lodash.toPairsIn = toPairsIn;
  24686. lodash.toPath = toPath;
  24687. lodash.toPlainObject = toPlainObject;
  24688. lodash.transform = transform;
  24689. lodash.unary = unary;
  24690. lodash.union = union;
  24691. lodash.unionBy = unionBy;
  24692. lodash.unionWith = unionWith;
  24693. lodash.uniq = uniq;
  24694. lodash.uniqBy = uniqBy;
  24695. lodash.uniqWith = uniqWith;
  24696. lodash.unset = unset;
  24697. lodash.unzip = unzip;
  24698. lodash.unzipWith = unzipWith;
  24699. lodash.update = update;
  24700. lodash.updateWith = updateWith;
  24701. lodash.values = values;
  24702. lodash.valuesIn = valuesIn;
  24703. lodash.without = without;
  24704. lodash.words = words;
  24705. lodash.wrap = wrap;
  24706. lodash.xor = xor;
  24707. lodash.xorBy = xorBy;
  24708. lodash.xorWith = xorWith;
  24709. lodash.zip = zip;
  24710. lodash.zipObject = zipObject;
  24711. lodash.zipObjectDeep = zipObjectDeep;
  24712. lodash.zipWith = zipWith;
  24713. // Add aliases.
  24714. lodash.entries = toPairs;
  24715. lodash.entriesIn = toPairsIn;
  24716. lodash.extend = assignIn;
  24717. lodash.extendWith = assignInWith;
  24718. // Add methods to `lodash.prototype`.
  24719. mixin(lodash, lodash);
  24720. /*------------------------------------------------------------------------*/
  24721. // Add methods that return unwrapped values in chain sequences.
  24722. lodash.add = add;
  24723. lodash.attempt = attempt;
  24724. lodash.camelCase = camelCase;
  24725. lodash.capitalize = capitalize;
  24726. lodash.ceil = ceil;
  24727. lodash.clamp = clamp;
  24728. lodash.clone = clone;
  24729. lodash.cloneDeep = cloneDeep;
  24730. lodash.cloneDeepWith = cloneDeepWith;
  24731. lodash.cloneWith = cloneWith;
  24732. lodash.conformsTo = conformsTo;
  24733. lodash.deburr = deburr;
  24734. lodash.defaultTo = defaultTo;
  24735. lodash.divide = divide;
  24736. lodash.endsWith = endsWith;
  24737. lodash.eq = eq;
  24738. lodash.escape = escape;
  24739. lodash.escapeRegExp = escapeRegExp;
  24740. lodash.every = every;
  24741. lodash.find = find;
  24742. lodash.findIndex = findIndex;
  24743. lodash.findKey = findKey;
  24744. lodash.findLast = findLast;
  24745. lodash.findLastIndex = findLastIndex;
  24746. lodash.findLastKey = findLastKey;
  24747. lodash.floor = floor;
  24748. lodash.forEach = forEach;
  24749. lodash.forEachRight = forEachRight;
  24750. lodash.forIn = forIn;
  24751. lodash.forInRight = forInRight;
  24752. lodash.forOwn = forOwn;
  24753. lodash.forOwnRight = forOwnRight;
  24754. lodash.get = get;
  24755. lodash.gt = gt;
  24756. lodash.gte = gte;
  24757. lodash.has = has;
  24758. lodash.hasIn = hasIn;
  24759. lodash.head = head;
  24760. lodash.identity = identity;
  24761. lodash.includes = includes;
  24762. lodash.indexOf = indexOf;
  24763. lodash.inRange = inRange;
  24764. lodash.invoke = invoke;
  24765. lodash.isArguments = isArguments;
  24766. lodash.isArray = isArray;
  24767. lodash.isArrayBuffer = isArrayBuffer;
  24768. lodash.isArrayLike = isArrayLike;
  24769. lodash.isArrayLikeObject = isArrayLikeObject;
  24770. lodash.isBoolean = isBoolean;
  24771. lodash.isBuffer = isBuffer;
  24772. lodash.isDate = isDate;
  24773. lodash.isElement = isElement;
  24774. lodash.isEmpty = isEmpty;
  24775. lodash.isEqual = isEqual;
  24776. lodash.isEqualWith = isEqualWith;
  24777. lodash.isError = isError;
  24778. lodash.isFinite = isFinite;
  24779. lodash.isFunction = isFunction;
  24780. lodash.isInteger = isInteger;
  24781. lodash.isLength = isLength;
  24782. lodash.isMap = isMap;
  24783. lodash.isMatch = isMatch;
  24784. lodash.isMatchWith = isMatchWith;
  24785. lodash.isNaN = isNaN;
  24786. lodash.isNative = isNative;
  24787. lodash.isNil = isNil;
  24788. lodash.isNull = isNull;
  24789. lodash.isNumber = isNumber;
  24790. lodash.isObject = isObject;
  24791. lodash.isObjectLike = isObjectLike;
  24792. lodash.isPlainObject = isPlainObject;
  24793. lodash.isRegExp = isRegExp;
  24794. lodash.isSafeInteger = isSafeInteger;
  24795. lodash.isSet = isSet;
  24796. lodash.isString = isString;
  24797. lodash.isSymbol = isSymbol;
  24798. lodash.isTypedArray = isTypedArray;
  24799. lodash.isUndefined = isUndefined;
  24800. lodash.isWeakMap = isWeakMap;
  24801. lodash.isWeakSet = isWeakSet;
  24802. lodash.join = join;
  24803. lodash.kebabCase = kebabCase;
  24804. lodash.last = last;
  24805. lodash.lastIndexOf = lastIndexOf;
  24806. lodash.lowerCase = lowerCase;
  24807. lodash.lowerFirst = lowerFirst;
  24808. lodash.lt = lt;
  24809. lodash.lte = lte;
  24810. lodash.max = max;
  24811. lodash.maxBy = maxBy;
  24812. lodash.mean = mean;
  24813. lodash.meanBy = meanBy;
  24814. lodash.min = min;
  24815. lodash.minBy = minBy;
  24816. lodash.stubArray = stubArray;
  24817. lodash.stubFalse = stubFalse;
  24818. lodash.stubObject = stubObject;
  24819. lodash.stubString = stubString;
  24820. lodash.stubTrue = stubTrue;
  24821. lodash.multiply = multiply;
  24822. lodash.nth = nth;
  24823. lodash.noConflict = noConflict;
  24824. lodash.noop = noop;
  24825. lodash.now = now;
  24826. lodash.pad = pad;
  24827. lodash.padEnd = padEnd;
  24828. lodash.padStart = padStart;
  24829. lodash.parseInt = parseInt;
  24830. lodash.random = random;
  24831. lodash.reduce = reduce;
  24832. lodash.reduceRight = reduceRight;
  24833. lodash.repeat = repeat;
  24834. lodash.replace = replace;
  24835. lodash.result = result;
  24836. lodash.round = round;
  24837. lodash.runInContext = runInContext;
  24838. lodash.sample = sample;
  24839. lodash.size = size;
  24840. lodash.snakeCase = snakeCase;
  24841. lodash.some = some;
  24842. lodash.sortedIndex = sortedIndex;
  24843. lodash.sortedIndexBy = sortedIndexBy;
  24844. lodash.sortedIndexOf = sortedIndexOf;
  24845. lodash.sortedLastIndex = sortedLastIndex;
  24846. lodash.sortedLastIndexBy = sortedLastIndexBy;
  24847. lodash.sortedLastIndexOf = sortedLastIndexOf;
  24848. lodash.startCase = startCase;
  24849. lodash.startsWith = startsWith;
  24850. lodash.subtract = subtract;
  24851. lodash.sum = sum;
  24852. lodash.sumBy = sumBy;
  24853. lodash.template = template;
  24854. lodash.times = times;
  24855. lodash.toFinite = toFinite;
  24856. lodash.toInteger = toInteger;
  24857. lodash.toLength = toLength;
  24858. lodash.toLower = toLower;
  24859. lodash.toNumber = toNumber;
  24860. lodash.toSafeInteger = toSafeInteger;
  24861. lodash.toString = toString;
  24862. lodash.toUpper = toUpper;
  24863. lodash.trim = trim;
  24864. lodash.trimEnd = trimEnd;
  24865. lodash.trimStart = trimStart;
  24866. lodash.truncate = truncate;
  24867. lodash.unescape = unescape;
  24868. lodash.uniqueId = uniqueId;
  24869. lodash.upperCase = upperCase;
  24870. lodash.upperFirst = upperFirst;
  24871. // Add aliases.
  24872. lodash.each = forEach;
  24873. lodash.eachRight = forEachRight;
  24874. lodash.first = head;
  24875. mixin(lodash, (function() {
  24876. var source = {};
  24877. baseForOwn(lodash, function(func, methodName) {
  24878. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  24879. source[methodName] = func;
  24880. }
  24881. });
  24882. return source;
  24883. }()), { 'chain': false });
  24884. /*------------------------------------------------------------------------*/
  24885. /**
  24886. * The semantic version number.
  24887. *
  24888. * @static
  24889. * @memberOf _
  24890. * @type {string}
  24891. */
  24892. lodash.VERSION = VERSION;
  24893. // Assign default placeholders.
  24894. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  24895. lodash[methodName].placeholder = lodash;
  24896. });
  24897. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  24898. arrayEach(['drop', 'take'], function(methodName, index) {
  24899. LazyWrapper.prototype[methodName] = function(n) {
  24900. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  24901. var result = (this.__filtered__ && !index)
  24902. ? new LazyWrapper(this)
  24903. : this.clone();
  24904. if (result.__filtered__) {
  24905. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  24906. } else {
  24907. result.__views__.push({
  24908. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  24909. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  24910. });
  24911. }
  24912. return result;
  24913. };
  24914. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  24915. return this.reverse()[methodName](n).reverse();
  24916. };
  24917. });
  24918. // Add `LazyWrapper` methods that accept an `iteratee` value.
  24919. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  24920. var type = index + 1,
  24921. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  24922. LazyWrapper.prototype[methodName] = function(iteratee) {
  24923. var result = this.clone();
  24924. result.__iteratees__.push({
  24925. 'iteratee': getIteratee(iteratee, 3),
  24926. 'type': type
  24927. });
  24928. result.__filtered__ = result.__filtered__ || isFilter;
  24929. return result;
  24930. };
  24931. });
  24932. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  24933. arrayEach(['head', 'last'], function(methodName, index) {
  24934. var takeName = 'take' + (index ? 'Right' : '');
  24935. LazyWrapper.prototype[methodName] = function() {
  24936. return this[takeName](1).value()[0];
  24937. };
  24938. });
  24939. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  24940. arrayEach(['initial', 'tail'], function(methodName, index) {
  24941. var dropName = 'drop' + (index ? '' : 'Right');
  24942. LazyWrapper.prototype[methodName] = function() {
  24943. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  24944. };
  24945. });
  24946. LazyWrapper.prototype.compact = function() {
  24947. return this.filter(identity);
  24948. };
  24949. LazyWrapper.prototype.find = function(predicate) {
  24950. return this.filter(predicate).head();
  24951. };
  24952. LazyWrapper.prototype.findLast = function(predicate) {
  24953. return this.reverse().find(predicate);
  24954. };
  24955. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  24956. if (typeof path == 'function') {
  24957. return new LazyWrapper(this);
  24958. }
  24959. return this.map(function(value) {
  24960. return baseInvoke(value, path, args);
  24961. });
  24962. });
  24963. LazyWrapper.prototype.reject = function(predicate) {
  24964. return this.filter(negate(getIteratee(predicate)));
  24965. };
  24966. LazyWrapper.prototype.slice = function(start, end) {
  24967. start = toInteger(start);
  24968. var result = this;
  24969. if (result.__filtered__ && (start > 0 || end < 0)) {
  24970. return new LazyWrapper(result);
  24971. }
  24972. if (start < 0) {
  24973. result = result.takeRight(-start);
  24974. } else if (start) {
  24975. result = result.drop(start);
  24976. }
  24977. if (end !== undefined) {
  24978. end = toInteger(end);
  24979. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  24980. }
  24981. return result;
  24982. };
  24983. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  24984. return this.reverse().takeWhile(predicate).reverse();
  24985. };
  24986. LazyWrapper.prototype.toArray = function() {
  24987. return this.take(MAX_ARRAY_LENGTH);
  24988. };
  24989. // Add `LazyWrapper` methods to `lodash.prototype`.
  24990. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  24991. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  24992. isTaker = /^(?:head|last)$/.test(methodName),
  24993. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  24994. retUnwrapped = isTaker || /^find/.test(methodName);
  24995. if (!lodashFunc) {
  24996. return;
  24997. }
  24998. lodash.prototype[methodName] = function() {
  24999. var value = this.__wrapped__,
  25000. args = isTaker ? [1] : arguments,
  25001. isLazy = value instanceof LazyWrapper,
  25002. iteratee = args[0],
  25003. useLazy = isLazy || isArray(value);
  25004. var interceptor = function(value) {
  25005. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  25006. return (isTaker && chainAll) ? result[0] : result;
  25007. };
  25008. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  25009. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  25010. isLazy = useLazy = false;
  25011. }
  25012. var chainAll = this.__chain__,
  25013. isHybrid = !!this.__actions__.length,
  25014. isUnwrapped = retUnwrapped && !chainAll,
  25015. onlyLazy = isLazy && !isHybrid;
  25016. if (!retUnwrapped && useLazy) {
  25017. value = onlyLazy ? value : new LazyWrapper(this);
  25018. var result = func.apply(value, args);
  25019. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  25020. return new LodashWrapper(result, chainAll);
  25021. }
  25022. if (isUnwrapped && onlyLazy) {
  25023. return func.apply(this, args);
  25024. }
  25025. result = this.thru(interceptor);
  25026. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  25027. };
  25028. });
  25029. // Add `Array` methods to `lodash.prototype`.
  25030. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  25031. var func = arrayProto[methodName],
  25032. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  25033. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  25034. lodash.prototype[methodName] = function() {
  25035. var args = arguments;
  25036. if (retUnwrapped && !this.__chain__) {
  25037. var value = this.value();
  25038. return func.apply(isArray(value) ? value : [], args);
  25039. }
  25040. return this[chainName](function(value) {
  25041. return func.apply(isArray(value) ? value : [], args);
  25042. });
  25043. };
  25044. });
  25045. // Map minified method names to their real names.
  25046. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  25047. var lodashFunc = lodash[methodName];
  25048. if (lodashFunc) {
  25049. var key = (lodashFunc.name + ''),
  25050. names = realNames[key] || (realNames[key] = []);
  25051. names.push({ 'name': methodName, 'func': lodashFunc });
  25052. }
  25053. });
  25054. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  25055. 'name': 'wrapper',
  25056. 'func': undefined
  25057. }];
  25058. // Add methods to `LazyWrapper`.
  25059. LazyWrapper.prototype.clone = lazyClone;
  25060. LazyWrapper.prototype.reverse = lazyReverse;
  25061. LazyWrapper.prototype.value = lazyValue;
  25062. // Add chain sequence methods to the `lodash` wrapper.
  25063. lodash.prototype.at = wrapperAt;
  25064. lodash.prototype.chain = wrapperChain;
  25065. lodash.prototype.commit = wrapperCommit;
  25066. lodash.prototype.next = wrapperNext;
  25067. lodash.prototype.plant = wrapperPlant;
  25068. lodash.prototype.reverse = wrapperReverse;
  25069. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  25070. // Add lazy aliases.
  25071. lodash.prototype.first = lodash.prototype.head;
  25072. if (symIterator) {
  25073. lodash.prototype[symIterator] = wrapperToIterator;
  25074. }
  25075. return lodash;
  25076. });
  25077. /*--------------------------------------------------------------------------*/
  25078. // Export lodash.
  25079. var _ = runInContext();
  25080. // Some AMD build optimizers, like r.js, check for condition patterns like:
  25081. if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
  25082. // Expose Lodash on the global object to prevent errors when Lodash is
  25083. // loaded by a script tag in the presence of an AMD loader.
  25084. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  25085. // Use `_.noConflict` to remove Lodash from the global object.
  25086. root._ = _;
  25087. // Define as an anonymous module so, through path mapping, it can be
  25088. // referenced as the "underscore" module.
  25089. define(function() {
  25090. return _;
  25091. });
  25092. }
  25093. // Check for `exports` after `define` in case a build optimizer adds it.
  25094. else if (freeModule) {
  25095. // Export for Node.js.
  25096. (freeModule.exports = _)._ = _;
  25097. // Export for CommonJS support.
  25098. freeExports._ = _;
  25099. }
  25100. else {
  25101. // Export to the global object.
  25102. root._ = _;
  25103. }
  25104. }.call(this));
  25105. });
  25106. return ___scope___.entry = "lodash.js";
  25107. });
  25108. FuseBox.pkg("vue", {}, function(___scope___){
  25109. ___scope___.file("dist/vue.js", function(exports, require, module, __filename, __dirname){
  25110. /*!
  25111. * Vue.js v2.2.5
  25112. * (c) 2014-2017 Evan You
  25113. * Released under the MIT License.
  25114. */
  25115. (function (global, factory) {
  25116. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  25117. typeof define === 'function' && define.amd ? define(factory) :
  25118. (global.Vue = factory());
  25119. }(this, (function () { 'use strict';
  25120. /* */
  25121. /**
  25122. * Convert a value to a string that is actually rendered.
  25123. */
  25124. function _toString (val) {
  25125. return val == null
  25126. ? ''
  25127. : typeof val === 'object'
  25128. ? JSON.stringify(val, null, 2)
  25129. : String(val)
  25130. }
  25131. /**
  25132. * Convert a input value to a number for persistence.
  25133. * If the conversion fails, return original string.
  25134. */
  25135. function toNumber (val) {
  25136. var n = parseFloat(val);
  25137. return isNaN(n) ? val : n
  25138. }
  25139. /**
  25140. * Make a map and return a function for checking if a key
  25141. * is in that map.
  25142. */
  25143. function makeMap (
  25144. str,
  25145. expectsLowerCase
  25146. ) {
  25147. var map = Object.create(null);
  25148. var list = str.split(',');
  25149. for (var i = 0; i < list.length; i++) {
  25150. map[list[i]] = true;
  25151. }
  25152. return expectsLowerCase
  25153. ? function (val) { return map[val.toLowerCase()]; }
  25154. : function (val) { return map[val]; }
  25155. }
  25156. /**
  25157. * Check if a tag is a built-in tag.
  25158. */
  25159. var isBuiltInTag = makeMap('slot,component', true);
  25160. /**
  25161. * Remove an item from an array
  25162. */
  25163. function remove (arr, item) {
  25164. if (arr.length) {
  25165. var index = arr.indexOf(item);
  25166. if (index > -1) {
  25167. return arr.splice(index, 1)
  25168. }
  25169. }
  25170. }
  25171. /**
  25172. * Check whether the object has the property.
  25173. */
  25174. var hasOwnProperty = Object.prototype.hasOwnProperty;
  25175. function hasOwn (obj, key) {
  25176. return hasOwnProperty.call(obj, key)
  25177. }
  25178. /**
  25179. * Check if value is primitive
  25180. */
  25181. function isPrimitive (value) {
  25182. return typeof value === 'string' || typeof value === 'number'
  25183. }
  25184. /**
  25185. * Create a cached version of a pure function.
  25186. */
  25187. function cached (fn) {
  25188. var cache = Object.create(null);
  25189. return (function cachedFn (str) {
  25190. var hit = cache[str];
  25191. return hit || (cache[str] = fn(str))
  25192. })
  25193. }
  25194. /**
  25195. * Camelize a hyphen-delimited string.
  25196. */
  25197. var camelizeRE = /-(\w)/g;
  25198. var camelize = cached(function (str) {
  25199. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  25200. });
  25201. /**
  25202. * Capitalize a string.
  25203. */
  25204. var capitalize = cached(function (str) {
  25205. return str.charAt(0).toUpperCase() + str.slice(1)
  25206. });
  25207. /**
  25208. * Hyphenate a camelCase string.
  25209. */
  25210. var hyphenateRE = /([^-])([A-Z])/g;
  25211. var hyphenate = cached(function (str) {
  25212. return str
  25213. .replace(hyphenateRE, '$1-$2')
  25214. .replace(hyphenateRE, '$1-$2')
  25215. .toLowerCase()
  25216. });
  25217. /**
  25218. * Simple bind, faster than native
  25219. */
  25220. function bind (fn, ctx) {
  25221. function boundFn (a) {
  25222. var l = arguments.length;
  25223. return l
  25224. ? l > 1
  25225. ? fn.apply(ctx, arguments)
  25226. : fn.call(ctx, a)
  25227. : fn.call(ctx)
  25228. }
  25229. // record original fn length
  25230. boundFn._length = fn.length;
  25231. return boundFn
  25232. }
  25233. /**
  25234. * Convert an Array-like object to a real Array.
  25235. */
  25236. function toArray (list, start) {
  25237. start = start || 0;
  25238. var i = list.length - start;
  25239. var ret = new Array(i);
  25240. while (i--) {
  25241. ret[i] = list[i + start];
  25242. }
  25243. return ret
  25244. }
  25245. /**
  25246. * Mix properties into target object.
  25247. */
  25248. function extend (to, _from) {
  25249. for (var key in _from) {
  25250. to[key] = _from[key];
  25251. }
  25252. return to
  25253. }
  25254. /**
  25255. * Quick object check - this is primarily used to tell
  25256. * Objects from primitive values when we know the value
  25257. * is a JSON-compliant type.
  25258. */
  25259. function isObject (obj) {
  25260. return obj !== null && typeof obj === 'object'
  25261. }
  25262. /**
  25263. * Strict object type check. Only returns true
  25264. * for plain JavaScript objects.
  25265. */
  25266. var toString = Object.prototype.toString;
  25267. var OBJECT_STRING = '[object Object]';
  25268. function isPlainObject (obj) {
  25269. return toString.call(obj) === OBJECT_STRING
  25270. }
  25271. /**
  25272. * Merge an Array of Objects into a single Object.
  25273. */
  25274. function toObject (arr) {
  25275. var res = {};
  25276. for (var i = 0; i < arr.length; i++) {
  25277. if (arr[i]) {
  25278. extend(res, arr[i]);
  25279. }
  25280. }
  25281. return res
  25282. }
  25283. /**
  25284. * Perform no operation.
  25285. */
  25286. function noop () {}
  25287. /**
  25288. * Always return false.
  25289. */
  25290. var no = function () { return false; };
  25291. /**
  25292. * Return same value
  25293. */
  25294. var identity = function (_) { return _; };
  25295. /**
  25296. * Generate a static keys string from compiler modules.
  25297. */
  25298. function genStaticKeys (modules) {
  25299. return modules.reduce(function (keys, m) {
  25300. return keys.concat(m.staticKeys || [])
  25301. }, []).join(',')
  25302. }
  25303. /**
  25304. * Check if two values are loosely equal - that is,
  25305. * if they are plain objects, do they have the same shape?
  25306. */
  25307. function looseEqual (a, b) {
  25308. var isObjectA = isObject(a);
  25309. var isObjectB = isObject(b);
  25310. if (isObjectA && isObjectB) {
  25311. try {
  25312. return JSON.stringify(a) === JSON.stringify(b)
  25313. } catch (e) {
  25314. // possible circular reference
  25315. return a === b
  25316. }
  25317. } else if (!isObjectA && !isObjectB) {
  25318. return String(a) === String(b)
  25319. } else {
  25320. return false
  25321. }
  25322. }
  25323. function looseIndexOf (arr, val) {
  25324. for (var i = 0; i < arr.length; i++) {
  25325. if (looseEqual(arr[i], val)) { return i }
  25326. }
  25327. return -1
  25328. }
  25329. /**
  25330. * Ensure a function is called only once.
  25331. */
  25332. function once (fn) {
  25333. var called = false;
  25334. return function () {
  25335. if (!called) {
  25336. called = true;
  25337. fn();
  25338. }
  25339. }
  25340. }
  25341. /* */
  25342. var config = {
  25343. /**
  25344. * Option merge strategies (used in core/util/options)
  25345. */
  25346. optionMergeStrategies: Object.create(null),
  25347. /**
  25348. * Whether to suppress warnings.
  25349. */
  25350. silent: false,
  25351. /**
  25352. * Show production mode tip message on boot?
  25353. */
  25354. productionTip: "development" !== 'production',
  25355. /**
  25356. * Whether to enable devtools
  25357. */
  25358. devtools: "development" !== 'production',
  25359. /**
  25360. * Whether to record perf
  25361. */
  25362. performance: false,
  25363. /**
  25364. * Error handler for watcher errors
  25365. */
  25366. errorHandler: null,
  25367. /**
  25368. * Ignore certain custom elements
  25369. */
  25370. ignoredElements: [],
  25371. /**
  25372. * Custom user key aliases for v-on
  25373. */
  25374. keyCodes: Object.create(null),
  25375. /**
  25376. * Check if a tag is reserved so that it cannot be registered as a
  25377. * component. This is platform-dependent and may be overwritten.
  25378. */
  25379. isReservedTag: no,
  25380. /**
  25381. * Check if a tag is an unknown element.
  25382. * Platform-dependent.
  25383. */
  25384. isUnknownElement: no,
  25385. /**
  25386. * Get the namespace of an element
  25387. */
  25388. getTagNamespace: noop,
  25389. /**
  25390. * Parse the real tag name for the specific platform.
  25391. */
  25392. parsePlatformTagName: identity,
  25393. /**
  25394. * Check if an attribute must be bound using property, e.g. value
  25395. * Platform-dependent.
  25396. */
  25397. mustUseProp: no,
  25398. /**
  25399. * List of asset types that a component can own.
  25400. */
  25401. _assetTypes: [
  25402. 'component',
  25403. 'directive',
  25404. 'filter'
  25405. ],
  25406. /**
  25407. * List of lifecycle hooks.
  25408. */
  25409. _lifecycleHooks: [
  25410. 'beforeCreate',
  25411. 'created',
  25412. 'beforeMount',
  25413. 'mounted',
  25414. 'beforeUpdate',
  25415. 'updated',
  25416. 'beforeDestroy',
  25417. 'destroyed',
  25418. 'activated',
  25419. 'deactivated'
  25420. ],
  25421. /**
  25422. * Max circular updates allowed in a scheduler flush cycle.
  25423. */
  25424. _maxUpdateCount: 100
  25425. };
  25426. /* */
  25427. var emptyObject = Object.freeze({});
  25428. /**
  25429. * Check if a string starts with $ or _
  25430. */
  25431. function isReserved (str) {
  25432. var c = (str + '').charCodeAt(0);
  25433. return c === 0x24 || c === 0x5F
  25434. }
  25435. /**
  25436. * Define a property.
  25437. */
  25438. function def (obj, key, val, enumerable) {
  25439. Object.defineProperty(obj, key, {
  25440. value: val,
  25441. enumerable: !!enumerable,
  25442. writable: true,
  25443. configurable: true
  25444. });
  25445. }
  25446. /**
  25447. * Parse simple path.
  25448. */
  25449. var bailRE = /[^\w.$]/;
  25450. function parsePath (path) {
  25451. if (bailRE.test(path)) {
  25452. return
  25453. }
  25454. var segments = path.split('.');
  25455. return function (obj) {
  25456. for (var i = 0; i < segments.length; i++) {
  25457. if (!obj) { return }
  25458. obj = obj[segments[i]];
  25459. }
  25460. return obj
  25461. }
  25462. }
  25463. /* */
  25464. /* globals MutationObserver */
  25465. // can we use __proto__?
  25466. var hasProto = '__proto__' in {};
  25467. // Browser environment sniffing
  25468. var inBrowser = typeof window !== 'undefined';
  25469. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  25470. var isIE = UA && /msie|trident/.test(UA);
  25471. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  25472. var isEdge = UA && UA.indexOf('edge/') > 0;
  25473. var isAndroid = UA && UA.indexOf('android') > 0;
  25474. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  25475. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  25476. // this needs to be lazy-evaled because vue may be required before
  25477. // vue-server-renderer can set VUE_ENV
  25478. var _isServer;
  25479. var isServerRendering = function () {
  25480. if (_isServer === undefined) {
  25481. /* istanbul ignore if */
  25482. if (!inBrowser && typeof global !== 'undefined') {
  25483. // detect presence of vue-server-renderer and avoid
  25484. // Webpack shimming the process
  25485. _isServer = global['process'].env.VUE_ENV === 'server';
  25486. } else {
  25487. _isServer = false;
  25488. }
  25489. }
  25490. return _isServer
  25491. };
  25492. // detect devtools
  25493. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  25494. /* istanbul ignore next */
  25495. function isNative (Ctor) {
  25496. return /native code/.test(Ctor.toString())
  25497. }
  25498. var hasSymbol =
  25499. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  25500. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  25501. /**
  25502. * Defer a task to execute it asynchronously.
  25503. */
  25504. var nextTick = (function () {
  25505. var callbacks = [];
  25506. var pending = false;
  25507. var timerFunc;
  25508. function nextTickHandler () {
  25509. pending = false;
  25510. var copies = callbacks.slice(0);
  25511. callbacks.length = 0;
  25512. for (var i = 0; i < copies.length; i++) {
  25513. copies[i]();
  25514. }
  25515. }
  25516. // the nextTick behavior leverages the microtask queue, which can be accessed
  25517. // via either native Promise.then or MutationObserver.
  25518. // MutationObserver has wider support, however it is seriously bugged in
  25519. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  25520. // completely stops working after triggering a few times... so, if native
  25521. // Promise is available, we will use it:
  25522. /* istanbul ignore if */
  25523. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  25524. var p = Promise.resolve();
  25525. var logError = function (err) { console.error(err); };
  25526. timerFunc = function () {
  25527. p.then(nextTickHandler).catch(logError);
  25528. // in problematic UIWebViews, Promise.then doesn't completely break, but
  25529. // it can get stuck in a weird state where callbacks are pushed into the
  25530. // microtask queue but the queue isn't being flushed, until the browser
  25531. // needs to do some other work, e.g. handle a timer. Therefore we can
  25532. // "force" the microtask queue to be flushed by adding an empty timer.
  25533. if (isIOS) { setTimeout(noop); }
  25534. };
  25535. } else if (typeof MutationObserver !== 'undefined' && (
  25536. isNative(MutationObserver) ||
  25537. // PhantomJS and iOS 7.x
  25538. MutationObserver.toString() === '[object MutationObserverConstructor]'
  25539. )) {
  25540. // use MutationObserver where native Promise is not available,
  25541. // e.g. PhantomJS IE11, iOS7, Android 4.4
  25542. var counter = 1;
  25543. var observer = new MutationObserver(nextTickHandler);
  25544. var textNode = document.createTextNode(String(counter));
  25545. observer.observe(textNode, {
  25546. characterData: true
  25547. });
  25548. timerFunc = function () {
  25549. counter = (counter + 1) % 2;
  25550. textNode.data = String(counter);
  25551. };
  25552. } else {
  25553. // fallback to setTimeout
  25554. /* istanbul ignore next */
  25555. timerFunc = function () {
  25556. setTimeout(nextTickHandler, 0);
  25557. };
  25558. }
  25559. return function queueNextTick (cb, ctx) {
  25560. var _resolve;
  25561. callbacks.push(function () {
  25562. if (cb) { cb.call(ctx); }
  25563. if (_resolve) { _resolve(ctx); }
  25564. });
  25565. if (!pending) {
  25566. pending = true;
  25567. timerFunc();
  25568. }
  25569. if (!cb && typeof Promise !== 'undefined') {
  25570. return new Promise(function (resolve) {
  25571. _resolve = resolve;
  25572. })
  25573. }
  25574. }
  25575. })();
  25576. var _Set;
  25577. /* istanbul ignore if */
  25578. if (typeof Set !== 'undefined' && isNative(Set)) {
  25579. // use native Set when available.
  25580. _Set = Set;
  25581. } else {
  25582. // a non-standard Set polyfill that only works with primitive keys.
  25583. _Set = (function () {
  25584. function Set () {
  25585. this.set = Object.create(null);
  25586. }
  25587. Set.prototype.has = function has (key) {
  25588. return this.set[key] === true
  25589. };
  25590. Set.prototype.add = function add (key) {
  25591. this.set[key] = true;
  25592. };
  25593. Set.prototype.clear = function clear () {
  25594. this.set = Object.create(null);
  25595. };
  25596. return Set;
  25597. }());
  25598. }
  25599. var warn = noop;
  25600. var tip = noop;
  25601. var formatComponentName;
  25602. {
  25603. var hasConsole = typeof console !== 'undefined';
  25604. var classifyRE = /(?:^|[-_])(\w)/g;
  25605. var classify = function (str) { return str
  25606. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  25607. .replace(/[-_]/g, ''); };
  25608. warn = function (msg, vm) {
  25609. if (hasConsole && (!config.silent)) {
  25610. console.error("[Vue warn]: " + msg + " " + (
  25611. vm ? formatLocation(formatComponentName(vm)) : ''
  25612. ));
  25613. }
  25614. };
  25615. tip = function (msg, vm) {
  25616. if (hasConsole && (!config.silent)) {
  25617. console.warn("[Vue tip]: " + msg + " " + (
  25618. vm ? formatLocation(formatComponentName(vm)) : ''
  25619. ));
  25620. }
  25621. };
  25622. formatComponentName = function (vm, includeFile) {
  25623. if (vm.$root === vm) {
  25624. return '<Root>'
  25625. }
  25626. var name = typeof vm === 'string'
  25627. ? vm
  25628. : typeof vm === 'function' && vm.options
  25629. ? vm.options.name
  25630. : vm._isVue
  25631. ? vm.$options.name || vm.$options._componentTag
  25632. : vm.name;
  25633. var file = vm._isVue && vm.$options.__file;
  25634. if (!name && file) {
  25635. var match = file.match(/([^/\\]+)\.vue$/);
  25636. name = match && match[1];
  25637. }
  25638. return (
  25639. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  25640. (file && includeFile !== false ? (" at " + file) : '')
  25641. )
  25642. };
  25643. var formatLocation = function (str) {
  25644. if (str === "<Anonymous>") {
  25645. str += " - use the \"name\" option for better debugging messages.";
  25646. }
  25647. return ("\n(found in " + str + ")")
  25648. };
  25649. }
  25650. /* */
  25651. var uid$1 = 0;
  25652. /**
  25653. * A dep is an observable that can have multiple
  25654. * directives subscribing to it.
  25655. */
  25656. var Dep = function Dep () {
  25657. this.id = uid$1++;
  25658. this.subs = [];
  25659. };
  25660. Dep.prototype.addSub = function addSub (sub) {
  25661. this.subs.push(sub);
  25662. };
  25663. Dep.prototype.removeSub = function removeSub (sub) {
  25664. remove(this.subs, sub);
  25665. };
  25666. Dep.prototype.depend = function depend () {
  25667. if (Dep.target) {
  25668. Dep.target.addDep(this);
  25669. }
  25670. };
  25671. Dep.prototype.notify = function notify () {
  25672. // stabilize the subscriber list first
  25673. var subs = this.subs.slice();
  25674. for (var i = 0, l = subs.length; i < l; i++) {
  25675. subs[i].update();
  25676. }
  25677. };
  25678. // the current target watcher being evaluated.
  25679. // this is globally unique because there could be only one
  25680. // watcher being evaluated at any time.
  25681. Dep.target = null;
  25682. var targetStack = [];
  25683. function pushTarget (_target) {
  25684. if (Dep.target) { targetStack.push(Dep.target); }
  25685. Dep.target = _target;
  25686. }
  25687. function popTarget () {
  25688. Dep.target = targetStack.pop();
  25689. }
  25690. /*
  25691. * not type checking this file because flow doesn't play well with
  25692. * dynamically accessing methods on Array prototype
  25693. */
  25694. var arrayProto = Array.prototype;
  25695. var arrayMethods = Object.create(arrayProto);[
  25696. 'push',
  25697. 'pop',
  25698. 'shift',
  25699. 'unshift',
  25700. 'splice',
  25701. 'sort',
  25702. 'reverse'
  25703. ]
  25704. .forEach(function (method) {
  25705. // cache original method
  25706. var original = arrayProto[method];
  25707. def(arrayMethods, method, function mutator () {
  25708. var arguments$1 = arguments;
  25709. // avoid leaking arguments:
  25710. // http://jsperf.com/closure-with-arguments
  25711. var i = arguments.length;
  25712. var args = new Array(i);
  25713. while (i--) {
  25714. args[i] = arguments$1[i];
  25715. }
  25716. var result = original.apply(this, args);
  25717. var ob = this.__ob__;
  25718. var inserted;
  25719. switch (method) {
  25720. case 'push':
  25721. inserted = args;
  25722. break
  25723. case 'unshift':
  25724. inserted = args;
  25725. break
  25726. case 'splice':
  25727. inserted = args.slice(2);
  25728. break
  25729. }
  25730. if (inserted) { ob.observeArray(inserted); }
  25731. // notify change
  25732. ob.dep.notify();
  25733. return result
  25734. });
  25735. });
  25736. /* */
  25737. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  25738. /**
  25739. * By default, when a reactive property is set, the new value is
  25740. * also converted to become reactive. However when passing down props,
  25741. * we don't want to force conversion because the value may be a nested value
  25742. * under a frozen data structure. Converting it would defeat the optimization.
  25743. */
  25744. var observerState = {
  25745. shouldConvert: true,
  25746. isSettingProps: false
  25747. };
  25748. /**
  25749. * Observer class that are attached to each observed
  25750. * object. Once attached, the observer converts target
  25751. * object's property keys into getter/setters that
  25752. * collect dependencies and dispatches updates.
  25753. */
  25754. var Observer = function Observer (value) {
  25755. this.value = value;
  25756. this.dep = new Dep();
  25757. this.vmCount = 0;
  25758. def(value, '__ob__', this);
  25759. if (Array.isArray(value)) {
  25760. var augment = hasProto
  25761. ? protoAugment
  25762. : copyAugment;
  25763. augment(value, arrayMethods, arrayKeys);
  25764. this.observeArray(value);
  25765. } else {
  25766. this.walk(value);
  25767. }
  25768. };
  25769. /**
  25770. * Walk through each property and convert them into
  25771. * getter/setters. This method should only be called when
  25772. * value type is Object.
  25773. */
  25774. Observer.prototype.walk = function walk (obj) {
  25775. var keys = Object.keys(obj);
  25776. for (var i = 0; i < keys.length; i++) {
  25777. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  25778. }
  25779. };
  25780. /**
  25781. * Observe a list of Array items.
  25782. */
  25783. Observer.prototype.observeArray = function observeArray (items) {
  25784. for (var i = 0, l = items.length; i < l; i++) {
  25785. observe(items[i]);
  25786. }
  25787. };
  25788. // helpers
  25789. /**
  25790. * Augment an target Object or Array by intercepting
  25791. * the prototype chain using __proto__
  25792. */
  25793. function protoAugment (target, src) {
  25794. /* eslint-disable no-proto */
  25795. target.__proto__ = src;
  25796. /* eslint-enable no-proto */
  25797. }
  25798. /**
  25799. * Augment an target Object or Array by defining
  25800. * hidden properties.
  25801. */
  25802. /* istanbul ignore next */
  25803. function copyAugment (target, src, keys) {
  25804. for (var i = 0, l = keys.length; i < l; i++) {
  25805. var key = keys[i];
  25806. def(target, key, src[key]);
  25807. }
  25808. }
  25809. /**
  25810. * Attempt to create an observer instance for a value,
  25811. * returns the new observer if successfully observed,
  25812. * or the existing observer if the value already has one.
  25813. */
  25814. function observe (value, asRootData) {
  25815. if (!isObject(value)) {
  25816. return
  25817. }
  25818. var ob;
  25819. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  25820. ob = value.__ob__;
  25821. } else if (
  25822. observerState.shouldConvert &&
  25823. !isServerRendering() &&
  25824. (Array.isArray(value) || isPlainObject(value)) &&
  25825. Object.isExtensible(value) &&
  25826. !value._isVue
  25827. ) {
  25828. ob = new Observer(value);
  25829. }
  25830. if (asRootData && ob) {
  25831. ob.vmCount++;
  25832. }
  25833. return ob
  25834. }
  25835. /**
  25836. * Define a reactive property on an Object.
  25837. */
  25838. function defineReactive$$1 (
  25839. obj,
  25840. key,
  25841. val,
  25842. customSetter
  25843. ) {
  25844. var dep = new Dep();
  25845. var property = Object.getOwnPropertyDescriptor(obj, key);
  25846. if (property && property.configurable === false) {
  25847. return
  25848. }
  25849. // cater for pre-defined getter/setters
  25850. var getter = property && property.get;
  25851. var setter = property && property.set;
  25852. var childOb = observe(val);
  25853. Object.defineProperty(obj, key, {
  25854. enumerable: true,
  25855. configurable: true,
  25856. get: function reactiveGetter () {
  25857. var value = getter ? getter.call(obj) : val;
  25858. if (Dep.target) {
  25859. dep.depend();
  25860. if (childOb) {
  25861. childOb.dep.depend();
  25862. }
  25863. if (Array.isArray(value)) {
  25864. dependArray(value);
  25865. }
  25866. }
  25867. return value
  25868. },
  25869. set: function reactiveSetter (newVal) {
  25870. var value = getter ? getter.call(obj) : val;
  25871. /* eslint-disable no-self-compare */
  25872. if (newVal === value || (newVal !== newVal && value !== value)) {
  25873. return
  25874. }
  25875. /* eslint-enable no-self-compare */
  25876. if ("development" !== 'production' && customSetter) {
  25877. customSetter();
  25878. }
  25879. if (setter) {
  25880. setter.call(obj, newVal);
  25881. } else {
  25882. val = newVal;
  25883. }
  25884. childOb = observe(newVal);
  25885. dep.notify();
  25886. }
  25887. });
  25888. }
  25889. /**
  25890. * Set a property on an object. Adds the new property and
  25891. * triggers change notification if the property doesn't
  25892. * already exist.
  25893. */
  25894. function set (target, key, val) {
  25895. if (Array.isArray(target) && typeof key === 'number') {
  25896. target.length = Math.max(target.length, key);
  25897. target.splice(key, 1, val);
  25898. return val
  25899. }
  25900. if (hasOwn(target, key)) {
  25901. target[key] = val;
  25902. return val
  25903. }
  25904. var ob = (target ).__ob__;
  25905. if (target._isVue || (ob && ob.vmCount)) {
  25906. "development" !== 'production' && warn(
  25907. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  25908. 'at runtime - declare it upfront in the data option.'
  25909. );
  25910. return val
  25911. }
  25912. if (!ob) {
  25913. target[key] = val;
  25914. return val
  25915. }
  25916. defineReactive$$1(ob.value, key, val);
  25917. ob.dep.notify();
  25918. return val
  25919. }
  25920. /**
  25921. * Delete a property and trigger change if necessary.
  25922. */
  25923. function del (target, key) {
  25924. if (Array.isArray(target) && typeof key === 'number') {
  25925. target.splice(key, 1);
  25926. return
  25927. }
  25928. var ob = (target ).__ob__;
  25929. if (target._isVue || (ob && ob.vmCount)) {
  25930. "development" !== 'production' && warn(
  25931. 'Avoid deleting properties on a Vue instance or its root $data ' +
  25932. '- just set it to null.'
  25933. );
  25934. return
  25935. }
  25936. if (!hasOwn(target, key)) {
  25937. return
  25938. }
  25939. delete target[key];
  25940. if (!ob) {
  25941. return
  25942. }
  25943. ob.dep.notify();
  25944. }
  25945. /**
  25946. * Collect dependencies on array elements when the array is touched, since
  25947. * we cannot intercept array element access like property getters.
  25948. */
  25949. function dependArray (value) {
  25950. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  25951. e = value[i];
  25952. e && e.__ob__ && e.__ob__.dep.depend();
  25953. if (Array.isArray(e)) {
  25954. dependArray(e);
  25955. }
  25956. }
  25957. }
  25958. /* */
  25959. /**
  25960. * Option overwriting strategies are functions that handle
  25961. * how to merge a parent option value and a child option
  25962. * value into the final value.
  25963. */
  25964. var strats = config.optionMergeStrategies;
  25965. /**
  25966. * Options with restrictions
  25967. */
  25968. {
  25969. strats.el = strats.propsData = function (parent, child, vm, key) {
  25970. if (!vm) {
  25971. warn(
  25972. "option \"" + key + "\" can only be used during instance " +
  25973. 'creation with the `new` keyword.'
  25974. );
  25975. }
  25976. return defaultStrat(parent, child)
  25977. };
  25978. }
  25979. /**
  25980. * Helper that recursively merges two data objects together.
  25981. */
  25982. function mergeData (to, from) {
  25983. if (!from) { return to }
  25984. var key, toVal, fromVal;
  25985. var keys = Object.keys(from);
  25986. for (var i = 0; i < keys.length; i++) {
  25987. key = keys[i];
  25988. toVal = to[key];
  25989. fromVal = from[key];
  25990. if (!hasOwn(to, key)) {
  25991. set(to, key, fromVal);
  25992. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  25993. mergeData(toVal, fromVal);
  25994. }
  25995. }
  25996. return to
  25997. }
  25998. /**
  25999. * Data
  26000. */
  26001. strats.data = function (
  26002. parentVal,
  26003. childVal,
  26004. vm
  26005. ) {
  26006. if (!vm) {
  26007. // in a Vue.extend merge, both should be functions
  26008. if (!childVal) {
  26009. return parentVal
  26010. }
  26011. if (typeof childVal !== 'function') {
  26012. "development" !== 'production' && warn(
  26013. 'The "data" option should be a function ' +
  26014. 'that returns a per-instance value in component ' +
  26015. 'definitions.',
  26016. vm
  26017. );
  26018. return parentVal
  26019. }
  26020. if (!parentVal) {
  26021. return childVal
  26022. }
  26023. // when parentVal & childVal are both present,
  26024. // we need to return a function that returns the
  26025. // merged result of both functions... no need to
  26026. // check if parentVal is a function here because
  26027. // it has to be a function to pass previous merges.
  26028. return function mergedDataFn () {
  26029. return mergeData(
  26030. childVal.call(this),
  26031. parentVal.call(this)
  26032. )
  26033. }
  26034. } else if (parentVal || childVal) {
  26035. return function mergedInstanceDataFn () {
  26036. // instance merge
  26037. var instanceData = typeof childVal === 'function'
  26038. ? childVal.call(vm)
  26039. : childVal;
  26040. var defaultData = typeof parentVal === 'function'
  26041. ? parentVal.call(vm)
  26042. : undefined;
  26043. if (instanceData) {
  26044. return mergeData(instanceData, defaultData)
  26045. } else {
  26046. return defaultData
  26047. }
  26048. }
  26049. }
  26050. };
  26051. /**
  26052. * Hooks and props are merged as arrays.
  26053. */
  26054. function mergeHook (
  26055. parentVal,
  26056. childVal
  26057. ) {
  26058. return childVal
  26059. ? parentVal
  26060. ? parentVal.concat(childVal)
  26061. : Array.isArray(childVal)
  26062. ? childVal
  26063. : [childVal]
  26064. : parentVal
  26065. }
  26066. config._lifecycleHooks.forEach(function (hook) {
  26067. strats[hook] = mergeHook;
  26068. });
  26069. /**
  26070. * Assets
  26071. *
  26072. * When a vm is present (instance creation), we need to do
  26073. * a three-way merge between constructor options, instance
  26074. * options and parent options.
  26075. */
  26076. function mergeAssets (parentVal, childVal) {
  26077. var res = Object.create(parentVal || null);
  26078. return childVal
  26079. ? extend(res, childVal)
  26080. : res
  26081. }
  26082. config._assetTypes.forEach(function (type) {
  26083. strats[type + 's'] = mergeAssets;
  26084. });
  26085. /**
  26086. * Watchers.
  26087. *
  26088. * Watchers hashes should not overwrite one
  26089. * another, so we merge them as arrays.
  26090. */
  26091. strats.watch = function (parentVal, childVal) {
  26092. /* istanbul ignore if */
  26093. if (!childVal) { return Object.create(parentVal || null) }
  26094. if (!parentVal) { return childVal }
  26095. var ret = {};
  26096. extend(ret, parentVal);
  26097. for (var key in childVal) {
  26098. var parent = ret[key];
  26099. var child = childVal[key];
  26100. if (parent && !Array.isArray(parent)) {
  26101. parent = [parent];
  26102. }
  26103. ret[key] = parent
  26104. ? parent.concat(child)
  26105. : [child];
  26106. }
  26107. return ret
  26108. };
  26109. /**
  26110. * Other object hashes.
  26111. */
  26112. strats.props =
  26113. strats.methods =
  26114. strats.computed = function (parentVal, childVal) {
  26115. if (!childVal) { return Object.create(parentVal || null) }
  26116. if (!parentVal) { return childVal }
  26117. var ret = Object.create(null);
  26118. extend(ret, parentVal);
  26119. extend(ret, childVal);
  26120. return ret
  26121. };
  26122. /**
  26123. * Default strategy.
  26124. */
  26125. var defaultStrat = function (parentVal, childVal) {
  26126. return childVal === undefined
  26127. ? parentVal
  26128. : childVal
  26129. };
  26130. /**
  26131. * Validate component names
  26132. */
  26133. function checkComponents (options) {
  26134. for (var key in options.components) {
  26135. var lower = key.toLowerCase();
  26136. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  26137. warn(
  26138. 'Do not use built-in or reserved HTML elements as component ' +
  26139. 'id: ' + key
  26140. );
  26141. }
  26142. }
  26143. }
  26144. /**
  26145. * Ensure all props option syntax are normalized into the
  26146. * Object-based format.
  26147. */
  26148. function normalizeProps (options) {
  26149. var props = options.props;
  26150. if (!props) { return }
  26151. var res = {};
  26152. var i, val, name;
  26153. if (Array.isArray(props)) {
  26154. i = props.length;
  26155. while (i--) {
  26156. val = props[i];
  26157. if (typeof val === 'string') {
  26158. name = camelize(val);
  26159. res[name] = { type: null };
  26160. } else {
  26161. warn('props must be strings when using array syntax.');
  26162. }
  26163. }
  26164. } else if (isPlainObject(props)) {
  26165. for (var key in props) {
  26166. val = props[key];
  26167. name = camelize(key);
  26168. res[name] = isPlainObject(val)
  26169. ? val
  26170. : { type: val };
  26171. }
  26172. }
  26173. options.props = res;
  26174. }
  26175. /**
  26176. * Normalize raw function directives into object format.
  26177. */
  26178. function normalizeDirectives (options) {
  26179. var dirs = options.directives;
  26180. if (dirs) {
  26181. for (var key in dirs) {
  26182. var def = dirs[key];
  26183. if (typeof def === 'function') {
  26184. dirs[key] = { bind: def, update: def };
  26185. }
  26186. }
  26187. }
  26188. }
  26189. /**
  26190. * Merge two option objects into a new one.
  26191. * Core utility used in both instantiation and inheritance.
  26192. */
  26193. function mergeOptions (
  26194. parent,
  26195. child,
  26196. vm
  26197. ) {
  26198. {
  26199. checkComponents(child);
  26200. }
  26201. normalizeProps(child);
  26202. normalizeDirectives(child);
  26203. var extendsFrom = child.extends;
  26204. if (extendsFrom) {
  26205. parent = typeof extendsFrom === 'function'
  26206. ? mergeOptions(parent, extendsFrom.options, vm)
  26207. : mergeOptions(parent, extendsFrom, vm);
  26208. }
  26209. if (child.mixins) {
  26210. for (var i = 0, l = child.mixins.length; i < l; i++) {
  26211. var mixin = child.mixins[i];
  26212. if (mixin.prototype instanceof Vue$3) {
  26213. mixin = mixin.options;
  26214. }
  26215. parent = mergeOptions(parent, mixin, vm);
  26216. }
  26217. }
  26218. var options = {};
  26219. var key;
  26220. for (key in parent) {
  26221. mergeField(key);
  26222. }
  26223. for (key in child) {
  26224. if (!hasOwn(parent, key)) {
  26225. mergeField(key);
  26226. }
  26227. }
  26228. function mergeField (key) {
  26229. var strat = strats[key] || defaultStrat;
  26230. options[key] = strat(parent[key], child[key], vm, key);
  26231. }
  26232. return options
  26233. }
  26234. /**
  26235. * Resolve an asset.
  26236. * This function is used because child instances need access
  26237. * to assets defined in its ancestor chain.
  26238. */
  26239. function resolveAsset (
  26240. options,
  26241. type,
  26242. id,
  26243. warnMissing
  26244. ) {
  26245. /* istanbul ignore if */
  26246. if (typeof id !== 'string') {
  26247. return
  26248. }
  26249. var assets = options[type];
  26250. // check local registration variations first
  26251. if (hasOwn(assets, id)) { return assets[id] }
  26252. var camelizedId = camelize(id);
  26253. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  26254. var PascalCaseId = capitalize(camelizedId);
  26255. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  26256. // fallback to prototype chain
  26257. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  26258. if ("development" !== 'production' && warnMissing && !res) {
  26259. warn(
  26260. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  26261. options
  26262. );
  26263. }
  26264. return res
  26265. }
  26266. /* */
  26267. function validateProp (
  26268. key,
  26269. propOptions,
  26270. propsData,
  26271. vm
  26272. ) {
  26273. var prop = propOptions[key];
  26274. var absent = !hasOwn(propsData, key);
  26275. var value = propsData[key];
  26276. // handle boolean props
  26277. if (isType(Boolean, prop.type)) {
  26278. if (absent && !hasOwn(prop, 'default')) {
  26279. value = false;
  26280. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  26281. value = true;
  26282. }
  26283. }
  26284. // check default value
  26285. if (value === undefined) {
  26286. value = getPropDefaultValue(vm, prop, key);
  26287. // since the default value is a fresh copy,
  26288. // make sure to observe it.
  26289. var prevShouldConvert = observerState.shouldConvert;
  26290. observerState.shouldConvert = true;
  26291. observe(value);
  26292. observerState.shouldConvert = prevShouldConvert;
  26293. }
  26294. {
  26295. assertProp(prop, key, value, vm, absent);
  26296. }
  26297. return value
  26298. }
  26299. /**
  26300. * Get the default value of a prop.
  26301. */
  26302. function getPropDefaultValue (vm, prop, key) {
  26303. // no default, return undefined
  26304. if (!hasOwn(prop, 'default')) {
  26305. return undefined
  26306. }
  26307. var def = prop.default;
  26308. // warn against non-factory defaults for Object & Array
  26309. if ("development" !== 'production' && isObject(def)) {
  26310. warn(
  26311. 'Invalid default value for prop "' + key + '": ' +
  26312. 'Props with type Object/Array must use a factory function ' +
  26313. 'to return the default value.',
  26314. vm
  26315. );
  26316. }
  26317. // the raw prop value was also undefined from previous render,
  26318. // return previous default value to avoid unnecessary watcher trigger
  26319. if (vm && vm.$options.propsData &&
  26320. vm.$options.propsData[key] === undefined &&
  26321. vm._props[key] !== undefined) {
  26322. return vm._props[key]
  26323. }
  26324. // call factory function for non-Function types
  26325. // a value is Function if its prototype is function even across different execution context
  26326. return typeof def === 'function' && getType(prop.type) !== 'Function'
  26327. ? def.call(vm)
  26328. : def
  26329. }
  26330. /**
  26331. * Assert whether a prop is valid.
  26332. */
  26333. function assertProp (
  26334. prop,
  26335. name,
  26336. value,
  26337. vm,
  26338. absent
  26339. ) {
  26340. if (prop.required && absent) {
  26341. warn(
  26342. 'Missing required prop: "' + name + '"',
  26343. vm
  26344. );
  26345. return
  26346. }
  26347. if (value == null && !prop.required) {
  26348. return
  26349. }
  26350. var type = prop.type;
  26351. var valid = !type || type === true;
  26352. var expectedTypes = [];
  26353. if (type) {
  26354. if (!Array.isArray(type)) {
  26355. type = [type];
  26356. }
  26357. for (var i = 0; i < type.length && !valid; i++) {
  26358. var assertedType = assertType(value, type[i]);
  26359. expectedTypes.push(assertedType.expectedType || '');
  26360. valid = assertedType.valid;
  26361. }
  26362. }
  26363. if (!valid) {
  26364. warn(
  26365. 'Invalid prop: type check failed for prop "' + name + '".' +
  26366. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  26367. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  26368. vm
  26369. );
  26370. return
  26371. }
  26372. var validator = prop.validator;
  26373. if (validator) {
  26374. if (!validator(value)) {
  26375. warn(
  26376. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  26377. vm
  26378. );
  26379. }
  26380. }
  26381. }
  26382. /**
  26383. * Assert the type of a value
  26384. */
  26385. function assertType (value, type) {
  26386. var valid;
  26387. var expectedType = getType(type);
  26388. if (expectedType === 'String') {
  26389. valid = typeof value === (expectedType = 'string');
  26390. } else if (expectedType === 'Number') {
  26391. valid = typeof value === (expectedType = 'number');
  26392. } else if (expectedType === 'Boolean') {
  26393. valid = typeof value === (expectedType = 'boolean');
  26394. } else if (expectedType === 'Function') {
  26395. valid = typeof value === (expectedType = 'function');
  26396. } else if (expectedType === 'Object') {
  26397. valid = isPlainObject(value);
  26398. } else if (expectedType === 'Array') {
  26399. valid = Array.isArray(value);
  26400. } else {
  26401. valid = value instanceof type;
  26402. }
  26403. return {
  26404. valid: valid,
  26405. expectedType: expectedType
  26406. }
  26407. }
  26408. /**
  26409. * Use function string name to check built-in types,
  26410. * because a simple equality check will fail when running
  26411. * across different vms / iframes.
  26412. */
  26413. function getType (fn) {
  26414. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  26415. return match && match[1]
  26416. }
  26417. function isType (type, fn) {
  26418. if (!Array.isArray(fn)) {
  26419. return getType(fn) === getType(type)
  26420. }
  26421. for (var i = 0, len = fn.length; i < len; i++) {
  26422. if (getType(fn[i]) === getType(type)) {
  26423. return true
  26424. }
  26425. }
  26426. /* istanbul ignore next */
  26427. return false
  26428. }
  26429. function handleError (err, vm, info) {
  26430. if (config.errorHandler) {
  26431. config.errorHandler.call(null, err, vm, info);
  26432. } else {
  26433. {
  26434. warn(("Error in " + info + ":"), vm);
  26435. }
  26436. /* istanbul ignore else */
  26437. if (inBrowser && typeof console !== 'undefined') {
  26438. console.error(err);
  26439. } else {
  26440. throw err
  26441. }
  26442. }
  26443. }
  26444. /* not type checking this file because flow doesn't play well with Proxy */
  26445. var initProxy;
  26446. {
  26447. var allowedGlobals = makeMap(
  26448. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  26449. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  26450. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  26451. 'require' // for Webpack/Browserify
  26452. );
  26453. var warnNonPresent = function (target, key) {
  26454. warn(
  26455. "Property or method \"" + key + "\" is not defined on the instance but " +
  26456. "referenced during render. Make sure to declare reactive data " +
  26457. "properties in the data option.",
  26458. target
  26459. );
  26460. };
  26461. var hasProxy =
  26462. typeof Proxy !== 'undefined' &&
  26463. Proxy.toString().match(/native code/);
  26464. if (hasProxy) {
  26465. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  26466. config.keyCodes = new Proxy(config.keyCodes, {
  26467. set: function set (target, key, value) {
  26468. if (isBuiltInModifier(key)) {
  26469. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  26470. return false
  26471. } else {
  26472. target[key] = value;
  26473. return true
  26474. }
  26475. }
  26476. });
  26477. }
  26478. var hasHandler = {
  26479. has: function has (target, key) {
  26480. var has = key in target;
  26481. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  26482. if (!has && !isAllowed) {
  26483. warnNonPresent(target, key);
  26484. }
  26485. return has || !isAllowed
  26486. }
  26487. };
  26488. var getHandler = {
  26489. get: function get (target, key) {
  26490. if (typeof key === 'string' && !(key in target)) {
  26491. warnNonPresent(target, key);
  26492. }
  26493. return target[key]
  26494. }
  26495. };
  26496. initProxy = function initProxy (vm) {
  26497. if (hasProxy) {
  26498. // determine which proxy handler to use
  26499. var options = vm.$options;
  26500. var handlers = options.render && options.render._withStripped
  26501. ? getHandler
  26502. : hasHandler;
  26503. vm._renderProxy = new Proxy(vm, handlers);
  26504. } else {
  26505. vm._renderProxy = vm;
  26506. }
  26507. };
  26508. }
  26509. var mark;
  26510. var measure;
  26511. {
  26512. var perf = inBrowser && window.performance;
  26513. /* istanbul ignore if */
  26514. if (
  26515. perf &&
  26516. perf.mark &&
  26517. perf.measure &&
  26518. perf.clearMarks &&
  26519. perf.clearMeasures
  26520. ) {
  26521. mark = function (tag) { return perf.mark(tag); };
  26522. measure = function (name, startTag, endTag) {
  26523. perf.measure(name, startTag, endTag);
  26524. perf.clearMarks(startTag);
  26525. perf.clearMarks(endTag);
  26526. perf.clearMeasures(name);
  26527. };
  26528. }
  26529. }
  26530. /* */
  26531. var VNode = function VNode (
  26532. tag,
  26533. data,
  26534. children,
  26535. text,
  26536. elm,
  26537. context,
  26538. componentOptions
  26539. ) {
  26540. this.tag = tag;
  26541. this.data = data;
  26542. this.children = children;
  26543. this.text = text;
  26544. this.elm = elm;
  26545. this.ns = undefined;
  26546. this.context = context;
  26547. this.functionalContext = undefined;
  26548. this.key = data && data.key;
  26549. this.componentOptions = componentOptions;
  26550. this.componentInstance = undefined;
  26551. this.parent = undefined;
  26552. this.raw = false;
  26553. this.isStatic = false;
  26554. this.isRootInsert = true;
  26555. this.isComment = false;
  26556. this.isCloned = false;
  26557. this.isOnce = false;
  26558. };
  26559. var prototypeAccessors = { child: {} };
  26560. // DEPRECATED: alias for componentInstance for backwards compat.
  26561. /* istanbul ignore next */
  26562. prototypeAccessors.child.get = function () {
  26563. return this.componentInstance
  26564. };
  26565. Object.defineProperties( VNode.prototype, prototypeAccessors );
  26566. var createEmptyVNode = function () {
  26567. var node = new VNode();
  26568. node.text = '';
  26569. node.isComment = true;
  26570. return node
  26571. };
  26572. function createTextVNode (val) {
  26573. return new VNode(undefined, undefined, undefined, String(val))
  26574. }
  26575. // optimized shallow clone
  26576. // used for static nodes and slot nodes because they may be reused across
  26577. // multiple renders, cloning them avoids errors when DOM manipulations rely
  26578. // on their elm reference.
  26579. function cloneVNode (vnode) {
  26580. var cloned = new VNode(
  26581. vnode.tag,
  26582. vnode.data,
  26583. vnode.children,
  26584. vnode.text,
  26585. vnode.elm,
  26586. vnode.context,
  26587. vnode.componentOptions
  26588. );
  26589. cloned.ns = vnode.ns;
  26590. cloned.isStatic = vnode.isStatic;
  26591. cloned.key = vnode.key;
  26592. cloned.isCloned = true;
  26593. return cloned
  26594. }
  26595. function cloneVNodes (vnodes) {
  26596. var len = vnodes.length;
  26597. var res = new Array(len);
  26598. for (var i = 0; i < len; i++) {
  26599. res[i] = cloneVNode(vnodes[i]);
  26600. }
  26601. return res
  26602. }
  26603. /* */
  26604. var normalizeEvent = cached(function (name) {
  26605. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  26606. name = once$$1 ? name.slice(1) : name;
  26607. var capture = name.charAt(0) === '!';
  26608. name = capture ? name.slice(1) : name;
  26609. return {
  26610. name: name,
  26611. once: once$$1,
  26612. capture: capture
  26613. }
  26614. });
  26615. function createFnInvoker (fns) {
  26616. function invoker () {
  26617. var arguments$1 = arguments;
  26618. var fns = invoker.fns;
  26619. if (Array.isArray(fns)) {
  26620. for (var i = 0; i < fns.length; i++) {
  26621. fns[i].apply(null, arguments$1);
  26622. }
  26623. } else {
  26624. // return handler return value for single handlers
  26625. return fns.apply(null, arguments)
  26626. }
  26627. }
  26628. invoker.fns = fns;
  26629. return invoker
  26630. }
  26631. function updateListeners (
  26632. on,
  26633. oldOn,
  26634. add,
  26635. remove$$1,
  26636. vm
  26637. ) {
  26638. var name, cur, old, event;
  26639. for (name in on) {
  26640. cur = on[name];
  26641. old = oldOn[name];
  26642. event = normalizeEvent(name);
  26643. if (!cur) {
  26644. "development" !== 'production' && warn(
  26645. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  26646. vm
  26647. );
  26648. } else if (!old) {
  26649. if (!cur.fns) {
  26650. cur = on[name] = createFnInvoker(cur);
  26651. }
  26652. add(event.name, cur, event.once, event.capture);
  26653. } else if (cur !== old) {
  26654. old.fns = cur;
  26655. on[name] = old;
  26656. }
  26657. }
  26658. for (name in oldOn) {
  26659. if (!on[name]) {
  26660. event = normalizeEvent(name);
  26661. remove$$1(event.name, oldOn[name], event.capture);
  26662. }
  26663. }
  26664. }
  26665. /* */
  26666. function mergeVNodeHook (def, hookKey, hook) {
  26667. var invoker;
  26668. var oldHook = def[hookKey];
  26669. function wrappedHook () {
  26670. hook.apply(this, arguments);
  26671. // important: remove merged hook to ensure it's called only once
  26672. // and prevent memory leak
  26673. remove(invoker.fns, wrappedHook);
  26674. }
  26675. if (!oldHook) {
  26676. // no existing hook
  26677. invoker = createFnInvoker([wrappedHook]);
  26678. } else {
  26679. /* istanbul ignore if */
  26680. if (oldHook.fns && oldHook.merged) {
  26681. // already a merged invoker
  26682. invoker = oldHook;
  26683. invoker.fns.push(wrappedHook);
  26684. } else {
  26685. // existing plain hook
  26686. invoker = createFnInvoker([oldHook, wrappedHook]);
  26687. }
  26688. }
  26689. invoker.merged = true;
  26690. def[hookKey] = invoker;
  26691. }
  26692. /* */
  26693. // The template compiler attempts to minimize the need for normalization by
  26694. // statically analyzing the template at compile time.
  26695. //
  26696. // For plain HTML markup, normalization can be completely skipped because the
  26697. // generated render function is guaranteed to return Array<VNode>. There are
  26698. // two cases where extra normalization is needed:
  26699. // 1. When the children contains components - because a functional component
  26700. // may return an Array instead of a single root. In this case, just a simple
  26701. // normalization is needed - if any child is an Array, we flatten the whole
  26702. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  26703. // because functional components already normalize their own children.
  26704. function simpleNormalizeChildren (children) {
  26705. for (var i = 0; i < children.length; i++) {
  26706. if (Array.isArray(children[i])) {
  26707. return Array.prototype.concat.apply([], children)
  26708. }
  26709. }
  26710. return children
  26711. }
  26712. // 2. When the children contains constructs that always generated nested Arrays,
  26713. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  26714. // with hand-written render functions / JSX. In such cases a full normalization
  26715. // is needed to cater to all possible types of children values.
  26716. function normalizeChildren (children) {
  26717. return isPrimitive(children)
  26718. ? [createTextVNode(children)]
  26719. : Array.isArray(children)
  26720. ? normalizeArrayChildren(children)
  26721. : undefined
  26722. }
  26723. function normalizeArrayChildren (children, nestedIndex) {
  26724. var res = [];
  26725. var i, c, last;
  26726. for (i = 0; i < children.length; i++) {
  26727. c = children[i];
  26728. if (c == null || typeof c === 'boolean') { continue }
  26729. last = res[res.length - 1];
  26730. // nested
  26731. if (Array.isArray(c)) {
  26732. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  26733. } else if (isPrimitive(c)) {
  26734. if (last && last.text) {
  26735. last.text += String(c);
  26736. } else if (c !== '') {
  26737. // convert primitive to vnode
  26738. res.push(createTextVNode(c));
  26739. }
  26740. } else {
  26741. if (c.text && last && last.text) {
  26742. res[res.length - 1] = createTextVNode(last.text + c.text);
  26743. } else {
  26744. // default key for nested array children (likely generated by v-for)
  26745. if (c.tag && c.key == null && nestedIndex != null) {
  26746. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  26747. }
  26748. res.push(c);
  26749. }
  26750. }
  26751. }
  26752. return res
  26753. }
  26754. /* */
  26755. function getFirstComponentChild (children) {
  26756. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  26757. }
  26758. /* */
  26759. function initEvents (vm) {
  26760. vm._events = Object.create(null);
  26761. vm._hasHookEvent = false;
  26762. // init parent attached events
  26763. var listeners = vm.$options._parentListeners;
  26764. if (listeners) {
  26765. updateComponentListeners(vm, listeners);
  26766. }
  26767. }
  26768. var target;
  26769. function add (event, fn, once$$1) {
  26770. if (once$$1) {
  26771. target.$once(event, fn);
  26772. } else {
  26773. target.$on(event, fn);
  26774. }
  26775. }
  26776. function remove$1 (event, fn) {
  26777. target.$off(event, fn);
  26778. }
  26779. function updateComponentListeners (
  26780. vm,
  26781. listeners,
  26782. oldListeners
  26783. ) {
  26784. target = vm;
  26785. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  26786. }
  26787. function eventsMixin (Vue) {
  26788. var hookRE = /^hook:/;
  26789. Vue.prototype.$on = function (event, fn) {
  26790. var this$1 = this;
  26791. var vm = this;
  26792. if (Array.isArray(event)) {
  26793. for (var i = 0, l = event.length; i < l; i++) {
  26794. this$1.$on(event[i], fn);
  26795. }
  26796. } else {
  26797. (vm._events[event] || (vm._events[event] = [])).push(fn);
  26798. // optimize hook:event cost by using a boolean flag marked at registration
  26799. // instead of a hash lookup
  26800. if (hookRE.test(event)) {
  26801. vm._hasHookEvent = true;
  26802. }
  26803. }
  26804. return vm
  26805. };
  26806. Vue.prototype.$once = function (event, fn) {
  26807. var vm = this;
  26808. function on () {
  26809. vm.$off(event, on);
  26810. fn.apply(vm, arguments);
  26811. }
  26812. on.fn = fn;
  26813. vm.$on(event, on);
  26814. return vm
  26815. };
  26816. Vue.prototype.$off = function (event, fn) {
  26817. var this$1 = this;
  26818. var vm = this;
  26819. // all
  26820. if (!arguments.length) {
  26821. vm._events = Object.create(null);
  26822. return vm
  26823. }
  26824. // array of events
  26825. if (Array.isArray(event)) {
  26826. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  26827. this$1.$off(event[i$1], fn);
  26828. }
  26829. return vm
  26830. }
  26831. // specific event
  26832. var cbs = vm._events[event];
  26833. if (!cbs) {
  26834. return vm
  26835. }
  26836. if (arguments.length === 1) {
  26837. vm._events[event] = null;
  26838. return vm
  26839. }
  26840. // specific handler
  26841. var cb;
  26842. var i = cbs.length;
  26843. while (i--) {
  26844. cb = cbs[i];
  26845. if (cb === fn || cb.fn === fn) {
  26846. cbs.splice(i, 1);
  26847. break
  26848. }
  26849. }
  26850. return vm
  26851. };
  26852. Vue.prototype.$emit = function (event) {
  26853. var vm = this;
  26854. {
  26855. var lowerCaseEvent = event.toLowerCase();
  26856. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  26857. tip(
  26858. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  26859. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  26860. "Note that HTML attributes are case-insensitive and you cannot use " +
  26861. "v-on to listen to camelCase events when using in-DOM templates. " +
  26862. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  26863. );
  26864. }
  26865. }
  26866. var cbs = vm._events[event];
  26867. if (cbs) {
  26868. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  26869. var args = toArray(arguments, 1);
  26870. for (var i = 0, l = cbs.length; i < l; i++) {
  26871. cbs[i].apply(vm, args);
  26872. }
  26873. }
  26874. return vm
  26875. };
  26876. }
  26877. /* */
  26878. /**
  26879. * Runtime helper for resolving raw children VNodes into a slot object.
  26880. */
  26881. function resolveSlots (
  26882. children,
  26883. context
  26884. ) {
  26885. var slots = {};
  26886. if (!children) {
  26887. return slots
  26888. }
  26889. var defaultSlot = [];
  26890. var name, child;
  26891. for (var i = 0, l = children.length; i < l; i++) {
  26892. child = children[i];
  26893. // named slots should only be respected if the vnode was rendered in the
  26894. // same context.
  26895. if ((child.context === context || child.functionalContext === context) &&
  26896. child.data && (name = child.data.slot)) {
  26897. var slot = (slots[name] || (slots[name] = []));
  26898. if (child.tag === 'template') {
  26899. slot.push.apply(slot, child.children);
  26900. } else {
  26901. slot.push(child);
  26902. }
  26903. } else {
  26904. defaultSlot.push(child);
  26905. }
  26906. }
  26907. // ignore whitespace
  26908. if (!defaultSlot.every(isWhitespace)) {
  26909. slots.default = defaultSlot;
  26910. }
  26911. return slots
  26912. }
  26913. function isWhitespace (node) {
  26914. return node.isComment || node.text === ' '
  26915. }
  26916. function resolveScopedSlots (
  26917. fns
  26918. ) {
  26919. var res = {};
  26920. for (var i = 0; i < fns.length; i++) {
  26921. res[fns[i][0]] = fns[i][1];
  26922. }
  26923. return res
  26924. }
  26925. /* */
  26926. var activeInstance = null;
  26927. function initLifecycle (vm) {
  26928. var options = vm.$options;
  26929. // locate first non-abstract parent
  26930. var parent = options.parent;
  26931. if (parent && !options.abstract) {
  26932. while (parent.$options.abstract && parent.$parent) {
  26933. parent = parent.$parent;
  26934. }
  26935. parent.$children.push(vm);
  26936. }
  26937. vm.$parent = parent;
  26938. vm.$root = parent ? parent.$root : vm;
  26939. vm.$children = [];
  26940. vm.$refs = {};
  26941. vm._watcher = null;
  26942. vm._inactive = null;
  26943. vm._directInactive = false;
  26944. vm._isMounted = false;
  26945. vm._isDestroyed = false;
  26946. vm._isBeingDestroyed = false;
  26947. }
  26948. function lifecycleMixin (Vue) {
  26949. Vue.prototype._update = function (vnode, hydrating) {
  26950. var vm = this;
  26951. if (vm._isMounted) {
  26952. callHook(vm, 'beforeUpdate');
  26953. }
  26954. var prevEl = vm.$el;
  26955. var prevVnode = vm._vnode;
  26956. var prevActiveInstance = activeInstance;
  26957. activeInstance = vm;
  26958. vm._vnode = vnode;
  26959. // Vue.prototype.__patch__ is injected in entry points
  26960. // based on the rendering backend used.
  26961. if (!prevVnode) {
  26962. // initial render
  26963. vm.$el = vm.__patch__(
  26964. vm.$el, vnode, hydrating, false /* removeOnly */,
  26965. vm.$options._parentElm,
  26966. vm.$options._refElm
  26967. );
  26968. } else {
  26969. // updates
  26970. vm.$el = vm.__patch__(prevVnode, vnode);
  26971. }
  26972. activeInstance = prevActiveInstance;
  26973. // update __vue__ reference
  26974. if (prevEl) {
  26975. prevEl.__vue__ = null;
  26976. }
  26977. if (vm.$el) {
  26978. vm.$el.__vue__ = vm;
  26979. }
  26980. // if parent is an HOC, update its $el as well
  26981. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  26982. vm.$parent.$el = vm.$el;
  26983. }
  26984. // updated hook is called by the scheduler to ensure that children are
  26985. // updated in a parent's updated hook.
  26986. };
  26987. Vue.prototype.$forceUpdate = function () {
  26988. var vm = this;
  26989. if (vm._watcher) {
  26990. vm._watcher.update();
  26991. }
  26992. };
  26993. Vue.prototype.$destroy = function () {
  26994. var vm = this;
  26995. if (vm._isBeingDestroyed) {
  26996. return
  26997. }
  26998. callHook(vm, 'beforeDestroy');
  26999. vm._isBeingDestroyed = true;
  27000. // remove self from parent
  27001. var parent = vm.$parent;
  27002. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  27003. remove(parent.$children, vm);
  27004. }
  27005. // teardown watchers
  27006. if (vm._watcher) {
  27007. vm._watcher.teardown();
  27008. }
  27009. var i = vm._watchers.length;
  27010. while (i--) {
  27011. vm._watchers[i].teardown();
  27012. }
  27013. // remove reference from data ob
  27014. // frozen object may not have observer.
  27015. if (vm._data.__ob__) {
  27016. vm._data.__ob__.vmCount--;
  27017. }
  27018. // call the last hook...
  27019. vm._isDestroyed = true;
  27020. callHook(vm, 'destroyed');
  27021. // turn off all instance listeners.
  27022. vm.$off();
  27023. // remove __vue__ reference
  27024. if (vm.$el) {
  27025. vm.$el.__vue__ = null;
  27026. }
  27027. // invoke destroy hooks on current rendered tree
  27028. vm.__patch__(vm._vnode, null);
  27029. };
  27030. }
  27031. function mountComponent (
  27032. vm,
  27033. el,
  27034. hydrating
  27035. ) {
  27036. vm.$el = el;
  27037. if (!vm.$options.render) {
  27038. vm.$options.render = createEmptyVNode;
  27039. {
  27040. /* istanbul ignore if */
  27041. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  27042. vm.$options.el || el) {
  27043. warn(
  27044. 'You are using the runtime-only build of Vue where the template ' +
  27045. 'compiler is not available. Either pre-compile the templates into ' +
  27046. 'render functions, or use the compiler-included build.',
  27047. vm
  27048. );
  27049. } else {
  27050. warn(
  27051. 'Failed to mount component: template or render function not defined.',
  27052. vm
  27053. );
  27054. }
  27055. }
  27056. }
  27057. callHook(vm, 'beforeMount');
  27058. var updateComponent;
  27059. /* istanbul ignore if */
  27060. if ("development" !== 'production' && config.performance && mark) {
  27061. updateComponent = function () {
  27062. var name = vm._name;
  27063. var id = vm._uid;
  27064. var startTag = "vue-perf-start:" + id;
  27065. var endTag = "vue-perf-end:" + id;
  27066. mark(startTag);
  27067. var vnode = vm._render();
  27068. mark(endTag);
  27069. measure((name + " render"), startTag, endTag);
  27070. mark(startTag);
  27071. vm._update(vnode, hydrating);
  27072. mark(endTag);
  27073. measure((name + " patch"), startTag, endTag);
  27074. };
  27075. } else {
  27076. updateComponent = function () {
  27077. vm._update(vm._render(), hydrating);
  27078. };
  27079. }
  27080. vm._watcher = new Watcher(vm, updateComponent, noop);
  27081. hydrating = false;
  27082. // manually mounted instance, call mounted on self
  27083. // mounted is called for render-created child components in its inserted hook
  27084. if (vm.$vnode == null) {
  27085. vm._isMounted = true;
  27086. callHook(vm, 'mounted');
  27087. }
  27088. return vm
  27089. }
  27090. function updateChildComponent (
  27091. vm,
  27092. propsData,
  27093. listeners,
  27094. parentVnode,
  27095. renderChildren
  27096. ) {
  27097. // determine whether component has slot children
  27098. // we need to do this before overwriting $options._renderChildren
  27099. var hasChildren = !!(
  27100. renderChildren || // has new static slots
  27101. vm.$options._renderChildren || // has old static slots
  27102. parentVnode.data.scopedSlots || // has new scoped slots
  27103. vm.$scopedSlots !== emptyObject // has old scoped slots
  27104. );
  27105. vm.$options._parentVnode = parentVnode;
  27106. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  27107. if (vm._vnode) { // update child tree's parent
  27108. vm._vnode.parent = parentVnode;
  27109. }
  27110. vm.$options._renderChildren = renderChildren;
  27111. // update props
  27112. if (propsData && vm.$options.props) {
  27113. observerState.shouldConvert = false;
  27114. {
  27115. observerState.isSettingProps = true;
  27116. }
  27117. var props = vm._props;
  27118. var propKeys = vm.$options._propKeys || [];
  27119. for (var i = 0; i < propKeys.length; i++) {
  27120. var key = propKeys[i];
  27121. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  27122. }
  27123. observerState.shouldConvert = true;
  27124. {
  27125. observerState.isSettingProps = false;
  27126. }
  27127. // keep a copy of raw propsData
  27128. vm.$options.propsData = propsData;
  27129. }
  27130. // update listeners
  27131. if (listeners) {
  27132. var oldListeners = vm.$options._parentListeners;
  27133. vm.$options._parentListeners = listeners;
  27134. updateComponentListeners(vm, listeners, oldListeners);
  27135. }
  27136. // resolve slots + force update if has children
  27137. if (hasChildren) {
  27138. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  27139. vm.$forceUpdate();
  27140. }
  27141. }
  27142. function isInInactiveTree (vm) {
  27143. while (vm && (vm = vm.$parent)) {
  27144. if (vm._inactive) { return true }
  27145. }
  27146. return false
  27147. }
  27148. function activateChildComponent (vm, direct) {
  27149. if (direct) {
  27150. vm._directInactive = false;
  27151. if (isInInactiveTree(vm)) {
  27152. return
  27153. }
  27154. } else if (vm._directInactive) {
  27155. return
  27156. }
  27157. if (vm._inactive || vm._inactive == null) {
  27158. vm._inactive = false;
  27159. for (var i = 0; i < vm.$children.length; i++) {
  27160. activateChildComponent(vm.$children[i]);
  27161. }
  27162. callHook(vm, 'activated');
  27163. }
  27164. }
  27165. function deactivateChildComponent (vm, direct) {
  27166. if (direct) {
  27167. vm._directInactive = true;
  27168. if (isInInactiveTree(vm)) {
  27169. return
  27170. }
  27171. }
  27172. if (!vm._inactive) {
  27173. vm._inactive = true;
  27174. for (var i = 0; i < vm.$children.length; i++) {
  27175. deactivateChildComponent(vm.$children[i]);
  27176. }
  27177. callHook(vm, 'deactivated');
  27178. }
  27179. }
  27180. function callHook (vm, hook) {
  27181. var handlers = vm.$options[hook];
  27182. if (handlers) {
  27183. for (var i = 0, j = handlers.length; i < j; i++) {
  27184. try {
  27185. handlers[i].call(vm);
  27186. } catch (e) {
  27187. handleError(e, vm, (hook + " hook"));
  27188. }
  27189. }
  27190. }
  27191. if (vm._hasHookEvent) {
  27192. vm.$emit('hook:' + hook);
  27193. }
  27194. }
  27195. /* */
  27196. var queue = [];
  27197. var has = {};
  27198. var circular = {};
  27199. var waiting = false;
  27200. var flushing = false;
  27201. var index = 0;
  27202. /**
  27203. * Reset the scheduler's state.
  27204. */
  27205. function resetSchedulerState () {
  27206. queue.length = 0;
  27207. has = {};
  27208. {
  27209. circular = {};
  27210. }
  27211. waiting = flushing = false;
  27212. }
  27213. /**
  27214. * Flush both queues and run the watchers.
  27215. */
  27216. function flushSchedulerQueue () {
  27217. flushing = true;
  27218. var watcher, id, vm;
  27219. // Sort queue before flush.
  27220. // This ensures that:
  27221. // 1. Components are updated from parent to child. (because parent is always
  27222. // created before the child)
  27223. // 2. A component's user watchers are run before its render watcher (because
  27224. // user watchers are created before the render watcher)
  27225. // 3. If a component is destroyed during a parent component's watcher run,
  27226. // its watchers can be skipped.
  27227. queue.sort(function (a, b) { return a.id - b.id; });
  27228. // do not cache length because more watchers might be pushed
  27229. // as we run existing watchers
  27230. for (index = 0; index < queue.length; index++) {
  27231. watcher = queue[index];
  27232. id = watcher.id;
  27233. has[id] = null;
  27234. watcher.run();
  27235. // in dev build, check and stop circular updates.
  27236. if ("development" !== 'production' && has[id] != null) {
  27237. circular[id] = (circular[id] || 0) + 1;
  27238. if (circular[id] > config._maxUpdateCount) {
  27239. warn(
  27240. 'You may have an infinite update loop ' + (
  27241. watcher.user
  27242. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  27243. : "in a component render function."
  27244. ),
  27245. watcher.vm
  27246. );
  27247. break
  27248. }
  27249. }
  27250. }
  27251. // reset scheduler before updated hook called
  27252. var oldQueue = queue.slice();
  27253. resetSchedulerState();
  27254. // call updated hooks
  27255. index = oldQueue.length;
  27256. while (index--) {
  27257. watcher = oldQueue[index];
  27258. vm = watcher.vm;
  27259. if (vm._watcher === watcher && vm._isMounted) {
  27260. callHook(vm, 'updated');
  27261. }
  27262. }
  27263. // devtool hook
  27264. /* istanbul ignore if */
  27265. if (devtools && config.devtools) {
  27266. devtools.emit('flush');
  27267. }
  27268. }
  27269. /**
  27270. * Push a watcher into the watcher queue.
  27271. * Jobs with duplicate IDs will be skipped unless it's
  27272. * pushed when the queue is being flushed.
  27273. */
  27274. function queueWatcher (watcher) {
  27275. var id = watcher.id;
  27276. if (has[id] == null) {
  27277. has[id] = true;
  27278. if (!flushing) {
  27279. queue.push(watcher);
  27280. } else {
  27281. // if already flushing, splice the watcher based on its id
  27282. // if already past its id, it will be run next immediately.
  27283. var i = queue.length - 1;
  27284. while (i >= 0 && queue[i].id > watcher.id) {
  27285. i--;
  27286. }
  27287. queue.splice(Math.max(i, index) + 1, 0, watcher);
  27288. }
  27289. // queue the flush
  27290. if (!waiting) {
  27291. waiting = true;
  27292. nextTick(flushSchedulerQueue);
  27293. }
  27294. }
  27295. }
  27296. /* */
  27297. var uid$2 = 0;
  27298. /**
  27299. * A watcher parses an expression, collects dependencies,
  27300. * and fires callback when the expression value changes.
  27301. * This is used for both the $watch() api and directives.
  27302. */
  27303. var Watcher = function Watcher (
  27304. vm,
  27305. expOrFn,
  27306. cb,
  27307. options
  27308. ) {
  27309. this.vm = vm;
  27310. vm._watchers.push(this);
  27311. // options
  27312. if (options) {
  27313. this.deep = !!options.deep;
  27314. this.user = !!options.user;
  27315. this.lazy = !!options.lazy;
  27316. this.sync = !!options.sync;
  27317. } else {
  27318. this.deep = this.user = this.lazy = this.sync = false;
  27319. }
  27320. this.cb = cb;
  27321. this.id = ++uid$2; // uid for batching
  27322. this.active = true;
  27323. this.dirty = this.lazy; // for lazy watchers
  27324. this.deps = [];
  27325. this.newDeps = [];
  27326. this.depIds = new _Set();
  27327. this.newDepIds = new _Set();
  27328. this.expression = expOrFn.toString();
  27329. // parse expression for getter
  27330. if (typeof expOrFn === 'function') {
  27331. this.getter = expOrFn;
  27332. } else {
  27333. this.getter = parsePath(expOrFn);
  27334. if (!this.getter) {
  27335. this.getter = function () {};
  27336. "development" !== 'production' && warn(
  27337. "Failed watching path: \"" + expOrFn + "\" " +
  27338. 'Watcher only accepts simple dot-delimited paths. ' +
  27339. 'For full control, use a function instead.',
  27340. vm
  27341. );
  27342. }
  27343. }
  27344. this.value = this.lazy
  27345. ? undefined
  27346. : this.get();
  27347. };
  27348. /**
  27349. * Evaluate the getter, and re-collect dependencies.
  27350. */
  27351. Watcher.prototype.get = function get () {
  27352. pushTarget(this);
  27353. var value;
  27354. var vm = this.vm;
  27355. if (this.user) {
  27356. try {
  27357. value = this.getter.call(vm, vm);
  27358. } catch (e) {
  27359. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  27360. }
  27361. } else {
  27362. value = this.getter.call(vm, vm);
  27363. }
  27364. // "touch" every property so they are all tracked as
  27365. // dependencies for deep watching
  27366. if (this.deep) {
  27367. traverse(value);
  27368. }
  27369. popTarget();
  27370. this.cleanupDeps();
  27371. return value
  27372. };
  27373. /**
  27374. * Add a dependency to this directive.
  27375. */
  27376. Watcher.prototype.addDep = function addDep (dep) {
  27377. var id = dep.id;
  27378. if (!this.newDepIds.has(id)) {
  27379. this.newDepIds.add(id);
  27380. this.newDeps.push(dep);
  27381. if (!this.depIds.has(id)) {
  27382. dep.addSub(this);
  27383. }
  27384. }
  27385. };
  27386. /**
  27387. * Clean up for dependency collection.
  27388. */
  27389. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  27390. var this$1 = this;
  27391. var i = this.deps.length;
  27392. while (i--) {
  27393. var dep = this$1.deps[i];
  27394. if (!this$1.newDepIds.has(dep.id)) {
  27395. dep.removeSub(this$1);
  27396. }
  27397. }
  27398. var tmp = this.depIds;
  27399. this.depIds = this.newDepIds;
  27400. this.newDepIds = tmp;
  27401. this.newDepIds.clear();
  27402. tmp = this.deps;
  27403. this.deps = this.newDeps;
  27404. this.newDeps = tmp;
  27405. this.newDeps.length = 0;
  27406. };
  27407. /**
  27408. * Subscriber interface.
  27409. * Will be called when a dependency changes.
  27410. */
  27411. Watcher.prototype.update = function update () {
  27412. /* istanbul ignore else */
  27413. if (this.lazy) {
  27414. this.dirty = true;
  27415. } else if (this.sync) {
  27416. this.run();
  27417. } else {
  27418. queueWatcher(this);
  27419. }
  27420. };
  27421. /**
  27422. * Scheduler job interface.
  27423. * Will be called by the scheduler.
  27424. */
  27425. Watcher.prototype.run = function run () {
  27426. if (this.active) {
  27427. var value = this.get();
  27428. if (
  27429. value !== this.value ||
  27430. // Deep watchers and watchers on Object/Arrays should fire even
  27431. // when the value is the same, because the value may
  27432. // have mutated.
  27433. isObject(value) ||
  27434. this.deep
  27435. ) {
  27436. // set new value
  27437. var oldValue = this.value;
  27438. this.value = value;
  27439. if (this.user) {
  27440. try {
  27441. this.cb.call(this.vm, value, oldValue);
  27442. } catch (e) {
  27443. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  27444. }
  27445. } else {
  27446. this.cb.call(this.vm, value, oldValue);
  27447. }
  27448. }
  27449. }
  27450. };
  27451. /**
  27452. * Evaluate the value of the watcher.
  27453. * This only gets called for lazy watchers.
  27454. */
  27455. Watcher.prototype.evaluate = function evaluate () {
  27456. this.value = this.get();
  27457. this.dirty = false;
  27458. };
  27459. /**
  27460. * Depend on all deps collected by this watcher.
  27461. */
  27462. Watcher.prototype.depend = function depend () {
  27463. var this$1 = this;
  27464. var i = this.deps.length;
  27465. while (i--) {
  27466. this$1.deps[i].depend();
  27467. }
  27468. };
  27469. /**
  27470. * Remove self from all dependencies' subscriber list.
  27471. */
  27472. Watcher.prototype.teardown = function teardown () {
  27473. var this$1 = this;
  27474. if (this.active) {
  27475. // remove self from vm's watcher list
  27476. // this is a somewhat expensive operation so we skip it
  27477. // if the vm is being destroyed.
  27478. if (!this.vm._isBeingDestroyed) {
  27479. remove(this.vm._watchers, this);
  27480. }
  27481. var i = this.deps.length;
  27482. while (i--) {
  27483. this$1.deps[i].removeSub(this$1);
  27484. }
  27485. this.active = false;
  27486. }
  27487. };
  27488. /**
  27489. * Recursively traverse an object to evoke all converted
  27490. * getters, so that every nested property inside the object
  27491. * is collected as a "deep" dependency.
  27492. */
  27493. var seenObjects = new _Set();
  27494. function traverse (val) {
  27495. seenObjects.clear();
  27496. _traverse(val, seenObjects);
  27497. }
  27498. function _traverse (val, seen) {
  27499. var i, keys;
  27500. var isA = Array.isArray(val);
  27501. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  27502. return
  27503. }
  27504. if (val.__ob__) {
  27505. var depId = val.__ob__.dep.id;
  27506. if (seen.has(depId)) {
  27507. return
  27508. }
  27509. seen.add(depId);
  27510. }
  27511. if (isA) {
  27512. i = val.length;
  27513. while (i--) { _traverse(val[i], seen); }
  27514. } else {
  27515. keys = Object.keys(val);
  27516. i = keys.length;
  27517. while (i--) { _traverse(val[keys[i]], seen); }
  27518. }
  27519. }
  27520. /* */
  27521. var sharedPropertyDefinition = {
  27522. enumerable: true,
  27523. configurable: true,
  27524. get: noop,
  27525. set: noop
  27526. };
  27527. function proxy (target, sourceKey, key) {
  27528. sharedPropertyDefinition.get = function proxyGetter () {
  27529. return this[sourceKey][key]
  27530. };
  27531. sharedPropertyDefinition.set = function proxySetter (val) {
  27532. this[sourceKey][key] = val;
  27533. };
  27534. Object.defineProperty(target, key, sharedPropertyDefinition);
  27535. }
  27536. function initState (vm) {
  27537. vm._watchers = [];
  27538. var opts = vm.$options;
  27539. if (opts.props) { initProps(vm, opts.props); }
  27540. if (opts.methods) { initMethods(vm, opts.methods); }
  27541. if (opts.data) {
  27542. initData(vm);
  27543. } else {
  27544. observe(vm._data = {}, true /* asRootData */);
  27545. }
  27546. if (opts.computed) { initComputed(vm, opts.computed); }
  27547. if (opts.watch) { initWatch(vm, opts.watch); }
  27548. }
  27549. var isReservedProp = { key: 1, ref: 1, slot: 1 };
  27550. function initProps (vm, propsOptions) {
  27551. var propsData = vm.$options.propsData || {};
  27552. var props = vm._props = {};
  27553. // cache prop keys so that future props updates can iterate using Array
  27554. // instead of dynamic object key enumeration.
  27555. var keys = vm.$options._propKeys = [];
  27556. var isRoot = !vm.$parent;
  27557. // root instance props should be converted
  27558. observerState.shouldConvert = isRoot;
  27559. var loop = function ( key ) {
  27560. keys.push(key);
  27561. var value = validateProp(key, propsOptions, propsData, vm);
  27562. /* istanbul ignore else */
  27563. {
  27564. if (isReservedProp[key]) {
  27565. warn(
  27566. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  27567. vm
  27568. );
  27569. }
  27570. defineReactive$$1(props, key, value, function () {
  27571. if (vm.$parent && !observerState.isSettingProps) {
  27572. warn(
  27573. "Avoid mutating a prop directly since the value will be " +
  27574. "overwritten whenever the parent component re-renders. " +
  27575. "Instead, use a data or computed property based on the prop's " +
  27576. "value. Prop being mutated: \"" + key + "\"",
  27577. vm
  27578. );
  27579. }
  27580. });
  27581. }
  27582. // static props are already proxied on the component's prototype
  27583. // during Vue.extend(). We only need to proxy props defined at
  27584. // instantiation here.
  27585. if (!(key in vm)) {
  27586. proxy(vm, "_props", key);
  27587. }
  27588. };
  27589. for (var key in propsOptions) loop( key );
  27590. observerState.shouldConvert = true;
  27591. }
  27592. function initData (vm) {
  27593. var data = vm.$options.data;
  27594. data = vm._data = typeof data === 'function'
  27595. ? getData(data, vm)
  27596. : data || {};
  27597. if (!isPlainObject(data)) {
  27598. data = {};
  27599. "development" !== 'production' && warn(
  27600. 'data functions should return an object:\n' +
  27601. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  27602. vm
  27603. );
  27604. }
  27605. // proxy data on instance
  27606. var keys = Object.keys(data);
  27607. var props = vm.$options.props;
  27608. var i = keys.length;
  27609. while (i--) {
  27610. if (props && hasOwn(props, keys[i])) {
  27611. "development" !== 'production' && warn(
  27612. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  27613. "Use prop default value instead.",
  27614. vm
  27615. );
  27616. } else if (!isReserved(keys[i])) {
  27617. proxy(vm, "_data", keys[i]);
  27618. }
  27619. }
  27620. // observe data
  27621. observe(data, true /* asRootData */);
  27622. }
  27623. function getData (data, vm) {
  27624. try {
  27625. return data.call(vm)
  27626. } catch (e) {
  27627. handleError(e, vm, "data()");
  27628. return {}
  27629. }
  27630. }
  27631. var computedWatcherOptions = { lazy: true };
  27632. function initComputed (vm, computed) {
  27633. var watchers = vm._computedWatchers = Object.create(null);
  27634. for (var key in computed) {
  27635. var userDef = computed[key];
  27636. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  27637. // create internal watcher for the computed property.
  27638. watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
  27639. // component-defined computed properties are already defined on the
  27640. // component prototype. We only need to define computed properties defined
  27641. // at instantiation here.
  27642. if (!(key in vm)) {
  27643. defineComputed(vm, key, userDef);
  27644. }
  27645. }
  27646. }
  27647. function defineComputed (target, key, userDef) {
  27648. if (typeof userDef === 'function') {
  27649. sharedPropertyDefinition.get = createComputedGetter(key);
  27650. sharedPropertyDefinition.set = noop;
  27651. } else {
  27652. sharedPropertyDefinition.get = userDef.get
  27653. ? userDef.cache !== false
  27654. ? createComputedGetter(key)
  27655. : userDef.get
  27656. : noop;
  27657. sharedPropertyDefinition.set = userDef.set
  27658. ? userDef.set
  27659. : noop;
  27660. }
  27661. Object.defineProperty(target, key, sharedPropertyDefinition);
  27662. }
  27663. function createComputedGetter (key) {
  27664. return function computedGetter () {
  27665. var watcher = this._computedWatchers && this._computedWatchers[key];
  27666. if (watcher) {
  27667. if (watcher.dirty) {
  27668. watcher.evaluate();
  27669. }
  27670. if (Dep.target) {
  27671. watcher.depend();
  27672. }
  27673. return watcher.value
  27674. }
  27675. }
  27676. }
  27677. function initMethods (vm, methods) {
  27678. var props = vm.$options.props;
  27679. for (var key in methods) {
  27680. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  27681. {
  27682. if (methods[key] == null) {
  27683. warn(
  27684. "method \"" + key + "\" has an undefined value in the component definition. " +
  27685. "Did you reference the function correctly?",
  27686. vm
  27687. );
  27688. }
  27689. if (props && hasOwn(props, key)) {
  27690. warn(
  27691. ("method \"" + key + "\" has already been defined as a prop."),
  27692. vm
  27693. );
  27694. }
  27695. }
  27696. }
  27697. }
  27698. function initWatch (vm, watch) {
  27699. for (var key in watch) {
  27700. var handler = watch[key];
  27701. if (Array.isArray(handler)) {
  27702. for (var i = 0; i < handler.length; i++) {
  27703. createWatcher(vm, key, handler[i]);
  27704. }
  27705. } else {
  27706. createWatcher(vm, key, handler);
  27707. }
  27708. }
  27709. }
  27710. function createWatcher (vm, key, handler) {
  27711. var options;
  27712. if (isPlainObject(handler)) {
  27713. options = handler;
  27714. handler = handler.handler;
  27715. }
  27716. if (typeof handler === 'string') {
  27717. handler = vm[handler];
  27718. }
  27719. vm.$watch(key, handler, options);
  27720. }
  27721. function stateMixin (Vue) {
  27722. // flow somehow has problems with directly declared definition object
  27723. // when using Object.defineProperty, so we have to procedurally build up
  27724. // the object here.
  27725. var dataDef = {};
  27726. dataDef.get = function () { return this._data };
  27727. var propsDef = {};
  27728. propsDef.get = function () { return this._props };
  27729. {
  27730. dataDef.set = function (newData) {
  27731. warn(
  27732. 'Avoid replacing instance root $data. ' +
  27733. 'Use nested data properties instead.',
  27734. this
  27735. );
  27736. };
  27737. propsDef.set = function () {
  27738. warn("$props is readonly.", this);
  27739. };
  27740. }
  27741. Object.defineProperty(Vue.prototype, '$data', dataDef);
  27742. Object.defineProperty(Vue.prototype, '$props', propsDef);
  27743. Vue.prototype.$set = set;
  27744. Vue.prototype.$delete = del;
  27745. Vue.prototype.$watch = function (
  27746. expOrFn,
  27747. cb,
  27748. options
  27749. ) {
  27750. var vm = this;
  27751. options = options || {};
  27752. options.user = true;
  27753. var watcher = new Watcher(vm, expOrFn, cb, options);
  27754. if (options.immediate) {
  27755. cb.call(vm, watcher.value);
  27756. }
  27757. return function unwatchFn () {
  27758. watcher.teardown();
  27759. }
  27760. };
  27761. }
  27762. /* */
  27763. // hooks to be invoked on component VNodes during patch
  27764. var componentVNodeHooks = {
  27765. init: function init (
  27766. vnode,
  27767. hydrating,
  27768. parentElm,
  27769. refElm
  27770. ) {
  27771. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  27772. var child = vnode.componentInstance = createComponentInstanceForVnode(
  27773. vnode,
  27774. activeInstance,
  27775. parentElm,
  27776. refElm
  27777. );
  27778. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  27779. } else if (vnode.data.keepAlive) {
  27780. // kept-alive components, treat as a patch
  27781. var mountedNode = vnode; // work around flow
  27782. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  27783. }
  27784. },
  27785. prepatch: function prepatch (oldVnode, vnode) {
  27786. var options = vnode.componentOptions;
  27787. var child = vnode.componentInstance = oldVnode.componentInstance;
  27788. updateChildComponent(
  27789. child,
  27790. options.propsData, // updated props
  27791. options.listeners, // updated listeners
  27792. vnode, // new parent vnode
  27793. options.children // new children
  27794. );
  27795. },
  27796. insert: function insert (vnode) {
  27797. if (!vnode.componentInstance._isMounted) {
  27798. vnode.componentInstance._isMounted = true;
  27799. callHook(vnode.componentInstance, 'mounted');
  27800. }
  27801. if (vnode.data.keepAlive) {
  27802. activateChildComponent(vnode.componentInstance, true /* direct */);
  27803. }
  27804. },
  27805. destroy: function destroy (vnode) {
  27806. if (!vnode.componentInstance._isDestroyed) {
  27807. if (!vnode.data.keepAlive) {
  27808. vnode.componentInstance.$destroy();
  27809. } else {
  27810. deactivateChildComponent(vnode.componentInstance, true /* direct */);
  27811. }
  27812. }
  27813. }
  27814. };
  27815. var hooksToMerge = Object.keys(componentVNodeHooks);
  27816. function createComponent (
  27817. Ctor,
  27818. data,
  27819. context,
  27820. children,
  27821. tag
  27822. ) {
  27823. if (!Ctor) {
  27824. return
  27825. }
  27826. var baseCtor = context.$options._base;
  27827. if (isObject(Ctor)) {
  27828. Ctor = baseCtor.extend(Ctor);
  27829. }
  27830. if (typeof Ctor !== 'function') {
  27831. {
  27832. warn(("Invalid Component definition: " + (String(Ctor))), context);
  27833. }
  27834. return
  27835. }
  27836. // async component
  27837. if (!Ctor.cid) {
  27838. if (Ctor.resolved) {
  27839. Ctor = Ctor.resolved;
  27840. } else {
  27841. Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
  27842. // it's ok to queue this on every render because
  27843. // $forceUpdate is buffered by the scheduler.
  27844. context.$forceUpdate();
  27845. });
  27846. if (!Ctor) {
  27847. // return nothing if this is indeed an async component
  27848. // wait for the callback to trigger parent update.
  27849. return
  27850. }
  27851. }
  27852. }
  27853. // resolve constructor options in case global mixins are applied after
  27854. // component constructor creation
  27855. resolveConstructorOptions(Ctor);
  27856. data = data || {};
  27857. // transform component v-model data into props & events
  27858. if (data.model) {
  27859. transformModel(Ctor.options, data);
  27860. }
  27861. // extract props
  27862. var propsData = extractProps(data, Ctor, tag);
  27863. // functional component
  27864. if (Ctor.options.functional) {
  27865. return createFunctionalComponent(Ctor, propsData, data, context, children)
  27866. }
  27867. // extract listeners, since these needs to be treated as
  27868. // child component listeners instead of DOM listeners
  27869. var listeners = data.on;
  27870. // replace with listeners with .native modifier
  27871. data.on = data.nativeOn;
  27872. if (Ctor.options.abstract) {
  27873. // abstract components do not keep anything
  27874. // other than props & listeners
  27875. data = {};
  27876. }
  27877. // merge component management hooks onto the placeholder node
  27878. mergeHooks(data);
  27879. // return a placeholder vnode
  27880. var name = Ctor.options.name || tag;
  27881. var vnode = new VNode(
  27882. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  27883. data, undefined, undefined, undefined, context,
  27884. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  27885. );
  27886. return vnode
  27887. }
  27888. function createFunctionalComponent (
  27889. Ctor,
  27890. propsData,
  27891. data,
  27892. context,
  27893. children
  27894. ) {
  27895. var props = {};
  27896. var propOptions = Ctor.options.props;
  27897. if (propOptions) {
  27898. for (var key in propOptions) {
  27899. props[key] = validateProp(key, propOptions, propsData);
  27900. }
  27901. }
  27902. // ensure the createElement function in functional components
  27903. // gets a unique context - this is necessary for correct named slot check
  27904. var _context = Object.create(context);
  27905. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  27906. var vnode = Ctor.options.render.call(null, h, {
  27907. props: props,
  27908. data: data,
  27909. parent: context,
  27910. children: children,
  27911. slots: function () { return resolveSlots(children, context); }
  27912. });
  27913. if (vnode instanceof VNode) {
  27914. vnode.functionalContext = context;
  27915. if (data.slot) {
  27916. (vnode.data || (vnode.data = {})).slot = data.slot;
  27917. }
  27918. }
  27919. return vnode
  27920. }
  27921. function createComponentInstanceForVnode (
  27922. vnode, // we know it's MountedComponentVNode but flow doesn't
  27923. parent, // activeInstance in lifecycle state
  27924. parentElm,
  27925. refElm
  27926. ) {
  27927. var vnodeComponentOptions = vnode.componentOptions;
  27928. var options = {
  27929. _isComponent: true,
  27930. parent: parent,
  27931. propsData: vnodeComponentOptions.propsData,
  27932. _componentTag: vnodeComponentOptions.tag,
  27933. _parentVnode: vnode,
  27934. _parentListeners: vnodeComponentOptions.listeners,
  27935. _renderChildren: vnodeComponentOptions.children,
  27936. _parentElm: parentElm || null,
  27937. _refElm: refElm || null
  27938. };
  27939. // check inline-template render functions
  27940. var inlineTemplate = vnode.data.inlineTemplate;
  27941. if (inlineTemplate) {
  27942. options.render = inlineTemplate.render;
  27943. options.staticRenderFns = inlineTemplate.staticRenderFns;
  27944. }
  27945. return new vnodeComponentOptions.Ctor(options)
  27946. }
  27947. function resolveAsyncComponent (
  27948. factory,
  27949. baseCtor,
  27950. cb
  27951. ) {
  27952. if (factory.requested) {
  27953. // pool callbacks
  27954. factory.pendingCallbacks.push(cb);
  27955. } else {
  27956. factory.requested = true;
  27957. var cbs = factory.pendingCallbacks = [cb];
  27958. var sync = true;
  27959. var resolve = function (res) {
  27960. if (isObject(res)) {
  27961. res = baseCtor.extend(res);
  27962. }
  27963. // cache resolved
  27964. factory.resolved = res;
  27965. // invoke callbacks only if this is not a synchronous resolve
  27966. // (async resolves are shimmed as synchronous during SSR)
  27967. if (!sync) {
  27968. for (var i = 0, l = cbs.length; i < l; i++) {
  27969. cbs[i](res);
  27970. }
  27971. }
  27972. };
  27973. var reject = function (reason) {
  27974. "development" !== 'production' && warn(
  27975. "Failed to resolve async component: " + (String(factory)) +
  27976. (reason ? ("\nReason: " + reason) : '')
  27977. );
  27978. };
  27979. var res = factory(resolve, reject);
  27980. // handle promise
  27981. if (res && typeof res.then === 'function' && !factory.resolved) {
  27982. res.then(resolve, reject);
  27983. }
  27984. sync = false;
  27985. // return in case resolved synchronously
  27986. return factory.resolved
  27987. }
  27988. }
  27989. function extractProps (data, Ctor, tag) {
  27990. // we are only extracting raw values here.
  27991. // validation and default values are handled in the child
  27992. // component itself.
  27993. var propOptions = Ctor.options.props;
  27994. if (!propOptions) {
  27995. return
  27996. }
  27997. var res = {};
  27998. var attrs = data.attrs;
  27999. var props = data.props;
  28000. var domProps = data.domProps;
  28001. if (attrs || props || domProps) {
  28002. for (var key in propOptions) {
  28003. var altKey = hyphenate(key);
  28004. {
  28005. var keyInLowerCase = key.toLowerCase();
  28006. if (
  28007. key !== keyInLowerCase &&
  28008. attrs && attrs.hasOwnProperty(keyInLowerCase)
  28009. ) {
  28010. tip(
  28011. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  28012. (formatComponentName(tag || Ctor)) + ", but the delared prop name is" +
  28013. " \"" + key + "\". " +
  28014. "Note that HTML attributes are case-insensitive and camelCased " +
  28015. "props need to use their kebab-case equivalents when using in-DOM " +
  28016. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  28017. );
  28018. }
  28019. }
  28020. checkProp(res, props, key, altKey, true) ||
  28021. checkProp(res, attrs, key, altKey) ||
  28022. checkProp(res, domProps, key, altKey);
  28023. }
  28024. }
  28025. return res
  28026. }
  28027. function checkProp (
  28028. res,
  28029. hash,
  28030. key,
  28031. altKey,
  28032. preserve
  28033. ) {
  28034. if (hash) {
  28035. if (hasOwn(hash, key)) {
  28036. res[key] = hash[key];
  28037. if (!preserve) {
  28038. delete hash[key];
  28039. }
  28040. return true
  28041. } else if (hasOwn(hash, altKey)) {
  28042. res[key] = hash[altKey];
  28043. if (!preserve) {
  28044. delete hash[altKey];
  28045. }
  28046. return true
  28047. }
  28048. }
  28049. return false
  28050. }
  28051. function mergeHooks (data) {
  28052. if (!data.hook) {
  28053. data.hook = {};
  28054. }
  28055. for (var i = 0; i < hooksToMerge.length; i++) {
  28056. var key = hooksToMerge[i];
  28057. var fromParent = data.hook[key];
  28058. var ours = componentVNodeHooks[key];
  28059. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  28060. }
  28061. }
  28062. function mergeHook$1 (one, two) {
  28063. return function (a, b, c, d) {
  28064. one(a, b, c, d);
  28065. two(a, b, c, d);
  28066. }
  28067. }
  28068. // transform component v-model info (value and callback) into
  28069. // prop and event handler respectively.
  28070. function transformModel (options, data) {
  28071. var prop = (options.model && options.model.prop) || 'value';
  28072. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  28073. var on = data.on || (data.on = {});
  28074. if (on[event]) {
  28075. on[event] = [data.model.callback].concat(on[event]);
  28076. } else {
  28077. on[event] = data.model.callback;
  28078. }
  28079. }
  28080. /* */
  28081. var SIMPLE_NORMALIZE = 1;
  28082. var ALWAYS_NORMALIZE = 2;
  28083. // wrapper function for providing a more flexible interface
  28084. // without getting yelled at by flow
  28085. function createElement (
  28086. context,
  28087. tag,
  28088. data,
  28089. children,
  28090. normalizationType,
  28091. alwaysNormalize
  28092. ) {
  28093. if (Array.isArray(data) || isPrimitive(data)) {
  28094. normalizationType = children;
  28095. children = data;
  28096. data = undefined;
  28097. }
  28098. if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  28099. return _createElement(context, tag, data, children, normalizationType)
  28100. }
  28101. function _createElement (
  28102. context,
  28103. tag,
  28104. data,
  28105. children,
  28106. normalizationType
  28107. ) {
  28108. if (data && data.__ob__) {
  28109. "development" !== 'production' && warn(
  28110. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  28111. 'Always create fresh vnode data objects in each render!',
  28112. context
  28113. );
  28114. return createEmptyVNode()
  28115. }
  28116. if (!tag) {
  28117. // in case of component :is set to falsy value
  28118. return createEmptyVNode()
  28119. }
  28120. // support single function children as default scoped slot
  28121. if (Array.isArray(children) &&
  28122. typeof children[0] === 'function') {
  28123. data = data || {};
  28124. data.scopedSlots = { default: children[0] };
  28125. children.length = 0;
  28126. }
  28127. if (normalizationType === ALWAYS_NORMALIZE) {
  28128. children = normalizeChildren(children);
  28129. } else if (normalizationType === SIMPLE_NORMALIZE) {
  28130. children = simpleNormalizeChildren(children);
  28131. }
  28132. var vnode, ns;
  28133. if (typeof tag === 'string') {
  28134. var Ctor;
  28135. ns = config.getTagNamespace(tag);
  28136. if (config.isReservedTag(tag)) {
  28137. // platform built-in elements
  28138. vnode = new VNode(
  28139. config.parsePlatformTagName(tag), data, children,
  28140. undefined, undefined, context
  28141. );
  28142. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  28143. // component
  28144. vnode = createComponent(Ctor, data, context, children, tag);
  28145. } else {
  28146. // unknown or unlisted namespaced elements
  28147. // check at runtime because it may get assigned a namespace when its
  28148. // parent normalizes children
  28149. vnode = new VNode(
  28150. tag, data, children,
  28151. undefined, undefined, context
  28152. );
  28153. }
  28154. } else {
  28155. // direct component options / constructor
  28156. vnode = createComponent(tag, data, context, children);
  28157. }
  28158. if (vnode) {
  28159. if (ns) { applyNS(vnode, ns); }
  28160. return vnode
  28161. } else {
  28162. return createEmptyVNode()
  28163. }
  28164. }
  28165. function applyNS (vnode, ns) {
  28166. vnode.ns = ns;
  28167. if (vnode.tag === 'foreignObject') {
  28168. // use default namespace inside foreignObject
  28169. return
  28170. }
  28171. if (vnode.children) {
  28172. for (var i = 0, l = vnode.children.length; i < l; i++) {
  28173. var child = vnode.children[i];
  28174. if (child.tag && !child.ns) {
  28175. applyNS(child, ns);
  28176. }
  28177. }
  28178. }
  28179. }
  28180. /* */
  28181. /**
  28182. * Runtime helper for rendering v-for lists.
  28183. */
  28184. function renderList (
  28185. val,
  28186. render
  28187. ) {
  28188. var ret, i, l, keys, key;
  28189. if (Array.isArray(val) || typeof val === 'string') {
  28190. ret = new Array(val.length);
  28191. for (i = 0, l = val.length; i < l; i++) {
  28192. ret[i] = render(val[i], i);
  28193. }
  28194. } else if (typeof val === 'number') {
  28195. ret = new Array(val);
  28196. for (i = 0; i < val; i++) {
  28197. ret[i] = render(i + 1, i);
  28198. }
  28199. } else if (isObject(val)) {
  28200. keys = Object.keys(val);
  28201. ret = new Array(keys.length);
  28202. for (i = 0, l = keys.length; i < l; i++) {
  28203. key = keys[i];
  28204. ret[i] = render(val[key], key, i);
  28205. }
  28206. }
  28207. return ret
  28208. }
  28209. /* */
  28210. /**
  28211. * Runtime helper for rendering <slot>
  28212. */
  28213. function renderSlot (
  28214. name,
  28215. fallback,
  28216. props,
  28217. bindObject
  28218. ) {
  28219. var scopedSlotFn = this.$scopedSlots[name];
  28220. if (scopedSlotFn) { // scoped slot
  28221. props = props || {};
  28222. if (bindObject) {
  28223. extend(props, bindObject);
  28224. }
  28225. return scopedSlotFn(props) || fallback
  28226. } else {
  28227. var slotNodes = this.$slots[name];
  28228. // warn duplicate slot usage
  28229. if (slotNodes && "development" !== 'production') {
  28230. slotNodes._rendered && warn(
  28231. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  28232. "- this will likely cause render errors.",
  28233. this
  28234. );
  28235. slotNodes._rendered = true;
  28236. }
  28237. return slotNodes || fallback
  28238. }
  28239. }
  28240. /* */
  28241. /**
  28242. * Runtime helper for resolving filters
  28243. */
  28244. function resolveFilter (id) {
  28245. return resolveAsset(this.$options, 'filters', id, true) || identity
  28246. }
  28247. /* */
  28248. /**
  28249. * Runtime helper for checking keyCodes from config.
  28250. */
  28251. function checkKeyCodes (
  28252. eventKeyCode,
  28253. key,
  28254. builtInAlias
  28255. ) {
  28256. var keyCodes = config.keyCodes[key] || builtInAlias;
  28257. if (Array.isArray(keyCodes)) {
  28258. return keyCodes.indexOf(eventKeyCode) === -1
  28259. } else {
  28260. return keyCodes !== eventKeyCode
  28261. }
  28262. }
  28263. /* */
  28264. /**
  28265. * Runtime helper for merging v-bind="object" into a VNode's data.
  28266. */
  28267. function bindObjectProps (
  28268. data,
  28269. tag,
  28270. value,
  28271. asProp
  28272. ) {
  28273. if (value) {
  28274. if (!isObject(value)) {
  28275. "development" !== 'production' && warn(
  28276. 'v-bind without argument expects an Object or Array value',
  28277. this
  28278. );
  28279. } else {
  28280. if (Array.isArray(value)) {
  28281. value = toObject(value);
  28282. }
  28283. var hash;
  28284. for (var key in value) {
  28285. if (key === 'class' || key === 'style') {
  28286. hash = data;
  28287. } else {
  28288. var type = data.attrs && data.attrs.type;
  28289. hash = asProp || config.mustUseProp(tag, type, key)
  28290. ? data.domProps || (data.domProps = {})
  28291. : data.attrs || (data.attrs = {});
  28292. }
  28293. if (!(key in hash)) {
  28294. hash[key] = value[key];
  28295. }
  28296. }
  28297. }
  28298. }
  28299. return data
  28300. }
  28301. /* */
  28302. /**
  28303. * Runtime helper for rendering static trees.
  28304. */
  28305. function renderStatic (
  28306. index,
  28307. isInFor
  28308. ) {
  28309. var tree = this._staticTrees[index];
  28310. // if has already-rendered static tree and not inside v-for,
  28311. // we can reuse the same tree by doing a shallow clone.
  28312. if (tree && !isInFor) {
  28313. return Array.isArray(tree)
  28314. ? cloneVNodes(tree)
  28315. : cloneVNode(tree)
  28316. }
  28317. // otherwise, render a fresh tree.
  28318. tree = this._staticTrees[index] =
  28319. this.$options.staticRenderFns[index].call(this._renderProxy);
  28320. markStatic(tree, ("__static__" + index), false);
  28321. return tree
  28322. }
  28323. /**
  28324. * Runtime helper for v-once.
  28325. * Effectively it means marking the node as static with a unique key.
  28326. */
  28327. function markOnce (
  28328. tree,
  28329. index,
  28330. key
  28331. ) {
  28332. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  28333. return tree
  28334. }
  28335. function markStatic (
  28336. tree,
  28337. key,
  28338. isOnce
  28339. ) {
  28340. if (Array.isArray(tree)) {
  28341. for (var i = 0; i < tree.length; i++) {
  28342. if (tree[i] && typeof tree[i] !== 'string') {
  28343. markStaticNode(tree[i], (key + "_" + i), isOnce);
  28344. }
  28345. }
  28346. } else {
  28347. markStaticNode(tree, key, isOnce);
  28348. }
  28349. }
  28350. function markStaticNode (node, key, isOnce) {
  28351. node.isStatic = true;
  28352. node.key = key;
  28353. node.isOnce = isOnce;
  28354. }
  28355. /* */
  28356. function initRender (vm) {
  28357. vm.$vnode = null; // the placeholder node in parent tree
  28358. vm._vnode = null; // the root of the child tree
  28359. vm._staticTrees = null;
  28360. var parentVnode = vm.$options._parentVnode;
  28361. var renderContext = parentVnode && parentVnode.context;
  28362. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  28363. vm.$scopedSlots = emptyObject;
  28364. // bind the createElement fn to this instance
  28365. // so that we get proper render context inside it.
  28366. // args order: tag, data, children, normalizationType, alwaysNormalize
  28367. // internal version is used by render functions compiled from templates
  28368. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  28369. // normalization is always applied for the public version, used in
  28370. // user-written render functions.
  28371. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  28372. }
  28373. function renderMixin (Vue) {
  28374. Vue.prototype.$nextTick = function (fn) {
  28375. return nextTick(fn, this)
  28376. };
  28377. Vue.prototype._render = function () {
  28378. var vm = this;
  28379. var ref = vm.$options;
  28380. var render = ref.render;
  28381. var staticRenderFns = ref.staticRenderFns;
  28382. var _parentVnode = ref._parentVnode;
  28383. if (vm._isMounted) {
  28384. // clone slot nodes on re-renders
  28385. for (var key in vm.$slots) {
  28386. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  28387. }
  28388. }
  28389. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  28390. if (staticRenderFns && !vm._staticTrees) {
  28391. vm._staticTrees = [];
  28392. }
  28393. // set parent vnode. this allows render functions to have access
  28394. // to the data on the placeholder node.
  28395. vm.$vnode = _parentVnode;
  28396. // render self
  28397. var vnode;
  28398. try {
  28399. vnode = render.call(vm._renderProxy, vm.$createElement);
  28400. } catch (e) {
  28401. handleError(e, vm, "render function");
  28402. // return error render result,
  28403. // or previous vnode to prevent render error causing blank component
  28404. /* istanbul ignore else */
  28405. {
  28406. vnode = vm.$options.renderError
  28407. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  28408. : vm._vnode;
  28409. }
  28410. }
  28411. // return empty vnode in case the render function errored out
  28412. if (!(vnode instanceof VNode)) {
  28413. if ("development" !== 'production' && Array.isArray(vnode)) {
  28414. warn(
  28415. 'Multiple root nodes returned from render function. Render function ' +
  28416. 'should return a single root node.',
  28417. vm
  28418. );
  28419. }
  28420. vnode = createEmptyVNode();
  28421. }
  28422. // set parent
  28423. vnode.parent = _parentVnode;
  28424. return vnode
  28425. };
  28426. // internal render helpers.
  28427. // these are exposed on the instance prototype to reduce generated render
  28428. // code size.
  28429. Vue.prototype._o = markOnce;
  28430. Vue.prototype._n = toNumber;
  28431. Vue.prototype._s = _toString;
  28432. Vue.prototype._l = renderList;
  28433. Vue.prototype._t = renderSlot;
  28434. Vue.prototype._q = looseEqual;
  28435. Vue.prototype._i = looseIndexOf;
  28436. Vue.prototype._m = renderStatic;
  28437. Vue.prototype._f = resolveFilter;
  28438. Vue.prototype._k = checkKeyCodes;
  28439. Vue.prototype._b = bindObjectProps;
  28440. Vue.prototype._v = createTextVNode;
  28441. Vue.prototype._e = createEmptyVNode;
  28442. Vue.prototype._u = resolveScopedSlots;
  28443. }
  28444. /* */
  28445. function initProvide (vm) {
  28446. var provide = vm.$options.provide;
  28447. if (provide) {
  28448. vm._provided = typeof provide === 'function'
  28449. ? provide.call(vm)
  28450. : provide;
  28451. }
  28452. }
  28453. function initInjections (vm) {
  28454. var inject = vm.$options.inject;
  28455. if (inject) {
  28456. // inject is :any because flow is not smart enough to figure out cached
  28457. // isArray here
  28458. var isArray = Array.isArray(inject);
  28459. var keys = isArray
  28460. ? inject
  28461. : hasSymbol
  28462. ? Reflect.ownKeys(inject)
  28463. : Object.keys(inject);
  28464. var loop = function ( i ) {
  28465. var key = keys[i];
  28466. var provideKey = isArray ? key : inject[key];
  28467. var source = vm;
  28468. while (source) {
  28469. if (source._provided && provideKey in source._provided) {
  28470. /* istanbul ignore else */
  28471. {
  28472. defineReactive$$1(vm, key, source._provided[provideKey], function () {
  28473. warn(
  28474. "Avoid mutating an injected value directly since the changes will be " +
  28475. "overwritten whenever the provided component re-renders. " +
  28476. "injection being mutated: \"" + key + "\"",
  28477. vm
  28478. );
  28479. });
  28480. }
  28481. break
  28482. }
  28483. source = source.$parent;
  28484. }
  28485. };
  28486. for (var i = 0; i < keys.length; i++) loop( i );
  28487. }
  28488. }
  28489. /* */
  28490. var uid = 0;
  28491. function initMixin (Vue) {
  28492. Vue.prototype._init = function (options) {
  28493. var vm = this;
  28494. // a uid
  28495. vm._uid = uid++;
  28496. var startTag, endTag;
  28497. /* istanbul ignore if */
  28498. if ("development" !== 'production' && config.performance && mark) {
  28499. startTag = "vue-perf-init:" + (vm._uid);
  28500. endTag = "vue-perf-end:" + (vm._uid);
  28501. mark(startTag);
  28502. }
  28503. // a flag to avoid this being observed
  28504. vm._isVue = true;
  28505. // merge options
  28506. if (options && options._isComponent) {
  28507. // optimize internal component instantiation
  28508. // since dynamic options merging is pretty slow, and none of the
  28509. // internal component options needs special treatment.
  28510. initInternalComponent(vm, options);
  28511. } else {
  28512. vm.$options = mergeOptions(
  28513. resolveConstructorOptions(vm.constructor),
  28514. options || {},
  28515. vm
  28516. );
  28517. }
  28518. /* istanbul ignore else */
  28519. {
  28520. initProxy(vm);
  28521. }
  28522. // expose real self
  28523. vm._self = vm;
  28524. initLifecycle(vm);
  28525. initEvents(vm);
  28526. initRender(vm);
  28527. callHook(vm, 'beforeCreate');
  28528. initInjections(vm); // resolve injections before data/props
  28529. initState(vm);
  28530. initProvide(vm); // resolve provide after data/props
  28531. callHook(vm, 'created');
  28532. /* istanbul ignore if */
  28533. if ("development" !== 'production' && config.performance && mark) {
  28534. vm._name = formatComponentName(vm, false);
  28535. mark(endTag);
  28536. measure(((vm._name) + " init"), startTag, endTag);
  28537. }
  28538. if (vm.$options.el) {
  28539. vm.$mount(vm.$options.el);
  28540. }
  28541. };
  28542. }
  28543. function initInternalComponent (vm, options) {
  28544. var opts = vm.$options = Object.create(vm.constructor.options);
  28545. // doing this because it's faster than dynamic enumeration.
  28546. opts.parent = options.parent;
  28547. opts.propsData = options.propsData;
  28548. opts._parentVnode = options._parentVnode;
  28549. opts._parentListeners = options._parentListeners;
  28550. opts._renderChildren = options._renderChildren;
  28551. opts._componentTag = options._componentTag;
  28552. opts._parentElm = options._parentElm;
  28553. opts._refElm = options._refElm;
  28554. if (options.render) {
  28555. opts.render = options.render;
  28556. opts.staticRenderFns = options.staticRenderFns;
  28557. }
  28558. }
  28559. function resolveConstructorOptions (Ctor) {
  28560. var options = Ctor.options;
  28561. if (Ctor.super) {
  28562. var superOptions = resolveConstructorOptions(Ctor.super);
  28563. var cachedSuperOptions = Ctor.superOptions;
  28564. if (superOptions !== cachedSuperOptions) {
  28565. // super option changed,
  28566. // need to resolve new options.
  28567. Ctor.superOptions = superOptions;
  28568. // check if there are any late-modified/attached options (#4976)
  28569. var modifiedOptions = resolveModifiedOptions(Ctor);
  28570. // update base extend options
  28571. if (modifiedOptions) {
  28572. extend(Ctor.extendOptions, modifiedOptions);
  28573. }
  28574. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  28575. if (options.name) {
  28576. options.components[options.name] = Ctor;
  28577. }
  28578. }
  28579. }
  28580. return options
  28581. }
  28582. function resolveModifiedOptions (Ctor) {
  28583. var modified;
  28584. var latest = Ctor.options;
  28585. var sealed = Ctor.sealedOptions;
  28586. for (var key in latest) {
  28587. if (latest[key] !== sealed[key]) {
  28588. if (!modified) { modified = {}; }
  28589. modified[key] = dedupe(latest[key], sealed[key]);
  28590. }
  28591. }
  28592. return modified
  28593. }
  28594. function dedupe (latest, sealed) {
  28595. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  28596. // between merges
  28597. if (Array.isArray(latest)) {
  28598. var res = [];
  28599. sealed = Array.isArray(sealed) ? sealed : [sealed];
  28600. for (var i = 0; i < latest.length; i++) {
  28601. if (sealed.indexOf(latest[i]) < 0) {
  28602. res.push(latest[i]);
  28603. }
  28604. }
  28605. return res
  28606. } else {
  28607. return latest
  28608. }
  28609. }
  28610. function Vue$3 (options) {
  28611. if ("development" !== 'production' &&
  28612. !(this instanceof Vue$3)) {
  28613. warn('Vue is a constructor and should be called with the `new` keyword');
  28614. }
  28615. this._init(options);
  28616. }
  28617. initMixin(Vue$3);
  28618. stateMixin(Vue$3);
  28619. eventsMixin(Vue$3);
  28620. lifecycleMixin(Vue$3);
  28621. renderMixin(Vue$3);
  28622. /* */
  28623. function initUse (Vue) {
  28624. Vue.use = function (plugin) {
  28625. /* istanbul ignore if */
  28626. if (plugin.installed) {
  28627. return
  28628. }
  28629. // additional parameters
  28630. var args = toArray(arguments, 1);
  28631. args.unshift(this);
  28632. if (typeof plugin.install === 'function') {
  28633. plugin.install.apply(plugin, args);
  28634. } else if (typeof plugin === 'function') {
  28635. plugin.apply(null, args);
  28636. }
  28637. plugin.installed = true;
  28638. return this
  28639. };
  28640. }
  28641. /* */
  28642. function initMixin$1 (Vue) {
  28643. Vue.mixin = function (mixin) {
  28644. this.options = mergeOptions(this.options, mixin);
  28645. };
  28646. }
  28647. /* */
  28648. function initExtend (Vue) {
  28649. /**
  28650. * Each instance constructor, including Vue, has a unique
  28651. * cid. This enables us to create wrapped "child
  28652. * constructors" for prototypal inheritance and cache them.
  28653. */
  28654. Vue.cid = 0;
  28655. var cid = 1;
  28656. /**
  28657. * Class inheritance
  28658. */
  28659. Vue.extend = function (extendOptions) {
  28660. extendOptions = extendOptions || {};
  28661. var Super = this;
  28662. var SuperId = Super.cid;
  28663. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  28664. if (cachedCtors[SuperId]) {
  28665. return cachedCtors[SuperId]
  28666. }
  28667. var name = extendOptions.name || Super.options.name;
  28668. {
  28669. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  28670. warn(
  28671. 'Invalid component name: "' + name + '". Component names ' +
  28672. 'can only contain alphanumeric characters and the hyphen, ' +
  28673. 'and must start with a letter.'
  28674. );
  28675. }
  28676. }
  28677. var Sub = function VueComponent (options) {
  28678. this._init(options);
  28679. };
  28680. Sub.prototype = Object.create(Super.prototype);
  28681. Sub.prototype.constructor = Sub;
  28682. Sub.cid = cid++;
  28683. Sub.options = mergeOptions(
  28684. Super.options,
  28685. extendOptions
  28686. );
  28687. Sub['super'] = Super;
  28688. // For props and computed properties, we define the proxy getters on
  28689. // the Vue instances at extension time, on the extended prototype. This
  28690. // avoids Object.defineProperty calls for each instance created.
  28691. if (Sub.options.props) {
  28692. initProps$1(Sub);
  28693. }
  28694. if (Sub.options.computed) {
  28695. initComputed$1(Sub);
  28696. }
  28697. // allow further extension/mixin/plugin usage
  28698. Sub.extend = Super.extend;
  28699. Sub.mixin = Super.mixin;
  28700. Sub.use = Super.use;
  28701. // create asset registers, so extended classes
  28702. // can have their private assets too.
  28703. config._assetTypes.forEach(function (type) {
  28704. Sub[type] = Super[type];
  28705. });
  28706. // enable recursive self-lookup
  28707. if (name) {
  28708. Sub.options.components[name] = Sub;
  28709. }
  28710. // keep a reference to the super options at extension time.
  28711. // later at instantiation we can check if Super's options have
  28712. // been updated.
  28713. Sub.superOptions = Super.options;
  28714. Sub.extendOptions = extendOptions;
  28715. Sub.sealedOptions = extend({}, Sub.options);
  28716. // cache constructor
  28717. cachedCtors[SuperId] = Sub;
  28718. return Sub
  28719. };
  28720. }
  28721. function initProps$1 (Comp) {
  28722. var props = Comp.options.props;
  28723. for (var key in props) {
  28724. proxy(Comp.prototype, "_props", key);
  28725. }
  28726. }
  28727. function initComputed$1 (Comp) {
  28728. var computed = Comp.options.computed;
  28729. for (var key in computed) {
  28730. defineComputed(Comp.prototype, key, computed[key]);
  28731. }
  28732. }
  28733. /* */
  28734. function initAssetRegisters (Vue) {
  28735. /**
  28736. * Create asset registration methods.
  28737. */
  28738. config._assetTypes.forEach(function (type) {
  28739. Vue[type] = function (
  28740. id,
  28741. definition
  28742. ) {
  28743. if (!definition) {
  28744. return this.options[type + 's'][id]
  28745. } else {
  28746. /* istanbul ignore if */
  28747. {
  28748. if (type === 'component' && config.isReservedTag(id)) {
  28749. warn(
  28750. 'Do not use built-in or reserved HTML elements as component ' +
  28751. 'id: ' + id
  28752. );
  28753. }
  28754. }
  28755. if (type === 'component' && isPlainObject(definition)) {
  28756. definition.name = definition.name || id;
  28757. definition = this.options._base.extend(definition);
  28758. }
  28759. if (type === 'directive' && typeof definition === 'function') {
  28760. definition = { bind: definition, update: definition };
  28761. }
  28762. this.options[type + 's'][id] = definition;
  28763. return definition
  28764. }
  28765. };
  28766. });
  28767. }
  28768. /* */
  28769. var patternTypes = [String, RegExp];
  28770. function getComponentName (opts) {
  28771. return opts && (opts.Ctor.options.name || opts.tag)
  28772. }
  28773. function matches (pattern, name) {
  28774. if (typeof pattern === 'string') {
  28775. return pattern.split(',').indexOf(name) > -1
  28776. } else if (pattern instanceof RegExp) {
  28777. return pattern.test(name)
  28778. }
  28779. /* istanbul ignore next */
  28780. return false
  28781. }
  28782. function pruneCache (cache, filter) {
  28783. for (var key in cache) {
  28784. var cachedNode = cache[key];
  28785. if (cachedNode) {
  28786. var name = getComponentName(cachedNode.componentOptions);
  28787. if (name && !filter(name)) {
  28788. pruneCacheEntry(cachedNode);
  28789. cache[key] = null;
  28790. }
  28791. }
  28792. }
  28793. }
  28794. function pruneCacheEntry (vnode) {
  28795. if (vnode) {
  28796. if (!vnode.componentInstance._inactive) {
  28797. callHook(vnode.componentInstance, 'deactivated');
  28798. }
  28799. vnode.componentInstance.$destroy();
  28800. }
  28801. }
  28802. var KeepAlive = {
  28803. name: 'keep-alive',
  28804. abstract: true,
  28805. props: {
  28806. include: patternTypes,
  28807. exclude: patternTypes
  28808. },
  28809. created: function created () {
  28810. this.cache = Object.create(null);
  28811. },
  28812. destroyed: function destroyed () {
  28813. var this$1 = this;
  28814. for (var key in this$1.cache) {
  28815. pruneCacheEntry(this$1.cache[key]);
  28816. }
  28817. },
  28818. watch: {
  28819. include: function include (val) {
  28820. pruneCache(this.cache, function (name) { return matches(val, name); });
  28821. },
  28822. exclude: function exclude (val) {
  28823. pruneCache(this.cache, function (name) { return !matches(val, name); });
  28824. }
  28825. },
  28826. render: function render () {
  28827. var vnode = getFirstComponentChild(this.$slots.default);
  28828. var componentOptions = vnode && vnode.componentOptions;
  28829. if (componentOptions) {
  28830. // check pattern
  28831. var name = getComponentName(componentOptions);
  28832. if (name && (
  28833. (this.include && !matches(this.include, name)) ||
  28834. (this.exclude && matches(this.exclude, name))
  28835. )) {
  28836. return vnode
  28837. }
  28838. var key = vnode.key == null
  28839. // same constructor may get registered as different local components
  28840. // so cid alone is not enough (#3269)
  28841. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  28842. : vnode.key;
  28843. if (this.cache[key]) {
  28844. vnode.componentInstance = this.cache[key].componentInstance;
  28845. } else {
  28846. this.cache[key] = vnode;
  28847. }
  28848. vnode.data.keepAlive = true;
  28849. }
  28850. return vnode
  28851. }
  28852. };
  28853. var builtInComponents = {
  28854. KeepAlive: KeepAlive
  28855. };
  28856. /* */
  28857. function initGlobalAPI (Vue) {
  28858. // config
  28859. var configDef = {};
  28860. configDef.get = function () { return config; };
  28861. {
  28862. configDef.set = function () {
  28863. warn(
  28864. 'Do not replace the Vue.config object, set individual fields instead.'
  28865. );
  28866. };
  28867. }
  28868. Object.defineProperty(Vue, 'config', configDef);
  28869. // exposed util methods.
  28870. // NOTE: these are not considered part of the public API - avoid relying on
  28871. // them unless you are aware of the risk.
  28872. Vue.util = {
  28873. warn: warn,
  28874. extend: extend,
  28875. mergeOptions: mergeOptions,
  28876. defineReactive: defineReactive$$1
  28877. };
  28878. Vue.set = set;
  28879. Vue.delete = del;
  28880. Vue.nextTick = nextTick;
  28881. Vue.options = Object.create(null);
  28882. config._assetTypes.forEach(function (type) {
  28883. Vue.options[type + 's'] = Object.create(null);
  28884. });
  28885. // this is used to identify the "base" constructor to extend all plain-object
  28886. // components with in Weex's multi-instance scenarios.
  28887. Vue.options._base = Vue;
  28888. extend(Vue.options.components, builtInComponents);
  28889. initUse(Vue);
  28890. initMixin$1(Vue);
  28891. initExtend(Vue);
  28892. initAssetRegisters(Vue);
  28893. }
  28894. initGlobalAPI(Vue$3);
  28895. Object.defineProperty(Vue$3.prototype, '$isServer', {
  28896. get: isServerRendering
  28897. });
  28898. Vue$3.version = '2.2.5';
  28899. /* */
  28900. // attributes that should be using props for binding
  28901. var acceptValue = makeMap('input,textarea,option,select');
  28902. var mustUseProp = function (tag, type, attr) {
  28903. return (
  28904. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  28905. (attr === 'selected' && tag === 'option') ||
  28906. (attr === 'checked' && tag === 'input') ||
  28907. (attr === 'muted' && tag === 'video')
  28908. )
  28909. };
  28910. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  28911. var isBooleanAttr = makeMap(
  28912. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  28913. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  28914. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  28915. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  28916. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  28917. 'truespeed,typemustmatch,visible'
  28918. );
  28919. var xlinkNS = 'http://www.w3.org/1999/xlink';
  28920. var isXlink = function (name) {
  28921. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  28922. };
  28923. var getXlinkProp = function (name) {
  28924. return isXlink(name) ? name.slice(6, name.length) : ''
  28925. };
  28926. var isFalsyAttrValue = function (val) {
  28927. return val == null || val === false
  28928. };
  28929. /* */
  28930. function genClassForVnode (vnode) {
  28931. var data = vnode.data;
  28932. var parentNode = vnode;
  28933. var childNode = vnode;
  28934. while (childNode.componentInstance) {
  28935. childNode = childNode.componentInstance._vnode;
  28936. if (childNode.data) {
  28937. data = mergeClassData(childNode.data, data);
  28938. }
  28939. }
  28940. while ((parentNode = parentNode.parent)) {
  28941. if (parentNode.data) {
  28942. data = mergeClassData(data, parentNode.data);
  28943. }
  28944. }
  28945. return genClassFromData(data)
  28946. }
  28947. function mergeClassData (child, parent) {
  28948. return {
  28949. staticClass: concat(child.staticClass, parent.staticClass),
  28950. class: child.class
  28951. ? [child.class, parent.class]
  28952. : parent.class
  28953. }
  28954. }
  28955. function genClassFromData (data) {
  28956. var dynamicClass = data.class;
  28957. var staticClass = data.staticClass;
  28958. if (staticClass || dynamicClass) {
  28959. return concat(staticClass, stringifyClass(dynamicClass))
  28960. }
  28961. /* istanbul ignore next */
  28962. return ''
  28963. }
  28964. function concat (a, b) {
  28965. return a ? b ? (a + ' ' + b) : a : (b || '')
  28966. }
  28967. function stringifyClass (value) {
  28968. var res = '';
  28969. if (!value) {
  28970. return res
  28971. }
  28972. if (typeof value === 'string') {
  28973. return value
  28974. }
  28975. if (Array.isArray(value)) {
  28976. var stringified;
  28977. for (var i = 0, l = value.length; i < l; i++) {
  28978. if (value[i]) {
  28979. if ((stringified = stringifyClass(value[i]))) {
  28980. res += stringified + ' ';
  28981. }
  28982. }
  28983. }
  28984. return res.slice(0, -1)
  28985. }
  28986. if (isObject(value)) {
  28987. for (var key in value) {
  28988. if (value[key]) { res += key + ' '; }
  28989. }
  28990. return res.slice(0, -1)
  28991. }
  28992. /* istanbul ignore next */
  28993. return res
  28994. }
  28995. /* */
  28996. var namespaceMap = {
  28997. svg: 'http://www.w3.org/2000/svg',
  28998. math: 'http://www.w3.org/1998/Math/MathML'
  28999. };
  29000. var isHTMLTag = makeMap(
  29001. 'html,body,base,head,link,meta,style,title,' +
  29002. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  29003. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  29004. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  29005. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  29006. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  29007. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  29008. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  29009. 'output,progress,select,textarea,' +
  29010. 'details,dialog,menu,menuitem,summary,' +
  29011. 'content,element,shadow,template'
  29012. );
  29013. // this map is intentionally selective, only covering SVG elements that may
  29014. // contain child elements.
  29015. var isSVG = makeMap(
  29016. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  29017. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  29018. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  29019. true
  29020. );
  29021. var isPreTag = function (tag) { return tag === 'pre'; };
  29022. var isReservedTag = function (tag) {
  29023. return isHTMLTag(tag) || isSVG(tag)
  29024. };
  29025. function getTagNamespace (tag) {
  29026. if (isSVG(tag)) {
  29027. return 'svg'
  29028. }
  29029. // basic support for MathML
  29030. // note it doesn't support other MathML elements being component roots
  29031. if (tag === 'math') {
  29032. return 'math'
  29033. }
  29034. }
  29035. var unknownElementCache = Object.create(null);
  29036. function isUnknownElement (tag) {
  29037. /* istanbul ignore if */
  29038. if (!inBrowser) {
  29039. return true
  29040. }
  29041. if (isReservedTag(tag)) {
  29042. return false
  29043. }
  29044. tag = tag.toLowerCase();
  29045. /* istanbul ignore if */
  29046. if (unknownElementCache[tag] != null) {
  29047. return unknownElementCache[tag]
  29048. }
  29049. var el = document.createElement(tag);
  29050. if (tag.indexOf('-') > -1) {
  29051. // http://stackoverflow.com/a/28210364/1070244
  29052. return (unknownElementCache[tag] = (
  29053. el.constructor === window.HTMLUnknownElement ||
  29054. el.constructor === window.HTMLElement
  29055. ))
  29056. } else {
  29057. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  29058. }
  29059. }
  29060. /* */
  29061. /**
  29062. * Query an element selector if it's not an element already.
  29063. */
  29064. function query (el) {
  29065. if (typeof el === 'string') {
  29066. var selected = document.querySelector(el);
  29067. if (!selected) {
  29068. "development" !== 'production' && warn(
  29069. 'Cannot find element: ' + el
  29070. );
  29071. return document.createElement('div')
  29072. }
  29073. return selected
  29074. } else {
  29075. return el
  29076. }
  29077. }
  29078. /* */
  29079. function createElement$1 (tagName, vnode) {
  29080. var elm = document.createElement(tagName);
  29081. if (tagName !== 'select') {
  29082. return elm
  29083. }
  29084. // false or null will remove the attribute but undefined will not
  29085. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  29086. elm.setAttribute('multiple', 'multiple');
  29087. }
  29088. return elm
  29089. }
  29090. function createElementNS (namespace, tagName) {
  29091. return document.createElementNS(namespaceMap[namespace], tagName)
  29092. }
  29093. function createTextNode (text) {
  29094. return document.createTextNode(text)
  29095. }
  29096. function createComment (text) {
  29097. return document.createComment(text)
  29098. }
  29099. function insertBefore (parentNode, newNode, referenceNode) {
  29100. parentNode.insertBefore(newNode, referenceNode);
  29101. }
  29102. function removeChild (node, child) {
  29103. node.removeChild(child);
  29104. }
  29105. function appendChild (node, child) {
  29106. node.appendChild(child);
  29107. }
  29108. function parentNode (node) {
  29109. return node.parentNode
  29110. }
  29111. function nextSibling (node) {
  29112. return node.nextSibling
  29113. }
  29114. function tagName (node) {
  29115. return node.tagName
  29116. }
  29117. function setTextContent (node, text) {
  29118. node.textContent = text;
  29119. }
  29120. function setAttribute (node, key, val) {
  29121. node.setAttribute(key, val);
  29122. }
  29123. var nodeOps = Object.freeze({
  29124. createElement: createElement$1,
  29125. createElementNS: createElementNS,
  29126. createTextNode: createTextNode,
  29127. createComment: createComment,
  29128. insertBefore: insertBefore,
  29129. removeChild: removeChild,
  29130. appendChild: appendChild,
  29131. parentNode: parentNode,
  29132. nextSibling: nextSibling,
  29133. tagName: tagName,
  29134. setTextContent: setTextContent,
  29135. setAttribute: setAttribute
  29136. });
  29137. /* */
  29138. var ref = {
  29139. create: function create (_, vnode) {
  29140. registerRef(vnode);
  29141. },
  29142. update: function update (oldVnode, vnode) {
  29143. if (oldVnode.data.ref !== vnode.data.ref) {
  29144. registerRef(oldVnode, true);
  29145. registerRef(vnode);
  29146. }
  29147. },
  29148. destroy: function destroy (vnode) {
  29149. registerRef(vnode, true);
  29150. }
  29151. };
  29152. function registerRef (vnode, isRemoval) {
  29153. var key = vnode.data.ref;
  29154. if (!key) { return }
  29155. var vm = vnode.context;
  29156. var ref = vnode.componentInstance || vnode.elm;
  29157. var refs = vm.$refs;
  29158. if (isRemoval) {
  29159. if (Array.isArray(refs[key])) {
  29160. remove(refs[key], ref);
  29161. } else if (refs[key] === ref) {
  29162. refs[key] = undefined;
  29163. }
  29164. } else {
  29165. if (vnode.data.refInFor) {
  29166. if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
  29167. refs[key].push(ref);
  29168. } else {
  29169. refs[key] = [ref];
  29170. }
  29171. } else {
  29172. refs[key] = ref;
  29173. }
  29174. }
  29175. }
  29176. /**
  29177. * Virtual DOM patching algorithm based on Snabbdom by
  29178. * Simon Friis Vindum (@paldepind)
  29179. * Licensed under the MIT License
  29180. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  29181. *
  29182. * modified by Evan You (@yyx990803)
  29183. *
  29184. /*
  29185. * Not type-checking this because this file is perf-critical and the cost
  29186. * of making flow understand it is not worth it.
  29187. */
  29188. var emptyNode = new VNode('', {}, []);
  29189. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  29190. function isUndef (v) {
  29191. return v === undefined || v === null
  29192. }
  29193. function isDef (v) {
  29194. return v !== undefined && v !== null
  29195. }
  29196. function isTrue (v) {
  29197. return v === true
  29198. }
  29199. function sameVnode (a, b) {
  29200. return (
  29201. a.key === b.key &&
  29202. a.tag === b.tag &&
  29203. a.isComment === b.isComment &&
  29204. isDef(a.data) === isDef(b.data) &&
  29205. sameInputType(a, b)
  29206. )
  29207. }
  29208. // Some browsers do not support dynamically changing type for <input>
  29209. // so they need to be treated as different nodes
  29210. function sameInputType (a, b) {
  29211. if (a.tag !== 'input') { return true }
  29212. var i;
  29213. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  29214. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  29215. return typeA === typeB
  29216. }
  29217. function createKeyToOldIdx (children, beginIdx, endIdx) {
  29218. var i, key;
  29219. var map = {};
  29220. for (i = beginIdx; i <= endIdx; ++i) {
  29221. key = children[i].key;
  29222. if (isDef(key)) { map[key] = i; }
  29223. }
  29224. return map
  29225. }
  29226. function createPatchFunction (backend) {
  29227. var i, j;
  29228. var cbs = {};
  29229. var modules = backend.modules;
  29230. var nodeOps = backend.nodeOps;
  29231. for (i = 0; i < hooks.length; ++i) {
  29232. cbs[hooks[i]] = [];
  29233. for (j = 0; j < modules.length; ++j) {
  29234. if (isDef(modules[j][hooks[i]])) {
  29235. cbs[hooks[i]].push(modules[j][hooks[i]]);
  29236. }
  29237. }
  29238. }
  29239. function emptyNodeAt (elm) {
  29240. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  29241. }
  29242. function createRmCb (childElm, listeners) {
  29243. function remove$$1 () {
  29244. if (--remove$$1.listeners === 0) {
  29245. removeNode(childElm);
  29246. }
  29247. }
  29248. remove$$1.listeners = listeners;
  29249. return remove$$1
  29250. }
  29251. function removeNode (el) {
  29252. var parent = nodeOps.parentNode(el);
  29253. // element may have already been removed due to v-html / v-text
  29254. if (isDef(parent)) {
  29255. nodeOps.removeChild(parent, el);
  29256. }
  29257. }
  29258. var inPre = 0;
  29259. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  29260. vnode.isRootInsert = !nested; // for transition enter check
  29261. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  29262. return
  29263. }
  29264. var data = vnode.data;
  29265. var children = vnode.children;
  29266. var tag = vnode.tag;
  29267. if (isDef(tag)) {
  29268. {
  29269. if (data && data.pre) {
  29270. inPre++;
  29271. }
  29272. if (
  29273. !inPre &&
  29274. !vnode.ns &&
  29275. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  29276. config.isUnknownElement(tag)
  29277. ) {
  29278. warn(
  29279. 'Unknown custom element: <' + tag + '> - did you ' +
  29280. 'register the component correctly? For recursive components, ' +
  29281. 'make sure to provide the "name" option.',
  29282. vnode.context
  29283. );
  29284. }
  29285. }
  29286. vnode.elm = vnode.ns
  29287. ? nodeOps.createElementNS(vnode.ns, tag)
  29288. : nodeOps.createElement(tag, vnode);
  29289. setScope(vnode);
  29290. /* istanbul ignore if */
  29291. {
  29292. createChildren(vnode, children, insertedVnodeQueue);
  29293. if (isDef(data)) {
  29294. invokeCreateHooks(vnode, insertedVnodeQueue);
  29295. }
  29296. insert(parentElm, vnode.elm, refElm);
  29297. }
  29298. if ("development" !== 'production' && data && data.pre) {
  29299. inPre--;
  29300. }
  29301. } else if (isTrue(vnode.isComment)) {
  29302. vnode.elm = nodeOps.createComment(vnode.text);
  29303. insert(parentElm, vnode.elm, refElm);
  29304. } else {
  29305. vnode.elm = nodeOps.createTextNode(vnode.text);
  29306. insert(parentElm, vnode.elm, refElm);
  29307. }
  29308. }
  29309. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  29310. var i = vnode.data;
  29311. if (isDef(i)) {
  29312. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  29313. if (isDef(i = i.hook) && isDef(i = i.init)) {
  29314. i(vnode, false /* hydrating */, parentElm, refElm);
  29315. }
  29316. // after calling the init hook, if the vnode is a child component
  29317. // it should've created a child instance and mounted it. the child
  29318. // component also has set the placeholder vnode's elm.
  29319. // in that case we can just return the element and be done.
  29320. if (isDef(vnode.componentInstance)) {
  29321. initComponent(vnode, insertedVnodeQueue);
  29322. if (isTrue(isReactivated)) {
  29323. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  29324. }
  29325. return true
  29326. }
  29327. }
  29328. }
  29329. function initComponent (vnode, insertedVnodeQueue) {
  29330. if (isDef(vnode.data.pendingInsert)) {
  29331. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  29332. }
  29333. vnode.elm = vnode.componentInstance.$el;
  29334. if (isPatchable(vnode)) {
  29335. invokeCreateHooks(vnode, insertedVnodeQueue);
  29336. setScope(vnode);
  29337. } else {
  29338. // empty component root.
  29339. // skip all element-related modules except for ref (#3455)
  29340. registerRef(vnode);
  29341. // make sure to invoke the insert hook
  29342. insertedVnodeQueue.push(vnode);
  29343. }
  29344. }
  29345. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  29346. var i;
  29347. // hack for #4339: a reactivated component with inner transition
  29348. // does not trigger because the inner node's created hooks are not called
  29349. // again. It's not ideal to involve module-specific logic in here but
  29350. // there doesn't seem to be a better way to do it.
  29351. var innerNode = vnode;
  29352. while (innerNode.componentInstance) {
  29353. innerNode = innerNode.componentInstance._vnode;
  29354. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  29355. for (i = 0; i < cbs.activate.length; ++i) {
  29356. cbs.activate[i](emptyNode, innerNode);
  29357. }
  29358. insertedVnodeQueue.push(innerNode);
  29359. break
  29360. }
  29361. }
  29362. // unlike a newly created component,
  29363. // a reactivated keep-alive component doesn't insert itself
  29364. insert(parentElm, vnode.elm, refElm);
  29365. }
  29366. function insert (parent, elm, ref) {
  29367. if (isDef(parent)) {
  29368. if (isDef(ref)) {
  29369. nodeOps.insertBefore(parent, elm, ref);
  29370. } else {
  29371. nodeOps.appendChild(parent, elm);
  29372. }
  29373. }
  29374. }
  29375. function createChildren (vnode, children, insertedVnodeQueue) {
  29376. if (Array.isArray(children)) {
  29377. for (var i = 0; i < children.length; ++i) {
  29378. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  29379. }
  29380. } else if (isPrimitive(vnode.text)) {
  29381. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  29382. }
  29383. }
  29384. function isPatchable (vnode) {
  29385. while (vnode.componentInstance) {
  29386. vnode = vnode.componentInstance._vnode;
  29387. }
  29388. return isDef(vnode.tag)
  29389. }
  29390. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  29391. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  29392. cbs.create[i$1](emptyNode, vnode);
  29393. }
  29394. i = vnode.data.hook; // Reuse variable
  29395. if (isDef(i)) {
  29396. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  29397. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  29398. }
  29399. }
  29400. // set scope id attribute for scoped CSS.
  29401. // this is implemented as a special case to avoid the overhead
  29402. // of going through the normal attribute patching process.
  29403. function setScope (vnode) {
  29404. var i;
  29405. var ancestor = vnode;
  29406. while (ancestor) {
  29407. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  29408. nodeOps.setAttribute(vnode.elm, i, '');
  29409. }
  29410. ancestor = ancestor.parent;
  29411. }
  29412. // for slot content they should also get the scopeId from the host instance.
  29413. if (isDef(i = activeInstance) &&
  29414. i !== vnode.context &&
  29415. isDef(i = i.$options._scopeId)) {
  29416. nodeOps.setAttribute(vnode.elm, i, '');
  29417. }
  29418. }
  29419. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  29420. for (; startIdx <= endIdx; ++startIdx) {
  29421. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  29422. }
  29423. }
  29424. function invokeDestroyHook (vnode) {
  29425. var i, j;
  29426. var data = vnode.data;
  29427. if (isDef(data)) {
  29428. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  29429. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  29430. }
  29431. if (isDef(i = vnode.children)) {
  29432. for (j = 0; j < vnode.children.length; ++j) {
  29433. invokeDestroyHook(vnode.children[j]);
  29434. }
  29435. }
  29436. }
  29437. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  29438. for (; startIdx <= endIdx; ++startIdx) {
  29439. var ch = vnodes[startIdx];
  29440. if (isDef(ch)) {
  29441. if (isDef(ch.tag)) {
  29442. removeAndInvokeRemoveHook(ch);
  29443. invokeDestroyHook(ch);
  29444. } else { // Text node
  29445. removeNode(ch.elm);
  29446. }
  29447. }
  29448. }
  29449. }
  29450. function removeAndInvokeRemoveHook (vnode, rm) {
  29451. if (isDef(rm) || isDef(vnode.data)) {
  29452. var listeners = cbs.remove.length + 1;
  29453. if (isDef(rm)) {
  29454. // we have a recursively passed down rm callback
  29455. // increase the listeners count
  29456. rm.listeners += listeners;
  29457. } else {
  29458. // directly removing
  29459. rm = createRmCb(vnode.elm, listeners);
  29460. }
  29461. // recursively invoke hooks on child component root node
  29462. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  29463. removeAndInvokeRemoveHook(i, rm);
  29464. }
  29465. for (i = 0; i < cbs.remove.length; ++i) {
  29466. cbs.remove[i](vnode, rm);
  29467. }
  29468. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  29469. i(vnode, rm);
  29470. } else {
  29471. rm();
  29472. }
  29473. } else {
  29474. removeNode(vnode.elm);
  29475. }
  29476. }
  29477. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  29478. var oldStartIdx = 0;
  29479. var newStartIdx = 0;
  29480. var oldEndIdx = oldCh.length - 1;
  29481. var oldStartVnode = oldCh[0];
  29482. var oldEndVnode = oldCh[oldEndIdx];
  29483. var newEndIdx = newCh.length - 1;
  29484. var newStartVnode = newCh[0];
  29485. var newEndVnode = newCh[newEndIdx];
  29486. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  29487. // removeOnly is a special flag used only by <transition-group>
  29488. // to ensure removed elements stay in correct relative positions
  29489. // during leaving transitions
  29490. var canMove = !removeOnly;
  29491. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  29492. if (isUndef(oldStartVnode)) {
  29493. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  29494. } else if (isUndef(oldEndVnode)) {
  29495. oldEndVnode = oldCh[--oldEndIdx];
  29496. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  29497. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  29498. oldStartVnode = oldCh[++oldStartIdx];
  29499. newStartVnode = newCh[++newStartIdx];
  29500. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  29501. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  29502. oldEndVnode = oldCh[--oldEndIdx];
  29503. newEndVnode = newCh[--newEndIdx];
  29504. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  29505. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  29506. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  29507. oldStartVnode = oldCh[++oldStartIdx];
  29508. newEndVnode = newCh[--newEndIdx];
  29509. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  29510. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  29511. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  29512. oldEndVnode = oldCh[--oldEndIdx];
  29513. newStartVnode = newCh[++newStartIdx];
  29514. } else {
  29515. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  29516. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  29517. if (isUndef(idxInOld)) { // New element
  29518. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  29519. newStartVnode = newCh[++newStartIdx];
  29520. } else {
  29521. elmToMove = oldCh[idxInOld];
  29522. /* istanbul ignore if */
  29523. if ("development" !== 'production' && !elmToMove) {
  29524. warn(
  29525. 'It seems there are duplicate keys that is causing an update error. ' +
  29526. 'Make sure each v-for item has a unique key.'
  29527. );
  29528. }
  29529. if (sameVnode(elmToMove, newStartVnode)) {
  29530. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  29531. oldCh[idxInOld] = undefined;
  29532. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  29533. newStartVnode = newCh[++newStartIdx];
  29534. } else {
  29535. // same key but different element. treat as new element
  29536. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  29537. newStartVnode = newCh[++newStartIdx];
  29538. }
  29539. }
  29540. }
  29541. }
  29542. if (oldStartIdx > oldEndIdx) {
  29543. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  29544. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  29545. } else if (newStartIdx > newEndIdx) {
  29546. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  29547. }
  29548. }
  29549. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  29550. if (oldVnode === vnode) {
  29551. return
  29552. }
  29553. // reuse element for static trees.
  29554. // note we only do this if the vnode is cloned -
  29555. // if the new node is not cloned it means the render functions have been
  29556. // reset by the hot-reload-api and we need to do a proper re-render.
  29557. if (isTrue(vnode.isStatic) &&
  29558. isTrue(oldVnode.isStatic) &&
  29559. vnode.key === oldVnode.key &&
  29560. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  29561. vnode.elm = oldVnode.elm;
  29562. vnode.componentInstance = oldVnode.componentInstance;
  29563. return
  29564. }
  29565. var i;
  29566. var data = vnode.data;
  29567. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  29568. i(oldVnode, vnode);
  29569. }
  29570. var elm = vnode.elm = oldVnode.elm;
  29571. var oldCh = oldVnode.children;
  29572. var ch = vnode.children;
  29573. if (isDef(data) && isPatchable(vnode)) {
  29574. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  29575. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  29576. }
  29577. if (isUndef(vnode.text)) {
  29578. if (isDef(oldCh) && isDef(ch)) {
  29579. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  29580. } else if (isDef(ch)) {
  29581. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  29582. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  29583. } else if (isDef(oldCh)) {
  29584. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  29585. } else if (isDef(oldVnode.text)) {
  29586. nodeOps.setTextContent(elm, '');
  29587. }
  29588. } else if (oldVnode.text !== vnode.text) {
  29589. nodeOps.setTextContent(elm, vnode.text);
  29590. }
  29591. if (isDef(data)) {
  29592. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  29593. }
  29594. }
  29595. function invokeInsertHook (vnode, queue, initial) {
  29596. // delay insert hooks for component root nodes, invoke them after the
  29597. // element is really inserted
  29598. if (isTrue(initial) && isDef(vnode.parent)) {
  29599. vnode.parent.data.pendingInsert = queue;
  29600. } else {
  29601. for (var i = 0; i < queue.length; ++i) {
  29602. queue[i].data.hook.insert(queue[i]);
  29603. }
  29604. }
  29605. }
  29606. var bailed = false;
  29607. // list of modules that can skip create hook during hydration because they
  29608. // are already rendered on the client or has no need for initialization
  29609. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  29610. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  29611. function hydrate (elm, vnode, insertedVnodeQueue) {
  29612. {
  29613. if (!assertNodeMatch(elm, vnode)) {
  29614. return false
  29615. }
  29616. }
  29617. vnode.elm = elm;
  29618. var tag = vnode.tag;
  29619. var data = vnode.data;
  29620. var children = vnode.children;
  29621. if (isDef(data)) {
  29622. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  29623. if (isDef(i = vnode.componentInstance)) {
  29624. // child component. it should have hydrated its own tree.
  29625. initComponent(vnode, insertedVnodeQueue);
  29626. return true
  29627. }
  29628. }
  29629. if (isDef(tag)) {
  29630. if (isDef(children)) {
  29631. // empty element, allow client to pick up and populate children
  29632. if (!elm.hasChildNodes()) {
  29633. createChildren(vnode, children, insertedVnodeQueue);
  29634. } else {
  29635. var childrenMatch = true;
  29636. var childNode = elm.firstChild;
  29637. for (var i$1 = 0; i$1 < children.length; i$1++) {
  29638. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  29639. childrenMatch = false;
  29640. break
  29641. }
  29642. childNode = childNode.nextSibling;
  29643. }
  29644. // if childNode is not null, it means the actual childNodes list is
  29645. // longer than the virtual children list.
  29646. if (!childrenMatch || childNode) {
  29647. if ("development" !== 'production' &&
  29648. typeof console !== 'undefined' &&
  29649. !bailed) {
  29650. bailed = true;
  29651. console.warn('Parent: ', elm);
  29652. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  29653. }
  29654. return false
  29655. }
  29656. }
  29657. }
  29658. if (isDef(data)) {
  29659. for (var key in data) {
  29660. if (!isRenderedModule(key)) {
  29661. invokeCreateHooks(vnode, insertedVnodeQueue);
  29662. break
  29663. }
  29664. }
  29665. }
  29666. } else if (elm.data !== vnode.text) {
  29667. elm.data = vnode.text;
  29668. }
  29669. return true
  29670. }
  29671. function assertNodeMatch (node, vnode) {
  29672. if (isDef(vnode.tag)) {
  29673. return (
  29674. vnode.tag.indexOf('vue-component') === 0 ||
  29675. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  29676. )
  29677. } else {
  29678. return node.nodeType === (vnode.isComment ? 8 : 3)
  29679. }
  29680. }
  29681. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  29682. if (isUndef(vnode)) {
  29683. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  29684. return
  29685. }
  29686. var isInitialPatch = false;
  29687. var insertedVnodeQueue = [];
  29688. if (isUndef(oldVnode)) {
  29689. // empty mount (likely as component), create new root element
  29690. isInitialPatch = true;
  29691. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  29692. } else {
  29693. var isRealElement = isDef(oldVnode.nodeType);
  29694. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  29695. // patch existing root node
  29696. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  29697. } else {
  29698. if (isRealElement) {
  29699. // mounting to a real element
  29700. // check if this is server-rendered content and if we can perform
  29701. // a successful hydration.
  29702. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  29703. oldVnode.removeAttribute('server-rendered');
  29704. hydrating = true;
  29705. }
  29706. if (isTrue(hydrating)) {
  29707. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  29708. invokeInsertHook(vnode, insertedVnodeQueue, true);
  29709. return oldVnode
  29710. } else {
  29711. warn(
  29712. 'The client-side rendered virtual DOM tree is not matching ' +
  29713. 'server-rendered content. This is likely caused by incorrect ' +
  29714. 'HTML markup, for example nesting block-level elements inside ' +
  29715. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  29716. 'full client-side render.'
  29717. );
  29718. }
  29719. }
  29720. // either not server-rendered, or hydration failed.
  29721. // create an empty node and replace it
  29722. oldVnode = emptyNodeAt(oldVnode);
  29723. }
  29724. // replacing existing element
  29725. var oldElm = oldVnode.elm;
  29726. var parentElm$1 = nodeOps.parentNode(oldElm);
  29727. createElm(
  29728. vnode,
  29729. insertedVnodeQueue,
  29730. // extremely rare edge case: do not insert if old element is in a
  29731. // leaving transition. Only happens when combining transition +
  29732. // keep-alive + HOCs. (#4590)
  29733. oldElm._leaveCb ? null : parentElm$1,
  29734. nodeOps.nextSibling(oldElm)
  29735. );
  29736. if (isDef(vnode.parent)) {
  29737. // component root element replaced.
  29738. // update parent placeholder node element, recursively
  29739. var ancestor = vnode.parent;
  29740. while (ancestor) {
  29741. ancestor.elm = vnode.elm;
  29742. ancestor = ancestor.parent;
  29743. }
  29744. if (isPatchable(vnode)) {
  29745. for (var i = 0; i < cbs.create.length; ++i) {
  29746. cbs.create[i](emptyNode, vnode.parent);
  29747. }
  29748. }
  29749. }
  29750. if (isDef(parentElm$1)) {
  29751. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  29752. } else if (isDef(oldVnode.tag)) {
  29753. invokeDestroyHook(oldVnode);
  29754. }
  29755. }
  29756. }
  29757. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  29758. return vnode.elm
  29759. }
  29760. }
  29761. /* */
  29762. var directives = {
  29763. create: updateDirectives,
  29764. update: updateDirectives,
  29765. destroy: function unbindDirectives (vnode) {
  29766. updateDirectives(vnode, emptyNode);
  29767. }
  29768. };
  29769. function updateDirectives (oldVnode, vnode) {
  29770. if (oldVnode.data.directives || vnode.data.directives) {
  29771. _update(oldVnode, vnode);
  29772. }
  29773. }
  29774. function _update (oldVnode, vnode) {
  29775. var isCreate = oldVnode === emptyNode;
  29776. var isDestroy = vnode === emptyNode;
  29777. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  29778. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  29779. var dirsWithInsert = [];
  29780. var dirsWithPostpatch = [];
  29781. var key, oldDir, dir;
  29782. for (key in newDirs) {
  29783. oldDir = oldDirs[key];
  29784. dir = newDirs[key];
  29785. if (!oldDir) {
  29786. // new directive, bind
  29787. callHook$1(dir, 'bind', vnode, oldVnode);
  29788. if (dir.def && dir.def.inserted) {
  29789. dirsWithInsert.push(dir);
  29790. }
  29791. } else {
  29792. // existing directive, update
  29793. dir.oldValue = oldDir.value;
  29794. callHook$1(dir, 'update', vnode, oldVnode);
  29795. if (dir.def && dir.def.componentUpdated) {
  29796. dirsWithPostpatch.push(dir);
  29797. }
  29798. }
  29799. }
  29800. if (dirsWithInsert.length) {
  29801. var callInsert = function () {
  29802. for (var i = 0; i < dirsWithInsert.length; i++) {
  29803. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  29804. }
  29805. };
  29806. if (isCreate) {
  29807. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  29808. } else {
  29809. callInsert();
  29810. }
  29811. }
  29812. if (dirsWithPostpatch.length) {
  29813. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  29814. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  29815. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  29816. }
  29817. });
  29818. }
  29819. if (!isCreate) {
  29820. for (key in oldDirs) {
  29821. if (!newDirs[key]) {
  29822. // no longer present, unbind
  29823. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  29824. }
  29825. }
  29826. }
  29827. }
  29828. var emptyModifiers = Object.create(null);
  29829. function normalizeDirectives$1 (
  29830. dirs,
  29831. vm
  29832. ) {
  29833. var res = Object.create(null);
  29834. if (!dirs) {
  29835. return res
  29836. }
  29837. var i, dir;
  29838. for (i = 0; i < dirs.length; i++) {
  29839. dir = dirs[i];
  29840. if (!dir.modifiers) {
  29841. dir.modifiers = emptyModifiers;
  29842. }
  29843. res[getRawDirName(dir)] = dir;
  29844. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  29845. }
  29846. return res
  29847. }
  29848. function getRawDirName (dir) {
  29849. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  29850. }
  29851. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  29852. var fn = dir.def && dir.def[hook];
  29853. if (fn) {
  29854. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  29855. }
  29856. }
  29857. var baseModules = [
  29858. ref,
  29859. directives
  29860. ];
  29861. /* */
  29862. function updateAttrs (oldVnode, vnode) {
  29863. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  29864. return
  29865. }
  29866. var key, cur, old;
  29867. var elm = vnode.elm;
  29868. var oldAttrs = oldVnode.data.attrs || {};
  29869. var attrs = vnode.data.attrs || {};
  29870. // clone observed objects, as the user probably wants to mutate it
  29871. if (attrs.__ob__) {
  29872. attrs = vnode.data.attrs = extend({}, attrs);
  29873. }
  29874. for (key in attrs) {
  29875. cur = attrs[key];
  29876. old = oldAttrs[key];
  29877. if (old !== cur) {
  29878. setAttr(elm, key, cur);
  29879. }
  29880. }
  29881. // #4391: in IE9, setting type can reset value for input[type=radio]
  29882. /* istanbul ignore if */
  29883. if (isIE9 && attrs.value !== oldAttrs.value) {
  29884. setAttr(elm, 'value', attrs.value);
  29885. }
  29886. for (key in oldAttrs) {
  29887. if (attrs[key] == null) {
  29888. if (isXlink(key)) {
  29889. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  29890. } else if (!isEnumeratedAttr(key)) {
  29891. elm.removeAttribute(key);
  29892. }
  29893. }
  29894. }
  29895. }
  29896. function setAttr (el, key, value) {
  29897. if (isBooleanAttr(key)) {
  29898. // set attribute for blank value
  29899. // e.g. <option disabled>Select one</option>
  29900. if (isFalsyAttrValue(value)) {
  29901. el.removeAttribute(key);
  29902. } else {
  29903. el.setAttribute(key, key);
  29904. }
  29905. } else if (isEnumeratedAttr(key)) {
  29906. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  29907. } else if (isXlink(key)) {
  29908. if (isFalsyAttrValue(value)) {
  29909. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  29910. } else {
  29911. el.setAttributeNS(xlinkNS, key, value);
  29912. }
  29913. } else {
  29914. if (isFalsyAttrValue(value)) {
  29915. el.removeAttribute(key);
  29916. } else {
  29917. el.setAttribute(key, value);
  29918. }
  29919. }
  29920. }
  29921. var attrs = {
  29922. create: updateAttrs,
  29923. update: updateAttrs
  29924. };
  29925. /* */
  29926. function updateClass (oldVnode, vnode) {
  29927. var el = vnode.elm;
  29928. var data = vnode.data;
  29929. var oldData = oldVnode.data;
  29930. if (!data.staticClass && !data.class &&
  29931. (!oldData || (!oldData.staticClass && !oldData.class))) {
  29932. return
  29933. }
  29934. var cls = genClassForVnode(vnode);
  29935. // handle transition classes
  29936. var transitionClass = el._transitionClasses;
  29937. if (transitionClass) {
  29938. cls = concat(cls, stringifyClass(transitionClass));
  29939. }
  29940. // set the class
  29941. if (cls !== el._prevClass) {
  29942. el.setAttribute('class', cls);
  29943. el._prevClass = cls;
  29944. }
  29945. }
  29946. var klass = {
  29947. create: updateClass,
  29948. update: updateClass
  29949. };
  29950. /* */
  29951. var validDivisionCharRE = /[\w).+\-_$\]]/;
  29952. function parseFilters (exp) {
  29953. var inSingle = false;
  29954. var inDouble = false;
  29955. var inTemplateString = false;
  29956. var inRegex = false;
  29957. var curly = 0;
  29958. var square = 0;
  29959. var paren = 0;
  29960. var lastFilterIndex = 0;
  29961. var c, prev, i, expression, filters;
  29962. for (i = 0; i < exp.length; i++) {
  29963. prev = c;
  29964. c = exp.charCodeAt(i);
  29965. if (inSingle) {
  29966. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  29967. } else if (inDouble) {
  29968. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  29969. } else if (inTemplateString) {
  29970. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  29971. } else if (inRegex) {
  29972. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  29973. } else if (
  29974. c === 0x7C && // pipe
  29975. exp.charCodeAt(i + 1) !== 0x7C &&
  29976. exp.charCodeAt(i - 1) !== 0x7C &&
  29977. !curly && !square && !paren
  29978. ) {
  29979. if (expression === undefined) {
  29980. // first filter, end of expression
  29981. lastFilterIndex = i + 1;
  29982. expression = exp.slice(0, i).trim();
  29983. } else {
  29984. pushFilter();
  29985. }
  29986. } else {
  29987. switch (c) {
  29988. case 0x22: inDouble = true; break // "
  29989. case 0x27: inSingle = true; break // '
  29990. case 0x60: inTemplateString = true; break // `
  29991. case 0x28: paren++; break // (
  29992. case 0x29: paren--; break // )
  29993. case 0x5B: square++; break // [
  29994. case 0x5D: square--; break // ]
  29995. case 0x7B: curly++; break // {
  29996. case 0x7D: curly--; break // }
  29997. }
  29998. if (c === 0x2f) { // /
  29999. var j = i - 1;
  30000. var p = (void 0);
  30001. // find first non-whitespace prev char
  30002. for (; j >= 0; j--) {
  30003. p = exp.charAt(j);
  30004. if (p !== ' ') { break }
  30005. }
  30006. if (!p || !validDivisionCharRE.test(p)) {
  30007. inRegex = true;
  30008. }
  30009. }
  30010. }
  30011. }
  30012. if (expression === undefined) {
  30013. expression = exp.slice(0, i).trim();
  30014. } else if (lastFilterIndex !== 0) {
  30015. pushFilter();
  30016. }
  30017. function pushFilter () {
  30018. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  30019. lastFilterIndex = i + 1;
  30020. }
  30021. if (filters) {
  30022. for (i = 0; i < filters.length; i++) {
  30023. expression = wrapFilter(expression, filters[i]);
  30024. }
  30025. }
  30026. return expression
  30027. }
  30028. function wrapFilter (exp, filter) {
  30029. var i = filter.indexOf('(');
  30030. if (i < 0) {
  30031. // _f: resolveFilter
  30032. return ("_f(\"" + filter + "\")(" + exp + ")")
  30033. } else {
  30034. var name = filter.slice(0, i);
  30035. var args = filter.slice(i + 1);
  30036. return ("_f(\"" + name + "\")(" + exp + "," + args)
  30037. }
  30038. }
  30039. /* */
  30040. function baseWarn (msg) {
  30041. console.error(("[Vue compiler]: " + msg));
  30042. }
  30043. function pluckModuleFunction (
  30044. modules,
  30045. key
  30046. ) {
  30047. return modules
  30048. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  30049. : []
  30050. }
  30051. function addProp (el, name, value) {
  30052. (el.props || (el.props = [])).push({ name: name, value: value });
  30053. }
  30054. function addAttr (el, name, value) {
  30055. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  30056. }
  30057. function addDirective (
  30058. el,
  30059. name,
  30060. rawName,
  30061. value,
  30062. arg,
  30063. modifiers
  30064. ) {
  30065. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  30066. }
  30067. function addHandler (
  30068. el,
  30069. name,
  30070. value,
  30071. modifiers,
  30072. important
  30073. ) {
  30074. // check capture modifier
  30075. if (modifiers && modifiers.capture) {
  30076. delete modifiers.capture;
  30077. name = '!' + name; // mark the event as captured
  30078. }
  30079. if (modifiers && modifiers.once) {
  30080. delete modifiers.once;
  30081. name = '~' + name; // mark the event as once
  30082. }
  30083. var events;
  30084. if (modifiers && modifiers.native) {
  30085. delete modifiers.native;
  30086. events = el.nativeEvents || (el.nativeEvents = {});
  30087. } else {
  30088. events = el.events || (el.events = {});
  30089. }
  30090. var newHandler = { value: value, modifiers: modifiers };
  30091. var handlers = events[name];
  30092. /* istanbul ignore if */
  30093. if (Array.isArray(handlers)) {
  30094. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  30095. } else if (handlers) {
  30096. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  30097. } else {
  30098. events[name] = newHandler;
  30099. }
  30100. }
  30101. function getBindingAttr (
  30102. el,
  30103. name,
  30104. getStatic
  30105. ) {
  30106. var dynamicValue =
  30107. getAndRemoveAttr(el, ':' + name) ||
  30108. getAndRemoveAttr(el, 'v-bind:' + name);
  30109. if (dynamicValue != null) {
  30110. return parseFilters(dynamicValue)
  30111. } else if (getStatic !== false) {
  30112. var staticValue = getAndRemoveAttr(el, name);
  30113. if (staticValue != null) {
  30114. return JSON.stringify(staticValue)
  30115. }
  30116. }
  30117. }
  30118. function getAndRemoveAttr (el, name) {
  30119. var val;
  30120. if ((val = el.attrsMap[name]) != null) {
  30121. var list = el.attrsList;
  30122. for (var i = 0, l = list.length; i < l; i++) {
  30123. if (list[i].name === name) {
  30124. list.splice(i, 1);
  30125. break
  30126. }
  30127. }
  30128. }
  30129. return val
  30130. }
  30131. /* */
  30132. /**
  30133. * Cross-platform code generation for component v-model
  30134. */
  30135. function genComponentModel (
  30136. el,
  30137. value,
  30138. modifiers
  30139. ) {
  30140. var ref = modifiers || {};
  30141. var number = ref.number;
  30142. var trim = ref.trim;
  30143. var baseValueExpression = '$$v';
  30144. var valueExpression = baseValueExpression;
  30145. if (trim) {
  30146. valueExpression =
  30147. "(typeof " + baseValueExpression + " === 'string'" +
  30148. "? " + baseValueExpression + ".trim()" +
  30149. ": " + baseValueExpression + ")";
  30150. }
  30151. if (number) {
  30152. valueExpression = "_n(" + valueExpression + ")";
  30153. }
  30154. var assignment = genAssignmentCode(value, valueExpression);
  30155. el.model = {
  30156. value: ("(" + value + ")"),
  30157. expression: ("\"" + value + "\""),
  30158. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  30159. };
  30160. }
  30161. /**
  30162. * Cross-platform codegen helper for generating v-model value assignment code.
  30163. */
  30164. function genAssignmentCode (
  30165. value,
  30166. assignment
  30167. ) {
  30168. var modelRs = parseModel(value);
  30169. if (modelRs.idx === null) {
  30170. return (value + "=" + assignment)
  30171. } else {
  30172. return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
  30173. "if (!Array.isArray($$exp)){" +
  30174. value + "=" + assignment + "}" +
  30175. "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  30176. }
  30177. }
  30178. /**
  30179. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  30180. *
  30181. * for loop possible cases:
  30182. *
  30183. * - test
  30184. * - test[idx]
  30185. * - test[test1[idx]]
  30186. * - test["a"][idx]
  30187. * - xxx.test[a[a].test1[idx]]
  30188. * - test.xxx.a["asa"][test1[idx]]
  30189. *
  30190. */
  30191. var len;
  30192. var str;
  30193. var chr;
  30194. var index$1;
  30195. var expressionPos;
  30196. var expressionEndPos;
  30197. function parseModel (val) {
  30198. str = val;
  30199. len = str.length;
  30200. index$1 = expressionPos = expressionEndPos = 0;
  30201. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  30202. return {
  30203. exp: val,
  30204. idx: null
  30205. }
  30206. }
  30207. while (!eof()) {
  30208. chr = next();
  30209. /* istanbul ignore if */
  30210. if (isStringStart(chr)) {
  30211. parseString(chr);
  30212. } else if (chr === 0x5B) {
  30213. parseBracket(chr);
  30214. }
  30215. }
  30216. return {
  30217. exp: val.substring(0, expressionPos),
  30218. idx: val.substring(expressionPos + 1, expressionEndPos)
  30219. }
  30220. }
  30221. function next () {
  30222. return str.charCodeAt(++index$1)
  30223. }
  30224. function eof () {
  30225. return index$1 >= len
  30226. }
  30227. function isStringStart (chr) {
  30228. return chr === 0x22 || chr === 0x27
  30229. }
  30230. function parseBracket (chr) {
  30231. var inBracket = 1;
  30232. expressionPos = index$1;
  30233. while (!eof()) {
  30234. chr = next();
  30235. if (isStringStart(chr)) {
  30236. parseString(chr);
  30237. continue
  30238. }
  30239. if (chr === 0x5B) { inBracket++; }
  30240. if (chr === 0x5D) { inBracket--; }
  30241. if (inBracket === 0) {
  30242. expressionEndPos = index$1;
  30243. break
  30244. }
  30245. }
  30246. }
  30247. function parseString (chr) {
  30248. var stringQuote = chr;
  30249. while (!eof()) {
  30250. chr = next();
  30251. if (chr === stringQuote) {
  30252. break
  30253. }
  30254. }
  30255. }
  30256. /* */
  30257. var warn$1;
  30258. // in some cases, the event used has to be determined at runtime
  30259. // so we used some reserved tokens during compile.
  30260. var RANGE_TOKEN = '__r';
  30261. var CHECKBOX_RADIO_TOKEN = '__c';
  30262. function model (
  30263. el,
  30264. dir,
  30265. _warn
  30266. ) {
  30267. warn$1 = _warn;
  30268. var value = dir.value;
  30269. var modifiers = dir.modifiers;
  30270. var tag = el.tag;
  30271. var type = el.attrsMap.type;
  30272. {
  30273. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  30274. if (tag === 'input' && dynamicType) {
  30275. warn$1(
  30276. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  30277. "v-model does not support dynamic input types. Use v-if branches instead."
  30278. );
  30279. }
  30280. // inputs with type="file" are read only and setting the input's
  30281. // value will throw an error.
  30282. if (tag === 'input' && type === 'file') {
  30283. warn$1(
  30284. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  30285. "File inputs are read only. Use a v-on:change listener instead."
  30286. );
  30287. }
  30288. }
  30289. if (tag === 'select') {
  30290. genSelect(el, value, modifiers);
  30291. } else if (tag === 'input' && type === 'checkbox') {
  30292. genCheckboxModel(el, value, modifiers);
  30293. } else if (tag === 'input' && type === 'radio') {
  30294. genRadioModel(el, value, modifiers);
  30295. } else if (tag === 'input' || tag === 'textarea') {
  30296. genDefaultModel(el, value, modifiers);
  30297. } else if (!config.isReservedTag(tag)) {
  30298. genComponentModel(el, value, modifiers);
  30299. // component v-model doesn't need extra runtime
  30300. return false
  30301. } else {
  30302. warn$1(
  30303. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  30304. "v-model is not supported on this element type. " +
  30305. 'If you are working with contenteditable, it\'s recommended to ' +
  30306. 'wrap a library dedicated for that purpose inside a custom component.'
  30307. );
  30308. }
  30309. // ensure runtime directive metadata
  30310. return true
  30311. }
  30312. function genCheckboxModel (
  30313. el,
  30314. value,
  30315. modifiers
  30316. ) {
  30317. var number = modifiers && modifiers.number;
  30318. var valueBinding = getBindingAttr(el, 'value') || 'null';
  30319. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  30320. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  30321. addProp(el, 'checked',
  30322. "Array.isArray(" + value + ")" +
  30323. "?_i(" + value + "," + valueBinding + ")>-1" + (
  30324. trueValueBinding === 'true'
  30325. ? (":(" + value + ")")
  30326. : (":_q(" + value + "," + trueValueBinding + ")")
  30327. )
  30328. );
  30329. addHandler(el, CHECKBOX_RADIO_TOKEN,
  30330. "var $$a=" + value + "," +
  30331. '$$el=$event.target,' +
  30332. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  30333. 'if(Array.isArray($$a)){' +
  30334. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  30335. '$$i=_i($$a,$$v);' +
  30336. "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  30337. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  30338. "}else{" + value + "=$$c}",
  30339. null, true
  30340. );
  30341. }
  30342. function genRadioModel (
  30343. el,
  30344. value,
  30345. modifiers
  30346. ) {
  30347. var number = modifiers && modifiers.number;
  30348. var valueBinding = getBindingAttr(el, 'value') || 'null';
  30349. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  30350. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  30351. addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
  30352. }
  30353. function genSelect (
  30354. el,
  30355. value,
  30356. modifiers
  30357. ) {
  30358. var number = modifiers && modifiers.number;
  30359. var selectedVal = "Array.prototype.filter" +
  30360. ".call($event.target.options,function(o){return o.selected})" +
  30361. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  30362. "return " + (number ? '_n(val)' : 'val') + "})";
  30363. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  30364. var code = "var $$selectedVal = " + selectedVal + ";";
  30365. code = code + " " + (genAssignmentCode(value, assignment));
  30366. addHandler(el, 'change', code, null, true);
  30367. }
  30368. function genDefaultModel (
  30369. el,
  30370. value,
  30371. modifiers
  30372. ) {
  30373. var type = el.attrsMap.type;
  30374. var ref = modifiers || {};
  30375. var lazy = ref.lazy;
  30376. var number = ref.number;
  30377. var trim = ref.trim;
  30378. var needCompositionGuard = !lazy && type !== 'range';
  30379. var event = lazy
  30380. ? 'change'
  30381. : type === 'range'
  30382. ? RANGE_TOKEN
  30383. : 'input';
  30384. var valueExpression = '$event.target.value';
  30385. if (trim) {
  30386. valueExpression = "$event.target.value.trim()";
  30387. }
  30388. if (number) {
  30389. valueExpression = "_n(" + valueExpression + ")";
  30390. }
  30391. var code = genAssignmentCode(value, valueExpression);
  30392. if (needCompositionGuard) {
  30393. code = "if($event.target.composing)return;" + code;
  30394. }
  30395. addProp(el, 'value', ("(" + value + ")"));
  30396. addHandler(el, event, code, null, true);
  30397. if (trim || number || type === 'number') {
  30398. addHandler(el, 'blur', '$forceUpdate()');
  30399. }
  30400. }
  30401. /* */
  30402. // normalize v-model event tokens that can only be determined at runtime.
  30403. // it's important to place the event as the first in the array because
  30404. // the whole point is ensuring the v-model callback gets called before
  30405. // user-attached handlers.
  30406. function normalizeEvents (on) {
  30407. var event;
  30408. /* istanbul ignore if */
  30409. if (on[RANGE_TOKEN]) {
  30410. // IE input[type=range] only supports `change` event
  30411. event = isIE ? 'change' : 'input';
  30412. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  30413. delete on[RANGE_TOKEN];
  30414. }
  30415. if (on[CHECKBOX_RADIO_TOKEN]) {
  30416. // Chrome fires microtasks in between click/change, leads to #4521
  30417. event = isChrome ? 'click' : 'change';
  30418. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  30419. delete on[CHECKBOX_RADIO_TOKEN];
  30420. }
  30421. }
  30422. var target$1;
  30423. function add$1 (
  30424. event,
  30425. handler,
  30426. once,
  30427. capture
  30428. ) {
  30429. if (once) {
  30430. var oldHandler = handler;
  30431. var _target = target$1; // save current target element in closure
  30432. handler = function (ev) {
  30433. var res = arguments.length === 1
  30434. ? oldHandler(ev)
  30435. : oldHandler.apply(null, arguments);
  30436. if (res !== null) {
  30437. remove$2(event, handler, capture, _target);
  30438. }
  30439. };
  30440. }
  30441. target$1.addEventListener(event, handler, capture);
  30442. }
  30443. function remove$2 (
  30444. event,
  30445. handler,
  30446. capture,
  30447. _target
  30448. ) {
  30449. (_target || target$1).removeEventListener(event, handler, capture);
  30450. }
  30451. function updateDOMListeners (oldVnode, vnode) {
  30452. if (!oldVnode.data.on && !vnode.data.on) {
  30453. return
  30454. }
  30455. var on = vnode.data.on || {};
  30456. var oldOn = oldVnode.data.on || {};
  30457. target$1 = vnode.elm;
  30458. normalizeEvents(on);
  30459. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  30460. }
  30461. var events = {
  30462. create: updateDOMListeners,
  30463. update: updateDOMListeners
  30464. };
  30465. /* */
  30466. function updateDOMProps (oldVnode, vnode) {
  30467. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  30468. return
  30469. }
  30470. var key, cur;
  30471. var elm = vnode.elm;
  30472. var oldProps = oldVnode.data.domProps || {};
  30473. var props = vnode.data.domProps || {};
  30474. // clone observed objects, as the user probably wants to mutate it
  30475. if (props.__ob__) {
  30476. props = vnode.data.domProps = extend({}, props);
  30477. }
  30478. for (key in oldProps) {
  30479. if (props[key] == null) {
  30480. elm[key] = '';
  30481. }
  30482. }
  30483. for (key in props) {
  30484. cur = props[key];
  30485. // ignore children if the node has textContent or innerHTML,
  30486. // as these will throw away existing DOM nodes and cause removal errors
  30487. // on subsequent patches (#3360)
  30488. if (key === 'textContent' || key === 'innerHTML') {
  30489. if (vnode.children) { vnode.children.length = 0; }
  30490. if (cur === oldProps[key]) { continue }
  30491. }
  30492. if (key === 'value') {
  30493. // store value as _value as well since
  30494. // non-string values will be stringified
  30495. elm._value = cur;
  30496. // avoid resetting cursor position when value is the same
  30497. var strCur = cur == null ? '' : String(cur);
  30498. if (shouldUpdateValue(elm, vnode, strCur)) {
  30499. elm.value = strCur;
  30500. }
  30501. } else {
  30502. elm[key] = cur;
  30503. }
  30504. }
  30505. }
  30506. // check platforms/web/util/attrs.js acceptValue
  30507. function shouldUpdateValue (
  30508. elm,
  30509. vnode,
  30510. checkVal
  30511. ) {
  30512. return (!elm.composing && (
  30513. vnode.tag === 'option' ||
  30514. isDirty(elm, checkVal) ||
  30515. isInputChanged(elm, checkVal)
  30516. ))
  30517. }
  30518. function isDirty (elm, checkVal) {
  30519. // return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
  30520. return document.activeElement !== elm && elm.value !== checkVal
  30521. }
  30522. function isInputChanged (elm, newVal) {
  30523. var value = elm.value;
  30524. var modifiers = elm._vModifiers; // injected by v-model runtime
  30525. if ((modifiers && modifiers.number) || elm.type === 'number') {
  30526. return toNumber(value) !== toNumber(newVal)
  30527. }
  30528. if (modifiers && modifiers.trim) {
  30529. return value.trim() !== newVal.trim()
  30530. }
  30531. return value !== newVal
  30532. }
  30533. var domProps = {
  30534. create: updateDOMProps,
  30535. update: updateDOMProps
  30536. };
  30537. /* */
  30538. var parseStyleText = cached(function (cssText) {
  30539. var res = {};
  30540. var listDelimiter = /;(?![^(]*\))/g;
  30541. var propertyDelimiter = /:(.+)/;
  30542. cssText.split(listDelimiter).forEach(function (item) {
  30543. if (item) {
  30544. var tmp = item.split(propertyDelimiter);
  30545. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  30546. }
  30547. });
  30548. return res
  30549. });
  30550. // merge static and dynamic style data on the same vnode
  30551. function normalizeStyleData (data) {
  30552. var style = normalizeStyleBinding(data.style);
  30553. // static style is pre-processed into an object during compilation
  30554. // and is always a fresh object, so it's safe to merge into it
  30555. return data.staticStyle
  30556. ? extend(data.staticStyle, style)
  30557. : style
  30558. }
  30559. // normalize possible array / string values into Object
  30560. function normalizeStyleBinding (bindingStyle) {
  30561. if (Array.isArray(bindingStyle)) {
  30562. return toObject(bindingStyle)
  30563. }
  30564. if (typeof bindingStyle === 'string') {
  30565. return parseStyleText(bindingStyle)
  30566. }
  30567. return bindingStyle
  30568. }
  30569. /**
  30570. * parent component style should be after child's
  30571. * so that parent component's style could override it
  30572. */
  30573. function getStyle (vnode, checkChild) {
  30574. var res = {};
  30575. var styleData;
  30576. if (checkChild) {
  30577. var childNode = vnode;
  30578. while (childNode.componentInstance) {
  30579. childNode = childNode.componentInstance._vnode;
  30580. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  30581. extend(res, styleData);
  30582. }
  30583. }
  30584. }
  30585. if ((styleData = normalizeStyleData(vnode.data))) {
  30586. extend(res, styleData);
  30587. }
  30588. var parentNode = vnode;
  30589. while ((parentNode = parentNode.parent)) {
  30590. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  30591. extend(res, styleData);
  30592. }
  30593. }
  30594. return res
  30595. }
  30596. /* */
  30597. var cssVarRE = /^--/;
  30598. var importantRE = /\s*!important$/;
  30599. var setProp = function (el, name, val) {
  30600. /* istanbul ignore if */
  30601. if (cssVarRE.test(name)) {
  30602. el.style.setProperty(name, val);
  30603. } else if (importantRE.test(val)) {
  30604. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  30605. } else {
  30606. el.style[normalize(name)] = val;
  30607. }
  30608. };
  30609. var prefixes = ['Webkit', 'Moz', 'ms'];
  30610. var testEl;
  30611. var normalize = cached(function (prop) {
  30612. testEl = testEl || document.createElement('div');
  30613. prop = camelize(prop);
  30614. if (prop !== 'filter' && (prop in testEl.style)) {
  30615. return prop
  30616. }
  30617. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  30618. for (var i = 0; i < prefixes.length; i++) {
  30619. var prefixed = prefixes[i] + upper;
  30620. if (prefixed in testEl.style) {
  30621. return prefixed
  30622. }
  30623. }
  30624. });
  30625. function updateStyle (oldVnode, vnode) {
  30626. var data = vnode.data;
  30627. var oldData = oldVnode.data;
  30628. if (!data.staticStyle && !data.style &&
  30629. !oldData.staticStyle && !oldData.style) {
  30630. return
  30631. }
  30632. var cur, name;
  30633. var el = vnode.elm;
  30634. var oldStaticStyle = oldVnode.data.staticStyle;
  30635. var oldStyleBinding = oldVnode.data.style || {};
  30636. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  30637. var oldStyle = oldStaticStyle || oldStyleBinding;
  30638. var style = normalizeStyleBinding(vnode.data.style) || {};
  30639. vnode.data.style = style.__ob__ ? extend({}, style) : style;
  30640. var newStyle = getStyle(vnode, true);
  30641. for (name in oldStyle) {
  30642. if (newStyle[name] == null) {
  30643. setProp(el, name, '');
  30644. }
  30645. }
  30646. for (name in newStyle) {
  30647. cur = newStyle[name];
  30648. if (cur !== oldStyle[name]) {
  30649. // ie9 setting to null has no effect, must use empty string
  30650. setProp(el, name, cur == null ? '' : cur);
  30651. }
  30652. }
  30653. }
  30654. var style = {
  30655. create: updateStyle,
  30656. update: updateStyle
  30657. };
  30658. /* */
  30659. /**
  30660. * Add class with compatibility for SVG since classList is not supported on
  30661. * SVG elements in IE
  30662. */
  30663. function addClass (el, cls) {
  30664. /* istanbul ignore if */
  30665. if (!cls || !(cls = cls.trim())) {
  30666. return
  30667. }
  30668. /* istanbul ignore else */
  30669. if (el.classList) {
  30670. if (cls.indexOf(' ') > -1) {
  30671. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  30672. } else {
  30673. el.classList.add(cls);
  30674. }
  30675. } else {
  30676. var cur = " " + (el.getAttribute('class') || '') + " ";
  30677. if (cur.indexOf(' ' + cls + ' ') < 0) {
  30678. el.setAttribute('class', (cur + cls).trim());
  30679. }
  30680. }
  30681. }
  30682. /**
  30683. * Remove class with compatibility for SVG since classList is not supported on
  30684. * SVG elements in IE
  30685. */
  30686. function removeClass (el, cls) {
  30687. /* istanbul ignore if */
  30688. if (!cls || !(cls = cls.trim())) {
  30689. return
  30690. }
  30691. /* istanbul ignore else */
  30692. if (el.classList) {
  30693. if (cls.indexOf(' ') > -1) {
  30694. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  30695. } else {
  30696. el.classList.remove(cls);
  30697. }
  30698. } else {
  30699. var cur = " " + (el.getAttribute('class') || '') + " ";
  30700. var tar = ' ' + cls + ' ';
  30701. while (cur.indexOf(tar) >= 0) {
  30702. cur = cur.replace(tar, ' ');
  30703. }
  30704. el.setAttribute('class', cur.trim());
  30705. }
  30706. }
  30707. /* */
  30708. function resolveTransition (def$$1) {
  30709. if (!def$$1) {
  30710. return
  30711. }
  30712. /* istanbul ignore else */
  30713. if (typeof def$$1 === 'object') {
  30714. var res = {};
  30715. if (def$$1.css !== false) {
  30716. extend(res, autoCssTransition(def$$1.name || 'v'));
  30717. }
  30718. extend(res, def$$1);
  30719. return res
  30720. } else if (typeof def$$1 === 'string') {
  30721. return autoCssTransition(def$$1)
  30722. }
  30723. }
  30724. var autoCssTransition = cached(function (name) {
  30725. return {
  30726. enterClass: (name + "-enter"),
  30727. enterToClass: (name + "-enter-to"),
  30728. enterActiveClass: (name + "-enter-active"),
  30729. leaveClass: (name + "-leave"),
  30730. leaveToClass: (name + "-leave-to"),
  30731. leaveActiveClass: (name + "-leave-active")
  30732. }
  30733. });
  30734. var hasTransition = inBrowser && !isIE9;
  30735. var TRANSITION = 'transition';
  30736. var ANIMATION = 'animation';
  30737. // Transition property/event sniffing
  30738. var transitionProp = 'transition';
  30739. var transitionEndEvent = 'transitionend';
  30740. var animationProp = 'animation';
  30741. var animationEndEvent = 'animationend';
  30742. if (hasTransition) {
  30743. /* istanbul ignore if */
  30744. if (window.ontransitionend === undefined &&
  30745. window.onwebkittransitionend !== undefined) {
  30746. transitionProp = 'WebkitTransition';
  30747. transitionEndEvent = 'webkitTransitionEnd';
  30748. }
  30749. if (window.onanimationend === undefined &&
  30750. window.onwebkitanimationend !== undefined) {
  30751. animationProp = 'WebkitAnimation';
  30752. animationEndEvent = 'webkitAnimationEnd';
  30753. }
  30754. }
  30755. // binding to window is necessary to make hot reload work in IE in strict mode
  30756. var raf = inBrowser && window.requestAnimationFrame
  30757. ? window.requestAnimationFrame.bind(window)
  30758. : setTimeout;
  30759. function nextFrame (fn) {
  30760. raf(function () {
  30761. raf(fn);
  30762. });
  30763. }
  30764. function addTransitionClass (el, cls) {
  30765. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  30766. addClass(el, cls);
  30767. }
  30768. function removeTransitionClass (el, cls) {
  30769. if (el._transitionClasses) {
  30770. remove(el._transitionClasses, cls);
  30771. }
  30772. removeClass(el, cls);
  30773. }
  30774. function whenTransitionEnds (
  30775. el,
  30776. expectedType,
  30777. cb
  30778. ) {
  30779. var ref = getTransitionInfo(el, expectedType);
  30780. var type = ref.type;
  30781. var timeout = ref.timeout;
  30782. var propCount = ref.propCount;
  30783. if (!type) { return cb() }
  30784. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  30785. var ended = 0;
  30786. var end = function () {
  30787. el.removeEventListener(event, onEnd);
  30788. cb();
  30789. };
  30790. var onEnd = function (e) {
  30791. if (e.target === el) {
  30792. if (++ended >= propCount) {
  30793. end();
  30794. }
  30795. }
  30796. };
  30797. setTimeout(function () {
  30798. if (ended < propCount) {
  30799. end();
  30800. }
  30801. }, timeout + 1);
  30802. el.addEventListener(event, onEnd);
  30803. }
  30804. var transformRE = /\b(transform|all)(,|$)/;
  30805. function getTransitionInfo (el, expectedType) {
  30806. var styles = window.getComputedStyle(el);
  30807. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  30808. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  30809. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  30810. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  30811. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  30812. var animationTimeout = getTimeout(animationDelays, animationDurations);
  30813. var type;
  30814. var timeout = 0;
  30815. var propCount = 0;
  30816. /* istanbul ignore if */
  30817. if (expectedType === TRANSITION) {
  30818. if (transitionTimeout > 0) {
  30819. type = TRANSITION;
  30820. timeout = transitionTimeout;
  30821. propCount = transitionDurations.length;
  30822. }
  30823. } else if (expectedType === ANIMATION) {
  30824. if (animationTimeout > 0) {
  30825. type = ANIMATION;
  30826. timeout = animationTimeout;
  30827. propCount = animationDurations.length;
  30828. }
  30829. } else {
  30830. timeout = Math.max(transitionTimeout, animationTimeout);
  30831. type = timeout > 0
  30832. ? transitionTimeout > animationTimeout
  30833. ? TRANSITION
  30834. : ANIMATION
  30835. : null;
  30836. propCount = type
  30837. ? type === TRANSITION
  30838. ? transitionDurations.length
  30839. : animationDurations.length
  30840. : 0;
  30841. }
  30842. var hasTransform =
  30843. type === TRANSITION &&
  30844. transformRE.test(styles[transitionProp + 'Property']);
  30845. return {
  30846. type: type,
  30847. timeout: timeout,
  30848. propCount: propCount,
  30849. hasTransform: hasTransform
  30850. }
  30851. }
  30852. function getTimeout (delays, durations) {
  30853. /* istanbul ignore next */
  30854. while (delays.length < durations.length) {
  30855. delays = delays.concat(delays);
  30856. }
  30857. return Math.max.apply(null, durations.map(function (d, i) {
  30858. return toMs(d) + toMs(delays[i])
  30859. }))
  30860. }
  30861. function toMs (s) {
  30862. return Number(s.slice(0, -1)) * 1000
  30863. }
  30864. /* */
  30865. function enter (vnode, toggleDisplay) {
  30866. var el = vnode.elm;
  30867. // call leave callback now
  30868. if (el._leaveCb) {
  30869. el._leaveCb.cancelled = true;
  30870. el._leaveCb();
  30871. }
  30872. var data = resolveTransition(vnode.data.transition);
  30873. if (!data) {
  30874. return
  30875. }
  30876. /* istanbul ignore if */
  30877. if (el._enterCb || el.nodeType !== 1) {
  30878. return
  30879. }
  30880. var css = data.css;
  30881. var type = data.type;
  30882. var enterClass = data.enterClass;
  30883. var enterToClass = data.enterToClass;
  30884. var enterActiveClass = data.enterActiveClass;
  30885. var appearClass = data.appearClass;
  30886. var appearToClass = data.appearToClass;
  30887. var appearActiveClass = data.appearActiveClass;
  30888. var beforeEnter = data.beforeEnter;
  30889. var enter = data.enter;
  30890. var afterEnter = data.afterEnter;
  30891. var enterCancelled = data.enterCancelled;
  30892. var beforeAppear = data.beforeAppear;
  30893. var appear = data.appear;
  30894. var afterAppear = data.afterAppear;
  30895. var appearCancelled = data.appearCancelled;
  30896. var duration = data.duration;
  30897. // activeInstance will always be the <transition> component managing this
  30898. // transition. One edge case to check is when the <transition> is placed
  30899. // as the root node of a child component. In that case we need to check
  30900. // <transition>'s parent for appear check.
  30901. var context = activeInstance;
  30902. var transitionNode = activeInstance.$vnode;
  30903. while (transitionNode && transitionNode.parent) {
  30904. transitionNode = transitionNode.parent;
  30905. context = transitionNode.context;
  30906. }
  30907. var isAppear = !context._isMounted || !vnode.isRootInsert;
  30908. if (isAppear && !appear && appear !== '') {
  30909. return
  30910. }
  30911. var startClass = isAppear && appearClass
  30912. ? appearClass
  30913. : enterClass;
  30914. var activeClass = isAppear && appearActiveClass
  30915. ? appearActiveClass
  30916. : enterActiveClass;
  30917. var toClass = isAppear && appearToClass
  30918. ? appearToClass
  30919. : enterToClass;
  30920. var beforeEnterHook = isAppear
  30921. ? (beforeAppear || beforeEnter)
  30922. : beforeEnter;
  30923. var enterHook = isAppear
  30924. ? (typeof appear === 'function' ? appear : enter)
  30925. : enter;
  30926. var afterEnterHook = isAppear
  30927. ? (afterAppear || afterEnter)
  30928. : afterEnter;
  30929. var enterCancelledHook = isAppear
  30930. ? (appearCancelled || enterCancelled)
  30931. : enterCancelled;
  30932. var explicitEnterDuration = toNumber(
  30933. isObject(duration)
  30934. ? duration.enter
  30935. : duration
  30936. );
  30937. if ("development" !== 'production' && explicitEnterDuration != null) {
  30938. checkDuration(explicitEnterDuration, 'enter', vnode);
  30939. }
  30940. var expectsCSS = css !== false && !isIE9;
  30941. var userWantsControl = getHookArgumentsLength(enterHook);
  30942. var cb = el._enterCb = once(function () {
  30943. if (expectsCSS) {
  30944. removeTransitionClass(el, toClass);
  30945. removeTransitionClass(el, activeClass);
  30946. }
  30947. if (cb.cancelled) {
  30948. if (expectsCSS) {
  30949. removeTransitionClass(el, startClass);
  30950. }
  30951. enterCancelledHook && enterCancelledHook(el);
  30952. } else {
  30953. afterEnterHook && afterEnterHook(el);
  30954. }
  30955. el._enterCb = null;
  30956. });
  30957. if (!vnode.data.show) {
  30958. // remove pending leave element on enter by injecting an insert hook
  30959. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  30960. var parent = el.parentNode;
  30961. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  30962. if (pendingNode &&
  30963. pendingNode.tag === vnode.tag &&
  30964. pendingNode.elm._leaveCb) {
  30965. pendingNode.elm._leaveCb();
  30966. }
  30967. enterHook && enterHook(el, cb);
  30968. });
  30969. }
  30970. // start enter transition
  30971. beforeEnterHook && beforeEnterHook(el);
  30972. if (expectsCSS) {
  30973. addTransitionClass(el, startClass);
  30974. addTransitionClass(el, activeClass);
  30975. nextFrame(function () {
  30976. addTransitionClass(el, toClass);
  30977. removeTransitionClass(el, startClass);
  30978. if (!cb.cancelled && !userWantsControl) {
  30979. if (isValidDuration(explicitEnterDuration)) {
  30980. setTimeout(cb, explicitEnterDuration);
  30981. } else {
  30982. whenTransitionEnds(el, type, cb);
  30983. }
  30984. }
  30985. });
  30986. }
  30987. if (vnode.data.show) {
  30988. toggleDisplay && toggleDisplay();
  30989. enterHook && enterHook(el, cb);
  30990. }
  30991. if (!expectsCSS && !userWantsControl) {
  30992. cb();
  30993. }
  30994. }
  30995. function leave (vnode, rm) {
  30996. var el = vnode.elm;
  30997. // call enter callback now
  30998. if (el._enterCb) {
  30999. el._enterCb.cancelled = true;
  31000. el._enterCb();
  31001. }
  31002. var data = resolveTransition(vnode.data.transition);
  31003. if (!data) {
  31004. return rm()
  31005. }
  31006. /* istanbul ignore if */
  31007. if (el._leaveCb || el.nodeType !== 1) {
  31008. return
  31009. }
  31010. var css = data.css;
  31011. var type = data.type;
  31012. var leaveClass = data.leaveClass;
  31013. var leaveToClass = data.leaveToClass;
  31014. var leaveActiveClass = data.leaveActiveClass;
  31015. var beforeLeave = data.beforeLeave;
  31016. var leave = data.leave;
  31017. var afterLeave = data.afterLeave;
  31018. var leaveCancelled = data.leaveCancelled;
  31019. var delayLeave = data.delayLeave;
  31020. var duration = data.duration;
  31021. var expectsCSS = css !== false && !isIE9;
  31022. var userWantsControl = getHookArgumentsLength(leave);
  31023. var explicitLeaveDuration = toNumber(
  31024. isObject(duration)
  31025. ? duration.leave
  31026. : duration
  31027. );
  31028. if ("development" !== 'production' && explicitLeaveDuration != null) {
  31029. checkDuration(explicitLeaveDuration, 'leave', vnode);
  31030. }
  31031. var cb = el._leaveCb = once(function () {
  31032. if (el.parentNode && el.parentNode._pending) {
  31033. el.parentNode._pending[vnode.key] = null;
  31034. }
  31035. if (expectsCSS) {
  31036. removeTransitionClass(el, leaveToClass);
  31037. removeTransitionClass(el, leaveActiveClass);
  31038. }
  31039. if (cb.cancelled) {
  31040. if (expectsCSS) {
  31041. removeTransitionClass(el, leaveClass);
  31042. }
  31043. leaveCancelled && leaveCancelled(el);
  31044. } else {
  31045. rm();
  31046. afterLeave && afterLeave(el);
  31047. }
  31048. el._leaveCb = null;
  31049. });
  31050. if (delayLeave) {
  31051. delayLeave(performLeave);
  31052. } else {
  31053. performLeave();
  31054. }
  31055. function performLeave () {
  31056. // the delayed leave may have already been cancelled
  31057. if (cb.cancelled) {
  31058. return
  31059. }
  31060. // record leaving element
  31061. if (!vnode.data.show) {
  31062. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  31063. }
  31064. beforeLeave && beforeLeave(el);
  31065. if (expectsCSS) {
  31066. addTransitionClass(el, leaveClass);
  31067. addTransitionClass(el, leaveActiveClass);
  31068. nextFrame(function () {
  31069. addTransitionClass(el, leaveToClass);
  31070. removeTransitionClass(el, leaveClass);
  31071. if (!cb.cancelled && !userWantsControl) {
  31072. if (isValidDuration(explicitLeaveDuration)) {
  31073. setTimeout(cb, explicitLeaveDuration);
  31074. } else {
  31075. whenTransitionEnds(el, type, cb);
  31076. }
  31077. }
  31078. });
  31079. }
  31080. leave && leave(el, cb);
  31081. if (!expectsCSS && !userWantsControl) {
  31082. cb();
  31083. }
  31084. }
  31085. }
  31086. // only used in dev mode
  31087. function checkDuration (val, name, vnode) {
  31088. if (typeof val !== 'number') {
  31089. warn(
  31090. "<transition> explicit " + name + " duration is not a valid number - " +
  31091. "got " + (JSON.stringify(val)) + ".",
  31092. vnode.context
  31093. );
  31094. } else if (isNaN(val)) {
  31095. warn(
  31096. "<transition> explicit " + name + " duration is NaN - " +
  31097. 'the duration expression might be incorrect.',
  31098. vnode.context
  31099. );
  31100. }
  31101. }
  31102. function isValidDuration (val) {
  31103. return typeof val === 'number' && !isNaN(val)
  31104. }
  31105. /**
  31106. * Normalize a transition hook's argument length. The hook may be:
  31107. * - a merged hook (invoker) with the original in .fns
  31108. * - a wrapped component method (check ._length)
  31109. * - a plain function (.length)
  31110. */
  31111. function getHookArgumentsLength (fn) {
  31112. if (!fn) { return false }
  31113. var invokerFns = fn.fns;
  31114. if (invokerFns) {
  31115. // invoker
  31116. return getHookArgumentsLength(
  31117. Array.isArray(invokerFns)
  31118. ? invokerFns[0]
  31119. : invokerFns
  31120. )
  31121. } else {
  31122. return (fn._length || fn.length) > 1
  31123. }
  31124. }
  31125. function _enter (_, vnode) {
  31126. if (!vnode.data.show) {
  31127. enter(vnode);
  31128. }
  31129. }
  31130. var transition = inBrowser ? {
  31131. create: _enter,
  31132. activate: _enter,
  31133. remove: function remove$$1 (vnode, rm) {
  31134. /* istanbul ignore else */
  31135. if (!vnode.data.show) {
  31136. leave(vnode, rm);
  31137. } else {
  31138. rm();
  31139. }
  31140. }
  31141. } : {};
  31142. var platformModules = [
  31143. attrs,
  31144. klass,
  31145. events,
  31146. domProps,
  31147. style,
  31148. transition
  31149. ];
  31150. /* */
  31151. // the directive module should be applied last, after all
  31152. // built-in modules have been applied.
  31153. var modules = platformModules.concat(baseModules);
  31154. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  31155. /**
  31156. * Not type checking this file because flow doesn't like attaching
  31157. * properties to Elements.
  31158. */
  31159. /* istanbul ignore if */
  31160. if (isIE9) {
  31161. // http://www.matts411.com/post/internet-explorer-9-oninput/
  31162. document.addEventListener('selectionchange', function () {
  31163. var el = document.activeElement;
  31164. if (el && el.vmodel) {
  31165. trigger(el, 'input');
  31166. }
  31167. });
  31168. }
  31169. var model$1 = {
  31170. inserted: function inserted (el, binding, vnode) {
  31171. if (vnode.tag === 'select') {
  31172. var cb = function () {
  31173. setSelected(el, binding, vnode.context);
  31174. };
  31175. cb();
  31176. /* istanbul ignore if */
  31177. if (isIE || isEdge) {
  31178. setTimeout(cb, 0);
  31179. }
  31180. } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
  31181. el._vModifiers = binding.modifiers;
  31182. if (!binding.modifiers.lazy) {
  31183. if (!isAndroid) {
  31184. el.addEventListener('compositionstart', onCompositionStart);
  31185. el.addEventListener('compositionend', onCompositionEnd);
  31186. }
  31187. /* istanbul ignore if */
  31188. if (isIE9) {
  31189. el.vmodel = true;
  31190. }
  31191. }
  31192. }
  31193. },
  31194. componentUpdated: function componentUpdated (el, binding, vnode) {
  31195. if (vnode.tag === 'select') {
  31196. setSelected(el, binding, vnode.context);
  31197. // in case the options rendered by v-for have changed,
  31198. // it's possible that the value is out-of-sync with the rendered options.
  31199. // detect such cases and filter out values that no longer has a matching
  31200. // option in the DOM.
  31201. var needReset = el.multiple
  31202. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  31203. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  31204. if (needReset) {
  31205. trigger(el, 'change');
  31206. }
  31207. }
  31208. }
  31209. };
  31210. function setSelected (el, binding, vm) {
  31211. var value = binding.value;
  31212. var isMultiple = el.multiple;
  31213. if (isMultiple && !Array.isArray(value)) {
  31214. "development" !== 'production' && warn(
  31215. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  31216. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  31217. vm
  31218. );
  31219. return
  31220. }
  31221. var selected, option;
  31222. for (var i = 0, l = el.options.length; i < l; i++) {
  31223. option = el.options[i];
  31224. if (isMultiple) {
  31225. selected = looseIndexOf(value, getValue(option)) > -1;
  31226. if (option.selected !== selected) {
  31227. option.selected = selected;
  31228. }
  31229. } else {
  31230. if (looseEqual(getValue(option), value)) {
  31231. if (el.selectedIndex !== i) {
  31232. el.selectedIndex = i;
  31233. }
  31234. return
  31235. }
  31236. }
  31237. }
  31238. if (!isMultiple) {
  31239. el.selectedIndex = -1;
  31240. }
  31241. }
  31242. function hasNoMatchingOption (value, options) {
  31243. for (var i = 0, l = options.length; i < l; i++) {
  31244. if (looseEqual(getValue(options[i]), value)) {
  31245. return false
  31246. }
  31247. }
  31248. return true
  31249. }
  31250. function getValue (option) {
  31251. return '_value' in option
  31252. ? option._value
  31253. : option.value
  31254. }
  31255. function onCompositionStart (e) {
  31256. e.target.composing = true;
  31257. }
  31258. function onCompositionEnd (e) {
  31259. e.target.composing = false;
  31260. trigger(e.target, 'input');
  31261. }
  31262. function trigger (el, type) {
  31263. var e = document.createEvent('HTMLEvents');
  31264. e.initEvent(type, true, true);
  31265. el.dispatchEvent(e);
  31266. }
  31267. /* */
  31268. // recursively search for possible transition defined inside the component root
  31269. function locateNode (vnode) {
  31270. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  31271. ? locateNode(vnode.componentInstance._vnode)
  31272. : vnode
  31273. }
  31274. var show = {
  31275. bind: function bind (el, ref, vnode) {
  31276. var value = ref.value;
  31277. vnode = locateNode(vnode);
  31278. var transition = vnode.data && vnode.data.transition;
  31279. var originalDisplay = el.__vOriginalDisplay =
  31280. el.style.display === 'none' ? '' : el.style.display;
  31281. if (value && transition && !isIE9) {
  31282. vnode.data.show = true;
  31283. enter(vnode, function () {
  31284. el.style.display = originalDisplay;
  31285. });
  31286. } else {
  31287. el.style.display = value ? originalDisplay : 'none';
  31288. }
  31289. },
  31290. update: function update (el, ref, vnode) {
  31291. var value = ref.value;
  31292. var oldValue = ref.oldValue;
  31293. /* istanbul ignore if */
  31294. if (value === oldValue) { return }
  31295. vnode = locateNode(vnode);
  31296. var transition = vnode.data && vnode.data.transition;
  31297. if (transition && !isIE9) {
  31298. vnode.data.show = true;
  31299. if (value) {
  31300. enter(vnode, function () {
  31301. el.style.display = el.__vOriginalDisplay;
  31302. });
  31303. } else {
  31304. leave(vnode, function () {
  31305. el.style.display = 'none';
  31306. });
  31307. }
  31308. } else {
  31309. el.style.display = value ? el.__vOriginalDisplay : 'none';
  31310. }
  31311. },
  31312. unbind: function unbind (
  31313. el,
  31314. binding,
  31315. vnode,
  31316. oldVnode,
  31317. isDestroy
  31318. ) {
  31319. if (!isDestroy) {
  31320. el.style.display = el.__vOriginalDisplay;
  31321. }
  31322. }
  31323. };
  31324. var platformDirectives = {
  31325. model: model$1,
  31326. show: show
  31327. };
  31328. /* */
  31329. // Provides transition support for a single element/component.
  31330. // supports transition mode (out-in / in-out)
  31331. var transitionProps = {
  31332. name: String,
  31333. appear: Boolean,
  31334. css: Boolean,
  31335. mode: String,
  31336. type: String,
  31337. enterClass: String,
  31338. leaveClass: String,
  31339. enterToClass: String,
  31340. leaveToClass: String,
  31341. enterActiveClass: String,
  31342. leaveActiveClass: String,
  31343. appearClass: String,
  31344. appearActiveClass: String,
  31345. appearToClass: String,
  31346. duration: [Number, String, Object]
  31347. };
  31348. // in case the child is also an abstract component, e.g. <keep-alive>
  31349. // we want to recursively retrieve the real component to be rendered
  31350. function getRealChild (vnode) {
  31351. var compOptions = vnode && vnode.componentOptions;
  31352. if (compOptions && compOptions.Ctor.options.abstract) {
  31353. return getRealChild(getFirstComponentChild(compOptions.children))
  31354. } else {
  31355. return vnode
  31356. }
  31357. }
  31358. function extractTransitionData (comp) {
  31359. var data = {};
  31360. var options = comp.$options;
  31361. // props
  31362. for (var key in options.propsData) {
  31363. data[key] = comp[key];
  31364. }
  31365. // events.
  31366. // extract listeners and pass them directly to the transition methods
  31367. var listeners = options._parentListeners;
  31368. for (var key$1 in listeners) {
  31369. data[camelize(key$1)] = listeners[key$1];
  31370. }
  31371. return data
  31372. }
  31373. function placeholder (h, rawChild) {
  31374. return /\d-keep-alive$/.test(rawChild.tag)
  31375. ? h('keep-alive')
  31376. : null
  31377. }
  31378. function hasParentTransition (vnode) {
  31379. while ((vnode = vnode.parent)) {
  31380. if (vnode.data.transition) {
  31381. return true
  31382. }
  31383. }
  31384. }
  31385. function isSameChild (child, oldChild) {
  31386. return oldChild.key === child.key && oldChild.tag === child.tag
  31387. }
  31388. var Transition = {
  31389. name: 'transition',
  31390. props: transitionProps,
  31391. abstract: true,
  31392. render: function render (h) {
  31393. var this$1 = this;
  31394. var children = this.$slots.default;
  31395. if (!children) {
  31396. return
  31397. }
  31398. // filter out text nodes (possible whitespaces)
  31399. children = children.filter(function (c) { return c.tag; });
  31400. /* istanbul ignore if */
  31401. if (!children.length) {
  31402. return
  31403. }
  31404. // warn multiple elements
  31405. if ("development" !== 'production' && children.length > 1) {
  31406. warn(
  31407. '<transition> can only be used on a single element. Use ' +
  31408. '<transition-group> for lists.',
  31409. this.$parent
  31410. );
  31411. }
  31412. var mode = this.mode;
  31413. // warn invalid mode
  31414. if ("development" !== 'production' &&
  31415. mode && mode !== 'in-out' && mode !== 'out-in') {
  31416. warn(
  31417. 'invalid <transition> mode: ' + mode,
  31418. this.$parent
  31419. );
  31420. }
  31421. var rawChild = children[0];
  31422. // if this is a component root node and the component's
  31423. // parent container node also has transition, skip.
  31424. if (hasParentTransition(this.$vnode)) {
  31425. return rawChild
  31426. }
  31427. // apply transition data to child
  31428. // use getRealChild() to ignore abstract components e.g. keep-alive
  31429. var child = getRealChild(rawChild);
  31430. /* istanbul ignore if */
  31431. if (!child) {
  31432. return rawChild
  31433. }
  31434. if (this._leaving) {
  31435. return placeholder(h, rawChild)
  31436. }
  31437. // ensure a key that is unique to the vnode type and to this transition
  31438. // component instance. This key will be used to remove pending leaving nodes
  31439. // during entering.
  31440. var id = "__transition-" + (this._uid) + "-";
  31441. child.key = child.key == null
  31442. ? id + child.tag
  31443. : isPrimitive(child.key)
  31444. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  31445. : child.key;
  31446. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  31447. var oldRawChild = this._vnode;
  31448. var oldChild = getRealChild(oldRawChild);
  31449. // mark v-show
  31450. // so that the transition module can hand over the control to the directive
  31451. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  31452. child.data.show = true;
  31453. }
  31454. if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
  31455. // replace old child transition data with fresh one
  31456. // important for dynamic transitions!
  31457. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  31458. // handle transition mode
  31459. if (mode === 'out-in') {
  31460. // return placeholder node and queue update when leave finishes
  31461. this._leaving = true;
  31462. mergeVNodeHook(oldData, 'afterLeave', function () {
  31463. this$1._leaving = false;
  31464. this$1.$forceUpdate();
  31465. });
  31466. return placeholder(h, rawChild)
  31467. } else if (mode === 'in-out') {
  31468. var delayedLeave;
  31469. var performLeave = function () { delayedLeave(); };
  31470. mergeVNodeHook(data, 'afterEnter', performLeave);
  31471. mergeVNodeHook(data, 'enterCancelled', performLeave);
  31472. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  31473. }
  31474. }
  31475. return rawChild
  31476. }
  31477. };
  31478. /* */
  31479. // Provides transition support for list items.
  31480. // supports move transitions using the FLIP technique.
  31481. // Because the vdom's children update algorithm is "unstable" - i.e.
  31482. // it doesn't guarantee the relative positioning of removed elements,
  31483. // we force transition-group to update its children into two passes:
  31484. // in the first pass, we remove all nodes that need to be removed,
  31485. // triggering their leaving transition; in the second pass, we insert/move
  31486. // into the final desired state. This way in the second pass removed
  31487. // nodes will remain where they should be.
  31488. var props = extend({
  31489. tag: String,
  31490. moveClass: String
  31491. }, transitionProps);
  31492. delete props.mode;
  31493. var TransitionGroup = {
  31494. props: props,
  31495. render: function render (h) {
  31496. var tag = this.tag || this.$vnode.data.tag || 'span';
  31497. var map = Object.create(null);
  31498. var prevChildren = this.prevChildren = this.children;
  31499. var rawChildren = this.$slots.default || [];
  31500. var children = this.children = [];
  31501. var transitionData = extractTransitionData(this);
  31502. for (var i = 0; i < rawChildren.length; i++) {
  31503. var c = rawChildren[i];
  31504. if (c.tag) {
  31505. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  31506. children.push(c);
  31507. map[c.key] = c
  31508. ;(c.data || (c.data = {})).transition = transitionData;
  31509. } else {
  31510. var opts = c.componentOptions;
  31511. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  31512. warn(("<transition-group> children must be keyed: <" + name + ">"));
  31513. }
  31514. }
  31515. }
  31516. if (prevChildren) {
  31517. var kept = [];
  31518. var removed = [];
  31519. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  31520. var c$1 = prevChildren[i$1];
  31521. c$1.data.transition = transitionData;
  31522. c$1.data.pos = c$1.elm.getBoundingClientRect();
  31523. if (map[c$1.key]) {
  31524. kept.push(c$1);
  31525. } else {
  31526. removed.push(c$1);
  31527. }
  31528. }
  31529. this.kept = h(tag, null, kept);
  31530. this.removed = removed;
  31531. }
  31532. return h(tag, null, children)
  31533. },
  31534. beforeUpdate: function beforeUpdate () {
  31535. // force removing pass
  31536. this.__patch__(
  31537. this._vnode,
  31538. this.kept,
  31539. false, // hydrating
  31540. true // removeOnly (!important, avoids unnecessary moves)
  31541. );
  31542. this._vnode = this.kept;
  31543. },
  31544. updated: function updated () {
  31545. var children = this.prevChildren;
  31546. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  31547. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  31548. return
  31549. }
  31550. // we divide the work into three loops to avoid mixing DOM reads and writes
  31551. // in each iteration - which helps prevent layout thrashing.
  31552. children.forEach(callPendingCbs);
  31553. children.forEach(recordPosition);
  31554. children.forEach(applyTranslation);
  31555. // force reflow to put everything in position
  31556. var body = document.body;
  31557. var f = body.offsetHeight; // eslint-disable-line
  31558. children.forEach(function (c) {
  31559. if (c.data.moved) {
  31560. var el = c.elm;
  31561. var s = el.style;
  31562. addTransitionClass(el, moveClass);
  31563. s.transform = s.WebkitTransform = s.transitionDuration = '';
  31564. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  31565. if (!e || /transform$/.test(e.propertyName)) {
  31566. el.removeEventListener(transitionEndEvent, cb);
  31567. el._moveCb = null;
  31568. removeTransitionClass(el, moveClass);
  31569. }
  31570. });
  31571. }
  31572. });
  31573. },
  31574. methods: {
  31575. hasMove: function hasMove (el, moveClass) {
  31576. /* istanbul ignore if */
  31577. if (!hasTransition) {
  31578. return false
  31579. }
  31580. if (this._hasMove != null) {
  31581. return this._hasMove
  31582. }
  31583. // Detect whether an element with the move class applied has
  31584. // CSS transitions. Since the element may be inside an entering
  31585. // transition at this very moment, we make a clone of it and remove
  31586. // all other transition classes applied to ensure only the move class
  31587. // is applied.
  31588. var clone = el.cloneNode();
  31589. if (el._transitionClasses) {
  31590. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  31591. }
  31592. addClass(clone, moveClass);
  31593. clone.style.display = 'none';
  31594. this.$el.appendChild(clone);
  31595. var info = getTransitionInfo(clone);
  31596. this.$el.removeChild(clone);
  31597. return (this._hasMove = info.hasTransform)
  31598. }
  31599. }
  31600. };
  31601. function callPendingCbs (c) {
  31602. /* istanbul ignore if */
  31603. if (c.elm._moveCb) {
  31604. c.elm._moveCb();
  31605. }
  31606. /* istanbul ignore if */
  31607. if (c.elm._enterCb) {
  31608. c.elm._enterCb();
  31609. }
  31610. }
  31611. function recordPosition (c) {
  31612. c.data.newPos = c.elm.getBoundingClientRect();
  31613. }
  31614. function applyTranslation (c) {
  31615. var oldPos = c.data.pos;
  31616. var newPos = c.data.newPos;
  31617. var dx = oldPos.left - newPos.left;
  31618. var dy = oldPos.top - newPos.top;
  31619. if (dx || dy) {
  31620. c.data.moved = true;
  31621. var s = c.elm.style;
  31622. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  31623. s.transitionDuration = '0s';
  31624. }
  31625. }
  31626. var platformComponents = {
  31627. Transition: Transition,
  31628. TransitionGroup: TransitionGroup
  31629. };
  31630. /* */
  31631. // install platform specific utils
  31632. Vue$3.config.mustUseProp = mustUseProp;
  31633. Vue$3.config.isReservedTag = isReservedTag;
  31634. Vue$3.config.getTagNamespace = getTagNamespace;
  31635. Vue$3.config.isUnknownElement = isUnknownElement;
  31636. // install platform runtime directives & components
  31637. extend(Vue$3.options.directives, platformDirectives);
  31638. extend(Vue$3.options.components, platformComponents);
  31639. // install platform patch function
  31640. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  31641. // public mount method
  31642. Vue$3.prototype.$mount = function (
  31643. el,
  31644. hydrating
  31645. ) {
  31646. el = el && inBrowser ? query(el) : undefined;
  31647. return mountComponent(this, el, hydrating)
  31648. };
  31649. // devtools global hook
  31650. /* istanbul ignore next */
  31651. setTimeout(function () {
  31652. if (config.devtools) {
  31653. if (devtools) {
  31654. devtools.emit('init', Vue$3);
  31655. } else if ("development" !== 'production' && isChrome) {
  31656. console[console.info ? 'info' : 'log'](
  31657. 'Download the Vue Devtools extension for a better development experience:\n' +
  31658. 'https://github.com/vuejs/vue-devtools'
  31659. );
  31660. }
  31661. }
  31662. if ("development" !== 'production' &&
  31663. config.productionTip !== false &&
  31664. inBrowser && typeof console !== 'undefined') {
  31665. console[console.info ? 'info' : 'log'](
  31666. "You are running Vue in development mode.\n" +
  31667. "Make sure to turn on production mode when deploying for production.\n" +
  31668. "See more tips at https://vuejs.org/guide/deployment.html"
  31669. );
  31670. }
  31671. }, 0);
  31672. /* */
  31673. // check whether current browser encodes a char inside attribute values
  31674. function shouldDecode (content, encoded) {
  31675. var div = document.createElement('div');
  31676. div.innerHTML = "<div a=\"" + content + "\">";
  31677. return div.innerHTML.indexOf(encoded) > 0
  31678. }
  31679. // #3663
  31680. // IE encodes newlines inside attribute values while other browsers don't
  31681. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  31682. /* */
  31683. var isUnaryTag = makeMap(
  31684. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  31685. 'link,meta,param,source,track,wbr'
  31686. );
  31687. // Elements that you can, intentionally, leave open
  31688. // (and which close themselves)
  31689. var canBeLeftOpenTag = makeMap(
  31690. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  31691. );
  31692. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  31693. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  31694. var isNonPhrasingTag = makeMap(
  31695. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  31696. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  31697. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  31698. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  31699. 'title,tr,track'
  31700. );
  31701. /* */
  31702. var decoder;
  31703. function decode (html) {
  31704. decoder = decoder || document.createElement('div');
  31705. decoder.innerHTML = html;
  31706. return decoder.textContent
  31707. }
  31708. /**
  31709. * Not type-checking this file because it's mostly vendor code.
  31710. */
  31711. /*!
  31712. * HTML Parser By John Resig (ejohn.org)
  31713. * Modified by Juriy "kangax" Zaytsev
  31714. * Original code by Erik Arvidsson, Mozilla Public License
  31715. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  31716. */
  31717. // Regular Expressions for parsing tags and attributes
  31718. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  31719. var singleAttrAssign = /(?:=)/;
  31720. var singleAttrValues = [
  31721. // attr value double quotes
  31722. /"([^"]*)"+/.source,
  31723. // attr value, single quotes
  31724. /'([^']*)'+/.source,
  31725. // attr value, no quotes
  31726. /([^\s"'=<>`]+)/.source
  31727. ];
  31728. var attribute = new RegExp(
  31729. '^\\s*' + singleAttrIdentifier.source +
  31730. '(?:\\s*(' + singleAttrAssign.source + ')' +
  31731. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  31732. );
  31733. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  31734. // but for Vue templates we can enforce a simple charset
  31735. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  31736. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  31737. var startTagOpen = new RegExp('^<' + qnameCapture);
  31738. var startTagClose = /^\s*(\/?)>/;
  31739. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  31740. var doctype = /^<!DOCTYPE [^>]+>/i;
  31741. var comment = /^<!--/;
  31742. var conditionalComment = /^<!\[/;
  31743. var IS_REGEX_CAPTURING_BROKEN = false;
  31744. 'x'.replace(/x(.)?/g, function (m, g) {
  31745. IS_REGEX_CAPTURING_BROKEN = g === '';
  31746. });
  31747. // Special Elements (can contain anything)
  31748. var isPlainTextElement = makeMap('script,style,textarea', true);
  31749. var reCache = {};
  31750. var decodingMap = {
  31751. '&lt;': '<',
  31752. '&gt;': '>',
  31753. '&quot;': '"',
  31754. '&amp;': '&',
  31755. '&#10;': '\n'
  31756. };
  31757. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  31758. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  31759. function decodeAttr (value, shouldDecodeNewlines) {
  31760. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  31761. return value.replace(re, function (match) { return decodingMap[match]; })
  31762. }
  31763. function parseHTML (html, options) {
  31764. var stack = [];
  31765. var expectHTML = options.expectHTML;
  31766. var isUnaryTag$$1 = options.isUnaryTag || no;
  31767. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  31768. var index = 0;
  31769. var last, lastTag;
  31770. while (html) {
  31771. last = html;
  31772. // Make sure we're not in a plaintext content element like script/style
  31773. if (!lastTag || !isPlainTextElement(lastTag)) {
  31774. var textEnd = html.indexOf('<');
  31775. if (textEnd === 0) {
  31776. // Comment:
  31777. if (comment.test(html)) {
  31778. var commentEnd = html.indexOf('-->');
  31779. if (commentEnd >= 0) {
  31780. advance(commentEnd + 3);
  31781. continue
  31782. }
  31783. }
  31784. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  31785. if (conditionalComment.test(html)) {
  31786. var conditionalEnd = html.indexOf(']>');
  31787. if (conditionalEnd >= 0) {
  31788. advance(conditionalEnd + 2);
  31789. continue
  31790. }
  31791. }
  31792. // Doctype:
  31793. var doctypeMatch = html.match(doctype);
  31794. if (doctypeMatch) {
  31795. advance(doctypeMatch[0].length);
  31796. continue
  31797. }
  31798. // End tag:
  31799. var endTagMatch = html.match(endTag);
  31800. if (endTagMatch) {
  31801. var curIndex = index;
  31802. advance(endTagMatch[0].length);
  31803. parseEndTag(endTagMatch[1], curIndex, index);
  31804. continue
  31805. }
  31806. // Start tag:
  31807. var startTagMatch = parseStartTag();
  31808. if (startTagMatch) {
  31809. handleStartTag(startTagMatch);
  31810. continue
  31811. }
  31812. }
  31813. var text = (void 0), rest$1 = (void 0), next = (void 0);
  31814. if (textEnd >= 0) {
  31815. rest$1 = html.slice(textEnd);
  31816. while (
  31817. !endTag.test(rest$1) &&
  31818. !startTagOpen.test(rest$1) &&
  31819. !comment.test(rest$1) &&
  31820. !conditionalComment.test(rest$1)
  31821. ) {
  31822. // < in plain text, be forgiving and treat it as text
  31823. next = rest$1.indexOf('<', 1);
  31824. if (next < 0) { break }
  31825. textEnd += next;
  31826. rest$1 = html.slice(textEnd);
  31827. }
  31828. text = html.substring(0, textEnd);
  31829. advance(textEnd);
  31830. }
  31831. if (textEnd < 0) {
  31832. text = html;
  31833. html = '';
  31834. }
  31835. if (options.chars && text) {
  31836. options.chars(text);
  31837. }
  31838. } else {
  31839. var stackedTag = lastTag.toLowerCase();
  31840. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  31841. var endTagLength = 0;
  31842. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  31843. endTagLength = endTag.length;
  31844. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  31845. text = text
  31846. .replace(/<!--([\s\S]*?)-->/g, '$1')
  31847. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  31848. }
  31849. if (options.chars) {
  31850. options.chars(text);
  31851. }
  31852. return ''
  31853. });
  31854. index += html.length - rest.length;
  31855. html = rest;
  31856. parseEndTag(stackedTag, index - endTagLength, index);
  31857. }
  31858. if (html === last) {
  31859. options.chars && options.chars(html);
  31860. if ("development" !== 'production' && !stack.length && options.warn) {
  31861. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  31862. }
  31863. break
  31864. }
  31865. }
  31866. // Clean up any remaining tags
  31867. parseEndTag();
  31868. function advance (n) {
  31869. index += n;
  31870. html = html.substring(n);
  31871. }
  31872. function parseStartTag () {
  31873. var start = html.match(startTagOpen);
  31874. if (start) {
  31875. var match = {
  31876. tagName: start[1],
  31877. attrs: [],
  31878. start: index
  31879. };
  31880. advance(start[0].length);
  31881. var end, attr;
  31882. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  31883. advance(attr[0].length);
  31884. match.attrs.push(attr);
  31885. }
  31886. if (end) {
  31887. match.unarySlash = end[1];
  31888. advance(end[0].length);
  31889. match.end = index;
  31890. return match
  31891. }
  31892. }
  31893. }
  31894. function handleStartTag (match) {
  31895. var tagName = match.tagName;
  31896. var unarySlash = match.unarySlash;
  31897. if (expectHTML) {
  31898. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  31899. parseEndTag(lastTag);
  31900. }
  31901. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  31902. parseEndTag(tagName);
  31903. }
  31904. }
  31905. var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
  31906. var l = match.attrs.length;
  31907. var attrs = new Array(l);
  31908. for (var i = 0; i < l; i++) {
  31909. var args = match.attrs[i];
  31910. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  31911. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  31912. if (args[3] === '') { delete args[3]; }
  31913. if (args[4] === '') { delete args[4]; }
  31914. if (args[5] === '') { delete args[5]; }
  31915. }
  31916. var value = args[3] || args[4] || args[5] || '';
  31917. attrs[i] = {
  31918. name: args[1],
  31919. value: decodeAttr(
  31920. value,
  31921. options.shouldDecodeNewlines
  31922. )
  31923. };
  31924. }
  31925. if (!unary) {
  31926. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  31927. lastTag = tagName;
  31928. }
  31929. if (options.start) {
  31930. options.start(tagName, attrs, unary, match.start, match.end);
  31931. }
  31932. }
  31933. function parseEndTag (tagName, start, end) {
  31934. var pos, lowerCasedTagName;
  31935. if (start == null) { start = index; }
  31936. if (end == null) { end = index; }
  31937. if (tagName) {
  31938. lowerCasedTagName = tagName.toLowerCase();
  31939. }
  31940. // Find the closest opened tag of the same type
  31941. if (tagName) {
  31942. for (pos = stack.length - 1; pos >= 0; pos--) {
  31943. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  31944. break
  31945. }
  31946. }
  31947. } else {
  31948. // If no tag name is provided, clean shop
  31949. pos = 0;
  31950. }
  31951. if (pos >= 0) {
  31952. // Close all the open elements, up the stack
  31953. for (var i = stack.length - 1; i >= pos; i--) {
  31954. if ("development" !== 'production' &&
  31955. (i > pos || !tagName) &&
  31956. options.warn) {
  31957. options.warn(
  31958. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  31959. );
  31960. }
  31961. if (options.end) {
  31962. options.end(stack[i].tag, start, end);
  31963. }
  31964. }
  31965. // Remove the open elements from the stack
  31966. stack.length = pos;
  31967. lastTag = pos && stack[pos - 1].tag;
  31968. } else if (lowerCasedTagName === 'br') {
  31969. if (options.start) {
  31970. options.start(tagName, [], true, start, end);
  31971. }
  31972. } else if (lowerCasedTagName === 'p') {
  31973. if (options.start) {
  31974. options.start(tagName, [], false, start, end);
  31975. }
  31976. if (options.end) {
  31977. options.end(tagName, start, end);
  31978. }
  31979. }
  31980. }
  31981. }
  31982. /* */
  31983. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  31984. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  31985. var buildRegex = cached(function (delimiters) {
  31986. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  31987. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  31988. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  31989. });
  31990. function parseText (
  31991. text,
  31992. delimiters
  31993. ) {
  31994. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  31995. if (!tagRE.test(text)) {
  31996. return
  31997. }
  31998. var tokens = [];
  31999. var lastIndex = tagRE.lastIndex = 0;
  32000. var match, index;
  32001. while ((match = tagRE.exec(text))) {
  32002. index = match.index;
  32003. // push text token
  32004. if (index > lastIndex) {
  32005. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  32006. }
  32007. // tag token
  32008. var exp = parseFilters(match[1].trim());
  32009. tokens.push(("_s(" + exp + ")"));
  32010. lastIndex = index + match[0].length;
  32011. }
  32012. if (lastIndex < text.length) {
  32013. tokens.push(JSON.stringify(text.slice(lastIndex)));
  32014. }
  32015. return tokens.join('+')
  32016. }
  32017. /* */
  32018. var onRE = /^@|^v-on:/;
  32019. var dirRE = /^v-|^@|^:/;
  32020. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  32021. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  32022. var argRE = /:(.*)$/;
  32023. var bindRE = /^:|^v-bind:/;
  32024. var modifierRE = /\.[^.]+/g;
  32025. var decodeHTMLCached = cached(decode);
  32026. // configurable state
  32027. var warn$2;
  32028. var delimiters;
  32029. var transforms;
  32030. var preTransforms;
  32031. var postTransforms;
  32032. var platformIsPreTag;
  32033. var platformMustUseProp;
  32034. var platformGetTagNamespace;
  32035. /**
  32036. * Convert HTML string to AST.
  32037. */
  32038. function parse (
  32039. template,
  32040. options
  32041. ) {
  32042. warn$2 = options.warn || baseWarn;
  32043. platformGetTagNamespace = options.getTagNamespace || no;
  32044. platformMustUseProp = options.mustUseProp || no;
  32045. platformIsPreTag = options.isPreTag || no;
  32046. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  32047. transforms = pluckModuleFunction(options.modules, 'transformNode');
  32048. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  32049. delimiters = options.delimiters;
  32050. var stack = [];
  32051. var preserveWhitespace = options.preserveWhitespace !== false;
  32052. var root;
  32053. var currentParent;
  32054. var inVPre = false;
  32055. var inPre = false;
  32056. var warned = false;
  32057. function warnOnce (msg) {
  32058. if (!warned) {
  32059. warned = true;
  32060. warn$2(msg);
  32061. }
  32062. }
  32063. function endPre (element) {
  32064. // check pre state
  32065. if (element.pre) {
  32066. inVPre = false;
  32067. }
  32068. if (platformIsPreTag(element.tag)) {
  32069. inPre = false;
  32070. }
  32071. }
  32072. parseHTML(template, {
  32073. warn: warn$2,
  32074. expectHTML: options.expectHTML,
  32075. isUnaryTag: options.isUnaryTag,
  32076. canBeLeftOpenTag: options.canBeLeftOpenTag,
  32077. shouldDecodeNewlines: options.shouldDecodeNewlines,
  32078. start: function start (tag, attrs, unary) {
  32079. // check namespace.
  32080. // inherit parent ns if there is one
  32081. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  32082. // handle IE svg bug
  32083. /* istanbul ignore if */
  32084. if (isIE && ns === 'svg') {
  32085. attrs = guardIESVGBug(attrs);
  32086. }
  32087. var element = {
  32088. type: 1,
  32089. tag: tag,
  32090. attrsList: attrs,
  32091. attrsMap: makeAttrsMap(attrs),
  32092. parent: currentParent,
  32093. children: []
  32094. };
  32095. if (ns) {
  32096. element.ns = ns;
  32097. }
  32098. if (isForbiddenTag(element) && !isServerRendering()) {
  32099. element.forbidden = true;
  32100. "development" !== 'production' && warn$2(
  32101. 'Templates should only be responsible for mapping the state to the ' +
  32102. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  32103. "<" + tag + ">" + ', as they will not be parsed.'
  32104. );
  32105. }
  32106. // apply pre-transforms
  32107. for (var i = 0; i < preTransforms.length; i++) {
  32108. preTransforms[i](element, options);
  32109. }
  32110. if (!inVPre) {
  32111. processPre(element);
  32112. if (element.pre) {
  32113. inVPre = true;
  32114. }
  32115. }
  32116. if (platformIsPreTag(element.tag)) {
  32117. inPre = true;
  32118. }
  32119. if (inVPre) {
  32120. processRawAttrs(element);
  32121. } else {
  32122. processFor(element);
  32123. processIf(element);
  32124. processOnce(element);
  32125. processKey(element);
  32126. // determine whether this is a plain element after
  32127. // removing structural attributes
  32128. element.plain = !element.key && !attrs.length;
  32129. processRef(element);
  32130. processSlot(element);
  32131. processComponent(element);
  32132. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  32133. transforms[i$1](element, options);
  32134. }
  32135. processAttrs(element);
  32136. }
  32137. function checkRootConstraints (el) {
  32138. {
  32139. if (el.tag === 'slot' || el.tag === 'template') {
  32140. warnOnce(
  32141. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  32142. 'contain multiple nodes.'
  32143. );
  32144. }
  32145. if (el.attrsMap.hasOwnProperty('v-for')) {
  32146. warnOnce(
  32147. 'Cannot use v-for on stateful component root element because ' +
  32148. 'it renders multiple elements.'
  32149. );
  32150. }
  32151. }
  32152. }
  32153. // tree management
  32154. if (!root) {
  32155. root = element;
  32156. checkRootConstraints(root);
  32157. } else if (!stack.length) {
  32158. // allow root elements with v-if, v-else-if and v-else
  32159. if (root.if && (element.elseif || element.else)) {
  32160. checkRootConstraints(element);
  32161. addIfCondition(root, {
  32162. exp: element.elseif,
  32163. block: element
  32164. });
  32165. } else {
  32166. warnOnce(
  32167. "Component template should contain exactly one root element. " +
  32168. "If you are using v-if on multiple elements, " +
  32169. "use v-else-if to chain them instead."
  32170. );
  32171. }
  32172. }
  32173. if (currentParent && !element.forbidden) {
  32174. if (element.elseif || element.else) {
  32175. processIfConditions(element, currentParent);
  32176. } else if (element.slotScope) { // scoped slot
  32177. currentParent.plain = false;
  32178. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  32179. } else {
  32180. currentParent.children.push(element);
  32181. element.parent = currentParent;
  32182. }
  32183. }
  32184. if (!unary) {
  32185. currentParent = element;
  32186. stack.push(element);
  32187. } else {
  32188. endPre(element);
  32189. }
  32190. // apply post-transforms
  32191. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  32192. postTransforms[i$2](element, options);
  32193. }
  32194. },
  32195. end: function end () {
  32196. // remove trailing whitespace
  32197. var element = stack[stack.length - 1];
  32198. var lastNode = element.children[element.children.length - 1];
  32199. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  32200. element.children.pop();
  32201. }
  32202. // pop stack
  32203. stack.length -= 1;
  32204. currentParent = stack[stack.length - 1];
  32205. endPre(element);
  32206. },
  32207. chars: function chars (text) {
  32208. if (!currentParent) {
  32209. {
  32210. if (text === template) {
  32211. warnOnce(
  32212. 'Component template requires a root element, rather than just text.'
  32213. );
  32214. } else if ((text = text.trim())) {
  32215. warnOnce(
  32216. ("text \"" + text + "\" outside root element will be ignored.")
  32217. );
  32218. }
  32219. }
  32220. return
  32221. }
  32222. // IE textarea placeholder bug
  32223. /* istanbul ignore if */
  32224. if (isIE &&
  32225. currentParent.tag === 'textarea' &&
  32226. currentParent.attrsMap.placeholder === text) {
  32227. return
  32228. }
  32229. var children = currentParent.children;
  32230. text = inPre || text.trim()
  32231. ? decodeHTMLCached(text)
  32232. // only preserve whitespace if its not right after a starting tag
  32233. : preserveWhitespace && children.length ? ' ' : '';
  32234. if (text) {
  32235. var expression;
  32236. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  32237. children.push({
  32238. type: 2,
  32239. expression: expression,
  32240. text: text
  32241. });
  32242. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  32243. children.push({
  32244. type: 3,
  32245. text: text
  32246. });
  32247. }
  32248. }
  32249. }
  32250. });
  32251. return root
  32252. }
  32253. function processPre (el) {
  32254. if (getAndRemoveAttr(el, 'v-pre') != null) {
  32255. el.pre = true;
  32256. }
  32257. }
  32258. function processRawAttrs (el) {
  32259. var l = el.attrsList.length;
  32260. if (l) {
  32261. var attrs = el.attrs = new Array(l);
  32262. for (var i = 0; i < l; i++) {
  32263. attrs[i] = {
  32264. name: el.attrsList[i].name,
  32265. value: JSON.stringify(el.attrsList[i].value)
  32266. };
  32267. }
  32268. } else if (!el.pre) {
  32269. // non root node in pre blocks with no attributes
  32270. el.plain = true;
  32271. }
  32272. }
  32273. function processKey (el) {
  32274. var exp = getBindingAttr(el, 'key');
  32275. if (exp) {
  32276. if ("development" !== 'production' && el.tag === 'template') {
  32277. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  32278. }
  32279. el.key = exp;
  32280. }
  32281. }
  32282. function processRef (el) {
  32283. var ref = getBindingAttr(el, 'ref');
  32284. if (ref) {
  32285. el.ref = ref;
  32286. el.refInFor = checkInFor(el);
  32287. }
  32288. }
  32289. function processFor (el) {
  32290. var exp;
  32291. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  32292. var inMatch = exp.match(forAliasRE);
  32293. if (!inMatch) {
  32294. "development" !== 'production' && warn$2(
  32295. ("Invalid v-for expression: " + exp)
  32296. );
  32297. return
  32298. }
  32299. el.for = inMatch[2].trim();
  32300. var alias = inMatch[1].trim();
  32301. var iteratorMatch = alias.match(forIteratorRE);
  32302. if (iteratorMatch) {
  32303. el.alias = iteratorMatch[1].trim();
  32304. el.iterator1 = iteratorMatch[2].trim();
  32305. if (iteratorMatch[3]) {
  32306. el.iterator2 = iteratorMatch[3].trim();
  32307. }
  32308. } else {
  32309. el.alias = alias;
  32310. }
  32311. }
  32312. }
  32313. function processIf (el) {
  32314. var exp = getAndRemoveAttr(el, 'v-if');
  32315. if (exp) {
  32316. el.if = exp;
  32317. addIfCondition(el, {
  32318. exp: exp,
  32319. block: el
  32320. });
  32321. } else {
  32322. if (getAndRemoveAttr(el, 'v-else') != null) {
  32323. el.else = true;
  32324. }
  32325. var elseif = getAndRemoveAttr(el, 'v-else-if');
  32326. if (elseif) {
  32327. el.elseif = elseif;
  32328. }
  32329. }
  32330. }
  32331. function processIfConditions (el, parent) {
  32332. var prev = findPrevElement(parent.children);
  32333. if (prev && prev.if) {
  32334. addIfCondition(prev, {
  32335. exp: el.elseif,
  32336. block: el
  32337. });
  32338. } else {
  32339. warn$2(
  32340. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  32341. "used on element <" + (el.tag) + "> without corresponding v-if."
  32342. );
  32343. }
  32344. }
  32345. function findPrevElement (children) {
  32346. var i = children.length;
  32347. while (i--) {
  32348. if (children[i].type === 1) {
  32349. return children[i]
  32350. } else {
  32351. if ("development" !== 'production' && children[i].text !== ' ') {
  32352. warn$2(
  32353. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  32354. "will be ignored."
  32355. );
  32356. }
  32357. children.pop();
  32358. }
  32359. }
  32360. }
  32361. function addIfCondition (el, condition) {
  32362. if (!el.ifConditions) {
  32363. el.ifConditions = [];
  32364. }
  32365. el.ifConditions.push(condition);
  32366. }
  32367. function processOnce (el) {
  32368. var once$$1 = getAndRemoveAttr(el, 'v-once');
  32369. if (once$$1 != null) {
  32370. el.once = true;
  32371. }
  32372. }
  32373. function processSlot (el) {
  32374. if (el.tag === 'slot') {
  32375. el.slotName = getBindingAttr(el, 'name');
  32376. if ("development" !== 'production' && el.key) {
  32377. warn$2(
  32378. "`key` does not work on <slot> because slots are abstract outlets " +
  32379. "and can possibly expand into multiple elements. " +
  32380. "Use the key on a wrapping element instead."
  32381. );
  32382. }
  32383. } else {
  32384. var slotTarget = getBindingAttr(el, 'slot');
  32385. if (slotTarget) {
  32386. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  32387. }
  32388. if (el.tag === 'template') {
  32389. el.slotScope = getAndRemoveAttr(el, 'scope');
  32390. }
  32391. }
  32392. }
  32393. function processComponent (el) {
  32394. var binding;
  32395. if ((binding = getBindingAttr(el, 'is'))) {
  32396. el.component = binding;
  32397. }
  32398. if (getAndRemoveAttr(el, 'inline-template') != null) {
  32399. el.inlineTemplate = true;
  32400. }
  32401. }
  32402. function processAttrs (el) {
  32403. var list = el.attrsList;
  32404. var i, l, name, rawName, value, modifiers, isProp;
  32405. for (i = 0, l = list.length; i < l; i++) {
  32406. name = rawName = list[i].name;
  32407. value = list[i].value;
  32408. if (dirRE.test(name)) {
  32409. // mark element as dynamic
  32410. el.hasBindings = true;
  32411. // modifiers
  32412. modifiers = parseModifiers(name);
  32413. if (modifiers) {
  32414. name = name.replace(modifierRE, '');
  32415. }
  32416. if (bindRE.test(name)) { // v-bind
  32417. name = name.replace(bindRE, '');
  32418. value = parseFilters(value);
  32419. isProp = false;
  32420. if (modifiers) {
  32421. if (modifiers.prop) {
  32422. isProp = true;
  32423. name = camelize(name);
  32424. if (name === 'innerHtml') { name = 'innerHTML'; }
  32425. }
  32426. if (modifiers.camel) {
  32427. name = camelize(name);
  32428. }
  32429. }
  32430. if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  32431. addProp(el, name, value);
  32432. } else {
  32433. addAttr(el, name, value);
  32434. }
  32435. } else if (onRE.test(name)) { // v-on
  32436. name = name.replace(onRE, '');
  32437. addHandler(el, name, value, modifiers);
  32438. } else { // normal directives
  32439. name = name.replace(dirRE, '');
  32440. // parse arg
  32441. var argMatch = name.match(argRE);
  32442. var arg = argMatch && argMatch[1];
  32443. if (arg) {
  32444. name = name.slice(0, -(arg.length + 1));
  32445. }
  32446. addDirective(el, name, rawName, value, arg, modifiers);
  32447. if ("development" !== 'production' && name === 'model') {
  32448. checkForAliasModel(el, value);
  32449. }
  32450. }
  32451. } else {
  32452. // literal attribute
  32453. {
  32454. var expression = parseText(value, delimiters);
  32455. if (expression) {
  32456. warn$2(
  32457. name + "=\"" + value + "\": " +
  32458. 'Interpolation inside attributes has been removed. ' +
  32459. 'Use v-bind or the colon shorthand instead. For example, ' +
  32460. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  32461. );
  32462. }
  32463. }
  32464. addAttr(el, name, JSON.stringify(value));
  32465. }
  32466. }
  32467. }
  32468. function checkInFor (el) {
  32469. var parent = el;
  32470. while (parent) {
  32471. if (parent.for !== undefined) {
  32472. return true
  32473. }
  32474. parent = parent.parent;
  32475. }
  32476. return false
  32477. }
  32478. function parseModifiers (name) {
  32479. var match = name.match(modifierRE);
  32480. if (match) {
  32481. var ret = {};
  32482. match.forEach(function (m) { ret[m.slice(1)] = true; });
  32483. return ret
  32484. }
  32485. }
  32486. function makeAttrsMap (attrs) {
  32487. var map = {};
  32488. for (var i = 0, l = attrs.length; i < l; i++) {
  32489. if ("development" !== 'production' && map[attrs[i].name] && !isIE) {
  32490. warn$2('duplicate attribute: ' + attrs[i].name);
  32491. }
  32492. map[attrs[i].name] = attrs[i].value;
  32493. }
  32494. return map
  32495. }
  32496. function isForbiddenTag (el) {
  32497. return (
  32498. el.tag === 'style' ||
  32499. (el.tag === 'script' && (
  32500. !el.attrsMap.type ||
  32501. el.attrsMap.type === 'text/javascript'
  32502. ))
  32503. )
  32504. }
  32505. var ieNSBug = /^xmlns:NS\d+/;
  32506. var ieNSPrefix = /^NS\d+:/;
  32507. /* istanbul ignore next */
  32508. function guardIESVGBug (attrs) {
  32509. var res = [];
  32510. for (var i = 0; i < attrs.length; i++) {
  32511. var attr = attrs[i];
  32512. if (!ieNSBug.test(attr.name)) {
  32513. attr.name = attr.name.replace(ieNSPrefix, '');
  32514. res.push(attr);
  32515. }
  32516. }
  32517. return res
  32518. }
  32519. function checkForAliasModel (el, value) {
  32520. var _el = el;
  32521. while (_el) {
  32522. if (_el.for && _el.alias === value) {
  32523. warn$2(
  32524. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  32525. "You are binding v-model directly to a v-for iteration alias. " +
  32526. "This will not be able to modify the v-for source array because " +
  32527. "writing to the alias is like modifying a function local variable. " +
  32528. "Consider using an array of objects and use v-model on an object property instead."
  32529. );
  32530. }
  32531. _el = _el.parent;
  32532. }
  32533. }
  32534. /* */
  32535. var isStaticKey;
  32536. var isPlatformReservedTag;
  32537. var genStaticKeysCached = cached(genStaticKeys$1);
  32538. /**
  32539. * Goal of the optimizer: walk the generated template AST tree
  32540. * and detect sub-trees that are purely static, i.e. parts of
  32541. * the DOM that never needs to change.
  32542. *
  32543. * Once we detect these sub-trees, we can:
  32544. *
  32545. * 1. Hoist them into constants, so that we no longer need to
  32546. * create fresh nodes for them on each re-render;
  32547. * 2. Completely skip them in the patching process.
  32548. */
  32549. function optimize (root, options) {
  32550. if (!root) { return }
  32551. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  32552. isPlatformReservedTag = options.isReservedTag || no;
  32553. // first pass: mark all non-static nodes.
  32554. markStatic$1(root);
  32555. // second pass: mark static roots.
  32556. markStaticRoots(root, false);
  32557. }
  32558. function genStaticKeys$1 (keys) {
  32559. return makeMap(
  32560. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  32561. (keys ? ',' + keys : '')
  32562. )
  32563. }
  32564. function markStatic$1 (node) {
  32565. node.static = isStatic(node);
  32566. if (node.type === 1) {
  32567. // do not make component slot content static. this avoids
  32568. // 1. components not able to mutate slot nodes
  32569. // 2. static slot content fails for hot-reloading
  32570. if (
  32571. !isPlatformReservedTag(node.tag) &&
  32572. node.tag !== 'slot' &&
  32573. node.attrsMap['inline-template'] == null
  32574. ) {
  32575. return
  32576. }
  32577. for (var i = 0, l = node.children.length; i < l; i++) {
  32578. var child = node.children[i];
  32579. markStatic$1(child);
  32580. if (!child.static) {
  32581. node.static = false;
  32582. }
  32583. }
  32584. }
  32585. }
  32586. function markStaticRoots (node, isInFor) {
  32587. if (node.type === 1) {
  32588. if (node.static || node.once) {
  32589. node.staticInFor = isInFor;
  32590. }
  32591. // For a node to qualify as a static root, it should have children that
  32592. // are not just static text. Otherwise the cost of hoisting out will
  32593. // outweigh the benefits and it's better off to just always render it fresh.
  32594. if (node.static && node.children.length && !(
  32595. node.children.length === 1 &&
  32596. node.children[0].type === 3
  32597. )) {
  32598. node.staticRoot = true;
  32599. return
  32600. } else {
  32601. node.staticRoot = false;
  32602. }
  32603. if (node.children) {
  32604. for (var i = 0, l = node.children.length; i < l; i++) {
  32605. markStaticRoots(node.children[i], isInFor || !!node.for);
  32606. }
  32607. }
  32608. if (node.ifConditions) {
  32609. walkThroughConditionsBlocks(node.ifConditions, isInFor);
  32610. }
  32611. }
  32612. }
  32613. function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
  32614. for (var i = 1, len = conditionBlocks.length; i < len; i++) {
  32615. markStaticRoots(conditionBlocks[i].block, isInFor);
  32616. }
  32617. }
  32618. function isStatic (node) {
  32619. if (node.type === 2) { // expression
  32620. return false
  32621. }
  32622. if (node.type === 3) { // text
  32623. return true
  32624. }
  32625. return !!(node.pre || (
  32626. !node.hasBindings && // no dynamic bindings
  32627. !node.if && !node.for && // not v-if or v-for or v-else
  32628. !isBuiltInTag(node.tag) && // not a built-in
  32629. isPlatformReservedTag(node.tag) && // not a component
  32630. !isDirectChildOfTemplateFor(node) &&
  32631. Object.keys(node).every(isStaticKey)
  32632. ))
  32633. }
  32634. function isDirectChildOfTemplateFor (node) {
  32635. while (node.parent) {
  32636. node = node.parent;
  32637. if (node.tag !== 'template') {
  32638. return false
  32639. }
  32640. if (node.for) {
  32641. return true
  32642. }
  32643. }
  32644. return false
  32645. }
  32646. /* */
  32647. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  32648. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  32649. // keyCode aliases
  32650. var keyCodes = {
  32651. esc: 27,
  32652. tab: 9,
  32653. enter: 13,
  32654. space: 32,
  32655. up: 38,
  32656. left: 37,
  32657. right: 39,
  32658. down: 40,
  32659. 'delete': [8, 46]
  32660. };
  32661. // #4868: modifiers that prevent the execution of the listener
  32662. // need to explicitly return null so that we can determine whether to remove
  32663. // the listener for .once
  32664. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  32665. var modifierCode = {
  32666. stop: '$event.stopPropagation();',
  32667. prevent: '$event.preventDefault();',
  32668. self: genGuard("$event.target !== $event.currentTarget"),
  32669. ctrl: genGuard("!$event.ctrlKey"),
  32670. shift: genGuard("!$event.shiftKey"),
  32671. alt: genGuard("!$event.altKey"),
  32672. meta: genGuard("!$event.metaKey"),
  32673. left: genGuard("'button' in $event && $event.button !== 0"),
  32674. middle: genGuard("'button' in $event && $event.button !== 1"),
  32675. right: genGuard("'button' in $event && $event.button !== 2")
  32676. };
  32677. function genHandlers (events, native) {
  32678. var res = native ? 'nativeOn:{' : 'on:{';
  32679. for (var name in events) {
  32680. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  32681. }
  32682. return res.slice(0, -1) + '}'
  32683. }
  32684. function genHandler (
  32685. name,
  32686. handler
  32687. ) {
  32688. if (!handler) {
  32689. return 'function(){}'
  32690. }
  32691. if (Array.isArray(handler)) {
  32692. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  32693. }
  32694. var isMethodPath = simplePathRE.test(handler.value);
  32695. var isFunctionExpression = fnExpRE.test(handler.value);
  32696. if (!handler.modifiers) {
  32697. return isMethodPath || isFunctionExpression
  32698. ? handler.value
  32699. : ("function($event){" + (handler.value) + "}") // inline statement
  32700. } else {
  32701. var code = '';
  32702. var genModifierCode = '';
  32703. var keys = [];
  32704. for (var key in handler.modifiers) {
  32705. if (modifierCode[key]) {
  32706. genModifierCode += modifierCode[key];
  32707. // left/right
  32708. if (keyCodes[key]) {
  32709. keys.push(key);
  32710. }
  32711. } else {
  32712. keys.push(key);
  32713. }
  32714. }
  32715. if (keys.length) {
  32716. code += genKeyFilter(keys);
  32717. }
  32718. // Make sure modifiers like prevent and stop get executed after key filtering
  32719. if (genModifierCode) {
  32720. code += genModifierCode;
  32721. }
  32722. var handlerCode = isMethodPath
  32723. ? handler.value + '($event)'
  32724. : isFunctionExpression
  32725. ? ("(" + (handler.value) + ")($event)")
  32726. : handler.value;
  32727. return ("function($event){" + code + handlerCode + "}")
  32728. }
  32729. }
  32730. function genKeyFilter (keys) {
  32731. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  32732. }
  32733. function genFilterCode (key) {
  32734. var keyVal = parseInt(key, 10);
  32735. if (keyVal) {
  32736. return ("$event.keyCode!==" + keyVal)
  32737. }
  32738. var alias = keyCodes[key];
  32739. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  32740. }
  32741. /* */
  32742. function bind$1 (el, dir) {
  32743. el.wrapData = function (code) {
  32744. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  32745. };
  32746. }
  32747. /* */
  32748. var baseDirectives = {
  32749. bind: bind$1,
  32750. cloak: noop
  32751. };
  32752. /* */
  32753. // configurable state
  32754. var warn$3;
  32755. var transforms$1;
  32756. var dataGenFns;
  32757. var platformDirectives$1;
  32758. var isPlatformReservedTag$1;
  32759. var staticRenderFns;
  32760. var onceCount;
  32761. var currentOptions;
  32762. function generate (
  32763. ast,
  32764. options
  32765. ) {
  32766. // save previous staticRenderFns so generate calls can be nested
  32767. var prevStaticRenderFns = staticRenderFns;
  32768. var currentStaticRenderFns = staticRenderFns = [];
  32769. var prevOnceCount = onceCount;
  32770. onceCount = 0;
  32771. currentOptions = options;
  32772. warn$3 = options.warn || baseWarn;
  32773. transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  32774. dataGenFns = pluckModuleFunction(options.modules, 'genData');
  32775. platformDirectives$1 = options.directives || {};
  32776. isPlatformReservedTag$1 = options.isReservedTag || no;
  32777. var code = ast ? genElement(ast) : '_c("div")';
  32778. staticRenderFns = prevStaticRenderFns;
  32779. onceCount = prevOnceCount;
  32780. return {
  32781. render: ("with(this){return " + code + "}"),
  32782. staticRenderFns: currentStaticRenderFns
  32783. }
  32784. }
  32785. function genElement (el) {
  32786. if (el.staticRoot && !el.staticProcessed) {
  32787. return genStatic(el)
  32788. } else if (el.once && !el.onceProcessed) {
  32789. return genOnce(el)
  32790. } else if (el.for && !el.forProcessed) {
  32791. return genFor(el)
  32792. } else if (el.if && !el.ifProcessed) {
  32793. return genIf(el)
  32794. } else if (el.tag === 'template' && !el.slotTarget) {
  32795. return genChildren(el) || 'void 0'
  32796. } else if (el.tag === 'slot') {
  32797. return genSlot(el)
  32798. } else {
  32799. // component or element
  32800. var code;
  32801. if (el.component) {
  32802. code = genComponent(el.component, el);
  32803. } else {
  32804. var data = el.plain ? undefined : genData(el);
  32805. var children = el.inlineTemplate ? null : genChildren(el, true);
  32806. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  32807. }
  32808. // module transforms
  32809. for (var i = 0; i < transforms$1.length; i++) {
  32810. code = transforms$1[i](el, code);
  32811. }
  32812. return code
  32813. }
  32814. }
  32815. // hoist static sub-trees out
  32816. function genStatic (el) {
  32817. el.staticProcessed = true;
  32818. staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  32819. return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  32820. }
  32821. // v-once
  32822. function genOnce (el) {
  32823. el.onceProcessed = true;
  32824. if (el.if && !el.ifProcessed) {
  32825. return genIf(el)
  32826. } else if (el.staticInFor) {
  32827. var key = '';
  32828. var parent = el.parent;
  32829. while (parent) {
  32830. if (parent.for) {
  32831. key = parent.key;
  32832. break
  32833. }
  32834. parent = parent.parent;
  32835. }
  32836. if (!key) {
  32837. "development" !== 'production' && warn$3(
  32838. "v-once can only be used inside v-for that is keyed. "
  32839. );
  32840. return genElement(el)
  32841. }
  32842. return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  32843. } else {
  32844. return genStatic(el)
  32845. }
  32846. }
  32847. function genIf (el) {
  32848. el.ifProcessed = true; // avoid recursion
  32849. return genIfConditions(el.ifConditions.slice())
  32850. }
  32851. function genIfConditions (conditions) {
  32852. if (!conditions.length) {
  32853. return '_e()'
  32854. }
  32855. var condition = conditions.shift();
  32856. if (condition.exp) {
  32857. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
  32858. } else {
  32859. return ("" + (genTernaryExp(condition.block)))
  32860. }
  32861. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  32862. function genTernaryExp (el) {
  32863. return el.once ? genOnce(el) : genElement(el)
  32864. }
  32865. }
  32866. function genFor (el) {
  32867. var exp = el.for;
  32868. var alias = el.alias;
  32869. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  32870. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  32871. if (
  32872. "development" !== 'production' &&
  32873. maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key
  32874. ) {
  32875. warn$3(
  32876. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  32877. "v-for should have explicit keys. " +
  32878. "See https://vuejs.org/guide/list.html#key for more info.",
  32879. true /* tip */
  32880. );
  32881. }
  32882. el.forProcessed = true; // avoid recursion
  32883. return "_l((" + exp + ")," +
  32884. "function(" + alias + iterator1 + iterator2 + "){" +
  32885. "return " + (genElement(el)) +
  32886. '})'
  32887. }
  32888. function genData (el) {
  32889. var data = '{';
  32890. // directives first.
  32891. // directives may mutate the el's other properties before they are generated.
  32892. var dirs = genDirectives(el);
  32893. if (dirs) { data += dirs + ','; }
  32894. // key
  32895. if (el.key) {
  32896. data += "key:" + (el.key) + ",";
  32897. }
  32898. // ref
  32899. if (el.ref) {
  32900. data += "ref:" + (el.ref) + ",";
  32901. }
  32902. if (el.refInFor) {
  32903. data += "refInFor:true,";
  32904. }
  32905. // pre
  32906. if (el.pre) {
  32907. data += "pre:true,";
  32908. }
  32909. // record original tag name for components using "is" attribute
  32910. if (el.component) {
  32911. data += "tag:\"" + (el.tag) + "\",";
  32912. }
  32913. // module data generation functions
  32914. for (var i = 0; i < dataGenFns.length; i++) {
  32915. data += dataGenFns[i](el);
  32916. }
  32917. // attributes
  32918. if (el.attrs) {
  32919. data += "attrs:{" + (genProps(el.attrs)) + "},";
  32920. }
  32921. // DOM props
  32922. if (el.props) {
  32923. data += "domProps:{" + (genProps(el.props)) + "},";
  32924. }
  32925. // event handlers
  32926. if (el.events) {
  32927. data += (genHandlers(el.events)) + ",";
  32928. }
  32929. if (el.nativeEvents) {
  32930. data += (genHandlers(el.nativeEvents, true)) + ",";
  32931. }
  32932. // slot target
  32933. if (el.slotTarget) {
  32934. data += "slot:" + (el.slotTarget) + ",";
  32935. }
  32936. // scoped slots
  32937. if (el.scopedSlots) {
  32938. data += (genScopedSlots(el.scopedSlots)) + ",";
  32939. }
  32940. // component v-model
  32941. if (el.model) {
  32942. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  32943. }
  32944. // inline-template
  32945. if (el.inlineTemplate) {
  32946. var inlineTemplate = genInlineTemplate(el);
  32947. if (inlineTemplate) {
  32948. data += inlineTemplate + ",";
  32949. }
  32950. }
  32951. data = data.replace(/,$/, '') + '}';
  32952. // v-bind data wrap
  32953. if (el.wrapData) {
  32954. data = el.wrapData(data);
  32955. }
  32956. return data
  32957. }
  32958. function genDirectives (el) {
  32959. var dirs = el.directives;
  32960. if (!dirs) { return }
  32961. var res = 'directives:[';
  32962. var hasRuntime = false;
  32963. var i, l, dir, needRuntime;
  32964. for (i = 0, l = dirs.length; i < l; i++) {
  32965. dir = dirs[i];
  32966. needRuntime = true;
  32967. var gen = platformDirectives$1[dir.name] || baseDirectives[dir.name];
  32968. if (gen) {
  32969. // compile-time directive that manipulates AST.
  32970. // returns true if it also needs a runtime counterpart.
  32971. needRuntime = !!gen(el, dir, warn$3);
  32972. }
  32973. if (needRuntime) {
  32974. hasRuntime = true;
  32975. 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))) : '') + "},";
  32976. }
  32977. }
  32978. if (hasRuntime) {
  32979. return res.slice(0, -1) + ']'
  32980. }
  32981. }
  32982. function genInlineTemplate (el) {
  32983. var ast = el.children[0];
  32984. if ("development" !== 'production' && (
  32985. el.children.length > 1 || ast.type !== 1
  32986. )) {
  32987. warn$3('Inline-template components must have exactly one child element.');
  32988. }
  32989. if (ast.type === 1) {
  32990. var inlineRenderFns = generate(ast, currentOptions);
  32991. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  32992. }
  32993. }
  32994. function genScopedSlots (slots) {
  32995. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "])")
  32996. }
  32997. function genScopedSlot (key, el) {
  32998. return "[" + key + ",function(" + (String(el.attrsMap.scope)) + "){" +
  32999. "return " + (el.tag === 'template'
  33000. ? genChildren(el) || 'void 0'
  33001. : genElement(el)) + "}]"
  33002. }
  33003. function genChildren (el, checkSkip) {
  33004. var children = el.children;
  33005. if (children.length) {
  33006. var el$1 = children[0];
  33007. // optimize single v-for
  33008. if (children.length === 1 &&
  33009. el$1.for &&
  33010. el$1.tag !== 'template' &&
  33011. el$1.tag !== 'slot') {
  33012. return genElement(el$1)
  33013. }
  33014. var normalizationType = checkSkip ? getNormalizationType(children) : 0;
  33015. return ("[" + (children.map(genNode).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  33016. }
  33017. }
  33018. // determine the normalization needed for the children array.
  33019. // 0: no normalization needed
  33020. // 1: simple normalization needed (possible 1-level deep nested array)
  33021. // 2: full normalization needed
  33022. function getNormalizationType (children) {
  33023. var res = 0;
  33024. for (var i = 0; i < children.length; i++) {
  33025. var el = children[i];
  33026. if (el.type !== 1) {
  33027. continue
  33028. }
  33029. if (needsNormalization(el) ||
  33030. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  33031. res = 2;
  33032. break
  33033. }
  33034. if (maybeComponent(el) ||
  33035. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  33036. res = 1;
  33037. }
  33038. }
  33039. return res
  33040. }
  33041. function needsNormalization (el) {
  33042. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  33043. }
  33044. function maybeComponent (el) {
  33045. return !isPlatformReservedTag$1(el.tag)
  33046. }
  33047. function genNode (node) {
  33048. if (node.type === 1) {
  33049. return genElement(node)
  33050. } else {
  33051. return genText(node)
  33052. }
  33053. }
  33054. function genText (text) {
  33055. return ("_v(" + (text.type === 2
  33056. ? text.expression // no need for () because already wrapped in _s()
  33057. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  33058. }
  33059. function genSlot (el) {
  33060. var slotName = el.slotName || '"default"';
  33061. var children = genChildren(el);
  33062. var res = "_t(" + slotName + (children ? ("," + children) : '');
  33063. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  33064. var bind$$1 = el.attrsMap['v-bind'];
  33065. if ((attrs || bind$$1) && !children) {
  33066. res += ",null";
  33067. }
  33068. if (attrs) {
  33069. res += "," + attrs;
  33070. }
  33071. if (bind$$1) {
  33072. res += (attrs ? '' : ',null') + "," + bind$$1;
  33073. }
  33074. return res + ')'
  33075. }
  33076. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  33077. function genComponent (componentName, el) {
  33078. var children = el.inlineTemplate ? null : genChildren(el, true);
  33079. return ("_c(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
  33080. }
  33081. function genProps (props) {
  33082. var res = '';
  33083. for (var i = 0; i < props.length; i++) {
  33084. var prop = props[i];
  33085. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  33086. }
  33087. return res.slice(0, -1)
  33088. }
  33089. // #3895, #4268
  33090. function transformSpecialNewlines (text) {
  33091. return text
  33092. .replace(/\u2028/g, '\\u2028')
  33093. .replace(/\u2029/g, '\\u2029')
  33094. }
  33095. /* */
  33096. // these keywords should not appear inside expressions, but operators like
  33097. // typeof, instanceof and in are allowed
  33098. var prohibitedKeywordRE = new RegExp('\\b' + (
  33099. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  33100. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  33101. 'extends,finally,continue,debugger,function,arguments'
  33102. ).split(',').join('\\b|\\b') + '\\b');
  33103. // these unary operators should not be used as property/method names
  33104. var unaryOperatorsRE = new RegExp('\\b' + (
  33105. 'delete,typeof,void'
  33106. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  33107. // check valid identifier for v-for
  33108. var identRE = /[A-Za-z_$][\w$]*/;
  33109. // strip strings in expressions
  33110. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  33111. // detect problematic expressions in a template
  33112. function detectErrors (ast) {
  33113. var errors = [];
  33114. if (ast) {
  33115. checkNode(ast, errors);
  33116. }
  33117. return errors
  33118. }
  33119. function checkNode (node, errors) {
  33120. if (node.type === 1) {
  33121. for (var name in node.attrsMap) {
  33122. if (dirRE.test(name)) {
  33123. var value = node.attrsMap[name];
  33124. if (value) {
  33125. if (name === 'v-for') {
  33126. checkFor(node, ("v-for=\"" + value + "\""), errors);
  33127. } else if (onRE.test(name)) {
  33128. checkEvent(value, (name + "=\"" + value + "\""), errors);
  33129. } else {
  33130. checkExpression(value, (name + "=\"" + value + "\""), errors);
  33131. }
  33132. }
  33133. }
  33134. }
  33135. if (node.children) {
  33136. for (var i = 0; i < node.children.length; i++) {
  33137. checkNode(node.children[i], errors);
  33138. }
  33139. }
  33140. } else if (node.type === 2) {
  33141. checkExpression(node.expression, node.text, errors);
  33142. }
  33143. }
  33144. function checkEvent (exp, text, errors) {
  33145. var keywordMatch = exp.replace(stripStringRE, '').match(unaryOperatorsRE);
  33146. if (keywordMatch) {
  33147. errors.push(
  33148. "avoid using JavaScript unary operator as property name: " +
  33149. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  33150. );
  33151. }
  33152. checkExpression(exp, text, errors);
  33153. }
  33154. function checkFor (node, text, errors) {
  33155. checkExpression(node.for || '', text, errors);
  33156. checkIdentifier(node.alias, 'v-for alias', text, errors);
  33157. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  33158. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  33159. }
  33160. function checkIdentifier (ident, type, text, errors) {
  33161. if (typeof ident === 'string' && !identRE.test(ident)) {
  33162. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  33163. }
  33164. }
  33165. function checkExpression (exp, text, errors) {
  33166. try {
  33167. new Function(("return " + exp));
  33168. } catch (e) {
  33169. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  33170. if (keywordMatch) {
  33171. errors.push(
  33172. "avoid using JavaScript keyword as property name: " +
  33173. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  33174. );
  33175. } else {
  33176. errors.push(("invalid expression: " + (text.trim())));
  33177. }
  33178. }
  33179. }
  33180. /* */
  33181. function baseCompile (
  33182. template,
  33183. options
  33184. ) {
  33185. var ast = parse(template.trim(), options);
  33186. optimize(ast, options);
  33187. var code = generate(ast, options);
  33188. return {
  33189. ast: ast,
  33190. render: code.render,
  33191. staticRenderFns: code.staticRenderFns
  33192. }
  33193. }
  33194. function makeFunction (code, errors) {
  33195. try {
  33196. return new Function(code)
  33197. } catch (err) {
  33198. errors.push({ err: err, code: code });
  33199. return noop
  33200. }
  33201. }
  33202. function createCompiler (baseOptions) {
  33203. var functionCompileCache = Object.create(null);
  33204. function compile (
  33205. template,
  33206. options
  33207. ) {
  33208. var finalOptions = Object.create(baseOptions);
  33209. var errors = [];
  33210. var tips = [];
  33211. finalOptions.warn = function (msg, tip$$1) {
  33212. (tip$$1 ? tips : errors).push(msg);
  33213. };
  33214. if (options) {
  33215. // merge custom modules
  33216. if (options.modules) {
  33217. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  33218. }
  33219. // merge custom directives
  33220. if (options.directives) {
  33221. finalOptions.directives = extend(
  33222. Object.create(baseOptions.directives),
  33223. options.directives
  33224. );
  33225. }
  33226. // copy other options
  33227. for (var key in options) {
  33228. if (key !== 'modules' && key !== 'directives') {
  33229. finalOptions[key] = options[key];
  33230. }
  33231. }
  33232. }
  33233. var compiled = baseCompile(template, finalOptions);
  33234. {
  33235. errors.push.apply(errors, detectErrors(compiled.ast));
  33236. }
  33237. compiled.errors = errors;
  33238. compiled.tips = tips;
  33239. return compiled
  33240. }
  33241. function compileToFunctions (
  33242. template,
  33243. options,
  33244. vm
  33245. ) {
  33246. options = options || {};
  33247. /* istanbul ignore if */
  33248. {
  33249. // detect possible CSP restriction
  33250. try {
  33251. new Function('return 1');
  33252. } catch (e) {
  33253. if (e.toString().match(/unsafe-eval|CSP/)) {
  33254. warn(
  33255. 'It seems you are using the standalone build of Vue.js in an ' +
  33256. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  33257. 'The template compiler cannot work in this environment. Consider ' +
  33258. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  33259. 'templates into render functions.'
  33260. );
  33261. }
  33262. }
  33263. }
  33264. // check cache
  33265. var key = options.delimiters
  33266. ? String(options.delimiters) + template
  33267. : template;
  33268. if (functionCompileCache[key]) {
  33269. return functionCompileCache[key]
  33270. }
  33271. // compile
  33272. var compiled = compile(template, options);
  33273. // check compilation errors/tips
  33274. {
  33275. if (compiled.errors && compiled.errors.length) {
  33276. warn(
  33277. "Error compiling template:\n\n" + template + "\n\n" +
  33278. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  33279. vm
  33280. );
  33281. }
  33282. if (compiled.tips && compiled.tips.length) {
  33283. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  33284. }
  33285. }
  33286. // turn code into functions
  33287. var res = {};
  33288. var fnGenErrors = [];
  33289. res.render = makeFunction(compiled.render, fnGenErrors);
  33290. var l = compiled.staticRenderFns.length;
  33291. res.staticRenderFns = new Array(l);
  33292. for (var i = 0; i < l; i++) {
  33293. res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i], fnGenErrors);
  33294. }
  33295. // check function generation errors.
  33296. // this should only happen if there is a bug in the compiler itself.
  33297. // mostly for codegen development use
  33298. /* istanbul ignore if */
  33299. {
  33300. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  33301. warn(
  33302. "Failed to generate render function:\n\n" +
  33303. fnGenErrors.map(function (ref) {
  33304. var err = ref.err;
  33305. var code = ref.code;
  33306. return ((err.toString()) + " in\n\n" + code + "\n");
  33307. }).join('\n'),
  33308. vm
  33309. );
  33310. }
  33311. }
  33312. return (functionCompileCache[key] = res)
  33313. }
  33314. return {
  33315. compile: compile,
  33316. compileToFunctions: compileToFunctions
  33317. }
  33318. }
  33319. /* */
  33320. function transformNode (el, options) {
  33321. var warn = options.warn || baseWarn;
  33322. var staticClass = getAndRemoveAttr(el, 'class');
  33323. if ("development" !== 'production' && staticClass) {
  33324. var expression = parseText(staticClass, options.delimiters);
  33325. if (expression) {
  33326. warn(
  33327. "class=\"" + staticClass + "\": " +
  33328. 'Interpolation inside attributes has been removed. ' +
  33329. 'Use v-bind or the colon shorthand instead. For example, ' +
  33330. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  33331. );
  33332. }
  33333. }
  33334. if (staticClass) {
  33335. el.staticClass = JSON.stringify(staticClass);
  33336. }
  33337. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  33338. if (classBinding) {
  33339. el.classBinding = classBinding;
  33340. }
  33341. }
  33342. function genData$1 (el) {
  33343. var data = '';
  33344. if (el.staticClass) {
  33345. data += "staticClass:" + (el.staticClass) + ",";
  33346. }
  33347. if (el.classBinding) {
  33348. data += "class:" + (el.classBinding) + ",";
  33349. }
  33350. return data
  33351. }
  33352. var klass$1 = {
  33353. staticKeys: ['staticClass'],
  33354. transformNode: transformNode,
  33355. genData: genData$1
  33356. };
  33357. /* */
  33358. function transformNode$1 (el, options) {
  33359. var warn = options.warn || baseWarn;
  33360. var staticStyle = getAndRemoveAttr(el, 'style');
  33361. if (staticStyle) {
  33362. /* istanbul ignore if */
  33363. {
  33364. var expression = parseText(staticStyle, options.delimiters);
  33365. if (expression) {
  33366. warn(
  33367. "style=\"" + staticStyle + "\": " +
  33368. 'Interpolation inside attributes has been removed. ' +
  33369. 'Use v-bind or the colon shorthand instead. For example, ' +
  33370. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  33371. );
  33372. }
  33373. }
  33374. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  33375. }
  33376. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  33377. if (styleBinding) {
  33378. el.styleBinding = styleBinding;
  33379. }
  33380. }
  33381. function genData$2 (el) {
  33382. var data = '';
  33383. if (el.staticStyle) {
  33384. data += "staticStyle:" + (el.staticStyle) + ",";
  33385. }
  33386. if (el.styleBinding) {
  33387. data += "style:(" + (el.styleBinding) + "),";
  33388. }
  33389. return data
  33390. }
  33391. var style$1 = {
  33392. staticKeys: ['staticStyle'],
  33393. transformNode: transformNode$1,
  33394. genData: genData$2
  33395. };
  33396. var modules$1 = [
  33397. klass$1,
  33398. style$1
  33399. ];
  33400. /* */
  33401. function text (el, dir) {
  33402. if (dir.value) {
  33403. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  33404. }
  33405. }
  33406. /* */
  33407. function html (el, dir) {
  33408. if (dir.value) {
  33409. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  33410. }
  33411. }
  33412. var directives$1 = {
  33413. model: model,
  33414. text: text,
  33415. html: html
  33416. };
  33417. /* */
  33418. var baseOptions = {
  33419. expectHTML: true,
  33420. modules: modules$1,
  33421. directives: directives$1,
  33422. isPreTag: isPreTag,
  33423. isUnaryTag: isUnaryTag,
  33424. mustUseProp: mustUseProp,
  33425. canBeLeftOpenTag: canBeLeftOpenTag,
  33426. isReservedTag: isReservedTag,
  33427. getTagNamespace: getTagNamespace,
  33428. staticKeys: genStaticKeys(modules$1)
  33429. };
  33430. var ref$1 = createCompiler(baseOptions);
  33431. var compileToFunctions = ref$1.compileToFunctions;
  33432. /* */
  33433. var idToTemplate = cached(function (id) {
  33434. var el = query(id);
  33435. return el && el.innerHTML
  33436. });
  33437. var mount = Vue$3.prototype.$mount;
  33438. Vue$3.prototype.$mount = function (
  33439. el,
  33440. hydrating
  33441. ) {
  33442. el = el && query(el);
  33443. /* istanbul ignore if */
  33444. if (el === document.body || el === document.documentElement) {
  33445. "development" !== 'production' && warn(
  33446. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  33447. );
  33448. return this
  33449. }
  33450. var options = this.$options;
  33451. // resolve template/el and convert to render function
  33452. if (!options.render) {
  33453. var template = options.template;
  33454. if (template) {
  33455. if (typeof template === 'string') {
  33456. if (template.charAt(0) === '#') {
  33457. template = idToTemplate(template);
  33458. /* istanbul ignore if */
  33459. if ("development" !== 'production' && !template) {
  33460. warn(
  33461. ("Template element not found or is empty: " + (options.template)),
  33462. this
  33463. );
  33464. }
  33465. }
  33466. } else if (template.nodeType) {
  33467. template = template.innerHTML;
  33468. } else {
  33469. {
  33470. warn('invalid template option:' + template, this);
  33471. }
  33472. return this
  33473. }
  33474. } else if (el) {
  33475. template = getOuterHTML(el);
  33476. }
  33477. if (template) {
  33478. /* istanbul ignore if */
  33479. if ("development" !== 'production' && config.performance && mark) {
  33480. mark('compile');
  33481. }
  33482. var ref = compileToFunctions(template, {
  33483. shouldDecodeNewlines: shouldDecodeNewlines,
  33484. delimiters: options.delimiters
  33485. }, this);
  33486. var render = ref.render;
  33487. var staticRenderFns = ref.staticRenderFns;
  33488. options.render = render;
  33489. options.staticRenderFns = staticRenderFns;
  33490. /* istanbul ignore if */
  33491. if ("development" !== 'production' && config.performance && mark) {
  33492. mark('compile end');
  33493. measure(((this._name) + " compile"), 'compile', 'compile end');
  33494. }
  33495. }
  33496. }
  33497. return mount.call(this, el, hydrating)
  33498. };
  33499. /**
  33500. * Get outerHTML of elements, taking care
  33501. * of SVG elements in IE as well.
  33502. */
  33503. function getOuterHTML (el) {
  33504. if (el.outerHTML) {
  33505. return el.outerHTML
  33506. } else {
  33507. var container = document.createElement('div');
  33508. container.appendChild(el.cloneNode(true));
  33509. return container.innerHTML
  33510. }
  33511. }
  33512. Vue$3.compile = compileToFunctions;
  33513. return Vue$3;
  33514. })));
  33515. });
  33516. return ___scope___.entry = "dist/vue.runtime.common.js";
  33517. });
  33518. FuseBox.pkg("vee-validate", {}, function(___scope___){
  33519. ___scope___.file("dist/vee-validate.js", function(exports, require, module, __filename, __dirname){
  33520. /**
  33521. * vee-validate v2.0.0-beta.24
  33522. * (c) 2017 Abdelrahman Awad
  33523. * @license MIT
  33524. */
  33525. (function (global, factory) {
  33526. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  33527. typeof define === 'function' && define.amd ? define(factory) :
  33528. (global.VeeValidate = factory());
  33529. }(this, (function () { 'use strict';
  33530. var alpha = function (value) { return /^[a-zA-Z]*$/.test(value); };
  33531. var alpha_dash = function (value) { return /^[a-zA-Z0-9_-]*$/.test(value); };
  33532. var alpha_num = function (value) { return /^[a-zA-Z0-9]*$/.test(value); };
  33533. var alpha_spaces = function (value) { return /^[a-zA-Z\s]*$/.test(value); };
  33534. var between = function (value, ref) {
  33535. var min = ref[0];
  33536. var max = ref[1];
  33537. return Number(min) <= value && Number(max) >= value;
  33538. };
  33539. var confirmed = function (value, ref, validatingField) {
  33540. var confirmedField = ref[0];
  33541. var field = confirmedField
  33542. ? document.querySelector(("input[name='" + confirmedField + "']"))
  33543. : document.querySelector(("input[name='" + validatingField + "_confirmation']"));
  33544. return !! (field && String(value) === field.value);
  33545. };
  33546. function unwrapExports (x) {
  33547. return x && x.__esModule ? x['default'] : x;
  33548. }
  33549. function createCommonjsModule(fn, module) {
  33550. return module = { exports: {} }, fn(module, module.exports), module.exports;
  33551. }
  33552. var assertString_1 = createCommonjsModule(function (module, exports) {
  33553. 'use strict';
  33554. Object.defineProperty(exports, "__esModule", {
  33555. value: true
  33556. });
  33557. exports.default = assertString;
  33558. function assertString(input) {
  33559. if (typeof input !== 'string') {
  33560. throw new TypeError('This library (validator.js) validates strings only');
  33561. }
  33562. }
  33563. module.exports = exports['default'];
  33564. });
  33565. var isCreditCard_1 = createCommonjsModule(function (module, exports) {
  33566. 'use strict';
  33567. Object.defineProperty(exports, "__esModule", {
  33568. value: true
  33569. });
  33570. exports.default = isCreditCard;
  33571. var _assertString = assertString_1;
  33572. var _assertString2 = _interopRequireDefault(_assertString);
  33573. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33574. /* eslint-disable max-len */
  33575. var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})|62[0-9]{14}$/;
  33576. /* eslint-enable max-len */
  33577. function isCreditCard(str) {
  33578. (0, _assertString2.default)(str);
  33579. var sanitized = str.replace(/[^0-9]+/g, '');
  33580. if (!creditCard.test(sanitized)) {
  33581. return false;
  33582. }
  33583. var sum = 0;
  33584. var digit = void 0;
  33585. var tmpNum = void 0;
  33586. var shouldDouble = void 0;
  33587. for (var i = sanitized.length - 1; i >= 0; i--) {
  33588. digit = sanitized.substring(i, i + 1);
  33589. tmpNum = parseInt(digit, 10);
  33590. if (shouldDouble) {
  33591. tmpNum *= 2;
  33592. if (tmpNum >= 10) {
  33593. sum += tmpNum % 10 + 1;
  33594. } else {
  33595. sum += tmpNum;
  33596. }
  33597. } else {
  33598. sum += tmpNum;
  33599. }
  33600. shouldDouble = !shouldDouble;
  33601. }
  33602. return !!(sum % 10 === 0 ? sanitized : false);
  33603. }
  33604. module.exports = exports['default'];
  33605. });
  33606. var isCreditCard = unwrapExports(isCreditCard_1);
  33607. var credit_card = function (value) { return isCreditCard(String(value)); };
  33608. var decimal = function (value, params) {
  33609. var decimals = Array.isArray(params) ? (params[0] || '*') : '*';
  33610. if (Array.isArray(value)) {
  33611. return false;
  33612. }
  33613. if (value === null || value === undefined || value === '') {
  33614. return true;
  33615. }
  33616. // if is 0.
  33617. if (Number(decimals) === 0) {
  33618. return /^-?\d*$/.test(value);
  33619. }
  33620. var regexPart = decimals === '*' ? '+' : ("{1," + decimals + "}");
  33621. var regex = new RegExp(("^-?\\d*(\\.\\d" + regexPart + ")?$"));
  33622. if (! regex.test(value)) {
  33623. return false;
  33624. }
  33625. var parsedValue = parseFloat(value);
  33626. // eslint-disable-next-line
  33627. return parsedValue === parsedValue;
  33628. };
  33629. var digits = function (value, ref) {
  33630. var length = ref[0];
  33631. var strVal = String(value);
  33632. return /^[0-9]*$/.test(strVal) && strVal.length === Number(length);
  33633. };
  33634. var validateImage = function (file, width, height) {
  33635. var URL = window.URL || window.webkitURL;
  33636. return new Promise(function (resolve) {
  33637. var image = new Image();
  33638. image.onerror = function () { return resolve({ valid: false }); };
  33639. image.onload = function () { return resolve({
  33640. valid: image.width === Number(width) && image.height === Number(height)
  33641. }); };
  33642. image.src = URL.createObjectURL(file);
  33643. });
  33644. };
  33645. var dimensions = function (files, ref) {
  33646. var width = ref[0];
  33647. var height = ref[1];
  33648. var list = [];
  33649. for (var i = 0; i < files.length; i++) {
  33650. // if file is not an image, reject.
  33651. if (! /\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(files[i].name)) {
  33652. return false;
  33653. }
  33654. list.push(files[i]);
  33655. }
  33656. return Promise.all(list.map(function (file) { return validateImage(file, width, height); }));
  33657. };
  33658. var merge_1 = createCommonjsModule(function (module, exports) {
  33659. 'use strict';
  33660. Object.defineProperty(exports, "__esModule", {
  33661. value: true
  33662. });
  33663. exports.default = merge;
  33664. function merge() {
  33665. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  33666. var defaults = arguments[1];
  33667. for (var key in defaults) {
  33668. if (typeof obj[key] === 'undefined') {
  33669. obj[key] = defaults[key];
  33670. }
  33671. }
  33672. return obj;
  33673. }
  33674. module.exports = exports['default'];
  33675. });
  33676. var isByteLength_1 = createCommonjsModule(function (module, exports) {
  33677. 'use strict';
  33678. Object.defineProperty(exports, "__esModule", {
  33679. value: true
  33680. });
  33681. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  33682. exports.default = isByteLength;
  33683. var _assertString = assertString_1;
  33684. var _assertString2 = _interopRequireDefault(_assertString);
  33685. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33686. /* eslint-disable prefer-rest-params */
  33687. function isByteLength(str, options) {
  33688. (0, _assertString2.default)(str);
  33689. var min = void 0;
  33690. var max = void 0;
  33691. if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
  33692. min = options.min || 0;
  33693. max = options.max;
  33694. } else {
  33695. // backwards compatibility: isByteLength(str, min [, max])
  33696. min = arguments[1];
  33697. max = arguments[2];
  33698. }
  33699. var len = encodeURI(str).split(/%..|./).length - 1;
  33700. return len >= min && (typeof max === 'undefined' || len <= max);
  33701. }
  33702. module.exports = exports['default'];
  33703. });
  33704. var isFQDN = createCommonjsModule(function (module, exports) {
  33705. 'use strict';
  33706. Object.defineProperty(exports, "__esModule", {
  33707. value: true
  33708. });
  33709. exports.default = isFDQN;
  33710. var _assertString = assertString_1;
  33711. var _assertString2 = _interopRequireDefault(_assertString);
  33712. var _merge = merge_1;
  33713. var _merge2 = _interopRequireDefault(_merge);
  33714. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33715. var default_fqdn_options = {
  33716. require_tld: true,
  33717. allow_underscores: false,
  33718. allow_trailing_dot: false
  33719. };
  33720. function isFDQN(str, options) {
  33721. (0, _assertString2.default)(str);
  33722. options = (0, _merge2.default)(options, default_fqdn_options);
  33723. /* Remove the optional trailing dot before checking validity */
  33724. if (options.allow_trailing_dot && str[str.length - 1] === '.') {
  33725. str = str.substring(0, str.length - 1);
  33726. }
  33727. var parts = str.split('.');
  33728. if (options.require_tld) {
  33729. var tld = parts.pop();
  33730. if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
  33731. return false;
  33732. }
  33733. }
  33734. for (var part, i = 0; i < parts.length; i++) {
  33735. part = parts[i];
  33736. if (options.allow_underscores) {
  33737. part = part.replace(/_/g, '');
  33738. }
  33739. if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
  33740. return false;
  33741. }
  33742. if (/[\uff01-\uff5e]/.test(part)) {
  33743. // disallow full-width chars
  33744. return false;
  33745. }
  33746. if (part[0] === '-' || part[part.length - 1] === '-') {
  33747. return false;
  33748. }
  33749. }
  33750. return true;
  33751. }
  33752. module.exports = exports['default'];
  33753. });
  33754. var isEmail_1 = createCommonjsModule(function (module, exports) {
  33755. 'use strict';
  33756. Object.defineProperty(exports, "__esModule", {
  33757. value: true
  33758. });
  33759. exports.default = isEmail;
  33760. var _assertString = assertString_1;
  33761. var _assertString2 = _interopRequireDefault(_assertString);
  33762. var _merge = merge_1;
  33763. var _merge2 = _interopRequireDefault(_merge);
  33764. var _isByteLength = isByteLength_1;
  33765. var _isByteLength2 = _interopRequireDefault(_isByteLength);
  33766. var _isFQDN = isFQDN;
  33767. var _isFQDN2 = _interopRequireDefault(_isFQDN);
  33768. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33769. var default_email_options = {
  33770. allow_display_name: false,
  33771. allow_utf8_local_part: true,
  33772. require_tld: true
  33773. };
  33774. /* eslint-disable max-len */
  33775. /* eslint-disable no-control-regex */
  33776. var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i;
  33777. var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
  33778. var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
  33779. var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
  33780. var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
  33781. /* eslint-enable max-len */
  33782. /* eslint-enable no-control-regex */
  33783. function isEmail(str, options) {
  33784. (0, _assertString2.default)(str);
  33785. options = (0, _merge2.default)(options, default_email_options);
  33786. if (options.allow_display_name) {
  33787. var display_email = str.match(displayName);
  33788. if (display_email) {
  33789. str = display_email[1];
  33790. }
  33791. }
  33792. var parts = str.split('@');
  33793. var domain = parts.pop();
  33794. var user = parts.join('@');
  33795. var lower_domain = domain.toLowerCase();
  33796. if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {
  33797. user = user.replace(/\./g, '').toLowerCase();
  33798. }
  33799. if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 256 })) {
  33800. return false;
  33801. }
  33802. if (!(0, _isFQDN2.default)(domain, { require_tld: options.require_tld })) {
  33803. return false;
  33804. }
  33805. if (user[0] === '"') {
  33806. user = user.slice(1, user.length - 1);
  33807. return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
  33808. }
  33809. var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;
  33810. var user_parts = user.split('.');
  33811. for (var i = 0; i < user_parts.length; i++) {
  33812. if (!pattern.test(user_parts[i])) {
  33813. return false;
  33814. }
  33815. }
  33816. return true;
  33817. }
  33818. module.exports = exports['default'];
  33819. });
  33820. var isEmail = unwrapExports(isEmail_1);
  33821. var email = function (value) { return isEmail(String(value)); };
  33822. var ext = function (files, extensions) {
  33823. var regex = new RegExp((".(" + (extensions.join('|')) + ")$"), 'i');
  33824. return files.every(function (file) { return regex.test(file.name); });
  33825. };
  33826. var image = function (files) { return files.every(function (file) { return /\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(file.name); }
  33827. ); };
  33828. var In = function (value, options) { return !! options.filter(function (option) { return option == value; }).length; }; // eslint-disable-line
  33829. var isIP_1 = createCommonjsModule(function (module, exports) {
  33830. 'use strict';
  33831. Object.defineProperty(exports, "__esModule", {
  33832. value: true
  33833. });
  33834. exports.default = isIP;
  33835. var _assertString = assertString_1;
  33836. var _assertString2 = _interopRequireDefault(_assertString);
  33837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33838. var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
  33839. var ipv6Block = /^[0-9A-F]{1,4}$/i;
  33840. function isIP(str) {
  33841. var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  33842. (0, _assertString2.default)(str);
  33843. version = String(version);
  33844. if (!version) {
  33845. return isIP(str, 4) || isIP(str, 6);
  33846. } else if (version === '4') {
  33847. if (!ipv4Maybe.test(str)) {
  33848. return false;
  33849. }
  33850. var parts = str.split('.').sort(function (a, b) {
  33851. return a - b;
  33852. });
  33853. return parts[3] <= 255;
  33854. } else if (version === '6') {
  33855. var blocks = str.split(':');
  33856. var foundOmissionBlock = false; // marker to indicate ::
  33857. // At least some OS accept the last 32 bits of an IPv6 address
  33858. // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says
  33859. // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,
  33860. // and '::a.b.c.d' is deprecated, but also valid.
  33861. var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);
  33862. var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;
  33863. if (blocks.length > expectedNumberOfBlocks) {
  33864. return false;
  33865. }
  33866. // initial or final ::
  33867. if (str === '::') {
  33868. return true;
  33869. } else if (str.substr(0, 2) === '::') {
  33870. blocks.shift();
  33871. blocks.shift();
  33872. foundOmissionBlock = true;
  33873. } else if (str.substr(str.length - 2) === '::') {
  33874. blocks.pop();
  33875. blocks.pop();
  33876. foundOmissionBlock = true;
  33877. }
  33878. for (var i = 0; i < blocks.length; ++i) {
  33879. // test for a :: which can not be at the string start/end
  33880. // since those cases have been handled above
  33881. if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {
  33882. if (foundOmissionBlock) {
  33883. return false; // multiple :: in address
  33884. }
  33885. foundOmissionBlock = true;
  33886. } else if (foundIPv4TransitionBlock && i === blocks.length - 1) {
  33887. // it has been checked before that the last
  33888. // block is a valid IPv4 address
  33889. } else if (!ipv6Block.test(blocks[i])) {
  33890. return false;
  33891. }
  33892. }
  33893. if (foundOmissionBlock) {
  33894. return blocks.length >= 1;
  33895. }
  33896. return blocks.length === expectedNumberOfBlocks;
  33897. }
  33898. return false;
  33899. }
  33900. module.exports = exports['default'];
  33901. });
  33902. var isIP = unwrapExports(isIP_1);
  33903. var ip = function (value, ref) {
  33904. if ( ref === void 0 ) ref = [4];
  33905. var version = ref[0];
  33906. return isIP(value, version);
  33907. };
  33908. var max = function (value, ref) {
  33909. var length = ref[0];
  33910. if (value === undefined || value === null) {
  33911. return length >= 0;
  33912. }
  33913. return String(value).length <= length;
  33914. };
  33915. var max_value = function (value, ref) {
  33916. var max = ref[0];
  33917. if (Array.isArray(value) || value === null || value === undefined || value === '') {
  33918. return false;
  33919. }
  33920. return Number(value) <= max;
  33921. };
  33922. var mimes = function (files, mimes) {
  33923. var regex = new RegExp(((mimes.join('|').replace('*', '.+')) + "$"), 'i');
  33924. return files.every(function (file) { return regex.test(file.type); });
  33925. };
  33926. var min = function (value, ref) {
  33927. var length = ref[0];
  33928. if (value === undefined || value === null) {
  33929. return false;
  33930. }
  33931. return String(value).length >= length;
  33932. };
  33933. var min_value = function (value, ref) {
  33934. var min = ref[0];
  33935. if (Array.isArray(value) || value === null || value === undefined || value === '') {
  33936. return false;
  33937. }
  33938. return Number(value) >= min;
  33939. };
  33940. var not_in = function (value, options) { return ! options.filter(function (option) { return option == value; }).length; }; // eslint-disable-line
  33941. var numeric = function (value) { return /^[0-9]+$/.test(String(value)); };
  33942. var regex = function (value, ref) {
  33943. var regex = ref[0];
  33944. var flags = ref.slice(1);
  33945. if (regex instanceof RegExp) {
  33946. return regex.test(value);
  33947. }
  33948. return new RegExp(regex, flags).test(String(value));
  33949. };
  33950. var required = function (value) {
  33951. if (Array.isArray(value)) {
  33952. return !! value.length;
  33953. }
  33954. if (value === undefined || value === null) {
  33955. return false;
  33956. }
  33957. return !! String(value).trim().length;
  33958. };
  33959. var size = function (files, ref) {
  33960. var size = ref[0];
  33961. if (isNaN(size)) {
  33962. return false;
  33963. }
  33964. var nSize = Number(size) * 1024;
  33965. for (var i = 0; i < files.length; i++) {
  33966. if (files[i].size > nSize) {
  33967. return false;
  33968. }
  33969. }
  33970. return true;
  33971. };
  33972. var isURL_1 = createCommonjsModule(function (module, exports) {
  33973. 'use strict';
  33974. Object.defineProperty(exports, "__esModule", {
  33975. value: true
  33976. });
  33977. exports.default = isURL;
  33978. var _assertString = assertString_1;
  33979. var _assertString2 = _interopRequireDefault(_assertString);
  33980. var _isFQDN = isFQDN;
  33981. var _isFQDN2 = _interopRequireDefault(_isFQDN);
  33982. var _isIP = isIP_1;
  33983. var _isIP2 = _interopRequireDefault(_isIP);
  33984. var _merge = merge_1;
  33985. var _merge2 = _interopRequireDefault(_merge);
  33986. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33987. var default_url_options = {
  33988. protocols: ['http', 'https', 'ftp'],
  33989. require_tld: true,
  33990. require_protocol: false,
  33991. require_host: true,
  33992. require_valid_protocol: true,
  33993. allow_underscores: false,
  33994. allow_trailing_dot: false,
  33995. allow_protocol_relative_urls: false
  33996. };
  33997. var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
  33998. function isRegExp(obj) {
  33999. return Object.prototype.toString.call(obj) === '[object RegExp]';
  34000. }
  34001. function checkHost(host, matches) {
  34002. for (var i = 0; i < matches.length; i++) {
  34003. var match = matches[i];
  34004. if (host === match || isRegExp(match) && match.test(host)) {
  34005. return true;
  34006. }
  34007. }
  34008. return false;
  34009. }
  34010. function isURL(url, options) {
  34011. (0, _assertString2.default)(url);
  34012. if (!url || url.length >= 2083 || /\s/.test(url)) {
  34013. return false;
  34014. }
  34015. if (url.indexOf('mailto:') === 0) {
  34016. return false;
  34017. }
  34018. options = (0, _merge2.default)(options, default_url_options);
  34019. var protocol = void 0,
  34020. auth = void 0,
  34021. host = void 0,
  34022. hostname = void 0,
  34023. port = void 0,
  34024. port_str = void 0,
  34025. split = void 0,
  34026. ipv6 = void 0;
  34027. split = url.split('#');
  34028. url = split.shift();
  34029. split = url.split('?');
  34030. url = split.shift();
  34031. split = url.split('://');
  34032. if (split.length > 1) {
  34033. protocol = split.shift();
  34034. if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
  34035. return false;
  34036. }
  34037. } else if (options.require_protocol) {
  34038. return false;
  34039. } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {
  34040. split[0] = url.substr(2);
  34041. }
  34042. url = split.join('://');
  34043. split = url.split('/');
  34044. url = split.shift();
  34045. if (url === '' && !options.require_host) {
  34046. return true;
  34047. }
  34048. split = url.split('@');
  34049. if (split.length > 1) {
  34050. auth = split.shift();
  34051. if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
  34052. return false;
  34053. }
  34054. }
  34055. hostname = split.join('@');
  34056. port_str = ipv6 = null;
  34057. var ipv6_match = hostname.match(wrapped_ipv6);
  34058. if (ipv6_match) {
  34059. host = '';
  34060. ipv6 = ipv6_match[1];
  34061. port_str = ipv6_match[2] || null;
  34062. } else {
  34063. split = hostname.split(':');
  34064. host = split.shift();
  34065. if (split.length) {
  34066. port_str = split.join(':');
  34067. }
  34068. }
  34069. if (port_str !== null) {
  34070. port = parseInt(port_str, 10);
  34071. if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
  34072. return false;
  34073. }
  34074. }
  34075. if (!(0, _isIP2.default)(host) && !(0, _isFQDN2.default)(host, options) && (!ipv6 || !(0, _isIP2.default)(ipv6, 6)) && host !== 'localhost') {
  34076. return false;
  34077. }
  34078. host = host || ipv6;
  34079. if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
  34080. return false;
  34081. }
  34082. if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
  34083. return false;
  34084. }
  34085. return true;
  34086. }
  34087. module.exports = exports['default'];
  34088. });
  34089. var isURL = unwrapExports(isURL_1);
  34090. var url = function (value, ref) {
  34091. if ( ref === void 0 ) ref = [true];
  34092. var requireProtocol = ref[0];
  34093. return isURL(value, { require_protocol: !! requireProtocol });
  34094. };
  34095. /* eslint-disable camelcase */
  34096. var Rules = {
  34097. alpha_dash: alpha_dash,
  34098. alpha_num: alpha_num,
  34099. alpha_spaces: alpha_spaces,
  34100. alpha: alpha,
  34101. between: between,
  34102. confirmed: confirmed,
  34103. credit_card: credit_card,
  34104. decimal: decimal,
  34105. digits: digits,
  34106. dimensions: dimensions,
  34107. email: email,
  34108. ext: ext,
  34109. image: image,
  34110. in: In,
  34111. ip: ip,
  34112. max: max,
  34113. max_value: max_value,
  34114. mimes: mimes,
  34115. min: min,
  34116. min_value: min_value,
  34117. not_in: not_in,
  34118. numeric: numeric,
  34119. regex: regex,
  34120. required: required,
  34121. size: size,
  34122. url: url
  34123. };
  34124. var ErrorBag = function ErrorBag() {
  34125. this.errors = [];
  34126. };
  34127. /**
  34128. * Adds an error to the internal array.
  34129. *
  34130. * @param {string} field The field name.
  34131. * @param {string} msg The error message.
  34132. * @param {String} rule The rule that is responsible for the error.
  34133. * @param {String} scope The Scope name, optional.
  34134. */
  34135. ErrorBag.prototype.add = function add (field, msg, rule, scope) {
  34136. if ( scope === void 0 ) scope = '__global__';
  34137. this.errors.push({ field: field, msg: msg, rule: rule, scope: scope });
  34138. };
  34139. /**
  34140. * Gets all error messages from the internal array.
  34141. *
  34142. * @param {String} scope The Scope name, optional.
  34143. * @return {Array} errors Array of all error messages.
  34144. */
  34145. ErrorBag.prototype.all = function all (scope) {
  34146. if (! scope) {
  34147. return this.errors.map(function (e) { return e.msg; });
  34148. }
  34149. return this.errors.filter(function (e) { return e.scope === scope; }).map(function (e) { return e.msg; });
  34150. };
  34151. /**
  34152. * Checks if there are any errors in the internal array.
  34153. * @param {String} scope The Scope name, optional.
  34154. * @return {boolean} result True if there was at least one error, false otherwise.
  34155. */
  34156. ErrorBag.prototype.any = function any (scope) {
  34157. if (! scope) {
  34158. return !! this.errors.length;
  34159. }
  34160. return !! this.errors.filter(function (e) { return e.scope === scope; }).length;
  34161. };
  34162. /**
  34163. * Removes all items from the internal array.
  34164. *
  34165. * @param {String} scope The Scope name, optional.
  34166. */
  34167. ErrorBag.prototype.clear = function clear (scope) {
  34168. if (! scope) {
  34169. scope = '__global__';
  34170. }
  34171. this.errors = this.errors.filter(function (e) { return e.scope !== scope; });
  34172. };
  34173. /**
  34174. * Collects errors into groups or for a specific field.
  34175. *
  34176. * @param{string} field The field name.
  34177. * @param{string} scope The scope name.
  34178. * @param {Boolean} map If it should map the errors to strings instead of objects.
  34179. * @return {Array} errors The errors for the specified field.
  34180. */
  34181. ErrorBag.prototype.collect = function collect (field, scope, map) {
  34182. if ( map === void 0 ) map = true;
  34183. if (! field) {
  34184. var collection = {};
  34185. this.errors.forEach(function (e) {
  34186. if (! collection[e.field]) {
  34187. collection[e.field] = [];
  34188. }
  34189. collection[e.field].push(map ? e.msg : e);
  34190. });
  34191. return collection;
  34192. }
  34193. if (scope) {
  34194. return this.errors.filter(function (e) { return e.field === field && e.scope === scope; })
  34195. .map(function (e) { return (map ? e.msg : e); });
  34196. }
  34197. return this.errors.filter(function (e) { return e.field === field && e.scope === '__global__'; })
  34198. .map(function (e) { return (map ? e.msg : e); });
  34199. };
  34200. /**
  34201. * Gets the internal array length.
  34202. *
  34203. * @return {Number} length The internal array length.
  34204. */
  34205. ErrorBag.prototype.count = function count () {
  34206. return this.errors.length;
  34207. };
  34208. /**
  34209. * Gets the first error message for a specific field.
  34210. *
  34211. * @param{string} field The field name.
  34212. * @return {string|null} message The error message.
  34213. */
  34214. ErrorBag.prototype.first = function first (field, scope) {
  34215. var this$1 = this;
  34216. if ( scope === void 0 ) scope = '__global__';
  34217. var selector = this._selector(field);
  34218. var scoped = this._scope(field);
  34219. if (scoped) {
  34220. var result = this.first(scoped.name, scoped.scope);
  34221. // if such result exist, return it. otherwise it could be a field.
  34222. // with dot in its name.
  34223. if (result) {
  34224. return result;
  34225. }
  34226. }
  34227. if (selector) {
  34228. return this.firstByRule(selector.name, selector.rule, scope);
  34229. }
  34230. for (var i = 0; i < this.errors.length; i++) {
  34231. if (this$1.errors[i].field === field && (this$1.errors[i].scope === scope)) {
  34232. return this$1.errors[i].msg;
  34233. }
  34234. }
  34235. return null;
  34236. };
  34237. /**
  34238. * Returns the first error rule for the specified field
  34239. *
  34240. * @param {string} field The specified field.
  34241. * @return {string|null} First error rule on the specified field if one is found, otherwise null
  34242. */
  34243. ErrorBag.prototype.firstRule = function firstRule (field, scope) {
  34244. var errors = this.collect(field, scope, false);
  34245. return (errors.length && errors[0].rule) || null;
  34246. };
  34247. /**
  34248. * Checks if the internal array has at least one error for the specified field.
  34249. *
  34250. * @param{string} field The specified field.
  34251. * @return {Boolean} result True if at least one error is found, false otherwise.
  34252. */
  34253. ErrorBag.prototype.has = function has (field, scope) {
  34254. if ( scope === void 0 ) scope = '__global__';
  34255. return !! this.first(field, scope);
  34256. };
  34257. /**
  34258. * Gets the first error message for a specific field and a rule.
  34259. * @param {String} name The name of the field.
  34260. * @param {String} rule The name of the rule.
  34261. * @param {String} scope The name of the scope (optional).
  34262. */
  34263. ErrorBag.prototype.firstByRule = function firstByRule (name, rule, scope) {
  34264. var error = this.collect(name, scope, false).filter(function (e) { return e.rule === rule; })[0];
  34265. return (error && error.msg) || null;
  34266. };
  34267. /**
  34268. * Removes all error messages associated with a specific field.
  34269. *
  34270. * @param{string} field The field which messages are to be removed.
  34271. * @param {String} scope The Scope name, optional.
  34272. */
  34273. ErrorBag.prototype.remove = function remove (field, scope) {
  34274. if (scope) {
  34275. this.errors = this.errors.filter(function (e) { return e.field !== field || e.scope !== scope; });
  34276. return;
  34277. }
  34278. this.errors = this.errors.filter(function (e) { return e.field !== field && e.scope === '__global__'; });
  34279. };
  34280. /**
  34281. * Get the field attributes if there's a rule selector.
  34282. *
  34283. * @param{string} field The specified field.
  34284. * @return {Object|null}
  34285. */
  34286. ErrorBag.prototype._selector = function _selector (field) {
  34287. if (field.indexOf(':') > -1) {
  34288. var ref = field.split(':');
  34289. var name = ref[0];
  34290. var rule = ref[1];
  34291. return { name: name, rule: rule };
  34292. }
  34293. return null;
  34294. };
  34295. /**
  34296. * Get the field scope if specified using dot notation.
  34297. *
  34298. * @param {string} field the specifie field.
  34299. * @return {Object|null}
  34300. */
  34301. ErrorBag.prototype._scope = function _scope (field) {
  34302. if (field.indexOf('.') > -1) {
  34303. var ref = field.split('.');
  34304. var scope = ref[0];
  34305. var name = ref[1];
  34306. return { name: name, scope: scope };
  34307. }
  34308. return null;
  34309. };
  34310. var ValidatorException = (function () {
  34311. function anonymous(msg) {
  34312. this.msg = "[vee-validate]: " + msg;
  34313. }
  34314. anonymous.prototype.toString = function toString () {
  34315. return this.msg;
  34316. };
  34317. return anonymous;
  34318. }());
  34319. /**
  34320. * Gets the data attribute. the name must be kebab-case.
  34321. */
  34322. var getDataAttribute = function (el, name) { return el.getAttribute(("data-vv-" + name)); };
  34323. /**
  34324. * Determines the input field scope.
  34325. */
  34326. var getScope = function (el) {
  34327. var scope = getDataAttribute(el, 'scope');
  34328. if (! scope && el.form) {
  34329. scope = getDataAttribute(el.form, 'scope');
  34330. }
  34331. return scope;
  34332. };
  34333. /**
  34334. * Debounces a function.
  34335. */
  34336. var debounce = function (callback, wait, immediate) {
  34337. if ( wait === void 0 ) wait = 0;
  34338. var timeout;
  34339. if (wait == 0) {
  34340. return callback;
  34341. }
  34342. return function () {
  34343. var args = [], len = arguments.length;
  34344. while ( len-- ) args[ len ] = arguments[ len ];
  34345. var later = function () {
  34346. timeout = null;
  34347. if (!immediate) { callback.apply(void 0, args); }
  34348. };
  34349. var callNow = immediate && !timeout;
  34350. clearTimeout(timeout);
  34351. timeout = setTimeout(later, wait);
  34352. if (callNow) { callback(args); }
  34353. };
  34354. };
  34355. /**
  34356. * Emits a warning to the console.
  34357. */
  34358. var warn = function (message) {
  34359. if (! console) {
  34360. return;
  34361. }
  34362. console.warn(("[vee-validate]: " + message)); // eslint-disable-line
  34363. };
  34364. /**
  34365. * Checks if the value is an object.
  34366. */
  34367. var isObject = function (object) {
  34368. return object !== null && object && typeof object === 'object' && ! Array.isArray(object);
  34369. };
  34370. /**
  34371. * Checks if a function is callable.
  34372. */
  34373. var isCallable = function (func) { return typeof func === 'function'; };
  34374. /**
  34375. * Check if element has the css class on it.
  34376. */
  34377. var hasClass = function (el, className) {
  34378. if (el.classList) {
  34379. return el.classList.contains(className);
  34380. }
  34381. return !!el.className.match(new RegExp(("(\\s|^)" + className + "(\\s|$)")));
  34382. };
  34383. /**
  34384. * Adds the provided css className to the element.
  34385. */
  34386. var addClass = function (el, className) {
  34387. if (el.classList) {
  34388. el.classList.add(className);
  34389. return;
  34390. }
  34391. if (!hasClass(el, className)) {
  34392. el.className += " " + className;
  34393. }
  34394. };
  34395. /**
  34396. * Remove the provided css className from the element.
  34397. */
  34398. var removeClass = function (el, className) {
  34399. if (el.classList) {
  34400. el.classList.remove(className);
  34401. return;
  34402. }
  34403. if (hasClass(el, className)) {
  34404. var reg = new RegExp(("(\\s|^)" + className + "(\\s|$)"));
  34405. el.className = el.className.replace(reg, ' ');
  34406. }
  34407. };
  34408. /**
  34409. * Converts an array-like object to array.
  34410. * Simple polyfill for Array.from
  34411. */
  34412. var toArray = function (arrayLike) {
  34413. if (Array.from) {
  34414. return Array.from(arrayLike);
  34415. }
  34416. var array = [];
  34417. var length = arrayLike.length;
  34418. for (var i = 0; i < length; i++) {
  34419. array.push(arrayLike[i]);
  34420. }
  34421. return array;
  34422. };
  34423. /**
  34424. * Assign polyfill from the mdn.
  34425. */
  34426. var assign = function (target) {
  34427. var others = [], len = arguments.length - 1;
  34428. while ( len-- > 0 ) others[ len ] = arguments[ len + 1 ];
  34429. if (Object.assign) {
  34430. return Object.assign.apply(Object, [ target ].concat( others ));
  34431. }
  34432. if (target == null) {
  34433. throw new TypeError('Cannot convert undefined or null to object');
  34434. }
  34435. var to = Object(target);
  34436. others.forEach(function (arg) {
  34437. // Skip over if undefined or null
  34438. if (arg != null) {
  34439. Object.keys(arg).forEach(function (key) {
  34440. to[key] = arg[key];
  34441. });
  34442. }
  34443. });
  34444. return to;
  34445. };
  34446. /**
  34447. * polyfills array.find
  34448. * @param {Array} array
  34449. * @param {Function} predicate
  34450. */
  34451. var find = function (array, predicate) {
  34452. if (array.find) {
  34453. return array.find(predicate);
  34454. }
  34455. var result;
  34456. array.some(function (item) {
  34457. if (predicate(item)) {
  34458. result = item;
  34459. return true;
  34460. }
  34461. return false;
  34462. });
  34463. return result;
  34464. };
  34465. /**
  34466. * Gets the rules from a binding value or the element dataset.
  34467. *
  34468. * @param {String} expression The binding expression.
  34469. * @param {Object|String} value The binding value.
  34470. * @param {element} el The element.
  34471. * @returns {String|Object}
  34472. */
  34473. var getRules = function (expression, value, el) {
  34474. if (! expression) {
  34475. return getDataAttribute(el, 'rules');
  34476. }
  34477. if (typeof value === 'string') {
  34478. return value;
  34479. }
  34480. if (~['string', 'object'].indexOf(typeof value.rules)) {
  34481. return value.rules
  34482. }
  34483. return value;
  34484. };
  34485. /* eslint-disable prefer-rest-params */
  34486. var Dictionary = function Dictionary(dictionary) {
  34487. if ( dictionary === void 0 ) dictionary = {};
  34488. this.dictionary = {};
  34489. this.merge(dictionary);
  34490. };
  34491. Dictionary.prototype.hasLocale = function hasLocale (locale) {
  34492. return !! this.dictionary[locale];
  34493. };
  34494. Dictionary.prototype.getMessage = function getMessage (locale, key, fallback) {
  34495. if (! this.hasMessage(locale, key)) {
  34496. return fallback || this._getDefaultMessage(locale);
  34497. }
  34498. return this.dictionary[locale].messages[key];
  34499. };
  34500. Dictionary.prototype._getDefaultMessage = function _getDefaultMessage (locale) {
  34501. if (this.hasMessage(locale, '_default')) {
  34502. return this.dictionary[locale].messages._default;
  34503. }
  34504. return this.dictionary.en.messages._default;
  34505. };
  34506. Dictionary.prototype.getAttribute = function getAttribute (locale, key, fallback) {
  34507. if ( fallback === void 0 ) fallback = '';
  34508. if (! this.hasAttribute(locale, key)) {
  34509. return fallback;
  34510. }
  34511. return this.dictionary[locale].attributes[key];
  34512. };
  34513. Dictionary.prototype.hasMessage = function hasMessage (locale, key) {
  34514. return !! (
  34515. this.hasLocale(locale) &&
  34516. this.dictionary[locale].messages &&
  34517. this.dictionary[locale].messages[key]
  34518. );
  34519. };
  34520. Dictionary.prototype.hasAttribute = function hasAttribute (locale, key) {
  34521. return !! (
  34522. this.hasLocale(locale) &&
  34523. this.dictionary[locale].attributes &&
  34524. this.dictionary[locale].attributes[key]
  34525. );
  34526. };
  34527. Dictionary.prototype.merge = function merge (dictionary) {
  34528. this._merge(this.dictionary, dictionary);
  34529. };
  34530. Dictionary.prototype.setMessage = function setMessage (locale, key, message) {
  34531. if (! this.hasLocale(locale)) {
  34532. this.dictionary[locale] = {
  34533. messages: {},
  34534. attributes: {}
  34535. };
  34536. }
  34537. this.dictionary[locale].messages[key] = message;
  34538. };
  34539. Dictionary.prototype.setAttribute = function setAttribute (locale, key, attribute) {
  34540. if (! this.hasLocale(locale)) {
  34541. this.dictionary[locale] = {
  34542. messages: {},
  34543. attributes: {}
  34544. };
  34545. }
  34546. this.dictionary[locale].attributes[key] = attribute;
  34547. };
  34548. Dictionary.prototype._merge = function _merge (target, source) {
  34549. var this$1 = this;
  34550. if (! (isObject(target) && isObject(source))) {
  34551. return target;
  34552. }
  34553. Object.keys(source).forEach(function (key) {
  34554. if (isObject(source[key])) {
  34555. if (! target[key]) {
  34556. assign(target, ( obj = {}, obj[key] = {}, obj ));
  34557. var obj;
  34558. }
  34559. this$1._merge(target[key], source[key]);
  34560. return;
  34561. }
  34562. assign(target, ( obj$1 = {}, obj$1[key] = source[key], obj$1 ));
  34563. var obj$1;
  34564. });
  34565. return target;
  34566. };
  34567. /* istanbul ignore next */
  34568. /* eslint-disable max-len */
  34569. var messages = {
  34570. _default: function (field) { return ("The " + field + " value is not valid."); },
  34571. alpha_dash: function (field) { return ("The " + field + " field may contain alpha-numeric characters as well as dashes and underscores."); },
  34572. alpha_num: function (field) { return ("The " + field + " field may only contain alpha-numeric characters."); },
  34573. alpha_spaces: function (field) { return ("The " + field + " field may only contain alphabetic characters as well as spaces."); },
  34574. alpha: function (field) { return ("The " + field + " field may only contain alphabetic characters."); },
  34575. between: function (field, ref) {
  34576. var min = ref[0];
  34577. var max = ref[1];
  34578. return ("The " + field + " field must be between " + min + " and " + max + ".");
  34579. },
  34580. confirmed: function (field) { return ("The " + field + " confirmation does not match."); },
  34581. credit_card: function (field) { return ("The " + field + " field is invalid."); },
  34582. decimal: function (field, ref) {
  34583. if ( ref === void 0 ) ref = ['*'];
  34584. var decimals = ref[0];
  34585. return ("The " + field + " field must be numeric and may contain " + (decimals === '*' ? '' : decimals) + " decimal points.");
  34586. },
  34587. digits: function (field, ref) {
  34588. var length = ref[0];
  34589. return ("The " + field + " field must be numeric and exactly contain " + length + " digits.");
  34590. },
  34591. dimensions: function (field, ref) {
  34592. var width = ref[0];
  34593. var height = ref[1];
  34594. return ("The " + field + " field must be " + width + " pixels by " + height + " pixels.");
  34595. },
  34596. email: function (field) { return ("The " + field + " field must be a valid email."); },
  34597. ext: function (field) { return ("The " + field + " field must be a valid file."); },
  34598. image: function (field) { return ("The " + field + " field must be an image."); },
  34599. in: function (field) { return ("The " + field + " field must be a valid value."); },
  34600. ip: function (field) { return ("The " + field + " field must be a valid ip address."); },
  34601. max: function (field, ref) {
  34602. var length = ref[0];
  34603. return ("The " + field + " field may not be greater than " + length + " characters.");
  34604. },
  34605. max_value: function (field, ref) {
  34606. var max = ref[0];
  34607. return ("The " + field + " field must be " + max + " or less.");
  34608. },
  34609. mimes: function (field) { return ("The " + field + " field must have a valid file type."); },
  34610. min: function (field, ref) {
  34611. var length = ref[0];
  34612. return ("The " + field + " field must be at least " + length + " characters.");
  34613. },
  34614. min_value: function (field, ref) {
  34615. var min = ref[0];
  34616. return ("The " + field + " field must be " + min + " or more.");
  34617. },
  34618. not_in: function (field) { return ("The " + field + " field must be a valid value."); },
  34619. numeric: function (field) { return ("The " + field + " field may only contain numeric characters."); },
  34620. regex: function (field) { return ("The " + field + " field format is invalid."); },
  34621. required: function (field) { return ("The " + field + " field is required."); },
  34622. size: function (field, ref) {
  34623. var size = ref[0];
  34624. return ("The " + field + " field must be less than " + size + " KB.");
  34625. },
  34626. url: function (field) { return ("The " + field + " field is not a valid URL."); }
  34627. };
  34628. var after = function (moment) { return function (value, ref) {
  34629. var targetField = ref[0];
  34630. var format = ref[1];
  34631. var dateValue = moment(value, format, true);
  34632. var field = document.querySelector(("input[name='" + targetField + "']"));
  34633. if (! (dateValue.isValid() && field)) {
  34634. return false;
  34635. }
  34636. var other = moment(field.value, format, true);
  34637. if (! other.isValid()) {
  34638. return false;
  34639. }
  34640. return dateValue.isAfter(other);
  34641. }; };
  34642. var before = function (moment) { return function (value, ref) {
  34643. var targetField = ref[0];
  34644. var format = ref[1];
  34645. var dateValue = moment(value, format, true);
  34646. var field = document.querySelector(("input[name='" + targetField + "']"));
  34647. if (! dateValue.isValid() || ! field) {
  34648. return false;
  34649. }
  34650. var other = moment(field.value, format, true);
  34651. if (! other.isValid()) {
  34652. return false;
  34653. }
  34654. return dateValue.isBefore(other);
  34655. }; };
  34656. var date_format = function (moment) { return function (value, ref) {
  34657. var format = ref[0];
  34658. return moment(value, format, true).isValid();
  34659. } };
  34660. var date_between = function (moment) { return function (value, ref) {
  34661. var min = ref[0];
  34662. var max = ref[1];
  34663. var format = ref[2];
  34664. var minDate = moment(min, format, true);
  34665. var maxDate = moment(max, format, true);
  34666. var dateVal = moment(value, format, true);
  34667. if (! (minDate.isValid() && maxDate.isValid() && dateVal.isValid())) {
  34668. return false;
  34669. }
  34670. return dateVal.isBetween(minDate, maxDate);
  34671. }; };
  34672. /* istanbul ignore next */
  34673. /* eslint-disable max-len */
  34674. var messages$1 = {
  34675. after: function (field, ref) {
  34676. var target = ref[0];
  34677. return ("The " + field + " must be after " + target + ".");
  34678. },
  34679. before: function (field, ref) {
  34680. var target = ref[0];
  34681. return ("The " + field + " must be before " + target + ".");
  34682. },
  34683. date_between: function (field, ref) {
  34684. var min = ref[0];
  34685. var max = ref[1];
  34686. return ("The " + field + " must be between " + min + " and " + max + ".");
  34687. },
  34688. date_format: function (field, ref) {
  34689. var format = ref[0];
  34690. return ("The " + field + " must be in the format " + format + ".");
  34691. }
  34692. };
  34693. var date = {
  34694. make: function (moment) { return ({
  34695. date_format: date_format(moment),
  34696. after: after(moment),
  34697. before: before(moment),
  34698. date_between: date_between(moment)
  34699. }); },
  34700. messages: messages$1,
  34701. installed: false
  34702. };
  34703. var FieldBag = function FieldBag() {
  34704. this.fields = {};
  34705. };
  34706. /**
  34707. * Initializes and adds a new field to the bag.
  34708. */
  34709. FieldBag.prototype._add = function _add (name) {
  34710. this.fields[name] = {};
  34711. this._setFlags(name, { dirty: false, valid: false, }, true);
  34712. };
  34713. /**
  34714. * Adds a field if it does not exist.
  34715. */
  34716. FieldBag.prototype._addIfNotExists = function _addIfNotExists (name) {
  34717. if (this.fields[name]) {
  34718. return;
  34719. }
  34720. this._add(name);
  34721. };
  34722. /**
  34723. * Remooves a field from the bag.
  34724. */
  34725. FieldBag.prototype._remove = function _remove (name) {
  34726. delete this.fields[name];
  34727. };
  34728. /**
  34729. * Resets the flags state for a specified field or all fields.
  34730. */
  34731. FieldBag.prototype.reset = function reset (name) {
  34732. var this$1 = this;
  34733. if (! name) {
  34734. Object.keys(this.fields).forEach(function (field) {
  34735. this$1._setFlags(field, { dirty: false, valid: false, }, true);
  34736. });
  34737. return;
  34738. }
  34739. this._setFlags(name, { dirty: false, valid: false, }, true);
  34740. };
  34741. /**
  34742. * Sets the flags for a specified field.
  34743. */
  34744. FieldBag.prototype._setFlags = function _setFlags (name, flags, initial) {
  34745. var this$1 = this;
  34746. if ( initial === void 0 ) initial = false;
  34747. return Object.keys(flags).every(
  34748. function (flag) { return this$1._setFlag(name, flag, flags[flag], initial); }
  34749. );
  34750. };
  34751. /**
  34752. * Sets a flag for a specified field.
  34753. */
  34754. FieldBag.prototype._setFlag = function _setFlag (name, flag, value, initial) {
  34755. if ( initial === void 0 ) initial = false;
  34756. var method = "set" + (flag.charAt(0).toUpperCase()) + (flag.slice(1));
  34757. if (typeof this[method] !== 'function') {
  34758. return false;
  34759. }
  34760. this[method](name, value, initial);
  34761. return true;
  34762. };
  34763. /**
  34764. * Sets the dirty flag along with dependant flags.
  34765. */
  34766. FieldBag.prototype.setDirty = function setDirty (name, value, initial) {
  34767. if ( initial === void 0 ) initial = false;
  34768. this.fields[name].dirty = value;
  34769. this.fields[name].clean = initial || ! value;
  34770. this.fields[name].passed = this.fields[name].valid && value;
  34771. this.fields[name].failed = ! this.fields[name].valid && value;
  34772. };
  34773. /**
  34774. * Sets the valid flag along with dependant flags.
  34775. */
  34776. FieldBag.prototype.setValid = function setValid (name, value) {
  34777. this.fields[name].valid = value;
  34778. this.fields[name].passed = this.fields[name].dirty && value;
  34779. this.fields[name].failed = this.fields[name].dirty && ! value;
  34780. };
  34781. /**
  34782. * Gets a field flag value.
  34783. */
  34784. FieldBag.prototype._getFieldFlag = function _getFieldFlag (name, flag) {
  34785. if (this.fields[name]) {
  34786. return this.fields[name][flag];
  34787. }
  34788. return false;
  34789. };
  34790. FieldBag.prototype.dirty = function dirty (name) {
  34791. var this$1 = this;
  34792. if (! name) {
  34793. return Object.keys(this.fields).some(function (field) { return this$1.fields[field].dirty; });
  34794. }
  34795. return this._getFieldFlag(name, 'dirty');
  34796. };
  34797. FieldBag.prototype.valid = function valid (name) {
  34798. var this$1 = this;
  34799. if (! name) {
  34800. return Object.keys(this.fields).every(function (field) { return this$1.fields[field].valid; });
  34801. }
  34802. return this._getFieldFlag(name, 'valid');
  34803. };
  34804. FieldBag.prototype.passed = function passed (name) {
  34805. var this$1 = this;
  34806. if (! name) {
  34807. return Object.keys(this.fields).every(function (field) { return this$1.fields[field].passed; });
  34808. }
  34809. return this._getFieldFlag(name, 'passed');
  34810. };
  34811. FieldBag.prototype.failed = function failed (name) {
  34812. var this$1 = this;
  34813. if (! name) {
  34814. return Object.keys(this.fields).some(function (field) { return this$1.fields[field].failed; });
  34815. }
  34816. return this._getFieldFlag(name, 'failed');
  34817. };
  34818. FieldBag.prototype.clean = function clean (name) {
  34819. if (! name) {
  34820. return ! this.dirty();
  34821. }
  34822. return this._getFieldFlag(name, 'clean');
  34823. };
  34824. var LOCALE = 'en';
  34825. var STRICT_MODE = true;
  34826. var DICTIONARY = new Dictionary({
  34827. en: {
  34828. messages: messages,
  34829. attributes: {}
  34830. }
  34831. });
  34832. var Validator = function Validator(validations, options) {
  34833. if ( options === void 0 ) options = { init: true };
  34834. this.strictMode = STRICT_MODE;
  34835. this.$scopes = { __global__: {} };
  34836. this.fieldBag = new FieldBag();
  34837. this._createFields(validations);
  34838. this.errorBag = new ErrorBag();
  34839. // Some fields will be later evaluated, because the vm isn't mounted yet
  34840. // so it may register it under an inaccurate scope.
  34841. this.$deferred = [];
  34842. this.$ready = false;
  34843. // if momentjs is present, install the validators.
  34844. if (typeof moment === 'function') {
  34845. // eslint-disable-next-line
  34846. this.installDateTimeValidators(moment);
  34847. }
  34848. if (options.init) {
  34849. this.init();
  34850. }
  34851. };
  34852. var prototypeAccessors = { dictionary: {} };
  34853. /**
  34854. * @return Dictionary
  34855. */
  34856. prototypeAccessors.dictionary.get = function () {
  34857. return DICTIONARY;
  34858. };
  34859. /**
  34860. * Merges a validator object into the Rules and Messages.
  34861. *
  34862. * @param{string} name The name of the validator.
  34863. * @param{function|object} validator The validator object.
  34864. */
  34865. Validator._merge = function _merge (name, validator) {
  34866. if (isCallable(validator)) {
  34867. Rules[name] = validator;
  34868. return;
  34869. }
  34870. Rules[name] = validator.validate;
  34871. if (validator.getMessage && isCallable(validator.getMessage)) {
  34872. DICTIONARY.setMessage('en', name, validator.getMessage);
  34873. }
  34874. if (validator.messages) {
  34875. DICTIONARY.merge(
  34876. Object.keys(validator.messages).reduce(function (prev, curr) {
  34877. var dict = prev;
  34878. dict[curr] = {
  34879. messages: ( obj = {}, obj[name] = validator.messages[curr], obj )
  34880. };
  34881. var obj;
  34882. return dict;
  34883. }, {})
  34884. );
  34885. }
  34886. };
  34887. /**
  34888. * Guards from extnsion violations.
  34889. *
  34890. * @param{string} name name of the validation rule.
  34891. * @param{object} validator a validation rule object.
  34892. */
  34893. Validator._guardExtend = function _guardExtend (name, validator) {
  34894. if (Rules[name]) {
  34895. throw new ValidatorException(
  34896. ("Extension Error: There is an existing validator with the same name '" + name + "'.")
  34897. );
  34898. }
  34899. if (isCallable(validator)) {
  34900. return;
  34901. }
  34902. if (! isCallable(validator.validate)) {
  34903. throw new ValidatorException(
  34904. // eslint-disable-next-line
  34905. ("Extension Error: The validator '" + name + "' must be a function or have a 'validate' method.")
  34906. );
  34907. }
  34908. if (! isCallable(validator.getMessage) && ! isObject(validator.messages)) {
  34909. throw new ValidatorException(
  34910. // eslint-disable-next-line
  34911. ("Extension Error: The validator '" + name + "' must have a 'getMessage' method or have a 'messages' object.")
  34912. );
  34913. }
  34914. };
  34915. /**
  34916. * Static constructor.
  34917. *
  34918. * @param{object} validations The validations object.
  34919. * @return {Validator} validator A validator object.
  34920. */
  34921. Validator.create = function create (validations, $vm, options) {
  34922. return new Validator(validations, $vm, options);
  34923. };
  34924. /**
  34925. * Adds a custom validator to the list of validation rules.
  34926. *
  34927. * @param{string} name The name of the validator.
  34928. * @param{object|function} validator The validator object/function.
  34929. */
  34930. Validator.extend = function extend (name, validator) {
  34931. Validator._guardExtend(name, validator);
  34932. Validator._merge(name, validator);
  34933. };
  34934. /**
  34935. * Installs the datetime validators and the messages.
  34936. */
  34937. Validator.installDateTimeValidators = function installDateTimeValidators (moment) {
  34938. if (typeof moment !== 'function') {
  34939. warn('To use the date-time validators you must provide moment reference.');
  34940. return false;
  34941. }
  34942. if (date.installed) {
  34943. return true;
  34944. }
  34945. var validators = date.make(moment);
  34946. Object.keys(validators).forEach(function (name) {
  34947. Validator.extend(name, validators[name]);
  34948. });
  34949. Validator.updateDictionary({
  34950. en: {
  34951. messages: date.messages
  34952. }
  34953. });
  34954. date.installed = true;
  34955. return true;
  34956. };
  34957. /**
  34958. * Removes a rule from the list of validators.
  34959. * @param {String} name The name of the validator/rule.
  34960. */
  34961. Validator.remove = function remove (name) {
  34962. delete Rules[name];
  34963. };
  34964. /**
  34965. * Sets the default locale for all validators.
  34966. *
  34967. * @param {String} language The locale id.
  34968. */
  34969. Validator.setLocale = function setLocale (language) {
  34970. if ( language === void 0 ) language = 'en';
  34971. /* istanbul ignore if */
  34972. if (! DICTIONARY.hasLocale(language)) {
  34973. // eslint-disable-next-line
  34974. warn('You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated.');
  34975. }
  34976. LOCALE = language;
  34977. };
  34978. /**
  34979. * Sets the operating mode for all newly created validators.
  34980. * strictMode = true: Values without a rule are invalid and cause failure.
  34981. * strictMode = false: Values without a rule are valid and are skipped.
  34982. * @param {Boolean} strictMode.
  34983. */
  34984. Validator.setStrictMode = function setStrictMode (strictMode) {
  34985. if ( strictMode === void 0 ) strictMode = true;
  34986. STRICT_MODE = strictMode;
  34987. };
  34988. /**
  34989. * Updates the dicitionary, overwriting existing values and adding new ones.
  34990. *
  34991. * @param{object} data The dictionary object.
  34992. */
  34993. Validator.updateDictionary = function updateDictionary (data) {
  34994. DICTIONARY.merge(data);
  34995. };
  34996. Validator.addLocale = function addLocale (locale) {
  34997. if (! locale.name) {
  34998. warn('Your locale must have a name property');
  34999. return;
  35000. }
  35001. this.updateDictionary(( obj = {}, obj[locale.name] = locale, obj ));
  35002. var obj;
  35003. };
  35004. Validator.prototype.addLocale = function addLocale (locale) {
  35005. Validator.addLocale(locale);
  35006. };
  35007. /**
  35008. * Resolves the scope value. Only strings and functions are allowed.
  35009. * @param {Function|String} scope
  35010. * @returns {String}
  35011. */
  35012. Validator.prototype._resolveScope = function _resolveScope (scope) {
  35013. if (typeof scope === 'string') {
  35014. return scope;
  35015. }
  35016. // The resolved value should be string.
  35017. if (isCallable(scope)) {
  35018. var value = scope();
  35019. return typeof value === 'string' ? value : '__global__';
  35020. }
  35021. return '__global__';
  35022. };
  35023. /**
  35024. * Resolves the field values from the getter functions.
  35025. */
  35026. Validator.prototype._resolveValuesFromGetters = function _resolveValuesFromGetters (scope) {
  35027. var this$1 = this;
  35028. if ( scope === void 0 ) scope = '__global__';
  35029. if (! this.$scopes[scope]) {
  35030. return {};
  35031. }
  35032. var values = {};
  35033. Object.keys(this.$scopes[scope]).forEach(function (name) {
  35034. var field = this$1.$scopes[scope][name];
  35035. var getter = field.getter;
  35036. var context = field.context;
  35037. var fieldScope = this$1._resolveScope(field.scope);
  35038. if (getter && context && (scope === '__global__' || fieldScope === scope)) {
  35039. values[name] = {
  35040. value: getter(context()),
  35041. scope: fieldScope
  35042. };
  35043. }
  35044. });
  35045. return values;
  35046. };
  35047. /**
  35048. * Creates the fields to be validated.
  35049. *
  35050. * @param{object} validations
  35051. * @return {object} Normalized object.
  35052. */
  35053. Validator.prototype._createFields = function _createFields (validations) {
  35054. var this$1 = this;
  35055. if (! validations) {
  35056. return;
  35057. }
  35058. Object.keys(validations).forEach(function (field) {
  35059. this$1._createField(field, validations[field]);
  35060. });
  35061. };
  35062. /**
  35063. * Creates a field entry in the fields object.
  35064. * @param {String} name.
  35065. * @param {String|Array} checks.
  35066. */
  35067. Validator.prototype._createField = function _createField (name, checks, scope) {
  35068. if ( scope === void 0 ) scope = '__global__';
  35069. scope = this._resolveScope(scope);
  35070. if (! this.$scopes[scope]) {
  35071. this.$scopes[scope] = {};
  35072. }
  35073. if (! this.$scopes[scope][name]) {
  35074. this.$scopes[scope][name] = {};
  35075. }
  35076. var field = this.$scopes[scope][name];
  35077. this.fieldBag._addIfNotExists(name);
  35078. field.validations = this._normalizeRules(name, checks, scope);
  35079. field.required = this._isRequired(field);
  35080. };
  35081. /**
  35082. * Normalizes rules.
  35083. * @return {Object}
  35084. */
  35085. Validator.prototype._normalizeRules = function _normalizeRules (name, checks, scope) {
  35086. if (! checks) { return {}; }
  35087. if (typeof checks === 'string') {
  35088. return this._normalizeString(checks);
  35089. }
  35090. if (! isObject(checks)) {
  35091. warn(("Your checks for '" + scope + "." + name + "' must be either a string or an object."));
  35092. return {};
  35093. }
  35094. return this._normalizeObject(checks);
  35095. };
  35096. /**
  35097. * Checks if a field has a required rule.
  35098. */
  35099. Validator.prototype._isRequired = function _isRequired (field) {
  35100. return field.validations && field.validations.required;
  35101. };
  35102. /**
  35103. * Normalizes an object of rules.
  35104. */
  35105. Validator.prototype._normalizeObject = function _normalizeObject (rules) {
  35106. var this$1 = this;
  35107. var validations = {};
  35108. Object.keys(rules).forEach(function (rule) {
  35109. var params = [];
  35110. if (rules[rule] === true) {
  35111. params = [];
  35112. } else if (Array.isArray(rules[rule])) {
  35113. params = rules[rule];
  35114. } else {
  35115. params = [rules[rule]];
  35116. }
  35117. if (rules[rule] === false) {
  35118. delete validations[rule];
  35119. } else {
  35120. validations[rule] = params;
  35121. }
  35122. if (date.installed && this$1._isADateRule(rule)) {
  35123. validations[rule].push(this$1._getDateFormat(validations));
  35124. }
  35125. });
  35126. return validations;
  35127. };
  35128. /**
  35129. * Date rules need the existance of a format, so date_format must be supplied.
  35130. * @param {String} name The rule name.
  35131. * @param {Array} validations the field validations.
  35132. */
  35133. Validator.prototype._getDateFormat = function _getDateFormat (validations) {
  35134. if (validations.date_format && Array.isArray(validations.date_format)) {
  35135. return validations.date_format[0];
  35136. }
  35137. return null;
  35138. };
  35139. /**
  35140. * Checks if the passed rule is a date rule.
  35141. */
  35142. Validator.prototype._isADateRule = function _isADateRule (rule) {
  35143. return !! ~['after', 'before', 'date_between'].indexOf(rule);
  35144. };
  35145. /**
  35146. * Normalizes string rules.
  35147. * @param {String} rules The rules that will be normalized.
  35148. * @param {Object} field The field object that is being operated on.
  35149. */
  35150. Validator.prototype._normalizeString = function _normalizeString (rules) {
  35151. var this$1 = this;
  35152. var validations = {};
  35153. rules.split('|').forEach(function (rule) {
  35154. var parsedRule = this$1._parseRule(rule);
  35155. if (! parsedRule.name) {
  35156. return;
  35157. }
  35158. if (parsedRule.name === 'required') {
  35159. validations.required = true;
  35160. }
  35161. validations[parsedRule.name] = parsedRule.params;
  35162. if (date.installed && this$1._isADateRule(parsedRule.name)) {
  35163. validations[parsedRule.name].push(this$1._getDateFormat(validations));
  35164. }
  35165. });
  35166. return validations;
  35167. };
  35168. /**
  35169. * Normalizes a string rule.
  35170. *
  35171. * @param {string} rule The rule to be normalized.
  35172. * @return {object} rule The normalized rule.
  35173. */
  35174. Validator.prototype._parseRule = function _parseRule (rule) {
  35175. var params = [];
  35176. var name = rule.split(':')[0];
  35177. if (~rule.indexOf(':')) {
  35178. params = rule.split(':').slice(1).join(':').split(',');
  35179. }
  35180. return { name: name, params: params };
  35181. };
  35182. /**
  35183. * Formats an error message for field and a rule.
  35184. *
  35185. * @param{string} field The field name.
  35186. * @param{object} rule Normalized rule object.
  35187. * @param {object} data Additional Information about the validation result.
  35188. * @param {string} scope The field scope.
  35189. * @return {string} Formatted error message.
  35190. */
  35191. Validator.prototype._formatErrorMessage = function _formatErrorMessage (field, rule, data, scope) {
  35192. if ( data === void 0 ) data = {};
  35193. if ( scope === void 0 ) scope = '__global__';
  35194. var name = this._getFieldDisplayName(field, scope);
  35195. var params = this._getLocalizedParams(rule, scope);
  35196. // Defaults to english message.
  35197. if (! this.dictionary.hasLocale(LOCALE)) {
  35198. return this.dictionary.getMessage('en', rule.name)(name, params, data);
  35199. }
  35200. return this.dictionary.getMessage(LOCALE, rule.name)(name, params, data);
  35201. };
  35202. /**
  35203. * Translates the parameters passed to the rule (mainly for target fields).
  35204. */
  35205. Validator.prototype._getLocalizedParams = function _getLocalizedParams (rule, scope) {
  35206. if ( scope === void 0 ) scope = '__global__';
  35207. if (~ ['after', 'before', 'confirmed'].indexOf(rule.name) &&
  35208. rule.params && rule.params[0]) {
  35209. var param = this.$scopes[scope][rule.params[0]];
  35210. if (param && param.name) { return [param.name]; }
  35211. return [this.dictionary.getAttribute(LOCALE, rule.params[0], rule.params[0])];
  35212. }
  35213. return rule.params;
  35214. };
  35215. /**
  35216. * Resolves an appropiate display name, first checking 'data-as' or the registered 'prettyName'
  35217. * Then the dictionary, then fallsback to field name.
  35218. * @return {String} displayName The name to be used in the errors.
  35219. */
  35220. Validator.prototype._getFieldDisplayName = function _getFieldDisplayName (field, scope) {
  35221. if ( scope === void 0 ) scope = '__global__';
  35222. return this.$scopes[scope][field].name || this.dictionary.getAttribute(LOCALE, field, field);
  35223. };
  35224. /**
  35225. * Tests a single input value against a rule.
  35226. *
  35227. * @param{*} name The name of the field.
  35228. * @param{*} valuethe value of the field.
  35229. * @param{object} rule the rule object.
  35230. * @param {scope} scope The field scope.
  35231. * @return {boolean} Whether it passes the check.
  35232. */
  35233. Validator.prototype._test = function _test (name, value, rule, scope) {
  35234. var this$1 = this;
  35235. if ( scope === void 0 ) scope = '__global__';
  35236. var validator = Rules[rule.name];
  35237. if (! validator || typeof validator !== 'function') {
  35238. throw new ValidatorException(("No such validator '" + (rule.name) + "' exists."));
  35239. }
  35240. var result = validator(value, rule.params, name);
  35241. // If it is a promise.
  35242. if (isCallable(result.then)) {
  35243. return result.then(function (values) {
  35244. var allValid = true;
  35245. var data = {};
  35246. if (Array.isArray(values)) {
  35247. allValid = values.every(function (t) { return t.valid; });
  35248. } else { // Is a single object.
  35249. allValid = values.valid;
  35250. data = values.data;
  35251. }
  35252. if (! allValid) {
  35253. this$1.errorBag.add(
  35254. name,
  35255. this$1._formatErrorMessage(name, rule, data, scope),
  35256. rule.name,
  35257. scope
  35258. );
  35259. }
  35260. return allValid;
  35261. });
  35262. }
  35263. if (! isObject(result)) {
  35264. result = { valid: result, data: {} };
  35265. }
  35266. if (! result.valid) {
  35267. this.errorBag.add(
  35268. name,
  35269. this._formatErrorMessage(name, rule, result.data, scope),
  35270. rule.name,
  35271. scope
  35272. );
  35273. }
  35274. return result.valid;
  35275. };
  35276. /**
  35277. * Registers a field to be validated.
  35278. *
  35279. * @param{string} name The field name.
  35280. * @param{String|Array|Object} checks validations expression.
  35281. * @param {string} prettyName Custom name to be used as field name in error messages.
  35282. * @param {Function} getter A function used to retrive a fresh value for the field.
  35283. */
  35284. Validator.prototype.attach = function attach (name, checks, options) {
  35285. var this$1 = this;
  35286. if ( options === void 0 ) options = {};
  35287. var attach = function () {
  35288. options.scope = this$1._resolveScope(options.scope);
  35289. this$1.updateField(name, checks, options);
  35290. var field = this$1.$scopes[options.scope][name];
  35291. field.scope = options.scope;
  35292. field.name = options.prettyName;
  35293. field.getter = options.getter;
  35294. field.context = options.context;
  35295. field.listeners = options.listeners || { detach: function detach() {} };
  35296. field.el = field.listeners.el;
  35297. this$1._setAriaRequiredAttribute(field);
  35298. this$1._setAriaValidAttribute(field, true);
  35299. };
  35300. var scope = isCallable(options.scope) ? options.scope() : options.scope;
  35301. if (! scope && ! this.$ready) {
  35302. this.$deferred.push(attach);
  35303. return;
  35304. }
  35305. attach();
  35306. };
  35307. /**
  35308. * Initializes the non-scoped fields and any bootstrap logic.
  35309. */
  35310. Validator.prototype.init = function init () {
  35311. this.$ready = true;
  35312. this.$deferred.forEach(function (attach) {
  35313. attach();
  35314. });
  35315. this.$deferred = [];
  35316. return this;
  35317. };
  35318. /**
  35319. * Append another validation to an existing field.
  35320. *
  35321. * @param{string} name The field name.
  35322. * @param{string} checks validations expression.
  35323. */
  35324. Validator.prototype.append = function append (name, checks, options) {
  35325. if ( options === void 0 ) options = {};
  35326. options.scope = this._resolveScope(options.scope);
  35327. // No such field
  35328. if (! this.$scopes[options.scope] || ! this.$scopes[options.scope][name]) {
  35329. this.attach(name, checks, options);
  35330. }
  35331. var field = this.$scopes[options.scope][name];
  35332. var newChecks = this._normalizeRules(name, checks, options.scope);
  35333. Object.keys(newChecks).forEach(function (key) {
  35334. field.validations[key] = newChecks[key];
  35335. });
  35336. };
  35337. /**
  35338. * Updates the field rules with new ones.
  35339. */
  35340. Validator.prototype.updateField = function updateField (name, checks, options) {
  35341. if ( options === void 0 ) options = {};
  35342. var field = (this.$scopes[options.scope] && this.$scopes[options.scope][name]) || null;
  35343. var oldChecks = field ? JSON.stringify(field.validations) : '';
  35344. this._createField(name, checks, options.scope);
  35345. field = (this.$scopes[options.scope] && this.$scopes[options.scope][name]) || null;
  35346. var newChecks = field ? JSON.stringify(field.validations) : '';
  35347. // compare both newChecks and oldChecks to make sure we don't trigger uneccessary directive
  35348. // update by changing the errorBag (prevents infinite loops).
  35349. if (newChecks !== oldChecks) {
  35350. this.errorBag.remove(name, options.scope);
  35351. }
  35352. };
  35353. /**
  35354. * Removes a field from the validator.
  35355. *
  35356. * @param{String} name The name of the field.
  35357. * @param {String} scope The name of the field scope.
  35358. */
  35359. Validator.prototype.detach = function detach (name, scope) {
  35360. if ( scope === void 0 ) scope = '__global__';
  35361. // No such field.
  35362. if (! this.$scopes[scope] || ! this.$scopes[scope][name]) {
  35363. return;
  35364. }
  35365. this.$scopes[scope][name].listeners.detach();
  35366. this.errorBag.remove(name, scope);
  35367. this.fieldBag._remove(name);
  35368. delete this.$scopes[scope][name];
  35369. };
  35370. /**
  35371. * Adds a custom validator to the list of validation rules.
  35372. *
  35373. * @param{string} name The name of the validator.
  35374. * @param{object|function} validator The validator object/function.
  35375. */
  35376. Validator.prototype.extend = function extend (name, validator) {
  35377. Validator.extend(name, validator);
  35378. };
  35379. /**
  35380. * Gets the internal errorBag instance.
  35381. *
  35382. * @return {ErrorBag} errorBag The internal error bag object.
  35383. */
  35384. Validator.prototype.getErrors = function getErrors () {
  35385. return this.errorBag;
  35386. };
  35387. /**
  35388. * Gets the currently active locale.
  35389. *
  35390. * @return {String} Locale identifier.
  35391. */
  35392. Validator.prototype.getLocale = function getLocale () {
  35393. return LOCALE;
  35394. };
  35395. /**
  35396. * Just an alias to the static method for convienece.
  35397. */
  35398. Validator.prototype.installDateTimeValidators = function installDateTimeValidators (moment) {
  35399. Validator.installDateTimeValidators(moment);
  35400. };
  35401. /**
  35402. * Removes a rule from the list of validators.
  35403. * @param {String} name The name of the validator/rule.
  35404. */
  35405. Validator.prototype.remove = function remove (name) {
  35406. Validator.remove(name);
  35407. };
  35408. /**
  35409. * Sets the validator current langauge.
  35410. *
  35411. * @param {string} language locale or language id.
  35412. */
  35413. Validator.prototype.setLocale = function setLocale (language) {
  35414. /* istanbul ignore if */
  35415. if (! this.dictionary.hasLocale(language)) {
  35416. // eslint-disable-next-line
  35417. warn('You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated.');
  35418. }
  35419. LOCALE = language;
  35420. };
  35421. /**
  35422. * Sets the operating mode for this validator.
  35423. * strictMode = true: Values without a rule are invalid and cause failure.
  35424. * strictMode = false: Values without a rule are valid and are skipped.
  35425. * @param {Boolean} strictMode.
  35426. */
  35427. Validator.prototype.setStrictMode = function setStrictMode (strictMode) {
  35428. if ( strictMode === void 0 ) strictMode = true;
  35429. this.strictMode = strictMode;
  35430. };
  35431. /**
  35432. * Updates the messages dicitionary, overwriting existing values and adding new ones.
  35433. *
  35434. * @param{object} data The messages object.
  35435. */
  35436. Validator.prototype.updateDictionary = function updateDictionary (data) {
  35437. Validator.updateDictionary(data);
  35438. };
  35439. /**
  35440. * Adds a scope.
  35441. */
  35442. Validator.prototype.addScope = function addScope (scope) {
  35443. if (scope && ! this.$scopes[scope]) {
  35444. this.$scopes[scope] = {};
  35445. }
  35446. };
  35447. /**
  35448. * Validates a value against a registered field validations.
  35449. *
  35450. * @param{string} name the field name.
  35451. * @param{*} value The value to be validated.
  35452. * @param {String} scope The scope of the field.
  35453. * @return {Promise}
  35454. */
  35455. Validator.prototype.validate = function validate (name, value, scope) {
  35456. var this$1 = this;
  35457. if ( scope === void 0 ) scope = '__global__';
  35458. if (name && name.indexOf('.') > -1) {
  35459. // no such field, try the scope form.
  35460. if (! this.$scopes.__global__[name]) {
  35461. var assign$$1;
  35462. (assign$$1 = name.split('.'), scope = assign$$1[0], name = assign$$1[1]);
  35463. }
  35464. }
  35465. if (! scope) { scope = '__global__'; }
  35466. if (! this.$scopes[scope] || ! this.$scopes[scope][name]) {
  35467. if (! this.strictMode) { return Promise.resolve(true); }
  35468. var fullName = scope === '__global__' ? name : (scope + "." + name);
  35469. warn(("Validating a non-existant field: \"" + fullName + "\". Use \"attach()\" first."));
  35470. return Promise.reject(false);
  35471. }
  35472. var field = this.$scopes[scope][name];
  35473. this.errorBag.remove(name, scope);
  35474. // if its not required and is empty or null or undefined then it passes.
  35475. if (! field.required && ~[null, undefined, ''].indexOf(value)) {
  35476. this.fieldBag._setFlags(name, { valid: true, dirty: true });
  35477. return Promise.resolve(true);
  35478. }
  35479. var promises = [];
  35480. var test = Object.keys(field.validations).every(function (rule) {
  35481. var result = this$1._test(
  35482. name,
  35483. value,
  35484. { name: rule, params: field.validations[rule] },
  35485. scope
  35486. );
  35487. if (isCallable(result.then)) {
  35488. promises.push(result);
  35489. }
  35490. return result;
  35491. });
  35492. if (promises.length) {
  35493. return Promise.all(promises).then(function (values) {
  35494. var valid = values.every(function (t) { return t; }) && test;
  35495. this$1.fieldBag._setFlags(name, { valid: valid, dirty: true });
  35496. this$1._setAriaValidAttribute(field, test);
  35497. return valid;
  35498. });
  35499. }
  35500. this.fieldBag._setFlags(name, { valid: test, dirty: true });
  35501. this._setAriaValidAttribute(field, test);
  35502. return new Promise(function (resolve, reject) {
  35503. if (test) {
  35504. resolve(test);
  35505. return;
  35506. }
  35507. reject(false);
  35508. });
  35509. };
  35510. /**
  35511. * Sets the aria-invalid attribute on the element.
  35512. */
  35513. Validator.prototype._setAriaValidAttribute = function _setAriaValidAttribute (field, valid) {
  35514. if (! field.el) {
  35515. return;
  35516. }
  35517. field.el.setAttribute('aria-invalid', !valid);
  35518. };
  35519. /**
  35520. * Sets the aria-required attribute on the element.
  35521. */
  35522. Validator.prototype._setAriaRequiredAttribute = function _setAriaRequiredAttribute (field) {
  35523. if (! field.el) {
  35524. return;
  35525. }
  35526. field.el.setAttribute('aria-required', !! field.required);
  35527. };
  35528. /**
  35529. * Validates each value against the corresponding field validations.
  35530. * @param{object} values The values to be validated.
  35531. * @return {Promise} Returns a promise with the validation result.
  35532. */
  35533. Validator.prototype.validateAll = function validateAll (values) {
  35534. var this$1 = this;
  35535. var normalizedValues;
  35536. if (! values || typeof values === 'string') {
  35537. this.errorBag.clear(values);
  35538. normalizedValues = this._resolveValuesFromGetters(values);
  35539. } else {
  35540. normalizedValues = {};
  35541. Object.keys(values).forEach(function (key) {
  35542. normalizedValues[key] = {
  35543. value: values[key]
  35544. };
  35545. });
  35546. }
  35547. var promises = Object.keys(normalizedValues).map(function (property) { return this$1.validate(
  35548. property,
  35549. normalizedValues[property].value,
  35550. normalizedValues[property].scope
  35551. ); });
  35552. return Promise.all(promises).then(function () { return true; }).catch(function () {
  35553. throw new ValidatorException('Validation Failed');
  35554. });
  35555. };
  35556. /**
  35557. * Validates all scopes.
  35558. * @returns {Promise} All promises resulted from each scope.
  35559. */
  35560. Validator.prototype.validateScopes = function validateScopes () {
  35561. var this$1 = this;
  35562. return Promise.all(
  35563. Object.keys(this.$scopes).map(function (scope) { return this$1.validateAll(scope); })
  35564. );
  35565. };
  35566. Object.defineProperties( Validator.prototype, prototypeAccessors );
  35567. var makeMixin = function (Vue, options) { return ({
  35568. computed: ( obj = {}, obj[options.errorBagName] = {
  35569. get: function get() {
  35570. return this.$validator.errorBag;
  35571. }
  35572. }, obj[options.fieldsBagName] = {
  35573. get: function get() {
  35574. return this.$validator.fieldBag;
  35575. }
  35576. }, obj ),
  35577. beforeCreate: function beforeCreate() {
  35578. this.$validator = new Validator(null, { init: false });
  35579. Vue.util.defineReactive(this.$validator, 'errorBag', this.$validator.errorBag);
  35580. Vue.util.defineReactive(this.$validator, 'fieldBag', this.$validator.fieldBag);
  35581. },
  35582. mounted: function mounted() {
  35583. this.$validator.init();
  35584. }
  35585. })
  35586. var obj; };
  35587. var ListenerGenerator = function ListenerGenerator(el, binding, vnode, options) {
  35588. this.unwatch = undefined;
  35589. this.callbacks = [];
  35590. this.el = el;
  35591. this.scope = isObject(binding.value) ? binding.value.scope : getScope(el);
  35592. this.binding = binding;
  35593. this.vm = vnode.context;
  35594. this.component = vnode.child;
  35595. this.options = options;
  35596. this.fieldName = this._resolveFieldName();
  35597. this.model = this._resolveModel(vnode.data.directives);
  35598. };
  35599. /**
  35600. * Checks if the node directives contains a v-model.
  35601. */
  35602. ListenerGenerator.prototype._resolveModel = function _resolveModel (directives) {
  35603. var expRegex = /^[a-z_]+[0-9]*(\w*\.[a-z_]\w*)*$/i;
  35604. var model = find(directives, function (d) { return d.name === 'model' && expRegex.test(d.expression); });
  35605. return model && this._isExistingPath(model.expression) && model.expression;
  35606. };
  35607. /**
  35608. * Checks if the object path exists.
  35609. */
  35610. ListenerGenerator.prototype._isExistingPath = function _isExistingPath (path) {
  35611. var obj = this.vm;
  35612. return path.split('.').every(function (prop) {
  35613. if (! Object.prototype.hasOwnProperty.call(obj, prop)) {
  35614. return false;
  35615. }
  35616. obj = obj[prop];
  35617. return true;
  35618. });
  35619. };
  35620. /**
  35621. * Resolves the field name to trigger validations.
  35622. * @return {String} The field name.
  35623. */
  35624. ListenerGenerator.prototype._resolveFieldName = function _resolveFieldName () {
  35625. if (this.component) {
  35626. return getDataAttribute(this.el, 'name') || this.component.name;
  35627. }
  35628. return getDataAttribute(this.el, 'name') || this.el.name;
  35629. };
  35630. /**
  35631. * Determines if the validation rule requires additional listeners on target fields.
  35632. */
  35633. ListenerGenerator.prototype._hasFieldDependency = function _hasFieldDependency (rules) {
  35634. var this$1 = this;
  35635. var fieldName = false;
  35636. if (! rules) {
  35637. return false;
  35638. }
  35639. if (isObject(rules)) {
  35640. Object.keys(rules).forEach(function (r) { // eslint-disable-line
  35641. if (/confirmed|after|before/.test(r)) {
  35642. fieldName = rules[r];
  35643. return false;
  35644. }
  35645. });
  35646. return fieldName;
  35647. }
  35648. rules.split('|').every(function (r) {
  35649. if (/\b(confirmed|after|before):/.test(r)) {
  35650. fieldName = r.split(':')[1];
  35651. return false;
  35652. }
  35653. if (/\b(confirmed)/.test(r)) {
  35654. fieldName = (this$1.fieldName) + "_confirmation";
  35655. return false;
  35656. }
  35657. return true;
  35658. });
  35659. return fieldName;
  35660. };
  35661. /**
  35662. * Validates input value, triggered by 'input' event.
  35663. */
  35664. ListenerGenerator.prototype._inputListener = function _inputListener () {
  35665. this._validate(this.el.value);
  35666. };
  35667. /**
  35668. * Validates files, triggered by 'change' event.
  35669. */
  35670. ListenerGenerator.prototype._fileListener = function _fileListener () {
  35671. var isValid = this._validate(toArray(this.el.files));
  35672. if (! isValid && this.binding.modifiers.reject) {
  35673. this.el.value = '';
  35674. }
  35675. };
  35676. /**
  35677. * Validates radio buttons, triggered by 'change' event.
  35678. */
  35679. ListenerGenerator.prototype._radioListener = function _radioListener () {
  35680. var checked = document.querySelector(("input[name=\"" + (this.el.name) + "\"]:checked"));
  35681. this._validate(checked ? checked.value : null);
  35682. };
  35683. /**
  35684. * Validates checkboxes, triggered by change event.
  35685. */
  35686. ListenerGenerator.prototype._checkboxListener = function _checkboxListener () {
  35687. var this$1 = this;
  35688. var checkedBoxes = document.querySelectorAll(("input[name=\"" + (this.el.name) + "\"]:checked"));
  35689. if (! checkedBoxes || ! checkedBoxes.length) {
  35690. this._validate(null);
  35691. return;
  35692. }
  35693. toArray(checkedBoxes).forEach(function (box) {
  35694. this$1._validate(box.value);
  35695. });
  35696. };
  35697. /**
  35698. * Trigger the validation for a specific value.
  35699. */
  35700. ListenerGenerator.prototype._validate = function _validate (value) {
  35701. return this.vm.$validator.validate(
  35702. this.fieldName, value, this.scope || getScope(this.el)
  35703. ).catch(function (result) {
  35704. return result;
  35705. });
  35706. };
  35707. /**
  35708. * Returns a scoped callback, only runs if the el scope is the same as the recieved scope
  35709. * From the event.
  35710. */
  35711. ListenerGenerator.prototype._getScopedListener = function _getScopedListener (callback) {
  35712. var this$1 = this;
  35713. return function (scope) {
  35714. if (! scope || scope === this$1.scope || scope instanceof window.Event) {
  35715. callback();
  35716. }
  35717. };
  35718. };
  35719. /**
  35720. * Attaches validator event-triggered validation.
  35721. */
  35722. ListenerGenerator.prototype._attachValidatorEvent = function _attachValidatorEvent () {
  35723. var this$1 = this;
  35724. var listener = this._getScopedListener(this._getSuitableListener().listener.bind(this));
  35725. var fieldName = this._hasFieldDependency(
  35726. getRules(this.binding.expression, this.binding.value, this.el)
  35727. );
  35728. if (fieldName) {
  35729. // Wait for the validator ready triggered when vm is mounted because maybe
  35730. // the element isn't mounted yet.
  35731. this.vm.$nextTick(function () {
  35732. var target = document.querySelector(("input[name='" + fieldName + "']"));
  35733. if (! target) {
  35734. warn('Cannot find target field, no additional listeners were attached.');
  35735. return;
  35736. }
  35737. target.addEventListener('input', listener);
  35738. this$1.callbacks.push({ name: 'input', listener: listener, el: target });
  35739. });
  35740. }
  35741. };
  35742. /**
  35743. * Determines a suitable listener for the element.
  35744. */
  35745. ListenerGenerator.prototype._getSuitableListener = function _getSuitableListener () {
  35746. var listener;
  35747. if (this.el.tagName === 'SELECT') {
  35748. return {
  35749. names: ['change', 'blur'],
  35750. listener: this._inputListener
  35751. };
  35752. }
  35753. // determine the suitable listener and events to handle
  35754. switch (this.el.type) {
  35755. case 'file':
  35756. listener = {
  35757. names: ['change'],
  35758. listener: this._fileListener
  35759. };
  35760. break;
  35761. case 'radio':
  35762. listener = {
  35763. names: ['change'],
  35764. listener: this._radioListener
  35765. };
  35766. break;
  35767. case 'checkbox':
  35768. listener = {
  35769. names: ['change'],
  35770. listener: this._checkboxListener
  35771. };
  35772. break;
  35773. default:
  35774. listener = {
  35775. names: ['input', 'blur'],
  35776. listener: this._inputListener
  35777. };
  35778. break;
  35779. }
  35780. // users are able to specify which events they want to validate on
  35781. // pipe separated list of handler names to use
  35782. var events = getDataAttribute(this.el, 'validate-on');
  35783. if (events) {
  35784. listener.names = events.split('|');
  35785. }
  35786. return listener;
  35787. };
  35788. /**
  35789. * Attaches neccessary validation events for the component.
  35790. */
  35791. ListenerGenerator.prototype._attachComponentListeners = function _attachComponentListeners () {
  35792. var this$1 = this;
  35793. this.componentListener = debounce(function (value) {
  35794. this$1._validate(value);
  35795. }, getDataAttribute(this.el, 'delay') || this.options.delay);
  35796. this.component.$on('input', this.componentListener);
  35797. };
  35798. /**
  35799. * Attachs a suitable listener for the input.
  35800. */
  35801. ListenerGenerator.prototype._attachFieldListeners = function _attachFieldListeners () {
  35802. var this$1 = this;
  35803. // If it is a component, use vue events instead.
  35804. if (this.component) {
  35805. this._attachComponentListeners();
  35806. return;
  35807. }
  35808. var handler = this._getSuitableListener();
  35809. var listener = debounce(
  35810. handler.listener.bind(this),
  35811. getDataAttribute(this.el, 'delay') || this.options.delay
  35812. );
  35813. if (~['radio', 'checkbox'].indexOf(this.el.type)) {
  35814. this.vm.$nextTick(function () {
  35815. var elms = document.querySelectorAll(("input[name=\"" + (this$1.el.name) + "\"]"));
  35816. toArray(elms).forEach(function (input) {
  35817. handler.names.forEach(function (handlerName) {
  35818. input.addEventListener(handlerName, listener);
  35819. this$1.callbacks.push({ name: handlerName, listener: listener, el: input });
  35820. });
  35821. });
  35822. });
  35823. return;
  35824. }
  35825. handler.names.forEach(function (handlerName) {
  35826. this$1.el.addEventListener(handlerName, listener);
  35827. this$1.callbacks.push({ name: handlerName, listener: listener, el: this$1.el });
  35828. });
  35829. };
  35830. /**
  35831. * Returns a context, getter factory pairs for each input type.
  35832. */
  35833. ListenerGenerator.prototype._resolveValueGetter = function _resolveValueGetter () {
  35834. var this$1 = this;
  35835. if (this.component) {
  35836. return {
  35837. context: function () { return this$1.component; },
  35838. getter: function getter(context) {
  35839. return context[getDataAttribute(context.$el, 'value-path')] || context.value;
  35840. }
  35841. };
  35842. }
  35843. switch (this.el.type) {
  35844. case 'checkbox': return {
  35845. context: function () { return document.querySelectorAll(("input[name=\"" + (this$1.el.name) + "\"]:checked")); },
  35846. getter: function getter(context) {
  35847. if (! context || ! context.length) {
  35848. return null;
  35849. }
  35850. return toArray(context).map(function (checkbox) { return checkbox.value; });
  35851. }
  35852. };
  35853. case 'radio': return {
  35854. context: function () { return document.querySelector(("input[name=\"" + (this$1.el.name) + "\"]:checked")); },
  35855. getter: function getter(context) {
  35856. return context && context.value;
  35857. }
  35858. };
  35859. case 'file': return {
  35860. context: function () { return this$1.el; },
  35861. getter: function getter(context) {
  35862. return toArray(context.files);
  35863. }
  35864. };
  35865. default: return {
  35866. context: function () { return this$1.el; },
  35867. getter: function getter(context) {
  35868. return context.value;
  35869. }
  35870. };
  35871. }
  35872. };
  35873. /*
  35874. * Gets the arg string value, either from the directive or the expression value.
  35875. */
  35876. ListenerGenerator.prototype._getArg = function _getArg () {
  35877. // Get it from the directive arg.
  35878. if (this.binding.arg) {
  35879. return this.binding.arg;
  35880. }
  35881. // Get it from v-model.
  35882. if (this.model) {
  35883. return this.model;
  35884. }
  35885. return isObject(this.binding.value) ? this.binding.value.arg : null;
  35886. };
  35887. /**
  35888. * Attaches model watchers and extra listeners.
  35889. */
  35890. ListenerGenerator.prototype._attachModelWatcher = function _attachModelWatcher (arg) {
  35891. var this$1 = this;
  35892. var events = getDataAttribute(this.el, 'validate-on') || 'input|blur';
  35893. var listener = debounce(
  35894. this._getSuitableListener().listener.bind(this),
  35895. getDataAttribute(this.el, 'delay') || this.options.delay
  35896. );
  35897. events.split('|').forEach(function (name) {
  35898. if (~['input', 'change'].indexOf(name)) {
  35899. var debounced = debounce(function (value) {
  35900. this$1.vm.$validator.validate(
  35901. this$1.fieldName, value, this$1.scope || getScope(this$1.el)
  35902. ).catch(function (result) {
  35903. return result
  35904. });
  35905. }, getDataAttribute(this$1.el, 'delay') || this$1.options.delay);
  35906. this$1.unwatch = this$1.vm.$watch(arg, debounced, { deep: true });
  35907. // No need to attach it on element as it will use the vue watcher.
  35908. return;
  35909. }
  35910. this$1.el.addEventListener(name, listener);
  35911. this$1.callbacks.push({ name: name, listener: listener, el: this$1.el });
  35912. });
  35913. };
  35914. /**
  35915. * Attaches the Event Listeners.
  35916. */
  35917. ListenerGenerator.prototype.attach = function attach () {
  35918. var this$1 = this;
  35919. var ref = this._resolveValueGetter();
  35920. var context = ref.context;
  35921. var getter = ref.getter;
  35922. this.vm.$validator.attach(
  35923. this.fieldName,
  35924. getRules(this.binding.expression, this.binding.value, this.el), {
  35925. // eslint-disable-next-line
  35926. scope: function () {
  35927. return this$1.scope || getScope(this$1.el);
  35928. },
  35929. prettyName: getDataAttribute(this.el, 'as') || this.el.title,
  35930. context: context,
  35931. getter: getter,
  35932. listeners: this
  35933. }
  35934. );
  35935. this._attachValidatorEvent();
  35936. var arg = this._getArg();
  35937. if (arg) {
  35938. this._attachModelWatcher(arg);
  35939. return;
  35940. }
  35941. this._attachFieldListeners();
  35942. };
  35943. /**
  35944. * Removes all attached event listeners.
  35945. */
  35946. ListenerGenerator.prototype.detach = function detach () {
  35947. if (this.component) {
  35948. this.component.$off('input', this.componentListener);
  35949. }
  35950. if (this.unwatch) {
  35951. this.unwatch();
  35952. }
  35953. this.callbacks.forEach(function (h) {
  35954. h.el.removeEventListener(h.name, h.listener);
  35955. });
  35956. this.callbacks = [];
  35957. };
  35958. var listenersInstances = [];
  35959. function addClasses(el, flags, classNames) {
  35960. if (! flags) { return; }
  35961. if (flags.dirty) {
  35962. addClass(el, classNames.touched);
  35963. removeClass(el, classNames.untouched);
  35964. } else {
  35965. addClass(el, classNames.untouched);
  35966. removeClass(el, classNames.touched);
  35967. }
  35968. if (flags.valid || flags.passed) {
  35969. addClass(el, classNames.valid);
  35970. removeClass(el, classNames.invalid);
  35971. } else {
  35972. addClass(el, classNames.invalid);
  35973. removeClass(el, classNames.valid);
  35974. }
  35975. }
  35976. function setDirty(el, classNames) {
  35977. addClass(el, classNames.dirty);
  35978. removeClass(el, classNames.pristine);
  35979. }
  35980. function setPristine(el, classNames) {
  35981. addClass(el, classNames.pristine);
  35982. removeClass(el, classNames.dirty);
  35983. }
  35984. var makeDirective = function (options) { return ({
  35985. inserted: function inserted(el, binding, vnode) {
  35986. var listener = new ListenerGenerator(el, binding, vnode, options);
  35987. listener.attach();
  35988. listenersInstances.push({ vm: vnode.context, el: el, instance: listener });
  35989. if (options.enableAutoClasses) {
  35990. setPristine(el, options.classNames);
  35991. el.onfocus = function () { setDirty(el, options.classNames); };
  35992. addClasses(
  35993. el,
  35994. vnode.context.$validator.fieldBag.fields[listener.fieldName],
  35995. options.classNames
  35996. );
  35997. }
  35998. },
  35999. update: function update(el, ref, ref$1) {
  36000. var expression = ref.expression;
  36001. var value = ref.value;
  36002. var oldValue = ref.oldValue;
  36003. var context = ref$1.context;
  36004. var ref$2 = find(listenersInstances, function (l) { return l.vm === context && l.el === el; });
  36005. var instance = ref$2.instance;
  36006. if (options.enableAutoClasses) {
  36007. addClasses(el, context.$validator.fieldBag.fields[instance.fieldName], options.classNames);
  36008. }
  36009. // make sure we don't do uneccessary work if no expression was passed
  36010. // nor if the expression did not change.
  36011. if (! expression || (instance.cachedExp === JSON.stringify(value))) { return; }
  36012. instance.cachedExp = JSON.stringify(value);
  36013. var scope = isObject(value) ? (value.scope || getScope(el)) : getScope(el);
  36014. context.$validator.updateField(
  36015. instance.fieldName,
  36016. getRules(expression, value, el),
  36017. { scope: scope || '__global__' }
  36018. );
  36019. },
  36020. unbind: function unbind(el, ref, ref$1) {
  36021. var value = ref.value;
  36022. var context = ref$1.context;
  36023. var holder = find(listenersInstances, function (l) { return l.vm === context && l.el === el; });
  36024. if (typeof holder === 'undefined') {
  36025. return;
  36026. }
  36027. var scope = isObject(value) ? value.scope : (getScope(el) || '__global__');
  36028. context.$validator.detach(holder.instance.fieldName, scope);
  36029. listenersInstances.splice(listenersInstances.indexOf(holder), 1);
  36030. }
  36031. }); };
  36032. var DEFAULT_CLASS_NAMES = {
  36033. touched: 'touched', // the control has been blurred
  36034. untouched: 'untouched', // the control hasn't been blurred
  36035. valid: 'valid', // model is valid
  36036. invalid: 'invalid', // model is invalid
  36037. pristine: 'pristine', // control has not been interacted with
  36038. dirty: 'dirty' // control has been interacted with
  36039. };
  36040. // eslint-disable-next-line
  36041. var install = function (Vue, ref) {
  36042. if ( ref === void 0 ) ref = {};
  36043. var locale = ref.locale; if ( locale === void 0 ) locale = 'en';
  36044. var delay = ref.delay; if ( delay === void 0 ) delay = 0;
  36045. var errorBagName = ref.errorBagName; if ( errorBagName === void 0 ) errorBagName = 'errors';
  36046. var dictionary = ref.dictionary; if ( dictionary === void 0 ) dictionary = null;
  36047. var strict = ref.strict; if ( strict === void 0 ) strict = true;
  36048. var fieldsBagName = ref.fieldsBagName; if ( fieldsBagName === void 0 ) fieldsBagName = 'fields';
  36049. var enableAutoClasses = ref.enableAutoClasses; if ( enableAutoClasses === void 0 ) enableAutoClasses = false;
  36050. var classNames = ref.classNames; if ( classNames === void 0 ) classNames = {};
  36051. if (dictionary) {
  36052. Validator.updateDictionary(dictionary);
  36053. }
  36054. Validator.setLocale(locale);
  36055. Validator.setStrictMode(strict);
  36056. var options = {
  36057. locale: locale,
  36058. delay: delay,
  36059. dictionary: dictionary,
  36060. errorBagName: errorBagName,
  36061. fieldsBagName: fieldsBagName,
  36062. enableAutoClasses: enableAutoClasses,
  36063. classNames: assign({}, DEFAULT_CLASS_NAMES, classNames)
  36064. };
  36065. Vue.mixin(makeMixin(Vue, options));
  36066. Vue.directive('validate', makeDirective(options));
  36067. };
  36068. var index = {
  36069. install: install,
  36070. Validator: Validator,
  36071. ErrorBag: ErrorBag,
  36072. version: '2.0.0-beta.24'
  36073. };
  36074. return index;
  36075. })));
  36076. });
  36077. return ___scope___.entry = "dist/vee-validate.js";
  36078. });
  36079. FuseBox.pkg("axios", {"follow-redirects":"1.0.0"}, function(___scope___){
  36080. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  36081. module.exports = require('./lib/axios');
  36082. });
  36083. ___scope___.file("lib/axios.js", function(exports, require, module, __filename, __dirname){
  36084. 'use strict';
  36085. var utils = require('./utils');
  36086. var bind = require('./helpers/bind');
  36087. var Axios = require('./core/Axios');
  36088. var defaults = require('./defaults');
  36089. /**
  36090. * Create an instance of Axios
  36091. *
  36092. * @param {Object} defaultConfig The default config for the instance
  36093. * @return {Axios} A new instance of Axios
  36094. */
  36095. function createInstance(defaultConfig) {
  36096. var context = new Axios(defaultConfig);
  36097. var instance = bind(Axios.prototype.request, context);
  36098. // Copy axios.prototype to instance
  36099. utils.extend(instance, Axios.prototype, context);
  36100. // Copy context to instance
  36101. utils.extend(instance, context);
  36102. return instance;
  36103. }
  36104. // Create the default instance to be exported
  36105. var axios = createInstance(defaults);
  36106. // Expose Axios class to allow class inheritance
  36107. axios.Axios = Axios;
  36108. // Factory for creating new instances
  36109. axios.create = function create(instanceConfig) {
  36110. return createInstance(utils.merge(defaults, instanceConfig));
  36111. };
  36112. // Expose Cancel & CancelToken
  36113. axios.Cancel = require('./cancel/Cancel');
  36114. axios.CancelToken = require('./cancel/CancelToken');
  36115. axios.isCancel = require('./cancel/isCancel');
  36116. // Expose all/spread
  36117. axios.all = function all(promises) {
  36118. return Promise.all(promises);
  36119. };
  36120. axios.spread = require('./helpers/spread');
  36121. module.exports = axios;
  36122. // Allow use of default import syntax in TypeScript
  36123. module.exports.default = axios;
  36124. });
  36125. ___scope___.file("lib/utils.js", function(exports, require, module, __filename, __dirname){
  36126. 'use strict';
  36127. var bind = require('./helpers/bind');
  36128. /*global toString:true*/
  36129. // utils is a library of generic helper functions non-specific to axios
  36130. var toString = Object.prototype.toString;
  36131. /**
  36132. * Determine if a value is an Array
  36133. *
  36134. * @param {Object} val The value to test
  36135. * @returns {boolean} True if value is an Array, otherwise false
  36136. */
  36137. function isArray(val) {
  36138. return toString.call(val) === '[object Array]';
  36139. }
  36140. /**
  36141. * Determine if a value is an ArrayBuffer
  36142. *
  36143. * @param {Object} val The value to test
  36144. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  36145. */
  36146. function isArrayBuffer(val) {
  36147. return toString.call(val) === '[object ArrayBuffer]';
  36148. }
  36149. /**
  36150. * Determine if a value is a FormData
  36151. *
  36152. * @param {Object} val The value to test
  36153. * @returns {boolean} True if value is an FormData, otherwise false
  36154. */
  36155. function isFormData(val) {
  36156. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  36157. }
  36158. /**
  36159. * Determine if a value is a view on an ArrayBuffer
  36160. *
  36161. * @param {Object} val The value to test
  36162. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  36163. */
  36164. function isArrayBufferView(val) {
  36165. var result;
  36166. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  36167. result = ArrayBuffer.isView(val);
  36168. } else {
  36169. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  36170. }
  36171. return result;
  36172. }
  36173. /**
  36174. * Determine if a value is a String
  36175. *
  36176. * @param {Object} val The value to test
  36177. * @returns {boolean} True if value is a String, otherwise false
  36178. */
  36179. function isString(val) {
  36180. return typeof val === 'string';
  36181. }
  36182. /**
  36183. * Determine if a value is a Number
  36184. *
  36185. * @param {Object} val The value to test
  36186. * @returns {boolean} True if value is a Number, otherwise false
  36187. */
  36188. function isNumber(val) {
  36189. return typeof val === 'number';
  36190. }
  36191. /**
  36192. * Determine if a value is undefined
  36193. *
  36194. * @param {Object} val The value to test
  36195. * @returns {boolean} True if the value is undefined, otherwise false
  36196. */
  36197. function isUndefined(val) {
  36198. return typeof val === 'undefined';
  36199. }
  36200. /**
  36201. * Determine if a value is an Object
  36202. *
  36203. * @param {Object} val The value to test
  36204. * @returns {boolean} True if value is an Object, otherwise false
  36205. */
  36206. function isObject(val) {
  36207. return val !== null && typeof val === 'object';
  36208. }
  36209. /**
  36210. * Determine if a value is a Date
  36211. *
  36212. * @param {Object} val The value to test
  36213. * @returns {boolean} True if value is a Date, otherwise false
  36214. */
  36215. function isDate(val) {
  36216. return toString.call(val) === '[object Date]';
  36217. }
  36218. /**
  36219. * Determine if a value is a File
  36220. *
  36221. * @param {Object} val The value to test
  36222. * @returns {boolean} True if value is a File, otherwise false
  36223. */
  36224. function isFile(val) {
  36225. return toString.call(val) === '[object File]';
  36226. }
  36227. /**
  36228. * Determine if a value is a Blob
  36229. *
  36230. * @param {Object} val The value to test
  36231. * @returns {boolean} True if value is a Blob, otherwise false
  36232. */
  36233. function isBlob(val) {
  36234. return toString.call(val) === '[object Blob]';
  36235. }
  36236. /**
  36237. * Determine if a value is a Function
  36238. *
  36239. * @param {Object} val The value to test
  36240. * @returns {boolean} True if value is a Function, otherwise false
  36241. */
  36242. function isFunction(val) {
  36243. return toString.call(val) === '[object Function]';
  36244. }
  36245. /**
  36246. * Determine if a value is a Stream
  36247. *
  36248. * @param {Object} val The value to test
  36249. * @returns {boolean} True if value is a Stream, otherwise false
  36250. */
  36251. function isStream(val) {
  36252. return isObject(val) && isFunction(val.pipe);
  36253. }
  36254. /**
  36255. * Determine if a value is a URLSearchParams object
  36256. *
  36257. * @param {Object} val The value to test
  36258. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  36259. */
  36260. function isURLSearchParams(val) {
  36261. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  36262. }
  36263. /**
  36264. * Trim excess whitespace off the beginning and end of a string
  36265. *
  36266. * @param {String} str The String to trim
  36267. * @returns {String} The String freed of excess whitespace
  36268. */
  36269. function trim(str) {
  36270. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  36271. }
  36272. /**
  36273. * Determine if we're running in a standard browser environment
  36274. *
  36275. * This allows axios to run in a web worker, and react-native.
  36276. * Both environments support XMLHttpRequest, but not fully standard globals.
  36277. *
  36278. * web workers:
  36279. * typeof window -> undefined
  36280. * typeof document -> undefined
  36281. *
  36282. * react-native:
  36283. * typeof document.createElement -> undefined
  36284. */
  36285. function isStandardBrowserEnv() {
  36286. return (
  36287. typeof window !== 'undefined' &&
  36288. typeof document !== 'undefined' &&
  36289. typeof document.createElement === 'function'
  36290. );
  36291. }
  36292. /**
  36293. * Iterate over an Array or an Object invoking a function for each item.
  36294. *
  36295. * If `obj` is an Array callback will be called passing
  36296. * the value, index, and complete array for each item.
  36297. *
  36298. * If 'obj' is an Object callback will be called passing
  36299. * the value, key, and complete object for each property.
  36300. *
  36301. * @param {Object|Array} obj The object to iterate
  36302. * @param {Function} fn The callback to invoke for each item
  36303. */
  36304. function forEach(obj, fn) {
  36305. // Don't bother if no value provided
  36306. if (obj === null || typeof obj === 'undefined') {
  36307. return;
  36308. }
  36309. // Force an array if not already something iterable
  36310. if (typeof obj !== 'object' && !isArray(obj)) {
  36311. /*eslint no-param-reassign:0*/
  36312. obj = [obj];
  36313. }
  36314. if (isArray(obj)) {
  36315. // Iterate over array values
  36316. for (var i = 0, l = obj.length; i < l; i++) {
  36317. fn.call(null, obj[i], i, obj);
  36318. }
  36319. } else {
  36320. // Iterate over object keys
  36321. for (var key in obj) {
  36322. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  36323. fn.call(null, obj[key], key, obj);
  36324. }
  36325. }
  36326. }
  36327. }
  36328. /**
  36329. * Accepts varargs expecting each argument to be an object, then
  36330. * immutably merges the properties of each object and returns result.
  36331. *
  36332. * When multiple objects contain the same key the later object in
  36333. * the arguments list will take precedence.
  36334. *
  36335. * Example:
  36336. *
  36337. * ```js
  36338. * var result = merge({foo: 123}, {foo: 456});
  36339. * console.log(result.foo); // outputs 456
  36340. * ```
  36341. *
  36342. * @param {Object} obj1 Object to merge
  36343. * @returns {Object} Result of all merge properties
  36344. */
  36345. function merge(/* obj1, obj2, obj3, ... */) {
  36346. var result = {};
  36347. function assignValue(val, key) {
  36348. if (typeof result[key] === 'object' && typeof val === 'object') {
  36349. result[key] = merge(result[key], val);
  36350. } else {
  36351. result[key] = val;
  36352. }
  36353. }
  36354. for (var i = 0, l = arguments.length; i < l; i++) {
  36355. forEach(arguments[i], assignValue);
  36356. }
  36357. return result;
  36358. }
  36359. /**
  36360. * Extends object a by mutably adding to it the properties of object b.
  36361. *
  36362. * @param {Object} a The object to be extended
  36363. * @param {Object} b The object to copy properties from
  36364. * @param {Object} thisArg The object to bind function to
  36365. * @return {Object} The resulting value of object a
  36366. */
  36367. function extend(a, b, thisArg) {
  36368. forEach(b, function assignValue(val, key) {
  36369. if (thisArg && typeof val === 'function') {
  36370. a[key] = bind(val, thisArg);
  36371. } else {
  36372. a[key] = val;
  36373. }
  36374. });
  36375. return a;
  36376. }
  36377. module.exports = {
  36378. isArray: isArray,
  36379. isArrayBuffer: isArrayBuffer,
  36380. isFormData: isFormData,
  36381. isArrayBufferView: isArrayBufferView,
  36382. isString: isString,
  36383. isNumber: isNumber,
  36384. isObject: isObject,
  36385. isUndefined: isUndefined,
  36386. isDate: isDate,
  36387. isFile: isFile,
  36388. isBlob: isBlob,
  36389. isFunction: isFunction,
  36390. isStream: isStream,
  36391. isURLSearchParams: isURLSearchParams,
  36392. isStandardBrowserEnv: isStandardBrowserEnv,
  36393. forEach: forEach,
  36394. merge: merge,
  36395. extend: extend,
  36396. trim: trim
  36397. };
  36398. });
  36399. ___scope___.file("lib/helpers/bind.js", function(exports, require, module, __filename, __dirname){
  36400. 'use strict';
  36401. module.exports = function bind(fn, thisArg) {
  36402. return function wrap() {
  36403. var args = new Array(arguments.length);
  36404. for (var i = 0; i < args.length; i++) {
  36405. args[i] = arguments[i];
  36406. }
  36407. return fn.apply(thisArg, args);
  36408. };
  36409. };
  36410. });
  36411. ___scope___.file("lib/core/Axios.js", function(exports, require, module, __filename, __dirname){
  36412. 'use strict';
  36413. var defaults = require('./../defaults');
  36414. var utils = require('./../utils');
  36415. var InterceptorManager = require('./InterceptorManager');
  36416. var dispatchRequest = require('./dispatchRequest');
  36417. var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
  36418. var combineURLs = require('./../helpers/combineURLs');
  36419. /**
  36420. * Create a new instance of Axios
  36421. *
  36422. * @param {Object} instanceConfig The default config for the instance
  36423. */
  36424. function Axios(instanceConfig) {
  36425. this.defaults = instanceConfig;
  36426. this.interceptors = {
  36427. request: new InterceptorManager(),
  36428. response: new InterceptorManager()
  36429. };
  36430. }
  36431. /**
  36432. * Dispatch a request
  36433. *
  36434. * @param {Object} config The config specific for this request (merged with this.defaults)
  36435. */
  36436. Axios.prototype.request = function request(config) {
  36437. /*eslint no-param-reassign:0*/
  36438. // Allow for axios('example/url'[, config]) a la fetch API
  36439. if (typeof config === 'string') {
  36440. config = utils.merge({
  36441. url: arguments[0]
  36442. }, arguments[1]);
  36443. }
  36444. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  36445. // Support baseURL config
  36446. if (config.baseURL && !isAbsoluteURL(config.url)) {
  36447. config.url = combineURLs(config.baseURL, config.url);
  36448. }
  36449. // Hook up interceptors middleware
  36450. var chain = [dispatchRequest, undefined];
  36451. var promise = Promise.resolve(config);
  36452. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  36453. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  36454. });
  36455. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  36456. chain.push(interceptor.fulfilled, interceptor.rejected);
  36457. });
  36458. while (chain.length) {
  36459. promise = promise.then(chain.shift(), chain.shift());
  36460. }
  36461. return promise;
  36462. };
  36463. // Provide aliases for supported request methods
  36464. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  36465. /*eslint func-names:0*/
  36466. Axios.prototype[method] = function(url, config) {
  36467. return this.request(utils.merge(config || {}, {
  36468. method: method,
  36469. url: url
  36470. }));
  36471. };
  36472. });
  36473. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  36474. /*eslint func-names:0*/
  36475. Axios.prototype[method] = function(url, data, config) {
  36476. return this.request(utils.merge(config || {}, {
  36477. method: method,
  36478. url: url,
  36479. data: data
  36480. }));
  36481. };
  36482. });
  36483. module.exports = Axios;
  36484. });
  36485. ___scope___.file("lib/defaults.js", function(exports, require, module, __filename, __dirname){
  36486. /* fuse:injection: */ var process = require("process");
  36487. 'use strict';
  36488. var utils = require('./utils');
  36489. var normalizeHeaderName = require('./helpers/normalizeHeaderName');
  36490. var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  36491. var DEFAULT_CONTENT_TYPE = {
  36492. 'Content-Type': 'application/x-www-form-urlencoded'
  36493. };
  36494. function setContentTypeIfUnset(headers, value) {
  36495. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  36496. headers['Content-Type'] = value;
  36497. }
  36498. }
  36499. function getDefaultAdapter() {
  36500. var adapter;
  36501. if (typeof XMLHttpRequest !== 'undefined') {
  36502. // For browsers use XHR adapter
  36503. adapter = require('./adapters/xhr');
  36504. } else if (typeof process !== 'undefined') {
  36505. // For node use HTTP adapter
  36506. adapter = require('./adapters/http');
  36507. }
  36508. return adapter;
  36509. }
  36510. var defaults = {
  36511. adapter: getDefaultAdapter(),
  36512. transformRequest: [function transformRequest(data, headers) {
  36513. normalizeHeaderName(headers, 'Content-Type');
  36514. if (utils.isFormData(data) ||
  36515. utils.isArrayBuffer(data) ||
  36516. utils.isStream(data) ||
  36517. utils.isFile(data) ||
  36518. utils.isBlob(data)
  36519. ) {
  36520. return data;
  36521. }
  36522. if (utils.isArrayBufferView(data)) {
  36523. return data.buffer;
  36524. }
  36525. if (utils.isURLSearchParams(data)) {
  36526. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  36527. return data.toString();
  36528. }
  36529. if (utils.isObject(data)) {
  36530. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  36531. return JSON.stringify(data);
  36532. }
  36533. return data;
  36534. }],
  36535. transformResponse: [function transformResponse(data) {
  36536. /*eslint no-param-reassign:0*/
  36537. if (typeof data === 'string') {
  36538. data = data.replace(PROTECTION_PREFIX, '');
  36539. try {
  36540. data = JSON.parse(data);
  36541. } catch (e) { /* Ignore */ }
  36542. }
  36543. return data;
  36544. }],
  36545. timeout: 0,
  36546. xsrfCookieName: 'XSRF-TOKEN',
  36547. xsrfHeaderName: 'X-XSRF-TOKEN',
  36548. maxContentLength: -1,
  36549. validateStatus: function validateStatus(status) {
  36550. return status >= 200 && status < 300;
  36551. }
  36552. };
  36553. defaults.headers = {
  36554. common: {
  36555. 'Accept': 'application/json, text/plain, */*'
  36556. }
  36557. };
  36558. utils.forEach(['delete', 'get', 'head'], function forEachMehtodNoData(method) {
  36559. defaults.headers[method] = {};
  36560. });
  36561. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  36562. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  36563. });
  36564. module.exports = defaults;
  36565. });
  36566. ___scope___.file("lib/helpers/normalizeHeaderName.js", function(exports, require, module, __filename, __dirname){
  36567. 'use strict';
  36568. var utils = require('../utils');
  36569. module.exports = function normalizeHeaderName(headers, normalizedName) {
  36570. utils.forEach(headers, function processHeader(value, name) {
  36571. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  36572. headers[normalizedName] = value;
  36573. delete headers[name];
  36574. }
  36575. });
  36576. };
  36577. });
  36578. ___scope___.file("lib/adapters/xhr.js", function(exports, require, module, __filename, __dirname){
  36579. /* fuse:injection: */ var process = require("process");
  36580. 'use strict';
  36581. var utils = require('./../utils');
  36582. var settle = require('./../core/settle');
  36583. var buildURL = require('./../helpers/buildURL');
  36584. var parseHeaders = require('./../helpers/parseHeaders');
  36585. var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
  36586. var createError = require('../core/createError');
  36587. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || require('./../helpers/btoa');
  36588. module.exports = function xhrAdapter(config) {
  36589. return new Promise(function dispatchXhrRequest(resolve, reject) {
  36590. var requestData = config.data;
  36591. var requestHeaders = config.headers;
  36592. if (utils.isFormData(requestData)) {
  36593. delete requestHeaders['Content-Type']; // Let the browser set it
  36594. }
  36595. var request = new XMLHttpRequest();
  36596. var loadEvent = 'onreadystatechange';
  36597. var xDomain = false;
  36598. // For IE 8/9 CORS support
  36599. // Only supports POST and GET calls and doesn't returns the response headers.
  36600. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  36601. if (process.env.NODE_ENV !== 'test' &&
  36602. typeof window !== 'undefined' &&
  36603. window.XDomainRequest && !('withCredentials' in request) &&
  36604. !isURLSameOrigin(config.url)) {
  36605. request = new window.XDomainRequest();
  36606. loadEvent = 'onload';
  36607. xDomain = true;
  36608. request.onprogress = function handleProgress() {};
  36609. request.ontimeout = function handleTimeout() {};
  36610. }
  36611. // HTTP basic authentication
  36612. if (config.auth) {
  36613. var username = config.auth.username || '';
  36614. var password = config.auth.password || '';
  36615. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  36616. }
  36617. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  36618. // Set the request timeout in MS
  36619. request.timeout = config.timeout;
  36620. // Listen for ready state
  36621. request[loadEvent] = function handleLoad() {
  36622. if (!request || (request.readyState !== 4 && !xDomain)) {
  36623. return;
  36624. }
  36625. // The request errored out and we didn't get a response, this will be
  36626. // handled by onerror instead
  36627. // With one exception: request that using file: protocol, most browsers
  36628. // will return status as 0 even though it's a successful request
  36629. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  36630. return;
  36631. }
  36632. // Prepare the response
  36633. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  36634. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  36635. var response = {
  36636. data: responseData,
  36637. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  36638. status: request.status === 1223 ? 204 : request.status,
  36639. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  36640. headers: responseHeaders,
  36641. config: config,
  36642. request: request
  36643. };
  36644. settle(resolve, reject, response);
  36645. // Clean up request
  36646. request = null;
  36647. };
  36648. // Handle low level network errors
  36649. request.onerror = function handleError() {
  36650. // Real errors are hidden from us by the browser
  36651. // onerror should only fire if it's a network error
  36652. reject(createError('Network Error', config));
  36653. // Clean up request
  36654. request = null;
  36655. };
  36656. // Handle timeout
  36657. request.ontimeout = function handleTimeout() {
  36658. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  36659. // Clean up request
  36660. request = null;
  36661. };
  36662. // Add xsrf header
  36663. // This is only done if running in a standard browser environment.
  36664. // Specifically not if we're in a web worker, or react-native.
  36665. if (utils.isStandardBrowserEnv()) {
  36666. var cookies = require('./../helpers/cookies');
  36667. // Add xsrf header
  36668. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  36669. cookies.read(config.xsrfCookieName) :
  36670. undefined;
  36671. if (xsrfValue) {
  36672. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  36673. }
  36674. }
  36675. // Add headers to the request
  36676. if ('setRequestHeader' in request) {
  36677. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  36678. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  36679. // Remove Content-Type if data is undefined
  36680. delete requestHeaders[key];
  36681. } else {
  36682. // Otherwise add header to the request
  36683. request.setRequestHeader(key, val);
  36684. }
  36685. });
  36686. }
  36687. // Add withCredentials to request if needed
  36688. if (config.withCredentials) {
  36689. request.withCredentials = true;
  36690. }
  36691. // Add responseType to request if needed
  36692. if (config.responseType) {
  36693. try {
  36694. request.responseType = config.responseType;
  36695. } catch (e) {
  36696. if (request.responseType !== 'json') {
  36697. throw e;
  36698. }
  36699. }
  36700. }
  36701. // Handle progress if needed
  36702. if (typeof config.onDownloadProgress === 'function') {
  36703. request.addEventListener('progress', config.onDownloadProgress);
  36704. }
  36705. // Not all browsers support upload events
  36706. if (typeof config.onUploadProgress === 'function' && request.upload) {
  36707. request.upload.addEventListener('progress', config.onUploadProgress);
  36708. }
  36709. if (config.cancelToken) {
  36710. // Handle cancellation
  36711. config.cancelToken.promise.then(function onCanceled(cancel) {
  36712. if (!request) {
  36713. return;
  36714. }
  36715. request.abort();
  36716. reject(cancel);
  36717. // Clean up request
  36718. request = null;
  36719. });
  36720. }
  36721. if (requestData === undefined) {
  36722. requestData = null;
  36723. }
  36724. // Send the request
  36725. request.send(requestData);
  36726. });
  36727. };
  36728. });
  36729. ___scope___.file("lib/core/settle.js", function(exports, require, module, __filename, __dirname){
  36730. 'use strict';
  36731. var createError = require('./createError');
  36732. /**
  36733. * Resolve or reject a Promise based on response status.
  36734. *
  36735. * @param {Function} resolve A function that resolves the promise.
  36736. * @param {Function} reject A function that rejects the promise.
  36737. * @param {object} response The response.
  36738. */
  36739. module.exports = function settle(resolve, reject, response) {
  36740. var validateStatus = response.config.validateStatus;
  36741. // Note: status is not exposed by XDomainRequest
  36742. if (!response.status || !validateStatus || validateStatus(response.status)) {
  36743. resolve(response);
  36744. } else {
  36745. reject(createError(
  36746. 'Request failed with status code ' + response.status,
  36747. response.config,
  36748. null,
  36749. response
  36750. ));
  36751. }
  36752. };
  36753. });
  36754. ___scope___.file("lib/core/createError.js", function(exports, require, module, __filename, __dirname){
  36755. 'use strict';
  36756. var enhanceError = require('./enhanceError');
  36757. /**
  36758. * Create an Error with the specified message, config, error code, and response.
  36759. *
  36760. * @param {string} message The error message.
  36761. * @param {Object} config The config.
  36762. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  36763. @ @param {Object} [response] The response.
  36764. * @returns {Error} The created error.
  36765. */
  36766. module.exports = function createError(message, config, code, response) {
  36767. var error = new Error(message);
  36768. return enhanceError(error, config, code, response);
  36769. };
  36770. });
  36771. ___scope___.file("lib/core/enhanceError.js", function(exports, require, module, __filename, __dirname){
  36772. 'use strict';
  36773. /**
  36774. * Update an Error with the specified config, error code, and response.
  36775. *
  36776. * @param {Error} error The error to update.
  36777. * @param {Object} config The config.
  36778. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  36779. @ @param {Object} [response] The response.
  36780. * @returns {Error} The error.
  36781. */
  36782. module.exports = function enhanceError(error, config, code, response) {
  36783. error.config = config;
  36784. if (code) {
  36785. error.code = code;
  36786. }
  36787. error.response = response;
  36788. return error;
  36789. };
  36790. });
  36791. ___scope___.file("lib/helpers/buildURL.js", function(exports, require, module, __filename, __dirname){
  36792. 'use strict';
  36793. var utils = require('./../utils');
  36794. function encode(val) {
  36795. return encodeURIComponent(val).
  36796. replace(/%40/gi, '@').
  36797. replace(/%3A/gi, ':').
  36798. replace(/%24/g, '$').
  36799. replace(/%2C/gi, ',').
  36800. replace(/%20/g, '+').
  36801. replace(/%5B/gi, '[').
  36802. replace(/%5D/gi, ']');
  36803. }
  36804. /**
  36805. * Build a URL by appending params to the end
  36806. *
  36807. * @param {string} url The base of the url (e.g., http://www.google.com)
  36808. * @param {object} [params] The params to be appended
  36809. * @returns {string} The formatted url
  36810. */
  36811. module.exports = function buildURL(url, params, paramsSerializer) {
  36812. /*eslint no-param-reassign:0*/
  36813. if (!params) {
  36814. return url;
  36815. }
  36816. var serializedParams;
  36817. if (paramsSerializer) {
  36818. serializedParams = paramsSerializer(params);
  36819. } else if (utils.isURLSearchParams(params)) {
  36820. serializedParams = params.toString();
  36821. } else {
  36822. var parts = [];
  36823. utils.forEach(params, function serialize(val, key) {
  36824. if (val === null || typeof val === 'undefined') {
  36825. return;
  36826. }
  36827. if (utils.isArray(val)) {
  36828. key = key + '[]';
  36829. }
  36830. if (!utils.isArray(val)) {
  36831. val = [val];
  36832. }
  36833. utils.forEach(val, function parseValue(v) {
  36834. if (utils.isDate(v)) {
  36835. v = v.toISOString();
  36836. } else if (utils.isObject(v)) {
  36837. v = JSON.stringify(v);
  36838. }
  36839. parts.push(encode(key) + '=' + encode(v));
  36840. });
  36841. });
  36842. serializedParams = parts.join('&');
  36843. }
  36844. if (serializedParams) {
  36845. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  36846. }
  36847. return url;
  36848. };
  36849. });
  36850. ___scope___.file("lib/helpers/parseHeaders.js", function(exports, require, module, __filename, __dirname){
  36851. 'use strict';
  36852. var utils = require('./../utils');
  36853. /**
  36854. * Parse headers into an object
  36855. *
  36856. * ```
  36857. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  36858. * Content-Type: application/json
  36859. * Connection: keep-alive
  36860. * Transfer-Encoding: chunked
  36861. * ```
  36862. *
  36863. * @param {String} headers Headers needing to be parsed
  36864. * @returns {Object} Headers parsed into an object
  36865. */
  36866. module.exports = function parseHeaders(headers) {
  36867. var parsed = {};
  36868. var key;
  36869. var val;
  36870. var i;
  36871. if (!headers) { return parsed; }
  36872. utils.forEach(headers.split('\n'), function parser(line) {
  36873. i = line.indexOf(':');
  36874. key = utils.trim(line.substr(0, i)).toLowerCase();
  36875. val = utils.trim(line.substr(i + 1));
  36876. if (key) {
  36877. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  36878. }
  36879. });
  36880. return parsed;
  36881. };
  36882. });
  36883. ___scope___.file("lib/helpers/isURLSameOrigin.js", function(exports, require, module, __filename, __dirname){
  36884. 'use strict';
  36885. var utils = require('./../utils');
  36886. module.exports = (
  36887. utils.isStandardBrowserEnv() ?
  36888. // Standard browser envs have full support of the APIs needed to test
  36889. // whether the request URL is of the same origin as current location.
  36890. (function standardBrowserEnv() {
  36891. var msie = /(msie|trident)/i.test(navigator.userAgent);
  36892. var urlParsingNode = document.createElement('a');
  36893. var originURL;
  36894. /**
  36895. * Parse a URL to discover it's components
  36896. *
  36897. * @param {String} url The URL to be parsed
  36898. * @returns {Object}
  36899. */
  36900. function resolveURL(url) {
  36901. var href = url;
  36902. if (msie) {
  36903. // IE needs attribute set twice to normalize properties
  36904. urlParsingNode.setAttribute('href', href);
  36905. href = urlParsingNode.href;
  36906. }
  36907. urlParsingNode.setAttribute('href', href);
  36908. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  36909. return {
  36910. href: urlParsingNode.href,
  36911. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  36912. host: urlParsingNode.host,
  36913. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  36914. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  36915. hostname: urlParsingNode.hostname,
  36916. port: urlParsingNode.port,
  36917. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  36918. urlParsingNode.pathname :
  36919. '/' + urlParsingNode.pathname
  36920. };
  36921. }
  36922. originURL = resolveURL(window.location.href);
  36923. /**
  36924. * Determine if a URL shares the same origin as the current location
  36925. *
  36926. * @param {String} requestURL The URL to test
  36927. * @returns {boolean} True if URL shares the same origin, otherwise false
  36928. */
  36929. return function isURLSameOrigin(requestURL) {
  36930. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  36931. return (parsed.protocol === originURL.protocol &&
  36932. parsed.host === originURL.host);
  36933. };
  36934. })() :
  36935. // Non standard browser envs (web workers, react-native) lack needed support.
  36936. (function nonStandardBrowserEnv() {
  36937. return function isURLSameOrigin() {
  36938. return true;
  36939. };
  36940. })()
  36941. );
  36942. });
  36943. ___scope___.file("lib/helpers/btoa.js", function(exports, require, module, __filename, __dirname){
  36944. 'use strict';
  36945. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  36946. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  36947. function E() {
  36948. this.message = 'String contains an invalid character';
  36949. }
  36950. E.prototype = new Error;
  36951. E.prototype.code = 5;
  36952. E.prototype.name = 'InvalidCharacterError';
  36953. function btoa(input) {
  36954. var str = String(input);
  36955. var output = '';
  36956. for (
  36957. // initialize result and counter
  36958. var block, charCode, idx = 0, map = chars;
  36959. // if the next str index does not exist:
  36960. // change the mapping table to "="
  36961. // check if d has no fractional digits
  36962. str.charAt(idx | 0) || (map = '=', idx % 1);
  36963. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  36964. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  36965. ) {
  36966. charCode = str.charCodeAt(idx += 3 / 4);
  36967. if (charCode > 0xFF) {
  36968. throw new E();
  36969. }
  36970. block = block << 8 | charCode;
  36971. }
  36972. return output;
  36973. }
  36974. module.exports = btoa;
  36975. });
  36976. ___scope___.file("lib/helpers/cookies.js", function(exports, require, module, __filename, __dirname){
  36977. 'use strict';
  36978. var utils = require('./../utils');
  36979. module.exports = (
  36980. utils.isStandardBrowserEnv() ?
  36981. // Standard browser envs support document.cookie
  36982. (function standardBrowserEnv() {
  36983. return {
  36984. write: function write(name, value, expires, path, domain, secure) {
  36985. var cookie = [];
  36986. cookie.push(name + '=' + encodeURIComponent(value));
  36987. if (utils.isNumber(expires)) {
  36988. cookie.push('expires=' + new Date(expires).toGMTString());
  36989. }
  36990. if (utils.isString(path)) {
  36991. cookie.push('path=' + path);
  36992. }
  36993. if (utils.isString(domain)) {
  36994. cookie.push('domain=' + domain);
  36995. }
  36996. if (secure === true) {
  36997. cookie.push('secure');
  36998. }
  36999. document.cookie = cookie.join('; ');
  37000. },
  37001. read: function read(name) {
  37002. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  37003. return (match ? decodeURIComponent(match[3]) : null);
  37004. },
  37005. remove: function remove(name) {
  37006. this.write(name, '', Date.now() - 86400000);
  37007. }
  37008. };
  37009. })() :
  37010. // Non standard browser env (web workers, react-native) lack needed support.
  37011. (function nonStandardBrowserEnv() {
  37012. return {
  37013. write: function write() {},
  37014. read: function read() { return null; },
  37015. remove: function remove() {}
  37016. };
  37017. })()
  37018. );
  37019. });
  37020. ___scope___.file("lib/adapters/http.js", function(exports, require, module, __filename, __dirname){
  37021. /* fuse:injection: */ var process = require("process");
  37022. 'use strict';
  37023. var utils = require('./../utils');
  37024. var settle = require('./../core/settle');
  37025. var buildURL = require('./../helpers/buildURL');
  37026. var http = require('http');
  37027. var https = require('https');
  37028. var httpFollow = require('follow-redirects').http;
  37029. var httpsFollow = require('follow-redirects').https;
  37030. var url = require('url');
  37031. var zlib = require('zlib');
  37032. var pkg = require('./../../package.json');
  37033. var Buffer = require('buffer').Buffer;
  37034. var createError = require('../core/createError');
  37035. var enhanceError = require('../core/enhanceError');
  37036. /*eslint consistent-return:0*/
  37037. module.exports = function httpAdapter(config) {
  37038. return new Promise(function dispatchHttpRequest(resolve, reject) {
  37039. var data = config.data;
  37040. var headers = config.headers;
  37041. var timer;
  37042. var aborted = false;
  37043. // Set User-Agent (required by some servers)
  37044. // Only set header if it hasn't been set in config
  37045. // See https://github.com/mzabriskie/axios/issues/69
  37046. if (!headers['User-Agent'] && !headers['user-agent']) {
  37047. headers['User-Agent'] = 'axios/' + pkg.version;
  37048. }
  37049. if (data && !utils.isStream(data)) {
  37050. if (utils.isArrayBuffer(data)) {
  37051. data = new Buffer(new Uint8Array(data));
  37052. } else if (utils.isString(data)) {
  37053. data = new Buffer(data, 'utf-8');
  37054. } else {
  37055. return reject(createError(
  37056. 'Data after transformation must be a string, an ArrayBuffer, or a Stream',
  37057. config
  37058. ));
  37059. }
  37060. // Add Content-Length header if data exists
  37061. headers['Content-Length'] = data.length;
  37062. }
  37063. // HTTP basic authentication
  37064. var auth = undefined;
  37065. if (config.auth) {
  37066. var username = config.auth.username || '';
  37067. var password = config.auth.password || '';
  37068. auth = username + ':' + password;
  37069. }
  37070. // Parse url
  37071. var parsed = url.parse(config.url);
  37072. var protocol = parsed.protocol || 'http:';
  37073. if (!auth && parsed.auth) {
  37074. var urlAuth = parsed.auth.split(':');
  37075. var urlUsername = urlAuth[0] || '';
  37076. var urlPassword = urlAuth[1] || '';
  37077. auth = urlUsername + ':' + urlPassword;
  37078. }
  37079. if (auth) {
  37080. delete headers.Authorization;
  37081. }
  37082. var isHttps = protocol === 'https:';
  37083. var agent = isHttps ? config.httpsAgent : config.httpAgent;
  37084. var options = {
  37085. hostname: parsed.hostname,
  37086. port: parsed.port,
  37087. path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
  37088. method: config.method,
  37089. headers: headers,
  37090. agent: agent,
  37091. auth: auth
  37092. };
  37093. var proxy = config.proxy;
  37094. if (!proxy) {
  37095. var proxyEnv = protocol.slice(0, -1) + '_proxy';
  37096. var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
  37097. if (proxyUrl) {
  37098. var parsedProxyUrl = url.parse(proxyUrl);
  37099. proxy = {
  37100. host: parsedProxyUrl.hostname,
  37101. port: parsedProxyUrl.port
  37102. };
  37103. if (parsedProxyUrl.auth) {
  37104. var proxyUrlAuth = parsedProxyUrl.auth.split(':');
  37105. proxy.auth = {
  37106. username: proxyUrlAuth[0],
  37107. password: proxyUrlAuth[1]
  37108. };
  37109. }
  37110. }
  37111. }
  37112. if (proxy) {
  37113. options.hostname = proxy.host;
  37114. options.host = proxy.host;
  37115. options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
  37116. options.port = proxy.port;
  37117. options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
  37118. // Basic proxy authorization
  37119. if (proxy.auth) {
  37120. var base64 = new Buffer(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
  37121. options.headers['Proxy-Authorization'] = 'Basic ' + base64;
  37122. }
  37123. }
  37124. var transport;
  37125. if (config.maxRedirects === 0) {
  37126. transport = isHttps ? https : http;
  37127. } else {
  37128. if (config.maxRedirects) {
  37129. options.maxRedirects = config.maxRedirects;
  37130. }
  37131. transport = isHttps ? httpsFollow : httpFollow;
  37132. }
  37133. // Create the request
  37134. var req = transport.request(options, function handleResponse(res) {
  37135. if (aborted) return;
  37136. // Response has been received so kill timer that handles request timeout
  37137. clearTimeout(timer);
  37138. timer = null;
  37139. // uncompress the response body transparently if required
  37140. var stream = res;
  37141. switch (res.headers['content-encoding']) {
  37142. /*eslint default-case:0*/
  37143. case 'gzip':
  37144. case 'compress':
  37145. case 'deflate':
  37146. // add the unzipper to the body stream processing pipeline
  37147. stream = stream.pipe(zlib.createUnzip());
  37148. // remove the content-encoding in order to not confuse downstream operations
  37149. delete res.headers['content-encoding'];
  37150. break;
  37151. }
  37152. var response = {
  37153. status: res.statusCode,
  37154. statusText: res.statusMessage,
  37155. headers: res.headers,
  37156. config: config,
  37157. request: req
  37158. };
  37159. if (config.responseType === 'stream') {
  37160. response.data = stream;
  37161. settle(resolve, reject, response);
  37162. } else {
  37163. var responseBuffer = [];
  37164. stream.on('data', function handleStreamData(chunk) {
  37165. responseBuffer.push(chunk);
  37166. // make sure the content length is not over the maxContentLength if specified
  37167. if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
  37168. reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', config));
  37169. }
  37170. });
  37171. stream.on('error', function handleStreamError(err) {
  37172. if (aborted) return;
  37173. reject(enhanceError(err, config));
  37174. });
  37175. stream.on('end', function handleStreamEnd() {
  37176. var responseData = Buffer.concat(responseBuffer);
  37177. if (config.responseType !== 'arraybuffer') {
  37178. responseData = responseData.toString('utf8');
  37179. }
  37180. response.data = responseData;
  37181. settle(resolve, reject, response);
  37182. });
  37183. }
  37184. });
  37185. // Handle errors
  37186. req.on('error', function handleRequestError(err) {
  37187. if (aborted) return;
  37188. reject(enhanceError(err, config));
  37189. });
  37190. // Handle request timeout
  37191. if (config.timeout && !timer) {
  37192. timer = setTimeout(function handleRequestTimeout() {
  37193. req.abort();
  37194. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  37195. aborted = true;
  37196. }, config.timeout);
  37197. }
  37198. if (config.cancelToken) {
  37199. // Handle cancellation
  37200. config.cancelToken.promise.then(function onCanceled(cancel) {
  37201. if (aborted) {
  37202. return;
  37203. }
  37204. req.abort();
  37205. reject(cancel);
  37206. aborted = true;
  37207. });
  37208. }
  37209. // Send the request
  37210. if (utils.isStream(data)) {
  37211. data.pipe(req);
  37212. } else {
  37213. req.end(data);
  37214. }
  37215. });
  37216. };
  37217. });
  37218. ___scope___.file("package.json", function(exports, require, module, __filename, __dirname){
  37219. module.exports = {
  37220. "_args": [
  37221. [
  37222. {
  37223. "raw": "axios@^0.15.3",
  37224. "scope": null,
  37225. "escapedName": "axios",
  37226. "name": "axios",
  37227. "rawSpec": "^0.15.3",
  37228. "spec": ">=0.15.3 <0.16.0",
  37229. "type": "range"
  37230. },
  37231. "E:\\_\\wiki"
  37232. ]
  37233. ],
  37234. "_from": "axios@>=0.15.3 <0.16.0",
  37235. "_id": "axios@0.15.3",
  37236. "_inCache": true,
  37237. "_location": "/axios",
  37238. "_nodeVersion": "7.0.0",
  37239. "_npmOperationalInternal": {
  37240. "host": "packages-18-east.internal.npmjs.com",
  37241. "tmp": "tmp/axios-0.15.3.tgz_1480283949051_0.7373273745179176"
  37242. },
  37243. "_npmUser": {
  37244. "name": "nickuraltsev",
  37245. "email": "nick.uraltsev@gmail.com"
  37246. },
  37247. "_npmVersion": "3.10.8",
  37248. "_phantomChildren": {
  37249. "debug": "2.6.3"
  37250. },
  37251. "_requested": {
  37252. "raw": "axios@^0.15.3",
  37253. "scope": null,
  37254. "escapedName": "axios",
  37255. "name": "axios",
  37256. "rawSpec": "^0.15.3",
  37257. "spec": ">=0.15.3 <0.16.0",
  37258. "type": "range"
  37259. },
  37260. "_requiredBy": [
  37261. "/"
  37262. ],
  37263. "_resolved": "https://registry.npmjs.org/axios/-/axios-0.15.3.tgz",
  37264. "_shasum": "2c9d638b2e191a08ea1d6cc988eadd6ba5bdc053",
  37265. "_shrinkwrap": null,
  37266. "_spec": "axios@^0.15.3",
  37267. "_where": "E:\\_\\wiki",
  37268. "author": {
  37269. "name": "Matt Zabriskie"
  37270. },
  37271. "browser": {
  37272. "./lib/adapters/http.js": "./lib/adapters/xhr.js"
  37273. },
  37274. "bugs": {
  37275. "url": "https://github.com/mzabriskie/axios/issues"
  37276. },
  37277. "dependencies": {
  37278. "follow-redirects": "1.0.0"
  37279. },
  37280. "description": "Promise based HTTP client for the browser and node.js",
  37281. "devDependencies": {
  37282. "coveralls": "^2.11.9",
  37283. "es6-promise": "^4.0.5",
  37284. "grunt": "^1.0.1",
  37285. "grunt-banner": "^0.6.0",
  37286. "grunt-cli": "^1.2.0",
  37287. "grunt-contrib-clean": "^1.0.0",
  37288. "grunt-contrib-nodeunit": "^1.0.0",
  37289. "grunt-contrib-watch": "^1.0.0",
  37290. "grunt-eslint": "^19.0.0",
  37291. "grunt-karma": "^2.0.0",
  37292. "grunt-ts": "^6.0.0-beta.3",
  37293. "grunt-typings": "^0.1.5",
  37294. "grunt-webpack": "^1.0.18",
  37295. "istanbul-instrumenter-loader": "^1.0.0",
  37296. "jasmine-core": "^2.4.1",
  37297. "karma": "^1.3.0",
  37298. "karma-chrome-launcher": "^2.0.0",
  37299. "karma-coverage": "^1.0.0",
  37300. "karma-firefox-launcher": "^1.0.0",
  37301. "karma-jasmine": "^1.0.2",
  37302. "karma-jasmine-ajax": "^0.1.13",
  37303. "karma-opera-launcher": "^1.0.0",
  37304. "karma-phantomjs-launcher": "^1.0.0",
  37305. "karma-safari-launcher": "^1.0.0",
  37306. "karma-sauce-launcher": "^1.1.0",
  37307. "karma-sinon": "^1.0.5",
  37308. "karma-sourcemap-loader": "^0.3.7",
  37309. "karma-webpack": "^1.7.0",
  37310. "load-grunt-tasks": "^3.5.2",
  37311. "minimist": "^1.2.0",
  37312. "phantomjs-prebuilt": "^2.1.7",
  37313. "sinon": "^1.17.4",
  37314. "typescript": "^2.0.3",
  37315. "url-search-params": "^0.6.1",
  37316. "webpack": "^1.13.1",
  37317. "webpack-dev-server": "^1.14.1"
  37318. },
  37319. "directories": {},
  37320. "dist": {
  37321. "shasum": "2c9d638b2e191a08ea1d6cc988eadd6ba5bdc053",
  37322. "tarball": "https://registry.npmjs.org/axios/-/axios-0.15.3.tgz"
  37323. },
  37324. "gitHead": "4976816808c4e81acad2393c429832afeaf9664d",
  37325. "homepage": "https://github.com/mzabriskie/axios",
  37326. "keywords": [
  37327. "xhr",
  37328. "http",
  37329. "ajax",
  37330. "promise",
  37331. "node"
  37332. ],
  37333. "license": "MIT",
  37334. "main": "index.js",
  37335. "maintainers": [
  37336. {
  37337. "name": "mzabriskie",
  37338. "email": "mzabriskie@gmail.com"
  37339. },
  37340. {
  37341. "name": "nickuraltsev",
  37342. "email": "nick.uraltsev@gmail.com"
  37343. }
  37344. ],
  37345. "name": "axios",
  37346. "optionalDependencies": {},
  37347. "readme": "ERROR: No README data found!",
  37348. "repository": {
  37349. "type": "git",
  37350. "url": "git+https://github.com/mzabriskie/axios.git"
  37351. },
  37352. "scripts": {
  37353. "build": "NODE_ENV=production grunt build",
  37354. "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
  37355. "examples": "node ./examples/server.js",
  37356. "postversion": "git push && git push --tags",
  37357. "preversion": "npm test",
  37358. "start": "node ./sandbox/server.js",
  37359. "test": "grunt test",
  37360. "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
  37361. },
  37362. "typings": "./index.d.ts",
  37363. "version": "0.15.3"
  37364. }
  37365. ;
  37366. });
  37367. ___scope___.file("lib/core/InterceptorManager.js", function(exports, require, module, __filename, __dirname){
  37368. 'use strict';
  37369. var utils = require('./../utils');
  37370. function InterceptorManager() {
  37371. this.handlers = [];
  37372. }
  37373. /**
  37374. * Add a new interceptor to the stack
  37375. *
  37376. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  37377. * @param {Function} rejected The function to handle `reject` for a `Promise`
  37378. *
  37379. * @return {Number} An ID used to remove interceptor later
  37380. */
  37381. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  37382. this.handlers.push({
  37383. fulfilled: fulfilled,
  37384. rejected: rejected
  37385. });
  37386. return this.handlers.length - 1;
  37387. };
  37388. /**
  37389. * Remove an interceptor from the stack
  37390. *
  37391. * @param {Number} id The ID that was returned by `use`
  37392. */
  37393. InterceptorManager.prototype.eject = function eject(id) {
  37394. if (this.handlers[id]) {
  37395. this.handlers[id] = null;
  37396. }
  37397. };
  37398. /**
  37399. * Iterate over all the registered interceptors
  37400. *
  37401. * This method is particularly useful for skipping over any
  37402. * interceptors that may have become `null` calling `eject`.
  37403. *
  37404. * @param {Function} fn The function to call for each interceptor
  37405. */
  37406. InterceptorManager.prototype.forEach = function forEach(fn) {
  37407. utils.forEach(this.handlers, function forEachHandler(h) {
  37408. if (h !== null) {
  37409. fn(h);
  37410. }
  37411. });
  37412. };
  37413. module.exports = InterceptorManager;
  37414. });
  37415. ___scope___.file("lib/core/dispatchRequest.js", function(exports, require, module, __filename, __dirname){
  37416. 'use strict';
  37417. var utils = require('./../utils');
  37418. var transformData = require('./transformData');
  37419. var isCancel = require('../cancel/isCancel');
  37420. var defaults = require('../defaults');
  37421. /**
  37422. * Throws a `Cancel` if cancellation has been requested.
  37423. */
  37424. function throwIfCancellationRequested(config) {
  37425. if (config.cancelToken) {
  37426. config.cancelToken.throwIfRequested();
  37427. }
  37428. }
  37429. /**
  37430. * Dispatch a request to the server using the configured adapter.
  37431. *
  37432. * @param {object} config The config that is to be used for the request
  37433. * @returns {Promise} The Promise to be fulfilled
  37434. */
  37435. module.exports = function dispatchRequest(config) {
  37436. throwIfCancellationRequested(config);
  37437. // Ensure headers exist
  37438. config.headers = config.headers || {};
  37439. // Transform request data
  37440. config.data = transformData(
  37441. config.data,
  37442. config.headers,
  37443. config.transformRequest
  37444. );
  37445. // Flatten headers
  37446. config.headers = utils.merge(
  37447. config.headers.common || {},
  37448. config.headers[config.method] || {},
  37449. config.headers || {}
  37450. );
  37451. utils.forEach(
  37452. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  37453. function cleanHeaderConfig(method) {
  37454. delete config.headers[method];
  37455. }
  37456. );
  37457. var adapter = config.adapter || defaults.adapter;
  37458. return adapter(config).then(function onAdapterResolution(response) {
  37459. throwIfCancellationRequested(config);
  37460. // Transform response data
  37461. response.data = transformData(
  37462. response.data,
  37463. response.headers,
  37464. config.transformResponse
  37465. );
  37466. return response;
  37467. }, function onAdapterRejection(reason) {
  37468. if (!isCancel(reason)) {
  37469. throwIfCancellationRequested(config);
  37470. // Transform response data
  37471. if (reason && reason.response) {
  37472. reason.response.data = transformData(
  37473. reason.response.data,
  37474. reason.response.headers,
  37475. config.transformResponse
  37476. );
  37477. }
  37478. }
  37479. return Promise.reject(reason);
  37480. });
  37481. };
  37482. });
  37483. ___scope___.file("lib/core/transformData.js", function(exports, require, module, __filename, __dirname){
  37484. 'use strict';
  37485. var utils = require('./../utils');
  37486. /**
  37487. * Transform the data for a request or a response
  37488. *
  37489. * @param {Object|String} data The data to be transformed
  37490. * @param {Array} headers The headers for the request or response
  37491. * @param {Array|Function} fns A single function or Array of functions
  37492. * @returns {*} The resulting transformed data
  37493. */
  37494. module.exports = function transformData(data, headers, fns) {
  37495. /*eslint no-param-reassign:0*/
  37496. utils.forEach(fns, function transform(fn) {
  37497. data = fn(data, headers);
  37498. });
  37499. return data;
  37500. };
  37501. });
  37502. ___scope___.file("lib/cancel/isCancel.js", function(exports, require, module, __filename, __dirname){
  37503. 'use strict';
  37504. module.exports = function isCancel(value) {
  37505. return !!(value && value.__CANCEL__);
  37506. };
  37507. });
  37508. ___scope___.file("lib/helpers/isAbsoluteURL.js", function(exports, require, module, __filename, __dirname){
  37509. 'use strict';
  37510. /**
  37511. * Determines whether the specified URL is absolute
  37512. *
  37513. * @param {string} url The URL to test
  37514. * @returns {boolean} True if the specified URL is absolute, otherwise false
  37515. */
  37516. module.exports = function isAbsoluteURL(url) {
  37517. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  37518. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  37519. // by any combination of letters, digits, plus, period, or hyphen.
  37520. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  37521. };
  37522. });
  37523. ___scope___.file("lib/helpers/combineURLs.js", function(exports, require, module, __filename, __dirname){
  37524. 'use strict';
  37525. /**
  37526. * Creates a new URL by combining the specified URLs
  37527. *
  37528. * @param {string} baseURL The base URL
  37529. * @param {string} relativeURL The relative URL
  37530. * @returns {string} The combined URL
  37531. */
  37532. module.exports = function combineURLs(baseURL, relativeURL) {
  37533. return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  37534. };
  37535. });
  37536. ___scope___.file("lib/cancel/Cancel.js", function(exports, require, module, __filename, __dirname){
  37537. 'use strict';
  37538. /**
  37539. * A `Cancel` is an object that is thrown when an operation is canceled.
  37540. *
  37541. * @class
  37542. * @param {string=} message The message.
  37543. */
  37544. function Cancel(message) {
  37545. this.message = message;
  37546. }
  37547. Cancel.prototype.toString = function toString() {
  37548. return 'Cancel' + (this.message ? ': ' + this.message : '');
  37549. };
  37550. Cancel.prototype.__CANCEL__ = true;
  37551. module.exports = Cancel;
  37552. });
  37553. ___scope___.file("lib/cancel/CancelToken.js", function(exports, require, module, __filename, __dirname){
  37554. 'use strict';
  37555. var Cancel = require('./Cancel');
  37556. /**
  37557. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  37558. *
  37559. * @class
  37560. * @param {Function} executor The executor function.
  37561. */
  37562. function CancelToken(executor) {
  37563. if (typeof executor !== 'function') {
  37564. throw new TypeError('executor must be a function.');
  37565. }
  37566. var resolvePromise;
  37567. this.promise = new Promise(function promiseExecutor(resolve) {
  37568. resolvePromise = resolve;
  37569. });
  37570. var token = this;
  37571. executor(function cancel(message) {
  37572. if (token.reason) {
  37573. // Cancellation has already been requested
  37574. return;
  37575. }
  37576. token.reason = new Cancel(message);
  37577. resolvePromise(token.reason);
  37578. });
  37579. }
  37580. /**
  37581. * Throws a `Cancel` if cancellation has been requested.
  37582. */
  37583. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  37584. if (this.reason) {
  37585. throw this.reason;
  37586. }
  37587. };
  37588. /**
  37589. * Returns an object that contains a new `CancelToken` and a function that, when called,
  37590. * cancels the `CancelToken`.
  37591. */
  37592. CancelToken.source = function source() {
  37593. var cancel;
  37594. var token = new CancelToken(function executor(c) {
  37595. cancel = c;
  37596. });
  37597. return {
  37598. token: token,
  37599. cancel: cancel
  37600. };
  37601. };
  37602. module.exports = CancelToken;
  37603. });
  37604. ___scope___.file("lib/helpers/spread.js", function(exports, require, module, __filename, __dirname){
  37605. 'use strict';
  37606. /**
  37607. * Syntactic sugar for invoking a function and expanding an array for arguments.
  37608. *
  37609. * Common use case would be to use `Function.prototype.apply`.
  37610. *
  37611. * ```js
  37612. * function f(x, y, z) {}
  37613. * var args = [1, 2, 3];
  37614. * f.apply(null, args);
  37615. * ```
  37616. *
  37617. * With `spread` this example can be re-written.
  37618. *
  37619. * ```js
  37620. * spread(function(x, y, z) {})([1, 2, 3]);
  37621. * ```
  37622. *
  37623. * @param {Function} callback
  37624. * @returns {Function}
  37625. */
  37626. module.exports = function spread(callback) {
  37627. return function wrap(arr) {
  37628. return callback.apply(null, arr);
  37629. };
  37630. };
  37631. });
  37632. return ___scope___.entry = "index.js";
  37633. });
  37634. FuseBox.pkg("process", {}, function(___scope___){
  37635. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37636. // From https://github.com/defunctzombie/node-process/blob/master/browser.js
  37637. // shim for using process in browser
  37638. if (FuseBox.isServer) {
  37639. if (typeof __process_env__ !== "undefined") {
  37640. Object.assign(global.process.env, __process_env__);
  37641. }
  37642. module.exports = global.process;
  37643. } else {
  37644. require("object-assign-polyfill");
  37645. var productionEnv = false; //require('@system-env').production;
  37646. var process = module.exports = {};
  37647. var queue = [];
  37648. var draining = false;
  37649. var currentQueue;
  37650. var queueIndex = -1;
  37651. function cleanUpNextTick() {
  37652. draining = false;
  37653. if (currentQueue.length) {
  37654. queue = currentQueue.concat(queue);
  37655. } else {
  37656. queueIndex = -1;
  37657. }
  37658. if (queue.length) {
  37659. drainQueue();
  37660. }
  37661. }
  37662. function drainQueue() {
  37663. if (draining) {
  37664. return;
  37665. }
  37666. var timeout = setTimeout(cleanUpNextTick);
  37667. draining = true;
  37668. var len = queue.length;
  37669. while (len) {
  37670. currentQueue = queue;
  37671. queue = [];
  37672. while (++queueIndex < len) {
  37673. if (currentQueue) {
  37674. currentQueue[queueIndex].run();
  37675. }
  37676. }
  37677. queueIndex = -1;
  37678. len = queue.length;
  37679. }
  37680. currentQueue = null;
  37681. draining = false;
  37682. clearTimeout(timeout);
  37683. }
  37684. process.nextTick = function(fun) {
  37685. var args = new Array(arguments.length - 1);
  37686. if (arguments.length > 1) {
  37687. for (var i = 1; i < arguments.length; i++) {
  37688. args[i - 1] = arguments[i];
  37689. }
  37690. }
  37691. queue.push(new Item(fun, args));
  37692. if (queue.length === 1 && !draining) {
  37693. setTimeout(drainQueue, 0);
  37694. }
  37695. };
  37696. // v8 likes predictible objects
  37697. function Item(fun, array) {
  37698. this.fun = fun;
  37699. this.array = array;
  37700. }
  37701. Item.prototype.run = function() {
  37702. this.fun.apply(null, this.array);
  37703. };
  37704. process.title = "browser";
  37705. process.browser = true;
  37706. process.env = {
  37707. NODE_ENV: productionEnv ? "production" : "development",
  37708. };
  37709. if (typeof __process_env__ !== "undefined") {
  37710. Object.assign(process.env, __process_env__);
  37711. }
  37712. process.argv = [];
  37713. process.version = ""; // empty string to avoid regexp issues
  37714. process.versions = {};
  37715. function noop() {}
  37716. process.on = noop;
  37717. process.addListener = noop;
  37718. process.once = noop;
  37719. process.off = noop;
  37720. process.removeListener = noop;
  37721. process.removeAllListeners = noop;
  37722. process.emit = noop;
  37723. process.binding = function(name) {
  37724. throw new Error("process.binding is not supported");
  37725. };
  37726. process.cwd = function() { return "/"; };
  37727. process.chdir = function(dir) {
  37728. throw new Error("process.chdir is not supported");
  37729. };
  37730. process.umask = function() { return 0; };
  37731. }
  37732. });
  37733. return ___scope___.entry = "index.js";
  37734. });
  37735. FuseBox.pkg("object-assign-polyfill", {}, function(___scope___){
  37736. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37737. if (typeof Object.assign != "function") {
  37738. Object.assign = function(target, varArgs) { // .length of function is 2
  37739. "use strict";
  37740. if (target == null) { // TypeError if undefined or null
  37741. throw new TypeError("Cannot convert undefined or null to object");
  37742. }
  37743. var to = Object(target);
  37744. for (var index = 1; index < arguments.length; index++) {
  37745. var nextSource = arguments[index];
  37746. if (nextSource != null) { // Skip over if undefined or null
  37747. for (var nextKey in nextSource) {
  37748. // Avoid bugs when hasOwnProperty is shadowed
  37749. if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
  37750. to[nextKey] = nextSource[nextKey];
  37751. }
  37752. }
  37753. }
  37754. }
  37755. return to;
  37756. };
  37757. }
  37758. });
  37759. return ___scope___.entry = "index.js";
  37760. });
  37761. FuseBox.pkg("http", {}, function(___scope___){
  37762. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37763. if (FuseBox.isServer) {
  37764. module.exports = global.require("http");
  37765. } else {
  37766. module.exports = {};
  37767. }
  37768. });
  37769. return ___scope___.entry = "index.js";
  37770. });
  37771. FuseBox.pkg("https", {}, function(___scope___){
  37772. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37773. if (FuseBox.isServer) {
  37774. module.exports = global.require("https");
  37775. } else {
  37776. module.exports = {};
  37777. }
  37778. });
  37779. return ___scope___.entry = "index.js";
  37780. });
  37781. FuseBox.pkg("follow-redirects@1.0.0", {}, function(___scope___){
  37782. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37783. 'use strict';
  37784. var url = require('url');
  37785. var assert = require('assert');
  37786. var http = require('http');
  37787. var https = require('https');
  37788. var Writable = require('stream').Writable;
  37789. var debug = require('debug')('follow-redirects');
  37790. var nativeProtocols = {'http:': http, 'https:': https};
  37791. var schemes = {};
  37792. var exports = module.exports = {
  37793. maxRedirects: 21
  37794. };
  37795. // RFC7231§4.2.1: Of the request methods defined by this specification,
  37796. // the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe.
  37797. var safeMethods = {GET: true, HEAD: true, OPTIONS: true, TRACE: true};
  37798. // Create handlers that pass events from native requests
  37799. var eventHandlers = Object.create(null);
  37800. ['abort', 'aborted', 'error'].forEach(function (event) {
  37801. eventHandlers[event] = function (arg) {
  37802. this._redirectable.emit(event, arg);
  37803. };
  37804. });
  37805. // An HTTP(S) request that can be redirected
  37806. function RedirectableRequest(options, responseCallback) {
  37807. // Initialize the request
  37808. Writable.call(this);
  37809. this._options = options;
  37810. this._redirectCount = 0;
  37811. // Attach a callback if passed
  37812. if (responseCallback) {
  37813. this.on('response', responseCallback);
  37814. }
  37815. // React to responses of native requests
  37816. var self = this;
  37817. this._onNativeResponse = function (response) {
  37818. self._processResponse(response);
  37819. };
  37820. // Perform the first request
  37821. this._performRequest();
  37822. }
  37823. RedirectableRequest.prototype = Object.create(Writable.prototype);
  37824. // Executes the next native request (initial or redirect)
  37825. RedirectableRequest.prototype._performRequest = function () {
  37826. // If specified, use the agent corresponding to the protocol
  37827. // (HTTP and HTTPS use different types of agents)
  37828. var protocol = this._options.protocol;
  37829. if (this._options.agents) {
  37830. this._options.agent = this._options.agents[schemes[protocol]];
  37831. }
  37832. // Create the native request
  37833. var nativeProtocol = nativeProtocols[this._options.protocol];
  37834. var request = this._currentRequest =
  37835. nativeProtocol.request(this._options, this._onNativeResponse);
  37836. this._currentUrl = url.format(this._options);
  37837. // Set up event handlers
  37838. request._redirectable = this;
  37839. for (var event in eventHandlers) {
  37840. if (event) {
  37841. request.on(event, eventHandlers[event]);
  37842. }
  37843. }
  37844. // The first request is explicitly ended in RedirectableRequest#end
  37845. if (this._currentResponse) {
  37846. request.end();
  37847. }
  37848. };
  37849. // Processes a response from the current native request
  37850. RedirectableRequest.prototype._processResponse = function (response) {
  37851. // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
  37852. // that further action needs to be taken by the user agent in order to
  37853. // fulfill the request. If a Location header field is provided,
  37854. // the user agent MAY automatically redirect its request to the URI
  37855. // referenced by the Location field value,
  37856. // even if the specific status code is not understood.
  37857. var location = response.headers.location;
  37858. if (location && this._options.followRedirects !== false &&
  37859. response.statusCode >= 300 && response.statusCode < 400) {
  37860. // RFC7231§6.4: A client SHOULD detect and intervene
  37861. // in cyclical redirections (i.e., "infinite" redirection loops).
  37862. if (++this._redirectCount > this._options.maxRedirects) {
  37863. return this.emit('error', new Error('Max redirects exceeded.'));
  37864. }
  37865. // RFC7231§6.4.7: The 307 (Temporary Redirect) status code indicates
  37866. // that the target resource resides temporarily under a different URI
  37867. // and the user agent MUST NOT change the request method
  37868. // if it performs an automatic redirection to that URI.
  37869. if (response.statusCode !== 307) {
  37870. // RFC7231§6.4: Automatic redirection needs to done with
  37871. // care for methods not known to be safe […],
  37872. // since the user might not wish to redirect an unsafe request.
  37873. if (!(this._options.method in safeMethods)) {
  37874. this._options.method = 'GET';
  37875. }
  37876. }
  37877. // Perform the redirected request
  37878. var redirectUrl = url.resolve(this._currentUrl, location);
  37879. debug('redirecting to', redirectUrl);
  37880. Object.assign(this._options, url.parse(redirectUrl));
  37881. this._currentResponse = response;
  37882. this._performRequest();
  37883. } else {
  37884. // The response is not a redirect; return it as-is
  37885. response.responseUrl = this._currentUrl;
  37886. return this.emit('response', response);
  37887. }
  37888. };
  37889. // Aborts the current native request
  37890. RedirectableRequest.prototype.abort = function () {
  37891. this._currentRequest.abort();
  37892. };
  37893. // Ends the current native request
  37894. RedirectableRequest.prototype.end = function (data, encoding, callback) {
  37895. this._currentRequest.end(data, encoding, callback);
  37896. };
  37897. // Flushes the headers of the current native request
  37898. RedirectableRequest.prototype.flushHeaders = function () {
  37899. this._currentRequest.flushHeaders();
  37900. };
  37901. // Sets the noDelay option of the current native request
  37902. RedirectableRequest.prototype.setNoDelay = function (noDelay) {
  37903. this._currentRequest.setNoDelay(noDelay);
  37904. };
  37905. // Sets the socketKeepAlive option of the current native request
  37906. RedirectableRequest.prototype.setSocketKeepAlive = function (enable, initialDelay) {
  37907. this._currentRequest.setSocketKeepAlive(enable, initialDelay);
  37908. };
  37909. // Sets the timeout option of the current native request
  37910. RedirectableRequest.prototype.setTimeout = function (timeout, callback) {
  37911. this._currentRequest.setTimeout(timeout, callback);
  37912. };
  37913. // Writes buffered data to the current native request
  37914. RedirectableRequest.prototype._write = function (chunk, encoding, callback) {
  37915. this._currentRequest.write(chunk, encoding, callback);
  37916. };
  37917. // Export a redirecting wrapper for each native protocol
  37918. Object.keys(nativeProtocols).forEach(function (protocol) {
  37919. var scheme = schemes[protocol] = protocol.substr(0, protocol.length - 1);
  37920. var nativeProtocol = nativeProtocols[protocol];
  37921. var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
  37922. // Executes an HTTP request, following redirects
  37923. wrappedProtocol.request = function (options, callback) {
  37924. if (typeof options === 'string') {
  37925. options = url.parse(options);
  37926. options.maxRedirects = exports.maxRedirects;
  37927. } else {
  37928. options = Object.assign({
  37929. maxRedirects: exports.maxRedirects,
  37930. protocol: protocol
  37931. }, options);
  37932. }
  37933. assert.equal(options.protocol, protocol, 'protocol mismatch');
  37934. debug('options', options);
  37935. return new RedirectableRequest(options, callback);
  37936. };
  37937. // Executes a GET request, following redirects
  37938. wrappedProtocol.get = function (options, callback) {
  37939. var request = wrappedProtocol.request(options, callback);
  37940. request.end();
  37941. return request;
  37942. };
  37943. });
  37944. });
  37945. return ___scope___.entry = "index.js";
  37946. });
  37947. FuseBox.pkg("url", {}, function(___scope___){
  37948. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37949. if (FuseBox.isServer) {
  37950. module.exports = global.require("url");
  37951. } else {
  37952. module.exports = {};
  37953. }
  37954. });
  37955. return ___scope___.entry = "index.js";
  37956. });
  37957. FuseBox.pkg("assert", {}, function(___scope___){
  37958. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37959. /*
  37960. * From https://github.com/defunctzombie/commonjs-assert/blob/master/assert.js
  37961. */
  37962. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  37963. //
  37964. // Originally from narwhal.js (http://narwhaljs.org)
  37965. // Copyright (c) 2009 Thomas Robinson <280north.com>
  37966. //
  37967. // Permission is hereby granted, free of charge, to any person obtaining a copy
  37968. // of this software and associated documentation files (the 'Software'), to
  37969. // deal in the Software without restriction, including without limitation the
  37970. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  37971. // sell copies of the Software, and to permit persons to whom the Software is
  37972. // furnished to do so, subject to the following conditions:
  37973. //
  37974. // The above copyright notice and this permission notice shall be included in
  37975. // all copies or substantial portions of the Software.
  37976. //
  37977. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37978. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37979. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37980. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  37981. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  37982. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  37983. // when used in node, this will actually load the util module we depend on
  37984. // versus loading the builtin util module as happens otherwise
  37985. // this is a bug in node module loading as far as I am concerned
  37986. var util = require("util");
  37987. var pSlice = Array.prototype.slice;
  37988. var hasOwn = Object.prototype.hasOwnProperty;
  37989. // 1. The assert module provides functions that throw
  37990. // AssertionError's when particular conditions are not met. The
  37991. // assert module must conform to the following interface.
  37992. var assert = module.exports = ok;
  37993. // 2. The AssertionError is defined in assert.
  37994. // new assert.AssertionError({ message: message,
  37995. // actual: actual,
  37996. // expected: expected })
  37997. assert.AssertionError = function AssertionError(options) {
  37998. this.name = "AssertionError";
  37999. this.actual = options.actual;
  38000. this.expected = options.expected;
  38001. this.operator = options.operator;
  38002. if (options.message) {
  38003. this.message = options.message;
  38004. this.generatedMessage = false;
  38005. } else {
  38006. this.message = getMessage(this);
  38007. this.generatedMessage = true;
  38008. }
  38009. var stackStartFunction = options.stackStartFunction || fail;
  38010. if (Error.captureStackTrace) {
  38011. Error.captureStackTrace(this, stackStartFunction);
  38012. } else {
  38013. // non v8 browsers so we can have a stacktrace
  38014. var err = new Error();
  38015. if (err.stack) {
  38016. var out = err.stack;
  38017. // try to strip useless frames
  38018. var fn_name = stackStartFunction.name;
  38019. var idx = out.indexOf("\n" + fn_name);
  38020. if (idx >= 0) {
  38021. // once we have located the function frame
  38022. // we need to strip out everything before it (and its line)
  38023. var next_line = out.indexOf("\n", idx + 1);
  38024. out = out.substring(next_line + 1);
  38025. }
  38026. this.stack = out;
  38027. }
  38028. }
  38029. };
  38030. // assert.AssertionError instanceof Error
  38031. util.inherits(assert.AssertionError, Error);
  38032. function replacer(key, value) {
  38033. if (util.isUndefined(value)) {
  38034. return "" + value;
  38035. }
  38036. if (util.isNumber(value) && !isFinite(value)) {
  38037. return value.toString();
  38038. }
  38039. if (util.isFunction(value) || util.isRegExp(value)) {
  38040. return value.toString();
  38041. }
  38042. return value;
  38043. }
  38044. function truncate(s, n) {
  38045. if (util.isString(s)) {
  38046. return s.length < n ? s : s.slice(0, n);
  38047. } else {
  38048. return s;
  38049. }
  38050. }
  38051. function getMessage(self) {
  38052. return truncate(JSON.stringify(self.actual, replacer), 128) + " " +
  38053. self.operator + " " +
  38054. truncate(JSON.stringify(self.expected, replacer), 128);
  38055. }
  38056. // At present only the three keys mentioned above are used and
  38057. // understood by the spec. Implementations or sub modules can pass
  38058. // other keys to the AssertionError's constructor - they will be
  38059. // ignored.
  38060. // 3. All of the following functions must throw an AssertionError
  38061. // when a corresponding condition is not met, with a message that
  38062. // may be undefined if not provided. All assertion methods provide
  38063. // both the actual and expected values to the assertion error for
  38064. // display purposes.
  38065. function fail(actual, expected, message, operator, stackStartFunction) {
  38066. throw new assert.AssertionError({
  38067. message: message,
  38068. actual: actual,
  38069. expected: expected,
  38070. operator: operator,
  38071. stackStartFunction: stackStartFunction
  38072. });
  38073. }
  38074. // EXTENSION! allows for well behaved errors defined elsewhere.
  38075. assert.fail = fail;
  38076. // 4. Pure assertion tests whether a value is truthy, as determined
  38077. // by !!guard.
  38078. // assert.ok(guard, message_opt);
  38079. // This statement is equivalent to assert.equal(true, !!guard,
  38080. // message_opt);. To test strictly for the value true, use
  38081. // assert.strictEqual(true, guard, message_opt);.
  38082. function ok(value, message) {
  38083. if (!value) fail(value, true, message, "==", assert.ok);
  38084. }
  38085. assert.ok = ok;
  38086. // 5. The equality assertion tests shallow, coercive equality with
  38087. // ==.
  38088. // assert.equal(actual, expected, message_opt);
  38089. assert.equal = function equal(actual, expected, message) {
  38090. if (actual != expected) fail(actual, expected, message, "==", assert.equal);
  38091. };
  38092. // 6. The non-equality assertion tests for whether two objects are not equal
  38093. // with != assert.notEqual(actual, expected, message_opt);
  38094. assert.notEqual = function notEqual(actual, expected, message) {
  38095. if (actual == expected) {
  38096. fail(actual, expected, message, "!=", assert.notEqual);
  38097. }
  38098. };
  38099. // 7. The equivalence assertion tests a deep equality relation.
  38100. // assert.deepEqual(actual, expected, message_opt);
  38101. assert.deepEqual = function deepEqual(actual, expected, message) {
  38102. if (!_deepEqual(actual, expected)) {
  38103. fail(actual, expected, message, "deepEqual", assert.deepEqual);
  38104. }
  38105. };
  38106. function _deepEqual(actual, expected) {
  38107. // 7.1. All identical values are equivalent, as determined by ===.
  38108. if (actual === expected) {
  38109. return true;
  38110. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  38111. if (actual.length != expected.length) return false;
  38112. for (var i = 0; i < actual.length; i++) {
  38113. if (actual[i] !== expected[i]) return false;
  38114. }
  38115. return true;
  38116. // 7.2. If the expected value is a Date object, the actual value is
  38117. // equivalent if it is also a Date object that refers to the same time.
  38118. } else if (util.isDate(actual) && util.isDate(expected)) {
  38119. return actual.getTime() === expected.getTime();
  38120. // 7.3 If the expected value is a RegExp object, the actual value is
  38121. // equivalent if it is also a RegExp object with the same source and
  38122. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  38123. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  38124. return actual.source === expected.source &&
  38125. actual.global === expected.global &&
  38126. actual.multiline === expected.multiline &&
  38127. actual.lastIndex === expected.lastIndex &&
  38128. actual.ignoreCase === expected.ignoreCase;
  38129. // 7.4. Other pairs that do not both pass typeof value == 'object',
  38130. // equivalence is determined by ==.
  38131. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  38132. return actual == expected;
  38133. // 7.5 For all other Object pairs, including Array objects, equivalence is
  38134. // determined by having the same number of owned properties (as verified
  38135. // with Object.prototype.hasOwnProperty.call), the same set of keys
  38136. // (although not necessarily the same order), equivalent values for every
  38137. // corresponding key, and an identical 'prototype' property. Note: this
  38138. // accounts for both named and indexed properties on Arrays.
  38139. } else {
  38140. return objEquiv(actual, expected);
  38141. }
  38142. }
  38143. function isArguments(object) {
  38144. return Object.prototype.toString.call(object) == "[object Arguments]";
  38145. }
  38146. function objEquiv(a, b) {
  38147. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  38148. return false;
  38149. // an identical 'prototype' property.
  38150. if (a.prototype !== b.prototype) return false;
  38151. // if one is a primitive, the other must be same
  38152. if (util.isPrimitive(a) || util.isPrimitive(b)) {
  38153. return a === b;
  38154. }
  38155. var aIsArgs = isArguments(a),
  38156. bIsArgs = isArguments(b);
  38157. if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
  38158. return false;
  38159. if (aIsArgs) {
  38160. a = pSlice.call(a);
  38161. b = pSlice.call(b);
  38162. return _deepEqual(a, b);
  38163. }
  38164. var ka = objectKeys(a),
  38165. kb = objectKeys(b),
  38166. key, i;
  38167. // having the same number of owned properties (keys incorporates
  38168. // hasOwnProperty)
  38169. if (ka.length != kb.length)
  38170. return false;
  38171. //the same set of keys (although not necessarily the same order),
  38172. ka.sort();
  38173. kb.sort();
  38174. //~~~cheap key test
  38175. for (i = ka.length - 1; i >= 0; i--) {
  38176. if (ka[i] != kb[i])
  38177. return false;
  38178. }
  38179. //equivalent values for every corresponding key, and
  38180. //~~~possibly expensive deep test
  38181. for (i = ka.length - 1; i >= 0; i--) {
  38182. key = ka[i];
  38183. if (!_deepEqual(a[key], b[key])) return false;
  38184. }
  38185. return true;
  38186. }
  38187. // 8. The non-equivalence assertion tests for any deep inequality.
  38188. // assert.notDeepEqual(actual, expected, message_opt);
  38189. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  38190. if (_deepEqual(actual, expected)) {
  38191. fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual);
  38192. }
  38193. };
  38194. // 9. The strict equality assertion tests strict equality, as determined by ===.
  38195. // assert.strictEqual(actual, expected, message_opt);
  38196. assert.strictEqual = function strictEqual(actual, expected, message) {
  38197. if (actual !== expected) {
  38198. fail(actual, expected, message, "===", assert.strictEqual);
  38199. }
  38200. };
  38201. // 10. The strict non-equality assertion tests for strict inequality, as
  38202. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  38203. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  38204. if (actual === expected) {
  38205. fail(actual, expected, message, "!==", assert.notStrictEqual);
  38206. }
  38207. };
  38208. function expectedException(actual, expected) {
  38209. if (!actual || !expected) {
  38210. return false;
  38211. }
  38212. if (Object.prototype.toString.call(expected) == "[object RegExp]") {
  38213. return expected.test(actual);
  38214. } else if (actual instanceof expected) {
  38215. return true;
  38216. } else if (expected.call({}, actual) === true) {
  38217. return true;
  38218. }
  38219. return false;
  38220. }
  38221. function _throws(shouldThrow, block, expected, message) {
  38222. var actual;
  38223. if (util.isString(expected)) {
  38224. message = expected;
  38225. expected = null;
  38226. }
  38227. try {
  38228. block();
  38229. } catch (e) {
  38230. actual = e;
  38231. }
  38232. message = (expected && expected.name ? " (" + expected.name + ")." : ".") +
  38233. (message ? " " + message : ".");
  38234. if (shouldThrow && !actual) {
  38235. fail(actual, expected, "Missing expected exception" + message);
  38236. }
  38237. if (!shouldThrow && expectedException(actual, expected)) {
  38238. fail(actual, expected, "Got unwanted exception" + message);
  38239. }
  38240. if ((shouldThrow && actual && expected &&
  38241. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  38242. throw actual;
  38243. }
  38244. }
  38245. // 11. Expected to throw an error:
  38246. // assert.throws(block, Error_opt, message_opt);
  38247. assert.throws = function(block, /*optional*/ error, /*optional*/ message) {
  38248. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  38249. };
  38250. // EXTENSION! This is annoying to write outside this module.
  38251. assert.doesNotThrow = function(block, /*optional*/ message) {
  38252. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  38253. };
  38254. assert.ifError = function(err) { if (err) { throw err; } };
  38255. var objectKeys = Object.keys || function(obj) {
  38256. var keys = [];
  38257. for (var key in obj) {
  38258. if (hasOwn.call(obj, key)) keys.push(key);
  38259. }
  38260. return keys;
  38261. };
  38262. });
  38263. return ___scope___.entry = "index.js";
  38264. });
  38265. FuseBox.pkg("util", {}, function(___scope___){
  38266. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38267. /*
  38268. * Fork of https://raw.githubusercontent.com/defunctzombie/node-util
  38269. * inlining https://github.com/isaacs/inherits/blob/master/inherits_browser.js
  38270. */
  38271. // Copyright Joyent, Inc. and other Node contributors.
  38272. //
  38273. // Permission is hereby granted, free of charge, to any person obtaining a
  38274. // copy of this software and associated documentation files (the
  38275. // "Software"), to deal in the Software without restriction, including
  38276. // without limitation the rights to use, copy, modify, merge, publish,
  38277. // distribute, sublicense, and/or sell copies of the Software, and to permit
  38278. // persons to whom the Software is furnished to do so, subject to the
  38279. // following conditions:
  38280. //
  38281. // The above copyright notice and this permission notice shall be included
  38282. // in all copies or substantial portions of the Software.
  38283. //
  38284. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  38285. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  38286. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  38287. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  38288. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  38289. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  38290. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  38291. var process = require("process");
  38292. var formatRegExp = /%[sdj%]/g;
  38293. exports.format = function(f) {
  38294. if (!isString(f)) {
  38295. var objects = [];
  38296. for (var i = 0; i < arguments.length; i++) {
  38297. objects.push(inspect(arguments[i]));
  38298. }
  38299. return objects.join(" ");
  38300. }
  38301. var i = 1;
  38302. var args = arguments;
  38303. var len = args.length;
  38304. var str = String(f).replace(formatRegExp, function(x) {
  38305. if (x === "%%") return "%";
  38306. if (i >= len) return x;
  38307. switch (x) {
  38308. case "%s": return String(args[i++]);
  38309. case "%d": return Number(args[i++]);
  38310. case "%j":
  38311. try {
  38312. return JSON.stringify(args[i++]);
  38313. } catch (_) {
  38314. return "[Circular]";
  38315. }
  38316. default:
  38317. return x;
  38318. }
  38319. });
  38320. for (var x = args[i]; i < len; x = args[++i]) {
  38321. if (isNull(x) || !isObject(x)) {
  38322. str += " " + x;
  38323. } else {
  38324. str += " " + inspect(x);
  38325. }
  38326. }
  38327. return str;
  38328. };
  38329. // Mark that a method should not be used.
  38330. // Returns a modified function which warns once by default.
  38331. // If --no-deprecation is set, then it is a no-op.
  38332. exports.deprecate = function(fn, msg) {
  38333. // Allow for deprecating things in the process of starting up.
  38334. if (isUndefined(global.process)) {
  38335. return function() {
  38336. return exports.deprecate(fn, msg).apply(this, arguments);
  38337. };
  38338. }
  38339. if (process.noDeprecation === true) {
  38340. return fn;
  38341. }
  38342. var warned = false;
  38343. function deprecated() {
  38344. if (!warned) {
  38345. if (process.throwDeprecation) {
  38346. throw new Error(msg);
  38347. } else if (process.traceDeprecation) {
  38348. console.trace(msg);
  38349. } else {
  38350. console.error(msg);
  38351. }
  38352. warned = true;
  38353. }
  38354. return fn.apply(this, arguments);
  38355. }
  38356. return deprecated;
  38357. };
  38358. var debugs = {};
  38359. var debugEnviron;
  38360. exports.debuglog = function(set) {
  38361. if (isUndefined(debugEnviron))
  38362. debugEnviron = process.env.NODE_DEBUG || "";
  38363. set = set.toUpperCase();
  38364. if (!debugs[set]) {
  38365. if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
  38366. var pid = process.pid;
  38367. debugs[set] = function() {
  38368. var msg = exports.format.apply(exports, arguments);
  38369. console.error("%s %d: %s", set, pid, msg);
  38370. };
  38371. } else {
  38372. debugs[set] = function() {};
  38373. }
  38374. }
  38375. return debugs[set];
  38376. };
  38377. /**
  38378. * Echos the value of a value. Trys to print the value out
  38379. * in the best way possible given the different types.
  38380. *
  38381. * @param {Object} obj The object to print out.
  38382. * @param {Object} opts Optional options object that alters the output.
  38383. */
  38384. /* legacy: obj, showHidden, depth, colors*/
  38385. function inspect(obj, opts) {
  38386. // default options
  38387. var ctx = {
  38388. seen: [],
  38389. stylize: stylizeNoColor,
  38390. };
  38391. // legacy...
  38392. if (arguments.length >= 3) ctx.depth = arguments[2];
  38393. if (arguments.length >= 4) ctx.colors = arguments[3];
  38394. if (isBoolean(opts)) {
  38395. // legacy...
  38396. ctx.showHidden = opts;
  38397. } else if (opts) {
  38398. // got an "options" object
  38399. exports._extend(ctx, opts);
  38400. }
  38401. // set default options
  38402. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  38403. if (isUndefined(ctx.depth)) ctx.depth = 2;
  38404. if (isUndefined(ctx.colors)) ctx.colors = false;
  38405. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  38406. if (ctx.colors) ctx.stylize = stylizeWithColor;
  38407. return formatValue(ctx, obj, ctx.depth);
  38408. }
  38409. exports.inspect = inspect;
  38410. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  38411. inspect.colors = {
  38412. "bold" : [1, 22],
  38413. "italic" : [3, 23],
  38414. "underline" : [4, 24],
  38415. "inverse" : [7, 27],
  38416. "white" : [37, 39],
  38417. "grey" : [90, 39],
  38418. "black" : [30, 39],
  38419. "blue" : [34, 39],
  38420. "cyan" : [36, 39],
  38421. "green" : [32, 39],
  38422. "magenta" : [35, 39],
  38423. "red" : [31, 39],
  38424. "yellow" : [33, 39],
  38425. };
  38426. // Don't use 'blue' not visible on cmd.exe
  38427. inspect.styles = {
  38428. "special": "cyan",
  38429. "number": "yellow",
  38430. "boolean": "yellow",
  38431. "undefined": "grey",
  38432. "null": "bold",
  38433. "string": "green",
  38434. "date": "magenta",
  38435. // "name": intentionally not styling
  38436. "regexp": "red",
  38437. };
  38438. function stylizeWithColor(str, styleType) {
  38439. var style = inspect.styles[styleType];
  38440. if (style) {
  38441. return "\u001b[" + inspect.colors[style][0] + "m" + str +
  38442. "\u001b[" + inspect.colors[style][1] + "m";
  38443. } else {
  38444. return str;
  38445. }
  38446. }
  38447. function stylizeNoColor(str, styleType) {
  38448. return str;
  38449. }
  38450. function arrayToHash(array) {
  38451. var hash = {};
  38452. array.forEach(function(val, idx) {
  38453. hash[val] = true;
  38454. });
  38455. return hash;
  38456. }
  38457. function formatValue(ctx, value, recurseTimes) {
  38458. // Provide a hook for user-specified inspect functions.
  38459. // Check that value is an object with an inspect function on it
  38460. if (ctx.customInspect &&
  38461. value &&
  38462. isFunction(value.inspect) &&
  38463. // Filter out the util module, it's inspect function is special
  38464. value.inspect !== exports.inspect &&
  38465. // Also filter out any prototype objects using the circular check.
  38466. !(value.constructor && value.constructor.prototype === value)) {
  38467. var ret = value.inspect(recurseTimes, ctx);
  38468. if (!isString(ret)) {
  38469. ret = formatValue(ctx, ret, recurseTimes);
  38470. }
  38471. return ret;
  38472. }
  38473. // Primitive types cannot have properties
  38474. var primitive = formatPrimitive(ctx, value);
  38475. if (primitive) {
  38476. return primitive;
  38477. }
  38478. // Look up the keys of the object.
  38479. var keys = Object.keys(value);
  38480. var visibleKeys = arrayToHash(keys);
  38481. if (ctx.showHidden) {
  38482. keys = Object.getOwnPropertyNames(value);
  38483. }
  38484. // IE doesn't make error fields non-enumerable
  38485. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  38486. if (isError(value)
  38487. && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
  38488. return formatError(value);
  38489. }
  38490. // Some type of object without properties can be shortcutted.
  38491. if (keys.length === 0) {
  38492. if (isFunction(value)) {
  38493. var name = value.name ? ": " + value.name : "";
  38494. return ctx.stylize("[Function" + name + "]", "special");
  38495. }
  38496. if (isRegExp(value)) {
  38497. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  38498. }
  38499. if (isDate(value)) {
  38500. return ctx.stylize(Date.prototype.toString.call(value), "date");
  38501. }
  38502. if (isError(value)) {
  38503. return formatError(value);
  38504. }
  38505. }
  38506. var base = "", array = false, braces = ["{", "}"];
  38507. // Make Array say that they are Array
  38508. if (isArray(value)) {
  38509. array = true;
  38510. braces = ["[", "]"];
  38511. }
  38512. // Make functions say that they are functions
  38513. if (isFunction(value)) {
  38514. var n = value.name ? ": " + value.name : "";
  38515. base = " [Function" + n + "]";
  38516. }
  38517. // Make RegExps say that they are RegExps
  38518. if (isRegExp(value)) {
  38519. base = " " + RegExp.prototype.toString.call(value);
  38520. }
  38521. // Make dates with properties first say the date
  38522. if (isDate(value)) {
  38523. base = " " + Date.prototype.toUTCString.call(value);
  38524. }
  38525. // Make error with message first say the error
  38526. if (isError(value)) {
  38527. base = " " + formatError(value);
  38528. }
  38529. if (keys.length === 0 && (!array || value.length == 0)) {
  38530. return braces[0] + base + braces[1];
  38531. }
  38532. if (recurseTimes < 0) {
  38533. if (isRegExp(value)) {
  38534. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  38535. } else {
  38536. return ctx.stylize("[Object]", "special");
  38537. }
  38538. }
  38539. ctx.seen.push(value);
  38540. var output;
  38541. if (array) {
  38542. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  38543. } else {
  38544. output = keys.map(function(key) {
  38545. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  38546. });
  38547. }
  38548. ctx.seen.pop();
  38549. return reduceToSingleString(output, base, braces);
  38550. }
  38551. function formatPrimitive(ctx, value) {
  38552. if (isUndefined(value))
  38553. return ctx.stylize("undefined", "undefined");
  38554. if (isString(value)) {
  38555. var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "")
  38556. .replace(/'/g, "\\'")
  38557. .replace(/\\"/g, "\"") + "'";
  38558. return ctx.stylize(simple, "string");
  38559. }
  38560. if (isNumber(value))
  38561. return ctx.stylize("" + value, "number");
  38562. if (isBoolean(value))
  38563. return ctx.stylize("" + value, "boolean");
  38564. // For some reason typeof null is "object", so special case here.
  38565. if (isNull(value))
  38566. return ctx.stylize("null", "null");
  38567. }
  38568. function formatError(value) {
  38569. return "[" + Error.prototype.toString.call(value) + "]";
  38570. }
  38571. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  38572. var output = [];
  38573. for (var i = 0, l = value.length; i < l; ++i) {
  38574. if (hasOwnProperty(value, String(i))) {
  38575. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  38576. String(i), true));
  38577. } else {
  38578. output.push("");
  38579. }
  38580. }
  38581. keys.forEach(function(key) {
  38582. if (!key.match(/^\d+$/)) {
  38583. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  38584. key, true));
  38585. }
  38586. });
  38587. return output;
  38588. }
  38589. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  38590. var name, str, desc;
  38591. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  38592. if (desc.get) {
  38593. if (desc.set) {
  38594. str = ctx.stylize("[Getter/Setter]", "special");
  38595. } else {
  38596. str = ctx.stylize("[Getter]", "special");
  38597. }
  38598. } else {
  38599. if (desc.set) {
  38600. str = ctx.stylize("[Setter]", "special");
  38601. }
  38602. }
  38603. if (!hasOwnProperty(visibleKeys, key)) {
  38604. name = "[" + key + "]";
  38605. }
  38606. if (!str) {
  38607. if (ctx.seen.indexOf(desc.value) < 0) {
  38608. if (isNull(recurseTimes)) {
  38609. str = formatValue(ctx, desc.value, null);
  38610. } else {
  38611. str = formatValue(ctx, desc.value, recurseTimes - 1);
  38612. }
  38613. if (str.indexOf("\n") > -1) {
  38614. if (array) {
  38615. str = str.split("\n").map(function(line) {
  38616. return " " + line;
  38617. }).join("\n").substr(2);
  38618. } else {
  38619. str = "\n" + str.split("\n").map(function(line) {
  38620. return " " + line;
  38621. }).join("\n");
  38622. }
  38623. }
  38624. } else {
  38625. str = ctx.stylize("[Circular]", "special");
  38626. }
  38627. }
  38628. if (isUndefined(name)) {
  38629. if (array && key.match(/^\d+$/)) {
  38630. return str;
  38631. }
  38632. name = JSON.stringify("" + key);
  38633. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  38634. name = name.substr(1, name.length - 2);
  38635. name = ctx.stylize(name, "name");
  38636. } else {
  38637. name = name.replace(/'/g, "\\'")
  38638. .replace(/\\"/g, "\"")
  38639. .replace(/(^"|"$)/g, "'");
  38640. name = ctx.stylize(name, "string");
  38641. }
  38642. }
  38643. return name + ": " + str;
  38644. }
  38645. function reduceToSingleString(output, base, braces) {
  38646. var numLinesEst = 0;
  38647. var length = output.reduce(function(prev, cur) {
  38648. numLinesEst++;
  38649. if (cur.indexOf("\n") >= 0) numLinesEst++;
  38650. return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
  38651. }, 0);
  38652. if (length > 60) {
  38653. return braces[0] +
  38654. (base === "" ? "" : base + "\n ") +
  38655. " " +
  38656. output.join(",\n ") +
  38657. " " +
  38658. braces[1];
  38659. }
  38660. return braces[0] + base + " " + output.join(", ") + " " + braces[1];
  38661. }
  38662. // NOTE: These type checking functions intentionally don't use `instanceof`
  38663. // because it is fragile and can be easily faked with `Object.create()`.
  38664. function isArray(ar) {
  38665. return Array.isArray(ar);
  38666. }
  38667. exports.isArray = isArray;
  38668. function isBoolean(arg) {
  38669. return typeof arg === "boolean";
  38670. }
  38671. exports.isBoolean = isBoolean;
  38672. function isNull(arg) {
  38673. return arg === null;
  38674. }
  38675. exports.isNull = isNull;
  38676. function isNullOrUndefined(arg) {
  38677. return arg == null;
  38678. }
  38679. exports.isNullOrUndefined = isNullOrUndefined;
  38680. function isNumber(arg) {
  38681. return typeof arg === "number";
  38682. }
  38683. exports.isNumber = isNumber;
  38684. function isString(arg) {
  38685. return typeof arg === "string";
  38686. }
  38687. exports.isString = isString;
  38688. function isSymbol(arg) {
  38689. return typeof arg === "symbol";
  38690. }
  38691. exports.isSymbol = isSymbol;
  38692. function isUndefined(arg) {
  38693. return arg === void 0;
  38694. }
  38695. exports.isUndefined = isUndefined;
  38696. function isRegExp(re) {
  38697. return isObject(re) && objectToString(re) === "[object RegExp]";
  38698. }
  38699. exports.isRegExp = isRegExp;
  38700. function isObject(arg) {
  38701. return typeof arg === "object" && arg !== null;
  38702. }
  38703. exports.isObject = isObject;
  38704. function isDate(d) {
  38705. return isObject(d) && objectToString(d) === "[object Date]";
  38706. }
  38707. exports.isDate = isDate;
  38708. function isError(e) {
  38709. return isObject(e) &&
  38710. (objectToString(e) === "[object Error]" || e instanceof Error);
  38711. }
  38712. exports.isError = isError;
  38713. function isFunction(arg) {
  38714. return typeof arg === "function";
  38715. }
  38716. exports.isFunction = isFunction;
  38717. function isPrimitive(arg) {
  38718. return arg === null ||
  38719. typeof arg === "boolean" ||
  38720. typeof arg === "number" ||
  38721. typeof arg === "string" ||
  38722. typeof arg === "symbol" || // ES6 symbol
  38723. typeof arg === "undefined";
  38724. }
  38725. exports.isPrimitive = isPrimitive;
  38726. exports.isBuffer = require("./isBuffer.js");
  38727. function objectToString(o) {
  38728. return Object.prototype.toString.call(o);
  38729. }
  38730. function pad(n) {
  38731. return n < 10 ? "0" + n.toString(10) : n.toString(10);
  38732. }
  38733. var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
  38734. "Oct", "Nov", "Dec"];
  38735. // 26 Feb 16:19:34
  38736. function timestamp() {
  38737. var d = new Date();
  38738. var time = [pad(d.getHours()),
  38739. pad(d.getMinutes()),
  38740. pad(d.getSeconds())].join(":");
  38741. return [d.getDate(), months[d.getMonth()], time].join(" ");
  38742. }
  38743. // log is just a thin wrapper to console.log that prepends a timestamp
  38744. exports.log = function() {
  38745. console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
  38746. };
  38747. /**
  38748. * Inherit the prototype methods from one constructor into another.
  38749. *
  38750. * The Function.prototype.inherits from lang.js rewritten as a standalone
  38751. * function (not on Function.prototype). NOTE: If this file is to be loaded
  38752. * during bootstrapping this function needs to be rewritten using some native
  38753. * functions as prototype setup using normal JavaScript does not work as
  38754. * expected during bootstrapping (see mirror.js in r114903).
  38755. *
  38756. * @param {function} ctor Constructor function which needs to inherit the
  38757. * prototype.
  38758. * @param {function} superCtor Constructor function to inherit prototype from.
  38759. */
  38760. if (typeof Object.create === "function") {
  38761. // implementation from standard node.js 'util' module
  38762. exports.inherits = function inherits(ctor, superCtor) {
  38763. ctor.super_ = superCtor;
  38764. ctor.prototype = Object.create(superCtor.prototype, {
  38765. constructor: {
  38766. value: ctor,
  38767. enumerable: false,
  38768. writable: true,
  38769. configurable: true,
  38770. },
  38771. });
  38772. };
  38773. } else {
  38774. // old school shim for old browsers
  38775. exports.inherits = function inherits(ctor, superCtor) {
  38776. ctor.super_ = superCtor;
  38777. var TempCtor = function() {};
  38778. TempCtor.prototype = superCtor.prototype;
  38779. ctor.prototype = new TempCtor();
  38780. ctor.prototype.constructor = ctor;
  38781. };
  38782. }
  38783. exports._extend = function(origin, add) {
  38784. // Don't do anything if add isn't an object
  38785. if (!add || !isObject(add)) return origin;
  38786. var keys = Object.keys(add);
  38787. var i = keys.length;
  38788. while (i--) {
  38789. origin[keys[i]] = add[keys[i]];
  38790. }
  38791. return origin;
  38792. };
  38793. function hasOwnProperty(obj, prop) {
  38794. return Object.prototype.hasOwnProperty.call(obj, prop);
  38795. }
  38796. });
  38797. ___scope___.file("isBuffer.js", function(exports, require, module, __filename, __dirname){
  38798. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  38799. /*
  38800. * From https://github.com/defunctzombie/node-util/blob/master/support/isBuffer.js
  38801. */
  38802. module.exports = function isBuffer(arg) {
  38803. if (typeof Buffer !== "undefined") {
  38804. return arg instanceof Buffer;
  38805. } else {
  38806. return arg && typeof arg === "object"
  38807. && typeof arg.copy === "function"
  38808. && typeof arg.fill === "function"
  38809. && typeof arg.readUInt8 === "function";
  38810. }
  38811. };
  38812. });
  38813. return ___scope___.entry = "index.js";
  38814. });
  38815. FuseBox.pkg("buffer", {}, function(___scope___){
  38816. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38817. if (FuseBox.isServer) {
  38818. module.exports = global.require("buffer");
  38819. } else {
  38820. /*!
  38821. * The buffer module from node.js, for the browser.
  38822. *
  38823. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  38824. * @license MIT
  38825. */
  38826. /* eslint-disable no-proto */
  38827. "use strict";
  38828. var base64 = require("base64-js");
  38829. var ieee754 = require("ieee754");
  38830. exports.Buffer = Buffer;
  38831. exports.FuseShim = true;
  38832. exports.SlowBuffer = SlowBuffer;
  38833. exports.INSPECT_MAX_BYTES = 50;
  38834. var K_MAX_LENGTH = 0x7fffffff;
  38835. exports.kMaxLength = K_MAX_LENGTH;
  38836. /**
  38837. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  38838. * === true Use Uint8Array implementation (fastest)
  38839. * === false Print warning and recommend using `buffer` v4.x which has an Object
  38840. * implementation (most compatible, even IE6)
  38841. *
  38842. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  38843. * Opera 11.6+, iOS 4.2+.
  38844. *
  38845. * We report that the browser does not support typed arrays if the are not subclassable
  38846. * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
  38847. * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
  38848. * for __proto__ and has a buggy typed array implementation.
  38849. */
  38850. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
  38851. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  38852. console.error(
  38853. "This browser lacks typed array (Uint8Array) support which is required by " +
  38854. "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
  38855. }
  38856. function typedArraySupport() {
  38857. // Can typed array instances can be augmented?
  38858. try {
  38859. var arr = new Uint8Array(1);
  38860. arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42; } };
  38861. return arr.foo() === 42;
  38862. } catch (e) {
  38863. return false;
  38864. }
  38865. }
  38866. function createBuffer(length) {
  38867. if (length > K_MAX_LENGTH) {
  38868. throw new RangeError("Invalid typed array length");
  38869. }
  38870. // Return an augmented `Uint8Array` instance
  38871. var buf = new Uint8Array(length);
  38872. buf.__proto__ = Buffer.prototype;
  38873. return buf;
  38874. }
  38875. /**
  38876. * The Buffer constructor returns instances of `Uint8Array` that have their
  38877. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  38878. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  38879. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  38880. * returns a single octet.
  38881. *
  38882. * The `Uint8Array` prototype remains unmodified.
  38883. */
  38884. function Buffer(arg, encodingOrOffset, length) {
  38885. // Common case.
  38886. if (typeof arg === "number") {
  38887. if (typeof encodingOrOffset === "string") {
  38888. throw new Error(
  38889. "If encoding is specified then the first argument must be a string"
  38890. );
  38891. }
  38892. return allocUnsafe(arg);
  38893. }
  38894. return from(arg, encodingOrOffset, length);
  38895. }
  38896. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  38897. if (typeof Symbol !== "undefined" && Symbol.species &&
  38898. Buffer[Symbol.species] === Buffer) {
  38899. Object.defineProperty(Buffer, Symbol.species, {
  38900. value: null,
  38901. configurable: true,
  38902. enumerable: false,
  38903. writable: false,
  38904. });
  38905. }
  38906. Buffer.poolSize = 8192; // not used by this implementation
  38907. function from(value, encodingOrOffset, length) {
  38908. if (typeof value === "number") {
  38909. throw new TypeError("\"value\" argument must not be a number");
  38910. }
  38911. if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) {
  38912. return fromArrayBuffer(value, encodingOrOffset, length);
  38913. }
  38914. if (typeof value === "string") {
  38915. return fromString(value, encodingOrOffset);
  38916. }
  38917. return fromObject(value);
  38918. }
  38919. /**
  38920. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  38921. * if value is a number.
  38922. * Buffer.from(str[, encoding])
  38923. * Buffer.from(array)
  38924. * Buffer.from(buffer)
  38925. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  38926. **/
  38927. Buffer.from = function(value, encodingOrOffset, length) {
  38928. return from(value, encodingOrOffset, length);
  38929. };
  38930. // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
  38931. // https://github.com/feross/buffer/pull/148
  38932. Buffer.prototype.__proto__ = Uint8Array.prototype;
  38933. Buffer.__proto__ = Uint8Array;
  38934. function assertSize(size) {
  38935. if (typeof size !== "number") {
  38936. throw new TypeError("\"size\" argument must be a number");
  38937. } else if (size < 0) {
  38938. throw new RangeError("\"size\" argument must not be negative");
  38939. }
  38940. }
  38941. function alloc(size, fill, encoding) {
  38942. assertSize(size);
  38943. if (size <= 0) {
  38944. return createBuffer(size);
  38945. }
  38946. if (fill !== undefined) {
  38947. // Only pay attention to encoding if it's a string. This
  38948. // prevents accidentally sending in a number that would
  38949. // be interpretted as a start offset.
  38950. return typeof encoding === "string" ?
  38951. createBuffer(size).fill(fill, encoding) :
  38952. createBuffer(size).fill(fill);
  38953. }
  38954. return createBuffer(size);
  38955. }
  38956. /**
  38957. * Creates a new filled Buffer instance.
  38958. * alloc(size[, fill[, encoding]])
  38959. **/
  38960. Buffer.alloc = function(size, fill, encoding) {
  38961. return alloc(size, fill, encoding);
  38962. };
  38963. function allocUnsafe(size) {
  38964. assertSize(size);
  38965. return createBuffer(size < 0 ? 0 : checked(size) | 0);
  38966. }
  38967. /**
  38968. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  38969. * */
  38970. Buffer.allocUnsafe = function(size) {
  38971. return allocUnsafe(size);
  38972. };
  38973. /**
  38974. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  38975. */
  38976. Buffer.allocUnsafeSlow = function(size) {
  38977. return allocUnsafe(size);
  38978. };
  38979. function fromString(string, encoding) {
  38980. if (typeof encoding !== "string" || encoding === "") {
  38981. encoding = "utf8";
  38982. }
  38983. if (!Buffer.isEncoding(encoding)) {
  38984. throw new TypeError("\"encoding\" must be a valid string encoding");
  38985. }
  38986. var length = byteLength(string, encoding) | 0;
  38987. var buf = createBuffer(length);
  38988. var actual = buf.write(string, encoding);
  38989. if (actual !== length) {
  38990. // Writing a hex string, for example, that contains invalid characters will
  38991. // cause everything after the first invalid character to be ignored. (e.g.
  38992. // 'abxxcd' will be treated as 'ab')
  38993. buf = buf.slice(0, actual);
  38994. }
  38995. return buf;
  38996. }
  38997. function fromArrayLike(array) {
  38998. var length = array.length < 0 ? 0 : checked(array.length) | 0;
  38999. var buf = createBuffer(length);
  39000. for (var i = 0; i < length; i += 1) {
  39001. buf[i] = array[i] & 255;
  39002. }
  39003. return buf;
  39004. }
  39005. function fromArrayBuffer(array, byteOffset, length) {
  39006. array.byteLength; // this throws if `array` is not a valid ArrayBuffer
  39007. if (byteOffset < 0 || array.byteLength < byteOffset) {
  39008. throw new RangeError("'offset' is out of bounds");
  39009. }
  39010. if (array.byteLength < byteOffset + (length || 0)) {
  39011. throw new RangeError("'length' is out of bounds");
  39012. }
  39013. var buf;
  39014. if (byteOffset === undefined && length === undefined) {
  39015. buf = new Uint8Array(array);
  39016. } else if (length === undefined) {
  39017. buf = new Uint8Array(array, byteOffset);
  39018. } else {
  39019. buf = new Uint8Array(array, byteOffset, length);
  39020. }
  39021. // Return an augmented `Uint8Array` instance
  39022. buf.__proto__ = Buffer.prototype;
  39023. return buf;
  39024. }
  39025. function fromObject(obj) {
  39026. if (Buffer.isBuffer(obj)) {
  39027. var len = checked(obj.length) | 0;
  39028. var buf = createBuffer(len);
  39029. if (buf.length === 0) {
  39030. return buf;
  39031. }
  39032. obj.copy(buf, 0, 0, len);
  39033. return buf;
  39034. }
  39035. if (obj) {
  39036. if ((typeof ArrayBuffer !== "undefined" &&
  39037. obj.buffer instanceof ArrayBuffer) || "length" in obj) {
  39038. if (typeof obj.length !== "number" || isnan(obj.length)) {
  39039. return createBuffer(0);
  39040. }
  39041. return fromArrayLike(obj);
  39042. }
  39043. if (obj.type === "Buffer" && Array.isArray(obj.data)) {
  39044. return fromArrayLike(obj.data);
  39045. }
  39046. }
  39047. throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
  39048. }
  39049. function checked(length) {
  39050. // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
  39051. // length is NaN (which is otherwise coerced to zero.)
  39052. if (length >= K_MAX_LENGTH) {
  39053. throw new RangeError("Attempt to allocate Buffer larger than maximum " +
  39054. "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
  39055. }
  39056. return length | 0;
  39057. }
  39058. function SlowBuffer(length) {
  39059. if (+length != length) { // eslint-disable-line eqeqeq
  39060. length = 0;
  39061. }
  39062. return Buffer.alloc(+length);
  39063. }
  39064. Buffer.isBuffer = function isBuffer(b) {
  39065. return !!(b != null && b._isBuffer);
  39066. };
  39067. Buffer.compare = function compare(a, b) {
  39068. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  39069. throw new TypeError("Arguments must be Buffers");
  39070. }
  39071. if (a === b) return 0;
  39072. var x = a.length;
  39073. var y = b.length;
  39074. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  39075. if (a[i] !== b[i]) {
  39076. x = a[i];
  39077. y = b[i];
  39078. break;
  39079. }
  39080. }
  39081. if (x < y) return -1;
  39082. if (y < x) return 1;
  39083. return 0;
  39084. };
  39085. Buffer.isEncoding = function isEncoding(encoding) {
  39086. switch (String(encoding).toLowerCase()) {
  39087. case "hex":
  39088. case "utf8":
  39089. case "utf-8":
  39090. case "ascii":
  39091. case "latin1":
  39092. case "binary":
  39093. case "base64":
  39094. case "ucs2":
  39095. case "ucs-2":
  39096. case "utf16le":
  39097. case "utf-16le":
  39098. return true;
  39099. default:
  39100. return false;
  39101. }
  39102. };
  39103. Buffer.concat = function concat(list, length) {
  39104. if (!Array.isArray(list)) {
  39105. throw new TypeError("\"list\" argument must be an Array of Buffers");
  39106. }
  39107. if (list.length === 0) {
  39108. return Buffer.alloc(0);
  39109. }
  39110. var i;
  39111. if (length === undefined) {
  39112. length = 0;
  39113. for (i = 0; i < list.length; ++i) {
  39114. length += list[i].length;
  39115. }
  39116. }
  39117. var buffer = Buffer.allocUnsafe(length);
  39118. var pos = 0;
  39119. for (i = 0; i < list.length; ++i) {
  39120. var buf = list[i];
  39121. if (!Buffer.isBuffer(buf)) {
  39122. throw new TypeError("\"list\" argument must be an Array of Buffers");
  39123. }
  39124. buf.copy(buffer, pos);
  39125. pos += buf.length;
  39126. }
  39127. return buffer;
  39128. };
  39129. function byteLength(string, encoding) {
  39130. if (Buffer.isBuffer(string)) {
  39131. return string.length;
  39132. }
  39133. if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" &&
  39134. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  39135. return string.byteLength;
  39136. }
  39137. if (typeof string !== "string") {
  39138. string = "" + string;
  39139. }
  39140. var len = string.length;
  39141. if (len === 0) return 0;
  39142. // Use a for loop to avoid recursion
  39143. var loweredCase = false;
  39144. for (;;) {
  39145. switch (encoding) {
  39146. case "ascii":
  39147. case "latin1":
  39148. case "binary":
  39149. return len;
  39150. case "utf8":
  39151. case "utf-8":
  39152. case undefined:
  39153. return utf8ToBytes(string).length;
  39154. case "ucs2":
  39155. case "ucs-2":
  39156. case "utf16le":
  39157. case "utf-16le":
  39158. return len * 2;
  39159. case "hex":
  39160. return len >>> 1;
  39161. case "base64":
  39162. return base64ToBytes(string).length;
  39163. default:
  39164. if (loweredCase) return utf8ToBytes(string).length; // assume utf8
  39165. encoding = ("" + encoding).toLowerCase();
  39166. loweredCase = true;
  39167. }
  39168. }
  39169. }
  39170. Buffer.byteLength = byteLength;
  39171. function slowToString(encoding, start, end) {
  39172. var loweredCase = false;
  39173. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  39174. // property of a typed array.
  39175. // This behaves neither like String nor Uint8Array in that we set start/end
  39176. // to their upper/lower bounds if the value passed is out of range.
  39177. // undefined is handled specially as per ECMA-262 6th Edition,
  39178. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  39179. if (start === undefined || start < 0) {
  39180. start = 0;
  39181. }
  39182. // Return early if start > this.length. Done here to prevent potential uint32
  39183. // coercion fail below.
  39184. if (start > this.length) {
  39185. return "";
  39186. }
  39187. if (end === undefined || end > this.length) {
  39188. end = this.length;
  39189. }
  39190. if (end <= 0) {
  39191. return "";
  39192. }
  39193. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  39194. end >>>= 0;
  39195. start >>>= 0;
  39196. if (end <= start) {
  39197. return "";
  39198. }
  39199. if (!encoding) encoding = "utf8";
  39200. while (true) {
  39201. switch (encoding) {
  39202. case "hex":
  39203. return hexSlice(this, start, end);
  39204. case "utf8":
  39205. case "utf-8":
  39206. return utf8Slice(this, start, end);
  39207. case "ascii":
  39208. return asciiSlice(this, start, end);
  39209. case "latin1":
  39210. case "binary":
  39211. return latin1Slice(this, start, end);
  39212. case "base64":
  39213. return base64Slice(this, start, end);
  39214. case "ucs2":
  39215. case "ucs-2":
  39216. case "utf16le":
  39217. case "utf-16le":
  39218. return utf16leSlice(this, start, end);
  39219. default:
  39220. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  39221. encoding = (encoding + "").toLowerCase();
  39222. loweredCase = true;
  39223. }
  39224. }
  39225. }
  39226. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  39227. // Buffer instances.
  39228. Buffer.prototype._isBuffer = true;
  39229. function swap(b, n, m) {
  39230. var i = b[n];
  39231. b[n] = b[m];
  39232. b[m] = i;
  39233. }
  39234. Buffer.prototype.swap16 = function swap16() {
  39235. var len = this.length;
  39236. if (len % 2 !== 0) {
  39237. throw new RangeError("Buffer size must be a multiple of 16-bits");
  39238. }
  39239. for (var i = 0; i < len; i += 2) {
  39240. swap(this, i, i + 1);
  39241. }
  39242. return this;
  39243. };
  39244. Buffer.prototype.swap32 = function swap32() {
  39245. var len = this.length;
  39246. if (len % 4 !== 0) {
  39247. throw new RangeError("Buffer size must be a multiple of 32-bits");
  39248. }
  39249. for (var i = 0; i < len; i += 4) {
  39250. swap(this, i, i + 3);
  39251. swap(this, i + 1, i + 2);
  39252. }
  39253. return this;
  39254. };
  39255. Buffer.prototype.swap64 = function swap64() {
  39256. var len = this.length;
  39257. if (len % 8 !== 0) {
  39258. throw new RangeError("Buffer size must be a multiple of 64-bits");
  39259. }
  39260. for (var i = 0; i < len; i += 8) {
  39261. swap(this, i, i + 7);
  39262. swap(this, i + 1, i + 6);
  39263. swap(this, i + 2, i + 5);
  39264. swap(this, i + 3, i + 4);
  39265. }
  39266. return this;
  39267. };
  39268. Buffer.prototype.toString = function toString() {
  39269. var length = this.length;
  39270. if (length === 0) return "";
  39271. if (arguments.length === 0) return utf8Slice(this, 0, length);
  39272. return slowToString.apply(this, arguments);
  39273. };
  39274. Buffer.prototype.equals = function equals(b) {
  39275. if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
  39276. if (this === b) return true;
  39277. return Buffer.compare(this, b) === 0;
  39278. };
  39279. Buffer.prototype.inspect = function inspect() {
  39280. var str = "";
  39281. var max = exports.INSPECT_MAX_BYTES;
  39282. if (this.length > 0) {
  39283. str = this.toString("hex", 0, max).match(/.{2}/g).join(" ");
  39284. if (this.length > max) str += " ... ";
  39285. }
  39286. return "<Buffer " + str + ">";
  39287. };
  39288. Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  39289. if (!Buffer.isBuffer(target)) {
  39290. throw new TypeError("Argument must be a Buffer");
  39291. }
  39292. if (start === undefined) {
  39293. start = 0;
  39294. }
  39295. if (end === undefined) {
  39296. end = target ? target.length : 0;
  39297. }
  39298. if (thisStart === undefined) {
  39299. thisStart = 0;
  39300. }
  39301. if (thisEnd === undefined) {
  39302. thisEnd = this.length;
  39303. }
  39304. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  39305. throw new RangeError("out of range index");
  39306. }
  39307. if (thisStart >= thisEnd && start >= end) {
  39308. return 0;
  39309. }
  39310. if (thisStart >= thisEnd) {
  39311. return -1;
  39312. }
  39313. if (start >= end) {
  39314. return 1;
  39315. }
  39316. start >>>= 0;
  39317. end >>>= 0;
  39318. thisStart >>>= 0;
  39319. thisEnd >>>= 0;
  39320. if (this === target) return 0;
  39321. var x = thisEnd - thisStart;
  39322. var y = end - start;
  39323. var len = Math.min(x, y);
  39324. var thisCopy = this.slice(thisStart, thisEnd);
  39325. var targetCopy = target.slice(start, end);
  39326. for (var i = 0; i < len; ++i) {
  39327. if (thisCopy[i] !== targetCopy[i]) {
  39328. x = thisCopy[i];
  39329. y = targetCopy[i];
  39330. break;
  39331. }
  39332. }
  39333. if (x < y) return -1;
  39334. if (y < x) return 1;
  39335. return 0;
  39336. };
  39337. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  39338. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  39339. //
  39340. // Arguments:
  39341. // - buffer - a Buffer to search
  39342. // - val - a string, Buffer, or number
  39343. // - byteOffset - an index into `buffer`; will be clamped to an int32
  39344. // - encoding - an optional encoding, relevant is val is a string
  39345. // - dir - true for indexOf, false for lastIndexOf
  39346. function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  39347. // Empty buffer means no match
  39348. if (buffer.length === 0) return -1;
  39349. // Normalize byteOffset
  39350. if (typeof byteOffset === "string") {
  39351. encoding = byteOffset;
  39352. byteOffset = 0;
  39353. } else if (byteOffset > 0x7fffffff) {
  39354. byteOffset = 0x7fffffff;
  39355. } else if (byteOffset < -0x80000000) {
  39356. byteOffset = -0x80000000;
  39357. }
  39358. byteOffset = +byteOffset; // Coerce to Number.
  39359. if (isNaN(byteOffset)) {
  39360. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  39361. byteOffset = dir ? 0 : (buffer.length - 1);
  39362. }
  39363. // Normalize byteOffset: negative offsets start from the end of the buffer
  39364. if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
  39365. if (byteOffset >= buffer.length) {
  39366. if (dir) return -1;
  39367. else byteOffset = buffer.length - 1;
  39368. } else if (byteOffset < 0) {
  39369. if (dir) byteOffset = 0;
  39370. else return -1;
  39371. }
  39372. // Normalize val
  39373. if (typeof val === "string") {
  39374. val = Buffer.from(val, encoding);
  39375. }
  39376. // Finally, search either indexOf (if dir is true) or lastIndexOf
  39377. if (Buffer.isBuffer(val)) {
  39378. // Special case: looking for empty string/buffer always fails
  39379. if (val.length === 0) {
  39380. return -1;
  39381. }
  39382. return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
  39383. } else if (typeof val === "number") {
  39384. val = val & 0xFF; // Search for a byte value [0-255]
  39385. if (typeof Uint8Array.prototype.indexOf === "function") {
  39386. if (dir) {
  39387. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
  39388. } else {
  39389. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
  39390. }
  39391. }
  39392. return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
  39393. }
  39394. throw new TypeError("val must be string, number or Buffer");
  39395. }
  39396. function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  39397. var indexSize = 1;
  39398. var arrLength = arr.length;
  39399. var valLength = val.length;
  39400. if (encoding !== undefined) {
  39401. encoding = String(encoding).toLowerCase();
  39402. if (encoding === "ucs2" || encoding === "ucs-2" ||
  39403. encoding === "utf16le" || encoding === "utf-16le") {
  39404. if (arr.length < 2 || val.length < 2) {
  39405. return -1;
  39406. }
  39407. indexSize = 2;
  39408. arrLength /= 2;
  39409. valLength /= 2;
  39410. byteOffset /= 2;
  39411. }
  39412. }
  39413. function read(buf, i) {
  39414. if (indexSize === 1) {
  39415. return buf[i];
  39416. } else {
  39417. return buf.readUInt16BE(i * indexSize);
  39418. }
  39419. }
  39420. var i;
  39421. if (dir) {
  39422. var foundIndex = -1;
  39423. for (i = byteOffset; i < arrLength; i++) {
  39424. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  39425. if (foundIndex === -1) foundIndex = i;
  39426. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
  39427. } else {
  39428. if (foundIndex !== -1) i -= i - foundIndex;
  39429. foundIndex = -1;
  39430. }
  39431. }
  39432. } else {
  39433. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
  39434. for (i = byteOffset; i >= 0; i--) {
  39435. var found = true;
  39436. for (var j = 0; j < valLength; j++) {
  39437. if (read(arr, i + j) !== read(val, j)) {
  39438. found = false;
  39439. break;
  39440. }
  39441. }
  39442. if (found) return i;
  39443. }
  39444. }
  39445. return -1;
  39446. }
  39447. Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  39448. return this.indexOf(val, byteOffset, encoding) !== -1;
  39449. };
  39450. Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  39451. return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
  39452. };
  39453. Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  39454. return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
  39455. };
  39456. function hexWrite(buf, string, offset, length) {
  39457. offset = Number(offset) || 0;
  39458. var remaining = buf.length - offset;
  39459. if (!length) {
  39460. length = remaining;
  39461. } else {
  39462. length = Number(length);
  39463. if (length > remaining) {
  39464. length = remaining;
  39465. }
  39466. }
  39467. // must be an even number of digits
  39468. var strLen = string.length;
  39469. if (strLen % 2 !== 0) throw new TypeError("Invalid hex string");
  39470. if (length > strLen / 2) {
  39471. length = strLen / 2;
  39472. }
  39473. for (var i = 0; i < length; ++i) {
  39474. var parsed = parseInt(string.substr(i * 2, 2), 16);
  39475. if (isNaN(parsed)) return i;
  39476. buf[offset + i] = parsed;
  39477. }
  39478. return i;
  39479. }
  39480. function utf8Write(buf, string, offset, length) {
  39481. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
  39482. }
  39483. function asciiWrite(buf, string, offset, length) {
  39484. return blitBuffer(asciiToBytes(string), buf, offset, length);
  39485. }
  39486. function latin1Write(buf, string, offset, length) {
  39487. return asciiWrite(buf, string, offset, length);
  39488. }
  39489. function base64Write(buf, string, offset, length) {
  39490. return blitBuffer(base64ToBytes(string), buf, offset, length);
  39491. }
  39492. function ucs2Write(buf, string, offset, length) {
  39493. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
  39494. }
  39495. Buffer.prototype.write = function write(string, offset, length, encoding) {
  39496. // Buffer#write(string)
  39497. if (offset === undefined) {
  39498. encoding = "utf8";
  39499. length = this.length;
  39500. offset = 0;
  39501. // Buffer#write(string, encoding)
  39502. } else if (length === undefined && typeof offset === "string") {
  39503. encoding = offset;
  39504. length = this.length;
  39505. offset = 0;
  39506. // Buffer#write(string, offset[, length][, encoding])
  39507. } else if (isFinite(offset)) {
  39508. offset = offset >>> 0;
  39509. if (isFinite(length)) {
  39510. length = length >>> 0;
  39511. if (encoding === undefined) encoding = "utf8";
  39512. } else {
  39513. encoding = length;
  39514. length = undefined;
  39515. }
  39516. // legacy write(string, encoding, offset, length) - remove in v0.13
  39517. } else {
  39518. throw new Error(
  39519. "Buffer.write(string, encoding, offset[, length]) is no longer supported"
  39520. );
  39521. }
  39522. var remaining = this.length - offset;
  39523. if (length === undefined || length > remaining) length = remaining;
  39524. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  39525. throw new RangeError("Attempt to write outside buffer bounds");
  39526. }
  39527. if (!encoding) encoding = "utf8";
  39528. var loweredCase = false;
  39529. for (;;) {
  39530. switch (encoding) {
  39531. case "hex":
  39532. return hexWrite(this, string, offset, length);
  39533. case "utf8":
  39534. case "utf-8":
  39535. return utf8Write(this, string, offset, length);
  39536. case "ascii":
  39537. return asciiWrite(this, string, offset, length);
  39538. case "latin1":
  39539. case "binary":
  39540. return latin1Write(this, string, offset, length);
  39541. case "base64":
  39542. // Warning: maxLength not taken into account in base64Write
  39543. return base64Write(this, string, offset, length);
  39544. case "ucs2":
  39545. case "ucs-2":
  39546. case "utf16le":
  39547. case "utf-16le":
  39548. return ucs2Write(this, string, offset, length);
  39549. default:
  39550. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  39551. encoding = ("" + encoding).toLowerCase();
  39552. loweredCase = true;
  39553. }
  39554. }
  39555. };
  39556. Buffer.prototype.toJSON = function toJSON() {
  39557. return {
  39558. type: "Buffer",
  39559. data: Array.prototype.slice.call(this._arr || this, 0),
  39560. };
  39561. };
  39562. function base64Slice(buf, start, end) {
  39563. if (start === 0 && end === buf.length) {
  39564. return base64.fromByteArray(buf);
  39565. } else {
  39566. return base64.fromByteArray(buf.slice(start, end));
  39567. }
  39568. }
  39569. function utf8Slice(buf, start, end) {
  39570. end = Math.min(buf.length, end);
  39571. var res = [];
  39572. var i = start;
  39573. while (i < end) {
  39574. var firstByte = buf[i];
  39575. var codePoint = null;
  39576. var bytesPerSequence = (firstByte > 0xEF) ? 4 :
  39577. (firstByte > 0xDF) ? 3 :
  39578. (firstByte > 0xBF) ? 2 :
  39579. 1;
  39580. if (i + bytesPerSequence <= end) {
  39581. var secondByte, thirdByte, fourthByte, tempCodePoint;
  39582. switch (bytesPerSequence) {
  39583. case 1:
  39584. if (firstByte < 0x80) {
  39585. codePoint = firstByte;
  39586. }
  39587. break;
  39588. case 2:
  39589. secondByte = buf[i + 1];
  39590. if ((secondByte & 0xC0) === 0x80) {
  39591. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
  39592. if (tempCodePoint > 0x7F) {
  39593. codePoint = tempCodePoint;
  39594. }
  39595. }
  39596. break;
  39597. case 3:
  39598. secondByte = buf[i + 1];
  39599. thirdByte = buf[i + 2];
  39600. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  39601. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
  39602. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  39603. codePoint = tempCodePoint;
  39604. }
  39605. }
  39606. break;
  39607. case 4:
  39608. secondByte = buf[i + 1];
  39609. thirdByte = buf[i + 2];
  39610. fourthByte = buf[i + 3];
  39611. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  39612. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
  39613. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  39614. codePoint = tempCodePoint;
  39615. }
  39616. }
  39617. }
  39618. }
  39619. if (codePoint === null) {
  39620. // we did not generate a valid codePoint so insert a
  39621. // replacement char (U+FFFD) and advance only 1 byte
  39622. codePoint = 0xFFFD;
  39623. bytesPerSequence = 1;
  39624. } else if (codePoint > 0xFFFF) {
  39625. // encode to utf16 (surrogate pair dance)
  39626. codePoint -= 0x10000;
  39627. res.push(codePoint >>> 10 & 0x3FF | 0xD800);
  39628. codePoint = 0xDC00 | codePoint & 0x3FF;
  39629. }
  39630. res.push(codePoint);
  39631. i += bytesPerSequence;
  39632. }
  39633. return decodeCodePointsArray(res);
  39634. }
  39635. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  39636. // the lowest limit is Chrome, with 0x10000 args.
  39637. // We go 1 magnitude less, for safety
  39638. var MAX_ARGUMENTS_LENGTH = 0x1000;
  39639. function decodeCodePointsArray(codePoints) {
  39640. var len = codePoints.length;
  39641. if (len <= MAX_ARGUMENTS_LENGTH) {
  39642. return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
  39643. }
  39644. // Decode in chunks to avoid "call stack size exceeded".
  39645. var res = "";
  39646. var i = 0;
  39647. while (i < len) {
  39648. res += String.fromCharCode.apply(
  39649. String,
  39650. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  39651. );
  39652. }
  39653. return res;
  39654. }
  39655. function asciiSlice(buf, start, end) {
  39656. var ret = "";
  39657. end = Math.min(buf.length, end);
  39658. for (var i = start; i < end; ++i) {
  39659. ret += String.fromCharCode(buf[i] & 0x7F);
  39660. }
  39661. return ret;
  39662. }
  39663. function latin1Slice(buf, start, end) {
  39664. var ret = "";
  39665. end = Math.min(buf.length, end);
  39666. for (var i = start; i < end; ++i) {
  39667. ret += String.fromCharCode(buf[i]);
  39668. }
  39669. return ret;
  39670. }
  39671. function hexSlice(buf, start, end) {
  39672. var len = buf.length;
  39673. if (!start || start < 0) start = 0;
  39674. if (!end || end < 0 || end > len) end = len;
  39675. var out = "";
  39676. for (var i = start; i < end; ++i) {
  39677. out += toHex(buf[i]);
  39678. }
  39679. return out;
  39680. }
  39681. function utf16leSlice(buf, start, end) {
  39682. var bytes = buf.slice(start, end);
  39683. var res = "";
  39684. for (var i = 0; i < bytes.length; i += 2) {
  39685. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
  39686. }
  39687. return res;
  39688. }
  39689. Buffer.prototype.slice = function slice(start, end) {
  39690. var len = this.length;
  39691. start = ~~start;
  39692. end = end === undefined ? len : ~~end;
  39693. if (start < 0) {
  39694. start += len;
  39695. if (start < 0) start = 0;
  39696. } else if (start > len) {
  39697. start = len;
  39698. }
  39699. if (end < 0) {
  39700. end += len;
  39701. if (end < 0) end = 0;
  39702. } else if (end > len) {
  39703. end = len;
  39704. }
  39705. if (end < start) end = start;
  39706. var newBuf = this.subarray(start, end);
  39707. // Return an augmented `Uint8Array` instance
  39708. newBuf.__proto__ = Buffer.prototype;
  39709. return newBuf;
  39710. };
  39711. /*
  39712. * Need to make sure that buffer isn't trying to write out of bounds.
  39713. */
  39714. function checkOffset(offset, ext, length) {
  39715. if ((offset % 1) !== 0 || offset < 0) throw new RangeError("offset is not uint");
  39716. if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
  39717. }
  39718. Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  39719. offset = offset >>> 0;
  39720. byteLength = byteLength >>> 0;
  39721. if (!noAssert) checkOffset(offset, byteLength, this.length);
  39722. var val = this[offset];
  39723. var mul = 1;
  39724. var i = 0;
  39725. while (++i < byteLength && (mul *= 0x100)) {
  39726. val += this[offset + i] * mul;
  39727. }
  39728. return val;
  39729. };
  39730. Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  39731. offset = offset >>> 0;
  39732. byteLength = byteLength >>> 0;
  39733. if (!noAssert) {
  39734. checkOffset(offset, byteLength, this.length);
  39735. }
  39736. var val = this[offset + --byteLength];
  39737. var mul = 1;
  39738. while (byteLength > 0 && (mul *= 0x100)) {
  39739. val += this[offset + --byteLength] * mul;
  39740. }
  39741. return val;
  39742. };
  39743. Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  39744. offset = offset >>> 0;
  39745. if (!noAssert) checkOffset(offset, 1, this.length);
  39746. return this[offset];
  39747. };
  39748. Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  39749. offset = offset >>> 0;
  39750. if (!noAssert) checkOffset(offset, 2, this.length);
  39751. return this[offset] | (this[offset + 1] << 8);
  39752. };
  39753. Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  39754. offset = offset >>> 0;
  39755. if (!noAssert) checkOffset(offset, 2, this.length);
  39756. return (this[offset] << 8) | this[offset + 1];
  39757. };
  39758. Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  39759. offset = offset >>> 0;
  39760. if (!noAssert) checkOffset(offset, 4, this.length);
  39761. return ((this[offset]) |
  39762. (this[offset + 1] << 8) |
  39763. (this[offset + 2] << 16)) +
  39764. (this[offset + 3] * 0x1000000);
  39765. };
  39766. Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  39767. offset = offset >>> 0;
  39768. if (!noAssert) checkOffset(offset, 4, this.length);
  39769. return (this[offset] * 0x1000000) +
  39770. ((this[offset + 1] << 16) |
  39771. (this[offset + 2] << 8) |
  39772. this[offset + 3]);
  39773. };
  39774. Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  39775. offset = offset >>> 0;
  39776. byteLength = byteLength >>> 0;
  39777. if (!noAssert) checkOffset(offset, byteLength, this.length);
  39778. var val = this[offset];
  39779. var mul = 1;
  39780. var i = 0;
  39781. while (++i < byteLength && (mul *= 0x100)) {
  39782. val += this[offset + i] * mul;
  39783. }
  39784. mul *= 0x80;
  39785. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  39786. return val;
  39787. };
  39788. Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  39789. offset = offset >>> 0;
  39790. byteLength = byteLength >>> 0;
  39791. if (!noAssert) checkOffset(offset, byteLength, this.length);
  39792. var i = byteLength;
  39793. var mul = 1;
  39794. var val = this[offset + --i];
  39795. while (i > 0 && (mul *= 0x100)) {
  39796. val += this[offset + --i] * mul;
  39797. }
  39798. mul *= 0x80;
  39799. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  39800. return val;
  39801. };
  39802. Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  39803. offset = offset >>> 0;
  39804. if (!noAssert) checkOffset(offset, 1, this.length);
  39805. if (!(this[offset] & 0x80)) return (this[offset]);
  39806. return ((0xff - this[offset] + 1) * -1);
  39807. };
  39808. Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  39809. offset = offset >>> 0;
  39810. if (!noAssert) checkOffset(offset, 2, this.length);
  39811. var val = this[offset] | (this[offset + 1] << 8);
  39812. return (val & 0x8000) ? val | 0xFFFF0000 : val;
  39813. };
  39814. Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  39815. offset = offset >>> 0;
  39816. if (!noAssert) checkOffset(offset, 2, this.length);
  39817. var val = this[offset + 1] | (this[offset] << 8);
  39818. return (val & 0x8000) ? val | 0xFFFF0000 : val;
  39819. };
  39820. Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  39821. offset = offset >>> 0;
  39822. if (!noAssert) checkOffset(offset, 4, this.length);
  39823. return (this[offset]) |
  39824. (this[offset + 1] << 8) |
  39825. (this[offset + 2] << 16) |
  39826. (this[offset + 3] << 24);
  39827. };
  39828. Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  39829. offset = offset >>> 0;
  39830. if (!noAssert) checkOffset(offset, 4, this.length);
  39831. return (this[offset] << 24) |
  39832. (this[offset + 1] << 16) |
  39833. (this[offset + 2] << 8) |
  39834. (this[offset + 3]);
  39835. };
  39836. Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  39837. offset = offset >>> 0;
  39838. if (!noAssert) checkOffset(offset, 4, this.length);
  39839. return ieee754.read(this, offset, true, 23, 4);
  39840. };
  39841. Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  39842. offset = offset >>> 0;
  39843. if (!noAssert) checkOffset(offset, 4, this.length);
  39844. return ieee754.read(this, offset, false, 23, 4);
  39845. };
  39846. Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  39847. offset = offset >>> 0;
  39848. if (!noAssert) checkOffset(offset, 8, this.length);
  39849. return ieee754.read(this, offset, true, 52, 8);
  39850. };
  39851. Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  39852. offset = offset >>> 0;
  39853. if (!noAssert) checkOffset(offset, 8, this.length);
  39854. return ieee754.read(this, offset, false, 52, 8);
  39855. };
  39856. function checkInt(buf, value, offset, ext, max, min) {
  39857. if (!Buffer.isBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
  39858. if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
  39859. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  39860. }
  39861. Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  39862. value = +value;
  39863. offset = offset >>> 0;
  39864. byteLength = byteLength >>> 0;
  39865. if (!noAssert) {
  39866. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  39867. checkInt(this, value, offset, byteLength, maxBytes, 0);
  39868. }
  39869. var mul = 1;
  39870. var i = 0;
  39871. this[offset] = value & 0xFF;
  39872. while (++i < byteLength && (mul *= 0x100)) {
  39873. this[offset + i] = (value / mul) & 0xFF;
  39874. }
  39875. return offset + byteLength;
  39876. };
  39877. Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  39878. value = +value;
  39879. offset = offset >>> 0;
  39880. byteLength = byteLength >>> 0;
  39881. if (!noAssert) {
  39882. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  39883. checkInt(this, value, offset, byteLength, maxBytes, 0);
  39884. }
  39885. var i = byteLength - 1;
  39886. var mul = 1;
  39887. this[offset + i] = value & 0xFF;
  39888. while (--i >= 0 && (mul *= 0x100)) {
  39889. this[offset + i] = (value / mul) & 0xFF;
  39890. }
  39891. return offset + byteLength;
  39892. };
  39893. Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  39894. value = +value;
  39895. offset = offset >>> 0;
  39896. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
  39897. this[offset] = (value & 0xff);
  39898. return offset + 1;
  39899. };
  39900. Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  39901. value = +value;
  39902. offset = offset >>> 0;
  39903. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  39904. this[offset] = (value & 0xff);
  39905. this[offset + 1] = (value >>> 8);
  39906. return offset + 2;
  39907. };
  39908. Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  39909. value = +value;
  39910. offset = offset >>> 0;
  39911. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  39912. this[offset] = (value >>> 8);
  39913. this[offset + 1] = (value & 0xff);
  39914. return offset + 2;
  39915. };
  39916. Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  39917. value = +value;
  39918. offset = offset >>> 0;
  39919. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  39920. this[offset + 3] = (value >>> 24);
  39921. this[offset + 2] = (value >>> 16);
  39922. this[offset + 1] = (value >>> 8);
  39923. this[offset] = (value & 0xff);
  39924. return offset + 4;
  39925. };
  39926. Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  39927. value = +value;
  39928. offset = offset >>> 0;
  39929. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  39930. this[offset] = (value >>> 24);
  39931. this[offset + 1] = (value >>> 16);
  39932. this[offset + 2] = (value >>> 8);
  39933. this[offset + 3] = (value & 0xff);
  39934. return offset + 4;
  39935. };
  39936. Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  39937. value = +value;
  39938. offset = offset >>> 0;
  39939. if (!noAssert) {
  39940. var limit = Math.pow(2, 8 * byteLength - 1);
  39941. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  39942. }
  39943. var i = 0;
  39944. var mul = 1;
  39945. var sub = 0;
  39946. this[offset] = value & 0xFF;
  39947. while (++i < byteLength && (mul *= 0x100)) {
  39948. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  39949. sub = 1;
  39950. }
  39951. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
  39952. }
  39953. return offset + byteLength;
  39954. };
  39955. Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  39956. value = +value;
  39957. offset = offset >>> 0;
  39958. if (!noAssert) {
  39959. var limit = Math.pow(2, 8 * byteLength - 1);
  39960. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  39961. }
  39962. var i = byteLength - 1;
  39963. var mul = 1;
  39964. var sub = 0;
  39965. this[offset + i] = value & 0xFF;
  39966. while (--i >= 0 && (mul *= 0x100)) {
  39967. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  39968. sub = 1;
  39969. }
  39970. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
  39971. }
  39972. return offset + byteLength;
  39973. };
  39974. Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  39975. value = +value;
  39976. offset = offset >>> 0;
  39977. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
  39978. if (value < 0) value = 0xff + value + 1;
  39979. this[offset] = (value & 0xff);
  39980. return offset + 1;
  39981. };
  39982. Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  39983. value = +value;
  39984. offset = offset >>> 0;
  39985. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  39986. this[offset] = (value & 0xff);
  39987. this[offset + 1] = (value >>> 8);
  39988. return offset + 2;
  39989. };
  39990. Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  39991. value = +value;
  39992. offset = offset >>> 0;
  39993. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  39994. this[offset] = (value >>> 8);
  39995. this[offset + 1] = (value & 0xff);
  39996. return offset + 2;
  39997. };
  39998. Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  39999. value = +value;
  40000. offset = offset >>> 0;
  40001. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  40002. this[offset] = (value & 0xff);
  40003. this[offset + 1] = (value >>> 8);
  40004. this[offset + 2] = (value >>> 16);
  40005. this[offset + 3] = (value >>> 24);
  40006. return offset + 4;
  40007. };
  40008. Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  40009. value = +value;
  40010. offset = offset >>> 0;
  40011. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  40012. if (value < 0) value = 0xffffffff + value + 1;
  40013. this[offset] = (value >>> 24);
  40014. this[offset + 1] = (value >>> 16);
  40015. this[offset + 2] = (value >>> 8);
  40016. this[offset + 3] = (value & 0xff);
  40017. return offset + 4;
  40018. };
  40019. function checkIEEE754(buf, value, offset, ext, max, min) {
  40020. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  40021. if (offset < 0) throw new RangeError("Index out of range");
  40022. }
  40023. function writeFloat(buf, value, offset, littleEndian, noAssert) {
  40024. value = +value;
  40025. offset = offset >>> 0;
  40026. if (!noAssert) {
  40027. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
  40028. }
  40029. ieee754.write(buf, value, offset, littleEndian, 23, 4);
  40030. return offset + 4;
  40031. }
  40032. Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  40033. return writeFloat(this, value, offset, true, noAssert);
  40034. };
  40035. Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  40036. return writeFloat(this, value, offset, false, noAssert);
  40037. };
  40038. function writeDouble(buf, value, offset, littleEndian, noAssert) {
  40039. value = +value;
  40040. offset = offset >>> 0;
  40041. if (!noAssert) {
  40042. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
  40043. }
  40044. ieee754.write(buf, value, offset, littleEndian, 52, 8);
  40045. return offset + 8;
  40046. }
  40047. Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  40048. return writeDouble(this, value, offset, true, noAssert);
  40049. };
  40050. Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  40051. return writeDouble(this, value, offset, false, noAssert);
  40052. };
  40053. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  40054. Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  40055. if (!start) start = 0;
  40056. if (!end && end !== 0) end = this.length;
  40057. if (targetStart >= target.length) targetStart = target.length;
  40058. if (!targetStart) targetStart = 0;
  40059. if (end > 0 && end < start) end = start;
  40060. // Copy 0 bytes; we're done
  40061. if (end === start) return 0;
  40062. if (target.length === 0 || this.length === 0) return 0;
  40063. // Fatal error conditions
  40064. if (targetStart < 0) {
  40065. throw new RangeError("targetStart out of bounds");
  40066. }
  40067. if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds");
  40068. if (end < 0) throw new RangeError("sourceEnd out of bounds");
  40069. // Are we oob?
  40070. if (end > this.length) end = this.length;
  40071. if (target.length - targetStart < end - start) {
  40072. end = target.length - targetStart + start;
  40073. }
  40074. var len = end - start;
  40075. var i;
  40076. if (this === target && start < targetStart && targetStart < end) {
  40077. // descending copy from end
  40078. for (i = len - 1; i >= 0; --i) {
  40079. target[i + targetStart] = this[i + start];
  40080. }
  40081. } else if (len < 1000) {
  40082. // ascending copy from start
  40083. for (i = 0; i < len; ++i) {
  40084. target[i + targetStart] = this[i + start];
  40085. }
  40086. } else {
  40087. Uint8Array.prototype.set.call(
  40088. target,
  40089. this.subarray(start, start + len),
  40090. targetStart
  40091. );
  40092. }
  40093. return len;
  40094. };
  40095. // Usage:
  40096. // buffer.fill(number[, offset[, end]])
  40097. // buffer.fill(buffer[, offset[, end]])
  40098. // buffer.fill(string[, offset[, end]][, encoding])
  40099. Buffer.prototype.fill = function fill(val, start, end, encoding) {
  40100. // Handle string cases:
  40101. if (typeof val === "string") {
  40102. if (typeof start === "string") {
  40103. encoding = start;
  40104. start = 0;
  40105. end = this.length;
  40106. } else if (typeof end === "string") {
  40107. encoding = end;
  40108. end = this.length;
  40109. }
  40110. if (val.length === 1) {
  40111. var code = val.charCodeAt(0);
  40112. if (code < 256) {
  40113. val = code;
  40114. }
  40115. }
  40116. if (encoding !== undefined && typeof encoding !== "string") {
  40117. throw new TypeError("encoding must be a string");
  40118. }
  40119. if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
  40120. throw new TypeError("Unknown encoding: " + encoding);
  40121. }
  40122. } else if (typeof val === "number") {
  40123. val = val & 255;
  40124. }
  40125. // Invalid ranges are not set to a default, so can range check early.
  40126. if (start < 0 || this.length < start || this.length < end) {
  40127. throw new RangeError("Out of range index");
  40128. }
  40129. if (end <= start) {
  40130. return this;
  40131. }
  40132. start = start >>> 0;
  40133. end = end === undefined ? this.length : end >>> 0;
  40134. if (!val) val = 0;
  40135. var i;
  40136. if (typeof val === "number") {
  40137. for (i = start; i < end; ++i) {
  40138. this[i] = val;
  40139. }
  40140. } else {
  40141. var bytes = Buffer.isBuffer(val) ?
  40142. val :
  40143. new Buffer(val, encoding);
  40144. var len = bytes.length;
  40145. for (i = 0; i < end - start; ++i) {
  40146. this[i + start] = bytes[i % len];
  40147. }
  40148. }
  40149. return this;
  40150. };
  40151. // HELPER FUNCTIONS
  40152. // ================
  40153. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
  40154. function base64clean(str) {
  40155. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  40156. str = stringtrim(str).replace(INVALID_BASE64_RE, "");
  40157. // Node converts strings with length < 2 to ''
  40158. if (str.length < 2) return "";
  40159. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  40160. while (str.length % 4 !== 0) {
  40161. str = str + "=";
  40162. }
  40163. return str;
  40164. }
  40165. function stringtrim(str) {
  40166. if (str.trim) return str.trim();
  40167. return str.replace(/^\s+|\s+$/g, "");
  40168. }
  40169. function toHex(n) {
  40170. if (n < 16) return "0" + n.toString(16);
  40171. return n.toString(16);
  40172. }
  40173. function utf8ToBytes(string, units) {
  40174. units = units || Infinity;
  40175. var codePoint;
  40176. var length = string.length;
  40177. var leadSurrogate = null;
  40178. var bytes = [];
  40179. for (var i = 0; i < length; ++i) {
  40180. codePoint = string.charCodeAt(i);
  40181. // is surrogate component
  40182. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  40183. // last char was a lead
  40184. if (!leadSurrogate) {
  40185. // no lead yet
  40186. if (codePoint > 0xDBFF) {
  40187. // unexpected trail
  40188. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  40189. continue;
  40190. } else if (i + 1 === length) {
  40191. // unpaired lead
  40192. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  40193. continue;
  40194. }
  40195. // valid lead
  40196. leadSurrogate = codePoint;
  40197. continue;
  40198. }
  40199. // 2 leads in a row
  40200. if (codePoint < 0xDC00) {
  40201. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  40202. leadSurrogate = codePoint;
  40203. continue;
  40204. }
  40205. // valid surrogate pair
  40206. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
  40207. } else if (leadSurrogate) {
  40208. // valid bmp char, but last char was a lead
  40209. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  40210. }
  40211. leadSurrogate = null;
  40212. // encode utf8
  40213. if (codePoint < 0x80) {
  40214. if ((units -= 1) < 0) break;
  40215. bytes.push(codePoint);
  40216. } else if (codePoint < 0x800) {
  40217. if ((units -= 2) < 0) break;
  40218. bytes.push(
  40219. codePoint >> 0x6 | 0xC0,
  40220. codePoint & 0x3F | 0x80
  40221. );
  40222. } else if (codePoint < 0x10000) {
  40223. if ((units -= 3) < 0) break;
  40224. bytes.push(
  40225. codePoint >> 0xC | 0xE0,
  40226. codePoint >> 0x6 & 0x3F | 0x80,
  40227. codePoint & 0x3F | 0x80
  40228. );
  40229. } else if (codePoint < 0x110000) {
  40230. if ((units -= 4) < 0) break;
  40231. bytes.push(
  40232. codePoint >> 0x12 | 0xF0,
  40233. codePoint >> 0xC & 0x3F | 0x80,
  40234. codePoint >> 0x6 & 0x3F | 0x80,
  40235. codePoint & 0x3F | 0x80
  40236. );
  40237. } else {
  40238. throw new Error("Invalid code point");
  40239. }
  40240. }
  40241. return bytes;
  40242. }
  40243. function asciiToBytes(str) {
  40244. var byteArray = [];
  40245. for (var i = 0; i < str.length; ++i) {
  40246. // Node's code seems to be doing this and not & 0x7F..
  40247. byteArray.push(str.charCodeAt(i) & 0xFF);
  40248. }
  40249. return byteArray;
  40250. }
  40251. function utf16leToBytes(str, units) {
  40252. var c, hi, lo;
  40253. var byteArray = [];
  40254. for (var i = 0; i < str.length; ++i) {
  40255. if ((units -= 2) < 0) break;
  40256. c = str.charCodeAt(i);
  40257. hi = c >> 8;
  40258. lo = c % 256;
  40259. byteArray.push(lo);
  40260. byteArray.push(hi);
  40261. }
  40262. return byteArray;
  40263. }
  40264. function base64ToBytes(str) {
  40265. return base64.toByteArray(base64clean(str));
  40266. }
  40267. function blitBuffer(src, dst, offset, length) {
  40268. for (var i = 0; i < length; ++i) {
  40269. if ((i + offset >= dst.length) || (i >= src.length)) break;
  40270. dst[i + offset] = src[i];
  40271. }
  40272. return i;
  40273. }
  40274. function isnan(val) {
  40275. return val !== val; // eslint-disable-line no-self-compare
  40276. }
  40277. }
  40278. });
  40279. return ___scope___.entry = "index.js";
  40280. });
  40281. FuseBox.pkg("base64-js", {}, function(___scope___){
  40282. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  40283. 'use strict'
  40284. exports.byteLength = byteLength
  40285. exports.toByteArray = toByteArray
  40286. exports.fromByteArray = fromByteArray
  40287. var lookup = []
  40288. var revLookup = []
  40289. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  40290. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  40291. for (var i = 0, len = code.length; i < len; ++i) {
  40292. lookup[i] = code[i]
  40293. revLookup[code.charCodeAt(i)] = i
  40294. }
  40295. revLookup['-'.charCodeAt(0)] = 62
  40296. revLookup['_'.charCodeAt(0)] = 63
  40297. function placeHoldersCount (b64) {
  40298. var len = b64.length
  40299. if (len % 4 > 0) {
  40300. throw new Error('Invalid string. Length must be a multiple of 4')
  40301. }
  40302. // the number of equal signs (place holders)
  40303. // if there are two placeholders, than the two characters before it
  40304. // represent one byte
  40305. // if there is only one, then the three characters before it represent 2 bytes
  40306. // this is just a cheap hack to not do indexOf twice
  40307. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  40308. }
  40309. function byteLength (b64) {
  40310. // base64 is 4/3 + up to two characters of the original data
  40311. return b64.length * 3 / 4 - placeHoldersCount(b64)
  40312. }
  40313. function toByteArray (b64) {
  40314. var i, j, l, tmp, placeHolders, arr
  40315. var len = b64.length
  40316. placeHolders = placeHoldersCount(b64)
  40317. arr = new Arr(len * 3 / 4 - placeHolders)
  40318. // if there are placeholders, only get up to the last complete 4 chars
  40319. l = placeHolders > 0 ? len - 4 : len
  40320. var L = 0
  40321. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  40322. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  40323. arr[L++] = (tmp >> 16) & 0xFF
  40324. arr[L++] = (tmp >> 8) & 0xFF
  40325. arr[L++] = tmp & 0xFF
  40326. }
  40327. if (placeHolders === 2) {
  40328. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  40329. arr[L++] = tmp & 0xFF
  40330. } else if (placeHolders === 1) {
  40331. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  40332. arr[L++] = (tmp >> 8) & 0xFF
  40333. arr[L++] = tmp & 0xFF
  40334. }
  40335. return arr
  40336. }
  40337. function tripletToBase64 (num) {
  40338. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  40339. }
  40340. function encodeChunk (uint8, start, end) {
  40341. var tmp
  40342. var output = []
  40343. for (var i = start; i < end; i += 3) {
  40344. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  40345. output.push(tripletToBase64(tmp))
  40346. }
  40347. return output.join('')
  40348. }
  40349. function fromByteArray (uint8) {
  40350. var tmp
  40351. var len = uint8.length
  40352. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  40353. var output = ''
  40354. var parts = []
  40355. var maxChunkLength = 16383 // must be multiple of 3
  40356. // go through the array every three bytes, we'll deal with trailing stuff later
  40357. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  40358. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  40359. }
  40360. // pad the end with zeros, but make sure to not forget the extra bytes
  40361. if (extraBytes === 1) {
  40362. tmp = uint8[len - 1]
  40363. output += lookup[tmp >> 2]
  40364. output += lookup[(tmp << 4) & 0x3F]
  40365. output += '=='
  40366. } else if (extraBytes === 2) {
  40367. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  40368. output += lookup[tmp >> 10]
  40369. output += lookup[(tmp >> 4) & 0x3F]
  40370. output += lookup[(tmp << 2) & 0x3F]
  40371. output += '='
  40372. }
  40373. parts.push(output)
  40374. return parts.join('')
  40375. }
  40376. });
  40377. return ___scope___.entry = "index.js";
  40378. });
  40379. FuseBox.pkg("ieee754", {}, function(___scope___){
  40380. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  40381. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  40382. var e, m
  40383. var eLen = nBytes * 8 - mLen - 1
  40384. var eMax = (1 << eLen) - 1
  40385. var eBias = eMax >> 1
  40386. var nBits = -7
  40387. var i = isLE ? (nBytes - 1) : 0
  40388. var d = isLE ? -1 : 1
  40389. var s = buffer[offset + i]
  40390. i += d
  40391. e = s & ((1 << (-nBits)) - 1)
  40392. s >>= (-nBits)
  40393. nBits += eLen
  40394. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  40395. m = e & ((1 << (-nBits)) - 1)
  40396. e >>= (-nBits)
  40397. nBits += mLen
  40398. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  40399. if (e === 0) {
  40400. e = 1 - eBias
  40401. } else if (e === eMax) {
  40402. return m ? NaN : ((s ? -1 : 1) * Infinity)
  40403. } else {
  40404. m = m + Math.pow(2, mLen)
  40405. e = e - eBias
  40406. }
  40407. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  40408. }
  40409. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  40410. var e, m, c
  40411. var eLen = nBytes * 8 - mLen - 1
  40412. var eMax = (1 << eLen) - 1
  40413. var eBias = eMax >> 1
  40414. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  40415. var i = isLE ? 0 : (nBytes - 1)
  40416. var d = isLE ? 1 : -1
  40417. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  40418. value = Math.abs(value)
  40419. if (isNaN(value) || value === Infinity) {
  40420. m = isNaN(value) ? 1 : 0
  40421. e = eMax
  40422. } else {
  40423. e = Math.floor(Math.log(value) / Math.LN2)
  40424. if (value * (c = Math.pow(2, -e)) < 1) {
  40425. e--
  40426. c *= 2
  40427. }
  40428. if (e + eBias >= 1) {
  40429. value += rt / c
  40430. } else {
  40431. value += rt * Math.pow(2, 1 - eBias)
  40432. }
  40433. if (value * c >= 2) {
  40434. e++
  40435. c /= 2
  40436. }
  40437. if (e + eBias >= eMax) {
  40438. m = 0
  40439. e = eMax
  40440. } else if (e + eBias >= 1) {
  40441. m = (value * c - 1) * Math.pow(2, mLen)
  40442. e = e + eBias
  40443. } else {
  40444. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  40445. e = 0
  40446. }
  40447. }
  40448. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  40449. e = (e << mLen) | m
  40450. eLen += mLen
  40451. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  40452. buffer[offset + i - d] |= s * 128
  40453. }
  40454. });
  40455. return ___scope___.entry = "index.js";
  40456. });
  40457. FuseBox.pkg("stream", {}, function(___scope___){
  40458. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  40459. if (FuseBox.isServer) {
  40460. module.exports = global.require("stream");
  40461. } else {
  40462. module.exports = {};
  40463. }
  40464. });
  40465. return ___scope___.entry = "index.js";
  40466. });
  40467. FuseBox.pkg("debug", {}, function(___scope___){
  40468. ___scope___.file("src/browser.js", function(exports, require, module, __filename, __dirname){
  40469. /* fuse:injection: */ var process = require("process");
  40470. /**
  40471. * This is the web browser implementation of `debug()`.
  40472. *
  40473. * Expose `debug()` as the module.
  40474. */
  40475. exports = module.exports = require('./debug');
  40476. exports.log = log;
  40477. exports.formatArgs = formatArgs;
  40478. exports.save = save;
  40479. exports.load = load;
  40480. exports.useColors = useColors;
  40481. exports.storage = 'undefined' != typeof chrome
  40482. && 'undefined' != typeof chrome.storage
  40483. ? chrome.storage.local
  40484. : localstorage();
  40485. /**
  40486. * Colors.
  40487. */
  40488. exports.colors = [
  40489. 'lightseagreen',
  40490. 'forestgreen',
  40491. 'goldenrod',
  40492. 'dodgerblue',
  40493. 'darkorchid',
  40494. 'crimson'
  40495. ];
  40496. /**
  40497. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  40498. * and the Firebug extension (any Firefox version) are known
  40499. * to support "%c" CSS customizations.
  40500. *
  40501. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  40502. */
  40503. function useColors() {
  40504. // NB: In an Electron preload script, document will be defined but not fully
  40505. // initialized. Since we know we're in Chrome, we'll just detect this case
  40506. // explicitly
  40507. if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') {
  40508. return true;
  40509. }
  40510. // is webkit? http://stackoverflow.com/a/16459606/376773
  40511. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  40512. return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) ||
  40513. // is firebug? http://stackoverflow.com/a/398120/376773
  40514. (typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) ||
  40515. // is firefox >= v31?
  40516. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  40517. (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  40518. // double check webkit in userAgent just in case we are in a worker
  40519. (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  40520. }
  40521. /**
  40522. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  40523. */
  40524. exports.formatters.j = function(v) {
  40525. try {
  40526. return JSON.stringify(v);
  40527. } catch (err) {
  40528. return '[UnexpectedJSONParseError]: ' + err.message;
  40529. }
  40530. };
  40531. /**
  40532. * Colorize log arguments if enabled.
  40533. *
  40534. * @api public
  40535. */
  40536. function formatArgs(args) {
  40537. var useColors = this.useColors;
  40538. args[0] = (useColors ? '%c' : '')
  40539. + this.namespace
  40540. + (useColors ? ' %c' : ' ')
  40541. + args[0]
  40542. + (useColors ? '%c ' : ' ')
  40543. + '+' + exports.humanize(this.diff);
  40544. if (!useColors) return;
  40545. var c = 'color: ' + this.color;
  40546. args.splice(1, 0, c, 'color: inherit')
  40547. // the final "%c" is somewhat tricky, because there could be other
  40548. // arguments passed either before or after the %c, so we need to
  40549. // figure out the correct index to insert the CSS into
  40550. var index = 0;
  40551. var lastC = 0;
  40552. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  40553. if ('%%' === match) return;
  40554. index++;
  40555. if ('%c' === match) {
  40556. // we only are interested in the *last* %c
  40557. // (the user may have provided their own)
  40558. lastC = index;
  40559. }
  40560. });
  40561. args.splice(lastC, 0, c);
  40562. }
  40563. /**
  40564. * Invokes `console.log()` when available.
  40565. * No-op when `console.log` is not a "function".
  40566. *
  40567. * @api public
  40568. */
  40569. function log() {
  40570. // this hackery is required for IE8/9, where
  40571. // the `console.log` function doesn't have 'apply'
  40572. return 'object' === typeof console
  40573. && console.log
  40574. && Function.prototype.apply.call(console.log, console, arguments);
  40575. }
  40576. /**
  40577. * Save `namespaces`.
  40578. *
  40579. * @param {String} namespaces
  40580. * @api private
  40581. */
  40582. function save(namespaces) {
  40583. try {
  40584. if (null == namespaces) {
  40585. exports.storage.removeItem('debug');
  40586. } else {
  40587. exports.storage.debug = namespaces;
  40588. }
  40589. } catch(e) {}
  40590. }
  40591. /**
  40592. * Load `namespaces`.
  40593. *
  40594. * @return {String} returns the previously persisted debug modes
  40595. * @api private
  40596. */
  40597. function load() {
  40598. var r;
  40599. try {
  40600. r = exports.storage.debug;
  40601. } catch(e) {}
  40602. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  40603. if (!r && typeof process !== 'undefined' && 'env' in process) {
  40604. r = process.env.DEBUG;
  40605. }
  40606. return r;
  40607. }
  40608. /**
  40609. * Enable namespaces listed in `localStorage.debug` initially.
  40610. */
  40611. exports.enable(load());
  40612. /**
  40613. * Localstorage attempts to return the localstorage.
  40614. *
  40615. * This is necessary because safari throws
  40616. * when a user disables cookies/localstorage
  40617. * and you attempt to access it.
  40618. *
  40619. * @return {LocalStorage}
  40620. * @api private
  40621. */
  40622. function localstorage() {
  40623. try {
  40624. return window.localStorage;
  40625. } catch (e) {}
  40626. }
  40627. });
  40628. ___scope___.file("src/debug.js", function(exports, require, module, __filename, __dirname){
  40629. /**
  40630. * This is the common logic for both the Node.js and web browser
  40631. * implementations of `debug()`.
  40632. *
  40633. * Expose `debug()` as the module.
  40634. */
  40635. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  40636. exports.coerce = coerce;
  40637. exports.disable = disable;
  40638. exports.enable = enable;
  40639. exports.enabled = enabled;
  40640. exports.humanize = require('ms');
  40641. /**
  40642. * The currently active debug mode names, and names to skip.
  40643. */
  40644. exports.names = [];
  40645. exports.skips = [];
  40646. /**
  40647. * Map of special "%n" handling functions, for the debug "format" argument.
  40648. *
  40649. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  40650. */
  40651. exports.formatters = {};
  40652. /**
  40653. * Previous log timestamp.
  40654. */
  40655. var prevTime;
  40656. /**
  40657. * Select a color.
  40658. * @param {String} namespace
  40659. * @return {Number}
  40660. * @api private
  40661. */
  40662. function selectColor(namespace) {
  40663. var hash = 0, i;
  40664. for (i in namespace) {
  40665. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  40666. hash |= 0; // Convert to 32bit integer
  40667. }
  40668. return exports.colors[Math.abs(hash) % exports.colors.length];
  40669. }
  40670. /**
  40671. * Create a debugger with the given `namespace`.
  40672. *
  40673. * @param {String} namespace
  40674. * @return {Function}
  40675. * @api public
  40676. */
  40677. function createDebug(namespace) {
  40678. function debug() {
  40679. // disabled?
  40680. if (!debug.enabled) return;
  40681. var self = debug;
  40682. // set `diff` timestamp
  40683. var curr = +new Date();
  40684. var ms = curr - (prevTime || curr);
  40685. self.diff = ms;
  40686. self.prev = prevTime;
  40687. self.curr = curr;
  40688. prevTime = curr;
  40689. // turn the `arguments` into a proper Array
  40690. var args = new Array(arguments.length);
  40691. for (var i = 0; i < args.length; i++) {
  40692. args[i] = arguments[i];
  40693. }
  40694. args[0] = exports.coerce(args[0]);
  40695. if ('string' !== typeof args[0]) {
  40696. // anything else let's inspect with %O
  40697. args.unshift('%O');
  40698. }
  40699. // apply any `formatters` transformations
  40700. var index = 0;
  40701. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  40702. // if we encounter an escaped % then don't increase the array index
  40703. if (match === '%%') return match;
  40704. index++;
  40705. var formatter = exports.formatters[format];
  40706. if ('function' === typeof formatter) {
  40707. var val = args[index];
  40708. match = formatter.call(self, val);
  40709. // now we need to remove `args[index]` since it's inlined in the `format`
  40710. args.splice(index, 1);
  40711. index--;
  40712. }
  40713. return match;
  40714. });
  40715. // apply env-specific formatting (colors, etc.)
  40716. exports.formatArgs.call(self, args);
  40717. var logFn = debug.log || exports.log || console.log.bind(console);
  40718. logFn.apply(self, args);
  40719. }
  40720. debug.namespace = namespace;
  40721. debug.enabled = exports.enabled(namespace);
  40722. debug.useColors = exports.useColors();
  40723. debug.color = selectColor(namespace);
  40724. // env-specific initialization logic for debug instances
  40725. if ('function' === typeof exports.init) {
  40726. exports.init(debug);
  40727. }
  40728. return debug;
  40729. }
  40730. /**
  40731. * Enables a debug mode by namespaces. This can include modes
  40732. * separated by a colon and wildcards.
  40733. *
  40734. * @param {String} namespaces
  40735. * @api public
  40736. */
  40737. function enable(namespaces) {
  40738. exports.save(namespaces);
  40739. exports.names = [];
  40740. exports.skips = [];
  40741. var split = (namespaces || '').split(/[\s,]+/);
  40742. var len = split.length;
  40743. for (var i = 0; i < len; i++) {
  40744. if (!split[i]) continue; // ignore empty strings
  40745. namespaces = split[i].replace(/\*/g, '.*?');
  40746. if (namespaces[0] === '-') {
  40747. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  40748. } else {
  40749. exports.names.push(new RegExp('^' + namespaces + '$'));
  40750. }
  40751. }
  40752. }
  40753. /**
  40754. * Disable debug output.
  40755. *
  40756. * @api public
  40757. */
  40758. function disable() {
  40759. exports.enable('');
  40760. }
  40761. /**
  40762. * Returns true if the given mode name is enabled, false otherwise.
  40763. *
  40764. * @param {String} name
  40765. * @return {Boolean}
  40766. * @api public
  40767. */
  40768. function enabled(name) {
  40769. var i, len;
  40770. for (i = 0, len = exports.skips.length; i < len; i++) {
  40771. if (exports.skips[i].test(name)) {
  40772. return false;
  40773. }
  40774. }
  40775. for (i = 0, len = exports.names.length; i < len; i++) {
  40776. if (exports.names[i].test(name)) {
  40777. return true;
  40778. }
  40779. }
  40780. return false;
  40781. }
  40782. /**
  40783. * Coerce `val`.
  40784. *
  40785. * @param {Mixed} val
  40786. * @return {Mixed}
  40787. * @api private
  40788. */
  40789. function coerce(val) {
  40790. if (val instanceof Error) return val.stack || val.message;
  40791. return val;
  40792. }
  40793. });
  40794. return ___scope___.entry = "src/browser.js";
  40795. });
  40796. FuseBox.pkg("ms", {}, function(___scope___){
  40797. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  40798. /**
  40799. * Helpers.
  40800. */
  40801. var s = 1000
  40802. var m = s * 60
  40803. var h = m * 60
  40804. var d = h * 24
  40805. var y = d * 365.25
  40806. /**
  40807. * Parse or format the given `val`.
  40808. *
  40809. * Options:
  40810. *
  40811. * - `long` verbose formatting [false]
  40812. *
  40813. * @param {String|Number} val
  40814. * @param {Object} options
  40815. * @throws {Error} throw an error if val is not a non-empty string or a number
  40816. * @return {String|Number}
  40817. * @api public
  40818. */
  40819. module.exports = function (val, options) {
  40820. options = options || {}
  40821. var type = typeof val
  40822. if (type === 'string' && val.length > 0) {
  40823. return parse(val)
  40824. } else if (type === 'number' && isNaN(val) === false) {
  40825. return options.long ?
  40826. fmtLong(val) :
  40827. fmtShort(val)
  40828. }
  40829. throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val))
  40830. }
  40831. /**
  40832. * Parse the given `str` and return milliseconds.
  40833. *
  40834. * @param {String} str
  40835. * @return {Number}
  40836. * @api private
  40837. */
  40838. function parse(str) {
  40839. str = String(str)
  40840. if (str.length > 10000) {
  40841. return
  40842. }
  40843. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str)
  40844. if (!match) {
  40845. return
  40846. }
  40847. var n = parseFloat(match[1])
  40848. var type = (match[2] || 'ms').toLowerCase()
  40849. switch (type) {
  40850. case 'years':
  40851. case 'year':
  40852. case 'yrs':
  40853. case 'yr':
  40854. case 'y':
  40855. return n * y
  40856. case 'days':
  40857. case 'day':
  40858. case 'd':
  40859. return n * d
  40860. case 'hours':
  40861. case 'hour':
  40862. case 'hrs':
  40863. case 'hr':
  40864. case 'h':
  40865. return n * h
  40866. case 'minutes':
  40867. case 'minute':
  40868. case 'mins':
  40869. case 'min':
  40870. case 'm':
  40871. return n * m
  40872. case 'seconds':
  40873. case 'second':
  40874. case 'secs':
  40875. case 'sec':
  40876. case 's':
  40877. return n * s
  40878. case 'milliseconds':
  40879. case 'millisecond':
  40880. case 'msecs':
  40881. case 'msec':
  40882. case 'ms':
  40883. return n
  40884. default:
  40885. return undefined
  40886. }
  40887. }
  40888. /**
  40889. * Short format for `ms`.
  40890. *
  40891. * @param {Number} ms
  40892. * @return {String}
  40893. * @api private
  40894. */
  40895. function fmtShort(ms) {
  40896. if (ms >= d) {
  40897. return Math.round(ms / d) + 'd'
  40898. }
  40899. if (ms >= h) {
  40900. return Math.round(ms / h) + 'h'
  40901. }
  40902. if (ms >= m) {
  40903. return Math.round(ms / m) + 'm'
  40904. }
  40905. if (ms >= s) {
  40906. return Math.round(ms / s) + 's'
  40907. }
  40908. return ms + 'ms'
  40909. }
  40910. /**
  40911. * Long format for `ms`.
  40912. *
  40913. * @param {Number} ms
  40914. * @return {String}
  40915. * @api private
  40916. */
  40917. function fmtLong(ms) {
  40918. return plural(ms, d, 'day') ||
  40919. plural(ms, h, 'hour') ||
  40920. plural(ms, m, 'minute') ||
  40921. plural(ms, s, 'second') ||
  40922. ms + ' ms'
  40923. }
  40924. /**
  40925. * Pluralization helper.
  40926. */
  40927. function plural(ms, n, name) {
  40928. if (ms < n) {
  40929. return
  40930. }
  40931. if (ms < n * 1.5) {
  40932. return Math.floor(ms / n) + ' ' + name
  40933. }
  40934. return Math.ceil(ms / n) + ' ' + name + 's'
  40935. }
  40936. });
  40937. return ___scope___.entry = "index.js";
  40938. });
  40939. FuseBox.pkg("zlib", {}, function(___scope___){
  40940. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  40941. if (FuseBox.isServer) {
  40942. module.exports = global.require("zlib");
  40943. } else {
  40944. module.exports = {};
  40945. }
  40946. });
  40947. return ___scope___.entry = "index.js";
  40948. });
  40949. FuseBox.import("fusebox-hot-reload").connect(4444, "")
  40950. FuseBox.import("default/configure.js");
  40951. FuseBox.main("default/configure.js");
  40952. })
  40953. (function(e){function r(e){var r=e.charCodeAt(0),n=e.charCodeAt(1);if((d||58!==n)&&(r>=97&&r<=122||64===r)){if(64===r){var t=e.split("/"),i=t.splice(2,t.length).join("/");return[t[0]+"/"+t[1],i||void 0]}var o=e.indexOf("/");if(o===-1)return[e];var a=e.substring(0,o),f=e.substring(o+1);return[a,f]}}function n(e){return e.substring(0,e.lastIndexOf("/"))||"./"}function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=[],t=0,i=arguments.length;t<i;t++)n=n.concat(arguments[t].split("/"));for(var o=[],t=0,i=n.length;t<i;t++){var a=n[t];a&&"."!==a&&(".."===a?o.pop():o.push(a))}return""===n[0]&&o.unshift(""),o.join("/")||(o.length?"/":".")}function i(e){var r=e.match(/\.(\w{1,})$/);return r&&r[1]?e:e+".js"}function o(e){if(d){var r,n=document,t=n.getElementsByTagName("head")[0];/\.css$/.test(e)?(r=n.createElement("link"),r.rel="stylesheet",r.type="text/css",r.href=e):(r=n.createElement("script"),r.type="text/javascript",r.src=e,r.async=!0),t.insertBefore(r,t.firstChild)}}function a(e,r){for(var n in e)e.hasOwnProperty(n)&&r(n,e[n])}function f(e){return{server:require(e)}}function u(e,n){var o=n.path||"./",a=n.pkg||"default",u=r(e);if(u&&(o="./",a=u[0],n.v&&n.v[a]&&(a=a+"@"+n.v[a]),e=u[1]),e)if(126===e.charCodeAt(0))e=e.slice(2,e.length),o="./";else if(!d&&(47===e.charCodeAt(0)||58===e.charCodeAt(1)))return f(e);var s=h[a];if(!s){if(d)throw"Package not found "+a;return f(a+(e?"/"+e:""))}e=e?e:"./"+s.s.entry;var l,c=t(o,e),v=i(c),p=s.f[v];return!p&&v.indexOf("*")>-1&&(l=v),p||l||(v=t(c,"/","index.js"),p=s.f[v],p||(v=c+".js",p=s.f[v]),p||(p=s.f[c+".jsx"]),p||(v=c+"/index.jsx",p=s.f[v])),{file:p,wildcard:l,pkgName:a,versions:s.v,filePath:c,validPath:v}}function s(e,r){if(!d)return r(/\.(js|json)$/.test(e)?v.require(e):"");var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==n.readyState)if(200==n.status){var i=n.getResponseHeader("Content-Type"),o=n.responseText;/json/.test(i)?o="module.exports = "+o:/javascript/.test(i)||(o="module.exports = "+JSON.stringify(o));var a=t("./",e);g.dynamic(a,o),r(g.import(e,{}))}else console.error(e,"not found on request"),r(void 0)},n.open("GET",e,!0),n.send()}function l(e,r){var n=m[e];if(n)for(var t in n){var i=n[t].apply(null,r);if(i===!1)return!1}}function c(e,r){if(void 0===r&&(r={}),58===e.charCodeAt(4)||58===e.charCodeAt(5))return o(e);var t=u(e,r);if(t.server)return t.server;var i=t.file;if(t.wildcard){var a=new RegExp(t.wildcard.replace(/\*/g,"@").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&").replace(/@/g,"[a-z0-9$_-]+"),"i"),f=h[t.pkgName];if(f){var p={};for(var m in f.f)a.test(m)&&(p[m]=c(t.pkgName+"/"+m));return p}}if(!i){var g="function"==typeof r,x=l("async",[e,r]);if(x===!1)return;return s(e,function(e){return g?r(e):null})}var _=t.pkgName;if(i.locals&&i.locals.module)return i.locals.module.exports;var w=i.locals={},y=n(t.validPath);w.exports={},w.module={exports:w.exports},w.require=function(e,r){return c(e,{pkg:_,path:y,v:t.versions})},w.require.main={filename:d?"./":v.require.main.filename,paths:d?[]:v.require.main.paths};var b=[w.module.exports,w.require,w.module,t.validPath,y,_];return l("before-import",b),i.fn.apply(0,b),l("after-import",b),w.module.exports}if(e.FuseBox)return e.FuseBox;var d="undefined"!=typeof window&&window.navigator,v=d?window:global;d&&(v.global=window),e=d&&"undefined"==typeof __fbx__dnm__?e:module.exports;var p=d?window.__fsbx__=window.__fsbx__||{}:v.$fsbx=v.$fsbx||{};d||(v.require=require);var h=p.p=p.p||{},m=p.e=p.e||{},g=function(){function r(){}return r.global=function(e,r){return void 0===r?v[e]:void(v[e]=r)},r.import=function(e,r){return c(e,r)},r.on=function(e,r){m[e]=m[e]||[],m[e].push(r)},r.exists=function(e){try{var r=u(e,{});return void 0!==r.file}catch(e){return!1}},r.remove=function(e){var r=u(e,{}),n=h[r.pkgName];n&&n.f[r.validPath]&&delete n.f[r.validPath]},r.main=function(e){return this.mainFile=e,r.import(e,{})},r.expose=function(r){var n=function(n){var t=r[n].alias,i=c(r[n].pkg);"*"===t?a(i,function(r,n){return e[r]=n}):"object"==typeof t?a(t,function(r,n){return e[n]=i[r]}):e[t]=i};for(var t in r)n(t)},r.dynamic=function(r,n,t){this.pkg(t&&t.pkg||"default",{},function(t){t.file(r,function(r,t,i,o,a){var f=new Function("__fbx__dnm__","exports","require","module","__filename","__dirname","__root__",n);f(!0,r,t,i,o,a,e)})})},r.flush=function(e){var r=h.default;for(var n in r.f)e&&!e(n)||delete r.f[n].locals},r.pkg=function(e,r,n){if(h[e])return n(h[e].s);var t=h[e]={};return t.f={},t.v=r,t.s={file:function(e,r){return t.f[e]={fn:r}}},n(t.s)},r.addPlugin=function(e){this.plugins.push(e)},r}();return g.packages=h,g.isBrowser=void 0!==d,g.isServer=!d,g.plugins=[],e.FuseBox=g}(this))