app.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  107. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  108. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  109. module.exports = function xhrAdapter(config) {
  110. return new Promise(function dispatchXhrRequest(resolve, reject) {
  111. var requestData = config.data;
  112. var requestHeaders = config.headers;
  113. if (utils.isFormData(requestData)) {
  114. delete requestHeaders['Content-Type']; // Let the browser set it
  115. }
  116. var request = new XMLHttpRequest();
  117. // HTTP basic authentication
  118. if (config.auth) {
  119. var username = config.auth.username || '';
  120. var password = config.auth.password || '';
  121. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  122. }
  123. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  124. // Set the request timeout in MS
  125. request.timeout = config.timeout;
  126. // Listen for ready state
  127. request.onreadystatechange = function handleLoad() {
  128. if (!request || request.readyState !== 4) {
  129. return;
  130. }
  131. // The request errored out and we didn't get a response, this will be
  132. // handled by onerror instead
  133. // With one exception: request that using file: protocol, most browsers
  134. // will return status as 0 even though it's a successful request
  135. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  136. return;
  137. }
  138. // Prepare the response
  139. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  140. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  141. var response = {
  142. data: responseData,
  143. status: request.status,
  144. statusText: request.statusText,
  145. headers: responseHeaders,
  146. config: config,
  147. request: request
  148. };
  149. settle(resolve, reject, response);
  150. // Clean up request
  151. request = null;
  152. };
  153. // Handle browser request cancellation (as opposed to a manual cancellation)
  154. request.onabort = function handleAbort() {
  155. if (!request) {
  156. return;
  157. }
  158. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  159. // Clean up request
  160. request = null;
  161. };
  162. // Handle low level network errors
  163. request.onerror = function handleError() {
  164. // Real errors are hidden from us by the browser
  165. // onerror should only fire if it's a network error
  166. reject(createError('Network Error', config, null, request));
  167. // Clean up request
  168. request = null;
  169. };
  170. // Handle timeout
  171. request.ontimeout = function handleTimeout() {
  172. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  173. request));
  174. // Clean up request
  175. request = null;
  176. };
  177. // Add xsrf header
  178. // This is only done if running in a standard browser environment.
  179. // Specifically not if we're in a web worker, or react-native.
  180. if (utils.isStandardBrowserEnv()) {
  181. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  182. // Add xsrf header
  183. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  184. cookies.read(config.xsrfCookieName) :
  185. undefined;
  186. if (xsrfValue) {
  187. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  188. }
  189. }
  190. // Add headers to the request
  191. if ('setRequestHeader' in request) {
  192. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  193. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  194. // Remove Content-Type if data is undefined
  195. delete requestHeaders[key];
  196. } else {
  197. // Otherwise add header to the request
  198. request.setRequestHeader(key, val);
  199. }
  200. });
  201. }
  202. // Add withCredentials to request if needed
  203. if (config.withCredentials) {
  204. request.withCredentials = true;
  205. }
  206. // Add responseType to request if needed
  207. if (config.responseType) {
  208. try {
  209. request.responseType = config.responseType;
  210. } catch (e) {
  211. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  212. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  213. if (config.responseType !== 'json') {
  214. throw e;
  215. }
  216. }
  217. }
  218. // Handle progress if needed
  219. if (typeof config.onDownloadProgress === 'function') {
  220. request.addEventListener('progress', config.onDownloadProgress);
  221. }
  222. // Not all browsers support upload events
  223. if (typeof config.onUploadProgress === 'function' && request.upload) {
  224. request.upload.addEventListener('progress', config.onUploadProgress);
  225. }
  226. if (config.cancelToken) {
  227. // Handle cancellation
  228. config.cancelToken.promise.then(function onCanceled(cancel) {
  229. if (!request) {
  230. return;
  231. }
  232. request.abort();
  233. reject(cancel);
  234. // Clean up request
  235. request = null;
  236. });
  237. }
  238. if (requestData === undefined) {
  239. requestData = null;
  240. }
  241. // Send the request
  242. request.send(requestData);
  243. });
  244. };
  245. /***/ }),
  246. /***/ "./node_modules/axios/lib/axios.js":
  247. /*!*****************************************!*\
  248. !*** ./node_modules/axios/lib/axios.js ***!
  249. \*****************************************/
  250. /*! no static exports found */
  251. /***/ (function(module, exports, __webpack_require__) {
  252. "use strict";
  253. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  254. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  255. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  256. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  257. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  258. /**
  259. * Create an instance of Axios
  260. *
  261. * @param {Object} defaultConfig The default config for the instance
  262. * @return {Axios} A new instance of Axios
  263. */
  264. function createInstance(defaultConfig) {
  265. var context = new Axios(defaultConfig);
  266. var instance = bind(Axios.prototype.request, context);
  267. // Copy axios.prototype to instance
  268. utils.extend(instance, Axios.prototype, context);
  269. // Copy context to instance
  270. utils.extend(instance, context);
  271. return instance;
  272. }
  273. // Create the default instance to be exported
  274. var axios = createInstance(defaults);
  275. // Expose Axios class to allow class inheritance
  276. axios.Axios = Axios;
  277. // Factory for creating new instances
  278. axios.create = function create(instanceConfig) {
  279. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  280. };
  281. // Expose Cancel & CancelToken
  282. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  283. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  284. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  285. // Expose all/spread
  286. axios.all = function all(promises) {
  287. return Promise.all(promises);
  288. };
  289. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  290. module.exports = axios;
  291. // Allow use of default import syntax in TypeScript
  292. module.exports.default = axios;
  293. /***/ }),
  294. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  295. /*!*************************************************!*\
  296. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  297. \*************************************************/
  298. /*! no static exports found */
  299. /***/ (function(module, exports, __webpack_require__) {
  300. "use strict";
  301. /**
  302. * A `Cancel` is an object that is thrown when an operation is canceled.
  303. *
  304. * @class
  305. * @param {string=} message The message.
  306. */
  307. function Cancel(message) {
  308. this.message = message;
  309. }
  310. Cancel.prototype.toString = function toString() {
  311. return 'Cancel' + (this.message ? ': ' + this.message : '');
  312. };
  313. Cancel.prototype.__CANCEL__ = true;
  314. module.exports = Cancel;
  315. /***/ }),
  316. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  317. /*!******************************************************!*\
  318. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  319. \******************************************************/
  320. /*! no static exports found */
  321. /***/ (function(module, exports, __webpack_require__) {
  322. "use strict";
  323. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  324. /**
  325. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  326. *
  327. * @class
  328. * @param {Function} executor The executor function.
  329. */
  330. function CancelToken(executor) {
  331. if (typeof executor !== 'function') {
  332. throw new TypeError('executor must be a function.');
  333. }
  334. var resolvePromise;
  335. this.promise = new Promise(function promiseExecutor(resolve) {
  336. resolvePromise = resolve;
  337. });
  338. var token = this;
  339. executor(function cancel(message) {
  340. if (token.reason) {
  341. // Cancellation has already been requested
  342. return;
  343. }
  344. token.reason = new Cancel(message);
  345. resolvePromise(token.reason);
  346. });
  347. }
  348. /**
  349. * Throws a `Cancel` if cancellation has been requested.
  350. */
  351. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  352. if (this.reason) {
  353. throw this.reason;
  354. }
  355. };
  356. /**
  357. * Returns an object that contains a new `CancelToken` and a function that, when called,
  358. * cancels the `CancelToken`.
  359. */
  360. CancelToken.source = function source() {
  361. var cancel;
  362. var token = new CancelToken(function executor(c) {
  363. cancel = c;
  364. });
  365. return {
  366. token: token,
  367. cancel: cancel
  368. };
  369. };
  370. module.exports = CancelToken;
  371. /***/ }),
  372. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  373. /*!***************************************************!*\
  374. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  375. \***************************************************/
  376. /*! no static exports found */
  377. /***/ (function(module, exports, __webpack_require__) {
  378. "use strict";
  379. module.exports = function isCancel(value) {
  380. return !!(value && value.__CANCEL__);
  381. };
  382. /***/ }),
  383. /***/ "./node_modules/axios/lib/core/Axios.js":
  384. /*!**********************************************!*\
  385. !*** ./node_modules/axios/lib/core/Axios.js ***!
  386. \**********************************************/
  387. /*! no static exports found */
  388. /***/ (function(module, exports, __webpack_require__) {
  389. "use strict";
  390. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  391. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  392. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  393. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  394. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  395. /**
  396. * Create a new instance of Axios
  397. *
  398. * @param {Object} instanceConfig The default config for the instance
  399. */
  400. function Axios(instanceConfig) {
  401. this.defaults = instanceConfig;
  402. this.interceptors = {
  403. request: new InterceptorManager(),
  404. response: new InterceptorManager()
  405. };
  406. }
  407. /**
  408. * Dispatch a request
  409. *
  410. * @param {Object} config The config specific for this request (merged with this.defaults)
  411. */
  412. Axios.prototype.request = function request(config) {
  413. /*eslint no-param-reassign:0*/
  414. // Allow for axios('example/url'[, config]) a la fetch API
  415. if (typeof config === 'string') {
  416. config = arguments[1] || {};
  417. config.url = arguments[0];
  418. } else {
  419. config = config || {};
  420. }
  421. config = mergeConfig(this.defaults, config);
  422. config.method = config.method ? config.method.toLowerCase() : 'get';
  423. // Hook up interceptors middleware
  424. var chain = [dispatchRequest, undefined];
  425. var promise = Promise.resolve(config);
  426. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  427. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  428. });
  429. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  430. chain.push(interceptor.fulfilled, interceptor.rejected);
  431. });
  432. while (chain.length) {
  433. promise = promise.then(chain.shift(), chain.shift());
  434. }
  435. return promise;
  436. };
  437. Axios.prototype.getUri = function getUri(config) {
  438. config = mergeConfig(this.defaults, config);
  439. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  440. };
  441. // Provide aliases for supported request methods
  442. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  443. /*eslint func-names:0*/
  444. Axios.prototype[method] = function(url, config) {
  445. return this.request(utils.merge(config || {}, {
  446. method: method,
  447. url: url
  448. }));
  449. };
  450. });
  451. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  452. /*eslint func-names:0*/
  453. Axios.prototype[method] = function(url, data, config) {
  454. return this.request(utils.merge(config || {}, {
  455. method: method,
  456. url: url,
  457. data: data
  458. }));
  459. };
  460. });
  461. module.exports = Axios;
  462. /***/ }),
  463. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  464. /*!***********************************************************!*\
  465. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  466. \***********************************************************/
  467. /*! no static exports found */
  468. /***/ (function(module, exports, __webpack_require__) {
  469. "use strict";
  470. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  471. function InterceptorManager() {
  472. this.handlers = [];
  473. }
  474. /**
  475. * Add a new interceptor to the stack
  476. *
  477. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  478. * @param {Function} rejected The function to handle `reject` for a `Promise`
  479. *
  480. * @return {Number} An ID used to remove interceptor later
  481. */
  482. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  483. this.handlers.push({
  484. fulfilled: fulfilled,
  485. rejected: rejected
  486. });
  487. return this.handlers.length - 1;
  488. };
  489. /**
  490. * Remove an interceptor from the stack
  491. *
  492. * @param {Number} id The ID that was returned by `use`
  493. */
  494. InterceptorManager.prototype.eject = function eject(id) {
  495. if (this.handlers[id]) {
  496. this.handlers[id] = null;
  497. }
  498. };
  499. /**
  500. * Iterate over all the registered interceptors
  501. *
  502. * This method is particularly useful for skipping over any
  503. * interceptors that may have become `null` calling `eject`.
  504. *
  505. * @param {Function} fn The function to call for each interceptor
  506. */
  507. InterceptorManager.prototype.forEach = function forEach(fn) {
  508. utils.forEach(this.handlers, function forEachHandler(h) {
  509. if (h !== null) {
  510. fn(h);
  511. }
  512. });
  513. };
  514. module.exports = InterceptorManager;
  515. /***/ }),
  516. /***/ "./node_modules/axios/lib/core/createError.js":
  517. /*!****************************************************!*\
  518. !*** ./node_modules/axios/lib/core/createError.js ***!
  519. \****************************************************/
  520. /*! no static exports found */
  521. /***/ (function(module, exports, __webpack_require__) {
  522. "use strict";
  523. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  524. /**
  525. * Create an Error with the specified message, config, error code, request and response.
  526. *
  527. * @param {string} message The error message.
  528. * @param {Object} config The config.
  529. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  530. * @param {Object} [request] The request.
  531. * @param {Object} [response] The response.
  532. * @returns {Error} The created error.
  533. */
  534. module.exports = function createError(message, config, code, request, response) {
  535. var error = new Error(message);
  536. return enhanceError(error, config, code, request, response);
  537. };
  538. /***/ }),
  539. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  540. /*!********************************************************!*\
  541. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  542. \********************************************************/
  543. /*! no static exports found */
  544. /***/ (function(module, exports, __webpack_require__) {
  545. "use strict";
  546. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  547. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  548. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  549. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  550. var isAbsoluteURL = __webpack_require__(/*! ./../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  551. var combineURLs = __webpack_require__(/*! ./../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  552. /**
  553. * Throws a `Cancel` if cancellation has been requested.
  554. */
  555. function throwIfCancellationRequested(config) {
  556. if (config.cancelToken) {
  557. config.cancelToken.throwIfRequested();
  558. }
  559. }
  560. /**
  561. * Dispatch a request to the server using the configured adapter.
  562. *
  563. * @param {object} config The config that is to be used for the request
  564. * @returns {Promise} The Promise to be fulfilled
  565. */
  566. module.exports = function dispatchRequest(config) {
  567. throwIfCancellationRequested(config);
  568. // Support baseURL config
  569. if (config.baseURL && !isAbsoluteURL(config.url)) {
  570. config.url = combineURLs(config.baseURL, config.url);
  571. }
  572. // Ensure headers exist
  573. config.headers = config.headers || {};
  574. // Transform request data
  575. config.data = transformData(
  576. config.data,
  577. config.headers,
  578. config.transformRequest
  579. );
  580. // Flatten headers
  581. config.headers = utils.merge(
  582. config.headers.common || {},
  583. config.headers[config.method] || {},
  584. config.headers || {}
  585. );
  586. utils.forEach(
  587. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  588. function cleanHeaderConfig(method) {
  589. delete config.headers[method];
  590. }
  591. );
  592. var adapter = config.adapter || defaults.adapter;
  593. return adapter(config).then(function onAdapterResolution(response) {
  594. throwIfCancellationRequested(config);
  595. // Transform response data
  596. response.data = transformData(
  597. response.data,
  598. response.headers,
  599. config.transformResponse
  600. );
  601. return response;
  602. }, function onAdapterRejection(reason) {
  603. if (!isCancel(reason)) {
  604. throwIfCancellationRequested(config);
  605. // Transform response data
  606. if (reason && reason.response) {
  607. reason.response.data = transformData(
  608. reason.response.data,
  609. reason.response.headers,
  610. config.transformResponse
  611. );
  612. }
  613. }
  614. return Promise.reject(reason);
  615. });
  616. };
  617. /***/ }),
  618. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  619. /*!*****************************************************!*\
  620. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  621. \*****************************************************/
  622. /*! no static exports found */
  623. /***/ (function(module, exports, __webpack_require__) {
  624. "use strict";
  625. /**
  626. * Update an Error with the specified config, error code, and response.
  627. *
  628. * @param {Error} error The error to update.
  629. * @param {Object} config The config.
  630. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  631. * @param {Object} [request] The request.
  632. * @param {Object} [response] The response.
  633. * @returns {Error} The error.
  634. */
  635. module.exports = function enhanceError(error, config, code, request, response) {
  636. error.config = config;
  637. if (code) {
  638. error.code = code;
  639. }
  640. error.request = request;
  641. error.response = response;
  642. error.isAxiosError = true;
  643. error.toJSON = function() {
  644. return {
  645. // Standard
  646. message: this.message,
  647. name: this.name,
  648. // Microsoft
  649. description: this.description,
  650. number: this.number,
  651. // Mozilla
  652. fileName: this.fileName,
  653. lineNumber: this.lineNumber,
  654. columnNumber: this.columnNumber,
  655. stack: this.stack,
  656. // Axios
  657. config: this.config,
  658. code: this.code
  659. };
  660. };
  661. return error;
  662. };
  663. /***/ }),
  664. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  665. /*!****************************************************!*\
  666. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  667. \****************************************************/
  668. /*! no static exports found */
  669. /***/ (function(module, exports, __webpack_require__) {
  670. "use strict";
  671. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  672. /**
  673. * Config-specific merge-function which creates a new config-object
  674. * by merging two configuration objects together.
  675. *
  676. * @param {Object} config1
  677. * @param {Object} config2
  678. * @returns {Object} New object resulting from merging config2 to config1
  679. */
  680. module.exports = function mergeConfig(config1, config2) {
  681. // eslint-disable-next-line no-param-reassign
  682. config2 = config2 || {};
  683. var config = {};
  684. utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
  685. if (typeof config2[prop] !== 'undefined') {
  686. config[prop] = config2[prop];
  687. }
  688. });
  689. utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
  690. if (utils.isObject(config2[prop])) {
  691. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  692. } else if (typeof config2[prop] !== 'undefined') {
  693. config[prop] = config2[prop];
  694. } else if (utils.isObject(config1[prop])) {
  695. config[prop] = utils.deepMerge(config1[prop]);
  696. } else if (typeof config1[prop] !== 'undefined') {
  697. config[prop] = config1[prop];
  698. }
  699. });
  700. utils.forEach([
  701. 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
  702. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  703. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
  704. 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
  705. 'socketPath'
  706. ], function defaultToConfig2(prop) {
  707. if (typeof config2[prop] !== 'undefined') {
  708. config[prop] = config2[prop];
  709. } else if (typeof config1[prop] !== 'undefined') {
  710. config[prop] = config1[prop];
  711. }
  712. });
  713. return config;
  714. };
  715. /***/ }),
  716. /***/ "./node_modules/axios/lib/core/settle.js":
  717. /*!***********************************************!*\
  718. !*** ./node_modules/axios/lib/core/settle.js ***!
  719. \***********************************************/
  720. /*! no static exports found */
  721. /***/ (function(module, exports, __webpack_require__) {
  722. "use strict";
  723. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  724. /**
  725. * Resolve or reject a Promise based on response status.
  726. *
  727. * @param {Function} resolve A function that resolves the promise.
  728. * @param {Function} reject A function that rejects the promise.
  729. * @param {object} response The response.
  730. */
  731. module.exports = function settle(resolve, reject, response) {
  732. var validateStatus = response.config.validateStatus;
  733. if (!validateStatus || validateStatus(response.status)) {
  734. resolve(response);
  735. } else {
  736. reject(createError(
  737. 'Request failed with status code ' + response.status,
  738. response.config,
  739. null,
  740. response.request,
  741. response
  742. ));
  743. }
  744. };
  745. /***/ }),
  746. /***/ "./node_modules/axios/lib/core/transformData.js":
  747. /*!******************************************************!*\
  748. !*** ./node_modules/axios/lib/core/transformData.js ***!
  749. \******************************************************/
  750. /*! no static exports found */
  751. /***/ (function(module, exports, __webpack_require__) {
  752. "use strict";
  753. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  754. /**
  755. * Transform the data for a request or a response
  756. *
  757. * @param {Object|String} data The data to be transformed
  758. * @param {Array} headers The headers for the request or response
  759. * @param {Array|Function} fns A single function or Array of functions
  760. * @returns {*} The resulting transformed data
  761. */
  762. module.exports = function transformData(data, headers, fns) {
  763. /*eslint no-param-reassign:0*/
  764. utils.forEach(fns, function transform(fn) {
  765. data = fn(data, headers);
  766. });
  767. return data;
  768. };
  769. /***/ }),
  770. /***/ "./node_modules/axios/lib/defaults.js":
  771. /*!********************************************!*\
  772. !*** ./node_modules/axios/lib/defaults.js ***!
  773. \********************************************/
  774. /*! no static exports found */
  775. /***/ (function(module, exports, __webpack_require__) {
  776. "use strict";
  777. /* WEBPACK VAR INJECTION */(function(process) {
  778. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  779. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  780. var DEFAULT_CONTENT_TYPE = {
  781. 'Content-Type': 'application/x-www-form-urlencoded'
  782. };
  783. function setContentTypeIfUnset(headers, value) {
  784. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  785. headers['Content-Type'] = value;
  786. }
  787. }
  788. function getDefaultAdapter() {
  789. var adapter;
  790. // Only Node.JS has a process variable that is of [[Class]] process
  791. if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  792. // For node use HTTP adapter
  793. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  794. } else if (typeof XMLHttpRequest !== 'undefined') {
  795. // For browsers use XHR adapter
  796. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  797. }
  798. return adapter;
  799. }
  800. var defaults = {
  801. adapter: getDefaultAdapter(),
  802. transformRequest: [function transformRequest(data, headers) {
  803. normalizeHeaderName(headers, 'Accept');
  804. normalizeHeaderName(headers, 'Content-Type');
  805. if (utils.isFormData(data) ||
  806. utils.isArrayBuffer(data) ||
  807. utils.isBuffer(data) ||
  808. utils.isStream(data) ||
  809. utils.isFile(data) ||
  810. utils.isBlob(data)
  811. ) {
  812. return data;
  813. }
  814. if (utils.isArrayBufferView(data)) {
  815. return data.buffer;
  816. }
  817. if (utils.isURLSearchParams(data)) {
  818. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  819. return data.toString();
  820. }
  821. if (utils.isObject(data)) {
  822. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  823. return JSON.stringify(data);
  824. }
  825. return data;
  826. }],
  827. transformResponse: [function transformResponse(data) {
  828. /*eslint no-param-reassign:0*/
  829. if (typeof data === 'string') {
  830. try {
  831. data = JSON.parse(data);
  832. } catch (e) { /* Ignore */ }
  833. }
  834. return data;
  835. }],
  836. /**
  837. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  838. * timeout is not created.
  839. */
  840. timeout: 0,
  841. xsrfCookieName: 'XSRF-TOKEN',
  842. xsrfHeaderName: 'X-XSRF-TOKEN',
  843. maxContentLength: -1,
  844. validateStatus: function validateStatus(status) {
  845. return status >= 200 && status < 300;
  846. }
  847. };
  848. defaults.headers = {
  849. common: {
  850. 'Accept': 'application/json, text/plain, */*'
  851. }
  852. };
  853. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  854. defaults.headers[method] = {};
  855. });
  856. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  857. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  858. });
  859. module.exports = defaults;
  860. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  861. /***/ }),
  862. /***/ "./node_modules/axios/lib/helpers/bind.js":
  863. /*!************************************************!*\
  864. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  865. \************************************************/
  866. /*! no static exports found */
  867. /***/ (function(module, exports, __webpack_require__) {
  868. "use strict";
  869. module.exports = function bind(fn, thisArg) {
  870. return function wrap() {
  871. var args = new Array(arguments.length);
  872. for (var i = 0; i < args.length; i++) {
  873. args[i] = arguments[i];
  874. }
  875. return fn.apply(thisArg, args);
  876. };
  877. };
  878. /***/ }),
  879. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  880. /*!****************************************************!*\
  881. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  882. \****************************************************/
  883. /*! no static exports found */
  884. /***/ (function(module, exports, __webpack_require__) {
  885. "use strict";
  886. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  887. function encode(val) {
  888. return encodeURIComponent(val).
  889. replace(/%40/gi, '@').
  890. replace(/%3A/gi, ':').
  891. replace(/%24/g, '$').
  892. replace(/%2C/gi, ',').
  893. replace(/%20/g, '+').
  894. replace(/%5B/gi, '[').
  895. replace(/%5D/gi, ']');
  896. }
  897. /**
  898. * Build a URL by appending params to the end
  899. *
  900. * @param {string} url The base of the url (e.g., http://www.google.com)
  901. * @param {object} [params] The params to be appended
  902. * @returns {string} The formatted url
  903. */
  904. module.exports = function buildURL(url, params, paramsSerializer) {
  905. /*eslint no-param-reassign:0*/
  906. if (!params) {
  907. return url;
  908. }
  909. var serializedParams;
  910. if (paramsSerializer) {
  911. serializedParams = paramsSerializer(params);
  912. } else if (utils.isURLSearchParams(params)) {
  913. serializedParams = params.toString();
  914. } else {
  915. var parts = [];
  916. utils.forEach(params, function serialize(val, key) {
  917. if (val === null || typeof val === 'undefined') {
  918. return;
  919. }
  920. if (utils.isArray(val)) {
  921. key = key + '[]';
  922. } else {
  923. val = [val];
  924. }
  925. utils.forEach(val, function parseValue(v) {
  926. if (utils.isDate(v)) {
  927. v = v.toISOString();
  928. } else if (utils.isObject(v)) {
  929. v = JSON.stringify(v);
  930. }
  931. parts.push(encode(key) + '=' + encode(v));
  932. });
  933. });
  934. serializedParams = parts.join('&');
  935. }
  936. if (serializedParams) {
  937. var hashmarkIndex = url.indexOf('#');
  938. if (hashmarkIndex !== -1) {
  939. url = url.slice(0, hashmarkIndex);
  940. }
  941. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  942. }
  943. return url;
  944. };
  945. /***/ }),
  946. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  947. /*!*******************************************************!*\
  948. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  949. \*******************************************************/
  950. /*! no static exports found */
  951. /***/ (function(module, exports, __webpack_require__) {
  952. "use strict";
  953. /**
  954. * Creates a new URL by combining the specified URLs
  955. *
  956. * @param {string} baseURL The base URL
  957. * @param {string} relativeURL The relative URL
  958. * @returns {string} The combined URL
  959. */
  960. module.exports = function combineURLs(baseURL, relativeURL) {
  961. return relativeURL
  962. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  963. : baseURL;
  964. };
  965. /***/ }),
  966. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  967. /*!***************************************************!*\
  968. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  969. \***************************************************/
  970. /*! no static exports found */
  971. /***/ (function(module, exports, __webpack_require__) {
  972. "use strict";
  973. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  974. module.exports = (
  975. utils.isStandardBrowserEnv() ?
  976. // Standard browser envs support document.cookie
  977. (function standardBrowserEnv() {
  978. return {
  979. write: function write(name, value, expires, path, domain, secure) {
  980. var cookie = [];
  981. cookie.push(name + '=' + encodeURIComponent(value));
  982. if (utils.isNumber(expires)) {
  983. cookie.push('expires=' + new Date(expires).toGMTString());
  984. }
  985. if (utils.isString(path)) {
  986. cookie.push('path=' + path);
  987. }
  988. if (utils.isString(domain)) {
  989. cookie.push('domain=' + domain);
  990. }
  991. if (secure === true) {
  992. cookie.push('secure');
  993. }
  994. document.cookie = cookie.join('; ');
  995. },
  996. read: function read(name) {
  997. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  998. return (match ? decodeURIComponent(match[3]) : null);
  999. },
  1000. remove: function remove(name) {
  1001. this.write(name, '', Date.now() - 86400000);
  1002. }
  1003. };
  1004. })() :
  1005. // Non standard browser env (web workers, react-native) lack needed support.
  1006. (function nonStandardBrowserEnv() {
  1007. return {
  1008. write: function write() {},
  1009. read: function read() { return null; },
  1010. remove: function remove() {}
  1011. };
  1012. })()
  1013. );
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1016. /*!*********************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1018. \*********************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. /**
  1023. * Determines whether the specified URL is absolute
  1024. *
  1025. * @param {string} url The URL to test
  1026. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1027. */
  1028. module.exports = function isAbsoluteURL(url) {
  1029. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1030. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1031. // by any combination of letters, digits, plus, period, or hyphen.
  1032. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1033. };
  1034. /***/ }),
  1035. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1036. /*!***********************************************************!*\
  1037. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1038. \***********************************************************/
  1039. /*! no static exports found */
  1040. /***/ (function(module, exports, __webpack_require__) {
  1041. "use strict";
  1042. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1043. module.exports = (
  1044. utils.isStandardBrowserEnv() ?
  1045. // Standard browser envs have full support of the APIs needed to test
  1046. // whether the request URL is of the same origin as current location.
  1047. (function standardBrowserEnv() {
  1048. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1049. var urlParsingNode = document.createElement('a');
  1050. var originURL;
  1051. /**
  1052. * Parse a URL to discover it's components
  1053. *
  1054. * @param {String} url The URL to be parsed
  1055. * @returns {Object}
  1056. */
  1057. function resolveURL(url) {
  1058. var href = url;
  1059. if (msie) {
  1060. // IE needs attribute set twice to normalize properties
  1061. urlParsingNode.setAttribute('href', href);
  1062. href = urlParsingNode.href;
  1063. }
  1064. urlParsingNode.setAttribute('href', href);
  1065. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1066. return {
  1067. href: urlParsingNode.href,
  1068. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1069. host: urlParsingNode.host,
  1070. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1071. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1072. hostname: urlParsingNode.hostname,
  1073. port: urlParsingNode.port,
  1074. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1075. urlParsingNode.pathname :
  1076. '/' + urlParsingNode.pathname
  1077. };
  1078. }
  1079. originURL = resolveURL(window.location.href);
  1080. /**
  1081. * Determine if a URL shares the same origin as the current location
  1082. *
  1083. * @param {String} requestURL The URL to test
  1084. * @returns {boolean} True if URL shares the same origin, otherwise false
  1085. */
  1086. return function isURLSameOrigin(requestURL) {
  1087. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1088. return (parsed.protocol === originURL.protocol &&
  1089. parsed.host === originURL.host);
  1090. };
  1091. })() :
  1092. // Non standard browser envs (web workers, react-native) lack needed support.
  1093. (function nonStandardBrowserEnv() {
  1094. return function isURLSameOrigin() {
  1095. return true;
  1096. };
  1097. })()
  1098. );
  1099. /***/ }),
  1100. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1101. /*!***************************************************************!*\
  1102. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1103. \***************************************************************/
  1104. /*! no static exports found */
  1105. /***/ (function(module, exports, __webpack_require__) {
  1106. "use strict";
  1107. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1108. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1109. utils.forEach(headers, function processHeader(value, name) {
  1110. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1111. headers[normalizedName] = value;
  1112. delete headers[name];
  1113. }
  1114. });
  1115. };
  1116. /***/ }),
  1117. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1118. /*!********************************************************!*\
  1119. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1120. \********************************************************/
  1121. /*! no static exports found */
  1122. /***/ (function(module, exports, __webpack_require__) {
  1123. "use strict";
  1124. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1125. // Headers whose duplicates are ignored by node
  1126. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1127. var ignoreDuplicateOf = [
  1128. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1129. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1130. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1131. 'referer', 'retry-after', 'user-agent'
  1132. ];
  1133. /**
  1134. * Parse headers into an object
  1135. *
  1136. * ```
  1137. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1138. * Content-Type: application/json
  1139. * Connection: keep-alive
  1140. * Transfer-Encoding: chunked
  1141. * ```
  1142. *
  1143. * @param {String} headers Headers needing to be parsed
  1144. * @returns {Object} Headers parsed into an object
  1145. */
  1146. module.exports = function parseHeaders(headers) {
  1147. var parsed = {};
  1148. var key;
  1149. var val;
  1150. var i;
  1151. if (!headers) { return parsed; }
  1152. utils.forEach(headers.split('\n'), function parser(line) {
  1153. i = line.indexOf(':');
  1154. key = utils.trim(line.substr(0, i)).toLowerCase();
  1155. val = utils.trim(line.substr(i + 1));
  1156. if (key) {
  1157. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1158. return;
  1159. }
  1160. if (key === 'set-cookie') {
  1161. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1162. } else {
  1163. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1164. }
  1165. }
  1166. });
  1167. return parsed;
  1168. };
  1169. /***/ }),
  1170. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1171. /*!**************************************************!*\
  1172. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1173. \**************************************************/
  1174. /*! no static exports found */
  1175. /***/ (function(module, exports, __webpack_require__) {
  1176. "use strict";
  1177. /**
  1178. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1179. *
  1180. * Common use case would be to use `Function.prototype.apply`.
  1181. *
  1182. * ```js
  1183. * function f(x, y, z) {}
  1184. * var args = [1, 2, 3];
  1185. * f.apply(null, args);
  1186. * ```
  1187. *
  1188. * With `spread` this example can be re-written.
  1189. *
  1190. * ```js
  1191. * spread(function(x, y, z) {})([1, 2, 3]);
  1192. * ```
  1193. *
  1194. * @param {Function} callback
  1195. * @returns {Function}
  1196. */
  1197. module.exports = function spread(callback) {
  1198. return function wrap(arr) {
  1199. return callback.apply(null, arr);
  1200. };
  1201. };
  1202. /***/ }),
  1203. /***/ "./node_modules/axios/lib/utils.js":
  1204. /*!*****************************************!*\
  1205. !*** ./node_modules/axios/lib/utils.js ***!
  1206. \*****************************************/
  1207. /*! no static exports found */
  1208. /***/ (function(module, exports, __webpack_require__) {
  1209. "use strict";
  1210. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1211. var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
  1212. /*global toString:true*/
  1213. // utils is a library of generic helper functions non-specific to axios
  1214. var toString = Object.prototype.toString;
  1215. /**
  1216. * Determine if a value is an Array
  1217. *
  1218. * @param {Object} val The value to test
  1219. * @returns {boolean} True if value is an Array, otherwise false
  1220. */
  1221. function isArray(val) {
  1222. return toString.call(val) === '[object Array]';
  1223. }
  1224. /**
  1225. * Determine if a value is an ArrayBuffer
  1226. *
  1227. * @param {Object} val The value to test
  1228. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1229. */
  1230. function isArrayBuffer(val) {
  1231. return toString.call(val) === '[object ArrayBuffer]';
  1232. }
  1233. /**
  1234. * Determine if a value is a FormData
  1235. *
  1236. * @param {Object} val The value to test
  1237. * @returns {boolean} True if value is an FormData, otherwise false
  1238. */
  1239. function isFormData(val) {
  1240. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1241. }
  1242. /**
  1243. * Determine if a value is a view on an ArrayBuffer
  1244. *
  1245. * @param {Object} val The value to test
  1246. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1247. */
  1248. function isArrayBufferView(val) {
  1249. var result;
  1250. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1251. result = ArrayBuffer.isView(val);
  1252. } else {
  1253. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1254. }
  1255. return result;
  1256. }
  1257. /**
  1258. * Determine if a value is a String
  1259. *
  1260. * @param {Object} val The value to test
  1261. * @returns {boolean} True if value is a String, otherwise false
  1262. */
  1263. function isString(val) {
  1264. return typeof val === 'string';
  1265. }
  1266. /**
  1267. * Determine if a value is a Number
  1268. *
  1269. * @param {Object} val The value to test
  1270. * @returns {boolean} True if value is a Number, otherwise false
  1271. */
  1272. function isNumber(val) {
  1273. return typeof val === 'number';
  1274. }
  1275. /**
  1276. * Determine if a value is undefined
  1277. *
  1278. * @param {Object} val The value to test
  1279. * @returns {boolean} True if the value is undefined, otherwise false
  1280. */
  1281. function isUndefined(val) {
  1282. return typeof val === 'undefined';
  1283. }
  1284. /**
  1285. * Determine if a value is an Object
  1286. *
  1287. * @param {Object} val The value to test
  1288. * @returns {boolean} True if value is an Object, otherwise false
  1289. */
  1290. function isObject(val) {
  1291. return val !== null && typeof val === 'object';
  1292. }
  1293. /**
  1294. * Determine if a value is a Date
  1295. *
  1296. * @param {Object} val The value to test
  1297. * @returns {boolean} True if value is a Date, otherwise false
  1298. */
  1299. function isDate(val) {
  1300. return toString.call(val) === '[object Date]';
  1301. }
  1302. /**
  1303. * Determine if a value is a File
  1304. *
  1305. * @param {Object} val The value to test
  1306. * @returns {boolean} True if value is a File, otherwise false
  1307. */
  1308. function isFile(val) {
  1309. return toString.call(val) === '[object File]';
  1310. }
  1311. /**
  1312. * Determine if a value is a Blob
  1313. *
  1314. * @param {Object} val The value to test
  1315. * @returns {boolean} True if value is a Blob, otherwise false
  1316. */
  1317. function isBlob(val) {
  1318. return toString.call(val) === '[object Blob]';
  1319. }
  1320. /**
  1321. * Determine if a value is a Function
  1322. *
  1323. * @param {Object} val The value to test
  1324. * @returns {boolean} True if value is a Function, otherwise false
  1325. */
  1326. function isFunction(val) {
  1327. return toString.call(val) === '[object Function]';
  1328. }
  1329. /**
  1330. * Determine if a value is a Stream
  1331. *
  1332. * @param {Object} val The value to test
  1333. * @returns {boolean} True if value is a Stream, otherwise false
  1334. */
  1335. function isStream(val) {
  1336. return isObject(val) && isFunction(val.pipe);
  1337. }
  1338. /**
  1339. * Determine if a value is a URLSearchParams object
  1340. *
  1341. * @param {Object} val The value to test
  1342. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1343. */
  1344. function isURLSearchParams(val) {
  1345. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1346. }
  1347. /**
  1348. * Trim excess whitespace off the beginning and end of a string
  1349. *
  1350. * @param {String} str The String to trim
  1351. * @returns {String} The String freed of excess whitespace
  1352. */
  1353. function trim(str) {
  1354. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1355. }
  1356. /**
  1357. * Determine if we're running in a standard browser environment
  1358. *
  1359. * This allows axios to run in a web worker, and react-native.
  1360. * Both environments support XMLHttpRequest, but not fully standard globals.
  1361. *
  1362. * web workers:
  1363. * typeof window -> undefined
  1364. * typeof document -> undefined
  1365. *
  1366. * react-native:
  1367. * navigator.product -> 'ReactNative'
  1368. * nativescript
  1369. * navigator.product -> 'NativeScript' or 'NS'
  1370. */
  1371. function isStandardBrowserEnv() {
  1372. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1373. navigator.product === 'NativeScript' ||
  1374. navigator.product === 'NS')) {
  1375. return false;
  1376. }
  1377. return (
  1378. typeof window !== 'undefined' &&
  1379. typeof document !== 'undefined'
  1380. );
  1381. }
  1382. /**
  1383. * Iterate over an Array or an Object invoking a function for each item.
  1384. *
  1385. * If `obj` is an Array callback will be called passing
  1386. * the value, index, and complete array for each item.
  1387. *
  1388. * If 'obj' is an Object callback will be called passing
  1389. * the value, key, and complete object for each property.
  1390. *
  1391. * @param {Object|Array} obj The object to iterate
  1392. * @param {Function} fn The callback to invoke for each item
  1393. */
  1394. function forEach(obj, fn) {
  1395. // Don't bother if no value provided
  1396. if (obj === null || typeof obj === 'undefined') {
  1397. return;
  1398. }
  1399. // Force an array if not already something iterable
  1400. if (typeof obj !== 'object') {
  1401. /*eslint no-param-reassign:0*/
  1402. obj = [obj];
  1403. }
  1404. if (isArray(obj)) {
  1405. // Iterate over array values
  1406. for (var i = 0, l = obj.length; i < l; i++) {
  1407. fn.call(null, obj[i], i, obj);
  1408. }
  1409. } else {
  1410. // Iterate over object keys
  1411. for (var key in obj) {
  1412. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1413. fn.call(null, obj[key], key, obj);
  1414. }
  1415. }
  1416. }
  1417. }
  1418. /**
  1419. * Accepts varargs expecting each argument to be an object, then
  1420. * immutably merges the properties of each object and returns result.
  1421. *
  1422. * When multiple objects contain the same key the later object in
  1423. * the arguments list will take precedence.
  1424. *
  1425. * Example:
  1426. *
  1427. * ```js
  1428. * var result = merge({foo: 123}, {foo: 456});
  1429. * console.log(result.foo); // outputs 456
  1430. * ```
  1431. *
  1432. * @param {Object} obj1 Object to merge
  1433. * @returns {Object} Result of all merge properties
  1434. */
  1435. function merge(/* obj1, obj2, obj3, ... */) {
  1436. var result = {};
  1437. function assignValue(val, key) {
  1438. if (typeof result[key] === 'object' && typeof val === 'object') {
  1439. result[key] = merge(result[key], val);
  1440. } else {
  1441. result[key] = val;
  1442. }
  1443. }
  1444. for (var i = 0, l = arguments.length; i < l; i++) {
  1445. forEach(arguments[i], assignValue);
  1446. }
  1447. return result;
  1448. }
  1449. /**
  1450. * Function equal to merge with the difference being that no reference
  1451. * to original objects is kept.
  1452. *
  1453. * @see merge
  1454. * @param {Object} obj1 Object to merge
  1455. * @returns {Object} Result of all merge properties
  1456. */
  1457. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1458. var result = {};
  1459. function assignValue(val, key) {
  1460. if (typeof result[key] === 'object' && typeof val === 'object') {
  1461. result[key] = deepMerge(result[key], val);
  1462. } else if (typeof val === 'object') {
  1463. result[key] = deepMerge({}, val);
  1464. } else {
  1465. result[key] = val;
  1466. }
  1467. }
  1468. for (var i = 0, l = arguments.length; i < l; i++) {
  1469. forEach(arguments[i], assignValue);
  1470. }
  1471. return result;
  1472. }
  1473. /**
  1474. * Extends object a by mutably adding to it the properties of object b.
  1475. *
  1476. * @param {Object} a The object to be extended
  1477. * @param {Object} b The object to copy properties from
  1478. * @param {Object} thisArg The object to bind function to
  1479. * @return {Object} The resulting value of object a
  1480. */
  1481. function extend(a, b, thisArg) {
  1482. forEach(b, function assignValue(val, key) {
  1483. if (thisArg && typeof val === 'function') {
  1484. a[key] = bind(val, thisArg);
  1485. } else {
  1486. a[key] = val;
  1487. }
  1488. });
  1489. return a;
  1490. }
  1491. module.exports = {
  1492. isArray: isArray,
  1493. isArrayBuffer: isArrayBuffer,
  1494. isBuffer: isBuffer,
  1495. isFormData: isFormData,
  1496. isArrayBufferView: isArrayBufferView,
  1497. isString: isString,
  1498. isNumber: isNumber,
  1499. isObject: isObject,
  1500. isUndefined: isUndefined,
  1501. isDate: isDate,
  1502. isFile: isFile,
  1503. isBlob: isBlob,
  1504. isFunction: isFunction,
  1505. isStream: isStream,
  1506. isURLSearchParams: isURLSearchParams,
  1507. isStandardBrowserEnv: isStandardBrowserEnv,
  1508. forEach: forEach,
  1509. merge: merge,
  1510. deepMerge: deepMerge,
  1511. extend: extend,
  1512. trim: trim
  1513. };
  1514. /***/ }),
  1515. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1516. /*!***************************************************************************************************************************************************************************!*\
  1517. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1518. \***************************************************************************************************************************************************************************/
  1519. /*! exports provided: default */
  1520. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1521. "use strict";
  1522. __webpack_require__.r(__webpack_exports__);
  1523. //
  1524. //
  1525. //
  1526. //
  1527. //
  1528. //
  1529. //
  1530. //
  1531. //
  1532. //
  1533. //
  1534. //
  1535. //
  1536. //
  1537. //
  1538. //
  1539. /* harmony default export */ __webpack_exports__["default"] = ({
  1540. mounted: function mounted() {
  1541. console.log('Component mounted.');
  1542. }
  1543. });
  1544. /***/ }),
  1545. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1546. /*!*****************************************************!*\
  1547. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1548. \*****************************************************/
  1549. /*! no static exports found */
  1550. /***/ (function(module, exports, __webpack_require__) {
  1551. /*!
  1552. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  1553. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1554. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1555. */
  1556. (function (global, factory) {
  1557. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1558. undefined;
  1559. }(this, (function (exports, $, Popper) { 'use strict';
  1560. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1561. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1562. function _defineProperties(target, props) {
  1563. for (var i = 0; i < props.length; i++) {
  1564. var descriptor = props[i];
  1565. descriptor.enumerable = descriptor.enumerable || false;
  1566. descriptor.configurable = true;
  1567. if ("value" in descriptor) descriptor.writable = true;
  1568. Object.defineProperty(target, descriptor.key, descriptor);
  1569. }
  1570. }
  1571. function _createClass(Constructor, protoProps, staticProps) {
  1572. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1573. if (staticProps) _defineProperties(Constructor, staticProps);
  1574. return Constructor;
  1575. }
  1576. function _defineProperty(obj, key, value) {
  1577. if (key in obj) {
  1578. Object.defineProperty(obj, key, {
  1579. value: value,
  1580. enumerable: true,
  1581. configurable: true,
  1582. writable: true
  1583. });
  1584. } else {
  1585. obj[key] = value;
  1586. }
  1587. return obj;
  1588. }
  1589. function ownKeys(object, enumerableOnly) {
  1590. var keys = Object.keys(object);
  1591. if (Object.getOwnPropertySymbols) {
  1592. var symbols = Object.getOwnPropertySymbols(object);
  1593. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  1594. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  1595. });
  1596. keys.push.apply(keys, symbols);
  1597. }
  1598. return keys;
  1599. }
  1600. function _objectSpread2(target) {
  1601. for (var i = 1; i < arguments.length; i++) {
  1602. var source = arguments[i] != null ? arguments[i] : {};
  1603. if (i % 2) {
  1604. ownKeys(Object(source), true).forEach(function (key) {
  1605. _defineProperty(target, key, source[key]);
  1606. });
  1607. } else if (Object.getOwnPropertyDescriptors) {
  1608. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  1609. } else {
  1610. ownKeys(Object(source)).forEach(function (key) {
  1611. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  1612. });
  1613. }
  1614. }
  1615. return target;
  1616. }
  1617. function _inheritsLoose(subClass, superClass) {
  1618. subClass.prototype = Object.create(superClass.prototype);
  1619. subClass.prototype.constructor = subClass;
  1620. subClass.__proto__ = superClass;
  1621. }
  1622. /**
  1623. * --------------------------------------------------------------------------
  1624. * Bootstrap (v4.4.1): util.js
  1625. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1626. * --------------------------------------------------------------------------
  1627. */
  1628. /**
  1629. * ------------------------------------------------------------------------
  1630. * Private TransitionEnd Helpers
  1631. * ------------------------------------------------------------------------
  1632. */
  1633. var TRANSITION_END = 'transitionend';
  1634. var MAX_UID = 1000000;
  1635. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1636. function toType(obj) {
  1637. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1638. }
  1639. function getSpecialTransitionEndEvent() {
  1640. return {
  1641. bindType: TRANSITION_END,
  1642. delegateType: TRANSITION_END,
  1643. handle: function handle(event) {
  1644. if ($(event.target).is(this)) {
  1645. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1646. }
  1647. return undefined; // eslint-disable-line no-undefined
  1648. }
  1649. };
  1650. }
  1651. function transitionEndEmulator(duration) {
  1652. var _this = this;
  1653. var called = false;
  1654. $(this).one(Util.TRANSITION_END, function () {
  1655. called = true;
  1656. });
  1657. setTimeout(function () {
  1658. if (!called) {
  1659. Util.triggerTransitionEnd(_this);
  1660. }
  1661. }, duration);
  1662. return this;
  1663. }
  1664. function setTransitionEndSupport() {
  1665. $.fn.emulateTransitionEnd = transitionEndEmulator;
  1666. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1667. }
  1668. /**
  1669. * --------------------------------------------------------------------------
  1670. * Public Util Api
  1671. * --------------------------------------------------------------------------
  1672. */
  1673. var Util = {
  1674. TRANSITION_END: 'bsTransitionEnd',
  1675. getUID: function getUID(prefix) {
  1676. do {
  1677. // eslint-disable-next-line no-bitwise
  1678. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1679. } while (document.getElementById(prefix));
  1680. return prefix;
  1681. },
  1682. getSelectorFromElement: function getSelectorFromElement(element) {
  1683. var selector = element.getAttribute('data-target');
  1684. if (!selector || selector === '#') {
  1685. var hrefAttr = element.getAttribute('href');
  1686. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1687. }
  1688. try {
  1689. return document.querySelector(selector) ? selector : null;
  1690. } catch (err) {
  1691. return null;
  1692. }
  1693. },
  1694. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1695. if (!element) {
  1696. return 0;
  1697. } // Get transition-duration of the element
  1698. var transitionDuration = $(element).css('transition-duration');
  1699. var transitionDelay = $(element).css('transition-delay');
  1700. var floatTransitionDuration = parseFloat(transitionDuration);
  1701. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1702. if (!floatTransitionDuration && !floatTransitionDelay) {
  1703. return 0;
  1704. } // If multiple durations are defined, take the first
  1705. transitionDuration = transitionDuration.split(',')[0];
  1706. transitionDelay = transitionDelay.split(',')[0];
  1707. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1708. },
  1709. reflow: function reflow(element) {
  1710. return element.offsetHeight;
  1711. },
  1712. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1713. $(element).trigger(TRANSITION_END);
  1714. },
  1715. // TODO: Remove in v5
  1716. supportsTransitionEnd: function supportsTransitionEnd() {
  1717. return Boolean(TRANSITION_END);
  1718. },
  1719. isElement: function isElement(obj) {
  1720. return (obj[0] || obj).nodeType;
  1721. },
  1722. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1723. for (var property in configTypes) {
  1724. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1725. var expectedTypes = configTypes[property];
  1726. var value = config[property];
  1727. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1728. if (!new RegExp(expectedTypes).test(valueType)) {
  1729. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1730. }
  1731. }
  1732. }
  1733. },
  1734. findShadowRoot: function findShadowRoot(element) {
  1735. if (!document.documentElement.attachShadow) {
  1736. return null;
  1737. } // Can find the shadow root otherwise it'll return the document
  1738. if (typeof element.getRootNode === 'function') {
  1739. var root = element.getRootNode();
  1740. return root instanceof ShadowRoot ? root : null;
  1741. }
  1742. if (element instanceof ShadowRoot) {
  1743. return element;
  1744. } // when we don't find a shadow root
  1745. if (!element.parentNode) {
  1746. return null;
  1747. }
  1748. return Util.findShadowRoot(element.parentNode);
  1749. },
  1750. jQueryDetection: function jQueryDetection() {
  1751. if (typeof $ === 'undefined') {
  1752. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  1753. }
  1754. var version = $.fn.jquery.split(' ')[0].split('.');
  1755. var minMajor = 1;
  1756. var ltMajor = 2;
  1757. var minMinor = 9;
  1758. var minPatch = 1;
  1759. var maxMajor = 4;
  1760. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  1761. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  1762. }
  1763. }
  1764. };
  1765. Util.jQueryDetection();
  1766. setTransitionEndSupport();
  1767. /**
  1768. * ------------------------------------------------------------------------
  1769. * Constants
  1770. * ------------------------------------------------------------------------
  1771. */
  1772. var NAME = 'alert';
  1773. var VERSION = '4.4.1';
  1774. var DATA_KEY = 'bs.alert';
  1775. var EVENT_KEY = "." + DATA_KEY;
  1776. var DATA_API_KEY = '.data-api';
  1777. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1778. var Selector = {
  1779. DISMISS: '[data-dismiss="alert"]'
  1780. };
  1781. var Event = {
  1782. CLOSE: "close" + EVENT_KEY,
  1783. CLOSED: "closed" + EVENT_KEY,
  1784. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  1785. };
  1786. var ClassName = {
  1787. ALERT: 'alert',
  1788. FADE: 'fade',
  1789. SHOW: 'show'
  1790. };
  1791. /**
  1792. * ------------------------------------------------------------------------
  1793. * Class Definition
  1794. * ------------------------------------------------------------------------
  1795. */
  1796. var Alert =
  1797. /*#__PURE__*/
  1798. function () {
  1799. function Alert(element) {
  1800. this._element = element;
  1801. } // Getters
  1802. var _proto = Alert.prototype;
  1803. // Public
  1804. _proto.close = function close(element) {
  1805. var rootElement = this._element;
  1806. if (element) {
  1807. rootElement = this._getRootElement(element);
  1808. }
  1809. var customEvent = this._triggerCloseEvent(rootElement);
  1810. if (customEvent.isDefaultPrevented()) {
  1811. return;
  1812. }
  1813. this._removeElement(rootElement);
  1814. };
  1815. _proto.dispose = function dispose() {
  1816. $.removeData(this._element, DATA_KEY);
  1817. this._element = null;
  1818. } // Private
  1819. ;
  1820. _proto._getRootElement = function _getRootElement(element) {
  1821. var selector = Util.getSelectorFromElement(element);
  1822. var parent = false;
  1823. if (selector) {
  1824. parent = document.querySelector(selector);
  1825. }
  1826. if (!parent) {
  1827. parent = $(element).closest("." + ClassName.ALERT)[0];
  1828. }
  1829. return parent;
  1830. };
  1831. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1832. var closeEvent = $.Event(Event.CLOSE);
  1833. $(element).trigger(closeEvent);
  1834. return closeEvent;
  1835. };
  1836. _proto._removeElement = function _removeElement(element) {
  1837. var _this = this;
  1838. $(element).removeClass(ClassName.SHOW);
  1839. if (!$(element).hasClass(ClassName.FADE)) {
  1840. this._destroyElement(element);
  1841. return;
  1842. }
  1843. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1844. $(element).one(Util.TRANSITION_END, function (event) {
  1845. return _this._destroyElement(element, event);
  1846. }).emulateTransitionEnd(transitionDuration);
  1847. };
  1848. _proto._destroyElement = function _destroyElement(element) {
  1849. $(element).detach().trigger(Event.CLOSED).remove();
  1850. } // Static
  1851. ;
  1852. Alert._jQueryInterface = function _jQueryInterface(config) {
  1853. return this.each(function () {
  1854. var $element = $(this);
  1855. var data = $element.data(DATA_KEY);
  1856. if (!data) {
  1857. data = new Alert(this);
  1858. $element.data(DATA_KEY, data);
  1859. }
  1860. if (config === 'close') {
  1861. data[config](this);
  1862. }
  1863. });
  1864. };
  1865. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1866. return function (event) {
  1867. if (event) {
  1868. event.preventDefault();
  1869. }
  1870. alertInstance.close(this);
  1871. };
  1872. };
  1873. _createClass(Alert, null, [{
  1874. key: "VERSION",
  1875. get: function get() {
  1876. return VERSION;
  1877. }
  1878. }]);
  1879. return Alert;
  1880. }();
  1881. /**
  1882. * ------------------------------------------------------------------------
  1883. * Data Api implementation
  1884. * ------------------------------------------------------------------------
  1885. */
  1886. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  1887. /**
  1888. * ------------------------------------------------------------------------
  1889. * jQuery
  1890. * ------------------------------------------------------------------------
  1891. */
  1892. $.fn[NAME] = Alert._jQueryInterface;
  1893. $.fn[NAME].Constructor = Alert;
  1894. $.fn[NAME].noConflict = function () {
  1895. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1896. return Alert._jQueryInterface;
  1897. };
  1898. /**
  1899. * ------------------------------------------------------------------------
  1900. * Constants
  1901. * ------------------------------------------------------------------------
  1902. */
  1903. var NAME$1 = 'button';
  1904. var VERSION$1 = '4.4.1';
  1905. var DATA_KEY$1 = 'bs.button';
  1906. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1907. var DATA_API_KEY$1 = '.data-api';
  1908. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  1909. var ClassName$1 = {
  1910. ACTIVE: 'active',
  1911. BUTTON: 'btn',
  1912. FOCUS: 'focus'
  1913. };
  1914. var Selector$1 = {
  1915. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  1916. DATA_TOGGLES: '[data-toggle="buttons"]',
  1917. DATA_TOGGLE: '[data-toggle="button"]',
  1918. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  1919. INPUT: 'input:not([type="hidden"])',
  1920. ACTIVE: '.active',
  1921. BUTTON: '.btn'
  1922. };
  1923. var Event$1 = {
  1924. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  1925. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  1926. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  1927. };
  1928. /**
  1929. * ------------------------------------------------------------------------
  1930. * Class Definition
  1931. * ------------------------------------------------------------------------
  1932. */
  1933. var Button =
  1934. /*#__PURE__*/
  1935. function () {
  1936. function Button(element) {
  1937. this._element = element;
  1938. } // Getters
  1939. var _proto = Button.prototype;
  1940. // Public
  1941. _proto.toggle = function toggle() {
  1942. var triggerChangeEvent = true;
  1943. var addAriaPressed = true;
  1944. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  1945. if (rootElement) {
  1946. var input = this._element.querySelector(Selector$1.INPUT);
  1947. if (input) {
  1948. if (input.type === 'radio') {
  1949. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  1950. triggerChangeEvent = false;
  1951. } else {
  1952. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  1953. if (activeElement) {
  1954. $(activeElement).removeClass(ClassName$1.ACTIVE);
  1955. }
  1956. }
  1957. } else if (input.type === 'checkbox') {
  1958. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  1959. triggerChangeEvent = false;
  1960. }
  1961. } else {
  1962. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  1963. triggerChangeEvent = false;
  1964. }
  1965. if (triggerChangeEvent) {
  1966. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  1967. $(input).trigger('change');
  1968. }
  1969. input.focus();
  1970. addAriaPressed = false;
  1971. }
  1972. }
  1973. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  1974. if (addAriaPressed) {
  1975. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  1976. }
  1977. if (triggerChangeEvent) {
  1978. $(this._element).toggleClass(ClassName$1.ACTIVE);
  1979. }
  1980. }
  1981. };
  1982. _proto.dispose = function dispose() {
  1983. $.removeData(this._element, DATA_KEY$1);
  1984. this._element = null;
  1985. } // Static
  1986. ;
  1987. Button._jQueryInterface = function _jQueryInterface(config) {
  1988. return this.each(function () {
  1989. var data = $(this).data(DATA_KEY$1);
  1990. if (!data) {
  1991. data = new Button(this);
  1992. $(this).data(DATA_KEY$1, data);
  1993. }
  1994. if (config === 'toggle') {
  1995. data[config]();
  1996. }
  1997. });
  1998. };
  1999. _createClass(Button, null, [{
  2000. key: "VERSION",
  2001. get: function get() {
  2002. return VERSION$1;
  2003. }
  2004. }]);
  2005. return Button;
  2006. }();
  2007. /**
  2008. * ------------------------------------------------------------------------
  2009. * Data Api implementation
  2010. * ------------------------------------------------------------------------
  2011. */
  2012. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2013. var button = event.target;
  2014. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2015. button = $(button).closest(Selector$1.BUTTON)[0];
  2016. }
  2017. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2018. event.preventDefault(); // work around Firefox bug #1540995
  2019. } else {
  2020. var inputBtn = button.querySelector(Selector$1.INPUT);
  2021. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2022. event.preventDefault(); // work around Firefox bug #1540995
  2023. return;
  2024. }
  2025. Button._jQueryInterface.call($(button), 'toggle');
  2026. }
  2027. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2028. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2029. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2030. });
  2031. $(window).on(Event$1.LOAD_DATA_API, function () {
  2032. // ensure correct active class is set to match the controls' actual values/states
  2033. // find all checkboxes/readio buttons inside data-toggle groups
  2034. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2035. for (var i = 0, len = buttons.length; i < len; i++) {
  2036. var button = buttons[i];
  2037. var input = button.querySelector(Selector$1.INPUT);
  2038. if (input.checked || input.hasAttribute('checked')) {
  2039. button.classList.add(ClassName$1.ACTIVE);
  2040. } else {
  2041. button.classList.remove(ClassName$1.ACTIVE);
  2042. }
  2043. } // find all button toggles
  2044. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2045. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2046. var _button = buttons[_i];
  2047. if (_button.getAttribute('aria-pressed') === 'true') {
  2048. _button.classList.add(ClassName$1.ACTIVE);
  2049. } else {
  2050. _button.classList.remove(ClassName$1.ACTIVE);
  2051. }
  2052. }
  2053. });
  2054. /**
  2055. * ------------------------------------------------------------------------
  2056. * jQuery
  2057. * ------------------------------------------------------------------------
  2058. */
  2059. $.fn[NAME$1] = Button._jQueryInterface;
  2060. $.fn[NAME$1].Constructor = Button;
  2061. $.fn[NAME$1].noConflict = function () {
  2062. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2063. return Button._jQueryInterface;
  2064. };
  2065. /**
  2066. * ------------------------------------------------------------------------
  2067. * Constants
  2068. * ------------------------------------------------------------------------
  2069. */
  2070. var NAME$2 = 'carousel';
  2071. var VERSION$2 = '4.4.1';
  2072. var DATA_KEY$2 = 'bs.carousel';
  2073. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2074. var DATA_API_KEY$2 = '.data-api';
  2075. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2076. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2077. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2078. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2079. var SWIPE_THRESHOLD = 40;
  2080. var Default = {
  2081. interval: 5000,
  2082. keyboard: true,
  2083. slide: false,
  2084. pause: 'hover',
  2085. wrap: true,
  2086. touch: true
  2087. };
  2088. var DefaultType = {
  2089. interval: '(number|boolean)',
  2090. keyboard: 'boolean',
  2091. slide: '(boolean|string)',
  2092. pause: '(string|boolean)',
  2093. wrap: 'boolean',
  2094. touch: 'boolean'
  2095. };
  2096. var Direction = {
  2097. NEXT: 'next',
  2098. PREV: 'prev',
  2099. LEFT: 'left',
  2100. RIGHT: 'right'
  2101. };
  2102. var Event$2 = {
  2103. SLIDE: "slide" + EVENT_KEY$2,
  2104. SLID: "slid" + EVENT_KEY$2,
  2105. KEYDOWN: "keydown" + EVENT_KEY$2,
  2106. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2107. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2108. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2109. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2110. TOUCHEND: "touchend" + EVENT_KEY$2,
  2111. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2112. POINTERUP: "pointerup" + EVENT_KEY$2,
  2113. DRAG_START: "dragstart" + EVENT_KEY$2,
  2114. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2115. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2116. };
  2117. var ClassName$2 = {
  2118. CAROUSEL: 'carousel',
  2119. ACTIVE: 'active',
  2120. SLIDE: 'slide',
  2121. RIGHT: 'carousel-item-right',
  2122. LEFT: 'carousel-item-left',
  2123. NEXT: 'carousel-item-next',
  2124. PREV: 'carousel-item-prev',
  2125. ITEM: 'carousel-item',
  2126. POINTER_EVENT: 'pointer-event'
  2127. };
  2128. var Selector$2 = {
  2129. ACTIVE: '.active',
  2130. ACTIVE_ITEM: '.active.carousel-item',
  2131. ITEM: '.carousel-item',
  2132. ITEM_IMG: '.carousel-item img',
  2133. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2134. INDICATORS: '.carousel-indicators',
  2135. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2136. DATA_RIDE: '[data-ride="carousel"]'
  2137. };
  2138. var PointerType = {
  2139. TOUCH: 'touch',
  2140. PEN: 'pen'
  2141. };
  2142. /**
  2143. * ------------------------------------------------------------------------
  2144. * Class Definition
  2145. * ------------------------------------------------------------------------
  2146. */
  2147. var Carousel =
  2148. /*#__PURE__*/
  2149. function () {
  2150. function Carousel(element, config) {
  2151. this._items = null;
  2152. this._interval = null;
  2153. this._activeElement = null;
  2154. this._isPaused = false;
  2155. this._isSliding = false;
  2156. this.touchTimeout = null;
  2157. this.touchStartX = 0;
  2158. this.touchDeltaX = 0;
  2159. this._config = this._getConfig(config);
  2160. this._element = element;
  2161. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2162. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2163. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2164. this._addEventListeners();
  2165. } // Getters
  2166. var _proto = Carousel.prototype;
  2167. // Public
  2168. _proto.next = function next() {
  2169. if (!this._isSliding) {
  2170. this._slide(Direction.NEXT);
  2171. }
  2172. };
  2173. _proto.nextWhenVisible = function nextWhenVisible() {
  2174. // Don't call next when the page isn't visible
  2175. // or the carousel or its parent isn't visible
  2176. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2177. this.next();
  2178. }
  2179. };
  2180. _proto.prev = function prev() {
  2181. if (!this._isSliding) {
  2182. this._slide(Direction.PREV);
  2183. }
  2184. };
  2185. _proto.pause = function pause(event) {
  2186. if (!event) {
  2187. this._isPaused = true;
  2188. }
  2189. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2190. Util.triggerTransitionEnd(this._element);
  2191. this.cycle(true);
  2192. }
  2193. clearInterval(this._interval);
  2194. this._interval = null;
  2195. };
  2196. _proto.cycle = function cycle(event) {
  2197. if (!event) {
  2198. this._isPaused = false;
  2199. }
  2200. if (this._interval) {
  2201. clearInterval(this._interval);
  2202. this._interval = null;
  2203. }
  2204. if (this._config.interval && !this._isPaused) {
  2205. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2206. }
  2207. };
  2208. _proto.to = function to(index) {
  2209. var _this = this;
  2210. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2211. var activeIndex = this._getItemIndex(this._activeElement);
  2212. if (index > this._items.length - 1 || index < 0) {
  2213. return;
  2214. }
  2215. if (this._isSliding) {
  2216. $(this._element).one(Event$2.SLID, function () {
  2217. return _this.to(index);
  2218. });
  2219. return;
  2220. }
  2221. if (activeIndex === index) {
  2222. this.pause();
  2223. this.cycle();
  2224. return;
  2225. }
  2226. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2227. this._slide(direction, this._items[index]);
  2228. };
  2229. _proto.dispose = function dispose() {
  2230. $(this._element).off(EVENT_KEY$2);
  2231. $.removeData(this._element, DATA_KEY$2);
  2232. this._items = null;
  2233. this._config = null;
  2234. this._element = null;
  2235. this._interval = null;
  2236. this._isPaused = null;
  2237. this._isSliding = null;
  2238. this._activeElement = null;
  2239. this._indicatorsElement = null;
  2240. } // Private
  2241. ;
  2242. _proto._getConfig = function _getConfig(config) {
  2243. config = _objectSpread2({}, Default, {}, config);
  2244. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2245. return config;
  2246. };
  2247. _proto._handleSwipe = function _handleSwipe() {
  2248. var absDeltax = Math.abs(this.touchDeltaX);
  2249. if (absDeltax <= SWIPE_THRESHOLD) {
  2250. return;
  2251. }
  2252. var direction = absDeltax / this.touchDeltaX;
  2253. this.touchDeltaX = 0; // swipe left
  2254. if (direction > 0) {
  2255. this.prev();
  2256. } // swipe right
  2257. if (direction < 0) {
  2258. this.next();
  2259. }
  2260. };
  2261. _proto._addEventListeners = function _addEventListeners() {
  2262. var _this2 = this;
  2263. if (this._config.keyboard) {
  2264. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2265. return _this2._keydown(event);
  2266. });
  2267. }
  2268. if (this._config.pause === 'hover') {
  2269. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2270. return _this2.pause(event);
  2271. }).on(Event$2.MOUSELEAVE, function (event) {
  2272. return _this2.cycle(event);
  2273. });
  2274. }
  2275. if (this._config.touch) {
  2276. this._addTouchEventListeners();
  2277. }
  2278. };
  2279. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2280. var _this3 = this;
  2281. if (!this._touchSupported) {
  2282. return;
  2283. }
  2284. var start = function start(event) {
  2285. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2286. _this3.touchStartX = event.originalEvent.clientX;
  2287. } else if (!_this3._pointerEvent) {
  2288. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2289. }
  2290. };
  2291. var move = function move(event) {
  2292. // ensure swiping with one touch and not pinching
  2293. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2294. _this3.touchDeltaX = 0;
  2295. } else {
  2296. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2297. }
  2298. };
  2299. var end = function end(event) {
  2300. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2301. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2302. }
  2303. _this3._handleSwipe();
  2304. if (_this3._config.pause === 'hover') {
  2305. // If it's a touch-enabled device, mouseenter/leave are fired as
  2306. // part of the mouse compatibility events on first tap - the carousel
  2307. // would stop cycling until user tapped out of it;
  2308. // here, we listen for touchend, explicitly pause the carousel
  2309. // (as if it's the second time we tap on it, mouseenter compat event
  2310. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2311. // events to fire) we explicitly restart cycling
  2312. _this3.pause();
  2313. if (_this3.touchTimeout) {
  2314. clearTimeout(_this3.touchTimeout);
  2315. }
  2316. _this3.touchTimeout = setTimeout(function (event) {
  2317. return _this3.cycle(event);
  2318. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2319. }
  2320. };
  2321. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2322. return e.preventDefault();
  2323. });
  2324. if (this._pointerEvent) {
  2325. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2326. return start(event);
  2327. });
  2328. $(this._element).on(Event$2.POINTERUP, function (event) {
  2329. return end(event);
  2330. });
  2331. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2332. } else {
  2333. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2334. return start(event);
  2335. });
  2336. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2337. return move(event);
  2338. });
  2339. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2340. return end(event);
  2341. });
  2342. }
  2343. };
  2344. _proto._keydown = function _keydown(event) {
  2345. if (/input|textarea/i.test(event.target.tagName)) {
  2346. return;
  2347. }
  2348. switch (event.which) {
  2349. case ARROW_LEFT_KEYCODE:
  2350. event.preventDefault();
  2351. this.prev();
  2352. break;
  2353. case ARROW_RIGHT_KEYCODE:
  2354. event.preventDefault();
  2355. this.next();
  2356. break;
  2357. }
  2358. };
  2359. _proto._getItemIndex = function _getItemIndex(element) {
  2360. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2361. return this._items.indexOf(element);
  2362. };
  2363. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2364. var isNextDirection = direction === Direction.NEXT;
  2365. var isPrevDirection = direction === Direction.PREV;
  2366. var activeIndex = this._getItemIndex(activeElement);
  2367. var lastItemIndex = this._items.length - 1;
  2368. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2369. if (isGoingToWrap && !this._config.wrap) {
  2370. return activeElement;
  2371. }
  2372. var delta = direction === Direction.PREV ? -1 : 1;
  2373. var itemIndex = (activeIndex + delta) % this._items.length;
  2374. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2375. };
  2376. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2377. var targetIndex = this._getItemIndex(relatedTarget);
  2378. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2379. var slideEvent = $.Event(Event$2.SLIDE, {
  2380. relatedTarget: relatedTarget,
  2381. direction: eventDirectionName,
  2382. from: fromIndex,
  2383. to: targetIndex
  2384. });
  2385. $(this._element).trigger(slideEvent);
  2386. return slideEvent;
  2387. };
  2388. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2389. if (this._indicatorsElement) {
  2390. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2391. $(indicators).removeClass(ClassName$2.ACTIVE);
  2392. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2393. if (nextIndicator) {
  2394. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2395. }
  2396. }
  2397. };
  2398. _proto._slide = function _slide(direction, element) {
  2399. var _this4 = this;
  2400. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2401. var activeElementIndex = this._getItemIndex(activeElement);
  2402. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2403. var nextElementIndex = this._getItemIndex(nextElement);
  2404. var isCycling = Boolean(this._interval);
  2405. var directionalClassName;
  2406. var orderClassName;
  2407. var eventDirectionName;
  2408. if (direction === Direction.NEXT) {
  2409. directionalClassName = ClassName$2.LEFT;
  2410. orderClassName = ClassName$2.NEXT;
  2411. eventDirectionName = Direction.LEFT;
  2412. } else {
  2413. directionalClassName = ClassName$2.RIGHT;
  2414. orderClassName = ClassName$2.PREV;
  2415. eventDirectionName = Direction.RIGHT;
  2416. }
  2417. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2418. this._isSliding = false;
  2419. return;
  2420. }
  2421. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2422. if (slideEvent.isDefaultPrevented()) {
  2423. return;
  2424. }
  2425. if (!activeElement || !nextElement) {
  2426. // Some weirdness is happening, so we bail
  2427. return;
  2428. }
  2429. this._isSliding = true;
  2430. if (isCycling) {
  2431. this.pause();
  2432. }
  2433. this._setActiveIndicatorElement(nextElement);
  2434. var slidEvent = $.Event(Event$2.SLID, {
  2435. relatedTarget: nextElement,
  2436. direction: eventDirectionName,
  2437. from: activeElementIndex,
  2438. to: nextElementIndex
  2439. });
  2440. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2441. $(nextElement).addClass(orderClassName);
  2442. Util.reflow(nextElement);
  2443. $(activeElement).addClass(directionalClassName);
  2444. $(nextElement).addClass(directionalClassName);
  2445. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2446. if (nextElementInterval) {
  2447. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2448. this._config.interval = nextElementInterval;
  2449. } else {
  2450. this._config.interval = this._config.defaultInterval || this._config.interval;
  2451. }
  2452. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2453. $(activeElement).one(Util.TRANSITION_END, function () {
  2454. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2455. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2456. _this4._isSliding = false;
  2457. setTimeout(function () {
  2458. return $(_this4._element).trigger(slidEvent);
  2459. }, 0);
  2460. }).emulateTransitionEnd(transitionDuration);
  2461. } else {
  2462. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2463. $(nextElement).addClass(ClassName$2.ACTIVE);
  2464. this._isSliding = false;
  2465. $(this._element).trigger(slidEvent);
  2466. }
  2467. if (isCycling) {
  2468. this.cycle();
  2469. }
  2470. } // Static
  2471. ;
  2472. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2473. return this.each(function () {
  2474. var data = $(this).data(DATA_KEY$2);
  2475. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2476. if (typeof config === 'object') {
  2477. _config = _objectSpread2({}, _config, {}, config);
  2478. }
  2479. var action = typeof config === 'string' ? config : _config.slide;
  2480. if (!data) {
  2481. data = new Carousel(this, _config);
  2482. $(this).data(DATA_KEY$2, data);
  2483. }
  2484. if (typeof config === 'number') {
  2485. data.to(config);
  2486. } else if (typeof action === 'string') {
  2487. if (typeof data[action] === 'undefined') {
  2488. throw new TypeError("No method named \"" + action + "\"");
  2489. }
  2490. data[action]();
  2491. } else if (_config.interval && _config.ride) {
  2492. data.pause();
  2493. data.cycle();
  2494. }
  2495. });
  2496. };
  2497. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2498. var selector = Util.getSelectorFromElement(this);
  2499. if (!selector) {
  2500. return;
  2501. }
  2502. var target = $(selector)[0];
  2503. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2504. return;
  2505. }
  2506. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2507. var slideIndex = this.getAttribute('data-slide-to');
  2508. if (slideIndex) {
  2509. config.interval = false;
  2510. }
  2511. Carousel._jQueryInterface.call($(target), config);
  2512. if (slideIndex) {
  2513. $(target).data(DATA_KEY$2).to(slideIndex);
  2514. }
  2515. event.preventDefault();
  2516. };
  2517. _createClass(Carousel, null, [{
  2518. key: "VERSION",
  2519. get: function get() {
  2520. return VERSION$2;
  2521. }
  2522. }, {
  2523. key: "Default",
  2524. get: function get() {
  2525. return Default;
  2526. }
  2527. }]);
  2528. return Carousel;
  2529. }();
  2530. /**
  2531. * ------------------------------------------------------------------------
  2532. * Data Api implementation
  2533. * ------------------------------------------------------------------------
  2534. */
  2535. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2536. $(window).on(Event$2.LOAD_DATA_API, function () {
  2537. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2538. for (var i = 0, len = carousels.length; i < len; i++) {
  2539. var $carousel = $(carousels[i]);
  2540. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2541. }
  2542. });
  2543. /**
  2544. * ------------------------------------------------------------------------
  2545. * jQuery
  2546. * ------------------------------------------------------------------------
  2547. */
  2548. $.fn[NAME$2] = Carousel._jQueryInterface;
  2549. $.fn[NAME$2].Constructor = Carousel;
  2550. $.fn[NAME$2].noConflict = function () {
  2551. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2552. return Carousel._jQueryInterface;
  2553. };
  2554. /**
  2555. * ------------------------------------------------------------------------
  2556. * Constants
  2557. * ------------------------------------------------------------------------
  2558. */
  2559. var NAME$3 = 'collapse';
  2560. var VERSION$3 = '4.4.1';
  2561. var DATA_KEY$3 = 'bs.collapse';
  2562. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2563. var DATA_API_KEY$3 = '.data-api';
  2564. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2565. var Default$1 = {
  2566. toggle: true,
  2567. parent: ''
  2568. };
  2569. var DefaultType$1 = {
  2570. toggle: 'boolean',
  2571. parent: '(string|element)'
  2572. };
  2573. var Event$3 = {
  2574. SHOW: "show" + EVENT_KEY$3,
  2575. SHOWN: "shown" + EVENT_KEY$3,
  2576. HIDE: "hide" + EVENT_KEY$3,
  2577. HIDDEN: "hidden" + EVENT_KEY$3,
  2578. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2579. };
  2580. var ClassName$3 = {
  2581. SHOW: 'show',
  2582. COLLAPSE: 'collapse',
  2583. COLLAPSING: 'collapsing',
  2584. COLLAPSED: 'collapsed'
  2585. };
  2586. var Dimension = {
  2587. WIDTH: 'width',
  2588. HEIGHT: 'height'
  2589. };
  2590. var Selector$3 = {
  2591. ACTIVES: '.show, .collapsing',
  2592. DATA_TOGGLE: '[data-toggle="collapse"]'
  2593. };
  2594. /**
  2595. * ------------------------------------------------------------------------
  2596. * Class Definition
  2597. * ------------------------------------------------------------------------
  2598. */
  2599. var Collapse =
  2600. /*#__PURE__*/
  2601. function () {
  2602. function Collapse(element, config) {
  2603. this._isTransitioning = false;
  2604. this._element = element;
  2605. this._config = this._getConfig(config);
  2606. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2607. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  2608. for (var i = 0, len = toggleList.length; i < len; i++) {
  2609. var elem = toggleList[i];
  2610. var selector = Util.getSelectorFromElement(elem);
  2611. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2612. return foundElem === element;
  2613. });
  2614. if (selector !== null && filterElement.length > 0) {
  2615. this._selector = selector;
  2616. this._triggerArray.push(elem);
  2617. }
  2618. }
  2619. this._parent = this._config.parent ? this._getParent() : null;
  2620. if (!this._config.parent) {
  2621. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2622. }
  2623. if (this._config.toggle) {
  2624. this.toggle();
  2625. }
  2626. } // Getters
  2627. var _proto = Collapse.prototype;
  2628. // Public
  2629. _proto.toggle = function toggle() {
  2630. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  2631. this.hide();
  2632. } else {
  2633. this.show();
  2634. }
  2635. };
  2636. _proto.show = function show() {
  2637. var _this = this;
  2638. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  2639. return;
  2640. }
  2641. var actives;
  2642. var activesData;
  2643. if (this._parent) {
  2644. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  2645. if (typeof _this._config.parent === 'string') {
  2646. return elem.getAttribute('data-parent') === _this._config.parent;
  2647. }
  2648. return elem.classList.contains(ClassName$3.COLLAPSE);
  2649. });
  2650. if (actives.length === 0) {
  2651. actives = null;
  2652. }
  2653. }
  2654. if (actives) {
  2655. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  2656. if (activesData && activesData._isTransitioning) {
  2657. return;
  2658. }
  2659. }
  2660. var startEvent = $.Event(Event$3.SHOW);
  2661. $(this._element).trigger(startEvent);
  2662. if (startEvent.isDefaultPrevented()) {
  2663. return;
  2664. }
  2665. if (actives) {
  2666. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  2667. if (!activesData) {
  2668. $(actives).data(DATA_KEY$3, null);
  2669. }
  2670. }
  2671. var dimension = this._getDimension();
  2672. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  2673. this._element.style[dimension] = 0;
  2674. if (this._triggerArray.length) {
  2675. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  2676. }
  2677. this.setTransitioning(true);
  2678. var complete = function complete() {
  2679. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  2680. _this._element.style[dimension] = '';
  2681. _this.setTransitioning(false);
  2682. $(_this._element).trigger(Event$3.SHOWN);
  2683. };
  2684. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2685. var scrollSize = "scroll" + capitalizedDimension;
  2686. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2687. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2688. this._element.style[dimension] = this._element[scrollSize] + "px";
  2689. };
  2690. _proto.hide = function hide() {
  2691. var _this2 = this;
  2692. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  2693. return;
  2694. }
  2695. var startEvent = $.Event(Event$3.HIDE);
  2696. $(this._element).trigger(startEvent);
  2697. if (startEvent.isDefaultPrevented()) {
  2698. return;
  2699. }
  2700. var dimension = this._getDimension();
  2701. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  2702. Util.reflow(this._element);
  2703. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  2704. var triggerArrayLength = this._triggerArray.length;
  2705. if (triggerArrayLength > 0) {
  2706. for (var i = 0; i < triggerArrayLength; i++) {
  2707. var trigger = this._triggerArray[i];
  2708. var selector = Util.getSelectorFromElement(trigger);
  2709. if (selector !== null) {
  2710. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  2711. if (!$elem.hasClass(ClassName$3.SHOW)) {
  2712. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  2713. }
  2714. }
  2715. }
  2716. }
  2717. this.setTransitioning(true);
  2718. var complete = function complete() {
  2719. _this2.setTransitioning(false);
  2720. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  2721. };
  2722. this._element.style[dimension] = '';
  2723. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2724. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2725. };
  2726. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  2727. this._isTransitioning = isTransitioning;
  2728. };
  2729. _proto.dispose = function dispose() {
  2730. $.removeData(this._element, DATA_KEY$3);
  2731. this._config = null;
  2732. this._parent = null;
  2733. this._element = null;
  2734. this._triggerArray = null;
  2735. this._isTransitioning = null;
  2736. } // Private
  2737. ;
  2738. _proto._getConfig = function _getConfig(config) {
  2739. config = _objectSpread2({}, Default$1, {}, config);
  2740. config.toggle = Boolean(config.toggle); // Coerce string values
  2741. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  2742. return config;
  2743. };
  2744. _proto._getDimension = function _getDimension() {
  2745. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  2746. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  2747. };
  2748. _proto._getParent = function _getParent() {
  2749. var _this3 = this;
  2750. var parent;
  2751. if (Util.isElement(this._config.parent)) {
  2752. parent = this._config.parent; // It's a jQuery object
  2753. if (typeof this._config.parent.jquery !== 'undefined') {
  2754. parent = this._config.parent[0];
  2755. }
  2756. } else {
  2757. parent = document.querySelector(this._config.parent);
  2758. }
  2759. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  2760. var children = [].slice.call(parent.querySelectorAll(selector));
  2761. $(children).each(function (i, element) {
  2762. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  2763. });
  2764. return parent;
  2765. };
  2766. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  2767. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  2768. if (triggerArray.length) {
  2769. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  2770. }
  2771. } // Static
  2772. ;
  2773. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  2774. var selector = Util.getSelectorFromElement(element);
  2775. return selector ? document.querySelector(selector) : null;
  2776. };
  2777. Collapse._jQueryInterface = function _jQueryInterface(config) {
  2778. return this.each(function () {
  2779. var $this = $(this);
  2780. var data = $this.data(DATA_KEY$3);
  2781. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  2782. if (!data && _config.toggle && /show|hide/.test(config)) {
  2783. _config.toggle = false;
  2784. }
  2785. if (!data) {
  2786. data = new Collapse(this, _config);
  2787. $this.data(DATA_KEY$3, data);
  2788. }
  2789. if (typeof config === 'string') {
  2790. if (typeof data[config] === 'undefined') {
  2791. throw new TypeError("No method named \"" + config + "\"");
  2792. }
  2793. data[config]();
  2794. }
  2795. });
  2796. };
  2797. _createClass(Collapse, null, [{
  2798. key: "VERSION",
  2799. get: function get() {
  2800. return VERSION$3;
  2801. }
  2802. }, {
  2803. key: "Default",
  2804. get: function get() {
  2805. return Default$1;
  2806. }
  2807. }]);
  2808. return Collapse;
  2809. }();
  2810. /**
  2811. * ------------------------------------------------------------------------
  2812. * Data Api implementation
  2813. * ------------------------------------------------------------------------
  2814. */
  2815. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  2816. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  2817. if (event.currentTarget.tagName === 'A') {
  2818. event.preventDefault();
  2819. }
  2820. var $trigger = $(this);
  2821. var selector = Util.getSelectorFromElement(this);
  2822. var selectors = [].slice.call(document.querySelectorAll(selector));
  2823. $(selectors).each(function () {
  2824. var $target = $(this);
  2825. var data = $target.data(DATA_KEY$3);
  2826. var config = data ? 'toggle' : $trigger.data();
  2827. Collapse._jQueryInterface.call($target, config);
  2828. });
  2829. });
  2830. /**
  2831. * ------------------------------------------------------------------------
  2832. * jQuery
  2833. * ------------------------------------------------------------------------
  2834. */
  2835. $.fn[NAME$3] = Collapse._jQueryInterface;
  2836. $.fn[NAME$3].Constructor = Collapse;
  2837. $.fn[NAME$3].noConflict = function () {
  2838. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  2839. return Collapse._jQueryInterface;
  2840. };
  2841. /**
  2842. * ------------------------------------------------------------------------
  2843. * Constants
  2844. * ------------------------------------------------------------------------
  2845. */
  2846. var NAME$4 = 'dropdown';
  2847. var VERSION$4 = '4.4.1';
  2848. var DATA_KEY$4 = 'bs.dropdown';
  2849. var EVENT_KEY$4 = "." + DATA_KEY$4;
  2850. var DATA_API_KEY$4 = '.data-api';
  2851. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  2852. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  2853. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  2854. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  2855. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  2856. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  2857. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  2858. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  2859. var Event$4 = {
  2860. HIDE: "hide" + EVENT_KEY$4,
  2861. HIDDEN: "hidden" + EVENT_KEY$4,
  2862. SHOW: "show" + EVENT_KEY$4,
  2863. SHOWN: "shown" + EVENT_KEY$4,
  2864. CLICK: "click" + EVENT_KEY$4,
  2865. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  2866. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  2867. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  2868. };
  2869. var ClassName$4 = {
  2870. DISABLED: 'disabled',
  2871. SHOW: 'show',
  2872. DROPUP: 'dropup',
  2873. DROPRIGHT: 'dropright',
  2874. DROPLEFT: 'dropleft',
  2875. MENURIGHT: 'dropdown-menu-right',
  2876. MENULEFT: 'dropdown-menu-left',
  2877. POSITION_STATIC: 'position-static'
  2878. };
  2879. var Selector$4 = {
  2880. DATA_TOGGLE: '[data-toggle="dropdown"]',
  2881. FORM_CHILD: '.dropdown form',
  2882. MENU: '.dropdown-menu',
  2883. NAVBAR_NAV: '.navbar-nav',
  2884. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  2885. };
  2886. var AttachmentMap = {
  2887. TOP: 'top-start',
  2888. TOPEND: 'top-end',
  2889. BOTTOM: 'bottom-start',
  2890. BOTTOMEND: 'bottom-end',
  2891. RIGHT: 'right-start',
  2892. RIGHTEND: 'right-end',
  2893. LEFT: 'left-start',
  2894. LEFTEND: 'left-end'
  2895. };
  2896. var Default$2 = {
  2897. offset: 0,
  2898. flip: true,
  2899. boundary: 'scrollParent',
  2900. reference: 'toggle',
  2901. display: 'dynamic',
  2902. popperConfig: null
  2903. };
  2904. var DefaultType$2 = {
  2905. offset: '(number|string|function)',
  2906. flip: 'boolean',
  2907. boundary: '(string|element)',
  2908. reference: '(string|element)',
  2909. display: 'string',
  2910. popperConfig: '(null|object)'
  2911. };
  2912. /**
  2913. * ------------------------------------------------------------------------
  2914. * Class Definition
  2915. * ------------------------------------------------------------------------
  2916. */
  2917. var Dropdown =
  2918. /*#__PURE__*/
  2919. function () {
  2920. function Dropdown(element, config) {
  2921. this._element = element;
  2922. this._popper = null;
  2923. this._config = this._getConfig(config);
  2924. this._menu = this._getMenuElement();
  2925. this._inNavbar = this._detectNavbar();
  2926. this._addEventListeners();
  2927. } // Getters
  2928. var _proto = Dropdown.prototype;
  2929. // Public
  2930. _proto.toggle = function toggle() {
  2931. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  2932. return;
  2933. }
  2934. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  2935. Dropdown._clearMenus();
  2936. if (isActive) {
  2937. return;
  2938. }
  2939. this.show(true);
  2940. };
  2941. _proto.show = function show(usePopper) {
  2942. if (usePopper === void 0) {
  2943. usePopper = false;
  2944. }
  2945. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  2946. return;
  2947. }
  2948. var relatedTarget = {
  2949. relatedTarget: this._element
  2950. };
  2951. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  2952. var parent = Dropdown._getParentFromElement(this._element);
  2953. $(parent).trigger(showEvent);
  2954. if (showEvent.isDefaultPrevented()) {
  2955. return;
  2956. } // Disable totally Popper.js for Dropdown in Navbar
  2957. if (!this._inNavbar && usePopper) {
  2958. /**
  2959. * Check for Popper dependency
  2960. * Popper - https://popper.js.org
  2961. */
  2962. if (typeof Popper === 'undefined') {
  2963. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  2964. }
  2965. var referenceElement = this._element;
  2966. if (this._config.reference === 'parent') {
  2967. referenceElement = parent;
  2968. } else if (Util.isElement(this._config.reference)) {
  2969. referenceElement = this._config.reference; // Check if it's jQuery element
  2970. if (typeof this._config.reference.jquery !== 'undefined') {
  2971. referenceElement = this._config.reference[0];
  2972. }
  2973. } // If boundary is not `scrollParent`, then set position to `static`
  2974. // to allow the menu to "escape" the scroll parent's boundaries
  2975. // https://github.com/twbs/bootstrap/issues/24251
  2976. if (this._config.boundary !== 'scrollParent') {
  2977. $(parent).addClass(ClassName$4.POSITION_STATIC);
  2978. }
  2979. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  2980. } // If this is a touch-enabled device we add extra
  2981. // empty mouseover listeners to the body's immediate children;
  2982. // only needed because of broken event delegation on iOS
  2983. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2984. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  2985. $(document.body).children().on('mouseover', null, $.noop);
  2986. }
  2987. this._element.focus();
  2988. this._element.setAttribute('aria-expanded', true);
  2989. $(this._menu).toggleClass(ClassName$4.SHOW);
  2990. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  2991. };
  2992. _proto.hide = function hide() {
  2993. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  2994. return;
  2995. }
  2996. var relatedTarget = {
  2997. relatedTarget: this._element
  2998. };
  2999. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3000. var parent = Dropdown._getParentFromElement(this._element);
  3001. $(parent).trigger(hideEvent);
  3002. if (hideEvent.isDefaultPrevented()) {
  3003. return;
  3004. }
  3005. if (this._popper) {
  3006. this._popper.destroy();
  3007. }
  3008. $(this._menu).toggleClass(ClassName$4.SHOW);
  3009. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3010. };
  3011. _proto.dispose = function dispose() {
  3012. $.removeData(this._element, DATA_KEY$4);
  3013. $(this._element).off(EVENT_KEY$4);
  3014. this._element = null;
  3015. this._menu = null;
  3016. if (this._popper !== null) {
  3017. this._popper.destroy();
  3018. this._popper = null;
  3019. }
  3020. };
  3021. _proto.update = function update() {
  3022. this._inNavbar = this._detectNavbar();
  3023. if (this._popper !== null) {
  3024. this._popper.scheduleUpdate();
  3025. }
  3026. } // Private
  3027. ;
  3028. _proto._addEventListeners = function _addEventListeners() {
  3029. var _this = this;
  3030. $(this._element).on(Event$4.CLICK, function (event) {
  3031. event.preventDefault();
  3032. event.stopPropagation();
  3033. _this.toggle();
  3034. });
  3035. };
  3036. _proto._getConfig = function _getConfig(config) {
  3037. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3038. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3039. return config;
  3040. };
  3041. _proto._getMenuElement = function _getMenuElement() {
  3042. if (!this._menu) {
  3043. var parent = Dropdown._getParentFromElement(this._element);
  3044. if (parent) {
  3045. this._menu = parent.querySelector(Selector$4.MENU);
  3046. }
  3047. }
  3048. return this._menu;
  3049. };
  3050. _proto._getPlacement = function _getPlacement() {
  3051. var $parentDropdown = $(this._element.parentNode);
  3052. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3053. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3054. placement = AttachmentMap.TOP;
  3055. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3056. placement = AttachmentMap.TOPEND;
  3057. }
  3058. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3059. placement = AttachmentMap.RIGHT;
  3060. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3061. placement = AttachmentMap.LEFT;
  3062. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3063. placement = AttachmentMap.BOTTOMEND;
  3064. }
  3065. return placement;
  3066. };
  3067. _proto._detectNavbar = function _detectNavbar() {
  3068. return $(this._element).closest('.navbar').length > 0;
  3069. };
  3070. _proto._getOffset = function _getOffset() {
  3071. var _this2 = this;
  3072. var offset = {};
  3073. if (typeof this._config.offset === 'function') {
  3074. offset.fn = function (data) {
  3075. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3076. return data;
  3077. };
  3078. } else {
  3079. offset.offset = this._config.offset;
  3080. }
  3081. return offset;
  3082. };
  3083. _proto._getPopperConfig = function _getPopperConfig() {
  3084. var popperConfig = {
  3085. placement: this._getPlacement(),
  3086. modifiers: {
  3087. offset: this._getOffset(),
  3088. flip: {
  3089. enabled: this._config.flip
  3090. },
  3091. preventOverflow: {
  3092. boundariesElement: this._config.boundary
  3093. }
  3094. }
  3095. }; // Disable Popper.js if we have a static display
  3096. if (this._config.display === 'static') {
  3097. popperConfig.modifiers.applyStyle = {
  3098. enabled: false
  3099. };
  3100. }
  3101. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3102. } // Static
  3103. ;
  3104. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3105. return this.each(function () {
  3106. var data = $(this).data(DATA_KEY$4);
  3107. var _config = typeof config === 'object' ? config : null;
  3108. if (!data) {
  3109. data = new Dropdown(this, _config);
  3110. $(this).data(DATA_KEY$4, data);
  3111. }
  3112. if (typeof config === 'string') {
  3113. if (typeof data[config] === 'undefined') {
  3114. throw new TypeError("No method named \"" + config + "\"");
  3115. }
  3116. data[config]();
  3117. }
  3118. });
  3119. };
  3120. Dropdown._clearMenus = function _clearMenus(event) {
  3121. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3122. return;
  3123. }
  3124. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3125. for (var i = 0, len = toggles.length; i < len; i++) {
  3126. var parent = Dropdown._getParentFromElement(toggles[i]);
  3127. var context = $(toggles[i]).data(DATA_KEY$4);
  3128. var relatedTarget = {
  3129. relatedTarget: toggles[i]
  3130. };
  3131. if (event && event.type === 'click') {
  3132. relatedTarget.clickEvent = event;
  3133. }
  3134. if (!context) {
  3135. continue;
  3136. }
  3137. var dropdownMenu = context._menu;
  3138. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3139. continue;
  3140. }
  3141. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3142. continue;
  3143. }
  3144. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3145. $(parent).trigger(hideEvent);
  3146. if (hideEvent.isDefaultPrevented()) {
  3147. continue;
  3148. } // If this is a touch-enabled device we remove the extra
  3149. // empty mouseover listeners we added for iOS support
  3150. if ('ontouchstart' in document.documentElement) {
  3151. $(document.body).children().off('mouseover', null, $.noop);
  3152. }
  3153. toggles[i].setAttribute('aria-expanded', 'false');
  3154. if (context._popper) {
  3155. context._popper.destroy();
  3156. }
  3157. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3158. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3159. }
  3160. };
  3161. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3162. var parent;
  3163. var selector = Util.getSelectorFromElement(element);
  3164. if (selector) {
  3165. parent = document.querySelector(selector);
  3166. }
  3167. return parent || element.parentNode;
  3168. } // eslint-disable-next-line complexity
  3169. ;
  3170. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3171. // If not input/textarea:
  3172. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3173. // If input/textarea:
  3174. // - If space key => not a dropdown command
  3175. // - If key is other than escape
  3176. // - If key is not up or down => not a dropdown command
  3177. // - If trigger inside the menu => not a dropdown command
  3178. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3179. return;
  3180. }
  3181. event.preventDefault();
  3182. event.stopPropagation();
  3183. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3184. return;
  3185. }
  3186. var parent = Dropdown._getParentFromElement(this);
  3187. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3188. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3189. return;
  3190. }
  3191. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3192. if (event.which === ESCAPE_KEYCODE) {
  3193. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3194. $(toggle).trigger('focus');
  3195. }
  3196. $(this).trigger('click');
  3197. return;
  3198. }
  3199. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3200. return $(item).is(':visible');
  3201. });
  3202. if (items.length === 0) {
  3203. return;
  3204. }
  3205. var index = items.indexOf(event.target);
  3206. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3207. // Up
  3208. index--;
  3209. }
  3210. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3211. // Down
  3212. index++;
  3213. }
  3214. if (index < 0) {
  3215. index = 0;
  3216. }
  3217. items[index].focus();
  3218. };
  3219. _createClass(Dropdown, null, [{
  3220. key: "VERSION",
  3221. get: function get() {
  3222. return VERSION$4;
  3223. }
  3224. }, {
  3225. key: "Default",
  3226. get: function get() {
  3227. return Default$2;
  3228. }
  3229. }, {
  3230. key: "DefaultType",
  3231. get: function get() {
  3232. return DefaultType$2;
  3233. }
  3234. }]);
  3235. return Dropdown;
  3236. }();
  3237. /**
  3238. * ------------------------------------------------------------------------
  3239. * Data Api implementation
  3240. * ------------------------------------------------------------------------
  3241. */
  3242. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3243. event.preventDefault();
  3244. event.stopPropagation();
  3245. Dropdown._jQueryInterface.call($(this), 'toggle');
  3246. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3247. e.stopPropagation();
  3248. });
  3249. /**
  3250. * ------------------------------------------------------------------------
  3251. * jQuery
  3252. * ------------------------------------------------------------------------
  3253. */
  3254. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3255. $.fn[NAME$4].Constructor = Dropdown;
  3256. $.fn[NAME$4].noConflict = function () {
  3257. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3258. return Dropdown._jQueryInterface;
  3259. };
  3260. /**
  3261. * ------------------------------------------------------------------------
  3262. * Constants
  3263. * ------------------------------------------------------------------------
  3264. */
  3265. var NAME$5 = 'modal';
  3266. var VERSION$5 = '4.4.1';
  3267. var DATA_KEY$5 = 'bs.modal';
  3268. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3269. var DATA_API_KEY$5 = '.data-api';
  3270. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3271. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3272. var Default$3 = {
  3273. backdrop: true,
  3274. keyboard: true,
  3275. focus: true,
  3276. show: true
  3277. };
  3278. var DefaultType$3 = {
  3279. backdrop: '(boolean|string)',
  3280. keyboard: 'boolean',
  3281. focus: 'boolean',
  3282. show: 'boolean'
  3283. };
  3284. var Event$5 = {
  3285. HIDE: "hide" + EVENT_KEY$5,
  3286. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3287. HIDDEN: "hidden" + EVENT_KEY$5,
  3288. SHOW: "show" + EVENT_KEY$5,
  3289. SHOWN: "shown" + EVENT_KEY$5,
  3290. FOCUSIN: "focusin" + EVENT_KEY$5,
  3291. RESIZE: "resize" + EVENT_KEY$5,
  3292. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3293. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3294. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3295. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3296. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3297. };
  3298. var ClassName$5 = {
  3299. SCROLLABLE: 'modal-dialog-scrollable',
  3300. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3301. BACKDROP: 'modal-backdrop',
  3302. OPEN: 'modal-open',
  3303. FADE: 'fade',
  3304. SHOW: 'show',
  3305. STATIC: 'modal-static'
  3306. };
  3307. var Selector$5 = {
  3308. DIALOG: '.modal-dialog',
  3309. MODAL_BODY: '.modal-body',
  3310. DATA_TOGGLE: '[data-toggle="modal"]',
  3311. DATA_DISMISS: '[data-dismiss="modal"]',
  3312. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3313. STICKY_CONTENT: '.sticky-top'
  3314. };
  3315. /**
  3316. * ------------------------------------------------------------------------
  3317. * Class Definition
  3318. * ------------------------------------------------------------------------
  3319. */
  3320. var Modal =
  3321. /*#__PURE__*/
  3322. function () {
  3323. function Modal(element, config) {
  3324. this._config = this._getConfig(config);
  3325. this._element = element;
  3326. this._dialog = element.querySelector(Selector$5.DIALOG);
  3327. this._backdrop = null;
  3328. this._isShown = false;
  3329. this._isBodyOverflowing = false;
  3330. this._ignoreBackdropClick = false;
  3331. this._isTransitioning = false;
  3332. this._scrollbarWidth = 0;
  3333. } // Getters
  3334. var _proto = Modal.prototype;
  3335. // Public
  3336. _proto.toggle = function toggle(relatedTarget) {
  3337. return this._isShown ? this.hide() : this.show(relatedTarget);
  3338. };
  3339. _proto.show = function show(relatedTarget) {
  3340. var _this = this;
  3341. if (this._isShown || this._isTransitioning) {
  3342. return;
  3343. }
  3344. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3345. this._isTransitioning = true;
  3346. }
  3347. var showEvent = $.Event(Event$5.SHOW, {
  3348. relatedTarget: relatedTarget
  3349. });
  3350. $(this._element).trigger(showEvent);
  3351. if (this._isShown || showEvent.isDefaultPrevented()) {
  3352. return;
  3353. }
  3354. this._isShown = true;
  3355. this._checkScrollbar();
  3356. this._setScrollbar();
  3357. this._adjustDialog();
  3358. this._setEscapeEvent();
  3359. this._setResizeEvent();
  3360. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3361. return _this.hide(event);
  3362. });
  3363. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3364. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3365. if ($(event.target).is(_this._element)) {
  3366. _this._ignoreBackdropClick = true;
  3367. }
  3368. });
  3369. });
  3370. this._showBackdrop(function () {
  3371. return _this._showElement(relatedTarget);
  3372. });
  3373. };
  3374. _proto.hide = function hide(event) {
  3375. var _this2 = this;
  3376. if (event) {
  3377. event.preventDefault();
  3378. }
  3379. if (!this._isShown || this._isTransitioning) {
  3380. return;
  3381. }
  3382. var hideEvent = $.Event(Event$5.HIDE);
  3383. $(this._element).trigger(hideEvent);
  3384. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3385. return;
  3386. }
  3387. this._isShown = false;
  3388. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3389. if (transition) {
  3390. this._isTransitioning = true;
  3391. }
  3392. this._setEscapeEvent();
  3393. this._setResizeEvent();
  3394. $(document).off(Event$5.FOCUSIN);
  3395. $(this._element).removeClass(ClassName$5.SHOW);
  3396. $(this._element).off(Event$5.CLICK_DISMISS);
  3397. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3398. if (transition) {
  3399. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3400. $(this._element).one(Util.TRANSITION_END, function (event) {
  3401. return _this2._hideModal(event);
  3402. }).emulateTransitionEnd(transitionDuration);
  3403. } else {
  3404. this._hideModal();
  3405. }
  3406. };
  3407. _proto.dispose = function dispose() {
  3408. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3409. return $(htmlElement).off(EVENT_KEY$5);
  3410. });
  3411. /**
  3412. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3413. * Do not move `document` in `htmlElements` array
  3414. * It will remove `Event.CLICK_DATA_API` event that should remain
  3415. */
  3416. $(document).off(Event$5.FOCUSIN);
  3417. $.removeData(this._element, DATA_KEY$5);
  3418. this._config = null;
  3419. this._element = null;
  3420. this._dialog = null;
  3421. this._backdrop = null;
  3422. this._isShown = null;
  3423. this._isBodyOverflowing = null;
  3424. this._ignoreBackdropClick = null;
  3425. this._isTransitioning = null;
  3426. this._scrollbarWidth = null;
  3427. };
  3428. _proto.handleUpdate = function handleUpdate() {
  3429. this._adjustDialog();
  3430. } // Private
  3431. ;
  3432. _proto._getConfig = function _getConfig(config) {
  3433. config = _objectSpread2({}, Default$3, {}, config);
  3434. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3435. return config;
  3436. };
  3437. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3438. var _this3 = this;
  3439. if (this._config.backdrop === 'static') {
  3440. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3441. $(this._element).trigger(hideEventPrevented);
  3442. if (hideEventPrevented.defaultPrevented) {
  3443. return;
  3444. }
  3445. this._element.classList.add(ClassName$5.STATIC);
  3446. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3447. $(this._element).one(Util.TRANSITION_END, function () {
  3448. _this3._element.classList.remove(ClassName$5.STATIC);
  3449. }).emulateTransitionEnd(modalTransitionDuration);
  3450. this._element.focus();
  3451. } else {
  3452. this.hide();
  3453. }
  3454. };
  3455. _proto._showElement = function _showElement(relatedTarget) {
  3456. var _this4 = this;
  3457. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3458. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3459. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3460. // Don't move modal's DOM position
  3461. document.body.appendChild(this._element);
  3462. }
  3463. this._element.style.display = 'block';
  3464. this._element.removeAttribute('aria-hidden');
  3465. this._element.setAttribute('aria-modal', true);
  3466. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3467. modalBody.scrollTop = 0;
  3468. } else {
  3469. this._element.scrollTop = 0;
  3470. }
  3471. if (transition) {
  3472. Util.reflow(this._element);
  3473. }
  3474. $(this._element).addClass(ClassName$5.SHOW);
  3475. if (this._config.focus) {
  3476. this._enforceFocus();
  3477. }
  3478. var shownEvent = $.Event(Event$5.SHOWN, {
  3479. relatedTarget: relatedTarget
  3480. });
  3481. var transitionComplete = function transitionComplete() {
  3482. if (_this4._config.focus) {
  3483. _this4._element.focus();
  3484. }
  3485. _this4._isTransitioning = false;
  3486. $(_this4._element).trigger(shownEvent);
  3487. };
  3488. if (transition) {
  3489. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3490. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3491. } else {
  3492. transitionComplete();
  3493. }
  3494. };
  3495. _proto._enforceFocus = function _enforceFocus() {
  3496. var _this5 = this;
  3497. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3498. .on(Event$5.FOCUSIN, function (event) {
  3499. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3500. _this5._element.focus();
  3501. }
  3502. });
  3503. };
  3504. _proto._setEscapeEvent = function _setEscapeEvent() {
  3505. var _this6 = this;
  3506. if (this._isShown && this._config.keyboard) {
  3507. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3508. if (event.which === ESCAPE_KEYCODE$1) {
  3509. _this6._triggerBackdropTransition();
  3510. }
  3511. });
  3512. } else if (!this._isShown) {
  3513. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3514. }
  3515. };
  3516. _proto._setResizeEvent = function _setResizeEvent() {
  3517. var _this7 = this;
  3518. if (this._isShown) {
  3519. $(window).on(Event$5.RESIZE, function (event) {
  3520. return _this7.handleUpdate(event);
  3521. });
  3522. } else {
  3523. $(window).off(Event$5.RESIZE);
  3524. }
  3525. };
  3526. _proto._hideModal = function _hideModal() {
  3527. var _this8 = this;
  3528. this._element.style.display = 'none';
  3529. this._element.setAttribute('aria-hidden', true);
  3530. this._element.removeAttribute('aria-modal');
  3531. this._isTransitioning = false;
  3532. this._showBackdrop(function () {
  3533. $(document.body).removeClass(ClassName$5.OPEN);
  3534. _this8._resetAdjustments();
  3535. _this8._resetScrollbar();
  3536. $(_this8._element).trigger(Event$5.HIDDEN);
  3537. });
  3538. };
  3539. _proto._removeBackdrop = function _removeBackdrop() {
  3540. if (this._backdrop) {
  3541. $(this._backdrop).remove();
  3542. this._backdrop = null;
  3543. }
  3544. };
  3545. _proto._showBackdrop = function _showBackdrop(callback) {
  3546. var _this9 = this;
  3547. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3548. if (this._isShown && this._config.backdrop) {
  3549. this._backdrop = document.createElement('div');
  3550. this._backdrop.className = ClassName$5.BACKDROP;
  3551. if (animate) {
  3552. this._backdrop.classList.add(animate);
  3553. }
  3554. $(this._backdrop).appendTo(document.body);
  3555. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3556. if (_this9._ignoreBackdropClick) {
  3557. _this9._ignoreBackdropClick = false;
  3558. return;
  3559. }
  3560. if (event.target !== event.currentTarget) {
  3561. return;
  3562. }
  3563. _this9._triggerBackdropTransition();
  3564. });
  3565. if (animate) {
  3566. Util.reflow(this._backdrop);
  3567. }
  3568. $(this._backdrop).addClass(ClassName$5.SHOW);
  3569. if (!callback) {
  3570. return;
  3571. }
  3572. if (!animate) {
  3573. callback();
  3574. return;
  3575. }
  3576. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3577. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3578. } else if (!this._isShown && this._backdrop) {
  3579. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3580. var callbackRemove = function callbackRemove() {
  3581. _this9._removeBackdrop();
  3582. if (callback) {
  3583. callback();
  3584. }
  3585. };
  3586. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3587. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3588. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3589. } else {
  3590. callbackRemove();
  3591. }
  3592. } else if (callback) {
  3593. callback();
  3594. }
  3595. } // ----------------------------------------------------------------------
  3596. // the following methods are used to handle overflowing modals
  3597. // todo (fat): these should probably be refactored out of modal.js
  3598. // ----------------------------------------------------------------------
  3599. ;
  3600. _proto._adjustDialog = function _adjustDialog() {
  3601. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3602. if (!this._isBodyOverflowing && isModalOverflowing) {
  3603. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3604. }
  3605. if (this._isBodyOverflowing && !isModalOverflowing) {
  3606. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3607. }
  3608. };
  3609. _proto._resetAdjustments = function _resetAdjustments() {
  3610. this._element.style.paddingLeft = '';
  3611. this._element.style.paddingRight = '';
  3612. };
  3613. _proto._checkScrollbar = function _checkScrollbar() {
  3614. var rect = document.body.getBoundingClientRect();
  3615. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  3616. this._scrollbarWidth = this._getScrollbarWidth();
  3617. };
  3618. _proto._setScrollbar = function _setScrollbar() {
  3619. var _this10 = this;
  3620. if (this._isBodyOverflowing) {
  3621. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3622. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3623. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3624. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  3625. $(fixedContent).each(function (index, element) {
  3626. var actualPadding = element.style.paddingRight;
  3627. var calculatedPadding = $(element).css('padding-right');
  3628. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3629. }); // Adjust sticky content margin
  3630. $(stickyContent).each(function (index, element) {
  3631. var actualMargin = element.style.marginRight;
  3632. var calculatedMargin = $(element).css('margin-right');
  3633. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3634. }); // Adjust body padding
  3635. var actualPadding = document.body.style.paddingRight;
  3636. var calculatedPadding = $(document.body).css('padding-right');
  3637. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3638. }
  3639. $(document.body).addClass(ClassName$5.OPEN);
  3640. };
  3641. _proto._resetScrollbar = function _resetScrollbar() {
  3642. // Restore fixed content padding
  3643. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3644. $(fixedContent).each(function (index, element) {
  3645. var padding = $(element).data('padding-right');
  3646. $(element).removeData('padding-right');
  3647. element.style.paddingRight = padding ? padding : '';
  3648. }); // Restore sticky content
  3649. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  3650. $(elements).each(function (index, element) {
  3651. var margin = $(element).data('margin-right');
  3652. if (typeof margin !== 'undefined') {
  3653. $(element).css('margin-right', margin).removeData('margin-right');
  3654. }
  3655. }); // Restore body padding
  3656. var padding = $(document.body).data('padding-right');
  3657. $(document.body).removeData('padding-right');
  3658. document.body.style.paddingRight = padding ? padding : '';
  3659. };
  3660. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3661. // thx d.walsh
  3662. var scrollDiv = document.createElement('div');
  3663. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  3664. document.body.appendChild(scrollDiv);
  3665. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3666. document.body.removeChild(scrollDiv);
  3667. return scrollbarWidth;
  3668. } // Static
  3669. ;
  3670. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3671. return this.each(function () {
  3672. var data = $(this).data(DATA_KEY$5);
  3673. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  3674. if (!data) {
  3675. data = new Modal(this, _config);
  3676. $(this).data(DATA_KEY$5, data);
  3677. }
  3678. if (typeof config === 'string') {
  3679. if (typeof data[config] === 'undefined') {
  3680. throw new TypeError("No method named \"" + config + "\"");
  3681. }
  3682. data[config](relatedTarget);
  3683. } else if (_config.show) {
  3684. data.show(relatedTarget);
  3685. }
  3686. });
  3687. };
  3688. _createClass(Modal, null, [{
  3689. key: "VERSION",
  3690. get: function get() {
  3691. return VERSION$5;
  3692. }
  3693. }, {
  3694. key: "Default",
  3695. get: function get() {
  3696. return Default$3;
  3697. }
  3698. }]);
  3699. return Modal;
  3700. }();
  3701. /**
  3702. * ------------------------------------------------------------------------
  3703. * Data Api implementation
  3704. * ------------------------------------------------------------------------
  3705. */
  3706. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  3707. var _this11 = this;
  3708. var target;
  3709. var selector = Util.getSelectorFromElement(this);
  3710. if (selector) {
  3711. target = document.querySelector(selector);
  3712. }
  3713. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  3714. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3715. event.preventDefault();
  3716. }
  3717. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  3718. if (showEvent.isDefaultPrevented()) {
  3719. // Only register focus restorer if modal will actually get shown
  3720. return;
  3721. }
  3722. $target.one(Event$5.HIDDEN, function () {
  3723. if ($(_this11).is(':visible')) {
  3724. _this11.focus();
  3725. }
  3726. });
  3727. });
  3728. Modal._jQueryInterface.call($(target), config, this);
  3729. });
  3730. /**
  3731. * ------------------------------------------------------------------------
  3732. * jQuery
  3733. * ------------------------------------------------------------------------
  3734. */
  3735. $.fn[NAME$5] = Modal._jQueryInterface;
  3736. $.fn[NAME$5].Constructor = Modal;
  3737. $.fn[NAME$5].noConflict = function () {
  3738. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3739. return Modal._jQueryInterface;
  3740. };
  3741. /**
  3742. * --------------------------------------------------------------------------
  3743. * Bootstrap (v4.4.1): tools/sanitizer.js
  3744. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3745. * --------------------------------------------------------------------------
  3746. */
  3747. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3748. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3749. var DefaultWhitelist = {
  3750. // Global attributes allowed on any supplied element below.
  3751. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3752. a: ['target', 'href', 'title', 'rel'],
  3753. area: [],
  3754. b: [],
  3755. br: [],
  3756. col: [],
  3757. code: [],
  3758. div: [],
  3759. em: [],
  3760. hr: [],
  3761. h1: [],
  3762. h2: [],
  3763. h3: [],
  3764. h4: [],
  3765. h5: [],
  3766. h6: [],
  3767. i: [],
  3768. img: ['src', 'alt', 'title', 'width', 'height'],
  3769. li: [],
  3770. ol: [],
  3771. p: [],
  3772. pre: [],
  3773. s: [],
  3774. small: [],
  3775. span: [],
  3776. sub: [],
  3777. sup: [],
  3778. strong: [],
  3779. u: [],
  3780. ul: []
  3781. };
  3782. /**
  3783. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3784. *
  3785. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3786. */
  3787. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  3788. /**
  3789. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3790. *
  3791. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3792. */
  3793. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  3794. function allowedAttribute(attr, allowedAttributeList) {
  3795. var attrName = attr.nodeName.toLowerCase();
  3796. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3797. if (uriAttrs.indexOf(attrName) !== -1) {
  3798. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3799. }
  3800. return true;
  3801. }
  3802. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3803. return attrRegex instanceof RegExp;
  3804. }); // Check if a regular expression validates the attribute.
  3805. for (var i = 0, l = regExp.length; i < l; i++) {
  3806. if (attrName.match(regExp[i])) {
  3807. return true;
  3808. }
  3809. }
  3810. return false;
  3811. }
  3812. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3813. if (unsafeHtml.length === 0) {
  3814. return unsafeHtml;
  3815. }
  3816. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3817. return sanitizeFn(unsafeHtml);
  3818. }
  3819. var domParser = new window.DOMParser();
  3820. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3821. var whitelistKeys = Object.keys(whiteList);
  3822. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3823. var _loop = function _loop(i, len) {
  3824. var el = elements[i];
  3825. var elName = el.nodeName.toLowerCase();
  3826. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3827. el.parentNode.removeChild(el);
  3828. return "continue";
  3829. }
  3830. var attributeList = [].slice.call(el.attributes);
  3831. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3832. attributeList.forEach(function (attr) {
  3833. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3834. el.removeAttribute(attr.nodeName);
  3835. }
  3836. });
  3837. };
  3838. for (var i = 0, len = elements.length; i < len; i++) {
  3839. var _ret = _loop(i);
  3840. if (_ret === "continue") continue;
  3841. }
  3842. return createdDocument.body.innerHTML;
  3843. }
  3844. /**
  3845. * ------------------------------------------------------------------------
  3846. * Constants
  3847. * ------------------------------------------------------------------------
  3848. */
  3849. var NAME$6 = 'tooltip';
  3850. var VERSION$6 = '4.4.1';
  3851. var DATA_KEY$6 = 'bs.tooltip';
  3852. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3853. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  3854. var CLASS_PREFIX = 'bs-tooltip';
  3855. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3856. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3857. var DefaultType$4 = {
  3858. animation: 'boolean',
  3859. template: 'string',
  3860. title: '(string|element|function)',
  3861. trigger: 'string',
  3862. delay: '(number|object)',
  3863. html: 'boolean',
  3864. selector: '(string|boolean)',
  3865. placement: '(string|function)',
  3866. offset: '(number|string|function)',
  3867. container: '(string|element|boolean)',
  3868. fallbackPlacement: '(string|array)',
  3869. boundary: '(string|element)',
  3870. sanitize: 'boolean',
  3871. sanitizeFn: '(null|function)',
  3872. whiteList: 'object',
  3873. popperConfig: '(null|object)'
  3874. };
  3875. var AttachmentMap$1 = {
  3876. AUTO: 'auto',
  3877. TOP: 'top',
  3878. RIGHT: 'right',
  3879. BOTTOM: 'bottom',
  3880. LEFT: 'left'
  3881. };
  3882. var Default$4 = {
  3883. animation: true,
  3884. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3885. trigger: 'hover focus',
  3886. title: '',
  3887. delay: 0,
  3888. html: false,
  3889. selector: false,
  3890. placement: 'top',
  3891. offset: 0,
  3892. container: false,
  3893. fallbackPlacement: 'flip',
  3894. boundary: 'scrollParent',
  3895. sanitize: true,
  3896. sanitizeFn: null,
  3897. whiteList: DefaultWhitelist,
  3898. popperConfig: null
  3899. };
  3900. var HoverState = {
  3901. SHOW: 'show',
  3902. OUT: 'out'
  3903. };
  3904. var Event$6 = {
  3905. HIDE: "hide" + EVENT_KEY$6,
  3906. HIDDEN: "hidden" + EVENT_KEY$6,
  3907. SHOW: "show" + EVENT_KEY$6,
  3908. SHOWN: "shown" + EVENT_KEY$6,
  3909. INSERTED: "inserted" + EVENT_KEY$6,
  3910. CLICK: "click" + EVENT_KEY$6,
  3911. FOCUSIN: "focusin" + EVENT_KEY$6,
  3912. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3913. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3914. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3915. };
  3916. var ClassName$6 = {
  3917. FADE: 'fade',
  3918. SHOW: 'show'
  3919. };
  3920. var Selector$6 = {
  3921. TOOLTIP: '.tooltip',
  3922. TOOLTIP_INNER: '.tooltip-inner',
  3923. ARROW: '.arrow'
  3924. };
  3925. var Trigger = {
  3926. HOVER: 'hover',
  3927. FOCUS: 'focus',
  3928. CLICK: 'click',
  3929. MANUAL: 'manual'
  3930. };
  3931. /**
  3932. * ------------------------------------------------------------------------
  3933. * Class Definition
  3934. * ------------------------------------------------------------------------
  3935. */
  3936. var Tooltip =
  3937. /*#__PURE__*/
  3938. function () {
  3939. function Tooltip(element, config) {
  3940. if (typeof Popper === 'undefined') {
  3941. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  3942. } // private
  3943. this._isEnabled = true;
  3944. this._timeout = 0;
  3945. this._hoverState = '';
  3946. this._activeTrigger = {};
  3947. this._popper = null; // Protected
  3948. this.element = element;
  3949. this.config = this._getConfig(config);
  3950. this.tip = null;
  3951. this._setListeners();
  3952. } // Getters
  3953. var _proto = Tooltip.prototype;
  3954. // Public
  3955. _proto.enable = function enable() {
  3956. this._isEnabled = true;
  3957. };
  3958. _proto.disable = function disable() {
  3959. this._isEnabled = false;
  3960. };
  3961. _proto.toggleEnabled = function toggleEnabled() {
  3962. this._isEnabled = !this._isEnabled;
  3963. };
  3964. _proto.toggle = function toggle(event) {
  3965. if (!this._isEnabled) {
  3966. return;
  3967. }
  3968. if (event) {
  3969. var dataKey = this.constructor.DATA_KEY;
  3970. var context = $(event.currentTarget).data(dataKey);
  3971. if (!context) {
  3972. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3973. $(event.currentTarget).data(dataKey, context);
  3974. }
  3975. context._activeTrigger.click = !context._activeTrigger.click;
  3976. if (context._isWithActiveTrigger()) {
  3977. context._enter(null, context);
  3978. } else {
  3979. context._leave(null, context);
  3980. }
  3981. } else {
  3982. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  3983. this._leave(null, this);
  3984. return;
  3985. }
  3986. this._enter(null, this);
  3987. }
  3988. };
  3989. _proto.dispose = function dispose() {
  3990. clearTimeout(this._timeout);
  3991. $.removeData(this.element, this.constructor.DATA_KEY);
  3992. $(this.element).off(this.constructor.EVENT_KEY);
  3993. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  3994. if (this.tip) {
  3995. $(this.tip).remove();
  3996. }
  3997. this._isEnabled = null;
  3998. this._timeout = null;
  3999. this._hoverState = null;
  4000. this._activeTrigger = null;
  4001. if (this._popper) {
  4002. this._popper.destroy();
  4003. }
  4004. this._popper = null;
  4005. this.element = null;
  4006. this.config = null;
  4007. this.tip = null;
  4008. };
  4009. _proto.show = function show() {
  4010. var _this = this;
  4011. if ($(this.element).css('display') === 'none') {
  4012. throw new Error('Please use show on visible elements');
  4013. }
  4014. var showEvent = $.Event(this.constructor.Event.SHOW);
  4015. if (this.isWithContent() && this._isEnabled) {
  4016. $(this.element).trigger(showEvent);
  4017. var shadowRoot = Util.findShadowRoot(this.element);
  4018. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4019. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4020. return;
  4021. }
  4022. var tip = this.getTipElement();
  4023. var tipId = Util.getUID(this.constructor.NAME);
  4024. tip.setAttribute('id', tipId);
  4025. this.element.setAttribute('aria-describedby', tipId);
  4026. this.setContent();
  4027. if (this.config.animation) {
  4028. $(tip).addClass(ClassName$6.FADE);
  4029. }
  4030. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4031. var attachment = this._getAttachment(placement);
  4032. this.addAttachmentClass(attachment);
  4033. var container = this._getContainer();
  4034. $(tip).data(this.constructor.DATA_KEY, this);
  4035. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4036. $(tip).appendTo(container);
  4037. }
  4038. $(this.element).trigger(this.constructor.Event.INSERTED);
  4039. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4040. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4041. // empty mouseover listeners to the body's immediate children;
  4042. // only needed because of broken event delegation on iOS
  4043. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4044. if ('ontouchstart' in document.documentElement) {
  4045. $(document.body).children().on('mouseover', null, $.noop);
  4046. }
  4047. var complete = function complete() {
  4048. if (_this.config.animation) {
  4049. _this._fixTransition();
  4050. }
  4051. var prevHoverState = _this._hoverState;
  4052. _this._hoverState = null;
  4053. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4054. if (prevHoverState === HoverState.OUT) {
  4055. _this._leave(null, _this);
  4056. }
  4057. };
  4058. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4059. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4060. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4061. } else {
  4062. complete();
  4063. }
  4064. }
  4065. };
  4066. _proto.hide = function hide(callback) {
  4067. var _this2 = this;
  4068. var tip = this.getTipElement();
  4069. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4070. var complete = function complete() {
  4071. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4072. tip.parentNode.removeChild(tip);
  4073. }
  4074. _this2._cleanTipClass();
  4075. _this2.element.removeAttribute('aria-describedby');
  4076. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4077. if (_this2._popper !== null) {
  4078. _this2._popper.destroy();
  4079. }
  4080. if (callback) {
  4081. callback();
  4082. }
  4083. };
  4084. $(this.element).trigger(hideEvent);
  4085. if (hideEvent.isDefaultPrevented()) {
  4086. return;
  4087. }
  4088. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4089. // empty mouseover listeners we added for iOS support
  4090. if ('ontouchstart' in document.documentElement) {
  4091. $(document.body).children().off('mouseover', null, $.noop);
  4092. }
  4093. this._activeTrigger[Trigger.CLICK] = false;
  4094. this._activeTrigger[Trigger.FOCUS] = false;
  4095. this._activeTrigger[Trigger.HOVER] = false;
  4096. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4097. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4098. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4099. } else {
  4100. complete();
  4101. }
  4102. this._hoverState = '';
  4103. };
  4104. _proto.update = function update() {
  4105. if (this._popper !== null) {
  4106. this._popper.scheduleUpdate();
  4107. }
  4108. } // Protected
  4109. ;
  4110. _proto.isWithContent = function isWithContent() {
  4111. return Boolean(this.getTitle());
  4112. };
  4113. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4114. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4115. };
  4116. _proto.getTipElement = function getTipElement() {
  4117. this.tip = this.tip || $(this.config.template)[0];
  4118. return this.tip;
  4119. };
  4120. _proto.setContent = function setContent() {
  4121. var tip = this.getTipElement();
  4122. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4123. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4124. };
  4125. _proto.setElementContent = function setElementContent($element, content) {
  4126. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4127. // Content is a DOM node or a jQuery
  4128. if (this.config.html) {
  4129. if (!$(content).parent().is($element)) {
  4130. $element.empty().append(content);
  4131. }
  4132. } else {
  4133. $element.text($(content).text());
  4134. }
  4135. return;
  4136. }
  4137. if (this.config.html) {
  4138. if (this.config.sanitize) {
  4139. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4140. }
  4141. $element.html(content);
  4142. } else {
  4143. $element.text(content);
  4144. }
  4145. };
  4146. _proto.getTitle = function getTitle() {
  4147. var title = this.element.getAttribute('data-original-title');
  4148. if (!title) {
  4149. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4150. }
  4151. return title;
  4152. } // Private
  4153. ;
  4154. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4155. var _this3 = this;
  4156. var defaultBsConfig = {
  4157. placement: attachment,
  4158. modifiers: {
  4159. offset: this._getOffset(),
  4160. flip: {
  4161. behavior: this.config.fallbackPlacement
  4162. },
  4163. arrow: {
  4164. element: Selector$6.ARROW
  4165. },
  4166. preventOverflow: {
  4167. boundariesElement: this.config.boundary
  4168. }
  4169. },
  4170. onCreate: function onCreate(data) {
  4171. if (data.originalPlacement !== data.placement) {
  4172. _this3._handlePopperPlacementChange(data);
  4173. }
  4174. },
  4175. onUpdate: function onUpdate(data) {
  4176. return _this3._handlePopperPlacementChange(data);
  4177. }
  4178. };
  4179. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4180. };
  4181. _proto._getOffset = function _getOffset() {
  4182. var _this4 = this;
  4183. var offset = {};
  4184. if (typeof this.config.offset === 'function') {
  4185. offset.fn = function (data) {
  4186. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4187. return data;
  4188. };
  4189. } else {
  4190. offset.offset = this.config.offset;
  4191. }
  4192. return offset;
  4193. };
  4194. _proto._getContainer = function _getContainer() {
  4195. if (this.config.container === false) {
  4196. return document.body;
  4197. }
  4198. if (Util.isElement(this.config.container)) {
  4199. return $(this.config.container);
  4200. }
  4201. return $(document).find(this.config.container);
  4202. };
  4203. _proto._getAttachment = function _getAttachment(placement) {
  4204. return AttachmentMap$1[placement.toUpperCase()];
  4205. };
  4206. _proto._setListeners = function _setListeners() {
  4207. var _this5 = this;
  4208. var triggers = this.config.trigger.split(' ');
  4209. triggers.forEach(function (trigger) {
  4210. if (trigger === 'click') {
  4211. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4212. return _this5.toggle(event);
  4213. });
  4214. } else if (trigger !== Trigger.MANUAL) {
  4215. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4216. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4217. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4218. return _this5._enter(event);
  4219. }).on(eventOut, _this5.config.selector, function (event) {
  4220. return _this5._leave(event);
  4221. });
  4222. }
  4223. });
  4224. this._hideModalHandler = function () {
  4225. if (_this5.element) {
  4226. _this5.hide();
  4227. }
  4228. };
  4229. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4230. if (this.config.selector) {
  4231. this.config = _objectSpread2({}, this.config, {
  4232. trigger: 'manual',
  4233. selector: ''
  4234. });
  4235. } else {
  4236. this._fixTitle();
  4237. }
  4238. };
  4239. _proto._fixTitle = function _fixTitle() {
  4240. var titleType = typeof this.element.getAttribute('data-original-title');
  4241. if (this.element.getAttribute('title') || titleType !== 'string') {
  4242. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4243. this.element.setAttribute('title', '');
  4244. }
  4245. };
  4246. _proto._enter = function _enter(event, context) {
  4247. var dataKey = this.constructor.DATA_KEY;
  4248. context = context || $(event.currentTarget).data(dataKey);
  4249. if (!context) {
  4250. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4251. $(event.currentTarget).data(dataKey, context);
  4252. }
  4253. if (event) {
  4254. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4255. }
  4256. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4257. context._hoverState = HoverState.SHOW;
  4258. return;
  4259. }
  4260. clearTimeout(context._timeout);
  4261. context._hoverState = HoverState.SHOW;
  4262. if (!context.config.delay || !context.config.delay.show) {
  4263. context.show();
  4264. return;
  4265. }
  4266. context._timeout = setTimeout(function () {
  4267. if (context._hoverState === HoverState.SHOW) {
  4268. context.show();
  4269. }
  4270. }, context.config.delay.show);
  4271. };
  4272. _proto._leave = function _leave(event, context) {
  4273. var dataKey = this.constructor.DATA_KEY;
  4274. context = context || $(event.currentTarget).data(dataKey);
  4275. if (!context) {
  4276. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4277. $(event.currentTarget).data(dataKey, context);
  4278. }
  4279. if (event) {
  4280. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4281. }
  4282. if (context._isWithActiveTrigger()) {
  4283. return;
  4284. }
  4285. clearTimeout(context._timeout);
  4286. context._hoverState = HoverState.OUT;
  4287. if (!context.config.delay || !context.config.delay.hide) {
  4288. context.hide();
  4289. return;
  4290. }
  4291. context._timeout = setTimeout(function () {
  4292. if (context._hoverState === HoverState.OUT) {
  4293. context.hide();
  4294. }
  4295. }, context.config.delay.hide);
  4296. };
  4297. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4298. for (var trigger in this._activeTrigger) {
  4299. if (this._activeTrigger[trigger]) {
  4300. return true;
  4301. }
  4302. }
  4303. return false;
  4304. };
  4305. _proto._getConfig = function _getConfig(config) {
  4306. var dataAttributes = $(this.element).data();
  4307. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4308. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4309. delete dataAttributes[dataAttr];
  4310. }
  4311. });
  4312. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4313. if (typeof config.delay === 'number') {
  4314. config.delay = {
  4315. show: config.delay,
  4316. hide: config.delay
  4317. };
  4318. }
  4319. if (typeof config.title === 'number') {
  4320. config.title = config.title.toString();
  4321. }
  4322. if (typeof config.content === 'number') {
  4323. config.content = config.content.toString();
  4324. }
  4325. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4326. if (config.sanitize) {
  4327. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4328. }
  4329. return config;
  4330. };
  4331. _proto._getDelegateConfig = function _getDelegateConfig() {
  4332. var config = {};
  4333. if (this.config) {
  4334. for (var key in this.config) {
  4335. if (this.constructor.Default[key] !== this.config[key]) {
  4336. config[key] = this.config[key];
  4337. }
  4338. }
  4339. }
  4340. return config;
  4341. };
  4342. _proto._cleanTipClass = function _cleanTipClass() {
  4343. var $tip = $(this.getTipElement());
  4344. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4345. if (tabClass !== null && tabClass.length) {
  4346. $tip.removeClass(tabClass.join(''));
  4347. }
  4348. };
  4349. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4350. var popperInstance = popperData.instance;
  4351. this.tip = popperInstance.popper;
  4352. this._cleanTipClass();
  4353. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4354. };
  4355. _proto._fixTransition = function _fixTransition() {
  4356. var tip = this.getTipElement();
  4357. var initConfigAnimation = this.config.animation;
  4358. if (tip.getAttribute('x-placement') !== null) {
  4359. return;
  4360. }
  4361. $(tip).removeClass(ClassName$6.FADE);
  4362. this.config.animation = false;
  4363. this.hide();
  4364. this.show();
  4365. this.config.animation = initConfigAnimation;
  4366. } // Static
  4367. ;
  4368. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4369. return this.each(function () {
  4370. var data = $(this).data(DATA_KEY$6);
  4371. var _config = typeof config === 'object' && config;
  4372. if (!data && /dispose|hide/.test(config)) {
  4373. return;
  4374. }
  4375. if (!data) {
  4376. data = new Tooltip(this, _config);
  4377. $(this).data(DATA_KEY$6, data);
  4378. }
  4379. if (typeof config === 'string') {
  4380. if (typeof data[config] === 'undefined') {
  4381. throw new TypeError("No method named \"" + config + "\"");
  4382. }
  4383. data[config]();
  4384. }
  4385. });
  4386. };
  4387. _createClass(Tooltip, null, [{
  4388. key: "VERSION",
  4389. get: function get() {
  4390. return VERSION$6;
  4391. }
  4392. }, {
  4393. key: "Default",
  4394. get: function get() {
  4395. return Default$4;
  4396. }
  4397. }, {
  4398. key: "NAME",
  4399. get: function get() {
  4400. return NAME$6;
  4401. }
  4402. }, {
  4403. key: "DATA_KEY",
  4404. get: function get() {
  4405. return DATA_KEY$6;
  4406. }
  4407. }, {
  4408. key: "Event",
  4409. get: function get() {
  4410. return Event$6;
  4411. }
  4412. }, {
  4413. key: "EVENT_KEY",
  4414. get: function get() {
  4415. return EVENT_KEY$6;
  4416. }
  4417. }, {
  4418. key: "DefaultType",
  4419. get: function get() {
  4420. return DefaultType$4;
  4421. }
  4422. }]);
  4423. return Tooltip;
  4424. }();
  4425. /**
  4426. * ------------------------------------------------------------------------
  4427. * jQuery
  4428. * ------------------------------------------------------------------------
  4429. */
  4430. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4431. $.fn[NAME$6].Constructor = Tooltip;
  4432. $.fn[NAME$6].noConflict = function () {
  4433. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4434. return Tooltip._jQueryInterface;
  4435. };
  4436. /**
  4437. * ------------------------------------------------------------------------
  4438. * Constants
  4439. * ------------------------------------------------------------------------
  4440. */
  4441. var NAME$7 = 'popover';
  4442. var VERSION$7 = '4.4.1';
  4443. var DATA_KEY$7 = 'bs.popover';
  4444. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4445. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4446. var CLASS_PREFIX$1 = 'bs-popover';
  4447. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4448. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4449. placement: 'right',
  4450. trigger: 'click',
  4451. content: '',
  4452. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4453. });
  4454. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4455. content: '(string|element|function)'
  4456. });
  4457. var ClassName$7 = {
  4458. FADE: 'fade',
  4459. SHOW: 'show'
  4460. };
  4461. var Selector$7 = {
  4462. TITLE: '.popover-header',
  4463. CONTENT: '.popover-body'
  4464. };
  4465. var Event$7 = {
  4466. HIDE: "hide" + EVENT_KEY$7,
  4467. HIDDEN: "hidden" + EVENT_KEY$7,
  4468. SHOW: "show" + EVENT_KEY$7,
  4469. SHOWN: "shown" + EVENT_KEY$7,
  4470. INSERTED: "inserted" + EVENT_KEY$7,
  4471. CLICK: "click" + EVENT_KEY$7,
  4472. FOCUSIN: "focusin" + EVENT_KEY$7,
  4473. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4474. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4475. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4476. };
  4477. /**
  4478. * ------------------------------------------------------------------------
  4479. * Class Definition
  4480. * ------------------------------------------------------------------------
  4481. */
  4482. var Popover =
  4483. /*#__PURE__*/
  4484. function (_Tooltip) {
  4485. _inheritsLoose(Popover, _Tooltip);
  4486. function Popover() {
  4487. return _Tooltip.apply(this, arguments) || this;
  4488. }
  4489. var _proto = Popover.prototype;
  4490. // Overrides
  4491. _proto.isWithContent = function isWithContent() {
  4492. return this.getTitle() || this._getContent();
  4493. };
  4494. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4495. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4496. };
  4497. _proto.getTipElement = function getTipElement() {
  4498. this.tip = this.tip || $(this.config.template)[0];
  4499. return this.tip;
  4500. };
  4501. _proto.setContent = function setContent() {
  4502. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4503. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4504. var content = this._getContent();
  4505. if (typeof content === 'function') {
  4506. content = content.call(this.element);
  4507. }
  4508. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4509. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4510. } // Private
  4511. ;
  4512. _proto._getContent = function _getContent() {
  4513. return this.element.getAttribute('data-content') || this.config.content;
  4514. };
  4515. _proto._cleanTipClass = function _cleanTipClass() {
  4516. var $tip = $(this.getTipElement());
  4517. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4518. if (tabClass !== null && tabClass.length > 0) {
  4519. $tip.removeClass(tabClass.join(''));
  4520. }
  4521. } // Static
  4522. ;
  4523. Popover._jQueryInterface = function _jQueryInterface(config) {
  4524. return this.each(function () {
  4525. var data = $(this).data(DATA_KEY$7);
  4526. var _config = typeof config === 'object' ? config : null;
  4527. if (!data && /dispose|hide/.test(config)) {
  4528. return;
  4529. }
  4530. if (!data) {
  4531. data = new Popover(this, _config);
  4532. $(this).data(DATA_KEY$7, data);
  4533. }
  4534. if (typeof config === 'string') {
  4535. if (typeof data[config] === 'undefined') {
  4536. throw new TypeError("No method named \"" + config + "\"");
  4537. }
  4538. data[config]();
  4539. }
  4540. });
  4541. };
  4542. _createClass(Popover, null, [{
  4543. key: "VERSION",
  4544. // Getters
  4545. get: function get() {
  4546. return VERSION$7;
  4547. }
  4548. }, {
  4549. key: "Default",
  4550. get: function get() {
  4551. return Default$5;
  4552. }
  4553. }, {
  4554. key: "NAME",
  4555. get: function get() {
  4556. return NAME$7;
  4557. }
  4558. }, {
  4559. key: "DATA_KEY",
  4560. get: function get() {
  4561. return DATA_KEY$7;
  4562. }
  4563. }, {
  4564. key: "Event",
  4565. get: function get() {
  4566. return Event$7;
  4567. }
  4568. }, {
  4569. key: "EVENT_KEY",
  4570. get: function get() {
  4571. return EVENT_KEY$7;
  4572. }
  4573. }, {
  4574. key: "DefaultType",
  4575. get: function get() {
  4576. return DefaultType$5;
  4577. }
  4578. }]);
  4579. return Popover;
  4580. }(Tooltip);
  4581. /**
  4582. * ------------------------------------------------------------------------
  4583. * jQuery
  4584. * ------------------------------------------------------------------------
  4585. */
  4586. $.fn[NAME$7] = Popover._jQueryInterface;
  4587. $.fn[NAME$7].Constructor = Popover;
  4588. $.fn[NAME$7].noConflict = function () {
  4589. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4590. return Popover._jQueryInterface;
  4591. };
  4592. /**
  4593. * ------------------------------------------------------------------------
  4594. * Constants
  4595. * ------------------------------------------------------------------------
  4596. */
  4597. var NAME$8 = 'scrollspy';
  4598. var VERSION$8 = '4.4.1';
  4599. var DATA_KEY$8 = 'bs.scrollspy';
  4600. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4601. var DATA_API_KEY$6 = '.data-api';
  4602. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4603. var Default$6 = {
  4604. offset: 10,
  4605. method: 'auto',
  4606. target: ''
  4607. };
  4608. var DefaultType$6 = {
  4609. offset: 'number',
  4610. method: 'string',
  4611. target: '(string|element)'
  4612. };
  4613. var Event$8 = {
  4614. ACTIVATE: "activate" + EVENT_KEY$8,
  4615. SCROLL: "scroll" + EVENT_KEY$8,
  4616. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  4617. };
  4618. var ClassName$8 = {
  4619. DROPDOWN_ITEM: 'dropdown-item',
  4620. DROPDOWN_MENU: 'dropdown-menu',
  4621. ACTIVE: 'active'
  4622. };
  4623. var Selector$8 = {
  4624. DATA_SPY: '[data-spy="scroll"]',
  4625. ACTIVE: '.active',
  4626. NAV_LIST_GROUP: '.nav, .list-group',
  4627. NAV_LINKS: '.nav-link',
  4628. NAV_ITEMS: '.nav-item',
  4629. LIST_ITEMS: '.list-group-item',
  4630. DROPDOWN: '.dropdown',
  4631. DROPDOWN_ITEMS: '.dropdown-item',
  4632. DROPDOWN_TOGGLE: '.dropdown-toggle'
  4633. };
  4634. var OffsetMethod = {
  4635. OFFSET: 'offset',
  4636. POSITION: 'position'
  4637. };
  4638. /**
  4639. * ------------------------------------------------------------------------
  4640. * Class Definition
  4641. * ------------------------------------------------------------------------
  4642. */
  4643. var ScrollSpy =
  4644. /*#__PURE__*/
  4645. function () {
  4646. function ScrollSpy(element, config) {
  4647. var _this = this;
  4648. this._element = element;
  4649. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4650. this._config = this._getConfig(config);
  4651. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  4652. this._offsets = [];
  4653. this._targets = [];
  4654. this._activeTarget = null;
  4655. this._scrollHeight = 0;
  4656. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  4657. return _this._process(event);
  4658. });
  4659. this.refresh();
  4660. this._process();
  4661. } // Getters
  4662. var _proto = ScrollSpy.prototype;
  4663. // Public
  4664. _proto.refresh = function refresh() {
  4665. var _this2 = this;
  4666. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  4667. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4668. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  4669. this._offsets = [];
  4670. this._targets = [];
  4671. this._scrollHeight = this._getScrollHeight();
  4672. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4673. targets.map(function (element) {
  4674. var target;
  4675. var targetSelector = Util.getSelectorFromElement(element);
  4676. if (targetSelector) {
  4677. target = document.querySelector(targetSelector);
  4678. }
  4679. if (target) {
  4680. var targetBCR = target.getBoundingClientRect();
  4681. if (targetBCR.width || targetBCR.height) {
  4682. // TODO (fat): remove sketch reliance on jQuery position/offset
  4683. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  4684. }
  4685. }
  4686. return null;
  4687. }).filter(function (item) {
  4688. return item;
  4689. }).sort(function (a, b) {
  4690. return a[0] - b[0];
  4691. }).forEach(function (item) {
  4692. _this2._offsets.push(item[0]);
  4693. _this2._targets.push(item[1]);
  4694. });
  4695. };
  4696. _proto.dispose = function dispose() {
  4697. $.removeData(this._element, DATA_KEY$8);
  4698. $(this._scrollElement).off(EVENT_KEY$8);
  4699. this._element = null;
  4700. this._scrollElement = null;
  4701. this._config = null;
  4702. this._selector = null;
  4703. this._offsets = null;
  4704. this._targets = null;
  4705. this._activeTarget = null;
  4706. this._scrollHeight = null;
  4707. } // Private
  4708. ;
  4709. _proto._getConfig = function _getConfig(config) {
  4710. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  4711. if (typeof config.target !== 'string') {
  4712. var id = $(config.target).attr('id');
  4713. if (!id) {
  4714. id = Util.getUID(NAME$8);
  4715. $(config.target).attr('id', id);
  4716. }
  4717. config.target = "#" + id;
  4718. }
  4719. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4720. return config;
  4721. };
  4722. _proto._getScrollTop = function _getScrollTop() {
  4723. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4724. };
  4725. _proto._getScrollHeight = function _getScrollHeight() {
  4726. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4727. };
  4728. _proto._getOffsetHeight = function _getOffsetHeight() {
  4729. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4730. };
  4731. _proto._process = function _process() {
  4732. var scrollTop = this._getScrollTop() + this._config.offset;
  4733. var scrollHeight = this._getScrollHeight();
  4734. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4735. if (this._scrollHeight !== scrollHeight) {
  4736. this.refresh();
  4737. }
  4738. if (scrollTop >= maxScroll) {
  4739. var target = this._targets[this._targets.length - 1];
  4740. if (this._activeTarget !== target) {
  4741. this._activate(target);
  4742. }
  4743. return;
  4744. }
  4745. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4746. this._activeTarget = null;
  4747. this._clear();
  4748. return;
  4749. }
  4750. var offsetLength = this._offsets.length;
  4751. for (var i = offsetLength; i--;) {
  4752. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4753. if (isActiveTarget) {
  4754. this._activate(this._targets[i]);
  4755. }
  4756. }
  4757. };
  4758. _proto._activate = function _activate(target) {
  4759. this._activeTarget = target;
  4760. this._clear();
  4761. var queries = this._selector.split(',').map(function (selector) {
  4762. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4763. });
  4764. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  4765. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  4766. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  4767. $link.addClass(ClassName$8.ACTIVE);
  4768. } else {
  4769. // Set triggered link as active
  4770. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  4771. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4772. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  4773. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  4774. }
  4775. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  4776. relatedTarget: target
  4777. });
  4778. };
  4779. _proto._clear = function _clear() {
  4780. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4781. return node.classList.contains(ClassName$8.ACTIVE);
  4782. }).forEach(function (node) {
  4783. return node.classList.remove(ClassName$8.ACTIVE);
  4784. });
  4785. } // Static
  4786. ;
  4787. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4788. return this.each(function () {
  4789. var data = $(this).data(DATA_KEY$8);
  4790. var _config = typeof config === 'object' && config;
  4791. if (!data) {
  4792. data = new ScrollSpy(this, _config);
  4793. $(this).data(DATA_KEY$8, data);
  4794. }
  4795. if (typeof config === 'string') {
  4796. if (typeof data[config] === 'undefined') {
  4797. throw new TypeError("No method named \"" + config + "\"");
  4798. }
  4799. data[config]();
  4800. }
  4801. });
  4802. };
  4803. _createClass(ScrollSpy, null, [{
  4804. key: "VERSION",
  4805. get: function get() {
  4806. return VERSION$8;
  4807. }
  4808. }, {
  4809. key: "Default",
  4810. get: function get() {
  4811. return Default$6;
  4812. }
  4813. }]);
  4814. return ScrollSpy;
  4815. }();
  4816. /**
  4817. * ------------------------------------------------------------------------
  4818. * Data Api implementation
  4819. * ------------------------------------------------------------------------
  4820. */
  4821. $(window).on(Event$8.LOAD_DATA_API, function () {
  4822. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  4823. var scrollSpysLength = scrollSpys.length;
  4824. for (var i = scrollSpysLength; i--;) {
  4825. var $spy = $(scrollSpys[i]);
  4826. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4827. }
  4828. });
  4829. /**
  4830. * ------------------------------------------------------------------------
  4831. * jQuery
  4832. * ------------------------------------------------------------------------
  4833. */
  4834. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  4835. $.fn[NAME$8].Constructor = ScrollSpy;
  4836. $.fn[NAME$8].noConflict = function () {
  4837. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4838. return ScrollSpy._jQueryInterface;
  4839. };
  4840. /**
  4841. * ------------------------------------------------------------------------
  4842. * Constants
  4843. * ------------------------------------------------------------------------
  4844. */
  4845. var NAME$9 = 'tab';
  4846. var VERSION$9 = '4.4.1';
  4847. var DATA_KEY$9 = 'bs.tab';
  4848. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4849. var DATA_API_KEY$7 = '.data-api';
  4850. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  4851. var Event$9 = {
  4852. HIDE: "hide" + EVENT_KEY$9,
  4853. HIDDEN: "hidden" + EVENT_KEY$9,
  4854. SHOW: "show" + EVENT_KEY$9,
  4855. SHOWN: "shown" + EVENT_KEY$9,
  4856. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  4857. };
  4858. var ClassName$9 = {
  4859. DROPDOWN_MENU: 'dropdown-menu',
  4860. ACTIVE: 'active',
  4861. DISABLED: 'disabled',
  4862. FADE: 'fade',
  4863. SHOW: 'show'
  4864. };
  4865. var Selector$9 = {
  4866. DROPDOWN: '.dropdown',
  4867. NAV_LIST_GROUP: '.nav, .list-group',
  4868. ACTIVE: '.active',
  4869. ACTIVE_UL: '> li > .active',
  4870. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  4871. DROPDOWN_TOGGLE: '.dropdown-toggle',
  4872. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  4873. };
  4874. /**
  4875. * ------------------------------------------------------------------------
  4876. * Class Definition
  4877. * ------------------------------------------------------------------------
  4878. */
  4879. var Tab =
  4880. /*#__PURE__*/
  4881. function () {
  4882. function Tab(element) {
  4883. this._element = element;
  4884. } // Getters
  4885. var _proto = Tab.prototype;
  4886. // Public
  4887. _proto.show = function show() {
  4888. var _this = this;
  4889. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  4890. return;
  4891. }
  4892. var target;
  4893. var previous;
  4894. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  4895. var selector = Util.getSelectorFromElement(this._element);
  4896. if (listElement) {
  4897. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  4898. previous = $.makeArray($(listElement).find(itemSelector));
  4899. previous = previous[previous.length - 1];
  4900. }
  4901. var hideEvent = $.Event(Event$9.HIDE, {
  4902. relatedTarget: this._element
  4903. });
  4904. var showEvent = $.Event(Event$9.SHOW, {
  4905. relatedTarget: previous
  4906. });
  4907. if (previous) {
  4908. $(previous).trigger(hideEvent);
  4909. }
  4910. $(this._element).trigger(showEvent);
  4911. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4912. return;
  4913. }
  4914. if (selector) {
  4915. target = document.querySelector(selector);
  4916. }
  4917. this._activate(this._element, listElement);
  4918. var complete = function complete() {
  4919. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  4920. relatedTarget: _this._element
  4921. });
  4922. var shownEvent = $.Event(Event$9.SHOWN, {
  4923. relatedTarget: previous
  4924. });
  4925. $(previous).trigger(hiddenEvent);
  4926. $(_this._element).trigger(shownEvent);
  4927. };
  4928. if (target) {
  4929. this._activate(target, target.parentNode, complete);
  4930. } else {
  4931. complete();
  4932. }
  4933. };
  4934. _proto.dispose = function dispose() {
  4935. $.removeData(this._element, DATA_KEY$9);
  4936. this._element = null;
  4937. } // Private
  4938. ;
  4939. _proto._activate = function _activate(element, container, callback) {
  4940. var _this2 = this;
  4941. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  4942. var active = activeElements[0];
  4943. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  4944. var complete = function complete() {
  4945. return _this2._transitionComplete(element, active, callback);
  4946. };
  4947. if (active && isTransitioning) {
  4948. var transitionDuration = Util.getTransitionDurationFromElement(active);
  4949. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4950. } else {
  4951. complete();
  4952. }
  4953. };
  4954. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  4955. if (active) {
  4956. $(active).removeClass(ClassName$9.ACTIVE);
  4957. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  4958. if (dropdownChild) {
  4959. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  4960. }
  4961. if (active.getAttribute('role') === 'tab') {
  4962. active.setAttribute('aria-selected', false);
  4963. }
  4964. }
  4965. $(element).addClass(ClassName$9.ACTIVE);
  4966. if (element.getAttribute('role') === 'tab') {
  4967. element.setAttribute('aria-selected', true);
  4968. }
  4969. Util.reflow(element);
  4970. if (element.classList.contains(ClassName$9.FADE)) {
  4971. element.classList.add(ClassName$9.SHOW);
  4972. }
  4973. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  4974. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  4975. if (dropdownElement) {
  4976. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  4977. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  4978. }
  4979. element.setAttribute('aria-expanded', true);
  4980. }
  4981. if (callback) {
  4982. callback();
  4983. }
  4984. } // Static
  4985. ;
  4986. Tab._jQueryInterface = function _jQueryInterface(config) {
  4987. return this.each(function () {
  4988. var $this = $(this);
  4989. var data = $this.data(DATA_KEY$9);
  4990. if (!data) {
  4991. data = new Tab(this);
  4992. $this.data(DATA_KEY$9, data);
  4993. }
  4994. if (typeof config === 'string') {
  4995. if (typeof data[config] === 'undefined') {
  4996. throw new TypeError("No method named \"" + config + "\"");
  4997. }
  4998. data[config]();
  4999. }
  5000. });
  5001. };
  5002. _createClass(Tab, null, [{
  5003. key: "VERSION",
  5004. get: function get() {
  5005. return VERSION$9;
  5006. }
  5007. }]);
  5008. return Tab;
  5009. }();
  5010. /**
  5011. * ------------------------------------------------------------------------
  5012. * Data Api implementation
  5013. * ------------------------------------------------------------------------
  5014. */
  5015. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5016. event.preventDefault();
  5017. Tab._jQueryInterface.call($(this), 'show');
  5018. });
  5019. /**
  5020. * ------------------------------------------------------------------------
  5021. * jQuery
  5022. * ------------------------------------------------------------------------
  5023. */
  5024. $.fn[NAME$9] = Tab._jQueryInterface;
  5025. $.fn[NAME$9].Constructor = Tab;
  5026. $.fn[NAME$9].noConflict = function () {
  5027. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5028. return Tab._jQueryInterface;
  5029. };
  5030. /**
  5031. * ------------------------------------------------------------------------
  5032. * Constants
  5033. * ------------------------------------------------------------------------
  5034. */
  5035. var NAME$a = 'toast';
  5036. var VERSION$a = '4.4.1';
  5037. var DATA_KEY$a = 'bs.toast';
  5038. var EVENT_KEY$a = "." + DATA_KEY$a;
  5039. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5040. var Event$a = {
  5041. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5042. HIDE: "hide" + EVENT_KEY$a,
  5043. HIDDEN: "hidden" + EVENT_KEY$a,
  5044. SHOW: "show" + EVENT_KEY$a,
  5045. SHOWN: "shown" + EVENT_KEY$a
  5046. };
  5047. var ClassName$a = {
  5048. FADE: 'fade',
  5049. HIDE: 'hide',
  5050. SHOW: 'show',
  5051. SHOWING: 'showing'
  5052. };
  5053. var DefaultType$7 = {
  5054. animation: 'boolean',
  5055. autohide: 'boolean',
  5056. delay: 'number'
  5057. };
  5058. var Default$7 = {
  5059. animation: true,
  5060. autohide: true,
  5061. delay: 500
  5062. };
  5063. var Selector$a = {
  5064. DATA_DISMISS: '[data-dismiss="toast"]'
  5065. };
  5066. /**
  5067. * ------------------------------------------------------------------------
  5068. * Class Definition
  5069. * ------------------------------------------------------------------------
  5070. */
  5071. var Toast =
  5072. /*#__PURE__*/
  5073. function () {
  5074. function Toast(element, config) {
  5075. this._element = element;
  5076. this._config = this._getConfig(config);
  5077. this._timeout = null;
  5078. this._setListeners();
  5079. } // Getters
  5080. var _proto = Toast.prototype;
  5081. // Public
  5082. _proto.show = function show() {
  5083. var _this = this;
  5084. var showEvent = $.Event(Event$a.SHOW);
  5085. $(this._element).trigger(showEvent);
  5086. if (showEvent.isDefaultPrevented()) {
  5087. return;
  5088. }
  5089. if (this._config.animation) {
  5090. this._element.classList.add(ClassName$a.FADE);
  5091. }
  5092. var complete = function complete() {
  5093. _this._element.classList.remove(ClassName$a.SHOWING);
  5094. _this._element.classList.add(ClassName$a.SHOW);
  5095. $(_this._element).trigger(Event$a.SHOWN);
  5096. if (_this._config.autohide) {
  5097. _this._timeout = setTimeout(function () {
  5098. _this.hide();
  5099. }, _this._config.delay);
  5100. }
  5101. };
  5102. this._element.classList.remove(ClassName$a.HIDE);
  5103. Util.reflow(this._element);
  5104. this._element.classList.add(ClassName$a.SHOWING);
  5105. if (this._config.animation) {
  5106. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5107. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5108. } else {
  5109. complete();
  5110. }
  5111. };
  5112. _proto.hide = function hide() {
  5113. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5114. return;
  5115. }
  5116. var hideEvent = $.Event(Event$a.HIDE);
  5117. $(this._element).trigger(hideEvent);
  5118. if (hideEvent.isDefaultPrevented()) {
  5119. return;
  5120. }
  5121. this._close();
  5122. };
  5123. _proto.dispose = function dispose() {
  5124. clearTimeout(this._timeout);
  5125. this._timeout = null;
  5126. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5127. this._element.classList.remove(ClassName$a.SHOW);
  5128. }
  5129. $(this._element).off(Event$a.CLICK_DISMISS);
  5130. $.removeData(this._element, DATA_KEY$a);
  5131. this._element = null;
  5132. this._config = null;
  5133. } // Private
  5134. ;
  5135. _proto._getConfig = function _getConfig(config) {
  5136. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5137. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5138. return config;
  5139. };
  5140. _proto._setListeners = function _setListeners() {
  5141. var _this2 = this;
  5142. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5143. return _this2.hide();
  5144. });
  5145. };
  5146. _proto._close = function _close() {
  5147. var _this3 = this;
  5148. var complete = function complete() {
  5149. _this3._element.classList.add(ClassName$a.HIDE);
  5150. $(_this3._element).trigger(Event$a.HIDDEN);
  5151. };
  5152. this._element.classList.remove(ClassName$a.SHOW);
  5153. if (this._config.animation) {
  5154. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5155. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5156. } else {
  5157. complete();
  5158. }
  5159. } // Static
  5160. ;
  5161. Toast._jQueryInterface = function _jQueryInterface(config) {
  5162. return this.each(function () {
  5163. var $element = $(this);
  5164. var data = $element.data(DATA_KEY$a);
  5165. var _config = typeof config === 'object' && config;
  5166. if (!data) {
  5167. data = new Toast(this, _config);
  5168. $element.data(DATA_KEY$a, data);
  5169. }
  5170. if (typeof config === 'string') {
  5171. if (typeof data[config] === 'undefined') {
  5172. throw new TypeError("No method named \"" + config + "\"");
  5173. }
  5174. data[config](this);
  5175. }
  5176. });
  5177. };
  5178. _createClass(Toast, null, [{
  5179. key: "VERSION",
  5180. get: function get() {
  5181. return VERSION$a;
  5182. }
  5183. }, {
  5184. key: "DefaultType",
  5185. get: function get() {
  5186. return DefaultType$7;
  5187. }
  5188. }, {
  5189. key: "Default",
  5190. get: function get() {
  5191. return Default$7;
  5192. }
  5193. }]);
  5194. return Toast;
  5195. }();
  5196. /**
  5197. * ------------------------------------------------------------------------
  5198. * jQuery
  5199. * ------------------------------------------------------------------------
  5200. */
  5201. $.fn[NAME$a] = Toast._jQueryInterface;
  5202. $.fn[NAME$a].Constructor = Toast;
  5203. $.fn[NAME$a].noConflict = function () {
  5204. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5205. return Toast._jQueryInterface;
  5206. };
  5207. exports.Alert = Alert;
  5208. exports.Button = Button;
  5209. exports.Carousel = Carousel;
  5210. exports.Collapse = Collapse;
  5211. exports.Dropdown = Dropdown;
  5212. exports.Modal = Modal;
  5213. exports.Popover = Popover;
  5214. exports.Scrollspy = ScrollSpy;
  5215. exports.Tab = Tab;
  5216. exports.Toast = Toast;
  5217. exports.Tooltip = Tooltip;
  5218. exports.Util = Util;
  5219. Object.defineProperty(exports, '__esModule', { value: true });
  5220. })));
  5221. //# sourceMappingURL=bootstrap.js.map
  5222. /***/ }),
  5223. /***/ "./node_modules/is-buffer/index.js":
  5224. /*!*****************************************!*\
  5225. !*** ./node_modules/is-buffer/index.js ***!
  5226. \*****************************************/
  5227. /*! no static exports found */
  5228. /***/ (function(module, exports) {
  5229. /*!
  5230. * Determine if an object is a Buffer
  5231. *
  5232. * @author Feross Aboukhadijeh <https://feross.org>
  5233. * @license MIT
  5234. */
  5235. module.exports = function isBuffer (obj) {
  5236. return obj != null && obj.constructor != null &&
  5237. typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  5238. }
  5239. /***/ }),
  5240. /***/ "./node_modules/jquery/dist/jquery.js":
  5241. /*!********************************************!*\
  5242. !*** ./node_modules/jquery/dist/jquery.js ***!
  5243. \********************************************/
  5244. /*! no static exports found */
  5245. /***/ (function(module, exports, __webpack_require__) {
  5246. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  5247. * jQuery JavaScript Library v3.4.1
  5248. * https://jquery.com/
  5249. *
  5250. * Includes Sizzle.js
  5251. * https://sizzlejs.com/
  5252. *
  5253. * Copyright JS Foundation and other contributors
  5254. * Released under the MIT license
  5255. * https://jquery.org/license
  5256. *
  5257. * Date: 2019-05-01T21:04Z
  5258. */
  5259. ( function( global, factory ) {
  5260. "use strict";
  5261. if ( true && typeof module.exports === "object" ) {
  5262. // For CommonJS and CommonJS-like environments where a proper `window`
  5263. // is present, execute the factory and get jQuery.
  5264. // For environments that do not have a `window` with a `document`
  5265. // (such as Node.js), expose a factory as module.exports.
  5266. // This accentuates the need for the creation of a real `window`.
  5267. // e.g. var jQuery = require("jquery")(window);
  5268. // See ticket #14549 for more info.
  5269. module.exports = global.document ?
  5270. factory( global, true ) :
  5271. function( w ) {
  5272. if ( !w.document ) {
  5273. throw new Error( "jQuery requires a window with a document" );
  5274. }
  5275. return factory( w );
  5276. };
  5277. } else {
  5278. factory( global );
  5279. }
  5280. // Pass this if window is not defined yet
  5281. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5282. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5283. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5284. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5285. // enough that all such attempts are guarded in a try block.
  5286. "use strict";
  5287. var arr = [];
  5288. var document = window.document;
  5289. var getProto = Object.getPrototypeOf;
  5290. var slice = arr.slice;
  5291. var concat = arr.concat;
  5292. var push = arr.push;
  5293. var indexOf = arr.indexOf;
  5294. var class2type = {};
  5295. var toString = class2type.toString;
  5296. var hasOwn = class2type.hasOwnProperty;
  5297. var fnToString = hasOwn.toString;
  5298. var ObjectFunctionString = fnToString.call( Object );
  5299. var support = {};
  5300. var isFunction = function isFunction( obj ) {
  5301. // Support: Chrome <=57, Firefox <=52
  5302. // In some browsers, typeof returns "function" for HTML <object> elements
  5303. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5304. // We don't want to classify *any* DOM node as a function.
  5305. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5306. };
  5307. var isWindow = function isWindow( obj ) {
  5308. return obj != null && obj === obj.window;
  5309. };
  5310. var preservedScriptAttributes = {
  5311. type: true,
  5312. src: true,
  5313. nonce: true,
  5314. noModule: true
  5315. };
  5316. function DOMEval( code, node, doc ) {
  5317. doc = doc || document;
  5318. var i, val,
  5319. script = doc.createElement( "script" );
  5320. script.text = code;
  5321. if ( node ) {
  5322. for ( i in preservedScriptAttributes ) {
  5323. // Support: Firefox 64+, Edge 18+
  5324. // Some browsers don't support the "nonce" property on scripts.
  5325. // On the other hand, just using `getAttribute` is not enough as
  5326. // the `nonce` attribute is reset to an empty string whenever it
  5327. // becomes browsing-context connected.
  5328. // See https://github.com/whatwg/html/issues/2369
  5329. // See https://html.spec.whatwg.org/#nonce-attributes
  5330. // The `node.getAttribute` check was added for the sake of
  5331. // `jQuery.globalEval` so that it can fake a nonce-containing node
  5332. // via an object.
  5333. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  5334. if ( val ) {
  5335. script.setAttribute( i, val );
  5336. }
  5337. }
  5338. }
  5339. doc.head.appendChild( script ).parentNode.removeChild( script );
  5340. }
  5341. function toType( obj ) {
  5342. if ( obj == null ) {
  5343. return obj + "";
  5344. }
  5345. // Support: Android <=2.3 only (functionish RegExp)
  5346. return typeof obj === "object" || typeof obj === "function" ?
  5347. class2type[ toString.call( obj ) ] || "object" :
  5348. typeof obj;
  5349. }
  5350. /* global Symbol */
  5351. // Defining this global in .eslintrc.json would create a danger of using the global
  5352. // unguarded in another place, it seems safer to define global only for this module
  5353. var
  5354. version = "3.4.1",
  5355. // Define a local copy of jQuery
  5356. jQuery = function( selector, context ) {
  5357. // The jQuery object is actually just the init constructor 'enhanced'
  5358. // Need init if jQuery is called (just allow error to be thrown if not included)
  5359. return new jQuery.fn.init( selector, context );
  5360. },
  5361. // Support: Android <=4.0 only
  5362. // Make sure we trim BOM and NBSP
  5363. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  5364. jQuery.fn = jQuery.prototype = {
  5365. // The current version of jQuery being used
  5366. jquery: version,
  5367. constructor: jQuery,
  5368. // The default length of a jQuery object is 0
  5369. length: 0,
  5370. toArray: function() {
  5371. return slice.call( this );
  5372. },
  5373. // Get the Nth element in the matched element set OR
  5374. // Get the whole matched element set as a clean array
  5375. get: function( num ) {
  5376. // Return all the elements in a clean array
  5377. if ( num == null ) {
  5378. return slice.call( this );
  5379. }
  5380. // Return just the one element from the set
  5381. return num < 0 ? this[ num + this.length ] : this[ num ];
  5382. },
  5383. // Take an array of elements and push it onto the stack
  5384. // (returning the new matched element set)
  5385. pushStack: function( elems ) {
  5386. // Build a new jQuery matched element set
  5387. var ret = jQuery.merge( this.constructor(), elems );
  5388. // Add the old object onto the stack (as a reference)
  5389. ret.prevObject = this;
  5390. // Return the newly-formed element set
  5391. return ret;
  5392. },
  5393. // Execute a callback for every element in the matched set.
  5394. each: function( callback ) {
  5395. return jQuery.each( this, callback );
  5396. },
  5397. map: function( callback ) {
  5398. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5399. return callback.call( elem, i, elem );
  5400. } ) );
  5401. },
  5402. slice: function() {
  5403. return this.pushStack( slice.apply( this, arguments ) );
  5404. },
  5405. first: function() {
  5406. return this.eq( 0 );
  5407. },
  5408. last: function() {
  5409. return this.eq( -1 );
  5410. },
  5411. eq: function( i ) {
  5412. var len = this.length,
  5413. j = +i + ( i < 0 ? len : 0 );
  5414. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5415. },
  5416. end: function() {
  5417. return this.prevObject || this.constructor();
  5418. },
  5419. // For internal use only.
  5420. // Behaves like an Array's method, not like a jQuery method.
  5421. push: push,
  5422. sort: arr.sort,
  5423. splice: arr.splice
  5424. };
  5425. jQuery.extend = jQuery.fn.extend = function() {
  5426. var options, name, src, copy, copyIsArray, clone,
  5427. target = arguments[ 0 ] || {},
  5428. i = 1,
  5429. length = arguments.length,
  5430. deep = false;
  5431. // Handle a deep copy situation
  5432. if ( typeof target === "boolean" ) {
  5433. deep = target;
  5434. // Skip the boolean and the target
  5435. target = arguments[ i ] || {};
  5436. i++;
  5437. }
  5438. // Handle case when target is a string or something (possible in deep copy)
  5439. if ( typeof target !== "object" && !isFunction( target ) ) {
  5440. target = {};
  5441. }
  5442. // Extend jQuery itself if only one argument is passed
  5443. if ( i === length ) {
  5444. target = this;
  5445. i--;
  5446. }
  5447. for ( ; i < length; i++ ) {
  5448. // Only deal with non-null/undefined values
  5449. if ( ( options = arguments[ i ] ) != null ) {
  5450. // Extend the base object
  5451. for ( name in options ) {
  5452. copy = options[ name ];
  5453. // Prevent Object.prototype pollution
  5454. // Prevent never-ending loop
  5455. if ( name === "__proto__" || target === copy ) {
  5456. continue;
  5457. }
  5458. // Recurse if we're merging plain objects or arrays
  5459. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5460. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5461. src = target[ name ];
  5462. // Ensure proper type for the source value
  5463. if ( copyIsArray && !Array.isArray( src ) ) {
  5464. clone = [];
  5465. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  5466. clone = {};
  5467. } else {
  5468. clone = src;
  5469. }
  5470. copyIsArray = false;
  5471. // Never move original objects, clone them
  5472. target[ name ] = jQuery.extend( deep, clone, copy );
  5473. // Don't bring in undefined values
  5474. } else if ( copy !== undefined ) {
  5475. target[ name ] = copy;
  5476. }
  5477. }
  5478. }
  5479. }
  5480. // Return the modified object
  5481. return target;
  5482. };
  5483. jQuery.extend( {
  5484. // Unique for each copy of jQuery on the page
  5485. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5486. // Assume jQuery is ready without the ready module
  5487. isReady: true,
  5488. error: function( msg ) {
  5489. throw new Error( msg );
  5490. },
  5491. noop: function() {},
  5492. isPlainObject: function( obj ) {
  5493. var proto, Ctor;
  5494. // Detect obvious negatives
  5495. // Use toString instead of jQuery.type to catch host objects
  5496. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5497. return false;
  5498. }
  5499. proto = getProto( obj );
  5500. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5501. if ( !proto ) {
  5502. return true;
  5503. }
  5504. // Objects with prototype are plain iff they were constructed by a global Object function
  5505. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5506. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5507. },
  5508. isEmptyObject: function( obj ) {
  5509. var name;
  5510. for ( name in obj ) {
  5511. return false;
  5512. }
  5513. return true;
  5514. },
  5515. // Evaluates a script in a global context
  5516. globalEval: function( code, options ) {
  5517. DOMEval( code, { nonce: options && options.nonce } );
  5518. },
  5519. each: function( obj, callback ) {
  5520. var length, i = 0;
  5521. if ( isArrayLike( obj ) ) {
  5522. length = obj.length;
  5523. for ( ; i < length; i++ ) {
  5524. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5525. break;
  5526. }
  5527. }
  5528. } else {
  5529. for ( i in obj ) {
  5530. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5531. break;
  5532. }
  5533. }
  5534. }
  5535. return obj;
  5536. },
  5537. // Support: Android <=4.0 only
  5538. trim: function( text ) {
  5539. return text == null ?
  5540. "" :
  5541. ( text + "" ).replace( rtrim, "" );
  5542. },
  5543. // results is for internal usage only
  5544. makeArray: function( arr, results ) {
  5545. var ret = results || [];
  5546. if ( arr != null ) {
  5547. if ( isArrayLike( Object( arr ) ) ) {
  5548. jQuery.merge( ret,
  5549. typeof arr === "string" ?
  5550. [ arr ] : arr
  5551. );
  5552. } else {
  5553. push.call( ret, arr );
  5554. }
  5555. }
  5556. return ret;
  5557. },
  5558. inArray: function( elem, arr, i ) {
  5559. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5560. },
  5561. // Support: Android <=4.0 only, PhantomJS 1 only
  5562. // push.apply(_, arraylike) throws on ancient WebKit
  5563. merge: function( first, second ) {
  5564. var len = +second.length,
  5565. j = 0,
  5566. i = first.length;
  5567. for ( ; j < len; j++ ) {
  5568. first[ i++ ] = second[ j ];
  5569. }
  5570. first.length = i;
  5571. return first;
  5572. },
  5573. grep: function( elems, callback, invert ) {
  5574. var callbackInverse,
  5575. matches = [],
  5576. i = 0,
  5577. length = elems.length,
  5578. callbackExpect = !invert;
  5579. // Go through the array, only saving the items
  5580. // that pass the validator function
  5581. for ( ; i < length; i++ ) {
  5582. callbackInverse = !callback( elems[ i ], i );
  5583. if ( callbackInverse !== callbackExpect ) {
  5584. matches.push( elems[ i ] );
  5585. }
  5586. }
  5587. return matches;
  5588. },
  5589. // arg is for internal usage only
  5590. map: function( elems, callback, arg ) {
  5591. var length, value,
  5592. i = 0,
  5593. ret = [];
  5594. // Go through the array, translating each of the items to their new values
  5595. if ( isArrayLike( elems ) ) {
  5596. length = elems.length;
  5597. for ( ; i < length; i++ ) {
  5598. value = callback( elems[ i ], i, arg );
  5599. if ( value != null ) {
  5600. ret.push( value );
  5601. }
  5602. }
  5603. // Go through every key on the object,
  5604. } else {
  5605. for ( i in elems ) {
  5606. value = callback( elems[ i ], i, arg );
  5607. if ( value != null ) {
  5608. ret.push( value );
  5609. }
  5610. }
  5611. }
  5612. // Flatten any nested arrays
  5613. return concat.apply( [], ret );
  5614. },
  5615. // A global GUID counter for objects
  5616. guid: 1,
  5617. // jQuery.support is not used in Core but other projects attach their
  5618. // properties to it so it needs to exist.
  5619. support: support
  5620. } );
  5621. if ( typeof Symbol === "function" ) {
  5622. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5623. }
  5624. // Populate the class2type map
  5625. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5626. function( i, name ) {
  5627. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5628. } );
  5629. function isArrayLike( obj ) {
  5630. // Support: real iOS 8.2 only (not reproducible in simulator)
  5631. // `in` check used to prevent JIT error (gh-2145)
  5632. // hasOwn isn't used here due to false negatives
  5633. // regarding Nodelist length in IE
  5634. var length = !!obj && "length" in obj && obj.length,
  5635. type = toType( obj );
  5636. if ( isFunction( obj ) || isWindow( obj ) ) {
  5637. return false;
  5638. }
  5639. return type === "array" || length === 0 ||
  5640. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5641. }
  5642. var Sizzle =
  5643. /*!
  5644. * Sizzle CSS Selector Engine v2.3.4
  5645. * https://sizzlejs.com/
  5646. *
  5647. * Copyright JS Foundation and other contributors
  5648. * Released under the MIT license
  5649. * https://js.foundation/
  5650. *
  5651. * Date: 2019-04-08
  5652. */
  5653. (function( window ) {
  5654. var i,
  5655. support,
  5656. Expr,
  5657. getText,
  5658. isXML,
  5659. tokenize,
  5660. compile,
  5661. select,
  5662. outermostContext,
  5663. sortInput,
  5664. hasDuplicate,
  5665. // Local document vars
  5666. setDocument,
  5667. document,
  5668. docElem,
  5669. documentIsHTML,
  5670. rbuggyQSA,
  5671. rbuggyMatches,
  5672. matches,
  5673. contains,
  5674. // Instance-specific data
  5675. expando = "sizzle" + 1 * new Date(),
  5676. preferredDoc = window.document,
  5677. dirruns = 0,
  5678. done = 0,
  5679. classCache = createCache(),
  5680. tokenCache = createCache(),
  5681. compilerCache = createCache(),
  5682. nonnativeSelectorCache = createCache(),
  5683. sortOrder = function( a, b ) {
  5684. if ( a === b ) {
  5685. hasDuplicate = true;
  5686. }
  5687. return 0;
  5688. },
  5689. // Instance methods
  5690. hasOwn = ({}).hasOwnProperty,
  5691. arr = [],
  5692. pop = arr.pop,
  5693. push_native = arr.push,
  5694. push = arr.push,
  5695. slice = arr.slice,
  5696. // Use a stripped-down indexOf as it's faster than native
  5697. // https://jsperf.com/thor-indexof-vs-for/5
  5698. indexOf = function( list, elem ) {
  5699. var i = 0,
  5700. len = list.length;
  5701. for ( ; i < len; i++ ) {
  5702. if ( list[i] === elem ) {
  5703. return i;
  5704. }
  5705. }
  5706. return -1;
  5707. },
  5708. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  5709. // Regular expressions
  5710. // http://www.w3.org/TR/css3-selectors/#whitespace
  5711. whitespace = "[\\x20\\t\\r\\n\\f]",
  5712. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  5713. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  5714. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5715. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5716. // Operator (capture 2)
  5717. "*([*^$|!~]?=)" + whitespace +
  5718. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  5719. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  5720. "*\\]",
  5721. pseudos = ":(" + identifier + ")(?:\\((" +
  5722. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5723. // 1. quoted (capture 3; capture 4 or capture 5)
  5724. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5725. // 2. simple (capture 6)
  5726. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5727. // 3. anything else (capture 2)
  5728. ".*" +
  5729. ")\\)|)",
  5730. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5731. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5732. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  5733. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5734. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  5735. rdescend = new RegExp( whitespace + "|>" ),
  5736. rpseudo = new RegExp( pseudos ),
  5737. ridentifier = new RegExp( "^" + identifier + "$" ),
  5738. matchExpr = {
  5739. "ID": new RegExp( "^#(" + identifier + ")" ),
  5740. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5741. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5742. "ATTR": new RegExp( "^" + attributes ),
  5743. "PSEUDO": new RegExp( "^" + pseudos ),
  5744. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  5745. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  5746. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5747. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5748. // For use in libraries implementing .is()
  5749. // We use this for POS matching in `select`
  5750. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  5751. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5752. },
  5753. rhtml = /HTML$/i,
  5754. rinputs = /^(?:input|select|textarea|button)$/i,
  5755. rheader = /^h\d$/i,
  5756. rnative = /^[^{]+\{\s*\[native \w/,
  5757. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5758. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5759. rsibling = /[+~]/,
  5760. // CSS escapes
  5761. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5762. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  5763. funescape = function( _, escaped, escapedWhitespace ) {
  5764. var high = "0x" + escaped - 0x10000;
  5765. // NaN means non-codepoint
  5766. // Support: Firefox<24
  5767. // Workaround erroneous numeric interpretation of +"0x"
  5768. return high !== high || escapedWhitespace ?
  5769. escaped :
  5770. high < 0 ?
  5771. // BMP codepoint
  5772. String.fromCharCode( high + 0x10000 ) :
  5773. // Supplemental Plane codepoint (surrogate pair)
  5774. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5775. },
  5776. // CSS string/identifier serialization
  5777. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5778. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5779. fcssescape = function( ch, asCodePoint ) {
  5780. if ( asCodePoint ) {
  5781. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5782. if ( ch === "\0" ) {
  5783. return "\uFFFD";
  5784. }
  5785. // Control characters and (dependent upon position) numbers get escaped as code points
  5786. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5787. }
  5788. // Other potentially-special ASCII characters get backslash-escaped
  5789. return "\\" + ch;
  5790. },
  5791. // Used for iframes
  5792. // See setDocument()
  5793. // Removing the function wrapper causes a "Permission Denied"
  5794. // error in IE
  5795. unloadHandler = function() {
  5796. setDocument();
  5797. },
  5798. inDisabledFieldset = addCombinator(
  5799. function( elem ) {
  5800. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  5801. },
  5802. { dir: "parentNode", next: "legend" }
  5803. );
  5804. // Optimize for push.apply( _, NodeList )
  5805. try {
  5806. push.apply(
  5807. (arr = slice.call( preferredDoc.childNodes )),
  5808. preferredDoc.childNodes
  5809. );
  5810. // Support: Android<4.0
  5811. // Detect silently failing push.apply
  5812. arr[ preferredDoc.childNodes.length ].nodeType;
  5813. } catch ( e ) {
  5814. push = { apply: arr.length ?
  5815. // Leverage slice if possible
  5816. function( target, els ) {
  5817. push_native.apply( target, slice.call(els) );
  5818. } :
  5819. // Support: IE<9
  5820. // Otherwise append directly
  5821. function( target, els ) {
  5822. var j = target.length,
  5823. i = 0;
  5824. // Can't trust NodeList.length
  5825. while ( (target[j++] = els[i++]) ) {}
  5826. target.length = j - 1;
  5827. }
  5828. };
  5829. }
  5830. function Sizzle( selector, context, results, seed ) {
  5831. var m, i, elem, nid, match, groups, newSelector,
  5832. newContext = context && context.ownerDocument,
  5833. // nodeType defaults to 9, since context defaults to document
  5834. nodeType = context ? context.nodeType : 9;
  5835. results = results || [];
  5836. // Return early from calls with invalid selector or context
  5837. if ( typeof selector !== "string" || !selector ||
  5838. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5839. return results;
  5840. }
  5841. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5842. if ( !seed ) {
  5843. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  5844. setDocument( context );
  5845. }
  5846. context = context || document;
  5847. if ( documentIsHTML ) {
  5848. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5849. // (excepting DocumentFragment context, where the methods don't exist)
  5850. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  5851. // ID selector
  5852. if ( (m = match[1]) ) {
  5853. // Document context
  5854. if ( nodeType === 9 ) {
  5855. if ( (elem = context.getElementById( m )) ) {
  5856. // Support: IE, Opera, Webkit
  5857. // TODO: identify versions
  5858. // getElementById can match elements by name instead of ID
  5859. if ( elem.id === m ) {
  5860. results.push( elem );
  5861. return results;
  5862. }
  5863. } else {
  5864. return results;
  5865. }
  5866. // Element context
  5867. } else {
  5868. // Support: IE, Opera, Webkit
  5869. // TODO: identify versions
  5870. // getElementById can match elements by name instead of ID
  5871. if ( newContext && (elem = newContext.getElementById( m )) &&
  5872. contains( context, elem ) &&
  5873. elem.id === m ) {
  5874. results.push( elem );
  5875. return results;
  5876. }
  5877. }
  5878. // Type selector
  5879. } else if ( match[2] ) {
  5880. push.apply( results, context.getElementsByTagName( selector ) );
  5881. return results;
  5882. // Class selector
  5883. } else if ( (m = match[3]) && support.getElementsByClassName &&
  5884. context.getElementsByClassName ) {
  5885. push.apply( results, context.getElementsByClassName( m ) );
  5886. return results;
  5887. }
  5888. }
  5889. // Take advantage of querySelectorAll
  5890. if ( support.qsa &&
  5891. !nonnativeSelectorCache[ selector + " " ] &&
  5892. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  5893. // Support: IE 8 only
  5894. // Exclude object elements
  5895. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  5896. newSelector = selector;
  5897. newContext = context;
  5898. // qSA considers elements outside a scoping root when evaluating child or
  5899. // descendant combinators, which is not what we want.
  5900. // In such cases, we work around the behavior by prefixing every selector in the
  5901. // list with an ID selector referencing the scope context.
  5902. // Thanks to Andrew Dupont for this technique.
  5903. if ( nodeType === 1 && rdescend.test( selector ) ) {
  5904. // Capture the context ID, setting it first if necessary
  5905. if ( (nid = context.getAttribute( "id" )) ) {
  5906. nid = nid.replace( rcssescape, fcssescape );
  5907. } else {
  5908. context.setAttribute( "id", (nid = expando) );
  5909. }
  5910. // Prefix every selector in the list
  5911. groups = tokenize( selector );
  5912. i = groups.length;
  5913. while ( i-- ) {
  5914. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  5915. }
  5916. newSelector = groups.join( "," );
  5917. // Expand context for sibling selectors
  5918. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5919. context;
  5920. }
  5921. try {
  5922. push.apply( results,
  5923. newContext.querySelectorAll( newSelector )
  5924. );
  5925. return results;
  5926. } catch ( qsaError ) {
  5927. nonnativeSelectorCache( selector, true );
  5928. } finally {
  5929. if ( nid === expando ) {
  5930. context.removeAttribute( "id" );
  5931. }
  5932. }
  5933. }
  5934. }
  5935. }
  5936. // All others
  5937. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5938. }
  5939. /**
  5940. * Create key-value caches of limited size
  5941. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5942. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5943. * deleting the oldest entry
  5944. */
  5945. function createCache() {
  5946. var keys = [];
  5947. function cache( key, value ) {
  5948. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5949. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5950. // Only keep the most recent entries
  5951. delete cache[ keys.shift() ];
  5952. }
  5953. return (cache[ key + " " ] = value);
  5954. }
  5955. return cache;
  5956. }
  5957. /**
  5958. * Mark a function for special use by Sizzle
  5959. * @param {Function} fn The function to mark
  5960. */
  5961. function markFunction( fn ) {
  5962. fn[ expando ] = true;
  5963. return fn;
  5964. }
  5965. /**
  5966. * Support testing using an element
  5967. * @param {Function} fn Passed the created element and returns a boolean result
  5968. */
  5969. function assert( fn ) {
  5970. var el = document.createElement("fieldset");
  5971. try {
  5972. return !!fn( el );
  5973. } catch (e) {
  5974. return false;
  5975. } finally {
  5976. // Remove from its parent by default
  5977. if ( el.parentNode ) {
  5978. el.parentNode.removeChild( el );
  5979. }
  5980. // release memory in IE
  5981. el = null;
  5982. }
  5983. }
  5984. /**
  5985. * Adds the same handler for all of the specified attrs
  5986. * @param {String} attrs Pipe-separated list of attributes
  5987. * @param {Function} handler The method that will be applied
  5988. */
  5989. function addHandle( attrs, handler ) {
  5990. var arr = attrs.split("|"),
  5991. i = arr.length;
  5992. while ( i-- ) {
  5993. Expr.attrHandle[ arr[i] ] = handler;
  5994. }
  5995. }
  5996. /**
  5997. * Checks document order of two siblings
  5998. * @param {Element} a
  5999. * @param {Element} b
  6000. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  6001. */
  6002. function siblingCheck( a, b ) {
  6003. var cur = b && a,
  6004. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  6005. a.sourceIndex - b.sourceIndex;
  6006. // Use IE sourceIndex if available on both nodes
  6007. if ( diff ) {
  6008. return diff;
  6009. }
  6010. // Check if b follows a
  6011. if ( cur ) {
  6012. while ( (cur = cur.nextSibling) ) {
  6013. if ( cur === b ) {
  6014. return -1;
  6015. }
  6016. }
  6017. }
  6018. return a ? 1 : -1;
  6019. }
  6020. /**
  6021. * Returns a function to use in pseudos for input types
  6022. * @param {String} type
  6023. */
  6024. function createInputPseudo( type ) {
  6025. return function( elem ) {
  6026. var name = elem.nodeName.toLowerCase();
  6027. return name === "input" && elem.type === type;
  6028. };
  6029. }
  6030. /**
  6031. * Returns a function to use in pseudos for buttons
  6032. * @param {String} type
  6033. */
  6034. function createButtonPseudo( type ) {
  6035. return function( elem ) {
  6036. var name = elem.nodeName.toLowerCase();
  6037. return (name === "input" || name === "button") && elem.type === type;
  6038. };
  6039. }
  6040. /**
  6041. * Returns a function to use in pseudos for :enabled/:disabled
  6042. * @param {Boolean} disabled true for :disabled; false for :enabled
  6043. */
  6044. function createDisabledPseudo( disabled ) {
  6045. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  6046. return function( elem ) {
  6047. // Only certain elements can match :enabled or :disabled
  6048. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  6049. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  6050. if ( "form" in elem ) {
  6051. // Check for inherited disabledness on relevant non-disabled elements:
  6052. // * listed form-associated elements in a disabled fieldset
  6053. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  6054. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  6055. // * option elements in a disabled optgroup
  6056. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  6057. // All such elements have a "form" property.
  6058. if ( elem.parentNode && elem.disabled === false ) {
  6059. // Option elements defer to a parent optgroup if present
  6060. if ( "label" in elem ) {
  6061. if ( "label" in elem.parentNode ) {
  6062. return elem.parentNode.disabled === disabled;
  6063. } else {
  6064. return elem.disabled === disabled;
  6065. }
  6066. }
  6067. // Support: IE 6 - 11
  6068. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  6069. return elem.isDisabled === disabled ||
  6070. // Where there is no isDisabled, check manually
  6071. /* jshint -W018 */
  6072. elem.isDisabled !== !disabled &&
  6073. inDisabledFieldset( elem ) === disabled;
  6074. }
  6075. return elem.disabled === disabled;
  6076. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  6077. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  6078. // even exist on them, let alone have a boolean value.
  6079. } else if ( "label" in elem ) {
  6080. return elem.disabled === disabled;
  6081. }
  6082. // Remaining elements are neither :enabled nor :disabled
  6083. return false;
  6084. };
  6085. }
  6086. /**
  6087. * Returns a function to use in pseudos for positionals
  6088. * @param {Function} fn
  6089. */
  6090. function createPositionalPseudo( fn ) {
  6091. return markFunction(function( argument ) {
  6092. argument = +argument;
  6093. return markFunction(function( seed, matches ) {
  6094. var j,
  6095. matchIndexes = fn( [], seed.length, argument ),
  6096. i = matchIndexes.length;
  6097. // Match elements found at the specified indexes
  6098. while ( i-- ) {
  6099. if ( seed[ (j = matchIndexes[i]) ] ) {
  6100. seed[j] = !(matches[j] = seed[j]);
  6101. }
  6102. }
  6103. });
  6104. });
  6105. }
  6106. /**
  6107. * Checks a node for validity as a Sizzle context
  6108. * @param {Element|Object=} context
  6109. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  6110. */
  6111. function testContext( context ) {
  6112. return context && typeof context.getElementsByTagName !== "undefined" && context;
  6113. }
  6114. // Expose support vars for convenience
  6115. support = Sizzle.support = {};
  6116. /**
  6117. * Detects XML nodes
  6118. * @param {Element|Object} elem An element or a document
  6119. * @returns {Boolean} True iff elem is a non-HTML XML node
  6120. */
  6121. isXML = Sizzle.isXML = function( elem ) {
  6122. var namespace = elem.namespaceURI,
  6123. docElem = (elem.ownerDocument || elem).documentElement;
  6124. // Support: IE <=8
  6125. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  6126. // https://bugs.jquery.com/ticket/4833
  6127. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  6128. };
  6129. /**
  6130. * Sets document-related variables once based on the current document
  6131. * @param {Element|Object} [doc] An element or document object to use to set the document
  6132. * @returns {Object} Returns the current document
  6133. */
  6134. setDocument = Sizzle.setDocument = function( node ) {
  6135. var hasCompare, subWindow,
  6136. doc = node ? node.ownerDocument || node : preferredDoc;
  6137. // Return early if doc is invalid or already selected
  6138. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  6139. return document;
  6140. }
  6141. // Update global variables
  6142. document = doc;
  6143. docElem = document.documentElement;
  6144. documentIsHTML = !isXML( document );
  6145. // Support: IE 9-11, Edge
  6146. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  6147. if ( preferredDoc !== document &&
  6148. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  6149. // Support: IE 11, Edge
  6150. if ( subWindow.addEventListener ) {
  6151. subWindow.addEventListener( "unload", unloadHandler, false );
  6152. // Support: IE 9 - 10 only
  6153. } else if ( subWindow.attachEvent ) {
  6154. subWindow.attachEvent( "onunload", unloadHandler );
  6155. }
  6156. }
  6157. /* Attributes
  6158. ---------------------------------------------------------------------- */
  6159. // Support: IE<8
  6160. // Verify that getAttribute really returns attributes and not properties
  6161. // (excepting IE8 booleans)
  6162. support.attributes = assert(function( el ) {
  6163. el.className = "i";
  6164. return !el.getAttribute("className");
  6165. });
  6166. /* getElement(s)By*
  6167. ---------------------------------------------------------------------- */
  6168. // Check if getElementsByTagName("*") returns only elements
  6169. support.getElementsByTagName = assert(function( el ) {
  6170. el.appendChild( document.createComment("") );
  6171. return !el.getElementsByTagName("*").length;
  6172. });
  6173. // Support: IE<9
  6174. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  6175. // Support: IE<10
  6176. // Check if getElementById returns elements by name
  6177. // The broken getElementById methods don't pick up programmatically-set names,
  6178. // so use a roundabout getElementsByName test
  6179. support.getById = assert(function( el ) {
  6180. docElem.appendChild( el ).id = expando;
  6181. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  6182. });
  6183. // ID filter and find
  6184. if ( support.getById ) {
  6185. Expr.filter["ID"] = function( id ) {
  6186. var attrId = id.replace( runescape, funescape );
  6187. return function( elem ) {
  6188. return elem.getAttribute("id") === attrId;
  6189. };
  6190. };
  6191. Expr.find["ID"] = function( id, context ) {
  6192. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6193. var elem = context.getElementById( id );
  6194. return elem ? [ elem ] : [];
  6195. }
  6196. };
  6197. } else {
  6198. Expr.filter["ID"] = function( id ) {
  6199. var attrId = id.replace( runescape, funescape );
  6200. return function( elem ) {
  6201. var node = typeof elem.getAttributeNode !== "undefined" &&
  6202. elem.getAttributeNode("id");
  6203. return node && node.value === attrId;
  6204. };
  6205. };
  6206. // Support: IE 6 - 7 only
  6207. // getElementById is not reliable as a find shortcut
  6208. Expr.find["ID"] = function( id, context ) {
  6209. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6210. var node, i, elems,
  6211. elem = context.getElementById( id );
  6212. if ( elem ) {
  6213. // Verify the id attribute
  6214. node = elem.getAttributeNode("id");
  6215. if ( node && node.value === id ) {
  6216. return [ elem ];
  6217. }
  6218. // Fall back on getElementsByName
  6219. elems = context.getElementsByName( id );
  6220. i = 0;
  6221. while ( (elem = elems[i++]) ) {
  6222. node = elem.getAttributeNode("id");
  6223. if ( node && node.value === id ) {
  6224. return [ elem ];
  6225. }
  6226. }
  6227. }
  6228. return [];
  6229. }
  6230. };
  6231. }
  6232. // Tag
  6233. Expr.find["TAG"] = support.getElementsByTagName ?
  6234. function( tag, context ) {
  6235. if ( typeof context.getElementsByTagName !== "undefined" ) {
  6236. return context.getElementsByTagName( tag );
  6237. // DocumentFragment nodes don't have gEBTN
  6238. } else if ( support.qsa ) {
  6239. return context.querySelectorAll( tag );
  6240. }
  6241. } :
  6242. function( tag, context ) {
  6243. var elem,
  6244. tmp = [],
  6245. i = 0,
  6246. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  6247. results = context.getElementsByTagName( tag );
  6248. // Filter out possible comments
  6249. if ( tag === "*" ) {
  6250. while ( (elem = results[i++]) ) {
  6251. if ( elem.nodeType === 1 ) {
  6252. tmp.push( elem );
  6253. }
  6254. }
  6255. return tmp;
  6256. }
  6257. return results;
  6258. };
  6259. // Class
  6260. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  6261. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  6262. return context.getElementsByClassName( className );
  6263. }
  6264. };
  6265. /* QSA/matchesSelector
  6266. ---------------------------------------------------------------------- */
  6267. // QSA and matchesSelector support
  6268. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  6269. rbuggyMatches = [];
  6270. // qSa(:focus) reports false when true (Chrome 21)
  6271. // We allow this because of a bug in IE8/9 that throws an error
  6272. // whenever `document.activeElement` is accessed on an iframe
  6273. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  6274. // See https://bugs.jquery.com/ticket/13378
  6275. rbuggyQSA = [];
  6276. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  6277. // Build QSA regex
  6278. // Regex strategy adopted from Diego Perini
  6279. assert(function( el ) {
  6280. // Select is set to empty string on purpose
  6281. // This is to test IE's treatment of not explicitly
  6282. // setting a boolean content attribute,
  6283. // since its presence should be enough
  6284. // https://bugs.jquery.com/ticket/12359
  6285. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  6286. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  6287. "<option selected=''></option></select>";
  6288. // Support: IE8, Opera 11-12.16
  6289. // Nothing should be selected when empty strings follow ^= or $= or *=
  6290. // The test attribute must be unknown in Opera but "safe" for WinRT
  6291. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6292. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  6293. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6294. }
  6295. // Support: IE8
  6296. // Boolean attributes and "value" are not treated correctly
  6297. if ( !el.querySelectorAll("[selected]").length ) {
  6298. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6299. }
  6300. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6301. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6302. rbuggyQSA.push("~=");
  6303. }
  6304. // Webkit/Opera - :checked should return selected option elements
  6305. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6306. // IE8 throws error here and will not see later tests
  6307. if ( !el.querySelectorAll(":checked").length ) {
  6308. rbuggyQSA.push(":checked");
  6309. }
  6310. // Support: Safari 8+, iOS 8+
  6311. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6312. // In-page `selector#id sibling-combinator selector` fails
  6313. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6314. rbuggyQSA.push(".#.+[+~]");
  6315. }
  6316. });
  6317. assert(function( el ) {
  6318. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6319. "<select disabled='disabled'><option/></select>";
  6320. // Support: Windows 8 Native Apps
  6321. // The type and name attributes are restricted during .innerHTML assignment
  6322. var input = document.createElement("input");
  6323. input.setAttribute( "type", "hidden" );
  6324. el.appendChild( input ).setAttribute( "name", "D" );
  6325. // Support: IE8
  6326. // Enforce case-sensitivity of name attribute
  6327. if ( el.querySelectorAll("[name=d]").length ) {
  6328. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6329. }
  6330. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6331. // IE8 throws error here and will not see later tests
  6332. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  6333. rbuggyQSA.push( ":enabled", ":disabled" );
  6334. }
  6335. // Support: IE9-11+
  6336. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6337. docElem.appendChild( el ).disabled = true;
  6338. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  6339. rbuggyQSA.push( ":enabled", ":disabled" );
  6340. }
  6341. // Opera 10-11 does not throw on post-comma invalid pseudos
  6342. el.querySelectorAll("*,:x");
  6343. rbuggyQSA.push(",.*:");
  6344. });
  6345. }
  6346. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  6347. docElem.webkitMatchesSelector ||
  6348. docElem.mozMatchesSelector ||
  6349. docElem.oMatchesSelector ||
  6350. docElem.msMatchesSelector) )) ) {
  6351. assert(function( el ) {
  6352. // Check to see if it's possible to do matchesSelector
  6353. // on a disconnected node (IE 9)
  6354. support.disconnectedMatch = matches.call( el, "*" );
  6355. // This should fail with an exception
  6356. // Gecko does not error, returns false instead
  6357. matches.call( el, "[s!='']:x" );
  6358. rbuggyMatches.push( "!=", pseudos );
  6359. });
  6360. }
  6361. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  6362. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  6363. /* Contains
  6364. ---------------------------------------------------------------------- */
  6365. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6366. // Element contains another
  6367. // Purposefully self-exclusive
  6368. // As in, an element does not contain itself
  6369. contains = hasCompare || rnative.test( docElem.contains ) ?
  6370. function( a, b ) {
  6371. var adown = a.nodeType === 9 ? a.documentElement : a,
  6372. bup = b && b.parentNode;
  6373. return a === bup || !!( bup && bup.nodeType === 1 && (
  6374. adown.contains ?
  6375. adown.contains( bup ) :
  6376. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6377. ));
  6378. } :
  6379. function( a, b ) {
  6380. if ( b ) {
  6381. while ( (b = b.parentNode) ) {
  6382. if ( b === a ) {
  6383. return true;
  6384. }
  6385. }
  6386. }
  6387. return false;
  6388. };
  6389. /* Sorting
  6390. ---------------------------------------------------------------------- */
  6391. // Document order sorting
  6392. sortOrder = hasCompare ?
  6393. function( a, b ) {
  6394. // Flag for duplicate removal
  6395. if ( a === b ) {
  6396. hasDuplicate = true;
  6397. return 0;
  6398. }
  6399. // Sort on method existence if only one input has compareDocumentPosition
  6400. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6401. if ( compare ) {
  6402. return compare;
  6403. }
  6404. // Calculate position if both inputs belong to the same document
  6405. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  6406. a.compareDocumentPosition( b ) :
  6407. // Otherwise we know they are disconnected
  6408. 1;
  6409. // Disconnected nodes
  6410. if ( compare & 1 ||
  6411. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  6412. // Choose the first element that is related to our preferred document
  6413. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  6414. return -1;
  6415. }
  6416. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  6417. return 1;
  6418. }
  6419. // Maintain original order
  6420. return sortInput ?
  6421. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6422. 0;
  6423. }
  6424. return compare & 4 ? -1 : 1;
  6425. } :
  6426. function( a, b ) {
  6427. // Exit early if the nodes are identical
  6428. if ( a === b ) {
  6429. hasDuplicate = true;
  6430. return 0;
  6431. }
  6432. var cur,
  6433. i = 0,
  6434. aup = a.parentNode,
  6435. bup = b.parentNode,
  6436. ap = [ a ],
  6437. bp = [ b ];
  6438. // Parentless nodes are either documents or disconnected
  6439. if ( !aup || !bup ) {
  6440. return a === document ? -1 :
  6441. b === document ? 1 :
  6442. aup ? -1 :
  6443. bup ? 1 :
  6444. sortInput ?
  6445. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6446. 0;
  6447. // If the nodes are siblings, we can do a quick check
  6448. } else if ( aup === bup ) {
  6449. return siblingCheck( a, b );
  6450. }
  6451. // Otherwise we need full lists of their ancestors for comparison
  6452. cur = a;
  6453. while ( (cur = cur.parentNode) ) {
  6454. ap.unshift( cur );
  6455. }
  6456. cur = b;
  6457. while ( (cur = cur.parentNode) ) {
  6458. bp.unshift( cur );
  6459. }
  6460. // Walk down the tree looking for a discrepancy
  6461. while ( ap[i] === bp[i] ) {
  6462. i++;
  6463. }
  6464. return i ?
  6465. // Do a sibling check if the nodes have a common ancestor
  6466. siblingCheck( ap[i], bp[i] ) :
  6467. // Otherwise nodes in our document sort first
  6468. ap[i] === preferredDoc ? -1 :
  6469. bp[i] === preferredDoc ? 1 :
  6470. 0;
  6471. };
  6472. return document;
  6473. };
  6474. Sizzle.matches = function( expr, elements ) {
  6475. return Sizzle( expr, null, null, elements );
  6476. };
  6477. Sizzle.matchesSelector = function( elem, expr ) {
  6478. // Set document vars if needed
  6479. if ( ( elem.ownerDocument || elem ) !== document ) {
  6480. setDocument( elem );
  6481. }
  6482. if ( support.matchesSelector && documentIsHTML &&
  6483. !nonnativeSelectorCache[ expr + " " ] &&
  6484. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6485. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6486. try {
  6487. var ret = matches.call( elem, expr );
  6488. // IE 9's matchesSelector returns false on disconnected nodes
  6489. if ( ret || support.disconnectedMatch ||
  6490. // As well, disconnected nodes are said to be in a document
  6491. // fragment in IE 9
  6492. elem.document && elem.document.nodeType !== 11 ) {
  6493. return ret;
  6494. }
  6495. } catch (e) {
  6496. nonnativeSelectorCache( expr, true );
  6497. }
  6498. }
  6499. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6500. };
  6501. Sizzle.contains = function( context, elem ) {
  6502. // Set document vars if needed
  6503. if ( ( context.ownerDocument || context ) !== document ) {
  6504. setDocument( context );
  6505. }
  6506. return contains( context, elem );
  6507. };
  6508. Sizzle.attr = function( elem, name ) {
  6509. // Set document vars if needed
  6510. if ( ( elem.ownerDocument || elem ) !== document ) {
  6511. setDocument( elem );
  6512. }
  6513. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6514. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6515. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6516. fn( elem, name, !documentIsHTML ) :
  6517. undefined;
  6518. return val !== undefined ?
  6519. val :
  6520. support.attributes || !documentIsHTML ?
  6521. elem.getAttribute( name ) :
  6522. (val = elem.getAttributeNode(name)) && val.specified ?
  6523. val.value :
  6524. null;
  6525. };
  6526. Sizzle.escape = function( sel ) {
  6527. return (sel + "").replace( rcssescape, fcssescape );
  6528. };
  6529. Sizzle.error = function( msg ) {
  6530. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6531. };
  6532. /**
  6533. * Document sorting and removing duplicates
  6534. * @param {ArrayLike} results
  6535. */
  6536. Sizzle.uniqueSort = function( results ) {
  6537. var elem,
  6538. duplicates = [],
  6539. j = 0,
  6540. i = 0;
  6541. // Unless we *know* we can detect duplicates, assume their presence
  6542. hasDuplicate = !support.detectDuplicates;
  6543. sortInput = !support.sortStable && results.slice( 0 );
  6544. results.sort( sortOrder );
  6545. if ( hasDuplicate ) {
  6546. while ( (elem = results[i++]) ) {
  6547. if ( elem === results[ i ] ) {
  6548. j = duplicates.push( i );
  6549. }
  6550. }
  6551. while ( j-- ) {
  6552. results.splice( duplicates[ j ], 1 );
  6553. }
  6554. }
  6555. // Clear input after sorting to release objects
  6556. // See https://github.com/jquery/sizzle/pull/225
  6557. sortInput = null;
  6558. return results;
  6559. };
  6560. /**
  6561. * Utility function for retrieving the text value of an array of DOM nodes
  6562. * @param {Array|Element} elem
  6563. */
  6564. getText = Sizzle.getText = function( elem ) {
  6565. var node,
  6566. ret = "",
  6567. i = 0,
  6568. nodeType = elem.nodeType;
  6569. if ( !nodeType ) {
  6570. // If no nodeType, this is expected to be an array
  6571. while ( (node = elem[i++]) ) {
  6572. // Do not traverse comment nodes
  6573. ret += getText( node );
  6574. }
  6575. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6576. // Use textContent for elements
  6577. // innerText usage removed for consistency of new lines (jQuery #11153)
  6578. if ( typeof elem.textContent === "string" ) {
  6579. return elem.textContent;
  6580. } else {
  6581. // Traverse its children
  6582. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6583. ret += getText( elem );
  6584. }
  6585. }
  6586. } else if ( nodeType === 3 || nodeType === 4 ) {
  6587. return elem.nodeValue;
  6588. }
  6589. // Do not include comment or processing instruction nodes
  6590. return ret;
  6591. };
  6592. Expr = Sizzle.selectors = {
  6593. // Can be adjusted by the user
  6594. cacheLength: 50,
  6595. createPseudo: markFunction,
  6596. match: matchExpr,
  6597. attrHandle: {},
  6598. find: {},
  6599. relative: {
  6600. ">": { dir: "parentNode", first: true },
  6601. " ": { dir: "parentNode" },
  6602. "+": { dir: "previousSibling", first: true },
  6603. "~": { dir: "previousSibling" }
  6604. },
  6605. preFilter: {
  6606. "ATTR": function( match ) {
  6607. match[1] = match[1].replace( runescape, funescape );
  6608. // Move the given value to match[3] whether quoted or unquoted
  6609. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  6610. if ( match[2] === "~=" ) {
  6611. match[3] = " " + match[3] + " ";
  6612. }
  6613. return match.slice( 0, 4 );
  6614. },
  6615. "CHILD": function( match ) {
  6616. /* matches from matchExpr["CHILD"]
  6617. 1 type (only|nth|...)
  6618. 2 what (child|of-type)
  6619. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6620. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6621. 5 sign of xn-component
  6622. 6 x of xn-component
  6623. 7 sign of y-component
  6624. 8 y of y-component
  6625. */
  6626. match[1] = match[1].toLowerCase();
  6627. if ( match[1].slice( 0, 3 ) === "nth" ) {
  6628. // nth-* requires argument
  6629. if ( !match[3] ) {
  6630. Sizzle.error( match[0] );
  6631. }
  6632. // numeric x and y parameters for Expr.filter.CHILD
  6633. // remember that false/true cast respectively to 0/1
  6634. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  6635. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  6636. // other types prohibit arguments
  6637. } else if ( match[3] ) {
  6638. Sizzle.error( match[0] );
  6639. }
  6640. return match;
  6641. },
  6642. "PSEUDO": function( match ) {
  6643. var excess,
  6644. unquoted = !match[6] && match[2];
  6645. if ( matchExpr["CHILD"].test( match[0] ) ) {
  6646. return null;
  6647. }
  6648. // Accept quoted arguments as-is
  6649. if ( match[3] ) {
  6650. match[2] = match[4] || match[5] || "";
  6651. // Strip excess characters from unquoted arguments
  6652. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6653. // Get excess from tokenize (recursively)
  6654. (excess = tokenize( unquoted, true )) &&
  6655. // advance to the next closing parenthesis
  6656. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  6657. // excess is a negative index
  6658. match[0] = match[0].slice( 0, excess );
  6659. match[2] = unquoted.slice( 0, excess );
  6660. }
  6661. // Return only captures needed by the pseudo filter method (type and argument)
  6662. return match.slice( 0, 3 );
  6663. }
  6664. },
  6665. filter: {
  6666. "TAG": function( nodeNameSelector ) {
  6667. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6668. return nodeNameSelector === "*" ?
  6669. function() { return true; } :
  6670. function( elem ) {
  6671. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6672. };
  6673. },
  6674. "CLASS": function( className ) {
  6675. var pattern = classCache[ className + " " ];
  6676. return pattern ||
  6677. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  6678. classCache( className, function( elem ) {
  6679. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  6680. });
  6681. },
  6682. "ATTR": function( name, operator, check ) {
  6683. return function( elem ) {
  6684. var result = Sizzle.attr( elem, name );
  6685. if ( result == null ) {
  6686. return operator === "!=";
  6687. }
  6688. if ( !operator ) {
  6689. return true;
  6690. }
  6691. result += "";
  6692. return operator === "=" ? result === check :
  6693. operator === "!=" ? result !== check :
  6694. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6695. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6696. operator === "$=" ? check && result.slice( -check.length ) === check :
  6697. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6698. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6699. false;
  6700. };
  6701. },
  6702. "CHILD": function( type, what, argument, first, last ) {
  6703. var simple = type.slice( 0, 3 ) !== "nth",
  6704. forward = type.slice( -4 ) !== "last",
  6705. ofType = what === "of-type";
  6706. return first === 1 && last === 0 ?
  6707. // Shortcut for :nth-*(n)
  6708. function( elem ) {
  6709. return !!elem.parentNode;
  6710. } :
  6711. function( elem, context, xml ) {
  6712. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6713. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6714. parent = elem.parentNode,
  6715. name = ofType && elem.nodeName.toLowerCase(),
  6716. useCache = !xml && !ofType,
  6717. diff = false;
  6718. if ( parent ) {
  6719. // :(first|last|only)-(child|of-type)
  6720. if ( simple ) {
  6721. while ( dir ) {
  6722. node = elem;
  6723. while ( (node = node[ dir ]) ) {
  6724. if ( ofType ?
  6725. node.nodeName.toLowerCase() === name :
  6726. node.nodeType === 1 ) {
  6727. return false;
  6728. }
  6729. }
  6730. // Reverse direction for :only-* (if we haven't yet done so)
  6731. start = dir = type === "only" && !start && "nextSibling";
  6732. }
  6733. return true;
  6734. }
  6735. start = [ forward ? parent.firstChild : parent.lastChild ];
  6736. // non-xml :nth-child(...) stores cache data on `parent`
  6737. if ( forward && useCache ) {
  6738. // Seek `elem` from a previously-cached index
  6739. // ...in a gzip-friendly way
  6740. node = parent;
  6741. outerCache = node[ expando ] || (node[ expando ] = {});
  6742. // Support: IE <9 only
  6743. // Defend against cloned attroperties (jQuery gh-1709)
  6744. uniqueCache = outerCache[ node.uniqueID ] ||
  6745. (outerCache[ node.uniqueID ] = {});
  6746. cache = uniqueCache[ type ] || [];
  6747. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6748. diff = nodeIndex && cache[ 2 ];
  6749. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6750. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6751. // Fallback to seeking `elem` from the start
  6752. (diff = nodeIndex = 0) || start.pop()) ) {
  6753. // When found, cache indexes on `parent` and break
  6754. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6755. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6756. break;
  6757. }
  6758. }
  6759. } else {
  6760. // Use previously-cached element index if available
  6761. if ( useCache ) {
  6762. // ...in a gzip-friendly way
  6763. node = elem;
  6764. outerCache = node[ expando ] || (node[ expando ] = {});
  6765. // Support: IE <9 only
  6766. // Defend against cloned attroperties (jQuery gh-1709)
  6767. uniqueCache = outerCache[ node.uniqueID ] ||
  6768. (outerCache[ node.uniqueID ] = {});
  6769. cache = uniqueCache[ type ] || [];
  6770. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6771. diff = nodeIndex;
  6772. }
  6773. // xml :nth-child(...)
  6774. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6775. if ( diff === false ) {
  6776. // Use the same loop as above to seek `elem` from the start
  6777. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6778. (diff = nodeIndex = 0) || start.pop()) ) {
  6779. if ( ( ofType ?
  6780. node.nodeName.toLowerCase() === name :
  6781. node.nodeType === 1 ) &&
  6782. ++diff ) {
  6783. // Cache the index of each encountered element
  6784. if ( useCache ) {
  6785. outerCache = node[ expando ] || (node[ expando ] = {});
  6786. // Support: IE <9 only
  6787. // Defend against cloned attroperties (jQuery gh-1709)
  6788. uniqueCache = outerCache[ node.uniqueID ] ||
  6789. (outerCache[ node.uniqueID ] = {});
  6790. uniqueCache[ type ] = [ dirruns, diff ];
  6791. }
  6792. if ( node === elem ) {
  6793. break;
  6794. }
  6795. }
  6796. }
  6797. }
  6798. }
  6799. // Incorporate the offset, then check against cycle size
  6800. diff -= last;
  6801. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6802. }
  6803. };
  6804. },
  6805. "PSEUDO": function( pseudo, argument ) {
  6806. // pseudo-class names are case-insensitive
  6807. // http://www.w3.org/TR/selectors/#pseudo-classes
  6808. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6809. // Remember that setFilters inherits from pseudos
  6810. var args,
  6811. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6812. Sizzle.error( "unsupported pseudo: " + pseudo );
  6813. // The user may use createPseudo to indicate that
  6814. // arguments are needed to create the filter function
  6815. // just as Sizzle does
  6816. if ( fn[ expando ] ) {
  6817. return fn( argument );
  6818. }
  6819. // But maintain support for old signatures
  6820. if ( fn.length > 1 ) {
  6821. args = [ pseudo, pseudo, "", argument ];
  6822. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6823. markFunction(function( seed, matches ) {
  6824. var idx,
  6825. matched = fn( seed, argument ),
  6826. i = matched.length;
  6827. while ( i-- ) {
  6828. idx = indexOf( seed, matched[i] );
  6829. seed[ idx ] = !( matches[ idx ] = matched[i] );
  6830. }
  6831. }) :
  6832. function( elem ) {
  6833. return fn( elem, 0, args );
  6834. };
  6835. }
  6836. return fn;
  6837. }
  6838. },
  6839. pseudos: {
  6840. // Potentially complex pseudos
  6841. "not": markFunction(function( selector ) {
  6842. // Trim the selector passed to compile
  6843. // to avoid treating leading and trailing
  6844. // spaces as combinators
  6845. var input = [],
  6846. results = [],
  6847. matcher = compile( selector.replace( rtrim, "$1" ) );
  6848. return matcher[ expando ] ?
  6849. markFunction(function( seed, matches, context, xml ) {
  6850. var elem,
  6851. unmatched = matcher( seed, null, xml, [] ),
  6852. i = seed.length;
  6853. // Match elements unmatched by `matcher`
  6854. while ( i-- ) {
  6855. if ( (elem = unmatched[i]) ) {
  6856. seed[i] = !(matches[i] = elem);
  6857. }
  6858. }
  6859. }) :
  6860. function( elem, context, xml ) {
  6861. input[0] = elem;
  6862. matcher( input, null, xml, results );
  6863. // Don't keep the element (issue #299)
  6864. input[0] = null;
  6865. return !results.pop();
  6866. };
  6867. }),
  6868. "has": markFunction(function( selector ) {
  6869. return function( elem ) {
  6870. return Sizzle( selector, elem ).length > 0;
  6871. };
  6872. }),
  6873. "contains": markFunction(function( text ) {
  6874. text = text.replace( runescape, funescape );
  6875. return function( elem ) {
  6876. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  6877. };
  6878. }),
  6879. // "Whether an element is represented by a :lang() selector
  6880. // is based solely on the element's language value
  6881. // being equal to the identifier C,
  6882. // or beginning with the identifier C immediately followed by "-".
  6883. // The matching of C against the element's language value is performed case-insensitively.
  6884. // The identifier C does not have to be a valid language name."
  6885. // http://www.w3.org/TR/selectors/#lang-pseudo
  6886. "lang": markFunction( function( lang ) {
  6887. // lang value must be a valid identifier
  6888. if ( !ridentifier.test(lang || "") ) {
  6889. Sizzle.error( "unsupported lang: " + lang );
  6890. }
  6891. lang = lang.replace( runescape, funescape ).toLowerCase();
  6892. return function( elem ) {
  6893. var elemLang;
  6894. do {
  6895. if ( (elemLang = documentIsHTML ?
  6896. elem.lang :
  6897. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  6898. elemLang = elemLang.toLowerCase();
  6899. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6900. }
  6901. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  6902. return false;
  6903. };
  6904. }),
  6905. // Miscellaneous
  6906. "target": function( elem ) {
  6907. var hash = window.location && window.location.hash;
  6908. return hash && hash.slice( 1 ) === elem.id;
  6909. },
  6910. "root": function( elem ) {
  6911. return elem === docElem;
  6912. },
  6913. "focus": function( elem ) {
  6914. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  6915. },
  6916. // Boolean properties
  6917. "enabled": createDisabledPseudo( false ),
  6918. "disabled": createDisabledPseudo( true ),
  6919. "checked": function( elem ) {
  6920. // In CSS3, :checked should return both checked and selected elements
  6921. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6922. var nodeName = elem.nodeName.toLowerCase();
  6923. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  6924. },
  6925. "selected": function( elem ) {
  6926. // Accessing this property makes selected-by-default
  6927. // options in Safari work properly
  6928. if ( elem.parentNode ) {
  6929. elem.parentNode.selectedIndex;
  6930. }
  6931. return elem.selected === true;
  6932. },
  6933. // Contents
  6934. "empty": function( elem ) {
  6935. // http://www.w3.org/TR/selectors/#empty-pseudo
  6936. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6937. // but not by others (comment: 8; processing instruction: 7; etc.)
  6938. // nodeType < 6 works because attributes (2) do not appear as children
  6939. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6940. if ( elem.nodeType < 6 ) {
  6941. return false;
  6942. }
  6943. }
  6944. return true;
  6945. },
  6946. "parent": function( elem ) {
  6947. return !Expr.pseudos["empty"]( elem );
  6948. },
  6949. // Element/input types
  6950. "header": function( elem ) {
  6951. return rheader.test( elem.nodeName );
  6952. },
  6953. "input": function( elem ) {
  6954. return rinputs.test( elem.nodeName );
  6955. },
  6956. "button": function( elem ) {
  6957. var name = elem.nodeName.toLowerCase();
  6958. return name === "input" && elem.type === "button" || name === "button";
  6959. },
  6960. "text": function( elem ) {
  6961. var attr;
  6962. return elem.nodeName.toLowerCase() === "input" &&
  6963. elem.type === "text" &&
  6964. // Support: IE<8
  6965. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  6966. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  6967. },
  6968. // Position-in-collection
  6969. "first": createPositionalPseudo(function() {
  6970. return [ 0 ];
  6971. }),
  6972. "last": createPositionalPseudo(function( matchIndexes, length ) {
  6973. return [ length - 1 ];
  6974. }),
  6975. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  6976. return [ argument < 0 ? argument + length : argument ];
  6977. }),
  6978. "even": createPositionalPseudo(function( matchIndexes, length ) {
  6979. var i = 0;
  6980. for ( ; i < length; i += 2 ) {
  6981. matchIndexes.push( i );
  6982. }
  6983. return matchIndexes;
  6984. }),
  6985. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  6986. var i = 1;
  6987. for ( ; i < length; i += 2 ) {
  6988. matchIndexes.push( i );
  6989. }
  6990. return matchIndexes;
  6991. }),
  6992. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  6993. var i = argument < 0 ?
  6994. argument + length :
  6995. argument > length ?
  6996. length :
  6997. argument;
  6998. for ( ; --i >= 0; ) {
  6999. matchIndexes.push( i );
  7000. }
  7001. return matchIndexes;
  7002. }),
  7003. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  7004. var i = argument < 0 ? argument + length : argument;
  7005. for ( ; ++i < length; ) {
  7006. matchIndexes.push( i );
  7007. }
  7008. return matchIndexes;
  7009. })
  7010. }
  7011. };
  7012. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  7013. // Add button/input type pseudos
  7014. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  7015. Expr.pseudos[ i ] = createInputPseudo( i );
  7016. }
  7017. for ( i in { submit: true, reset: true } ) {
  7018. Expr.pseudos[ i ] = createButtonPseudo( i );
  7019. }
  7020. // Easy API for creating new setFilters
  7021. function setFilters() {}
  7022. setFilters.prototype = Expr.filters = Expr.pseudos;
  7023. Expr.setFilters = new setFilters();
  7024. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  7025. var matched, match, tokens, type,
  7026. soFar, groups, preFilters,
  7027. cached = tokenCache[ selector + " " ];
  7028. if ( cached ) {
  7029. return parseOnly ? 0 : cached.slice( 0 );
  7030. }
  7031. soFar = selector;
  7032. groups = [];
  7033. preFilters = Expr.preFilter;
  7034. while ( soFar ) {
  7035. // Comma and first run
  7036. if ( !matched || (match = rcomma.exec( soFar )) ) {
  7037. if ( match ) {
  7038. // Don't consume trailing commas as valid
  7039. soFar = soFar.slice( match[0].length ) || soFar;
  7040. }
  7041. groups.push( (tokens = []) );
  7042. }
  7043. matched = false;
  7044. // Combinators
  7045. if ( (match = rcombinators.exec( soFar )) ) {
  7046. matched = match.shift();
  7047. tokens.push({
  7048. value: matched,
  7049. // Cast descendant combinators to space
  7050. type: match[0].replace( rtrim, " " )
  7051. });
  7052. soFar = soFar.slice( matched.length );
  7053. }
  7054. // Filters
  7055. for ( type in Expr.filter ) {
  7056. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  7057. (match = preFilters[ type ]( match ))) ) {
  7058. matched = match.shift();
  7059. tokens.push({
  7060. value: matched,
  7061. type: type,
  7062. matches: match
  7063. });
  7064. soFar = soFar.slice( matched.length );
  7065. }
  7066. }
  7067. if ( !matched ) {
  7068. break;
  7069. }
  7070. }
  7071. // Return the length of the invalid excess
  7072. // if we're just parsing
  7073. // Otherwise, throw an error or return tokens
  7074. return parseOnly ?
  7075. soFar.length :
  7076. soFar ?
  7077. Sizzle.error( selector ) :
  7078. // Cache the tokens
  7079. tokenCache( selector, groups ).slice( 0 );
  7080. };
  7081. function toSelector( tokens ) {
  7082. var i = 0,
  7083. len = tokens.length,
  7084. selector = "";
  7085. for ( ; i < len; i++ ) {
  7086. selector += tokens[i].value;
  7087. }
  7088. return selector;
  7089. }
  7090. function addCombinator( matcher, combinator, base ) {
  7091. var dir = combinator.dir,
  7092. skip = combinator.next,
  7093. key = skip || dir,
  7094. checkNonElements = base && key === "parentNode",
  7095. doneName = done++;
  7096. return combinator.first ?
  7097. // Check against closest ancestor/preceding element
  7098. function( elem, context, xml ) {
  7099. while ( (elem = elem[ dir ]) ) {
  7100. if ( elem.nodeType === 1 || checkNonElements ) {
  7101. return matcher( elem, context, xml );
  7102. }
  7103. }
  7104. return false;
  7105. } :
  7106. // Check against all ancestor/preceding elements
  7107. function( elem, context, xml ) {
  7108. var oldCache, uniqueCache, outerCache,
  7109. newCache = [ dirruns, doneName ];
  7110. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  7111. if ( xml ) {
  7112. while ( (elem = elem[ dir ]) ) {
  7113. if ( elem.nodeType === 1 || checkNonElements ) {
  7114. if ( matcher( elem, context, xml ) ) {
  7115. return true;
  7116. }
  7117. }
  7118. }
  7119. } else {
  7120. while ( (elem = elem[ dir ]) ) {
  7121. if ( elem.nodeType === 1 || checkNonElements ) {
  7122. outerCache = elem[ expando ] || (elem[ expando ] = {});
  7123. // Support: IE <9 only
  7124. // Defend against cloned attroperties (jQuery gh-1709)
  7125. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  7126. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  7127. elem = elem[ dir ] || elem;
  7128. } else if ( (oldCache = uniqueCache[ key ]) &&
  7129. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  7130. // Assign to newCache so results back-propagate to previous elements
  7131. return (newCache[ 2 ] = oldCache[ 2 ]);
  7132. } else {
  7133. // Reuse newcache so results back-propagate to previous elements
  7134. uniqueCache[ key ] = newCache;
  7135. // A match means we're done; a fail means we have to keep checking
  7136. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  7137. return true;
  7138. }
  7139. }
  7140. }
  7141. }
  7142. }
  7143. return false;
  7144. };
  7145. }
  7146. function elementMatcher( matchers ) {
  7147. return matchers.length > 1 ?
  7148. function( elem, context, xml ) {
  7149. var i = matchers.length;
  7150. while ( i-- ) {
  7151. if ( !matchers[i]( elem, context, xml ) ) {
  7152. return false;
  7153. }
  7154. }
  7155. return true;
  7156. } :
  7157. matchers[0];
  7158. }
  7159. function multipleContexts( selector, contexts, results ) {
  7160. var i = 0,
  7161. len = contexts.length;
  7162. for ( ; i < len; i++ ) {
  7163. Sizzle( selector, contexts[i], results );
  7164. }
  7165. return results;
  7166. }
  7167. function condense( unmatched, map, filter, context, xml ) {
  7168. var elem,
  7169. newUnmatched = [],
  7170. i = 0,
  7171. len = unmatched.length,
  7172. mapped = map != null;
  7173. for ( ; i < len; i++ ) {
  7174. if ( (elem = unmatched[i]) ) {
  7175. if ( !filter || filter( elem, context, xml ) ) {
  7176. newUnmatched.push( elem );
  7177. if ( mapped ) {
  7178. map.push( i );
  7179. }
  7180. }
  7181. }
  7182. }
  7183. return newUnmatched;
  7184. }
  7185. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  7186. if ( postFilter && !postFilter[ expando ] ) {
  7187. postFilter = setMatcher( postFilter );
  7188. }
  7189. if ( postFinder && !postFinder[ expando ] ) {
  7190. postFinder = setMatcher( postFinder, postSelector );
  7191. }
  7192. return markFunction(function( seed, results, context, xml ) {
  7193. var temp, i, elem,
  7194. preMap = [],
  7195. postMap = [],
  7196. preexisting = results.length,
  7197. // Get initial elements from seed or context
  7198. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  7199. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  7200. matcherIn = preFilter && ( seed || !selector ) ?
  7201. condense( elems, preMap, preFilter, context, xml ) :
  7202. elems,
  7203. matcherOut = matcher ?
  7204. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  7205. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  7206. // ...intermediate processing is necessary
  7207. [] :
  7208. // ...otherwise use results directly
  7209. results :
  7210. matcherIn;
  7211. // Find primary matches
  7212. if ( matcher ) {
  7213. matcher( matcherIn, matcherOut, context, xml );
  7214. }
  7215. // Apply postFilter
  7216. if ( postFilter ) {
  7217. temp = condense( matcherOut, postMap );
  7218. postFilter( temp, [], context, xml );
  7219. // Un-match failing elements by moving them back to matcherIn
  7220. i = temp.length;
  7221. while ( i-- ) {
  7222. if ( (elem = temp[i]) ) {
  7223. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  7224. }
  7225. }
  7226. }
  7227. if ( seed ) {
  7228. if ( postFinder || preFilter ) {
  7229. if ( postFinder ) {
  7230. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  7231. temp = [];
  7232. i = matcherOut.length;
  7233. while ( i-- ) {
  7234. if ( (elem = matcherOut[i]) ) {
  7235. // Restore matcherIn since elem is not yet a final match
  7236. temp.push( (matcherIn[i] = elem) );
  7237. }
  7238. }
  7239. postFinder( null, (matcherOut = []), temp, xml );
  7240. }
  7241. // Move matched elements from seed to results to keep them synchronized
  7242. i = matcherOut.length;
  7243. while ( i-- ) {
  7244. if ( (elem = matcherOut[i]) &&
  7245. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  7246. seed[temp] = !(results[temp] = elem);
  7247. }
  7248. }
  7249. }
  7250. // Add elements to results, through postFinder if defined
  7251. } else {
  7252. matcherOut = condense(
  7253. matcherOut === results ?
  7254. matcherOut.splice( preexisting, matcherOut.length ) :
  7255. matcherOut
  7256. );
  7257. if ( postFinder ) {
  7258. postFinder( null, results, matcherOut, xml );
  7259. } else {
  7260. push.apply( results, matcherOut );
  7261. }
  7262. }
  7263. });
  7264. }
  7265. function matcherFromTokens( tokens ) {
  7266. var checkContext, matcher, j,
  7267. len = tokens.length,
  7268. leadingRelative = Expr.relative[ tokens[0].type ],
  7269. implicitRelative = leadingRelative || Expr.relative[" "],
  7270. i = leadingRelative ? 1 : 0,
  7271. // The foundational matcher ensures that elements are reachable from top-level context(s)
  7272. matchContext = addCombinator( function( elem ) {
  7273. return elem === checkContext;
  7274. }, implicitRelative, true ),
  7275. matchAnyContext = addCombinator( function( elem ) {
  7276. return indexOf( checkContext, elem ) > -1;
  7277. }, implicitRelative, true ),
  7278. matchers = [ function( elem, context, xml ) {
  7279. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  7280. (checkContext = context).nodeType ?
  7281. matchContext( elem, context, xml ) :
  7282. matchAnyContext( elem, context, xml ) );
  7283. // Avoid hanging onto element (issue #299)
  7284. checkContext = null;
  7285. return ret;
  7286. } ];
  7287. for ( ; i < len; i++ ) {
  7288. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  7289. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  7290. } else {
  7291. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  7292. // Return special upon seeing a positional matcher
  7293. if ( matcher[ expando ] ) {
  7294. // Find the next relative operator (if any) for proper handling
  7295. j = ++i;
  7296. for ( ; j < len; j++ ) {
  7297. if ( Expr.relative[ tokens[j].type ] ) {
  7298. break;
  7299. }
  7300. }
  7301. return setMatcher(
  7302. i > 1 && elementMatcher( matchers ),
  7303. i > 1 && toSelector(
  7304. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7305. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  7306. ).replace( rtrim, "$1" ),
  7307. matcher,
  7308. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7309. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  7310. j < len && toSelector( tokens )
  7311. );
  7312. }
  7313. matchers.push( matcher );
  7314. }
  7315. }
  7316. return elementMatcher( matchers );
  7317. }
  7318. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7319. var bySet = setMatchers.length > 0,
  7320. byElement = elementMatchers.length > 0,
  7321. superMatcher = function( seed, context, xml, results, outermost ) {
  7322. var elem, j, matcher,
  7323. matchedCount = 0,
  7324. i = "0",
  7325. unmatched = seed && [],
  7326. setMatched = [],
  7327. contextBackup = outermostContext,
  7328. // We must always have either seed elements or outermost context
  7329. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  7330. // Use integer dirruns iff this is the outermost matcher
  7331. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  7332. len = elems.length;
  7333. if ( outermost ) {
  7334. outermostContext = context === document || context || outermost;
  7335. }
  7336. // Add elements passing elementMatchers directly to results
  7337. // Support: IE<9, Safari
  7338. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7339. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  7340. if ( byElement && elem ) {
  7341. j = 0;
  7342. if ( !context && elem.ownerDocument !== document ) {
  7343. setDocument( elem );
  7344. xml = !documentIsHTML;
  7345. }
  7346. while ( (matcher = elementMatchers[j++]) ) {
  7347. if ( matcher( elem, context || document, xml) ) {
  7348. results.push( elem );
  7349. break;
  7350. }
  7351. }
  7352. if ( outermost ) {
  7353. dirruns = dirrunsUnique;
  7354. }
  7355. }
  7356. // Track unmatched elements for set filters
  7357. if ( bySet ) {
  7358. // They will have gone through all possible matchers
  7359. if ( (elem = !matcher && elem) ) {
  7360. matchedCount--;
  7361. }
  7362. // Lengthen the array for every element, matched or not
  7363. if ( seed ) {
  7364. unmatched.push( elem );
  7365. }
  7366. }
  7367. }
  7368. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7369. // makes the latter nonnegative.
  7370. matchedCount += i;
  7371. // Apply set filters to unmatched elements
  7372. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7373. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7374. // no element matchers and no seed.
  7375. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7376. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7377. // numerically zero.
  7378. if ( bySet && i !== matchedCount ) {
  7379. j = 0;
  7380. while ( (matcher = setMatchers[j++]) ) {
  7381. matcher( unmatched, setMatched, context, xml );
  7382. }
  7383. if ( seed ) {
  7384. // Reintegrate element matches to eliminate the need for sorting
  7385. if ( matchedCount > 0 ) {
  7386. while ( i-- ) {
  7387. if ( !(unmatched[i] || setMatched[i]) ) {
  7388. setMatched[i] = pop.call( results );
  7389. }
  7390. }
  7391. }
  7392. // Discard index placeholder values to get only actual matches
  7393. setMatched = condense( setMatched );
  7394. }
  7395. // Add matches to results
  7396. push.apply( results, setMatched );
  7397. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7398. if ( outermost && !seed && setMatched.length > 0 &&
  7399. ( matchedCount + setMatchers.length ) > 1 ) {
  7400. Sizzle.uniqueSort( results );
  7401. }
  7402. }
  7403. // Override manipulation of globals by nested matchers
  7404. if ( outermost ) {
  7405. dirruns = dirrunsUnique;
  7406. outermostContext = contextBackup;
  7407. }
  7408. return unmatched;
  7409. };
  7410. return bySet ?
  7411. markFunction( superMatcher ) :
  7412. superMatcher;
  7413. }
  7414. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7415. var i,
  7416. setMatchers = [],
  7417. elementMatchers = [],
  7418. cached = compilerCache[ selector + " " ];
  7419. if ( !cached ) {
  7420. // Generate a function of recursive functions that can be used to check each element
  7421. if ( !match ) {
  7422. match = tokenize( selector );
  7423. }
  7424. i = match.length;
  7425. while ( i-- ) {
  7426. cached = matcherFromTokens( match[i] );
  7427. if ( cached[ expando ] ) {
  7428. setMatchers.push( cached );
  7429. } else {
  7430. elementMatchers.push( cached );
  7431. }
  7432. }
  7433. // Cache the compiled function
  7434. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  7435. // Save selector and tokenization
  7436. cached.selector = selector;
  7437. }
  7438. return cached;
  7439. };
  7440. /**
  7441. * A low-level selection function that works with Sizzle's compiled
  7442. * selector functions
  7443. * @param {String|Function} selector A selector or a pre-compiled
  7444. * selector function built with Sizzle.compile
  7445. * @param {Element} context
  7446. * @param {Array} [results]
  7447. * @param {Array} [seed] A set of elements to match against
  7448. */
  7449. select = Sizzle.select = function( selector, context, results, seed ) {
  7450. var i, tokens, token, type, find,
  7451. compiled = typeof selector === "function" && selector,
  7452. match = !seed && tokenize( (selector = compiled.selector || selector) );
  7453. results = results || [];
  7454. // Try to minimize operations if there is only one selector in the list and no seed
  7455. // (the latter of which guarantees us context)
  7456. if ( match.length === 1 ) {
  7457. // Reduce context if the leading compound selector is an ID
  7458. tokens = match[0] = match[0].slice( 0 );
  7459. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  7460. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  7461. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  7462. if ( !context ) {
  7463. return results;
  7464. // Precompiled matchers will still verify ancestry, so step up a level
  7465. } else if ( compiled ) {
  7466. context = context.parentNode;
  7467. }
  7468. selector = selector.slice( tokens.shift().value.length );
  7469. }
  7470. // Fetch a seed set for right-to-left matching
  7471. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  7472. while ( i-- ) {
  7473. token = tokens[i];
  7474. // Abort if we hit a combinator
  7475. if ( Expr.relative[ (type = token.type) ] ) {
  7476. break;
  7477. }
  7478. if ( (find = Expr.find[ type ]) ) {
  7479. // Search, expanding context for leading sibling combinators
  7480. if ( (seed = find(
  7481. token.matches[0].replace( runescape, funescape ),
  7482. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  7483. )) ) {
  7484. // If seed is empty or no tokens remain, we can return early
  7485. tokens.splice( i, 1 );
  7486. selector = seed.length && toSelector( tokens );
  7487. if ( !selector ) {
  7488. push.apply( results, seed );
  7489. return results;
  7490. }
  7491. break;
  7492. }
  7493. }
  7494. }
  7495. }
  7496. // Compile and execute a filtering function if one is not provided
  7497. // Provide `match` to avoid retokenization if we modified the selector above
  7498. ( compiled || compile( selector, match ) )(
  7499. seed,
  7500. context,
  7501. !documentIsHTML,
  7502. results,
  7503. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7504. );
  7505. return results;
  7506. };
  7507. // One-time assignments
  7508. // Sort stability
  7509. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  7510. // Support: Chrome 14-35+
  7511. // Always assume duplicates if they aren't passed to the comparison function
  7512. support.detectDuplicates = !!hasDuplicate;
  7513. // Initialize against the default document
  7514. setDocument();
  7515. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7516. // Detached nodes confoundingly follow *each other*
  7517. support.sortDetached = assert(function( el ) {
  7518. // Should return 1, but returns 4 (following)
  7519. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  7520. });
  7521. // Support: IE<8
  7522. // Prevent attribute/property "interpolation"
  7523. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7524. if ( !assert(function( el ) {
  7525. el.innerHTML = "<a href='#'></a>";
  7526. return el.firstChild.getAttribute("href") === "#" ;
  7527. }) ) {
  7528. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7529. if ( !isXML ) {
  7530. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7531. }
  7532. });
  7533. }
  7534. // Support: IE<9
  7535. // Use defaultValue in place of getAttribute("value")
  7536. if ( !support.attributes || !assert(function( el ) {
  7537. el.innerHTML = "<input/>";
  7538. el.firstChild.setAttribute( "value", "" );
  7539. return el.firstChild.getAttribute( "value" ) === "";
  7540. }) ) {
  7541. addHandle( "value", function( elem, name, isXML ) {
  7542. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7543. return elem.defaultValue;
  7544. }
  7545. });
  7546. }
  7547. // Support: IE<9
  7548. // Use getAttributeNode to fetch booleans when getAttribute lies
  7549. if ( !assert(function( el ) {
  7550. return el.getAttribute("disabled") == null;
  7551. }) ) {
  7552. addHandle( booleans, function( elem, name, isXML ) {
  7553. var val;
  7554. if ( !isXML ) {
  7555. return elem[ name ] === true ? name.toLowerCase() :
  7556. (val = elem.getAttributeNode( name )) && val.specified ?
  7557. val.value :
  7558. null;
  7559. }
  7560. });
  7561. }
  7562. return Sizzle;
  7563. })( window );
  7564. jQuery.find = Sizzle;
  7565. jQuery.expr = Sizzle.selectors;
  7566. // Deprecated
  7567. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7568. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7569. jQuery.text = Sizzle.getText;
  7570. jQuery.isXMLDoc = Sizzle.isXML;
  7571. jQuery.contains = Sizzle.contains;
  7572. jQuery.escapeSelector = Sizzle.escape;
  7573. var dir = function( elem, dir, until ) {
  7574. var matched = [],
  7575. truncate = until !== undefined;
  7576. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7577. if ( elem.nodeType === 1 ) {
  7578. if ( truncate && jQuery( elem ).is( until ) ) {
  7579. break;
  7580. }
  7581. matched.push( elem );
  7582. }
  7583. }
  7584. return matched;
  7585. };
  7586. var siblings = function( n, elem ) {
  7587. var matched = [];
  7588. for ( ; n; n = n.nextSibling ) {
  7589. if ( n.nodeType === 1 && n !== elem ) {
  7590. matched.push( n );
  7591. }
  7592. }
  7593. return matched;
  7594. };
  7595. var rneedsContext = jQuery.expr.match.needsContext;
  7596. function nodeName( elem, name ) {
  7597. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7598. };
  7599. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7600. // Implement the identical functionality for filter and not
  7601. function winnow( elements, qualifier, not ) {
  7602. if ( isFunction( qualifier ) ) {
  7603. return jQuery.grep( elements, function( elem, i ) {
  7604. return !!qualifier.call( elem, i, elem ) !== not;
  7605. } );
  7606. }
  7607. // Single element
  7608. if ( qualifier.nodeType ) {
  7609. return jQuery.grep( elements, function( elem ) {
  7610. return ( elem === qualifier ) !== not;
  7611. } );
  7612. }
  7613. // Arraylike of elements (jQuery, arguments, Array)
  7614. if ( typeof qualifier !== "string" ) {
  7615. return jQuery.grep( elements, function( elem ) {
  7616. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7617. } );
  7618. }
  7619. // Filtered directly for both simple and complex selectors
  7620. return jQuery.filter( qualifier, elements, not );
  7621. }
  7622. jQuery.filter = function( expr, elems, not ) {
  7623. var elem = elems[ 0 ];
  7624. if ( not ) {
  7625. expr = ":not(" + expr + ")";
  7626. }
  7627. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7628. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7629. }
  7630. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7631. return elem.nodeType === 1;
  7632. } ) );
  7633. };
  7634. jQuery.fn.extend( {
  7635. find: function( selector ) {
  7636. var i, ret,
  7637. len = this.length,
  7638. self = this;
  7639. if ( typeof selector !== "string" ) {
  7640. return this.pushStack( jQuery( selector ).filter( function() {
  7641. for ( i = 0; i < len; i++ ) {
  7642. if ( jQuery.contains( self[ i ], this ) ) {
  7643. return true;
  7644. }
  7645. }
  7646. } ) );
  7647. }
  7648. ret = this.pushStack( [] );
  7649. for ( i = 0; i < len; i++ ) {
  7650. jQuery.find( selector, self[ i ], ret );
  7651. }
  7652. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7653. },
  7654. filter: function( selector ) {
  7655. return this.pushStack( winnow( this, selector || [], false ) );
  7656. },
  7657. not: function( selector ) {
  7658. return this.pushStack( winnow( this, selector || [], true ) );
  7659. },
  7660. is: function( selector ) {
  7661. return !!winnow(
  7662. this,
  7663. // If this is a positional/relative selector, check membership in the returned set
  7664. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7665. typeof selector === "string" && rneedsContext.test( selector ) ?
  7666. jQuery( selector ) :
  7667. selector || [],
  7668. false
  7669. ).length;
  7670. }
  7671. } );
  7672. // Initialize a jQuery object
  7673. // A central reference to the root jQuery(document)
  7674. var rootjQuery,
  7675. // A simple way to check for HTML strings
  7676. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7677. // Strict HTML recognition (#11290: must start with <)
  7678. // Shortcut simple #id case for speed
  7679. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7680. init = jQuery.fn.init = function( selector, context, root ) {
  7681. var match, elem;
  7682. // HANDLE: $(""), $(null), $(undefined), $(false)
  7683. if ( !selector ) {
  7684. return this;
  7685. }
  7686. // Method init() accepts an alternate rootjQuery
  7687. // so migrate can support jQuery.sub (gh-2101)
  7688. root = root || rootjQuery;
  7689. // Handle HTML strings
  7690. if ( typeof selector === "string" ) {
  7691. if ( selector[ 0 ] === "<" &&
  7692. selector[ selector.length - 1 ] === ">" &&
  7693. selector.length >= 3 ) {
  7694. // Assume that strings that start and end with <> are HTML and skip the regex check
  7695. match = [ null, selector, null ];
  7696. } else {
  7697. match = rquickExpr.exec( selector );
  7698. }
  7699. // Match html or make sure no context is specified for #id
  7700. if ( match && ( match[ 1 ] || !context ) ) {
  7701. // HANDLE: $(html) -> $(array)
  7702. if ( match[ 1 ] ) {
  7703. context = context instanceof jQuery ? context[ 0 ] : context;
  7704. // Option to run scripts is true for back-compat
  7705. // Intentionally let the error be thrown if parseHTML is not present
  7706. jQuery.merge( this, jQuery.parseHTML(
  7707. match[ 1 ],
  7708. context && context.nodeType ? context.ownerDocument || context : document,
  7709. true
  7710. ) );
  7711. // HANDLE: $(html, props)
  7712. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7713. for ( match in context ) {
  7714. // Properties of context are called as methods if possible
  7715. if ( isFunction( this[ match ] ) ) {
  7716. this[ match ]( context[ match ] );
  7717. // ...and otherwise set as attributes
  7718. } else {
  7719. this.attr( match, context[ match ] );
  7720. }
  7721. }
  7722. }
  7723. return this;
  7724. // HANDLE: $(#id)
  7725. } else {
  7726. elem = document.getElementById( match[ 2 ] );
  7727. if ( elem ) {
  7728. // Inject the element directly into the jQuery object
  7729. this[ 0 ] = elem;
  7730. this.length = 1;
  7731. }
  7732. return this;
  7733. }
  7734. // HANDLE: $(expr, $(...))
  7735. } else if ( !context || context.jquery ) {
  7736. return ( context || root ).find( selector );
  7737. // HANDLE: $(expr, context)
  7738. // (which is just equivalent to: $(context).find(expr)
  7739. } else {
  7740. return this.constructor( context ).find( selector );
  7741. }
  7742. // HANDLE: $(DOMElement)
  7743. } else if ( selector.nodeType ) {
  7744. this[ 0 ] = selector;
  7745. this.length = 1;
  7746. return this;
  7747. // HANDLE: $(function)
  7748. // Shortcut for document ready
  7749. } else if ( isFunction( selector ) ) {
  7750. return root.ready !== undefined ?
  7751. root.ready( selector ) :
  7752. // Execute immediately if ready is not present
  7753. selector( jQuery );
  7754. }
  7755. return jQuery.makeArray( selector, this );
  7756. };
  7757. // Give the init function the jQuery prototype for later instantiation
  7758. init.prototype = jQuery.fn;
  7759. // Initialize central reference
  7760. rootjQuery = jQuery( document );
  7761. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7762. // Methods guaranteed to produce a unique set when starting from a unique set
  7763. guaranteedUnique = {
  7764. children: true,
  7765. contents: true,
  7766. next: true,
  7767. prev: true
  7768. };
  7769. jQuery.fn.extend( {
  7770. has: function( target ) {
  7771. var targets = jQuery( target, this ),
  7772. l = targets.length;
  7773. return this.filter( function() {
  7774. var i = 0;
  7775. for ( ; i < l; i++ ) {
  7776. if ( jQuery.contains( this, targets[ i ] ) ) {
  7777. return true;
  7778. }
  7779. }
  7780. } );
  7781. },
  7782. closest: function( selectors, context ) {
  7783. var cur,
  7784. i = 0,
  7785. l = this.length,
  7786. matched = [],
  7787. targets = typeof selectors !== "string" && jQuery( selectors );
  7788. // Positional selectors never match, since there's no _selection_ context
  7789. if ( !rneedsContext.test( selectors ) ) {
  7790. for ( ; i < l; i++ ) {
  7791. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7792. // Always skip document fragments
  7793. if ( cur.nodeType < 11 && ( targets ?
  7794. targets.index( cur ) > -1 :
  7795. // Don't pass non-elements to Sizzle
  7796. cur.nodeType === 1 &&
  7797. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7798. matched.push( cur );
  7799. break;
  7800. }
  7801. }
  7802. }
  7803. }
  7804. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7805. },
  7806. // Determine the position of an element within the set
  7807. index: function( elem ) {
  7808. // No argument, return index in parent
  7809. if ( !elem ) {
  7810. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7811. }
  7812. // Index in selector
  7813. if ( typeof elem === "string" ) {
  7814. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7815. }
  7816. // Locate the position of the desired element
  7817. return indexOf.call( this,
  7818. // If it receives a jQuery object, the first element is used
  7819. elem.jquery ? elem[ 0 ] : elem
  7820. );
  7821. },
  7822. add: function( selector, context ) {
  7823. return this.pushStack(
  7824. jQuery.uniqueSort(
  7825. jQuery.merge( this.get(), jQuery( selector, context ) )
  7826. )
  7827. );
  7828. },
  7829. addBack: function( selector ) {
  7830. return this.add( selector == null ?
  7831. this.prevObject : this.prevObject.filter( selector )
  7832. );
  7833. }
  7834. } );
  7835. function sibling( cur, dir ) {
  7836. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7837. return cur;
  7838. }
  7839. jQuery.each( {
  7840. parent: function( elem ) {
  7841. var parent = elem.parentNode;
  7842. return parent && parent.nodeType !== 11 ? parent : null;
  7843. },
  7844. parents: function( elem ) {
  7845. return dir( elem, "parentNode" );
  7846. },
  7847. parentsUntil: function( elem, i, until ) {
  7848. return dir( elem, "parentNode", until );
  7849. },
  7850. next: function( elem ) {
  7851. return sibling( elem, "nextSibling" );
  7852. },
  7853. prev: function( elem ) {
  7854. return sibling( elem, "previousSibling" );
  7855. },
  7856. nextAll: function( elem ) {
  7857. return dir( elem, "nextSibling" );
  7858. },
  7859. prevAll: function( elem ) {
  7860. return dir( elem, "previousSibling" );
  7861. },
  7862. nextUntil: function( elem, i, until ) {
  7863. return dir( elem, "nextSibling", until );
  7864. },
  7865. prevUntil: function( elem, i, until ) {
  7866. return dir( elem, "previousSibling", until );
  7867. },
  7868. siblings: function( elem ) {
  7869. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7870. },
  7871. children: function( elem ) {
  7872. return siblings( elem.firstChild );
  7873. },
  7874. contents: function( elem ) {
  7875. if ( typeof elem.contentDocument !== "undefined" ) {
  7876. return elem.contentDocument;
  7877. }
  7878. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7879. // Treat the template element as a regular one in browsers that
  7880. // don't support it.
  7881. if ( nodeName( elem, "template" ) ) {
  7882. elem = elem.content || elem;
  7883. }
  7884. return jQuery.merge( [], elem.childNodes );
  7885. }
  7886. }, function( name, fn ) {
  7887. jQuery.fn[ name ] = function( until, selector ) {
  7888. var matched = jQuery.map( this, fn, until );
  7889. if ( name.slice( -5 ) !== "Until" ) {
  7890. selector = until;
  7891. }
  7892. if ( selector && typeof selector === "string" ) {
  7893. matched = jQuery.filter( selector, matched );
  7894. }
  7895. if ( this.length > 1 ) {
  7896. // Remove duplicates
  7897. if ( !guaranteedUnique[ name ] ) {
  7898. jQuery.uniqueSort( matched );
  7899. }
  7900. // Reverse order for parents* and prev-derivatives
  7901. if ( rparentsprev.test( name ) ) {
  7902. matched.reverse();
  7903. }
  7904. }
  7905. return this.pushStack( matched );
  7906. };
  7907. } );
  7908. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7909. // Convert String-formatted options into Object-formatted ones
  7910. function createOptions( options ) {
  7911. var object = {};
  7912. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7913. object[ flag ] = true;
  7914. } );
  7915. return object;
  7916. }
  7917. /*
  7918. * Create a callback list using the following parameters:
  7919. *
  7920. * options: an optional list of space-separated options that will change how
  7921. * the callback list behaves or a more traditional option object
  7922. *
  7923. * By default a callback list will act like an event callback list and can be
  7924. * "fired" multiple times.
  7925. *
  7926. * Possible options:
  7927. *
  7928. * once: will ensure the callback list can only be fired once (like a Deferred)
  7929. *
  7930. * memory: will keep track of previous values and will call any callback added
  7931. * after the list has been fired right away with the latest "memorized"
  7932. * values (like a Deferred)
  7933. *
  7934. * unique: will ensure a callback can only be added once (no duplicate in the list)
  7935. *
  7936. * stopOnFalse: interrupt callings when a callback returns false
  7937. *
  7938. */
  7939. jQuery.Callbacks = function( options ) {
  7940. // Convert options from String-formatted to Object-formatted if needed
  7941. // (we check in cache first)
  7942. options = typeof options === "string" ?
  7943. createOptions( options ) :
  7944. jQuery.extend( {}, options );
  7945. var // Flag to know if list is currently firing
  7946. firing,
  7947. // Last fire value for non-forgettable lists
  7948. memory,
  7949. // Flag to know if list was already fired
  7950. fired,
  7951. // Flag to prevent firing
  7952. locked,
  7953. // Actual callback list
  7954. list = [],
  7955. // Queue of execution data for repeatable lists
  7956. queue = [],
  7957. // Index of currently firing callback (modified by add/remove as needed)
  7958. firingIndex = -1,
  7959. // Fire callbacks
  7960. fire = function() {
  7961. // Enforce single-firing
  7962. locked = locked || options.once;
  7963. // Execute callbacks for all pending executions,
  7964. // respecting firingIndex overrides and runtime changes
  7965. fired = firing = true;
  7966. for ( ; queue.length; firingIndex = -1 ) {
  7967. memory = queue.shift();
  7968. while ( ++firingIndex < list.length ) {
  7969. // Run callback and check for early termination
  7970. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  7971. options.stopOnFalse ) {
  7972. // Jump to end and forget the data so .add doesn't re-fire
  7973. firingIndex = list.length;
  7974. memory = false;
  7975. }
  7976. }
  7977. }
  7978. // Forget the data if we're done with it
  7979. if ( !options.memory ) {
  7980. memory = false;
  7981. }
  7982. firing = false;
  7983. // Clean up if we're done firing for good
  7984. if ( locked ) {
  7985. // Keep an empty list if we have data for future add calls
  7986. if ( memory ) {
  7987. list = [];
  7988. // Otherwise, this object is spent
  7989. } else {
  7990. list = "";
  7991. }
  7992. }
  7993. },
  7994. // Actual Callbacks object
  7995. self = {
  7996. // Add a callback or a collection of callbacks to the list
  7997. add: function() {
  7998. if ( list ) {
  7999. // If we have memory from a past run, we should fire after adding
  8000. if ( memory && !firing ) {
  8001. firingIndex = list.length - 1;
  8002. queue.push( memory );
  8003. }
  8004. ( function add( args ) {
  8005. jQuery.each( args, function( _, arg ) {
  8006. if ( isFunction( arg ) ) {
  8007. if ( !options.unique || !self.has( arg ) ) {
  8008. list.push( arg );
  8009. }
  8010. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  8011. // Inspect recursively
  8012. add( arg );
  8013. }
  8014. } );
  8015. } )( arguments );
  8016. if ( memory && !firing ) {
  8017. fire();
  8018. }
  8019. }
  8020. return this;
  8021. },
  8022. // Remove a callback from the list
  8023. remove: function() {
  8024. jQuery.each( arguments, function( _, arg ) {
  8025. var index;
  8026. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  8027. list.splice( index, 1 );
  8028. // Handle firing indexes
  8029. if ( index <= firingIndex ) {
  8030. firingIndex--;
  8031. }
  8032. }
  8033. } );
  8034. return this;
  8035. },
  8036. // Check if a given callback is in the list.
  8037. // If no argument is given, return whether or not list has callbacks attached.
  8038. has: function( fn ) {
  8039. return fn ?
  8040. jQuery.inArray( fn, list ) > -1 :
  8041. list.length > 0;
  8042. },
  8043. // Remove all callbacks from the list
  8044. empty: function() {
  8045. if ( list ) {
  8046. list = [];
  8047. }
  8048. return this;
  8049. },
  8050. // Disable .fire and .add
  8051. // Abort any current/pending executions
  8052. // Clear all callbacks and values
  8053. disable: function() {
  8054. locked = queue = [];
  8055. list = memory = "";
  8056. return this;
  8057. },
  8058. disabled: function() {
  8059. return !list;
  8060. },
  8061. // Disable .fire
  8062. // Also disable .add unless we have memory (since it would have no effect)
  8063. // Abort any pending executions
  8064. lock: function() {
  8065. locked = queue = [];
  8066. if ( !memory && !firing ) {
  8067. list = memory = "";
  8068. }
  8069. return this;
  8070. },
  8071. locked: function() {
  8072. return !!locked;
  8073. },
  8074. // Call all callbacks with the given context and arguments
  8075. fireWith: function( context, args ) {
  8076. if ( !locked ) {
  8077. args = args || [];
  8078. args = [ context, args.slice ? args.slice() : args ];
  8079. queue.push( args );
  8080. if ( !firing ) {
  8081. fire();
  8082. }
  8083. }
  8084. return this;
  8085. },
  8086. // Call all the callbacks with the given arguments
  8087. fire: function() {
  8088. self.fireWith( this, arguments );
  8089. return this;
  8090. },
  8091. // To know if the callbacks have already been called at least once
  8092. fired: function() {
  8093. return !!fired;
  8094. }
  8095. };
  8096. return self;
  8097. };
  8098. function Identity( v ) {
  8099. return v;
  8100. }
  8101. function Thrower( ex ) {
  8102. throw ex;
  8103. }
  8104. function adoptValue( value, resolve, reject, noValue ) {
  8105. var method;
  8106. try {
  8107. // Check for promise aspect first to privilege synchronous behavior
  8108. if ( value && isFunction( ( method = value.promise ) ) ) {
  8109. method.call( value ).done( resolve ).fail( reject );
  8110. // Other thenables
  8111. } else if ( value && isFunction( ( method = value.then ) ) ) {
  8112. method.call( value, resolve, reject );
  8113. // Other non-thenables
  8114. } else {
  8115. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  8116. // * false: [ value ].slice( 0 ) => resolve( value )
  8117. // * true: [ value ].slice( 1 ) => resolve()
  8118. resolve.apply( undefined, [ value ].slice( noValue ) );
  8119. }
  8120. // For Promises/A+, convert exceptions into rejections
  8121. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  8122. // Deferred#then to conditionally suppress rejection.
  8123. } catch ( value ) {
  8124. // Support: Android 4.0 only
  8125. // Strict mode functions invoked without .call/.apply get global-object context
  8126. reject.apply( undefined, [ value ] );
  8127. }
  8128. }
  8129. jQuery.extend( {
  8130. Deferred: function( func ) {
  8131. var tuples = [
  8132. // action, add listener, callbacks,
  8133. // ... .then handlers, argument index, [final state]
  8134. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  8135. jQuery.Callbacks( "memory" ), 2 ],
  8136. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  8137. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  8138. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  8139. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  8140. ],
  8141. state = "pending",
  8142. promise = {
  8143. state: function() {
  8144. return state;
  8145. },
  8146. always: function() {
  8147. deferred.done( arguments ).fail( arguments );
  8148. return this;
  8149. },
  8150. "catch": function( fn ) {
  8151. return promise.then( null, fn );
  8152. },
  8153. // Keep pipe for back-compat
  8154. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  8155. var fns = arguments;
  8156. return jQuery.Deferred( function( newDefer ) {
  8157. jQuery.each( tuples, function( i, tuple ) {
  8158. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  8159. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  8160. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  8161. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  8162. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  8163. deferred[ tuple[ 1 ] ]( function() {
  8164. var returned = fn && fn.apply( this, arguments );
  8165. if ( returned && isFunction( returned.promise ) ) {
  8166. returned.promise()
  8167. .progress( newDefer.notify )
  8168. .done( newDefer.resolve )
  8169. .fail( newDefer.reject );
  8170. } else {
  8171. newDefer[ tuple[ 0 ] + "With" ](
  8172. this,
  8173. fn ? [ returned ] : arguments
  8174. );
  8175. }
  8176. } );
  8177. } );
  8178. fns = null;
  8179. } ).promise();
  8180. },
  8181. then: function( onFulfilled, onRejected, onProgress ) {
  8182. var maxDepth = 0;
  8183. function resolve( depth, deferred, handler, special ) {
  8184. return function() {
  8185. var that = this,
  8186. args = arguments,
  8187. mightThrow = function() {
  8188. var returned, then;
  8189. // Support: Promises/A+ section 2.3.3.3.3
  8190. // https://promisesaplus.com/#point-59
  8191. // Ignore double-resolution attempts
  8192. if ( depth < maxDepth ) {
  8193. return;
  8194. }
  8195. returned = handler.apply( that, args );
  8196. // Support: Promises/A+ section 2.3.1
  8197. // https://promisesaplus.com/#point-48
  8198. if ( returned === deferred.promise() ) {
  8199. throw new TypeError( "Thenable self-resolution" );
  8200. }
  8201. // Support: Promises/A+ sections 2.3.3.1, 3.5
  8202. // https://promisesaplus.com/#point-54
  8203. // https://promisesaplus.com/#point-75
  8204. // Retrieve `then` only once
  8205. then = returned &&
  8206. // Support: Promises/A+ section 2.3.4
  8207. // https://promisesaplus.com/#point-64
  8208. // Only check objects and functions for thenability
  8209. ( typeof returned === "object" ||
  8210. typeof returned === "function" ) &&
  8211. returned.then;
  8212. // Handle a returned thenable
  8213. if ( isFunction( then ) ) {
  8214. // Special processors (notify) just wait for resolution
  8215. if ( special ) {
  8216. then.call(
  8217. returned,
  8218. resolve( maxDepth, deferred, Identity, special ),
  8219. resolve( maxDepth, deferred, Thrower, special )
  8220. );
  8221. // Normal processors (resolve) also hook into progress
  8222. } else {
  8223. // ...and disregard older resolution values
  8224. maxDepth++;
  8225. then.call(
  8226. returned,
  8227. resolve( maxDepth, deferred, Identity, special ),
  8228. resolve( maxDepth, deferred, Thrower, special ),
  8229. resolve( maxDepth, deferred, Identity,
  8230. deferred.notifyWith )
  8231. );
  8232. }
  8233. // Handle all other returned values
  8234. } else {
  8235. // Only substitute handlers pass on context
  8236. // and multiple values (non-spec behavior)
  8237. if ( handler !== Identity ) {
  8238. that = undefined;
  8239. args = [ returned ];
  8240. }
  8241. // Process the value(s)
  8242. // Default process is resolve
  8243. ( special || deferred.resolveWith )( that, args );
  8244. }
  8245. },
  8246. // Only normal processors (resolve) catch and reject exceptions
  8247. process = special ?
  8248. mightThrow :
  8249. function() {
  8250. try {
  8251. mightThrow();
  8252. } catch ( e ) {
  8253. if ( jQuery.Deferred.exceptionHook ) {
  8254. jQuery.Deferred.exceptionHook( e,
  8255. process.stackTrace );
  8256. }
  8257. // Support: Promises/A+ section 2.3.3.3.4.1
  8258. // https://promisesaplus.com/#point-61
  8259. // Ignore post-resolution exceptions
  8260. if ( depth + 1 >= maxDepth ) {
  8261. // Only substitute handlers pass on context
  8262. // and multiple values (non-spec behavior)
  8263. if ( handler !== Thrower ) {
  8264. that = undefined;
  8265. args = [ e ];
  8266. }
  8267. deferred.rejectWith( that, args );
  8268. }
  8269. }
  8270. };
  8271. // Support: Promises/A+ section 2.3.3.3.1
  8272. // https://promisesaplus.com/#point-57
  8273. // Re-resolve promises immediately to dodge false rejection from
  8274. // subsequent errors
  8275. if ( depth ) {
  8276. process();
  8277. } else {
  8278. // Call an optional hook to record the stack, in case of exception
  8279. // since it's otherwise lost when execution goes async
  8280. if ( jQuery.Deferred.getStackHook ) {
  8281. process.stackTrace = jQuery.Deferred.getStackHook();
  8282. }
  8283. window.setTimeout( process );
  8284. }
  8285. };
  8286. }
  8287. return jQuery.Deferred( function( newDefer ) {
  8288. // progress_handlers.add( ... )
  8289. tuples[ 0 ][ 3 ].add(
  8290. resolve(
  8291. 0,
  8292. newDefer,
  8293. isFunction( onProgress ) ?
  8294. onProgress :
  8295. Identity,
  8296. newDefer.notifyWith
  8297. )
  8298. );
  8299. // fulfilled_handlers.add( ... )
  8300. tuples[ 1 ][ 3 ].add(
  8301. resolve(
  8302. 0,
  8303. newDefer,
  8304. isFunction( onFulfilled ) ?
  8305. onFulfilled :
  8306. Identity
  8307. )
  8308. );
  8309. // rejected_handlers.add( ... )
  8310. tuples[ 2 ][ 3 ].add(
  8311. resolve(
  8312. 0,
  8313. newDefer,
  8314. isFunction( onRejected ) ?
  8315. onRejected :
  8316. Thrower
  8317. )
  8318. );
  8319. } ).promise();
  8320. },
  8321. // Get a promise for this deferred
  8322. // If obj is provided, the promise aspect is added to the object
  8323. promise: function( obj ) {
  8324. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8325. }
  8326. },
  8327. deferred = {};
  8328. // Add list-specific methods
  8329. jQuery.each( tuples, function( i, tuple ) {
  8330. var list = tuple[ 2 ],
  8331. stateString = tuple[ 5 ];
  8332. // promise.progress = list.add
  8333. // promise.done = list.add
  8334. // promise.fail = list.add
  8335. promise[ tuple[ 1 ] ] = list.add;
  8336. // Handle state
  8337. if ( stateString ) {
  8338. list.add(
  8339. function() {
  8340. // state = "resolved" (i.e., fulfilled)
  8341. // state = "rejected"
  8342. state = stateString;
  8343. },
  8344. // rejected_callbacks.disable
  8345. // fulfilled_callbacks.disable
  8346. tuples[ 3 - i ][ 2 ].disable,
  8347. // rejected_handlers.disable
  8348. // fulfilled_handlers.disable
  8349. tuples[ 3 - i ][ 3 ].disable,
  8350. // progress_callbacks.lock
  8351. tuples[ 0 ][ 2 ].lock,
  8352. // progress_handlers.lock
  8353. tuples[ 0 ][ 3 ].lock
  8354. );
  8355. }
  8356. // progress_handlers.fire
  8357. // fulfilled_handlers.fire
  8358. // rejected_handlers.fire
  8359. list.add( tuple[ 3 ].fire );
  8360. // deferred.notify = function() { deferred.notifyWith(...) }
  8361. // deferred.resolve = function() { deferred.resolveWith(...) }
  8362. // deferred.reject = function() { deferred.rejectWith(...) }
  8363. deferred[ tuple[ 0 ] ] = function() {
  8364. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8365. return this;
  8366. };
  8367. // deferred.notifyWith = list.fireWith
  8368. // deferred.resolveWith = list.fireWith
  8369. // deferred.rejectWith = list.fireWith
  8370. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8371. } );
  8372. // Make the deferred a promise
  8373. promise.promise( deferred );
  8374. // Call given func if any
  8375. if ( func ) {
  8376. func.call( deferred, deferred );
  8377. }
  8378. // All done!
  8379. return deferred;
  8380. },
  8381. // Deferred helper
  8382. when: function( singleValue ) {
  8383. var
  8384. // count of uncompleted subordinates
  8385. remaining = arguments.length,
  8386. // count of unprocessed arguments
  8387. i = remaining,
  8388. // subordinate fulfillment data
  8389. resolveContexts = Array( i ),
  8390. resolveValues = slice.call( arguments ),
  8391. // the master Deferred
  8392. master = jQuery.Deferred(),
  8393. // subordinate callback factory
  8394. updateFunc = function( i ) {
  8395. return function( value ) {
  8396. resolveContexts[ i ] = this;
  8397. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8398. if ( !( --remaining ) ) {
  8399. master.resolveWith( resolveContexts, resolveValues );
  8400. }
  8401. };
  8402. };
  8403. // Single- and empty arguments are adopted like Promise.resolve
  8404. if ( remaining <= 1 ) {
  8405. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8406. !remaining );
  8407. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8408. if ( master.state() === "pending" ||
  8409. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8410. return master.then();
  8411. }
  8412. }
  8413. // Multiple arguments are aggregated like Promise.all array elements
  8414. while ( i-- ) {
  8415. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8416. }
  8417. return master.promise();
  8418. }
  8419. } );
  8420. // These usually indicate a programmer mistake during development,
  8421. // warn about them ASAP rather than swallowing them by default.
  8422. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8423. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8424. // Support: IE 8 - 9 only
  8425. // Console exists when dev tools are open, which can happen at any time
  8426. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8427. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8428. }
  8429. };
  8430. jQuery.readyException = function( error ) {
  8431. window.setTimeout( function() {
  8432. throw error;
  8433. } );
  8434. };
  8435. // The deferred used on DOM ready
  8436. var readyList = jQuery.Deferred();
  8437. jQuery.fn.ready = function( fn ) {
  8438. readyList
  8439. .then( fn )
  8440. // Wrap jQuery.readyException in a function so that the lookup
  8441. // happens at the time of error handling instead of callback
  8442. // registration.
  8443. .catch( function( error ) {
  8444. jQuery.readyException( error );
  8445. } );
  8446. return this;
  8447. };
  8448. jQuery.extend( {
  8449. // Is the DOM ready to be used? Set to true once it occurs.
  8450. isReady: false,
  8451. // A counter to track how many items to wait for before
  8452. // the ready event fires. See #6781
  8453. readyWait: 1,
  8454. // Handle when the DOM is ready
  8455. ready: function( wait ) {
  8456. // Abort if there are pending holds or we're already ready
  8457. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8458. return;
  8459. }
  8460. // Remember that the DOM is ready
  8461. jQuery.isReady = true;
  8462. // If a normal DOM Ready event fired, decrement, and wait if need be
  8463. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8464. return;
  8465. }
  8466. // If there are functions bound, to execute
  8467. readyList.resolveWith( document, [ jQuery ] );
  8468. }
  8469. } );
  8470. jQuery.ready.then = readyList.then;
  8471. // The ready event handler and self cleanup method
  8472. function completed() {
  8473. document.removeEventListener( "DOMContentLoaded", completed );
  8474. window.removeEventListener( "load", completed );
  8475. jQuery.ready();
  8476. }
  8477. // Catch cases where $(document).ready() is called
  8478. // after the browser event has already occurred.
  8479. // Support: IE <=9 - 10 only
  8480. // Older IE sometimes signals "interactive" too soon
  8481. if ( document.readyState === "complete" ||
  8482. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8483. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8484. window.setTimeout( jQuery.ready );
  8485. } else {
  8486. // Use the handy event callback
  8487. document.addEventListener( "DOMContentLoaded", completed );
  8488. // A fallback to window.onload, that will always work
  8489. window.addEventListener( "load", completed );
  8490. }
  8491. // Multifunctional method to get and set values of a collection
  8492. // The value/s can optionally be executed if it's a function
  8493. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8494. var i = 0,
  8495. len = elems.length,
  8496. bulk = key == null;
  8497. // Sets many values
  8498. if ( toType( key ) === "object" ) {
  8499. chainable = true;
  8500. for ( i in key ) {
  8501. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8502. }
  8503. // Sets one value
  8504. } else if ( value !== undefined ) {
  8505. chainable = true;
  8506. if ( !isFunction( value ) ) {
  8507. raw = true;
  8508. }
  8509. if ( bulk ) {
  8510. // Bulk operations run against the entire set
  8511. if ( raw ) {
  8512. fn.call( elems, value );
  8513. fn = null;
  8514. // ...except when executing function values
  8515. } else {
  8516. bulk = fn;
  8517. fn = function( elem, key, value ) {
  8518. return bulk.call( jQuery( elem ), value );
  8519. };
  8520. }
  8521. }
  8522. if ( fn ) {
  8523. for ( ; i < len; i++ ) {
  8524. fn(
  8525. elems[ i ], key, raw ?
  8526. value :
  8527. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8528. );
  8529. }
  8530. }
  8531. }
  8532. if ( chainable ) {
  8533. return elems;
  8534. }
  8535. // Gets
  8536. if ( bulk ) {
  8537. return fn.call( elems );
  8538. }
  8539. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8540. };
  8541. // Matches dashed string for camelizing
  8542. var rmsPrefix = /^-ms-/,
  8543. rdashAlpha = /-([a-z])/g;
  8544. // Used by camelCase as callback to replace()
  8545. function fcamelCase( all, letter ) {
  8546. return letter.toUpperCase();
  8547. }
  8548. // Convert dashed to camelCase; used by the css and data modules
  8549. // Support: IE <=9 - 11, Edge 12 - 15
  8550. // Microsoft forgot to hump their vendor prefix (#9572)
  8551. function camelCase( string ) {
  8552. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8553. }
  8554. var acceptData = function( owner ) {
  8555. // Accepts only:
  8556. // - Node
  8557. // - Node.ELEMENT_NODE
  8558. // - Node.DOCUMENT_NODE
  8559. // - Object
  8560. // - Any
  8561. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8562. };
  8563. function Data() {
  8564. this.expando = jQuery.expando + Data.uid++;
  8565. }
  8566. Data.uid = 1;
  8567. Data.prototype = {
  8568. cache: function( owner ) {
  8569. // Check if the owner object already has a cache
  8570. var value = owner[ this.expando ];
  8571. // If not, create one
  8572. if ( !value ) {
  8573. value = {};
  8574. // We can accept data for non-element nodes in modern browsers,
  8575. // but we should not, see #8335.
  8576. // Always return an empty object.
  8577. if ( acceptData( owner ) ) {
  8578. // If it is a node unlikely to be stringify-ed or looped over
  8579. // use plain assignment
  8580. if ( owner.nodeType ) {
  8581. owner[ this.expando ] = value;
  8582. // Otherwise secure it in a non-enumerable property
  8583. // configurable must be true to allow the property to be
  8584. // deleted when data is removed
  8585. } else {
  8586. Object.defineProperty( owner, this.expando, {
  8587. value: value,
  8588. configurable: true
  8589. } );
  8590. }
  8591. }
  8592. }
  8593. return value;
  8594. },
  8595. set: function( owner, data, value ) {
  8596. var prop,
  8597. cache = this.cache( owner );
  8598. // Handle: [ owner, key, value ] args
  8599. // Always use camelCase key (gh-2257)
  8600. if ( typeof data === "string" ) {
  8601. cache[ camelCase( data ) ] = value;
  8602. // Handle: [ owner, { properties } ] args
  8603. } else {
  8604. // Copy the properties one-by-one to the cache object
  8605. for ( prop in data ) {
  8606. cache[ camelCase( prop ) ] = data[ prop ];
  8607. }
  8608. }
  8609. return cache;
  8610. },
  8611. get: function( owner, key ) {
  8612. return key === undefined ?
  8613. this.cache( owner ) :
  8614. // Always use camelCase key (gh-2257)
  8615. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8616. },
  8617. access: function( owner, key, value ) {
  8618. // In cases where either:
  8619. //
  8620. // 1. No key was specified
  8621. // 2. A string key was specified, but no value provided
  8622. //
  8623. // Take the "read" path and allow the get method to determine
  8624. // which value to return, respectively either:
  8625. //
  8626. // 1. The entire cache object
  8627. // 2. The data stored at the key
  8628. //
  8629. if ( key === undefined ||
  8630. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8631. return this.get( owner, key );
  8632. }
  8633. // When the key is not a string, or both a key and value
  8634. // are specified, set or extend (existing objects) with either:
  8635. //
  8636. // 1. An object of properties
  8637. // 2. A key and value
  8638. //
  8639. this.set( owner, key, value );
  8640. // Since the "set" path can have two possible entry points
  8641. // return the expected data based on which path was taken[*]
  8642. return value !== undefined ? value : key;
  8643. },
  8644. remove: function( owner, key ) {
  8645. var i,
  8646. cache = owner[ this.expando ];
  8647. if ( cache === undefined ) {
  8648. return;
  8649. }
  8650. if ( key !== undefined ) {
  8651. // Support array or space separated string of keys
  8652. if ( Array.isArray( key ) ) {
  8653. // If key is an array of keys...
  8654. // We always set camelCase keys, so remove that.
  8655. key = key.map( camelCase );
  8656. } else {
  8657. key = camelCase( key );
  8658. // If a key with the spaces exists, use it.
  8659. // Otherwise, create an array by matching non-whitespace
  8660. key = key in cache ?
  8661. [ key ] :
  8662. ( key.match( rnothtmlwhite ) || [] );
  8663. }
  8664. i = key.length;
  8665. while ( i-- ) {
  8666. delete cache[ key[ i ] ];
  8667. }
  8668. }
  8669. // Remove the expando if there's no more data
  8670. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8671. // Support: Chrome <=35 - 45
  8672. // Webkit & Blink performance suffers when deleting properties
  8673. // from DOM nodes, so set to undefined instead
  8674. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8675. if ( owner.nodeType ) {
  8676. owner[ this.expando ] = undefined;
  8677. } else {
  8678. delete owner[ this.expando ];
  8679. }
  8680. }
  8681. },
  8682. hasData: function( owner ) {
  8683. var cache = owner[ this.expando ];
  8684. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8685. }
  8686. };
  8687. var dataPriv = new Data();
  8688. var dataUser = new Data();
  8689. // Implementation Summary
  8690. //
  8691. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8692. // 2. Improve the module's maintainability by reducing the storage
  8693. // paths to a single mechanism.
  8694. // 3. Use the same single mechanism to support "private" and "user" data.
  8695. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8696. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8697. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8698. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8699. rmultiDash = /[A-Z]/g;
  8700. function getData( data ) {
  8701. if ( data === "true" ) {
  8702. return true;
  8703. }
  8704. if ( data === "false" ) {
  8705. return false;
  8706. }
  8707. if ( data === "null" ) {
  8708. return null;
  8709. }
  8710. // Only convert to a number if it doesn't change the string
  8711. if ( data === +data + "" ) {
  8712. return +data;
  8713. }
  8714. if ( rbrace.test( data ) ) {
  8715. return JSON.parse( data );
  8716. }
  8717. return data;
  8718. }
  8719. function dataAttr( elem, key, data ) {
  8720. var name;
  8721. // If nothing was found internally, try to fetch any
  8722. // data from the HTML5 data-* attribute
  8723. if ( data === undefined && elem.nodeType === 1 ) {
  8724. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8725. data = elem.getAttribute( name );
  8726. if ( typeof data === "string" ) {
  8727. try {
  8728. data = getData( data );
  8729. } catch ( e ) {}
  8730. // Make sure we set the data so it isn't changed later
  8731. dataUser.set( elem, key, data );
  8732. } else {
  8733. data = undefined;
  8734. }
  8735. }
  8736. return data;
  8737. }
  8738. jQuery.extend( {
  8739. hasData: function( elem ) {
  8740. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8741. },
  8742. data: function( elem, name, data ) {
  8743. return dataUser.access( elem, name, data );
  8744. },
  8745. removeData: function( elem, name ) {
  8746. dataUser.remove( elem, name );
  8747. },
  8748. // TODO: Now that all calls to _data and _removeData have been replaced
  8749. // with direct calls to dataPriv methods, these can be deprecated.
  8750. _data: function( elem, name, data ) {
  8751. return dataPriv.access( elem, name, data );
  8752. },
  8753. _removeData: function( elem, name ) {
  8754. dataPriv.remove( elem, name );
  8755. }
  8756. } );
  8757. jQuery.fn.extend( {
  8758. data: function( key, value ) {
  8759. var i, name, data,
  8760. elem = this[ 0 ],
  8761. attrs = elem && elem.attributes;
  8762. // Gets all values
  8763. if ( key === undefined ) {
  8764. if ( this.length ) {
  8765. data = dataUser.get( elem );
  8766. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8767. i = attrs.length;
  8768. while ( i-- ) {
  8769. // Support: IE 11 only
  8770. // The attrs elements can be null (#14894)
  8771. if ( attrs[ i ] ) {
  8772. name = attrs[ i ].name;
  8773. if ( name.indexOf( "data-" ) === 0 ) {
  8774. name = camelCase( name.slice( 5 ) );
  8775. dataAttr( elem, name, data[ name ] );
  8776. }
  8777. }
  8778. }
  8779. dataPriv.set( elem, "hasDataAttrs", true );
  8780. }
  8781. }
  8782. return data;
  8783. }
  8784. // Sets multiple values
  8785. if ( typeof key === "object" ) {
  8786. return this.each( function() {
  8787. dataUser.set( this, key );
  8788. } );
  8789. }
  8790. return access( this, function( value ) {
  8791. var data;
  8792. // The calling jQuery object (element matches) is not empty
  8793. // (and therefore has an element appears at this[ 0 ]) and the
  8794. // `value` parameter was not undefined. An empty jQuery object
  8795. // will result in `undefined` for elem = this[ 0 ] which will
  8796. // throw an exception if an attempt to read a data cache is made.
  8797. if ( elem && value === undefined ) {
  8798. // Attempt to get data from the cache
  8799. // The key will always be camelCased in Data
  8800. data = dataUser.get( elem, key );
  8801. if ( data !== undefined ) {
  8802. return data;
  8803. }
  8804. // Attempt to "discover" the data in
  8805. // HTML5 custom data-* attrs
  8806. data = dataAttr( elem, key );
  8807. if ( data !== undefined ) {
  8808. return data;
  8809. }
  8810. // We tried really hard, but the data doesn't exist.
  8811. return;
  8812. }
  8813. // Set the data...
  8814. this.each( function() {
  8815. // We always store the camelCased key
  8816. dataUser.set( this, key, value );
  8817. } );
  8818. }, null, value, arguments.length > 1, null, true );
  8819. },
  8820. removeData: function( key ) {
  8821. return this.each( function() {
  8822. dataUser.remove( this, key );
  8823. } );
  8824. }
  8825. } );
  8826. jQuery.extend( {
  8827. queue: function( elem, type, data ) {
  8828. var queue;
  8829. if ( elem ) {
  8830. type = ( type || "fx" ) + "queue";
  8831. queue = dataPriv.get( elem, type );
  8832. // Speed up dequeue by getting out quickly if this is just a lookup
  8833. if ( data ) {
  8834. if ( !queue || Array.isArray( data ) ) {
  8835. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8836. } else {
  8837. queue.push( data );
  8838. }
  8839. }
  8840. return queue || [];
  8841. }
  8842. },
  8843. dequeue: function( elem, type ) {
  8844. type = type || "fx";
  8845. var queue = jQuery.queue( elem, type ),
  8846. startLength = queue.length,
  8847. fn = queue.shift(),
  8848. hooks = jQuery._queueHooks( elem, type ),
  8849. next = function() {
  8850. jQuery.dequeue( elem, type );
  8851. };
  8852. // If the fx queue is dequeued, always remove the progress sentinel
  8853. if ( fn === "inprogress" ) {
  8854. fn = queue.shift();
  8855. startLength--;
  8856. }
  8857. if ( fn ) {
  8858. // Add a progress sentinel to prevent the fx queue from being
  8859. // automatically dequeued
  8860. if ( type === "fx" ) {
  8861. queue.unshift( "inprogress" );
  8862. }
  8863. // Clear up the last queue stop function
  8864. delete hooks.stop;
  8865. fn.call( elem, next, hooks );
  8866. }
  8867. if ( !startLength && hooks ) {
  8868. hooks.empty.fire();
  8869. }
  8870. },
  8871. // Not public - generate a queueHooks object, or return the current one
  8872. _queueHooks: function( elem, type ) {
  8873. var key = type + "queueHooks";
  8874. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8875. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8876. dataPriv.remove( elem, [ type + "queue", key ] );
  8877. } )
  8878. } );
  8879. }
  8880. } );
  8881. jQuery.fn.extend( {
  8882. queue: function( type, data ) {
  8883. var setter = 2;
  8884. if ( typeof type !== "string" ) {
  8885. data = type;
  8886. type = "fx";
  8887. setter--;
  8888. }
  8889. if ( arguments.length < setter ) {
  8890. return jQuery.queue( this[ 0 ], type );
  8891. }
  8892. return data === undefined ?
  8893. this :
  8894. this.each( function() {
  8895. var queue = jQuery.queue( this, type, data );
  8896. // Ensure a hooks for this queue
  8897. jQuery._queueHooks( this, type );
  8898. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8899. jQuery.dequeue( this, type );
  8900. }
  8901. } );
  8902. },
  8903. dequeue: function( type ) {
  8904. return this.each( function() {
  8905. jQuery.dequeue( this, type );
  8906. } );
  8907. },
  8908. clearQueue: function( type ) {
  8909. return this.queue( type || "fx", [] );
  8910. },
  8911. // Get a promise resolved when queues of a certain type
  8912. // are emptied (fx is the type by default)
  8913. promise: function( type, obj ) {
  8914. var tmp,
  8915. count = 1,
  8916. defer = jQuery.Deferred(),
  8917. elements = this,
  8918. i = this.length,
  8919. resolve = function() {
  8920. if ( !( --count ) ) {
  8921. defer.resolveWith( elements, [ elements ] );
  8922. }
  8923. };
  8924. if ( typeof type !== "string" ) {
  8925. obj = type;
  8926. type = undefined;
  8927. }
  8928. type = type || "fx";
  8929. while ( i-- ) {
  8930. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  8931. if ( tmp && tmp.empty ) {
  8932. count++;
  8933. tmp.empty.add( resolve );
  8934. }
  8935. }
  8936. resolve();
  8937. return defer.promise( obj );
  8938. }
  8939. } );
  8940. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  8941. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  8942. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  8943. var documentElement = document.documentElement;
  8944. var isAttached = function( elem ) {
  8945. return jQuery.contains( elem.ownerDocument, elem );
  8946. },
  8947. composed = { composed: true };
  8948. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  8949. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  8950. // Support: iOS 10.0-10.2 only
  8951. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  8952. // leading to errors. We need to check for `getRootNode`.
  8953. if ( documentElement.getRootNode ) {
  8954. isAttached = function( elem ) {
  8955. return jQuery.contains( elem.ownerDocument, elem ) ||
  8956. elem.getRootNode( composed ) === elem.ownerDocument;
  8957. };
  8958. }
  8959. var isHiddenWithinTree = function( elem, el ) {
  8960. // isHiddenWithinTree might be called from jQuery#filter function;
  8961. // in that case, element will be second argument
  8962. elem = el || elem;
  8963. // Inline style trumps all
  8964. return elem.style.display === "none" ||
  8965. elem.style.display === "" &&
  8966. // Otherwise, check computed style
  8967. // Support: Firefox <=43 - 45
  8968. // Disconnected elements can have computed display: none, so first confirm that elem is
  8969. // in the document.
  8970. isAttached( elem ) &&
  8971. jQuery.css( elem, "display" ) === "none";
  8972. };
  8973. var swap = function( elem, options, callback, args ) {
  8974. var ret, name,
  8975. old = {};
  8976. // Remember the old values, and insert the new ones
  8977. for ( name in options ) {
  8978. old[ name ] = elem.style[ name ];
  8979. elem.style[ name ] = options[ name ];
  8980. }
  8981. ret = callback.apply( elem, args || [] );
  8982. // Revert the old values
  8983. for ( name in options ) {
  8984. elem.style[ name ] = old[ name ];
  8985. }
  8986. return ret;
  8987. };
  8988. function adjustCSS( elem, prop, valueParts, tween ) {
  8989. var adjusted, scale,
  8990. maxIterations = 20,
  8991. currentValue = tween ?
  8992. function() {
  8993. return tween.cur();
  8994. } :
  8995. function() {
  8996. return jQuery.css( elem, prop, "" );
  8997. },
  8998. initial = currentValue(),
  8999. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  9000. // Starting value computation is required for potential unit mismatches
  9001. initialInUnit = elem.nodeType &&
  9002. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  9003. rcssNum.exec( jQuery.css( elem, prop ) );
  9004. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  9005. // Support: Firefox <=54
  9006. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  9007. initial = initial / 2;
  9008. // Trust units reported by jQuery.css
  9009. unit = unit || initialInUnit[ 3 ];
  9010. // Iteratively approximate from a nonzero starting point
  9011. initialInUnit = +initial || 1;
  9012. while ( maxIterations-- ) {
  9013. // Evaluate and update our best guess (doubling guesses that zero out).
  9014. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  9015. jQuery.style( elem, prop, initialInUnit + unit );
  9016. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  9017. maxIterations = 0;
  9018. }
  9019. initialInUnit = initialInUnit / scale;
  9020. }
  9021. initialInUnit = initialInUnit * 2;
  9022. jQuery.style( elem, prop, initialInUnit + unit );
  9023. // Make sure we update the tween properties later on
  9024. valueParts = valueParts || [];
  9025. }
  9026. if ( valueParts ) {
  9027. initialInUnit = +initialInUnit || +initial || 0;
  9028. // Apply relative offset (+=/-=) if specified
  9029. adjusted = valueParts[ 1 ] ?
  9030. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  9031. +valueParts[ 2 ];
  9032. if ( tween ) {
  9033. tween.unit = unit;
  9034. tween.start = initialInUnit;
  9035. tween.end = adjusted;
  9036. }
  9037. }
  9038. return adjusted;
  9039. }
  9040. var defaultDisplayMap = {};
  9041. function getDefaultDisplay( elem ) {
  9042. var temp,
  9043. doc = elem.ownerDocument,
  9044. nodeName = elem.nodeName,
  9045. display = defaultDisplayMap[ nodeName ];
  9046. if ( display ) {
  9047. return display;
  9048. }
  9049. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  9050. display = jQuery.css( temp, "display" );
  9051. temp.parentNode.removeChild( temp );
  9052. if ( display === "none" ) {
  9053. display = "block";
  9054. }
  9055. defaultDisplayMap[ nodeName ] = display;
  9056. return display;
  9057. }
  9058. function showHide( elements, show ) {
  9059. var display, elem,
  9060. values = [],
  9061. index = 0,
  9062. length = elements.length;
  9063. // Determine new display value for elements that need to change
  9064. for ( ; index < length; index++ ) {
  9065. elem = elements[ index ];
  9066. if ( !elem.style ) {
  9067. continue;
  9068. }
  9069. display = elem.style.display;
  9070. if ( show ) {
  9071. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  9072. // check is required in this first loop unless we have a nonempty display value (either
  9073. // inline or about-to-be-restored)
  9074. if ( display === "none" ) {
  9075. values[ index ] = dataPriv.get( elem, "display" ) || null;
  9076. if ( !values[ index ] ) {
  9077. elem.style.display = "";
  9078. }
  9079. }
  9080. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  9081. values[ index ] = getDefaultDisplay( elem );
  9082. }
  9083. } else {
  9084. if ( display !== "none" ) {
  9085. values[ index ] = "none";
  9086. // Remember what we're overwriting
  9087. dataPriv.set( elem, "display", display );
  9088. }
  9089. }
  9090. }
  9091. // Set the display of the elements in a second loop to avoid constant reflow
  9092. for ( index = 0; index < length; index++ ) {
  9093. if ( values[ index ] != null ) {
  9094. elements[ index ].style.display = values[ index ];
  9095. }
  9096. }
  9097. return elements;
  9098. }
  9099. jQuery.fn.extend( {
  9100. show: function() {
  9101. return showHide( this, true );
  9102. },
  9103. hide: function() {
  9104. return showHide( this );
  9105. },
  9106. toggle: function( state ) {
  9107. if ( typeof state === "boolean" ) {
  9108. return state ? this.show() : this.hide();
  9109. }
  9110. return this.each( function() {
  9111. if ( isHiddenWithinTree( this ) ) {
  9112. jQuery( this ).show();
  9113. } else {
  9114. jQuery( this ).hide();
  9115. }
  9116. } );
  9117. }
  9118. } );
  9119. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  9120. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  9121. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  9122. // We have to close these tags to support XHTML (#13200)
  9123. var wrapMap = {
  9124. // Support: IE <=9 only
  9125. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  9126. // XHTML parsers do not magically insert elements in the
  9127. // same way that tag soup parsers do. So we cannot shorten
  9128. // this by omitting <tbody> or other required elements.
  9129. thead: [ 1, "<table>", "</table>" ],
  9130. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  9131. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  9132. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  9133. _default: [ 0, "", "" ]
  9134. };
  9135. // Support: IE <=9 only
  9136. wrapMap.optgroup = wrapMap.option;
  9137. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  9138. wrapMap.th = wrapMap.td;
  9139. function getAll( context, tag ) {
  9140. // Support: IE <=9 - 11 only
  9141. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  9142. var ret;
  9143. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9144. ret = context.getElementsByTagName( tag || "*" );
  9145. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  9146. ret = context.querySelectorAll( tag || "*" );
  9147. } else {
  9148. ret = [];
  9149. }
  9150. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  9151. return jQuery.merge( [ context ], ret );
  9152. }
  9153. return ret;
  9154. }
  9155. // Mark scripts as having already been evaluated
  9156. function setGlobalEval( elems, refElements ) {
  9157. var i = 0,
  9158. l = elems.length;
  9159. for ( ; i < l; i++ ) {
  9160. dataPriv.set(
  9161. elems[ i ],
  9162. "globalEval",
  9163. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  9164. );
  9165. }
  9166. }
  9167. var rhtml = /<|&#?\w+;/;
  9168. function buildFragment( elems, context, scripts, selection, ignored ) {
  9169. var elem, tmp, tag, wrap, attached, j,
  9170. fragment = context.createDocumentFragment(),
  9171. nodes = [],
  9172. i = 0,
  9173. l = elems.length;
  9174. for ( ; i < l; i++ ) {
  9175. elem = elems[ i ];
  9176. if ( elem || elem === 0 ) {
  9177. // Add nodes directly
  9178. if ( toType( elem ) === "object" ) {
  9179. // Support: Android <=4.0 only, PhantomJS 1 only
  9180. // push.apply(_, arraylike) throws on ancient WebKit
  9181. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  9182. // Convert non-html into a text node
  9183. } else if ( !rhtml.test( elem ) ) {
  9184. nodes.push( context.createTextNode( elem ) );
  9185. // Convert html into DOM nodes
  9186. } else {
  9187. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  9188. // Deserialize a standard representation
  9189. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  9190. wrap = wrapMap[ tag ] || wrapMap._default;
  9191. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  9192. // Descend through wrappers to the right content
  9193. j = wrap[ 0 ];
  9194. while ( j-- ) {
  9195. tmp = tmp.lastChild;
  9196. }
  9197. // Support: Android <=4.0 only, PhantomJS 1 only
  9198. // push.apply(_, arraylike) throws on ancient WebKit
  9199. jQuery.merge( nodes, tmp.childNodes );
  9200. // Remember the top-level container
  9201. tmp = fragment.firstChild;
  9202. // Ensure the created nodes are orphaned (#12392)
  9203. tmp.textContent = "";
  9204. }
  9205. }
  9206. }
  9207. // Remove wrapper from fragment
  9208. fragment.textContent = "";
  9209. i = 0;
  9210. while ( ( elem = nodes[ i++ ] ) ) {
  9211. // Skip elements already in the context collection (trac-4087)
  9212. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  9213. if ( ignored ) {
  9214. ignored.push( elem );
  9215. }
  9216. continue;
  9217. }
  9218. attached = isAttached( elem );
  9219. // Append to fragment
  9220. tmp = getAll( fragment.appendChild( elem ), "script" );
  9221. // Preserve script evaluation history
  9222. if ( attached ) {
  9223. setGlobalEval( tmp );
  9224. }
  9225. // Capture executables
  9226. if ( scripts ) {
  9227. j = 0;
  9228. while ( ( elem = tmp[ j++ ] ) ) {
  9229. if ( rscriptType.test( elem.type || "" ) ) {
  9230. scripts.push( elem );
  9231. }
  9232. }
  9233. }
  9234. }
  9235. return fragment;
  9236. }
  9237. ( function() {
  9238. var fragment = document.createDocumentFragment(),
  9239. div = fragment.appendChild( document.createElement( "div" ) ),
  9240. input = document.createElement( "input" );
  9241. // Support: Android 4.0 - 4.3 only
  9242. // Check state lost if the name is set (#11217)
  9243. // Support: Windows Web Apps (WWA)
  9244. // `name` and `type` must use .setAttribute for WWA (#14901)
  9245. input.setAttribute( "type", "radio" );
  9246. input.setAttribute( "checked", "checked" );
  9247. input.setAttribute( "name", "t" );
  9248. div.appendChild( input );
  9249. // Support: Android <=4.1 only
  9250. // Older WebKit doesn't clone checked state correctly in fragments
  9251. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  9252. // Support: IE <=11 only
  9253. // Make sure textarea (and checkbox) defaultValue is properly cloned
  9254. div.innerHTML = "<textarea>x</textarea>";
  9255. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  9256. } )();
  9257. var
  9258. rkeyEvent = /^key/,
  9259. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  9260. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  9261. function returnTrue() {
  9262. return true;
  9263. }
  9264. function returnFalse() {
  9265. return false;
  9266. }
  9267. // Support: IE <=9 - 11+
  9268. // focus() and blur() are asynchronous, except when they are no-op.
  9269. // So expect focus to be synchronous when the element is already active,
  9270. // and blur to be synchronous when the element is not already active.
  9271. // (focus and blur are always synchronous in other supported browsers,
  9272. // this just defines when we can count on it).
  9273. function expectSync( elem, type ) {
  9274. return ( elem === safeActiveElement() ) === ( type === "focus" );
  9275. }
  9276. // Support: IE <=9 only
  9277. // Accessing document.activeElement can throw unexpectedly
  9278. // https://bugs.jquery.com/ticket/13393
  9279. function safeActiveElement() {
  9280. try {
  9281. return document.activeElement;
  9282. } catch ( err ) { }
  9283. }
  9284. function on( elem, types, selector, data, fn, one ) {
  9285. var origFn, type;
  9286. // Types can be a map of types/handlers
  9287. if ( typeof types === "object" ) {
  9288. // ( types-Object, selector, data )
  9289. if ( typeof selector !== "string" ) {
  9290. // ( types-Object, data )
  9291. data = data || selector;
  9292. selector = undefined;
  9293. }
  9294. for ( type in types ) {
  9295. on( elem, type, selector, data, types[ type ], one );
  9296. }
  9297. return elem;
  9298. }
  9299. if ( data == null && fn == null ) {
  9300. // ( types, fn )
  9301. fn = selector;
  9302. data = selector = undefined;
  9303. } else if ( fn == null ) {
  9304. if ( typeof selector === "string" ) {
  9305. // ( types, selector, fn )
  9306. fn = data;
  9307. data = undefined;
  9308. } else {
  9309. // ( types, data, fn )
  9310. fn = data;
  9311. data = selector;
  9312. selector = undefined;
  9313. }
  9314. }
  9315. if ( fn === false ) {
  9316. fn = returnFalse;
  9317. } else if ( !fn ) {
  9318. return elem;
  9319. }
  9320. if ( one === 1 ) {
  9321. origFn = fn;
  9322. fn = function( event ) {
  9323. // Can use an empty set, since event contains the info
  9324. jQuery().off( event );
  9325. return origFn.apply( this, arguments );
  9326. };
  9327. // Use same guid so caller can remove using origFn
  9328. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9329. }
  9330. return elem.each( function() {
  9331. jQuery.event.add( this, types, fn, data, selector );
  9332. } );
  9333. }
  9334. /*
  9335. * Helper functions for managing events -- not part of the public interface.
  9336. * Props to Dean Edwards' addEvent library for many of the ideas.
  9337. */
  9338. jQuery.event = {
  9339. global: {},
  9340. add: function( elem, types, handler, data, selector ) {
  9341. var handleObjIn, eventHandle, tmp,
  9342. events, t, handleObj,
  9343. special, handlers, type, namespaces, origType,
  9344. elemData = dataPriv.get( elem );
  9345. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  9346. if ( !elemData ) {
  9347. return;
  9348. }
  9349. // Caller can pass in an object of custom data in lieu of the handler
  9350. if ( handler.handler ) {
  9351. handleObjIn = handler;
  9352. handler = handleObjIn.handler;
  9353. selector = handleObjIn.selector;
  9354. }
  9355. // Ensure that invalid selectors throw exceptions at attach time
  9356. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9357. if ( selector ) {
  9358. jQuery.find.matchesSelector( documentElement, selector );
  9359. }
  9360. // Make sure that the handler has a unique ID, used to find/remove it later
  9361. if ( !handler.guid ) {
  9362. handler.guid = jQuery.guid++;
  9363. }
  9364. // Init the element's event structure and main handler, if this is the first
  9365. if ( !( events = elemData.events ) ) {
  9366. events = elemData.events = {};
  9367. }
  9368. if ( !( eventHandle = elemData.handle ) ) {
  9369. eventHandle = elemData.handle = function( e ) {
  9370. // Discard the second event of a jQuery.event.trigger() and
  9371. // when an event is called after a page has unloaded
  9372. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9373. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9374. };
  9375. }
  9376. // Handle multiple events separated by a space
  9377. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9378. t = types.length;
  9379. while ( t-- ) {
  9380. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9381. type = origType = tmp[ 1 ];
  9382. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9383. // There *must* be a type, no attaching namespace-only handlers
  9384. if ( !type ) {
  9385. continue;
  9386. }
  9387. // If event changes its type, use the special event handlers for the changed type
  9388. special = jQuery.event.special[ type ] || {};
  9389. // If selector defined, determine special event api type, otherwise given type
  9390. type = ( selector ? special.delegateType : special.bindType ) || type;
  9391. // Update special based on newly reset type
  9392. special = jQuery.event.special[ type ] || {};
  9393. // handleObj is passed to all event handlers
  9394. handleObj = jQuery.extend( {
  9395. type: type,
  9396. origType: origType,
  9397. data: data,
  9398. handler: handler,
  9399. guid: handler.guid,
  9400. selector: selector,
  9401. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9402. namespace: namespaces.join( "." )
  9403. }, handleObjIn );
  9404. // Init the event handler queue if we're the first
  9405. if ( !( handlers = events[ type ] ) ) {
  9406. handlers = events[ type ] = [];
  9407. handlers.delegateCount = 0;
  9408. // Only use addEventListener if the special events handler returns false
  9409. if ( !special.setup ||
  9410. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9411. if ( elem.addEventListener ) {
  9412. elem.addEventListener( type, eventHandle );
  9413. }
  9414. }
  9415. }
  9416. if ( special.add ) {
  9417. special.add.call( elem, handleObj );
  9418. if ( !handleObj.handler.guid ) {
  9419. handleObj.handler.guid = handler.guid;
  9420. }
  9421. }
  9422. // Add to the element's handler list, delegates in front
  9423. if ( selector ) {
  9424. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9425. } else {
  9426. handlers.push( handleObj );
  9427. }
  9428. // Keep track of which events have ever been used, for event optimization
  9429. jQuery.event.global[ type ] = true;
  9430. }
  9431. },
  9432. // Detach an event or set of events from an element
  9433. remove: function( elem, types, handler, selector, mappedTypes ) {
  9434. var j, origCount, tmp,
  9435. events, t, handleObj,
  9436. special, handlers, type, namespaces, origType,
  9437. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9438. if ( !elemData || !( events = elemData.events ) ) {
  9439. return;
  9440. }
  9441. // Once for each type.namespace in types; type may be omitted
  9442. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9443. t = types.length;
  9444. while ( t-- ) {
  9445. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9446. type = origType = tmp[ 1 ];
  9447. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9448. // Unbind all events (on this namespace, if provided) for the element
  9449. if ( !type ) {
  9450. for ( type in events ) {
  9451. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9452. }
  9453. continue;
  9454. }
  9455. special = jQuery.event.special[ type ] || {};
  9456. type = ( selector ? special.delegateType : special.bindType ) || type;
  9457. handlers = events[ type ] || [];
  9458. tmp = tmp[ 2 ] &&
  9459. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9460. // Remove matching events
  9461. origCount = j = handlers.length;
  9462. while ( j-- ) {
  9463. handleObj = handlers[ j ];
  9464. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9465. ( !handler || handler.guid === handleObj.guid ) &&
  9466. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9467. ( !selector || selector === handleObj.selector ||
  9468. selector === "**" && handleObj.selector ) ) {
  9469. handlers.splice( j, 1 );
  9470. if ( handleObj.selector ) {
  9471. handlers.delegateCount--;
  9472. }
  9473. if ( special.remove ) {
  9474. special.remove.call( elem, handleObj );
  9475. }
  9476. }
  9477. }
  9478. // Remove generic event handler if we removed something and no more handlers exist
  9479. // (avoids potential for endless recursion during removal of special event handlers)
  9480. if ( origCount && !handlers.length ) {
  9481. if ( !special.teardown ||
  9482. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9483. jQuery.removeEvent( elem, type, elemData.handle );
  9484. }
  9485. delete events[ type ];
  9486. }
  9487. }
  9488. // Remove data and the expando if it's no longer used
  9489. if ( jQuery.isEmptyObject( events ) ) {
  9490. dataPriv.remove( elem, "handle events" );
  9491. }
  9492. },
  9493. dispatch: function( nativeEvent ) {
  9494. // Make a writable jQuery.Event from the native event object
  9495. var event = jQuery.event.fix( nativeEvent );
  9496. var i, j, ret, matched, handleObj, handlerQueue,
  9497. args = new Array( arguments.length ),
  9498. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  9499. special = jQuery.event.special[ event.type ] || {};
  9500. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9501. args[ 0 ] = event;
  9502. for ( i = 1; i < arguments.length; i++ ) {
  9503. args[ i ] = arguments[ i ];
  9504. }
  9505. event.delegateTarget = this;
  9506. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9507. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9508. return;
  9509. }
  9510. // Determine handlers
  9511. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9512. // Run delegates first; they may want to stop propagation beneath us
  9513. i = 0;
  9514. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9515. event.currentTarget = matched.elem;
  9516. j = 0;
  9517. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9518. !event.isImmediatePropagationStopped() ) {
  9519. // If the event is namespaced, then each handler is only invoked if it is
  9520. // specially universal or its namespaces are a superset of the event's.
  9521. if ( !event.rnamespace || handleObj.namespace === false ||
  9522. event.rnamespace.test( handleObj.namespace ) ) {
  9523. event.handleObj = handleObj;
  9524. event.data = handleObj.data;
  9525. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9526. handleObj.handler ).apply( matched.elem, args );
  9527. if ( ret !== undefined ) {
  9528. if ( ( event.result = ret ) === false ) {
  9529. event.preventDefault();
  9530. event.stopPropagation();
  9531. }
  9532. }
  9533. }
  9534. }
  9535. }
  9536. // Call the postDispatch hook for the mapped type
  9537. if ( special.postDispatch ) {
  9538. special.postDispatch.call( this, event );
  9539. }
  9540. return event.result;
  9541. },
  9542. handlers: function( event, handlers ) {
  9543. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9544. handlerQueue = [],
  9545. delegateCount = handlers.delegateCount,
  9546. cur = event.target;
  9547. // Find delegate handlers
  9548. if ( delegateCount &&
  9549. // Support: IE <=9
  9550. // Black-hole SVG <use> instance trees (trac-13180)
  9551. cur.nodeType &&
  9552. // Support: Firefox <=42
  9553. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9554. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9555. // Support: IE 11 only
  9556. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9557. !( event.type === "click" && event.button >= 1 ) ) {
  9558. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9559. // Don't check non-elements (#13208)
  9560. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9561. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9562. matchedHandlers = [];
  9563. matchedSelectors = {};
  9564. for ( i = 0; i < delegateCount; i++ ) {
  9565. handleObj = handlers[ i ];
  9566. // Don't conflict with Object.prototype properties (#13203)
  9567. sel = handleObj.selector + " ";
  9568. if ( matchedSelectors[ sel ] === undefined ) {
  9569. matchedSelectors[ sel ] = handleObj.needsContext ?
  9570. jQuery( sel, this ).index( cur ) > -1 :
  9571. jQuery.find( sel, this, null, [ cur ] ).length;
  9572. }
  9573. if ( matchedSelectors[ sel ] ) {
  9574. matchedHandlers.push( handleObj );
  9575. }
  9576. }
  9577. if ( matchedHandlers.length ) {
  9578. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9579. }
  9580. }
  9581. }
  9582. }
  9583. // Add the remaining (directly-bound) handlers
  9584. cur = this;
  9585. if ( delegateCount < handlers.length ) {
  9586. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9587. }
  9588. return handlerQueue;
  9589. },
  9590. addProp: function( name, hook ) {
  9591. Object.defineProperty( jQuery.Event.prototype, name, {
  9592. enumerable: true,
  9593. configurable: true,
  9594. get: isFunction( hook ) ?
  9595. function() {
  9596. if ( this.originalEvent ) {
  9597. return hook( this.originalEvent );
  9598. }
  9599. } :
  9600. function() {
  9601. if ( this.originalEvent ) {
  9602. return this.originalEvent[ name ];
  9603. }
  9604. },
  9605. set: function( value ) {
  9606. Object.defineProperty( this, name, {
  9607. enumerable: true,
  9608. configurable: true,
  9609. writable: true,
  9610. value: value
  9611. } );
  9612. }
  9613. } );
  9614. },
  9615. fix: function( originalEvent ) {
  9616. return originalEvent[ jQuery.expando ] ?
  9617. originalEvent :
  9618. new jQuery.Event( originalEvent );
  9619. },
  9620. special: {
  9621. load: {
  9622. // Prevent triggered image.load events from bubbling to window.load
  9623. noBubble: true
  9624. },
  9625. click: {
  9626. // Utilize native event to ensure correct state for checkable inputs
  9627. setup: function( data ) {
  9628. // For mutual compressibility with _default, replace `this` access with a local var.
  9629. // `|| data` is dead code meant only to preserve the variable through minification.
  9630. var el = this || data;
  9631. // Claim the first handler
  9632. if ( rcheckableType.test( el.type ) &&
  9633. el.click && nodeName( el, "input" ) ) {
  9634. // dataPriv.set( el, "click", ... )
  9635. leverageNative( el, "click", returnTrue );
  9636. }
  9637. // Return false to allow normal processing in the caller
  9638. return false;
  9639. },
  9640. trigger: function( data ) {
  9641. // For mutual compressibility with _default, replace `this` access with a local var.
  9642. // `|| data` is dead code meant only to preserve the variable through minification.
  9643. var el = this || data;
  9644. // Force setup before triggering a click
  9645. if ( rcheckableType.test( el.type ) &&
  9646. el.click && nodeName( el, "input" ) ) {
  9647. leverageNative( el, "click" );
  9648. }
  9649. // Return non-false to allow normal event-path propagation
  9650. return true;
  9651. },
  9652. // For cross-browser consistency, suppress native .click() on links
  9653. // Also prevent it if we're currently inside a leveraged native-event stack
  9654. _default: function( event ) {
  9655. var target = event.target;
  9656. return rcheckableType.test( target.type ) &&
  9657. target.click && nodeName( target, "input" ) &&
  9658. dataPriv.get( target, "click" ) ||
  9659. nodeName( target, "a" );
  9660. }
  9661. },
  9662. beforeunload: {
  9663. postDispatch: function( event ) {
  9664. // Support: Firefox 20+
  9665. // Firefox doesn't alert if the returnValue field is not set.
  9666. if ( event.result !== undefined && event.originalEvent ) {
  9667. event.originalEvent.returnValue = event.result;
  9668. }
  9669. }
  9670. }
  9671. }
  9672. };
  9673. // Ensure the presence of an event listener that handles manually-triggered
  9674. // synthetic events by interrupting progress until reinvoked in response to
  9675. // *native* events that it fires directly, ensuring that state changes have
  9676. // already occurred before other listeners are invoked.
  9677. function leverageNative( el, type, expectSync ) {
  9678. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  9679. if ( !expectSync ) {
  9680. if ( dataPriv.get( el, type ) === undefined ) {
  9681. jQuery.event.add( el, type, returnTrue );
  9682. }
  9683. return;
  9684. }
  9685. // Register the controller as a special universal handler for all event namespaces
  9686. dataPriv.set( el, type, false );
  9687. jQuery.event.add( el, type, {
  9688. namespace: false,
  9689. handler: function( event ) {
  9690. var notAsync, result,
  9691. saved = dataPriv.get( this, type );
  9692. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  9693. // Interrupt processing of the outer synthetic .trigger()ed event
  9694. // Saved data should be false in such cases, but might be a leftover capture object
  9695. // from an async native handler (gh-4350)
  9696. if ( !saved.length ) {
  9697. // Store arguments for use when handling the inner native event
  9698. // There will always be at least one argument (an event object), so this array
  9699. // will not be confused with a leftover capture object.
  9700. saved = slice.call( arguments );
  9701. dataPriv.set( this, type, saved );
  9702. // Trigger the native event and capture its result
  9703. // Support: IE <=9 - 11+
  9704. // focus() and blur() are asynchronous
  9705. notAsync = expectSync( this, type );
  9706. this[ type ]();
  9707. result = dataPriv.get( this, type );
  9708. if ( saved !== result || notAsync ) {
  9709. dataPriv.set( this, type, false );
  9710. } else {
  9711. result = {};
  9712. }
  9713. if ( saved !== result ) {
  9714. // Cancel the outer synthetic event
  9715. event.stopImmediatePropagation();
  9716. event.preventDefault();
  9717. return result.value;
  9718. }
  9719. // If this is an inner synthetic event for an event with a bubbling surrogate
  9720. // (focus or blur), assume that the surrogate already propagated from triggering the
  9721. // native event and prevent that from happening again here.
  9722. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  9723. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  9724. // less bad than duplication.
  9725. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  9726. event.stopPropagation();
  9727. }
  9728. // If this is a native event triggered above, everything is now in order
  9729. // Fire an inner synthetic event with the original arguments
  9730. } else if ( saved.length ) {
  9731. // ...and capture the result
  9732. dataPriv.set( this, type, {
  9733. value: jQuery.event.trigger(
  9734. // Support: IE <=9 - 11+
  9735. // Extend with the prototype to reset the above stopImmediatePropagation()
  9736. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  9737. saved.slice( 1 ),
  9738. this
  9739. )
  9740. } );
  9741. // Abort handling of the native event
  9742. event.stopImmediatePropagation();
  9743. }
  9744. }
  9745. } );
  9746. }
  9747. jQuery.removeEvent = function( elem, type, handle ) {
  9748. // This "if" is needed for plain objects
  9749. if ( elem.removeEventListener ) {
  9750. elem.removeEventListener( type, handle );
  9751. }
  9752. };
  9753. jQuery.Event = function( src, props ) {
  9754. // Allow instantiation without the 'new' keyword
  9755. if ( !( this instanceof jQuery.Event ) ) {
  9756. return new jQuery.Event( src, props );
  9757. }
  9758. // Event object
  9759. if ( src && src.type ) {
  9760. this.originalEvent = src;
  9761. this.type = src.type;
  9762. // Events bubbling up the document may have been marked as prevented
  9763. // by a handler lower down the tree; reflect the correct value.
  9764. this.isDefaultPrevented = src.defaultPrevented ||
  9765. src.defaultPrevented === undefined &&
  9766. // Support: Android <=2.3 only
  9767. src.returnValue === false ?
  9768. returnTrue :
  9769. returnFalse;
  9770. // Create target properties
  9771. // Support: Safari <=6 - 7 only
  9772. // Target should not be a text node (#504, #13143)
  9773. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9774. src.target.parentNode :
  9775. src.target;
  9776. this.currentTarget = src.currentTarget;
  9777. this.relatedTarget = src.relatedTarget;
  9778. // Event type
  9779. } else {
  9780. this.type = src;
  9781. }
  9782. // Put explicitly provided properties onto the event object
  9783. if ( props ) {
  9784. jQuery.extend( this, props );
  9785. }
  9786. // Create a timestamp if incoming event doesn't have one
  9787. this.timeStamp = src && src.timeStamp || Date.now();
  9788. // Mark it as fixed
  9789. this[ jQuery.expando ] = true;
  9790. };
  9791. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9792. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9793. jQuery.Event.prototype = {
  9794. constructor: jQuery.Event,
  9795. isDefaultPrevented: returnFalse,
  9796. isPropagationStopped: returnFalse,
  9797. isImmediatePropagationStopped: returnFalse,
  9798. isSimulated: false,
  9799. preventDefault: function() {
  9800. var e = this.originalEvent;
  9801. this.isDefaultPrevented = returnTrue;
  9802. if ( e && !this.isSimulated ) {
  9803. e.preventDefault();
  9804. }
  9805. },
  9806. stopPropagation: function() {
  9807. var e = this.originalEvent;
  9808. this.isPropagationStopped = returnTrue;
  9809. if ( e && !this.isSimulated ) {
  9810. e.stopPropagation();
  9811. }
  9812. },
  9813. stopImmediatePropagation: function() {
  9814. var e = this.originalEvent;
  9815. this.isImmediatePropagationStopped = returnTrue;
  9816. if ( e && !this.isSimulated ) {
  9817. e.stopImmediatePropagation();
  9818. }
  9819. this.stopPropagation();
  9820. }
  9821. };
  9822. // Includes all common event props including KeyEvent and MouseEvent specific props
  9823. jQuery.each( {
  9824. altKey: true,
  9825. bubbles: true,
  9826. cancelable: true,
  9827. changedTouches: true,
  9828. ctrlKey: true,
  9829. detail: true,
  9830. eventPhase: true,
  9831. metaKey: true,
  9832. pageX: true,
  9833. pageY: true,
  9834. shiftKey: true,
  9835. view: true,
  9836. "char": true,
  9837. code: true,
  9838. charCode: true,
  9839. key: true,
  9840. keyCode: true,
  9841. button: true,
  9842. buttons: true,
  9843. clientX: true,
  9844. clientY: true,
  9845. offsetX: true,
  9846. offsetY: true,
  9847. pointerId: true,
  9848. pointerType: true,
  9849. screenX: true,
  9850. screenY: true,
  9851. targetTouches: true,
  9852. toElement: true,
  9853. touches: true,
  9854. which: function( event ) {
  9855. var button = event.button;
  9856. // Add which for key events
  9857. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9858. return event.charCode != null ? event.charCode : event.keyCode;
  9859. }
  9860. // Add which for click: 1 === left; 2 === middle; 3 === right
  9861. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9862. if ( button & 1 ) {
  9863. return 1;
  9864. }
  9865. if ( button & 2 ) {
  9866. return 3;
  9867. }
  9868. if ( button & 4 ) {
  9869. return 2;
  9870. }
  9871. return 0;
  9872. }
  9873. return event.which;
  9874. }
  9875. }, jQuery.event.addProp );
  9876. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  9877. jQuery.event.special[ type ] = {
  9878. // Utilize native event if possible so blur/focus sequence is correct
  9879. setup: function() {
  9880. // Claim the first handler
  9881. // dataPriv.set( this, "focus", ... )
  9882. // dataPriv.set( this, "blur", ... )
  9883. leverageNative( this, type, expectSync );
  9884. // Return false to allow normal processing in the caller
  9885. return false;
  9886. },
  9887. trigger: function() {
  9888. // Force setup before trigger
  9889. leverageNative( this, type );
  9890. // Return non-false to allow normal event-path propagation
  9891. return true;
  9892. },
  9893. delegateType: delegateType
  9894. };
  9895. } );
  9896. // Create mouseenter/leave events using mouseover/out and event-time checks
  9897. // so that event delegation works in jQuery.
  9898. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9899. //
  9900. // Support: Safari 7 only
  9901. // Safari sends mouseenter too often; see:
  9902. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9903. // for the description of the bug (it existed in older Chrome versions as well).
  9904. jQuery.each( {
  9905. mouseenter: "mouseover",
  9906. mouseleave: "mouseout",
  9907. pointerenter: "pointerover",
  9908. pointerleave: "pointerout"
  9909. }, function( orig, fix ) {
  9910. jQuery.event.special[ orig ] = {
  9911. delegateType: fix,
  9912. bindType: fix,
  9913. handle: function( event ) {
  9914. var ret,
  9915. target = this,
  9916. related = event.relatedTarget,
  9917. handleObj = event.handleObj;
  9918. // For mouseenter/leave call the handler if related is outside the target.
  9919. // NB: No relatedTarget if the mouse left/entered the browser window
  9920. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9921. event.type = handleObj.origType;
  9922. ret = handleObj.handler.apply( this, arguments );
  9923. event.type = fix;
  9924. }
  9925. return ret;
  9926. }
  9927. };
  9928. } );
  9929. jQuery.fn.extend( {
  9930. on: function( types, selector, data, fn ) {
  9931. return on( this, types, selector, data, fn );
  9932. },
  9933. one: function( types, selector, data, fn ) {
  9934. return on( this, types, selector, data, fn, 1 );
  9935. },
  9936. off: function( types, selector, fn ) {
  9937. var handleObj, type;
  9938. if ( types && types.preventDefault && types.handleObj ) {
  9939. // ( event ) dispatched jQuery.Event
  9940. handleObj = types.handleObj;
  9941. jQuery( types.delegateTarget ).off(
  9942. handleObj.namespace ?
  9943. handleObj.origType + "." + handleObj.namespace :
  9944. handleObj.origType,
  9945. handleObj.selector,
  9946. handleObj.handler
  9947. );
  9948. return this;
  9949. }
  9950. if ( typeof types === "object" ) {
  9951. // ( types-object [, selector] )
  9952. for ( type in types ) {
  9953. this.off( type, selector, types[ type ] );
  9954. }
  9955. return this;
  9956. }
  9957. if ( selector === false || typeof selector === "function" ) {
  9958. // ( types [, fn] )
  9959. fn = selector;
  9960. selector = undefined;
  9961. }
  9962. if ( fn === false ) {
  9963. fn = returnFalse;
  9964. }
  9965. return this.each( function() {
  9966. jQuery.event.remove( this, types, fn, selector );
  9967. } );
  9968. }
  9969. } );
  9970. var
  9971. /* eslint-disable max-len */
  9972. // See https://github.com/eslint/eslint/issues/3229
  9973. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  9974. /* eslint-enable */
  9975. // Support: IE <=10 - 11, Edge 12 - 13 only
  9976. // In IE/Edge using regex groups here causes severe slowdowns.
  9977. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  9978. rnoInnerhtml = /<script|<style|<link/i,
  9979. // checked="checked" or checked
  9980. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  9981. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  9982. // Prefer a tbody over its parent table for containing new rows
  9983. function manipulationTarget( elem, content ) {
  9984. if ( nodeName( elem, "table" ) &&
  9985. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  9986. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  9987. }
  9988. return elem;
  9989. }
  9990. // Replace/restore the type attribute of script elements for safe DOM manipulation
  9991. function disableScript( elem ) {
  9992. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  9993. return elem;
  9994. }
  9995. function restoreScript( elem ) {
  9996. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  9997. elem.type = elem.type.slice( 5 );
  9998. } else {
  9999. elem.removeAttribute( "type" );
  10000. }
  10001. return elem;
  10002. }
  10003. function cloneCopyEvent( src, dest ) {
  10004. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  10005. if ( dest.nodeType !== 1 ) {
  10006. return;
  10007. }
  10008. // 1. Copy private data: events, handlers, etc.
  10009. if ( dataPriv.hasData( src ) ) {
  10010. pdataOld = dataPriv.access( src );
  10011. pdataCur = dataPriv.set( dest, pdataOld );
  10012. events = pdataOld.events;
  10013. if ( events ) {
  10014. delete pdataCur.handle;
  10015. pdataCur.events = {};
  10016. for ( type in events ) {
  10017. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  10018. jQuery.event.add( dest, type, events[ type ][ i ] );
  10019. }
  10020. }
  10021. }
  10022. }
  10023. // 2. Copy user data
  10024. if ( dataUser.hasData( src ) ) {
  10025. udataOld = dataUser.access( src );
  10026. udataCur = jQuery.extend( {}, udataOld );
  10027. dataUser.set( dest, udataCur );
  10028. }
  10029. }
  10030. // Fix IE bugs, see support tests
  10031. function fixInput( src, dest ) {
  10032. var nodeName = dest.nodeName.toLowerCase();
  10033. // Fails to persist the checked state of a cloned checkbox or radio button.
  10034. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  10035. dest.checked = src.checked;
  10036. // Fails to return the selected option to the default selected state when cloning options
  10037. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  10038. dest.defaultValue = src.defaultValue;
  10039. }
  10040. }
  10041. function domManip( collection, args, callback, ignored ) {
  10042. // Flatten any nested arrays
  10043. args = concat.apply( [], args );
  10044. var fragment, first, scripts, hasScripts, node, doc,
  10045. i = 0,
  10046. l = collection.length,
  10047. iNoClone = l - 1,
  10048. value = args[ 0 ],
  10049. valueIsFunction = isFunction( value );
  10050. // We can't cloneNode fragments that contain checked, in WebKit
  10051. if ( valueIsFunction ||
  10052. ( l > 1 && typeof value === "string" &&
  10053. !support.checkClone && rchecked.test( value ) ) ) {
  10054. return collection.each( function( index ) {
  10055. var self = collection.eq( index );
  10056. if ( valueIsFunction ) {
  10057. args[ 0 ] = value.call( this, index, self.html() );
  10058. }
  10059. domManip( self, args, callback, ignored );
  10060. } );
  10061. }
  10062. if ( l ) {
  10063. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  10064. first = fragment.firstChild;
  10065. if ( fragment.childNodes.length === 1 ) {
  10066. fragment = first;
  10067. }
  10068. // Require either new content or an interest in ignored elements to invoke the callback
  10069. if ( first || ignored ) {
  10070. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  10071. hasScripts = scripts.length;
  10072. // Use the original fragment for the last item
  10073. // instead of the first because it can end up
  10074. // being emptied incorrectly in certain situations (#8070).
  10075. for ( ; i < l; i++ ) {
  10076. node = fragment;
  10077. if ( i !== iNoClone ) {
  10078. node = jQuery.clone( node, true, true );
  10079. // Keep references to cloned scripts for later restoration
  10080. if ( hasScripts ) {
  10081. // Support: Android <=4.0 only, PhantomJS 1 only
  10082. // push.apply(_, arraylike) throws on ancient WebKit
  10083. jQuery.merge( scripts, getAll( node, "script" ) );
  10084. }
  10085. }
  10086. callback.call( collection[ i ], node, i );
  10087. }
  10088. if ( hasScripts ) {
  10089. doc = scripts[ scripts.length - 1 ].ownerDocument;
  10090. // Reenable scripts
  10091. jQuery.map( scripts, restoreScript );
  10092. // Evaluate executable scripts on first document insertion
  10093. for ( i = 0; i < hasScripts; i++ ) {
  10094. node = scripts[ i ];
  10095. if ( rscriptType.test( node.type || "" ) &&
  10096. !dataPriv.access( node, "globalEval" ) &&
  10097. jQuery.contains( doc, node ) ) {
  10098. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  10099. // Optional AJAX dependency, but won't run scripts if not present
  10100. if ( jQuery._evalUrl && !node.noModule ) {
  10101. jQuery._evalUrl( node.src, {
  10102. nonce: node.nonce || node.getAttribute( "nonce" )
  10103. } );
  10104. }
  10105. } else {
  10106. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  10107. }
  10108. }
  10109. }
  10110. }
  10111. }
  10112. }
  10113. return collection;
  10114. }
  10115. function remove( elem, selector, keepData ) {
  10116. var node,
  10117. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  10118. i = 0;
  10119. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  10120. if ( !keepData && node.nodeType === 1 ) {
  10121. jQuery.cleanData( getAll( node ) );
  10122. }
  10123. if ( node.parentNode ) {
  10124. if ( keepData && isAttached( node ) ) {
  10125. setGlobalEval( getAll( node, "script" ) );
  10126. }
  10127. node.parentNode.removeChild( node );
  10128. }
  10129. }
  10130. return elem;
  10131. }
  10132. jQuery.extend( {
  10133. htmlPrefilter: function( html ) {
  10134. return html.replace( rxhtmlTag, "<$1></$2>" );
  10135. },
  10136. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  10137. var i, l, srcElements, destElements,
  10138. clone = elem.cloneNode( true ),
  10139. inPage = isAttached( elem );
  10140. // Fix IE cloning issues
  10141. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  10142. !jQuery.isXMLDoc( elem ) ) {
  10143. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  10144. destElements = getAll( clone );
  10145. srcElements = getAll( elem );
  10146. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10147. fixInput( srcElements[ i ], destElements[ i ] );
  10148. }
  10149. }
  10150. // Copy the events from the original to the clone
  10151. if ( dataAndEvents ) {
  10152. if ( deepDataAndEvents ) {
  10153. srcElements = srcElements || getAll( elem );
  10154. destElements = destElements || getAll( clone );
  10155. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10156. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  10157. }
  10158. } else {
  10159. cloneCopyEvent( elem, clone );
  10160. }
  10161. }
  10162. // Preserve script evaluation history
  10163. destElements = getAll( clone, "script" );
  10164. if ( destElements.length > 0 ) {
  10165. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  10166. }
  10167. // Return the cloned set
  10168. return clone;
  10169. },
  10170. cleanData: function( elems ) {
  10171. var data, elem, type,
  10172. special = jQuery.event.special,
  10173. i = 0;
  10174. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  10175. if ( acceptData( elem ) ) {
  10176. if ( ( data = elem[ dataPriv.expando ] ) ) {
  10177. if ( data.events ) {
  10178. for ( type in data.events ) {
  10179. if ( special[ type ] ) {
  10180. jQuery.event.remove( elem, type );
  10181. // This is a shortcut to avoid jQuery.event.remove's overhead
  10182. } else {
  10183. jQuery.removeEvent( elem, type, data.handle );
  10184. }
  10185. }
  10186. }
  10187. // Support: Chrome <=35 - 45+
  10188. // Assign undefined instead of using delete, see Data#remove
  10189. elem[ dataPriv.expando ] = undefined;
  10190. }
  10191. if ( elem[ dataUser.expando ] ) {
  10192. // Support: Chrome <=35 - 45+
  10193. // Assign undefined instead of using delete, see Data#remove
  10194. elem[ dataUser.expando ] = undefined;
  10195. }
  10196. }
  10197. }
  10198. }
  10199. } );
  10200. jQuery.fn.extend( {
  10201. detach: function( selector ) {
  10202. return remove( this, selector, true );
  10203. },
  10204. remove: function( selector ) {
  10205. return remove( this, selector );
  10206. },
  10207. text: function( value ) {
  10208. return access( this, function( value ) {
  10209. return value === undefined ?
  10210. jQuery.text( this ) :
  10211. this.empty().each( function() {
  10212. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10213. this.textContent = value;
  10214. }
  10215. } );
  10216. }, null, value, arguments.length );
  10217. },
  10218. append: function() {
  10219. return domManip( this, arguments, function( elem ) {
  10220. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10221. var target = manipulationTarget( this, elem );
  10222. target.appendChild( elem );
  10223. }
  10224. } );
  10225. },
  10226. prepend: function() {
  10227. return domManip( this, arguments, function( elem ) {
  10228. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10229. var target = manipulationTarget( this, elem );
  10230. target.insertBefore( elem, target.firstChild );
  10231. }
  10232. } );
  10233. },
  10234. before: function() {
  10235. return domManip( this, arguments, function( elem ) {
  10236. if ( this.parentNode ) {
  10237. this.parentNode.insertBefore( elem, this );
  10238. }
  10239. } );
  10240. },
  10241. after: function() {
  10242. return domManip( this, arguments, function( elem ) {
  10243. if ( this.parentNode ) {
  10244. this.parentNode.insertBefore( elem, this.nextSibling );
  10245. }
  10246. } );
  10247. },
  10248. empty: function() {
  10249. var elem,
  10250. i = 0;
  10251. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  10252. if ( elem.nodeType === 1 ) {
  10253. // Prevent memory leaks
  10254. jQuery.cleanData( getAll( elem, false ) );
  10255. // Remove any remaining nodes
  10256. elem.textContent = "";
  10257. }
  10258. }
  10259. return this;
  10260. },
  10261. clone: function( dataAndEvents, deepDataAndEvents ) {
  10262. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  10263. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  10264. return this.map( function() {
  10265. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  10266. } );
  10267. },
  10268. html: function( value ) {
  10269. return access( this, function( value ) {
  10270. var elem = this[ 0 ] || {},
  10271. i = 0,
  10272. l = this.length;
  10273. if ( value === undefined && elem.nodeType === 1 ) {
  10274. return elem.innerHTML;
  10275. }
  10276. // See if we can take a shortcut and just use innerHTML
  10277. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  10278. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  10279. value = jQuery.htmlPrefilter( value );
  10280. try {
  10281. for ( ; i < l; i++ ) {
  10282. elem = this[ i ] || {};
  10283. // Remove element nodes and prevent memory leaks
  10284. if ( elem.nodeType === 1 ) {
  10285. jQuery.cleanData( getAll( elem, false ) );
  10286. elem.innerHTML = value;
  10287. }
  10288. }
  10289. elem = 0;
  10290. // If using innerHTML throws an exception, use the fallback method
  10291. } catch ( e ) {}
  10292. }
  10293. if ( elem ) {
  10294. this.empty().append( value );
  10295. }
  10296. }, null, value, arguments.length );
  10297. },
  10298. replaceWith: function() {
  10299. var ignored = [];
  10300. // Make the changes, replacing each non-ignored context element with the new content
  10301. return domManip( this, arguments, function( elem ) {
  10302. var parent = this.parentNode;
  10303. if ( jQuery.inArray( this, ignored ) < 0 ) {
  10304. jQuery.cleanData( getAll( this ) );
  10305. if ( parent ) {
  10306. parent.replaceChild( elem, this );
  10307. }
  10308. }
  10309. // Force callback invocation
  10310. }, ignored );
  10311. }
  10312. } );
  10313. jQuery.each( {
  10314. appendTo: "append",
  10315. prependTo: "prepend",
  10316. insertBefore: "before",
  10317. insertAfter: "after",
  10318. replaceAll: "replaceWith"
  10319. }, function( name, original ) {
  10320. jQuery.fn[ name ] = function( selector ) {
  10321. var elems,
  10322. ret = [],
  10323. insert = jQuery( selector ),
  10324. last = insert.length - 1,
  10325. i = 0;
  10326. for ( ; i <= last; i++ ) {
  10327. elems = i === last ? this : this.clone( true );
  10328. jQuery( insert[ i ] )[ original ]( elems );
  10329. // Support: Android <=4.0 only, PhantomJS 1 only
  10330. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  10331. push.apply( ret, elems.get() );
  10332. }
  10333. return this.pushStack( ret );
  10334. };
  10335. } );
  10336. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  10337. var getStyles = function( elem ) {
  10338. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  10339. // IE throws on elements created in popups
  10340. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  10341. var view = elem.ownerDocument.defaultView;
  10342. if ( !view || !view.opener ) {
  10343. view = window;
  10344. }
  10345. return view.getComputedStyle( elem );
  10346. };
  10347. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  10348. ( function() {
  10349. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  10350. // so they're executed at the same time to save the second computation.
  10351. function computeStyleTests() {
  10352. // This is a singleton, we need to execute it only once
  10353. if ( !div ) {
  10354. return;
  10355. }
  10356. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  10357. "margin-top:1px;padding:0;border:0";
  10358. div.style.cssText =
  10359. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  10360. "margin:auto;border:1px;padding:1px;" +
  10361. "width:60%;top:1%";
  10362. documentElement.appendChild( container ).appendChild( div );
  10363. var divStyle = window.getComputedStyle( div );
  10364. pixelPositionVal = divStyle.top !== "1%";
  10365. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  10366. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  10367. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  10368. // Some styles come back with percentage values, even though they shouldn't
  10369. div.style.right = "60%";
  10370. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  10371. // Support: IE 9 - 11 only
  10372. // Detect misreporting of content dimensions for box-sizing:border-box elements
  10373. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  10374. // Support: IE 9 only
  10375. // Detect overflow:scroll screwiness (gh-3699)
  10376. // Support: Chrome <=64
  10377. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  10378. div.style.position = "absolute";
  10379. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  10380. documentElement.removeChild( container );
  10381. // Nullify the div so it wouldn't be stored in the memory and
  10382. // it will also be a sign that checks already performed
  10383. div = null;
  10384. }
  10385. function roundPixelMeasures( measure ) {
  10386. return Math.round( parseFloat( measure ) );
  10387. }
  10388. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  10389. reliableMarginLeftVal,
  10390. container = document.createElement( "div" ),
  10391. div = document.createElement( "div" );
  10392. // Finish early in limited (non-browser) environments
  10393. if ( !div.style ) {
  10394. return;
  10395. }
  10396. // Support: IE <=9 - 11 only
  10397. // Style of cloned element affects source element cloned (#8908)
  10398. div.style.backgroundClip = "content-box";
  10399. div.cloneNode( true ).style.backgroundClip = "";
  10400. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  10401. jQuery.extend( support, {
  10402. boxSizingReliable: function() {
  10403. computeStyleTests();
  10404. return boxSizingReliableVal;
  10405. },
  10406. pixelBoxStyles: function() {
  10407. computeStyleTests();
  10408. return pixelBoxStylesVal;
  10409. },
  10410. pixelPosition: function() {
  10411. computeStyleTests();
  10412. return pixelPositionVal;
  10413. },
  10414. reliableMarginLeft: function() {
  10415. computeStyleTests();
  10416. return reliableMarginLeftVal;
  10417. },
  10418. scrollboxSize: function() {
  10419. computeStyleTests();
  10420. return scrollboxSizeVal;
  10421. }
  10422. } );
  10423. } )();
  10424. function curCSS( elem, name, computed ) {
  10425. var width, minWidth, maxWidth, ret,
  10426. // Support: Firefox 51+
  10427. // Retrieving style before computed somehow
  10428. // fixes an issue with getting wrong values
  10429. // on detached elements
  10430. style = elem.style;
  10431. computed = computed || getStyles( elem );
  10432. // getPropertyValue is needed for:
  10433. // .css('filter') (IE 9 only, #12537)
  10434. // .css('--customProperty) (#3144)
  10435. if ( computed ) {
  10436. ret = computed.getPropertyValue( name ) || computed[ name ];
  10437. if ( ret === "" && !isAttached( elem ) ) {
  10438. ret = jQuery.style( elem, name );
  10439. }
  10440. // A tribute to the "awesome hack by Dean Edwards"
  10441. // Android Browser returns percentage for some values,
  10442. // but width seems to be reliably pixels.
  10443. // This is against the CSSOM draft spec:
  10444. // https://drafts.csswg.org/cssom/#resolved-values
  10445. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10446. // Remember the original values
  10447. width = style.width;
  10448. minWidth = style.minWidth;
  10449. maxWidth = style.maxWidth;
  10450. // Put in the new values to get a computed value out
  10451. style.minWidth = style.maxWidth = style.width = ret;
  10452. ret = computed.width;
  10453. // Revert the changed values
  10454. style.width = width;
  10455. style.minWidth = minWidth;
  10456. style.maxWidth = maxWidth;
  10457. }
  10458. }
  10459. return ret !== undefined ?
  10460. // Support: IE <=9 - 11 only
  10461. // IE returns zIndex value as an integer.
  10462. ret + "" :
  10463. ret;
  10464. }
  10465. function addGetHookIf( conditionFn, hookFn ) {
  10466. // Define the hook, we'll check on the first run if it's really needed.
  10467. return {
  10468. get: function() {
  10469. if ( conditionFn() ) {
  10470. // Hook not needed (or it's not possible to use it due
  10471. // to missing dependency), remove it.
  10472. delete this.get;
  10473. return;
  10474. }
  10475. // Hook needed; redefine it so that the support test is not executed again.
  10476. return ( this.get = hookFn ).apply( this, arguments );
  10477. }
  10478. };
  10479. }
  10480. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10481. emptyStyle = document.createElement( "div" ).style,
  10482. vendorProps = {};
  10483. // Return a vendor-prefixed property or undefined
  10484. function vendorPropName( name ) {
  10485. // Check for vendor prefixed names
  10486. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10487. i = cssPrefixes.length;
  10488. while ( i-- ) {
  10489. name = cssPrefixes[ i ] + capName;
  10490. if ( name in emptyStyle ) {
  10491. return name;
  10492. }
  10493. }
  10494. }
  10495. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  10496. function finalPropName( name ) {
  10497. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  10498. if ( final ) {
  10499. return final;
  10500. }
  10501. if ( name in emptyStyle ) {
  10502. return name;
  10503. }
  10504. return vendorProps[ name ] = vendorPropName( name ) || name;
  10505. }
  10506. var
  10507. // Swappable if display is none or starts with table
  10508. // except "table", "table-cell", or "table-caption"
  10509. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10510. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10511. rcustomProp = /^--/,
  10512. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10513. cssNormalTransform = {
  10514. letterSpacing: "0",
  10515. fontWeight: "400"
  10516. };
  10517. function setPositiveNumber( elem, value, subtract ) {
  10518. // Any relative (+/-) values have already been
  10519. // normalized at this point
  10520. var matches = rcssNum.exec( value );
  10521. return matches ?
  10522. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10523. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10524. value;
  10525. }
  10526. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10527. var i = dimension === "width" ? 1 : 0,
  10528. extra = 0,
  10529. delta = 0;
  10530. // Adjustment may not be necessary
  10531. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10532. return 0;
  10533. }
  10534. for ( ; i < 4; i += 2 ) {
  10535. // Both box models exclude margin
  10536. if ( box === "margin" ) {
  10537. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10538. }
  10539. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10540. if ( !isBorderBox ) {
  10541. // Add padding
  10542. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10543. // For "border" or "margin", add border
  10544. if ( box !== "padding" ) {
  10545. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10546. // But still keep track of it otherwise
  10547. } else {
  10548. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10549. }
  10550. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10551. // "padding" or "margin"
  10552. } else {
  10553. // For "content", subtract padding
  10554. if ( box === "content" ) {
  10555. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10556. }
  10557. // For "content" or "padding", subtract border
  10558. if ( box !== "margin" ) {
  10559. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10560. }
  10561. }
  10562. }
  10563. // Account for positive content-box scroll gutter when requested by providing computedVal
  10564. if ( !isBorderBox && computedVal >= 0 ) {
  10565. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10566. // Assuming integer scroll gutter, subtract the rest and round down
  10567. delta += Math.max( 0, Math.ceil(
  10568. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10569. computedVal -
  10570. delta -
  10571. extra -
  10572. 0.5
  10573. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  10574. // Use an explicit zero to avoid NaN (gh-3964)
  10575. ) ) || 0;
  10576. }
  10577. return delta;
  10578. }
  10579. function getWidthOrHeight( elem, dimension, extra ) {
  10580. // Start with computed style
  10581. var styles = getStyles( elem ),
  10582. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  10583. // Fake content-box until we know it's needed to know the true value.
  10584. boxSizingNeeded = !support.boxSizingReliable() || extra,
  10585. isBorderBox = boxSizingNeeded &&
  10586. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10587. valueIsBorderBox = isBorderBox,
  10588. val = curCSS( elem, dimension, styles ),
  10589. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  10590. // Support: Firefox <=54
  10591. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10592. if ( rnumnonpx.test( val ) ) {
  10593. if ( !extra ) {
  10594. return val;
  10595. }
  10596. val = "auto";
  10597. }
  10598. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10599. // This happens for inline elements with no explicit setting (gh-3571)
  10600. // Support: Android <=4.1 - 4.3 only
  10601. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10602. // Support: IE 9-11 only
  10603. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  10604. // We use getClientRects() to check for hidden/disconnected.
  10605. // In those cases, the computed value can be trusted to be border-box
  10606. if ( ( !support.boxSizingReliable() && isBorderBox ||
  10607. val === "auto" ||
  10608. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  10609. elem.getClientRects().length ) {
  10610. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  10611. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  10612. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  10613. // retrieved value as a content box dimension.
  10614. valueIsBorderBox = offsetProp in elem;
  10615. if ( valueIsBorderBox ) {
  10616. val = elem[ offsetProp ];
  10617. }
  10618. }
  10619. // Normalize "" and auto
  10620. val = parseFloat( val ) || 0;
  10621. // Adjust for the element's box model
  10622. return ( val +
  10623. boxModelAdjustment(
  10624. elem,
  10625. dimension,
  10626. extra || ( isBorderBox ? "border" : "content" ),
  10627. valueIsBorderBox,
  10628. styles,
  10629. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10630. val
  10631. )
  10632. ) + "px";
  10633. }
  10634. jQuery.extend( {
  10635. // Add in style property hooks for overriding the default
  10636. // behavior of getting and setting a style property
  10637. cssHooks: {
  10638. opacity: {
  10639. get: function( elem, computed ) {
  10640. if ( computed ) {
  10641. // We should always get a number back from opacity
  10642. var ret = curCSS( elem, "opacity" );
  10643. return ret === "" ? "1" : ret;
  10644. }
  10645. }
  10646. }
  10647. },
  10648. // Don't automatically add "px" to these possibly-unitless properties
  10649. cssNumber: {
  10650. "animationIterationCount": true,
  10651. "columnCount": true,
  10652. "fillOpacity": true,
  10653. "flexGrow": true,
  10654. "flexShrink": true,
  10655. "fontWeight": true,
  10656. "gridArea": true,
  10657. "gridColumn": true,
  10658. "gridColumnEnd": true,
  10659. "gridColumnStart": true,
  10660. "gridRow": true,
  10661. "gridRowEnd": true,
  10662. "gridRowStart": true,
  10663. "lineHeight": true,
  10664. "opacity": true,
  10665. "order": true,
  10666. "orphans": true,
  10667. "widows": true,
  10668. "zIndex": true,
  10669. "zoom": true
  10670. },
  10671. // Add in properties whose names you wish to fix before
  10672. // setting or getting the value
  10673. cssProps: {},
  10674. // Get and set the style property on a DOM Node
  10675. style: function( elem, name, value, extra ) {
  10676. // Don't set styles on text and comment nodes
  10677. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10678. return;
  10679. }
  10680. // Make sure that we're working with the right name
  10681. var ret, type, hooks,
  10682. origName = camelCase( name ),
  10683. isCustomProp = rcustomProp.test( name ),
  10684. style = elem.style;
  10685. // Make sure that we're working with the right name. We don't
  10686. // want to query the value if it is a CSS custom property
  10687. // since they are user-defined.
  10688. if ( !isCustomProp ) {
  10689. name = finalPropName( origName );
  10690. }
  10691. // Gets hook for the prefixed version, then unprefixed version
  10692. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10693. // Check if we're setting a value
  10694. if ( value !== undefined ) {
  10695. type = typeof value;
  10696. // Convert "+=" or "-=" to relative numbers (#7345)
  10697. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10698. value = adjustCSS( elem, name, ret );
  10699. // Fixes bug #9237
  10700. type = "number";
  10701. }
  10702. // Make sure that null and NaN values aren't set (#7116)
  10703. if ( value == null || value !== value ) {
  10704. return;
  10705. }
  10706. // If a number was passed in, add the unit (except for certain CSS properties)
  10707. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  10708. // "px" to a few hardcoded values.
  10709. if ( type === "number" && !isCustomProp ) {
  10710. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10711. }
  10712. // background-* props affect original clone's values
  10713. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10714. style[ name ] = "inherit";
  10715. }
  10716. // If a hook was provided, use that value, otherwise just set the specified value
  10717. if ( !hooks || !( "set" in hooks ) ||
  10718. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10719. if ( isCustomProp ) {
  10720. style.setProperty( name, value );
  10721. } else {
  10722. style[ name ] = value;
  10723. }
  10724. }
  10725. } else {
  10726. // If a hook was provided get the non-computed value from there
  10727. if ( hooks && "get" in hooks &&
  10728. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10729. return ret;
  10730. }
  10731. // Otherwise just get the value from the style object
  10732. return style[ name ];
  10733. }
  10734. },
  10735. css: function( elem, name, extra, styles ) {
  10736. var val, num, hooks,
  10737. origName = camelCase( name ),
  10738. isCustomProp = rcustomProp.test( name );
  10739. // Make sure that we're working with the right name. We don't
  10740. // want to modify the value if it is a CSS custom property
  10741. // since they are user-defined.
  10742. if ( !isCustomProp ) {
  10743. name = finalPropName( origName );
  10744. }
  10745. // Try prefixed name followed by the unprefixed name
  10746. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10747. // If a hook was provided get the computed value from there
  10748. if ( hooks && "get" in hooks ) {
  10749. val = hooks.get( elem, true, extra );
  10750. }
  10751. // Otherwise, if a way to get the computed value exists, use that
  10752. if ( val === undefined ) {
  10753. val = curCSS( elem, name, styles );
  10754. }
  10755. // Convert "normal" to computed value
  10756. if ( val === "normal" && name in cssNormalTransform ) {
  10757. val = cssNormalTransform[ name ];
  10758. }
  10759. // Make numeric if forced or a qualifier was provided and val looks numeric
  10760. if ( extra === "" || extra ) {
  10761. num = parseFloat( val );
  10762. return extra === true || isFinite( num ) ? num || 0 : val;
  10763. }
  10764. return val;
  10765. }
  10766. } );
  10767. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  10768. jQuery.cssHooks[ dimension ] = {
  10769. get: function( elem, computed, extra ) {
  10770. if ( computed ) {
  10771. // Certain elements can have dimension info if we invisibly show them
  10772. // but it must have a current display style that would benefit
  10773. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10774. // Support: Safari 8+
  10775. // Table columns in Safari have non-zero offsetWidth & zero
  10776. // getBoundingClientRect().width unless display is changed.
  10777. // Support: IE <=11 only
  10778. // Running getBoundingClientRect on a disconnected node
  10779. // in IE throws an error.
  10780. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10781. swap( elem, cssShow, function() {
  10782. return getWidthOrHeight( elem, dimension, extra );
  10783. } ) :
  10784. getWidthOrHeight( elem, dimension, extra );
  10785. }
  10786. },
  10787. set: function( elem, value, extra ) {
  10788. var matches,
  10789. styles = getStyles( elem ),
  10790. // Only read styles.position if the test has a chance to fail
  10791. // to avoid forcing a reflow.
  10792. scrollboxSizeBuggy = !support.scrollboxSize() &&
  10793. styles.position === "absolute",
  10794. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  10795. boxSizingNeeded = scrollboxSizeBuggy || extra,
  10796. isBorderBox = boxSizingNeeded &&
  10797. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10798. subtract = extra ?
  10799. boxModelAdjustment(
  10800. elem,
  10801. dimension,
  10802. extra,
  10803. isBorderBox,
  10804. styles
  10805. ) :
  10806. 0;
  10807. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10808. // faking a content-box to get border and padding (gh-3699)
  10809. if ( isBorderBox && scrollboxSizeBuggy ) {
  10810. subtract -= Math.ceil(
  10811. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10812. parseFloat( styles[ dimension ] ) -
  10813. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10814. 0.5
  10815. );
  10816. }
  10817. // Convert to pixels if value adjustment is needed
  10818. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10819. ( matches[ 3 ] || "px" ) !== "px" ) {
  10820. elem.style[ dimension ] = value;
  10821. value = jQuery.css( elem, dimension );
  10822. }
  10823. return setPositiveNumber( elem, value, subtract );
  10824. }
  10825. };
  10826. } );
  10827. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10828. function( elem, computed ) {
  10829. if ( computed ) {
  10830. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10831. elem.getBoundingClientRect().left -
  10832. swap( elem, { marginLeft: 0 }, function() {
  10833. return elem.getBoundingClientRect().left;
  10834. } )
  10835. ) + "px";
  10836. }
  10837. }
  10838. );
  10839. // These hooks are used by animate to expand properties
  10840. jQuery.each( {
  10841. margin: "",
  10842. padding: "",
  10843. border: "Width"
  10844. }, function( prefix, suffix ) {
  10845. jQuery.cssHooks[ prefix + suffix ] = {
  10846. expand: function( value ) {
  10847. var i = 0,
  10848. expanded = {},
  10849. // Assumes a single number if not a string
  10850. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10851. for ( ; i < 4; i++ ) {
  10852. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10853. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10854. }
  10855. return expanded;
  10856. }
  10857. };
  10858. if ( prefix !== "margin" ) {
  10859. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10860. }
  10861. } );
  10862. jQuery.fn.extend( {
  10863. css: function( name, value ) {
  10864. return access( this, function( elem, name, value ) {
  10865. var styles, len,
  10866. map = {},
  10867. i = 0;
  10868. if ( Array.isArray( name ) ) {
  10869. styles = getStyles( elem );
  10870. len = name.length;
  10871. for ( ; i < len; i++ ) {
  10872. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10873. }
  10874. return map;
  10875. }
  10876. return value !== undefined ?
  10877. jQuery.style( elem, name, value ) :
  10878. jQuery.css( elem, name );
  10879. }, name, value, arguments.length > 1 );
  10880. }
  10881. } );
  10882. function Tween( elem, options, prop, end, easing ) {
  10883. return new Tween.prototype.init( elem, options, prop, end, easing );
  10884. }
  10885. jQuery.Tween = Tween;
  10886. Tween.prototype = {
  10887. constructor: Tween,
  10888. init: function( elem, options, prop, end, easing, unit ) {
  10889. this.elem = elem;
  10890. this.prop = prop;
  10891. this.easing = easing || jQuery.easing._default;
  10892. this.options = options;
  10893. this.start = this.now = this.cur();
  10894. this.end = end;
  10895. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10896. },
  10897. cur: function() {
  10898. var hooks = Tween.propHooks[ this.prop ];
  10899. return hooks && hooks.get ?
  10900. hooks.get( this ) :
  10901. Tween.propHooks._default.get( this );
  10902. },
  10903. run: function( percent ) {
  10904. var eased,
  10905. hooks = Tween.propHooks[ this.prop ];
  10906. if ( this.options.duration ) {
  10907. this.pos = eased = jQuery.easing[ this.easing ](
  10908. percent, this.options.duration * percent, 0, 1, this.options.duration
  10909. );
  10910. } else {
  10911. this.pos = eased = percent;
  10912. }
  10913. this.now = ( this.end - this.start ) * eased + this.start;
  10914. if ( this.options.step ) {
  10915. this.options.step.call( this.elem, this.now, this );
  10916. }
  10917. if ( hooks && hooks.set ) {
  10918. hooks.set( this );
  10919. } else {
  10920. Tween.propHooks._default.set( this );
  10921. }
  10922. return this;
  10923. }
  10924. };
  10925. Tween.prototype.init.prototype = Tween.prototype;
  10926. Tween.propHooks = {
  10927. _default: {
  10928. get: function( tween ) {
  10929. var result;
  10930. // Use a property on the element directly when it is not a DOM element,
  10931. // or when there is no matching style property that exists.
  10932. if ( tween.elem.nodeType !== 1 ||
  10933. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  10934. return tween.elem[ tween.prop ];
  10935. }
  10936. // Passing an empty string as a 3rd parameter to .css will automatically
  10937. // attempt a parseFloat and fallback to a string if the parse fails.
  10938. // Simple values such as "10px" are parsed to Float;
  10939. // complex values such as "rotate(1rad)" are returned as-is.
  10940. result = jQuery.css( tween.elem, tween.prop, "" );
  10941. // Empty strings, null, undefined and "auto" are converted to 0.
  10942. return !result || result === "auto" ? 0 : result;
  10943. },
  10944. set: function( tween ) {
  10945. // Use step hook for back compat.
  10946. // Use cssHook if its there.
  10947. // Use .style if available and use plain properties where available.
  10948. if ( jQuery.fx.step[ tween.prop ] ) {
  10949. jQuery.fx.step[ tween.prop ]( tween );
  10950. } else if ( tween.elem.nodeType === 1 && (
  10951. jQuery.cssHooks[ tween.prop ] ||
  10952. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  10953. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  10954. } else {
  10955. tween.elem[ tween.prop ] = tween.now;
  10956. }
  10957. }
  10958. }
  10959. };
  10960. // Support: IE <=9 only
  10961. // Panic based approach to setting things on disconnected nodes
  10962. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  10963. set: function( tween ) {
  10964. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  10965. tween.elem[ tween.prop ] = tween.now;
  10966. }
  10967. }
  10968. };
  10969. jQuery.easing = {
  10970. linear: function( p ) {
  10971. return p;
  10972. },
  10973. swing: function( p ) {
  10974. return 0.5 - Math.cos( p * Math.PI ) / 2;
  10975. },
  10976. _default: "swing"
  10977. };
  10978. jQuery.fx = Tween.prototype.init;
  10979. // Back compat <1.8 extension point
  10980. jQuery.fx.step = {};
  10981. var
  10982. fxNow, inProgress,
  10983. rfxtypes = /^(?:toggle|show|hide)$/,
  10984. rrun = /queueHooks$/;
  10985. function schedule() {
  10986. if ( inProgress ) {
  10987. if ( document.hidden === false && window.requestAnimationFrame ) {
  10988. window.requestAnimationFrame( schedule );
  10989. } else {
  10990. window.setTimeout( schedule, jQuery.fx.interval );
  10991. }
  10992. jQuery.fx.tick();
  10993. }
  10994. }
  10995. // Animations created synchronously will run synchronously
  10996. function createFxNow() {
  10997. window.setTimeout( function() {
  10998. fxNow = undefined;
  10999. } );
  11000. return ( fxNow = Date.now() );
  11001. }
  11002. // Generate parameters to create a standard animation
  11003. function genFx( type, includeWidth ) {
  11004. var which,
  11005. i = 0,
  11006. attrs = { height: type };
  11007. // If we include width, step value is 1 to do all cssExpand values,
  11008. // otherwise step value is 2 to skip over Left and Right
  11009. includeWidth = includeWidth ? 1 : 0;
  11010. for ( ; i < 4; i += 2 - includeWidth ) {
  11011. which = cssExpand[ i ];
  11012. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  11013. }
  11014. if ( includeWidth ) {
  11015. attrs.opacity = attrs.width = type;
  11016. }
  11017. return attrs;
  11018. }
  11019. function createTween( value, prop, animation ) {
  11020. var tween,
  11021. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  11022. index = 0,
  11023. length = collection.length;
  11024. for ( ; index < length; index++ ) {
  11025. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  11026. // We're done with this property
  11027. return tween;
  11028. }
  11029. }
  11030. }
  11031. function defaultPrefilter( elem, props, opts ) {
  11032. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  11033. isBox = "width" in props || "height" in props,
  11034. anim = this,
  11035. orig = {},
  11036. style = elem.style,
  11037. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  11038. dataShow = dataPriv.get( elem, "fxshow" );
  11039. // Queue-skipping animations hijack the fx hooks
  11040. if ( !opts.queue ) {
  11041. hooks = jQuery._queueHooks( elem, "fx" );
  11042. if ( hooks.unqueued == null ) {
  11043. hooks.unqueued = 0;
  11044. oldfire = hooks.empty.fire;
  11045. hooks.empty.fire = function() {
  11046. if ( !hooks.unqueued ) {
  11047. oldfire();
  11048. }
  11049. };
  11050. }
  11051. hooks.unqueued++;
  11052. anim.always( function() {
  11053. // Ensure the complete handler is called before this completes
  11054. anim.always( function() {
  11055. hooks.unqueued--;
  11056. if ( !jQuery.queue( elem, "fx" ).length ) {
  11057. hooks.empty.fire();
  11058. }
  11059. } );
  11060. } );
  11061. }
  11062. // Detect show/hide animations
  11063. for ( prop in props ) {
  11064. value = props[ prop ];
  11065. if ( rfxtypes.test( value ) ) {
  11066. delete props[ prop ];
  11067. toggle = toggle || value === "toggle";
  11068. if ( value === ( hidden ? "hide" : "show" ) ) {
  11069. // Pretend to be hidden if this is a "show" and
  11070. // there is still data from a stopped show/hide
  11071. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  11072. hidden = true;
  11073. // Ignore all other no-op show/hide data
  11074. } else {
  11075. continue;
  11076. }
  11077. }
  11078. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  11079. }
  11080. }
  11081. // Bail out if this is a no-op like .hide().hide()
  11082. propTween = !jQuery.isEmptyObject( props );
  11083. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  11084. return;
  11085. }
  11086. // Restrict "overflow" and "display" styles during box animations
  11087. if ( isBox && elem.nodeType === 1 ) {
  11088. // Support: IE <=9 - 11, Edge 12 - 15
  11089. // Record all 3 overflow attributes because IE does not infer the shorthand
  11090. // from identically-valued overflowX and overflowY and Edge just mirrors
  11091. // the overflowX value there.
  11092. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  11093. // Identify a display type, preferring old show/hide data over the CSS cascade
  11094. restoreDisplay = dataShow && dataShow.display;
  11095. if ( restoreDisplay == null ) {
  11096. restoreDisplay = dataPriv.get( elem, "display" );
  11097. }
  11098. display = jQuery.css( elem, "display" );
  11099. if ( display === "none" ) {
  11100. if ( restoreDisplay ) {
  11101. display = restoreDisplay;
  11102. } else {
  11103. // Get nonempty value(s) by temporarily forcing visibility
  11104. showHide( [ elem ], true );
  11105. restoreDisplay = elem.style.display || restoreDisplay;
  11106. display = jQuery.css( elem, "display" );
  11107. showHide( [ elem ] );
  11108. }
  11109. }
  11110. // Animate inline elements as inline-block
  11111. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  11112. if ( jQuery.css( elem, "float" ) === "none" ) {
  11113. // Restore the original display value at the end of pure show/hide animations
  11114. if ( !propTween ) {
  11115. anim.done( function() {
  11116. style.display = restoreDisplay;
  11117. } );
  11118. if ( restoreDisplay == null ) {
  11119. display = style.display;
  11120. restoreDisplay = display === "none" ? "" : display;
  11121. }
  11122. }
  11123. style.display = "inline-block";
  11124. }
  11125. }
  11126. }
  11127. if ( opts.overflow ) {
  11128. style.overflow = "hidden";
  11129. anim.always( function() {
  11130. style.overflow = opts.overflow[ 0 ];
  11131. style.overflowX = opts.overflow[ 1 ];
  11132. style.overflowY = opts.overflow[ 2 ];
  11133. } );
  11134. }
  11135. // Implement show/hide animations
  11136. propTween = false;
  11137. for ( prop in orig ) {
  11138. // General show/hide setup for this element animation
  11139. if ( !propTween ) {
  11140. if ( dataShow ) {
  11141. if ( "hidden" in dataShow ) {
  11142. hidden = dataShow.hidden;
  11143. }
  11144. } else {
  11145. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  11146. }
  11147. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  11148. if ( toggle ) {
  11149. dataShow.hidden = !hidden;
  11150. }
  11151. // Show elements before animating them
  11152. if ( hidden ) {
  11153. showHide( [ elem ], true );
  11154. }
  11155. /* eslint-disable no-loop-func */
  11156. anim.done( function() {
  11157. /* eslint-enable no-loop-func */
  11158. // The final step of a "hide" animation is actually hiding the element
  11159. if ( !hidden ) {
  11160. showHide( [ elem ] );
  11161. }
  11162. dataPriv.remove( elem, "fxshow" );
  11163. for ( prop in orig ) {
  11164. jQuery.style( elem, prop, orig[ prop ] );
  11165. }
  11166. } );
  11167. }
  11168. // Per-property setup
  11169. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  11170. if ( !( prop in dataShow ) ) {
  11171. dataShow[ prop ] = propTween.start;
  11172. if ( hidden ) {
  11173. propTween.end = propTween.start;
  11174. propTween.start = 0;
  11175. }
  11176. }
  11177. }
  11178. }
  11179. function propFilter( props, specialEasing ) {
  11180. var index, name, easing, value, hooks;
  11181. // camelCase, specialEasing and expand cssHook pass
  11182. for ( index in props ) {
  11183. name = camelCase( index );
  11184. easing = specialEasing[ name ];
  11185. value = props[ index ];
  11186. if ( Array.isArray( value ) ) {
  11187. easing = value[ 1 ];
  11188. value = props[ index ] = value[ 0 ];
  11189. }
  11190. if ( index !== name ) {
  11191. props[ name ] = value;
  11192. delete props[ index ];
  11193. }
  11194. hooks = jQuery.cssHooks[ name ];
  11195. if ( hooks && "expand" in hooks ) {
  11196. value = hooks.expand( value );
  11197. delete props[ name ];
  11198. // Not quite $.extend, this won't overwrite existing keys.
  11199. // Reusing 'index' because we have the correct "name"
  11200. for ( index in value ) {
  11201. if ( !( index in props ) ) {
  11202. props[ index ] = value[ index ];
  11203. specialEasing[ index ] = easing;
  11204. }
  11205. }
  11206. } else {
  11207. specialEasing[ name ] = easing;
  11208. }
  11209. }
  11210. }
  11211. function Animation( elem, properties, options ) {
  11212. var result,
  11213. stopped,
  11214. index = 0,
  11215. length = Animation.prefilters.length,
  11216. deferred = jQuery.Deferred().always( function() {
  11217. // Don't match elem in the :animated selector
  11218. delete tick.elem;
  11219. } ),
  11220. tick = function() {
  11221. if ( stopped ) {
  11222. return false;
  11223. }
  11224. var currentTime = fxNow || createFxNow(),
  11225. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  11226. // Support: Android 2.3 only
  11227. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  11228. temp = remaining / animation.duration || 0,
  11229. percent = 1 - temp,
  11230. index = 0,
  11231. length = animation.tweens.length;
  11232. for ( ; index < length; index++ ) {
  11233. animation.tweens[ index ].run( percent );
  11234. }
  11235. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  11236. // If there's more to do, yield
  11237. if ( percent < 1 && length ) {
  11238. return remaining;
  11239. }
  11240. // If this was an empty animation, synthesize a final progress notification
  11241. if ( !length ) {
  11242. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11243. }
  11244. // Resolve the animation and report its conclusion
  11245. deferred.resolveWith( elem, [ animation ] );
  11246. return false;
  11247. },
  11248. animation = deferred.promise( {
  11249. elem: elem,
  11250. props: jQuery.extend( {}, properties ),
  11251. opts: jQuery.extend( true, {
  11252. specialEasing: {},
  11253. easing: jQuery.easing._default
  11254. }, options ),
  11255. originalProperties: properties,
  11256. originalOptions: options,
  11257. startTime: fxNow || createFxNow(),
  11258. duration: options.duration,
  11259. tweens: [],
  11260. createTween: function( prop, end ) {
  11261. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  11262. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  11263. animation.tweens.push( tween );
  11264. return tween;
  11265. },
  11266. stop: function( gotoEnd ) {
  11267. var index = 0,
  11268. // If we are going to the end, we want to run all the tweens
  11269. // otherwise we skip this part
  11270. length = gotoEnd ? animation.tweens.length : 0;
  11271. if ( stopped ) {
  11272. return this;
  11273. }
  11274. stopped = true;
  11275. for ( ; index < length; index++ ) {
  11276. animation.tweens[ index ].run( 1 );
  11277. }
  11278. // Resolve when we played the last frame; otherwise, reject
  11279. if ( gotoEnd ) {
  11280. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11281. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  11282. } else {
  11283. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  11284. }
  11285. return this;
  11286. }
  11287. } ),
  11288. props = animation.props;
  11289. propFilter( props, animation.opts.specialEasing );
  11290. for ( ; index < length; index++ ) {
  11291. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  11292. if ( result ) {
  11293. if ( isFunction( result.stop ) ) {
  11294. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  11295. result.stop.bind( result );
  11296. }
  11297. return result;
  11298. }
  11299. }
  11300. jQuery.map( props, createTween, animation );
  11301. if ( isFunction( animation.opts.start ) ) {
  11302. animation.opts.start.call( elem, animation );
  11303. }
  11304. // Attach callbacks from options
  11305. animation
  11306. .progress( animation.opts.progress )
  11307. .done( animation.opts.done, animation.opts.complete )
  11308. .fail( animation.opts.fail )
  11309. .always( animation.opts.always );
  11310. jQuery.fx.timer(
  11311. jQuery.extend( tick, {
  11312. elem: elem,
  11313. anim: animation,
  11314. queue: animation.opts.queue
  11315. } )
  11316. );
  11317. return animation;
  11318. }
  11319. jQuery.Animation = jQuery.extend( Animation, {
  11320. tweeners: {
  11321. "*": [ function( prop, value ) {
  11322. var tween = this.createTween( prop, value );
  11323. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  11324. return tween;
  11325. } ]
  11326. },
  11327. tweener: function( props, callback ) {
  11328. if ( isFunction( props ) ) {
  11329. callback = props;
  11330. props = [ "*" ];
  11331. } else {
  11332. props = props.match( rnothtmlwhite );
  11333. }
  11334. var prop,
  11335. index = 0,
  11336. length = props.length;
  11337. for ( ; index < length; index++ ) {
  11338. prop = props[ index ];
  11339. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  11340. Animation.tweeners[ prop ].unshift( callback );
  11341. }
  11342. },
  11343. prefilters: [ defaultPrefilter ],
  11344. prefilter: function( callback, prepend ) {
  11345. if ( prepend ) {
  11346. Animation.prefilters.unshift( callback );
  11347. } else {
  11348. Animation.prefilters.push( callback );
  11349. }
  11350. }
  11351. } );
  11352. jQuery.speed = function( speed, easing, fn ) {
  11353. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  11354. complete: fn || !fn && easing ||
  11355. isFunction( speed ) && speed,
  11356. duration: speed,
  11357. easing: fn && easing || easing && !isFunction( easing ) && easing
  11358. };
  11359. // Go to the end state if fx are off
  11360. if ( jQuery.fx.off ) {
  11361. opt.duration = 0;
  11362. } else {
  11363. if ( typeof opt.duration !== "number" ) {
  11364. if ( opt.duration in jQuery.fx.speeds ) {
  11365. opt.duration = jQuery.fx.speeds[ opt.duration ];
  11366. } else {
  11367. opt.duration = jQuery.fx.speeds._default;
  11368. }
  11369. }
  11370. }
  11371. // Normalize opt.queue - true/undefined/null -> "fx"
  11372. if ( opt.queue == null || opt.queue === true ) {
  11373. opt.queue = "fx";
  11374. }
  11375. // Queueing
  11376. opt.old = opt.complete;
  11377. opt.complete = function() {
  11378. if ( isFunction( opt.old ) ) {
  11379. opt.old.call( this );
  11380. }
  11381. if ( opt.queue ) {
  11382. jQuery.dequeue( this, opt.queue );
  11383. }
  11384. };
  11385. return opt;
  11386. };
  11387. jQuery.fn.extend( {
  11388. fadeTo: function( speed, to, easing, callback ) {
  11389. // Show any hidden elements after setting opacity to 0
  11390. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  11391. // Animate to the value specified
  11392. .end().animate( { opacity: to }, speed, easing, callback );
  11393. },
  11394. animate: function( prop, speed, easing, callback ) {
  11395. var empty = jQuery.isEmptyObject( prop ),
  11396. optall = jQuery.speed( speed, easing, callback ),
  11397. doAnimation = function() {
  11398. // Operate on a copy of prop so per-property easing won't be lost
  11399. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  11400. // Empty animations, or finishing resolves immediately
  11401. if ( empty || dataPriv.get( this, "finish" ) ) {
  11402. anim.stop( true );
  11403. }
  11404. };
  11405. doAnimation.finish = doAnimation;
  11406. return empty || optall.queue === false ?
  11407. this.each( doAnimation ) :
  11408. this.queue( optall.queue, doAnimation );
  11409. },
  11410. stop: function( type, clearQueue, gotoEnd ) {
  11411. var stopQueue = function( hooks ) {
  11412. var stop = hooks.stop;
  11413. delete hooks.stop;
  11414. stop( gotoEnd );
  11415. };
  11416. if ( typeof type !== "string" ) {
  11417. gotoEnd = clearQueue;
  11418. clearQueue = type;
  11419. type = undefined;
  11420. }
  11421. if ( clearQueue && type !== false ) {
  11422. this.queue( type || "fx", [] );
  11423. }
  11424. return this.each( function() {
  11425. var dequeue = true,
  11426. index = type != null && type + "queueHooks",
  11427. timers = jQuery.timers,
  11428. data = dataPriv.get( this );
  11429. if ( index ) {
  11430. if ( data[ index ] && data[ index ].stop ) {
  11431. stopQueue( data[ index ] );
  11432. }
  11433. } else {
  11434. for ( index in data ) {
  11435. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  11436. stopQueue( data[ index ] );
  11437. }
  11438. }
  11439. }
  11440. for ( index = timers.length; index--; ) {
  11441. if ( timers[ index ].elem === this &&
  11442. ( type == null || timers[ index ].queue === type ) ) {
  11443. timers[ index ].anim.stop( gotoEnd );
  11444. dequeue = false;
  11445. timers.splice( index, 1 );
  11446. }
  11447. }
  11448. // Start the next in the queue if the last step wasn't forced.
  11449. // Timers currently will call their complete callbacks, which
  11450. // will dequeue but only if they were gotoEnd.
  11451. if ( dequeue || !gotoEnd ) {
  11452. jQuery.dequeue( this, type );
  11453. }
  11454. } );
  11455. },
  11456. finish: function( type ) {
  11457. if ( type !== false ) {
  11458. type = type || "fx";
  11459. }
  11460. return this.each( function() {
  11461. var index,
  11462. data = dataPriv.get( this ),
  11463. queue = data[ type + "queue" ],
  11464. hooks = data[ type + "queueHooks" ],
  11465. timers = jQuery.timers,
  11466. length = queue ? queue.length : 0;
  11467. // Enable finishing flag on private data
  11468. data.finish = true;
  11469. // Empty the queue first
  11470. jQuery.queue( this, type, [] );
  11471. if ( hooks && hooks.stop ) {
  11472. hooks.stop.call( this, true );
  11473. }
  11474. // Look for any active animations, and finish them
  11475. for ( index = timers.length; index--; ) {
  11476. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11477. timers[ index ].anim.stop( true );
  11478. timers.splice( index, 1 );
  11479. }
  11480. }
  11481. // Look for any animations in the old queue and finish them
  11482. for ( index = 0; index < length; index++ ) {
  11483. if ( queue[ index ] && queue[ index ].finish ) {
  11484. queue[ index ].finish.call( this );
  11485. }
  11486. }
  11487. // Turn off finishing flag
  11488. delete data.finish;
  11489. } );
  11490. }
  11491. } );
  11492. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  11493. var cssFn = jQuery.fn[ name ];
  11494. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11495. return speed == null || typeof speed === "boolean" ?
  11496. cssFn.apply( this, arguments ) :
  11497. this.animate( genFx( name, true ), speed, easing, callback );
  11498. };
  11499. } );
  11500. // Generate shortcuts for custom animations
  11501. jQuery.each( {
  11502. slideDown: genFx( "show" ),
  11503. slideUp: genFx( "hide" ),
  11504. slideToggle: genFx( "toggle" ),
  11505. fadeIn: { opacity: "show" },
  11506. fadeOut: { opacity: "hide" },
  11507. fadeToggle: { opacity: "toggle" }
  11508. }, function( name, props ) {
  11509. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11510. return this.animate( props, speed, easing, callback );
  11511. };
  11512. } );
  11513. jQuery.timers = [];
  11514. jQuery.fx.tick = function() {
  11515. var timer,
  11516. i = 0,
  11517. timers = jQuery.timers;
  11518. fxNow = Date.now();
  11519. for ( ; i < timers.length; i++ ) {
  11520. timer = timers[ i ];
  11521. // Run the timer and safely remove it when done (allowing for external removal)
  11522. if ( !timer() && timers[ i ] === timer ) {
  11523. timers.splice( i--, 1 );
  11524. }
  11525. }
  11526. if ( !timers.length ) {
  11527. jQuery.fx.stop();
  11528. }
  11529. fxNow = undefined;
  11530. };
  11531. jQuery.fx.timer = function( timer ) {
  11532. jQuery.timers.push( timer );
  11533. jQuery.fx.start();
  11534. };
  11535. jQuery.fx.interval = 13;
  11536. jQuery.fx.start = function() {
  11537. if ( inProgress ) {
  11538. return;
  11539. }
  11540. inProgress = true;
  11541. schedule();
  11542. };
  11543. jQuery.fx.stop = function() {
  11544. inProgress = null;
  11545. };
  11546. jQuery.fx.speeds = {
  11547. slow: 600,
  11548. fast: 200,
  11549. // Default speed
  11550. _default: 400
  11551. };
  11552. // Based off of the plugin by Clint Helfers, with permission.
  11553. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11554. jQuery.fn.delay = function( time, type ) {
  11555. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11556. type = type || "fx";
  11557. return this.queue( type, function( next, hooks ) {
  11558. var timeout = window.setTimeout( next, time );
  11559. hooks.stop = function() {
  11560. window.clearTimeout( timeout );
  11561. };
  11562. } );
  11563. };
  11564. ( function() {
  11565. var input = document.createElement( "input" ),
  11566. select = document.createElement( "select" ),
  11567. opt = select.appendChild( document.createElement( "option" ) );
  11568. input.type = "checkbox";
  11569. // Support: Android <=4.3 only
  11570. // Default value for a checkbox should be "on"
  11571. support.checkOn = input.value !== "";
  11572. // Support: IE <=11 only
  11573. // Must access selectedIndex to make default options select
  11574. support.optSelected = opt.selected;
  11575. // Support: IE <=11 only
  11576. // An input loses its value after becoming a radio
  11577. input = document.createElement( "input" );
  11578. input.value = "t";
  11579. input.type = "radio";
  11580. support.radioValue = input.value === "t";
  11581. } )();
  11582. var boolHook,
  11583. attrHandle = jQuery.expr.attrHandle;
  11584. jQuery.fn.extend( {
  11585. attr: function( name, value ) {
  11586. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11587. },
  11588. removeAttr: function( name ) {
  11589. return this.each( function() {
  11590. jQuery.removeAttr( this, name );
  11591. } );
  11592. }
  11593. } );
  11594. jQuery.extend( {
  11595. attr: function( elem, name, value ) {
  11596. var ret, hooks,
  11597. nType = elem.nodeType;
  11598. // Don't get/set attributes on text, comment and attribute nodes
  11599. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11600. return;
  11601. }
  11602. // Fallback to prop when attributes are not supported
  11603. if ( typeof elem.getAttribute === "undefined" ) {
  11604. return jQuery.prop( elem, name, value );
  11605. }
  11606. // Attribute hooks are determined by the lowercase version
  11607. // Grab necessary hook if one is defined
  11608. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11609. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11610. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11611. }
  11612. if ( value !== undefined ) {
  11613. if ( value === null ) {
  11614. jQuery.removeAttr( elem, name );
  11615. return;
  11616. }
  11617. if ( hooks && "set" in hooks &&
  11618. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11619. return ret;
  11620. }
  11621. elem.setAttribute( name, value + "" );
  11622. return value;
  11623. }
  11624. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11625. return ret;
  11626. }
  11627. ret = jQuery.find.attr( elem, name );
  11628. // Non-existent attributes return null, we normalize to undefined
  11629. return ret == null ? undefined : ret;
  11630. },
  11631. attrHooks: {
  11632. type: {
  11633. set: function( elem, value ) {
  11634. if ( !support.radioValue && value === "radio" &&
  11635. nodeName( elem, "input" ) ) {
  11636. var val = elem.value;
  11637. elem.setAttribute( "type", value );
  11638. if ( val ) {
  11639. elem.value = val;
  11640. }
  11641. return value;
  11642. }
  11643. }
  11644. }
  11645. },
  11646. removeAttr: function( elem, value ) {
  11647. var name,
  11648. i = 0,
  11649. // Attribute names can contain non-HTML whitespace characters
  11650. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11651. attrNames = value && value.match( rnothtmlwhite );
  11652. if ( attrNames && elem.nodeType === 1 ) {
  11653. while ( ( name = attrNames[ i++ ] ) ) {
  11654. elem.removeAttribute( name );
  11655. }
  11656. }
  11657. }
  11658. } );
  11659. // Hooks for boolean attributes
  11660. boolHook = {
  11661. set: function( elem, value, name ) {
  11662. if ( value === false ) {
  11663. // Remove boolean attributes when set to false
  11664. jQuery.removeAttr( elem, name );
  11665. } else {
  11666. elem.setAttribute( name, name );
  11667. }
  11668. return name;
  11669. }
  11670. };
  11671. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  11672. var getter = attrHandle[ name ] || jQuery.find.attr;
  11673. attrHandle[ name ] = function( elem, name, isXML ) {
  11674. var ret, handle,
  11675. lowercaseName = name.toLowerCase();
  11676. if ( !isXML ) {
  11677. // Avoid an infinite loop by temporarily removing this function from the getter
  11678. handle = attrHandle[ lowercaseName ];
  11679. attrHandle[ lowercaseName ] = ret;
  11680. ret = getter( elem, name, isXML ) != null ?
  11681. lowercaseName :
  11682. null;
  11683. attrHandle[ lowercaseName ] = handle;
  11684. }
  11685. return ret;
  11686. };
  11687. } );
  11688. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11689. rclickable = /^(?:a|area)$/i;
  11690. jQuery.fn.extend( {
  11691. prop: function( name, value ) {
  11692. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11693. },
  11694. removeProp: function( name ) {
  11695. return this.each( function() {
  11696. delete this[ jQuery.propFix[ name ] || name ];
  11697. } );
  11698. }
  11699. } );
  11700. jQuery.extend( {
  11701. prop: function( elem, name, value ) {
  11702. var ret, hooks,
  11703. nType = elem.nodeType;
  11704. // Don't get/set properties on text, comment and attribute nodes
  11705. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11706. return;
  11707. }
  11708. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11709. // Fix name and attach hooks
  11710. name = jQuery.propFix[ name ] || name;
  11711. hooks = jQuery.propHooks[ name ];
  11712. }
  11713. if ( value !== undefined ) {
  11714. if ( hooks && "set" in hooks &&
  11715. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11716. return ret;
  11717. }
  11718. return ( elem[ name ] = value );
  11719. }
  11720. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11721. return ret;
  11722. }
  11723. return elem[ name ];
  11724. },
  11725. propHooks: {
  11726. tabIndex: {
  11727. get: function( elem ) {
  11728. // Support: IE <=9 - 11 only
  11729. // elem.tabIndex doesn't always return the
  11730. // correct value when it hasn't been explicitly set
  11731. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11732. // Use proper attribute retrieval(#12072)
  11733. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11734. if ( tabindex ) {
  11735. return parseInt( tabindex, 10 );
  11736. }
  11737. if (
  11738. rfocusable.test( elem.nodeName ) ||
  11739. rclickable.test( elem.nodeName ) &&
  11740. elem.href
  11741. ) {
  11742. return 0;
  11743. }
  11744. return -1;
  11745. }
  11746. }
  11747. },
  11748. propFix: {
  11749. "for": "htmlFor",
  11750. "class": "className"
  11751. }
  11752. } );
  11753. // Support: IE <=11 only
  11754. // Accessing the selectedIndex property
  11755. // forces the browser to respect setting selected
  11756. // on the option
  11757. // The getter ensures a default option is selected
  11758. // when in an optgroup
  11759. // eslint rule "no-unused-expressions" is disabled for this code
  11760. // since it considers such accessions noop
  11761. if ( !support.optSelected ) {
  11762. jQuery.propHooks.selected = {
  11763. get: function( elem ) {
  11764. /* eslint no-unused-expressions: "off" */
  11765. var parent = elem.parentNode;
  11766. if ( parent && parent.parentNode ) {
  11767. parent.parentNode.selectedIndex;
  11768. }
  11769. return null;
  11770. },
  11771. set: function( elem ) {
  11772. /* eslint no-unused-expressions: "off" */
  11773. var parent = elem.parentNode;
  11774. if ( parent ) {
  11775. parent.selectedIndex;
  11776. if ( parent.parentNode ) {
  11777. parent.parentNode.selectedIndex;
  11778. }
  11779. }
  11780. }
  11781. };
  11782. }
  11783. jQuery.each( [
  11784. "tabIndex",
  11785. "readOnly",
  11786. "maxLength",
  11787. "cellSpacing",
  11788. "cellPadding",
  11789. "rowSpan",
  11790. "colSpan",
  11791. "useMap",
  11792. "frameBorder",
  11793. "contentEditable"
  11794. ], function() {
  11795. jQuery.propFix[ this.toLowerCase() ] = this;
  11796. } );
  11797. // Strip and collapse whitespace according to HTML spec
  11798. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11799. function stripAndCollapse( value ) {
  11800. var tokens = value.match( rnothtmlwhite ) || [];
  11801. return tokens.join( " " );
  11802. }
  11803. function getClass( elem ) {
  11804. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11805. }
  11806. function classesToArray( value ) {
  11807. if ( Array.isArray( value ) ) {
  11808. return value;
  11809. }
  11810. if ( typeof value === "string" ) {
  11811. return value.match( rnothtmlwhite ) || [];
  11812. }
  11813. return [];
  11814. }
  11815. jQuery.fn.extend( {
  11816. addClass: function( value ) {
  11817. var classes, elem, cur, curValue, clazz, j, finalValue,
  11818. i = 0;
  11819. if ( isFunction( value ) ) {
  11820. return this.each( function( j ) {
  11821. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11822. } );
  11823. }
  11824. classes = classesToArray( value );
  11825. if ( classes.length ) {
  11826. while ( ( elem = this[ i++ ] ) ) {
  11827. curValue = getClass( elem );
  11828. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11829. if ( cur ) {
  11830. j = 0;
  11831. while ( ( clazz = classes[ j++ ] ) ) {
  11832. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11833. cur += clazz + " ";
  11834. }
  11835. }
  11836. // Only assign if different to avoid unneeded rendering.
  11837. finalValue = stripAndCollapse( cur );
  11838. if ( curValue !== finalValue ) {
  11839. elem.setAttribute( "class", finalValue );
  11840. }
  11841. }
  11842. }
  11843. }
  11844. return this;
  11845. },
  11846. removeClass: function( value ) {
  11847. var classes, elem, cur, curValue, clazz, j, finalValue,
  11848. i = 0;
  11849. if ( isFunction( value ) ) {
  11850. return this.each( function( j ) {
  11851. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11852. } );
  11853. }
  11854. if ( !arguments.length ) {
  11855. return this.attr( "class", "" );
  11856. }
  11857. classes = classesToArray( value );
  11858. if ( classes.length ) {
  11859. while ( ( elem = this[ i++ ] ) ) {
  11860. curValue = getClass( elem );
  11861. // This expression is here for better compressibility (see addClass)
  11862. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11863. if ( cur ) {
  11864. j = 0;
  11865. while ( ( clazz = classes[ j++ ] ) ) {
  11866. // Remove *all* instances
  11867. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11868. cur = cur.replace( " " + clazz + " ", " " );
  11869. }
  11870. }
  11871. // Only assign if different to avoid unneeded rendering.
  11872. finalValue = stripAndCollapse( cur );
  11873. if ( curValue !== finalValue ) {
  11874. elem.setAttribute( "class", finalValue );
  11875. }
  11876. }
  11877. }
  11878. }
  11879. return this;
  11880. },
  11881. toggleClass: function( value, stateVal ) {
  11882. var type = typeof value,
  11883. isValidValue = type === "string" || Array.isArray( value );
  11884. if ( typeof stateVal === "boolean" && isValidValue ) {
  11885. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11886. }
  11887. if ( isFunction( value ) ) {
  11888. return this.each( function( i ) {
  11889. jQuery( this ).toggleClass(
  11890. value.call( this, i, getClass( this ), stateVal ),
  11891. stateVal
  11892. );
  11893. } );
  11894. }
  11895. return this.each( function() {
  11896. var className, i, self, classNames;
  11897. if ( isValidValue ) {
  11898. // Toggle individual class names
  11899. i = 0;
  11900. self = jQuery( this );
  11901. classNames = classesToArray( value );
  11902. while ( ( className = classNames[ i++ ] ) ) {
  11903. // Check each className given, space separated list
  11904. if ( self.hasClass( className ) ) {
  11905. self.removeClass( className );
  11906. } else {
  11907. self.addClass( className );
  11908. }
  11909. }
  11910. // Toggle whole class name
  11911. } else if ( value === undefined || type === "boolean" ) {
  11912. className = getClass( this );
  11913. if ( className ) {
  11914. // Store className if set
  11915. dataPriv.set( this, "__className__", className );
  11916. }
  11917. // If the element has a class name or if we're passed `false`,
  11918. // then remove the whole classname (if there was one, the above saved it).
  11919. // Otherwise bring back whatever was previously saved (if anything),
  11920. // falling back to the empty string if nothing was stored.
  11921. if ( this.setAttribute ) {
  11922. this.setAttribute( "class",
  11923. className || value === false ?
  11924. "" :
  11925. dataPriv.get( this, "__className__" ) || ""
  11926. );
  11927. }
  11928. }
  11929. } );
  11930. },
  11931. hasClass: function( selector ) {
  11932. var className, elem,
  11933. i = 0;
  11934. className = " " + selector + " ";
  11935. while ( ( elem = this[ i++ ] ) ) {
  11936. if ( elem.nodeType === 1 &&
  11937. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  11938. return true;
  11939. }
  11940. }
  11941. return false;
  11942. }
  11943. } );
  11944. var rreturn = /\r/g;
  11945. jQuery.fn.extend( {
  11946. val: function( value ) {
  11947. var hooks, ret, valueIsFunction,
  11948. elem = this[ 0 ];
  11949. if ( !arguments.length ) {
  11950. if ( elem ) {
  11951. hooks = jQuery.valHooks[ elem.type ] ||
  11952. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  11953. if ( hooks &&
  11954. "get" in hooks &&
  11955. ( ret = hooks.get( elem, "value" ) ) !== undefined
  11956. ) {
  11957. return ret;
  11958. }
  11959. ret = elem.value;
  11960. // Handle most common string cases
  11961. if ( typeof ret === "string" ) {
  11962. return ret.replace( rreturn, "" );
  11963. }
  11964. // Handle cases where value is null/undef or number
  11965. return ret == null ? "" : ret;
  11966. }
  11967. return;
  11968. }
  11969. valueIsFunction = isFunction( value );
  11970. return this.each( function( i ) {
  11971. var val;
  11972. if ( this.nodeType !== 1 ) {
  11973. return;
  11974. }
  11975. if ( valueIsFunction ) {
  11976. val = value.call( this, i, jQuery( this ).val() );
  11977. } else {
  11978. val = value;
  11979. }
  11980. // Treat null/undefined as ""; convert numbers to string
  11981. if ( val == null ) {
  11982. val = "";
  11983. } else if ( typeof val === "number" ) {
  11984. val += "";
  11985. } else if ( Array.isArray( val ) ) {
  11986. val = jQuery.map( val, function( value ) {
  11987. return value == null ? "" : value + "";
  11988. } );
  11989. }
  11990. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  11991. // If set returns undefined, fall back to normal setting
  11992. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  11993. this.value = val;
  11994. }
  11995. } );
  11996. }
  11997. } );
  11998. jQuery.extend( {
  11999. valHooks: {
  12000. option: {
  12001. get: function( elem ) {
  12002. var val = jQuery.find.attr( elem, "value" );
  12003. return val != null ?
  12004. val :
  12005. // Support: IE <=10 - 11 only
  12006. // option.text throws exceptions (#14686, #14858)
  12007. // Strip and collapse whitespace
  12008. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  12009. stripAndCollapse( jQuery.text( elem ) );
  12010. }
  12011. },
  12012. select: {
  12013. get: function( elem ) {
  12014. var value, option, i,
  12015. options = elem.options,
  12016. index = elem.selectedIndex,
  12017. one = elem.type === "select-one",
  12018. values = one ? null : [],
  12019. max = one ? index + 1 : options.length;
  12020. if ( index < 0 ) {
  12021. i = max;
  12022. } else {
  12023. i = one ? index : 0;
  12024. }
  12025. // Loop through all the selected options
  12026. for ( ; i < max; i++ ) {
  12027. option = options[ i ];
  12028. // Support: IE <=9 only
  12029. // IE8-9 doesn't update selected after form reset (#2551)
  12030. if ( ( option.selected || i === index ) &&
  12031. // Don't return options that are disabled or in a disabled optgroup
  12032. !option.disabled &&
  12033. ( !option.parentNode.disabled ||
  12034. !nodeName( option.parentNode, "optgroup" ) ) ) {
  12035. // Get the specific value for the option
  12036. value = jQuery( option ).val();
  12037. // We don't need an array for one selects
  12038. if ( one ) {
  12039. return value;
  12040. }
  12041. // Multi-Selects return an array
  12042. values.push( value );
  12043. }
  12044. }
  12045. return values;
  12046. },
  12047. set: function( elem, value ) {
  12048. var optionSet, option,
  12049. options = elem.options,
  12050. values = jQuery.makeArray( value ),
  12051. i = options.length;
  12052. while ( i-- ) {
  12053. option = options[ i ];
  12054. /* eslint-disable no-cond-assign */
  12055. if ( option.selected =
  12056. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  12057. ) {
  12058. optionSet = true;
  12059. }
  12060. /* eslint-enable no-cond-assign */
  12061. }
  12062. // Force browsers to behave consistently when non-matching value is set
  12063. if ( !optionSet ) {
  12064. elem.selectedIndex = -1;
  12065. }
  12066. return values;
  12067. }
  12068. }
  12069. }
  12070. } );
  12071. // Radios and checkboxes getter/setter
  12072. jQuery.each( [ "radio", "checkbox" ], function() {
  12073. jQuery.valHooks[ this ] = {
  12074. set: function( elem, value ) {
  12075. if ( Array.isArray( value ) ) {
  12076. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  12077. }
  12078. }
  12079. };
  12080. if ( !support.checkOn ) {
  12081. jQuery.valHooks[ this ].get = function( elem ) {
  12082. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  12083. };
  12084. }
  12085. } );
  12086. // Return jQuery for attributes-only inclusion
  12087. support.focusin = "onfocusin" in window;
  12088. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  12089. stopPropagationCallback = function( e ) {
  12090. e.stopPropagation();
  12091. };
  12092. jQuery.extend( jQuery.event, {
  12093. trigger: function( event, data, elem, onlyHandlers ) {
  12094. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  12095. eventPath = [ elem || document ],
  12096. type = hasOwn.call( event, "type" ) ? event.type : event,
  12097. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  12098. cur = lastElement = tmp = elem = elem || document;
  12099. // Don't do events on text and comment nodes
  12100. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  12101. return;
  12102. }
  12103. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  12104. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  12105. return;
  12106. }
  12107. if ( type.indexOf( "." ) > -1 ) {
  12108. // Namespaced trigger; create a regexp to match event type in handle()
  12109. namespaces = type.split( "." );
  12110. type = namespaces.shift();
  12111. namespaces.sort();
  12112. }
  12113. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  12114. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  12115. event = event[ jQuery.expando ] ?
  12116. event :
  12117. new jQuery.Event( type, typeof event === "object" && event );
  12118. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  12119. event.isTrigger = onlyHandlers ? 2 : 3;
  12120. event.namespace = namespaces.join( "." );
  12121. event.rnamespace = event.namespace ?
  12122. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  12123. null;
  12124. // Clean up the event in case it is being reused
  12125. event.result = undefined;
  12126. if ( !event.target ) {
  12127. event.target = elem;
  12128. }
  12129. // Clone any incoming data and prepend the event, creating the handler arg list
  12130. data = data == null ?
  12131. [ event ] :
  12132. jQuery.makeArray( data, [ event ] );
  12133. // Allow special events to draw outside the lines
  12134. special = jQuery.event.special[ type ] || {};
  12135. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  12136. return;
  12137. }
  12138. // Determine event propagation path in advance, per W3C events spec (#9951)
  12139. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  12140. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  12141. bubbleType = special.delegateType || type;
  12142. if ( !rfocusMorph.test( bubbleType + type ) ) {
  12143. cur = cur.parentNode;
  12144. }
  12145. for ( ; cur; cur = cur.parentNode ) {
  12146. eventPath.push( cur );
  12147. tmp = cur;
  12148. }
  12149. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  12150. if ( tmp === ( elem.ownerDocument || document ) ) {
  12151. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  12152. }
  12153. }
  12154. // Fire handlers on the event path
  12155. i = 0;
  12156. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  12157. lastElement = cur;
  12158. event.type = i > 1 ?
  12159. bubbleType :
  12160. special.bindType || type;
  12161. // jQuery handler
  12162. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  12163. dataPriv.get( cur, "handle" );
  12164. if ( handle ) {
  12165. handle.apply( cur, data );
  12166. }
  12167. // Native handler
  12168. handle = ontype && cur[ ontype ];
  12169. if ( handle && handle.apply && acceptData( cur ) ) {
  12170. event.result = handle.apply( cur, data );
  12171. if ( event.result === false ) {
  12172. event.preventDefault();
  12173. }
  12174. }
  12175. }
  12176. event.type = type;
  12177. // If nobody prevented the default action, do it now
  12178. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  12179. if ( ( !special._default ||
  12180. special._default.apply( eventPath.pop(), data ) === false ) &&
  12181. acceptData( elem ) ) {
  12182. // Call a native DOM method on the target with the same name as the event.
  12183. // Don't do default actions on window, that's where global variables be (#6170)
  12184. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  12185. // Don't re-trigger an onFOO event when we call its FOO() method
  12186. tmp = elem[ ontype ];
  12187. if ( tmp ) {
  12188. elem[ ontype ] = null;
  12189. }
  12190. // Prevent re-triggering of the same event, since we already bubbled it above
  12191. jQuery.event.triggered = type;
  12192. if ( event.isPropagationStopped() ) {
  12193. lastElement.addEventListener( type, stopPropagationCallback );
  12194. }
  12195. elem[ type ]();
  12196. if ( event.isPropagationStopped() ) {
  12197. lastElement.removeEventListener( type, stopPropagationCallback );
  12198. }
  12199. jQuery.event.triggered = undefined;
  12200. if ( tmp ) {
  12201. elem[ ontype ] = tmp;
  12202. }
  12203. }
  12204. }
  12205. }
  12206. return event.result;
  12207. },
  12208. // Piggyback on a donor event to simulate a different one
  12209. // Used only for `focus(in | out)` events
  12210. simulate: function( type, elem, event ) {
  12211. var e = jQuery.extend(
  12212. new jQuery.Event(),
  12213. event,
  12214. {
  12215. type: type,
  12216. isSimulated: true
  12217. }
  12218. );
  12219. jQuery.event.trigger( e, null, elem );
  12220. }
  12221. } );
  12222. jQuery.fn.extend( {
  12223. trigger: function( type, data ) {
  12224. return this.each( function() {
  12225. jQuery.event.trigger( type, data, this );
  12226. } );
  12227. },
  12228. triggerHandler: function( type, data ) {
  12229. var elem = this[ 0 ];
  12230. if ( elem ) {
  12231. return jQuery.event.trigger( type, data, elem, true );
  12232. }
  12233. }
  12234. } );
  12235. // Support: Firefox <=44
  12236. // Firefox doesn't have focus(in | out) events
  12237. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  12238. //
  12239. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  12240. // focus(in | out) events fire after focus & blur events,
  12241. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  12242. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  12243. if ( !support.focusin ) {
  12244. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  12245. // Attach a single capturing handler on the document while someone wants focusin/focusout
  12246. var handler = function( event ) {
  12247. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  12248. };
  12249. jQuery.event.special[ fix ] = {
  12250. setup: function() {
  12251. var doc = this.ownerDocument || this,
  12252. attaches = dataPriv.access( doc, fix );
  12253. if ( !attaches ) {
  12254. doc.addEventListener( orig, handler, true );
  12255. }
  12256. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  12257. },
  12258. teardown: function() {
  12259. var doc = this.ownerDocument || this,
  12260. attaches = dataPriv.access( doc, fix ) - 1;
  12261. if ( !attaches ) {
  12262. doc.removeEventListener( orig, handler, true );
  12263. dataPriv.remove( doc, fix );
  12264. } else {
  12265. dataPriv.access( doc, fix, attaches );
  12266. }
  12267. }
  12268. };
  12269. } );
  12270. }
  12271. var location = window.location;
  12272. var nonce = Date.now();
  12273. var rquery = ( /\?/ );
  12274. // Cross-browser xml parsing
  12275. jQuery.parseXML = function( data ) {
  12276. var xml;
  12277. if ( !data || typeof data !== "string" ) {
  12278. return null;
  12279. }
  12280. // Support: IE 9 - 11 only
  12281. // IE throws on parseFromString with invalid input.
  12282. try {
  12283. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  12284. } catch ( e ) {
  12285. xml = undefined;
  12286. }
  12287. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  12288. jQuery.error( "Invalid XML: " + data );
  12289. }
  12290. return xml;
  12291. };
  12292. var
  12293. rbracket = /\[\]$/,
  12294. rCRLF = /\r?\n/g,
  12295. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  12296. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  12297. function buildParams( prefix, obj, traditional, add ) {
  12298. var name;
  12299. if ( Array.isArray( obj ) ) {
  12300. // Serialize array item.
  12301. jQuery.each( obj, function( i, v ) {
  12302. if ( traditional || rbracket.test( prefix ) ) {
  12303. // Treat each array item as a scalar.
  12304. add( prefix, v );
  12305. } else {
  12306. // Item is non-scalar (array or object), encode its numeric index.
  12307. buildParams(
  12308. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  12309. v,
  12310. traditional,
  12311. add
  12312. );
  12313. }
  12314. } );
  12315. } else if ( !traditional && toType( obj ) === "object" ) {
  12316. // Serialize object item.
  12317. for ( name in obj ) {
  12318. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  12319. }
  12320. } else {
  12321. // Serialize scalar item.
  12322. add( prefix, obj );
  12323. }
  12324. }
  12325. // Serialize an array of form elements or a set of
  12326. // key/values into a query string
  12327. jQuery.param = function( a, traditional ) {
  12328. var prefix,
  12329. s = [],
  12330. add = function( key, valueOrFunction ) {
  12331. // If value is a function, invoke it and use its return value
  12332. var value = isFunction( valueOrFunction ) ?
  12333. valueOrFunction() :
  12334. valueOrFunction;
  12335. s[ s.length ] = encodeURIComponent( key ) + "=" +
  12336. encodeURIComponent( value == null ? "" : value );
  12337. };
  12338. if ( a == null ) {
  12339. return "";
  12340. }
  12341. // If an array was passed in, assume that it is an array of form elements.
  12342. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  12343. // Serialize the form elements
  12344. jQuery.each( a, function() {
  12345. add( this.name, this.value );
  12346. } );
  12347. } else {
  12348. // If traditional, encode the "old" way (the way 1.3.2 or older
  12349. // did it), otherwise encode params recursively.
  12350. for ( prefix in a ) {
  12351. buildParams( prefix, a[ prefix ], traditional, add );
  12352. }
  12353. }
  12354. // Return the resulting serialization
  12355. return s.join( "&" );
  12356. };
  12357. jQuery.fn.extend( {
  12358. serialize: function() {
  12359. return jQuery.param( this.serializeArray() );
  12360. },
  12361. serializeArray: function() {
  12362. return this.map( function() {
  12363. // Can add propHook for "elements" to filter or add form elements
  12364. var elements = jQuery.prop( this, "elements" );
  12365. return elements ? jQuery.makeArray( elements ) : this;
  12366. } )
  12367. .filter( function() {
  12368. var type = this.type;
  12369. // Use .is( ":disabled" ) so that fieldset[disabled] works
  12370. return this.name && !jQuery( this ).is( ":disabled" ) &&
  12371. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  12372. ( this.checked || !rcheckableType.test( type ) );
  12373. } )
  12374. .map( function( i, elem ) {
  12375. var val = jQuery( this ).val();
  12376. if ( val == null ) {
  12377. return null;
  12378. }
  12379. if ( Array.isArray( val ) ) {
  12380. return jQuery.map( val, function( val ) {
  12381. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12382. } );
  12383. }
  12384. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12385. } ).get();
  12386. }
  12387. } );
  12388. var
  12389. r20 = /%20/g,
  12390. rhash = /#.*$/,
  12391. rantiCache = /([?&])_=[^&]*/,
  12392. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  12393. // #7653, #8125, #8152: local protocol detection
  12394. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  12395. rnoContent = /^(?:GET|HEAD)$/,
  12396. rprotocol = /^\/\//,
  12397. /* Prefilters
  12398. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  12399. * 2) These are called:
  12400. * - BEFORE asking for a transport
  12401. * - AFTER param serialization (s.data is a string if s.processData is true)
  12402. * 3) key is the dataType
  12403. * 4) the catchall symbol "*" can be used
  12404. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  12405. */
  12406. prefilters = {},
  12407. /* Transports bindings
  12408. * 1) key is the dataType
  12409. * 2) the catchall symbol "*" can be used
  12410. * 3) selection will start with transport dataType and THEN go to "*" if needed
  12411. */
  12412. transports = {},
  12413. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  12414. allTypes = "*/".concat( "*" ),
  12415. // Anchor tag for parsing the document origin
  12416. originAnchor = document.createElement( "a" );
  12417. originAnchor.href = location.href;
  12418. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  12419. function addToPrefiltersOrTransports( structure ) {
  12420. // dataTypeExpression is optional and defaults to "*"
  12421. return function( dataTypeExpression, func ) {
  12422. if ( typeof dataTypeExpression !== "string" ) {
  12423. func = dataTypeExpression;
  12424. dataTypeExpression = "*";
  12425. }
  12426. var dataType,
  12427. i = 0,
  12428. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  12429. if ( isFunction( func ) ) {
  12430. // For each dataType in the dataTypeExpression
  12431. while ( ( dataType = dataTypes[ i++ ] ) ) {
  12432. // Prepend if requested
  12433. if ( dataType[ 0 ] === "+" ) {
  12434. dataType = dataType.slice( 1 ) || "*";
  12435. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  12436. // Otherwise append
  12437. } else {
  12438. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  12439. }
  12440. }
  12441. }
  12442. };
  12443. }
  12444. // Base inspection function for prefilters and transports
  12445. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  12446. var inspected = {},
  12447. seekingTransport = ( structure === transports );
  12448. function inspect( dataType ) {
  12449. var selected;
  12450. inspected[ dataType ] = true;
  12451. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  12452. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  12453. if ( typeof dataTypeOrTransport === "string" &&
  12454. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  12455. options.dataTypes.unshift( dataTypeOrTransport );
  12456. inspect( dataTypeOrTransport );
  12457. return false;
  12458. } else if ( seekingTransport ) {
  12459. return !( selected = dataTypeOrTransport );
  12460. }
  12461. } );
  12462. return selected;
  12463. }
  12464. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12465. }
  12466. // A special extend for ajax options
  12467. // that takes "flat" options (not to be deep extended)
  12468. // Fixes #9887
  12469. function ajaxExtend( target, src ) {
  12470. var key, deep,
  12471. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12472. for ( key in src ) {
  12473. if ( src[ key ] !== undefined ) {
  12474. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12475. }
  12476. }
  12477. if ( deep ) {
  12478. jQuery.extend( true, target, deep );
  12479. }
  12480. return target;
  12481. }
  12482. /* Handles responses to an ajax request:
  12483. * - finds the right dataType (mediates between content-type and expected dataType)
  12484. * - returns the corresponding response
  12485. */
  12486. function ajaxHandleResponses( s, jqXHR, responses ) {
  12487. var ct, type, finalDataType, firstDataType,
  12488. contents = s.contents,
  12489. dataTypes = s.dataTypes;
  12490. // Remove auto dataType and get content-type in the process
  12491. while ( dataTypes[ 0 ] === "*" ) {
  12492. dataTypes.shift();
  12493. if ( ct === undefined ) {
  12494. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12495. }
  12496. }
  12497. // Check if we're dealing with a known content-type
  12498. if ( ct ) {
  12499. for ( type in contents ) {
  12500. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12501. dataTypes.unshift( type );
  12502. break;
  12503. }
  12504. }
  12505. }
  12506. // Check to see if we have a response for the expected dataType
  12507. if ( dataTypes[ 0 ] in responses ) {
  12508. finalDataType = dataTypes[ 0 ];
  12509. } else {
  12510. // Try convertible dataTypes
  12511. for ( type in responses ) {
  12512. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12513. finalDataType = type;
  12514. break;
  12515. }
  12516. if ( !firstDataType ) {
  12517. firstDataType = type;
  12518. }
  12519. }
  12520. // Or just use first one
  12521. finalDataType = finalDataType || firstDataType;
  12522. }
  12523. // If we found a dataType
  12524. // We add the dataType to the list if needed
  12525. // and return the corresponding response
  12526. if ( finalDataType ) {
  12527. if ( finalDataType !== dataTypes[ 0 ] ) {
  12528. dataTypes.unshift( finalDataType );
  12529. }
  12530. return responses[ finalDataType ];
  12531. }
  12532. }
  12533. /* Chain conversions given the request and the original response
  12534. * Also sets the responseXXX fields on the jqXHR instance
  12535. */
  12536. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12537. var conv2, current, conv, tmp, prev,
  12538. converters = {},
  12539. // Work with a copy of dataTypes in case we need to modify it for conversion
  12540. dataTypes = s.dataTypes.slice();
  12541. // Create converters map with lowercased keys
  12542. if ( dataTypes[ 1 ] ) {
  12543. for ( conv in s.converters ) {
  12544. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12545. }
  12546. }
  12547. current = dataTypes.shift();
  12548. // Convert to each sequential dataType
  12549. while ( current ) {
  12550. if ( s.responseFields[ current ] ) {
  12551. jqXHR[ s.responseFields[ current ] ] = response;
  12552. }
  12553. // Apply the dataFilter if provided
  12554. if ( !prev && isSuccess && s.dataFilter ) {
  12555. response = s.dataFilter( response, s.dataType );
  12556. }
  12557. prev = current;
  12558. current = dataTypes.shift();
  12559. if ( current ) {
  12560. // There's only work to do if current dataType is non-auto
  12561. if ( current === "*" ) {
  12562. current = prev;
  12563. // Convert response if prev dataType is non-auto and differs from current
  12564. } else if ( prev !== "*" && prev !== current ) {
  12565. // Seek a direct converter
  12566. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12567. // If none found, seek a pair
  12568. if ( !conv ) {
  12569. for ( conv2 in converters ) {
  12570. // If conv2 outputs current
  12571. tmp = conv2.split( " " );
  12572. if ( tmp[ 1 ] === current ) {
  12573. // If prev can be converted to accepted input
  12574. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12575. converters[ "* " + tmp[ 0 ] ];
  12576. if ( conv ) {
  12577. // Condense equivalence converters
  12578. if ( conv === true ) {
  12579. conv = converters[ conv2 ];
  12580. // Otherwise, insert the intermediate dataType
  12581. } else if ( converters[ conv2 ] !== true ) {
  12582. current = tmp[ 0 ];
  12583. dataTypes.unshift( tmp[ 1 ] );
  12584. }
  12585. break;
  12586. }
  12587. }
  12588. }
  12589. }
  12590. // Apply converter (if not an equivalence)
  12591. if ( conv !== true ) {
  12592. // Unless errors are allowed to bubble, catch and return them
  12593. if ( conv && s.throws ) {
  12594. response = conv( response );
  12595. } else {
  12596. try {
  12597. response = conv( response );
  12598. } catch ( e ) {
  12599. return {
  12600. state: "parsererror",
  12601. error: conv ? e : "No conversion from " + prev + " to " + current
  12602. };
  12603. }
  12604. }
  12605. }
  12606. }
  12607. }
  12608. }
  12609. return { state: "success", data: response };
  12610. }
  12611. jQuery.extend( {
  12612. // Counter for holding the number of active queries
  12613. active: 0,
  12614. // Last-Modified header cache for next request
  12615. lastModified: {},
  12616. etag: {},
  12617. ajaxSettings: {
  12618. url: location.href,
  12619. type: "GET",
  12620. isLocal: rlocalProtocol.test( location.protocol ),
  12621. global: true,
  12622. processData: true,
  12623. async: true,
  12624. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12625. /*
  12626. timeout: 0,
  12627. data: null,
  12628. dataType: null,
  12629. username: null,
  12630. password: null,
  12631. cache: null,
  12632. throws: false,
  12633. traditional: false,
  12634. headers: {},
  12635. */
  12636. accepts: {
  12637. "*": allTypes,
  12638. text: "text/plain",
  12639. html: "text/html",
  12640. xml: "application/xml, text/xml",
  12641. json: "application/json, text/javascript"
  12642. },
  12643. contents: {
  12644. xml: /\bxml\b/,
  12645. html: /\bhtml/,
  12646. json: /\bjson\b/
  12647. },
  12648. responseFields: {
  12649. xml: "responseXML",
  12650. text: "responseText",
  12651. json: "responseJSON"
  12652. },
  12653. // Data converters
  12654. // Keys separate source (or catchall "*") and destination types with a single space
  12655. converters: {
  12656. // Convert anything to text
  12657. "* text": String,
  12658. // Text to html (true = no transformation)
  12659. "text html": true,
  12660. // Evaluate text as a json expression
  12661. "text json": JSON.parse,
  12662. // Parse text as xml
  12663. "text xml": jQuery.parseXML
  12664. },
  12665. // For options that shouldn't be deep extended:
  12666. // you can add your own custom options here if
  12667. // and when you create one that shouldn't be
  12668. // deep extended (see ajaxExtend)
  12669. flatOptions: {
  12670. url: true,
  12671. context: true
  12672. }
  12673. },
  12674. // Creates a full fledged settings object into target
  12675. // with both ajaxSettings and settings fields.
  12676. // If target is omitted, writes into ajaxSettings.
  12677. ajaxSetup: function( target, settings ) {
  12678. return settings ?
  12679. // Building a settings object
  12680. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12681. // Extending ajaxSettings
  12682. ajaxExtend( jQuery.ajaxSettings, target );
  12683. },
  12684. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12685. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12686. // Main method
  12687. ajax: function( url, options ) {
  12688. // If url is an object, simulate pre-1.5 signature
  12689. if ( typeof url === "object" ) {
  12690. options = url;
  12691. url = undefined;
  12692. }
  12693. // Force options to be an object
  12694. options = options || {};
  12695. var transport,
  12696. // URL without anti-cache param
  12697. cacheURL,
  12698. // Response headers
  12699. responseHeadersString,
  12700. responseHeaders,
  12701. // timeout handle
  12702. timeoutTimer,
  12703. // Url cleanup var
  12704. urlAnchor,
  12705. // Request state (becomes false upon send and true upon completion)
  12706. completed,
  12707. // To know if global events are to be dispatched
  12708. fireGlobals,
  12709. // Loop variable
  12710. i,
  12711. // uncached part of the url
  12712. uncached,
  12713. // Create the final options object
  12714. s = jQuery.ajaxSetup( {}, options ),
  12715. // Callbacks context
  12716. callbackContext = s.context || s,
  12717. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12718. globalEventContext = s.context &&
  12719. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12720. jQuery( callbackContext ) :
  12721. jQuery.event,
  12722. // Deferreds
  12723. deferred = jQuery.Deferred(),
  12724. completeDeferred = jQuery.Callbacks( "once memory" ),
  12725. // Status-dependent callbacks
  12726. statusCode = s.statusCode || {},
  12727. // Headers (they are sent all at once)
  12728. requestHeaders = {},
  12729. requestHeadersNames = {},
  12730. // Default abort message
  12731. strAbort = "canceled",
  12732. // Fake xhr
  12733. jqXHR = {
  12734. readyState: 0,
  12735. // Builds headers hashtable if needed
  12736. getResponseHeader: function( key ) {
  12737. var match;
  12738. if ( completed ) {
  12739. if ( !responseHeaders ) {
  12740. responseHeaders = {};
  12741. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12742. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  12743. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  12744. .concat( match[ 2 ] );
  12745. }
  12746. }
  12747. match = responseHeaders[ key.toLowerCase() + " " ];
  12748. }
  12749. return match == null ? null : match.join( ", " );
  12750. },
  12751. // Raw string
  12752. getAllResponseHeaders: function() {
  12753. return completed ? responseHeadersString : null;
  12754. },
  12755. // Caches the header
  12756. setRequestHeader: function( name, value ) {
  12757. if ( completed == null ) {
  12758. name = requestHeadersNames[ name.toLowerCase() ] =
  12759. requestHeadersNames[ name.toLowerCase() ] || name;
  12760. requestHeaders[ name ] = value;
  12761. }
  12762. return this;
  12763. },
  12764. // Overrides response content-type header
  12765. overrideMimeType: function( type ) {
  12766. if ( completed == null ) {
  12767. s.mimeType = type;
  12768. }
  12769. return this;
  12770. },
  12771. // Status-dependent callbacks
  12772. statusCode: function( map ) {
  12773. var code;
  12774. if ( map ) {
  12775. if ( completed ) {
  12776. // Execute the appropriate callbacks
  12777. jqXHR.always( map[ jqXHR.status ] );
  12778. } else {
  12779. // Lazy-add the new callbacks in a way that preserves old ones
  12780. for ( code in map ) {
  12781. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12782. }
  12783. }
  12784. }
  12785. return this;
  12786. },
  12787. // Cancel the request
  12788. abort: function( statusText ) {
  12789. var finalText = statusText || strAbort;
  12790. if ( transport ) {
  12791. transport.abort( finalText );
  12792. }
  12793. done( 0, finalText );
  12794. return this;
  12795. }
  12796. };
  12797. // Attach deferreds
  12798. deferred.promise( jqXHR );
  12799. // Add protocol if not provided (prefilters might expect it)
  12800. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12801. // We also use the url parameter if available
  12802. s.url = ( ( url || s.url || location.href ) + "" )
  12803. .replace( rprotocol, location.protocol + "//" );
  12804. // Alias method option to type as per ticket #12004
  12805. s.type = options.method || options.type || s.method || s.type;
  12806. // Extract dataTypes list
  12807. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12808. // A cross-domain request is in order when the origin doesn't match the current origin.
  12809. if ( s.crossDomain == null ) {
  12810. urlAnchor = document.createElement( "a" );
  12811. // Support: IE <=8 - 11, Edge 12 - 15
  12812. // IE throws exception on accessing the href property if url is malformed,
  12813. // e.g. http://example.com:80x/
  12814. try {
  12815. urlAnchor.href = s.url;
  12816. // Support: IE <=8 - 11 only
  12817. // Anchor's host property isn't correctly set when s.url is relative
  12818. urlAnchor.href = urlAnchor.href;
  12819. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12820. urlAnchor.protocol + "//" + urlAnchor.host;
  12821. } catch ( e ) {
  12822. // If there is an error parsing the URL, assume it is crossDomain,
  12823. // it can be rejected by the transport if it is invalid
  12824. s.crossDomain = true;
  12825. }
  12826. }
  12827. // Convert data if not already a string
  12828. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12829. s.data = jQuery.param( s.data, s.traditional );
  12830. }
  12831. // Apply prefilters
  12832. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12833. // If request was aborted inside a prefilter, stop there
  12834. if ( completed ) {
  12835. return jqXHR;
  12836. }
  12837. // We can fire global events as of now if asked to
  12838. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12839. fireGlobals = jQuery.event && s.global;
  12840. // Watch for a new set of requests
  12841. if ( fireGlobals && jQuery.active++ === 0 ) {
  12842. jQuery.event.trigger( "ajaxStart" );
  12843. }
  12844. // Uppercase the type
  12845. s.type = s.type.toUpperCase();
  12846. // Determine if request has content
  12847. s.hasContent = !rnoContent.test( s.type );
  12848. // Save the URL in case we're toying with the If-Modified-Since
  12849. // and/or If-None-Match header later on
  12850. // Remove hash to simplify url manipulation
  12851. cacheURL = s.url.replace( rhash, "" );
  12852. // More options handling for requests with no content
  12853. if ( !s.hasContent ) {
  12854. // Remember the hash so we can put it back
  12855. uncached = s.url.slice( cacheURL.length );
  12856. // If data is available and should be processed, append data to url
  12857. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12858. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12859. // #9682: remove data so that it's not used in an eventual retry
  12860. delete s.data;
  12861. }
  12862. // Add or update anti-cache param if needed
  12863. if ( s.cache === false ) {
  12864. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12865. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  12866. }
  12867. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12868. s.url = cacheURL + uncached;
  12869. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12870. } else if ( s.data && s.processData &&
  12871. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12872. s.data = s.data.replace( r20, "+" );
  12873. }
  12874. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12875. if ( s.ifModified ) {
  12876. if ( jQuery.lastModified[ cacheURL ] ) {
  12877. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12878. }
  12879. if ( jQuery.etag[ cacheURL ] ) {
  12880. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12881. }
  12882. }
  12883. // Set the correct header, if data is being sent
  12884. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12885. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12886. }
  12887. // Set the Accepts header for the server, depending on the dataType
  12888. jqXHR.setRequestHeader(
  12889. "Accept",
  12890. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12891. s.accepts[ s.dataTypes[ 0 ] ] +
  12892. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  12893. s.accepts[ "*" ]
  12894. );
  12895. // Check for headers option
  12896. for ( i in s.headers ) {
  12897. jqXHR.setRequestHeader( i, s.headers[ i ] );
  12898. }
  12899. // Allow custom headers/mimetypes and early abort
  12900. if ( s.beforeSend &&
  12901. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  12902. // Abort if not done already and return
  12903. return jqXHR.abort();
  12904. }
  12905. // Aborting is no longer a cancellation
  12906. strAbort = "abort";
  12907. // Install callbacks on deferreds
  12908. completeDeferred.add( s.complete );
  12909. jqXHR.done( s.success );
  12910. jqXHR.fail( s.error );
  12911. // Get transport
  12912. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  12913. // If no transport, we auto-abort
  12914. if ( !transport ) {
  12915. done( -1, "No Transport" );
  12916. } else {
  12917. jqXHR.readyState = 1;
  12918. // Send global event
  12919. if ( fireGlobals ) {
  12920. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  12921. }
  12922. // If request was aborted inside ajaxSend, stop there
  12923. if ( completed ) {
  12924. return jqXHR;
  12925. }
  12926. // Timeout
  12927. if ( s.async && s.timeout > 0 ) {
  12928. timeoutTimer = window.setTimeout( function() {
  12929. jqXHR.abort( "timeout" );
  12930. }, s.timeout );
  12931. }
  12932. try {
  12933. completed = false;
  12934. transport.send( requestHeaders, done );
  12935. } catch ( e ) {
  12936. // Rethrow post-completion exceptions
  12937. if ( completed ) {
  12938. throw e;
  12939. }
  12940. // Propagate others as results
  12941. done( -1, e );
  12942. }
  12943. }
  12944. // Callback for when everything is done
  12945. function done( status, nativeStatusText, responses, headers ) {
  12946. var isSuccess, success, error, response, modified,
  12947. statusText = nativeStatusText;
  12948. // Ignore repeat invocations
  12949. if ( completed ) {
  12950. return;
  12951. }
  12952. completed = true;
  12953. // Clear timeout if it exists
  12954. if ( timeoutTimer ) {
  12955. window.clearTimeout( timeoutTimer );
  12956. }
  12957. // Dereference transport for early garbage collection
  12958. // (no matter how long the jqXHR object will be used)
  12959. transport = undefined;
  12960. // Cache response headers
  12961. responseHeadersString = headers || "";
  12962. // Set readyState
  12963. jqXHR.readyState = status > 0 ? 4 : 0;
  12964. // Determine if successful
  12965. isSuccess = status >= 200 && status < 300 || status === 304;
  12966. // Get response data
  12967. if ( responses ) {
  12968. response = ajaxHandleResponses( s, jqXHR, responses );
  12969. }
  12970. // Convert no matter what (that way responseXXX fields are always set)
  12971. response = ajaxConvert( s, response, jqXHR, isSuccess );
  12972. // If successful, handle type chaining
  12973. if ( isSuccess ) {
  12974. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12975. if ( s.ifModified ) {
  12976. modified = jqXHR.getResponseHeader( "Last-Modified" );
  12977. if ( modified ) {
  12978. jQuery.lastModified[ cacheURL ] = modified;
  12979. }
  12980. modified = jqXHR.getResponseHeader( "etag" );
  12981. if ( modified ) {
  12982. jQuery.etag[ cacheURL ] = modified;
  12983. }
  12984. }
  12985. // if no content
  12986. if ( status === 204 || s.type === "HEAD" ) {
  12987. statusText = "nocontent";
  12988. // if not modified
  12989. } else if ( status === 304 ) {
  12990. statusText = "notmodified";
  12991. // If we have data, let's convert it
  12992. } else {
  12993. statusText = response.state;
  12994. success = response.data;
  12995. error = response.error;
  12996. isSuccess = !error;
  12997. }
  12998. } else {
  12999. // Extract error from statusText and normalize for non-aborts
  13000. error = statusText;
  13001. if ( status || !statusText ) {
  13002. statusText = "error";
  13003. if ( status < 0 ) {
  13004. status = 0;
  13005. }
  13006. }
  13007. }
  13008. // Set data for the fake xhr object
  13009. jqXHR.status = status;
  13010. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  13011. // Success/Error
  13012. if ( isSuccess ) {
  13013. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  13014. } else {
  13015. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  13016. }
  13017. // Status-dependent callbacks
  13018. jqXHR.statusCode( statusCode );
  13019. statusCode = undefined;
  13020. if ( fireGlobals ) {
  13021. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  13022. [ jqXHR, s, isSuccess ? success : error ] );
  13023. }
  13024. // Complete
  13025. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  13026. if ( fireGlobals ) {
  13027. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  13028. // Handle the global AJAX counter
  13029. if ( !( --jQuery.active ) ) {
  13030. jQuery.event.trigger( "ajaxStop" );
  13031. }
  13032. }
  13033. }
  13034. return jqXHR;
  13035. },
  13036. getJSON: function( url, data, callback ) {
  13037. return jQuery.get( url, data, callback, "json" );
  13038. },
  13039. getScript: function( url, callback ) {
  13040. return jQuery.get( url, undefined, callback, "script" );
  13041. }
  13042. } );
  13043. jQuery.each( [ "get", "post" ], function( i, method ) {
  13044. jQuery[ method ] = function( url, data, callback, type ) {
  13045. // Shift arguments if data argument was omitted
  13046. if ( isFunction( data ) ) {
  13047. type = type || callback;
  13048. callback = data;
  13049. data = undefined;
  13050. }
  13051. // The url can be an options object (which then must have .url)
  13052. return jQuery.ajax( jQuery.extend( {
  13053. url: url,
  13054. type: method,
  13055. dataType: type,
  13056. data: data,
  13057. success: callback
  13058. }, jQuery.isPlainObject( url ) && url ) );
  13059. };
  13060. } );
  13061. jQuery._evalUrl = function( url, options ) {
  13062. return jQuery.ajax( {
  13063. url: url,
  13064. // Make this explicit, since user can override this through ajaxSetup (#11264)
  13065. type: "GET",
  13066. dataType: "script",
  13067. cache: true,
  13068. async: false,
  13069. global: false,
  13070. // Only evaluate the response if it is successful (gh-4126)
  13071. // dataFilter is not invoked for failure responses, so using it instead
  13072. // of the default converter is kludgy but it works.
  13073. converters: {
  13074. "text script": function() {}
  13075. },
  13076. dataFilter: function( response ) {
  13077. jQuery.globalEval( response, options );
  13078. }
  13079. } );
  13080. };
  13081. jQuery.fn.extend( {
  13082. wrapAll: function( html ) {
  13083. var wrap;
  13084. if ( this[ 0 ] ) {
  13085. if ( isFunction( html ) ) {
  13086. html = html.call( this[ 0 ] );
  13087. }
  13088. // The elements to wrap the target around
  13089. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  13090. if ( this[ 0 ].parentNode ) {
  13091. wrap.insertBefore( this[ 0 ] );
  13092. }
  13093. wrap.map( function() {
  13094. var elem = this;
  13095. while ( elem.firstElementChild ) {
  13096. elem = elem.firstElementChild;
  13097. }
  13098. return elem;
  13099. } ).append( this );
  13100. }
  13101. return this;
  13102. },
  13103. wrapInner: function( html ) {
  13104. if ( isFunction( html ) ) {
  13105. return this.each( function( i ) {
  13106. jQuery( this ).wrapInner( html.call( this, i ) );
  13107. } );
  13108. }
  13109. return this.each( function() {
  13110. var self = jQuery( this ),
  13111. contents = self.contents();
  13112. if ( contents.length ) {
  13113. contents.wrapAll( html );
  13114. } else {
  13115. self.append( html );
  13116. }
  13117. } );
  13118. },
  13119. wrap: function( html ) {
  13120. var htmlIsFunction = isFunction( html );
  13121. return this.each( function( i ) {
  13122. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  13123. } );
  13124. },
  13125. unwrap: function( selector ) {
  13126. this.parent( selector ).not( "body" ).each( function() {
  13127. jQuery( this ).replaceWith( this.childNodes );
  13128. } );
  13129. return this;
  13130. }
  13131. } );
  13132. jQuery.expr.pseudos.hidden = function( elem ) {
  13133. return !jQuery.expr.pseudos.visible( elem );
  13134. };
  13135. jQuery.expr.pseudos.visible = function( elem ) {
  13136. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  13137. };
  13138. jQuery.ajaxSettings.xhr = function() {
  13139. try {
  13140. return new window.XMLHttpRequest();
  13141. } catch ( e ) {}
  13142. };
  13143. var xhrSuccessStatus = {
  13144. // File protocol always yields status code 0, assume 200
  13145. 0: 200,
  13146. // Support: IE <=9 only
  13147. // #1450: sometimes IE returns 1223 when it should be 204
  13148. 1223: 204
  13149. },
  13150. xhrSupported = jQuery.ajaxSettings.xhr();
  13151. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  13152. support.ajax = xhrSupported = !!xhrSupported;
  13153. jQuery.ajaxTransport( function( options ) {
  13154. var callback, errorCallback;
  13155. // Cross domain only allowed if supported through XMLHttpRequest
  13156. if ( support.cors || xhrSupported && !options.crossDomain ) {
  13157. return {
  13158. send: function( headers, complete ) {
  13159. var i,
  13160. xhr = options.xhr();
  13161. xhr.open(
  13162. options.type,
  13163. options.url,
  13164. options.async,
  13165. options.username,
  13166. options.password
  13167. );
  13168. // Apply custom fields if provided
  13169. if ( options.xhrFields ) {
  13170. for ( i in options.xhrFields ) {
  13171. xhr[ i ] = options.xhrFields[ i ];
  13172. }
  13173. }
  13174. // Override mime type if needed
  13175. if ( options.mimeType && xhr.overrideMimeType ) {
  13176. xhr.overrideMimeType( options.mimeType );
  13177. }
  13178. // X-Requested-With header
  13179. // For cross-domain requests, seeing as conditions for a preflight are
  13180. // akin to a jigsaw puzzle, we simply never set it to be sure.
  13181. // (it can always be set on a per-request basis or even using ajaxSetup)
  13182. // For same-domain requests, won't change header if already provided.
  13183. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  13184. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  13185. }
  13186. // Set headers
  13187. for ( i in headers ) {
  13188. xhr.setRequestHeader( i, headers[ i ] );
  13189. }
  13190. // Callback
  13191. callback = function( type ) {
  13192. return function() {
  13193. if ( callback ) {
  13194. callback = errorCallback = xhr.onload =
  13195. xhr.onerror = xhr.onabort = xhr.ontimeout =
  13196. xhr.onreadystatechange = null;
  13197. if ( type === "abort" ) {
  13198. xhr.abort();
  13199. } else if ( type === "error" ) {
  13200. // Support: IE <=9 only
  13201. // On a manual native abort, IE9 throws
  13202. // errors on any property access that is not readyState
  13203. if ( typeof xhr.status !== "number" ) {
  13204. complete( 0, "error" );
  13205. } else {
  13206. complete(
  13207. // File: protocol always yields status 0; see #8605, #14207
  13208. xhr.status,
  13209. xhr.statusText
  13210. );
  13211. }
  13212. } else {
  13213. complete(
  13214. xhrSuccessStatus[ xhr.status ] || xhr.status,
  13215. xhr.statusText,
  13216. // Support: IE <=9 only
  13217. // IE9 has no XHR2 but throws on binary (trac-11426)
  13218. // For XHR2 non-text, let the caller handle it (gh-2498)
  13219. ( xhr.responseType || "text" ) !== "text" ||
  13220. typeof xhr.responseText !== "string" ?
  13221. { binary: xhr.response } :
  13222. { text: xhr.responseText },
  13223. xhr.getAllResponseHeaders()
  13224. );
  13225. }
  13226. }
  13227. };
  13228. };
  13229. // Listen to events
  13230. xhr.onload = callback();
  13231. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  13232. // Support: IE 9 only
  13233. // Use onreadystatechange to replace onabort
  13234. // to handle uncaught aborts
  13235. if ( xhr.onabort !== undefined ) {
  13236. xhr.onabort = errorCallback;
  13237. } else {
  13238. xhr.onreadystatechange = function() {
  13239. // Check readyState before timeout as it changes
  13240. if ( xhr.readyState === 4 ) {
  13241. // Allow onerror to be called first,
  13242. // but that will not handle a native abort
  13243. // Also, save errorCallback to a variable
  13244. // as xhr.onerror cannot be accessed
  13245. window.setTimeout( function() {
  13246. if ( callback ) {
  13247. errorCallback();
  13248. }
  13249. } );
  13250. }
  13251. };
  13252. }
  13253. // Create the abort callback
  13254. callback = callback( "abort" );
  13255. try {
  13256. // Do send the request (this may raise an exception)
  13257. xhr.send( options.hasContent && options.data || null );
  13258. } catch ( e ) {
  13259. // #14683: Only rethrow if this hasn't been notified as an error yet
  13260. if ( callback ) {
  13261. throw e;
  13262. }
  13263. }
  13264. },
  13265. abort: function() {
  13266. if ( callback ) {
  13267. callback();
  13268. }
  13269. }
  13270. };
  13271. }
  13272. } );
  13273. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  13274. jQuery.ajaxPrefilter( function( s ) {
  13275. if ( s.crossDomain ) {
  13276. s.contents.script = false;
  13277. }
  13278. } );
  13279. // Install script dataType
  13280. jQuery.ajaxSetup( {
  13281. accepts: {
  13282. script: "text/javascript, application/javascript, " +
  13283. "application/ecmascript, application/x-ecmascript"
  13284. },
  13285. contents: {
  13286. script: /\b(?:java|ecma)script\b/
  13287. },
  13288. converters: {
  13289. "text script": function( text ) {
  13290. jQuery.globalEval( text );
  13291. return text;
  13292. }
  13293. }
  13294. } );
  13295. // Handle cache's special case and crossDomain
  13296. jQuery.ajaxPrefilter( "script", function( s ) {
  13297. if ( s.cache === undefined ) {
  13298. s.cache = false;
  13299. }
  13300. if ( s.crossDomain ) {
  13301. s.type = "GET";
  13302. }
  13303. } );
  13304. // Bind script tag hack transport
  13305. jQuery.ajaxTransport( "script", function( s ) {
  13306. // This transport only deals with cross domain or forced-by-attrs requests
  13307. if ( s.crossDomain || s.scriptAttrs ) {
  13308. var script, callback;
  13309. return {
  13310. send: function( _, complete ) {
  13311. script = jQuery( "<script>" )
  13312. .attr( s.scriptAttrs || {} )
  13313. .prop( { charset: s.scriptCharset, src: s.url } )
  13314. .on( "load error", callback = function( evt ) {
  13315. script.remove();
  13316. callback = null;
  13317. if ( evt ) {
  13318. complete( evt.type === "error" ? 404 : 200, evt.type );
  13319. }
  13320. } );
  13321. // Use native DOM manipulation to avoid our domManip AJAX trickery
  13322. document.head.appendChild( script[ 0 ] );
  13323. },
  13324. abort: function() {
  13325. if ( callback ) {
  13326. callback();
  13327. }
  13328. }
  13329. };
  13330. }
  13331. } );
  13332. var oldCallbacks = [],
  13333. rjsonp = /(=)\?(?=&|$)|\?\?/;
  13334. // Default jsonp settings
  13335. jQuery.ajaxSetup( {
  13336. jsonp: "callback",
  13337. jsonpCallback: function() {
  13338. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  13339. this[ callback ] = true;
  13340. return callback;
  13341. }
  13342. } );
  13343. // Detect, normalize options and install callbacks for jsonp requests
  13344. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  13345. var callbackName, overwritten, responseContainer,
  13346. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  13347. "url" :
  13348. typeof s.data === "string" &&
  13349. ( s.contentType || "" )
  13350. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  13351. rjsonp.test( s.data ) && "data"
  13352. );
  13353. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  13354. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  13355. // Get callback name, remembering preexisting value associated with it
  13356. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  13357. s.jsonpCallback() :
  13358. s.jsonpCallback;
  13359. // Insert callback into url or form data
  13360. if ( jsonProp ) {
  13361. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  13362. } else if ( s.jsonp !== false ) {
  13363. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  13364. }
  13365. // Use data converter to retrieve json after script execution
  13366. s.converters[ "script json" ] = function() {
  13367. if ( !responseContainer ) {
  13368. jQuery.error( callbackName + " was not called" );
  13369. }
  13370. return responseContainer[ 0 ];
  13371. };
  13372. // Force json dataType
  13373. s.dataTypes[ 0 ] = "json";
  13374. // Install callback
  13375. overwritten = window[ callbackName ];
  13376. window[ callbackName ] = function() {
  13377. responseContainer = arguments;
  13378. };
  13379. // Clean-up function (fires after converters)
  13380. jqXHR.always( function() {
  13381. // If previous value didn't exist - remove it
  13382. if ( overwritten === undefined ) {
  13383. jQuery( window ).removeProp( callbackName );
  13384. // Otherwise restore preexisting value
  13385. } else {
  13386. window[ callbackName ] = overwritten;
  13387. }
  13388. // Save back as free
  13389. if ( s[ callbackName ] ) {
  13390. // Make sure that re-using the options doesn't screw things around
  13391. s.jsonpCallback = originalSettings.jsonpCallback;
  13392. // Save the callback name for future use
  13393. oldCallbacks.push( callbackName );
  13394. }
  13395. // Call if it was a function and we have a response
  13396. if ( responseContainer && isFunction( overwritten ) ) {
  13397. overwritten( responseContainer[ 0 ] );
  13398. }
  13399. responseContainer = overwritten = undefined;
  13400. } );
  13401. // Delegate to script
  13402. return "script";
  13403. }
  13404. } );
  13405. // Support: Safari 8 only
  13406. // In Safari 8 documents created via document.implementation.createHTMLDocument
  13407. // collapse sibling forms: the second one becomes a child of the first one.
  13408. // Because of that, this security measure has to be disabled in Safari 8.
  13409. // https://bugs.webkit.org/show_bug.cgi?id=137337
  13410. support.createHTMLDocument = ( function() {
  13411. var body = document.implementation.createHTMLDocument( "" ).body;
  13412. body.innerHTML = "<form></form><form></form>";
  13413. return body.childNodes.length === 2;
  13414. } )();
  13415. // Argument "data" should be string of html
  13416. // context (optional): If specified, the fragment will be created in this context,
  13417. // defaults to document
  13418. // keepScripts (optional): If true, will include scripts passed in the html string
  13419. jQuery.parseHTML = function( data, context, keepScripts ) {
  13420. if ( typeof data !== "string" ) {
  13421. return [];
  13422. }
  13423. if ( typeof context === "boolean" ) {
  13424. keepScripts = context;
  13425. context = false;
  13426. }
  13427. var base, parsed, scripts;
  13428. if ( !context ) {
  13429. // Stop scripts or inline event handlers from being executed immediately
  13430. // by using document.implementation
  13431. if ( support.createHTMLDocument ) {
  13432. context = document.implementation.createHTMLDocument( "" );
  13433. // Set the base href for the created document
  13434. // so any parsed elements with URLs
  13435. // are based on the document's URL (gh-2965)
  13436. base = context.createElement( "base" );
  13437. base.href = document.location.href;
  13438. context.head.appendChild( base );
  13439. } else {
  13440. context = document;
  13441. }
  13442. }
  13443. parsed = rsingleTag.exec( data );
  13444. scripts = !keepScripts && [];
  13445. // Single tag
  13446. if ( parsed ) {
  13447. return [ context.createElement( parsed[ 1 ] ) ];
  13448. }
  13449. parsed = buildFragment( [ data ], context, scripts );
  13450. if ( scripts && scripts.length ) {
  13451. jQuery( scripts ).remove();
  13452. }
  13453. return jQuery.merge( [], parsed.childNodes );
  13454. };
  13455. /**
  13456. * Load a url into a page
  13457. */
  13458. jQuery.fn.load = function( url, params, callback ) {
  13459. var selector, type, response,
  13460. self = this,
  13461. off = url.indexOf( " " );
  13462. if ( off > -1 ) {
  13463. selector = stripAndCollapse( url.slice( off ) );
  13464. url = url.slice( 0, off );
  13465. }
  13466. // If it's a function
  13467. if ( isFunction( params ) ) {
  13468. // We assume that it's the callback
  13469. callback = params;
  13470. params = undefined;
  13471. // Otherwise, build a param string
  13472. } else if ( params && typeof params === "object" ) {
  13473. type = "POST";
  13474. }
  13475. // If we have elements to modify, make the request
  13476. if ( self.length > 0 ) {
  13477. jQuery.ajax( {
  13478. url: url,
  13479. // If "type" variable is undefined, then "GET" method will be used.
  13480. // Make value of this field explicit since
  13481. // user can override it through ajaxSetup method
  13482. type: type || "GET",
  13483. dataType: "html",
  13484. data: params
  13485. } ).done( function( responseText ) {
  13486. // Save response for use in complete callback
  13487. response = arguments;
  13488. self.html( selector ?
  13489. // If a selector was specified, locate the right elements in a dummy div
  13490. // Exclude scripts to avoid IE 'Permission Denied' errors
  13491. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13492. // Otherwise use the full result
  13493. responseText );
  13494. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13495. // but they are ignored because response was set above.
  13496. // If it fails, this function gets "jqXHR", "status", "error"
  13497. } ).always( callback && function( jqXHR, status ) {
  13498. self.each( function() {
  13499. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13500. } );
  13501. } );
  13502. }
  13503. return this;
  13504. };
  13505. // Attach a bunch of functions for handling common AJAX events
  13506. jQuery.each( [
  13507. "ajaxStart",
  13508. "ajaxStop",
  13509. "ajaxComplete",
  13510. "ajaxError",
  13511. "ajaxSuccess",
  13512. "ajaxSend"
  13513. ], function( i, type ) {
  13514. jQuery.fn[ type ] = function( fn ) {
  13515. return this.on( type, fn );
  13516. };
  13517. } );
  13518. jQuery.expr.pseudos.animated = function( elem ) {
  13519. return jQuery.grep( jQuery.timers, function( fn ) {
  13520. return elem === fn.elem;
  13521. } ).length;
  13522. };
  13523. jQuery.offset = {
  13524. setOffset: function( elem, options, i ) {
  13525. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13526. position = jQuery.css( elem, "position" ),
  13527. curElem = jQuery( elem ),
  13528. props = {};
  13529. // Set position first, in-case top/left are set even on static elem
  13530. if ( position === "static" ) {
  13531. elem.style.position = "relative";
  13532. }
  13533. curOffset = curElem.offset();
  13534. curCSSTop = jQuery.css( elem, "top" );
  13535. curCSSLeft = jQuery.css( elem, "left" );
  13536. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13537. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13538. // Need to be able to calculate position if either
  13539. // top or left is auto and position is either absolute or fixed
  13540. if ( calculatePosition ) {
  13541. curPosition = curElem.position();
  13542. curTop = curPosition.top;
  13543. curLeft = curPosition.left;
  13544. } else {
  13545. curTop = parseFloat( curCSSTop ) || 0;
  13546. curLeft = parseFloat( curCSSLeft ) || 0;
  13547. }
  13548. if ( isFunction( options ) ) {
  13549. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13550. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13551. }
  13552. if ( options.top != null ) {
  13553. props.top = ( options.top - curOffset.top ) + curTop;
  13554. }
  13555. if ( options.left != null ) {
  13556. props.left = ( options.left - curOffset.left ) + curLeft;
  13557. }
  13558. if ( "using" in options ) {
  13559. options.using.call( elem, props );
  13560. } else {
  13561. curElem.css( props );
  13562. }
  13563. }
  13564. };
  13565. jQuery.fn.extend( {
  13566. // offset() relates an element's border box to the document origin
  13567. offset: function( options ) {
  13568. // Preserve chaining for setter
  13569. if ( arguments.length ) {
  13570. return options === undefined ?
  13571. this :
  13572. this.each( function( i ) {
  13573. jQuery.offset.setOffset( this, options, i );
  13574. } );
  13575. }
  13576. var rect, win,
  13577. elem = this[ 0 ];
  13578. if ( !elem ) {
  13579. return;
  13580. }
  13581. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13582. // Support: IE <=11 only
  13583. // Running getBoundingClientRect on a
  13584. // disconnected node in IE throws an error
  13585. if ( !elem.getClientRects().length ) {
  13586. return { top: 0, left: 0 };
  13587. }
  13588. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13589. rect = elem.getBoundingClientRect();
  13590. win = elem.ownerDocument.defaultView;
  13591. return {
  13592. top: rect.top + win.pageYOffset,
  13593. left: rect.left + win.pageXOffset
  13594. };
  13595. },
  13596. // position() relates an element's margin box to its offset parent's padding box
  13597. // This corresponds to the behavior of CSS absolute positioning
  13598. position: function() {
  13599. if ( !this[ 0 ] ) {
  13600. return;
  13601. }
  13602. var offsetParent, offset, doc,
  13603. elem = this[ 0 ],
  13604. parentOffset = { top: 0, left: 0 };
  13605. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13606. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13607. // Assume position:fixed implies availability of getBoundingClientRect
  13608. offset = elem.getBoundingClientRect();
  13609. } else {
  13610. offset = this.offset();
  13611. // Account for the *real* offset parent, which can be the document or its root element
  13612. // when a statically positioned element is identified
  13613. doc = elem.ownerDocument;
  13614. offsetParent = elem.offsetParent || doc.documentElement;
  13615. while ( offsetParent &&
  13616. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13617. jQuery.css( offsetParent, "position" ) === "static" ) {
  13618. offsetParent = offsetParent.parentNode;
  13619. }
  13620. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13621. // Incorporate borders into its offset, since they are outside its content origin
  13622. parentOffset = jQuery( offsetParent ).offset();
  13623. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13624. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13625. }
  13626. }
  13627. // Subtract parent offsets and element margins
  13628. return {
  13629. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13630. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13631. };
  13632. },
  13633. // This method will return documentElement in the following cases:
  13634. // 1) For the element inside the iframe without offsetParent, this method will return
  13635. // documentElement of the parent window
  13636. // 2) For the hidden or detached element
  13637. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13638. //
  13639. // but those exceptions were never presented as a real life use-cases
  13640. // and might be considered as more preferable results.
  13641. //
  13642. // This logic, however, is not guaranteed and can change at any point in the future
  13643. offsetParent: function() {
  13644. return this.map( function() {
  13645. var offsetParent = this.offsetParent;
  13646. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13647. offsetParent = offsetParent.offsetParent;
  13648. }
  13649. return offsetParent || documentElement;
  13650. } );
  13651. }
  13652. } );
  13653. // Create scrollLeft and scrollTop methods
  13654. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13655. var top = "pageYOffset" === prop;
  13656. jQuery.fn[ method ] = function( val ) {
  13657. return access( this, function( elem, method, val ) {
  13658. // Coalesce documents and windows
  13659. var win;
  13660. if ( isWindow( elem ) ) {
  13661. win = elem;
  13662. } else if ( elem.nodeType === 9 ) {
  13663. win = elem.defaultView;
  13664. }
  13665. if ( val === undefined ) {
  13666. return win ? win[ prop ] : elem[ method ];
  13667. }
  13668. if ( win ) {
  13669. win.scrollTo(
  13670. !top ? val : win.pageXOffset,
  13671. top ? val : win.pageYOffset
  13672. );
  13673. } else {
  13674. elem[ method ] = val;
  13675. }
  13676. }, method, val, arguments.length );
  13677. };
  13678. } );
  13679. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13680. // Add the top/left cssHooks using jQuery.fn.position
  13681. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13682. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13683. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13684. // rather than make the css module depend on the offset module, just check for it here
  13685. jQuery.each( [ "top", "left" ], function( i, prop ) {
  13686. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13687. function( elem, computed ) {
  13688. if ( computed ) {
  13689. computed = curCSS( elem, prop );
  13690. // If curCSS returns percentage, fallback to offset
  13691. return rnumnonpx.test( computed ) ?
  13692. jQuery( elem ).position()[ prop ] + "px" :
  13693. computed;
  13694. }
  13695. }
  13696. );
  13697. } );
  13698. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13699. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13700. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13701. function( defaultExtra, funcName ) {
  13702. // Margin is only for outerHeight, outerWidth
  13703. jQuery.fn[ funcName ] = function( margin, value ) {
  13704. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13705. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13706. return access( this, function( elem, type, value ) {
  13707. var doc;
  13708. if ( isWindow( elem ) ) {
  13709. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13710. return funcName.indexOf( "outer" ) === 0 ?
  13711. elem[ "inner" + name ] :
  13712. elem.document.documentElement[ "client" + name ];
  13713. }
  13714. // Get document width or height
  13715. if ( elem.nodeType === 9 ) {
  13716. doc = elem.documentElement;
  13717. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13718. // whichever is greatest
  13719. return Math.max(
  13720. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13721. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13722. doc[ "client" + name ]
  13723. );
  13724. }
  13725. return value === undefined ?
  13726. // Get width or height on the element, requesting but not forcing parseFloat
  13727. jQuery.css( elem, type, extra ) :
  13728. // Set width or height on the element
  13729. jQuery.style( elem, type, value, extra );
  13730. }, type, chainable ? margin : undefined, chainable );
  13731. };
  13732. } );
  13733. } );
  13734. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13735. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13736. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13737. function( i, name ) {
  13738. // Handle event binding
  13739. jQuery.fn[ name ] = function( data, fn ) {
  13740. return arguments.length > 0 ?
  13741. this.on( name, null, data, fn ) :
  13742. this.trigger( name );
  13743. };
  13744. } );
  13745. jQuery.fn.extend( {
  13746. hover: function( fnOver, fnOut ) {
  13747. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13748. }
  13749. } );
  13750. jQuery.fn.extend( {
  13751. bind: function( types, data, fn ) {
  13752. return this.on( types, null, data, fn );
  13753. },
  13754. unbind: function( types, fn ) {
  13755. return this.off( types, null, fn );
  13756. },
  13757. delegate: function( selector, types, data, fn ) {
  13758. return this.on( types, selector, data, fn );
  13759. },
  13760. undelegate: function( selector, types, fn ) {
  13761. // ( namespace ) or ( selector, types [, fn] )
  13762. return arguments.length === 1 ?
  13763. this.off( selector, "**" ) :
  13764. this.off( types, selector || "**", fn );
  13765. }
  13766. } );
  13767. // Bind a function to a context, optionally partially applying any
  13768. // arguments.
  13769. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13770. // However, it is not slated for removal any time soon
  13771. jQuery.proxy = function( fn, context ) {
  13772. var tmp, args, proxy;
  13773. if ( typeof context === "string" ) {
  13774. tmp = fn[ context ];
  13775. context = fn;
  13776. fn = tmp;
  13777. }
  13778. // Quick check to determine if target is callable, in the spec
  13779. // this throws a TypeError, but we will just return undefined.
  13780. if ( !isFunction( fn ) ) {
  13781. return undefined;
  13782. }
  13783. // Simulated bind
  13784. args = slice.call( arguments, 2 );
  13785. proxy = function() {
  13786. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13787. };
  13788. // Set the guid of unique handler to the same of original handler, so it can be removed
  13789. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13790. return proxy;
  13791. };
  13792. jQuery.holdReady = function( hold ) {
  13793. if ( hold ) {
  13794. jQuery.readyWait++;
  13795. } else {
  13796. jQuery.ready( true );
  13797. }
  13798. };
  13799. jQuery.isArray = Array.isArray;
  13800. jQuery.parseJSON = JSON.parse;
  13801. jQuery.nodeName = nodeName;
  13802. jQuery.isFunction = isFunction;
  13803. jQuery.isWindow = isWindow;
  13804. jQuery.camelCase = camelCase;
  13805. jQuery.type = toType;
  13806. jQuery.now = Date.now;
  13807. jQuery.isNumeric = function( obj ) {
  13808. // As of jQuery 3.0, isNumeric is limited to
  13809. // strings and numbers (primitives or objects)
  13810. // that can be coerced to finite numbers (gh-2662)
  13811. var type = jQuery.type( obj );
  13812. return ( type === "number" || type === "string" ) &&
  13813. // parseFloat NaNs numeric-cast false positives ("")
  13814. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13815. // subtraction forces infinities to NaN
  13816. !isNaN( obj - parseFloat( obj ) );
  13817. };
  13818. // Register as a named AMD module, since jQuery can be concatenated with other
  13819. // files that may use define, but not via a proper concatenation script that
  13820. // understands anonymous AMD modules. A named AMD is safest and most robust
  13821. // way to register. Lowercase jquery is used because AMD module names are
  13822. // derived from file names, and jQuery is normally delivered in a lowercase
  13823. // file name. Do this after creating the global so that if an AMD module wants
  13824. // to call noConflict to hide this version of jQuery, it will work.
  13825. // Note that for maximum portability, libraries that are not jQuery should
  13826. // declare themselves as anonymous modules, and avoid setting a global if an
  13827. // AMD loader is present. jQuery is a special case. For more information, see
  13828. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13829. if ( true ) {
  13830. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13831. return jQuery;
  13832. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13833. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13834. }
  13835. var
  13836. // Map over jQuery in case of overwrite
  13837. _jQuery = window.jQuery,
  13838. // Map over the $ in case of overwrite
  13839. _$ = window.$;
  13840. jQuery.noConflict = function( deep ) {
  13841. if ( window.$ === jQuery ) {
  13842. window.$ = _$;
  13843. }
  13844. if ( deep && window.jQuery === jQuery ) {
  13845. window.jQuery = _jQuery;
  13846. }
  13847. return jQuery;
  13848. };
  13849. // Expose jQuery and $ identifiers, even in AMD
  13850. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13851. // and CommonJS for browser emulators (#13566)
  13852. if ( !noGlobal ) {
  13853. window.jQuery = window.$ = jQuery;
  13854. }
  13855. return jQuery;
  13856. } );
  13857. /***/ }),
  13858. /***/ "./node_modules/lodash/lodash.js":
  13859. /*!***************************************!*\
  13860. !*** ./node_modules/lodash/lodash.js ***!
  13861. \***************************************/
  13862. /*! no static exports found */
  13863. /***/ (function(module, exports, __webpack_require__) {
  13864. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13865. * @license
  13866. * Lodash <https://lodash.com/>
  13867. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  13868. * Released under MIT license <https://lodash.com/license>
  13869. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13870. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13871. */
  13872. ;(function() {
  13873. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  13874. var undefined;
  13875. /** Used as the semantic version number. */
  13876. var VERSION = '4.17.15';
  13877. /** Used as the size to enable large array optimizations. */
  13878. var LARGE_ARRAY_SIZE = 200;
  13879. /** Error message constants. */
  13880. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  13881. FUNC_ERROR_TEXT = 'Expected a function';
  13882. /** Used to stand-in for `undefined` hash values. */
  13883. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  13884. /** Used as the maximum memoize cache size. */
  13885. var MAX_MEMOIZE_SIZE = 500;
  13886. /** Used as the internal argument placeholder. */
  13887. var PLACEHOLDER = '__lodash_placeholder__';
  13888. /** Used to compose bitmasks for cloning. */
  13889. var CLONE_DEEP_FLAG = 1,
  13890. CLONE_FLAT_FLAG = 2,
  13891. CLONE_SYMBOLS_FLAG = 4;
  13892. /** Used to compose bitmasks for value comparisons. */
  13893. var COMPARE_PARTIAL_FLAG = 1,
  13894. COMPARE_UNORDERED_FLAG = 2;
  13895. /** Used to compose bitmasks for function metadata. */
  13896. var WRAP_BIND_FLAG = 1,
  13897. WRAP_BIND_KEY_FLAG = 2,
  13898. WRAP_CURRY_BOUND_FLAG = 4,
  13899. WRAP_CURRY_FLAG = 8,
  13900. WRAP_CURRY_RIGHT_FLAG = 16,
  13901. WRAP_PARTIAL_FLAG = 32,
  13902. WRAP_PARTIAL_RIGHT_FLAG = 64,
  13903. WRAP_ARY_FLAG = 128,
  13904. WRAP_REARG_FLAG = 256,
  13905. WRAP_FLIP_FLAG = 512;
  13906. /** Used as default options for `_.truncate`. */
  13907. var DEFAULT_TRUNC_LENGTH = 30,
  13908. DEFAULT_TRUNC_OMISSION = '...';
  13909. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  13910. var HOT_COUNT = 800,
  13911. HOT_SPAN = 16;
  13912. /** Used to indicate the type of lazy iteratees. */
  13913. var LAZY_FILTER_FLAG = 1,
  13914. LAZY_MAP_FLAG = 2,
  13915. LAZY_WHILE_FLAG = 3;
  13916. /** Used as references for various `Number` constants. */
  13917. var INFINITY = 1 / 0,
  13918. MAX_SAFE_INTEGER = 9007199254740991,
  13919. MAX_INTEGER = 1.7976931348623157e+308,
  13920. NAN = 0 / 0;
  13921. /** Used as references for the maximum length and index of an array. */
  13922. var MAX_ARRAY_LENGTH = 4294967295,
  13923. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  13924. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  13925. /** Used to associate wrap methods with their bit flags. */
  13926. var wrapFlags = [
  13927. ['ary', WRAP_ARY_FLAG],
  13928. ['bind', WRAP_BIND_FLAG],
  13929. ['bindKey', WRAP_BIND_KEY_FLAG],
  13930. ['curry', WRAP_CURRY_FLAG],
  13931. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  13932. ['flip', WRAP_FLIP_FLAG],
  13933. ['partial', WRAP_PARTIAL_FLAG],
  13934. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  13935. ['rearg', WRAP_REARG_FLAG]
  13936. ];
  13937. /** `Object#toString` result references. */
  13938. var argsTag = '[object Arguments]',
  13939. arrayTag = '[object Array]',
  13940. asyncTag = '[object AsyncFunction]',
  13941. boolTag = '[object Boolean]',
  13942. dateTag = '[object Date]',
  13943. domExcTag = '[object DOMException]',
  13944. errorTag = '[object Error]',
  13945. funcTag = '[object Function]',
  13946. genTag = '[object GeneratorFunction]',
  13947. mapTag = '[object Map]',
  13948. numberTag = '[object Number]',
  13949. nullTag = '[object Null]',
  13950. objectTag = '[object Object]',
  13951. promiseTag = '[object Promise]',
  13952. proxyTag = '[object Proxy]',
  13953. regexpTag = '[object RegExp]',
  13954. setTag = '[object Set]',
  13955. stringTag = '[object String]',
  13956. symbolTag = '[object Symbol]',
  13957. undefinedTag = '[object Undefined]',
  13958. weakMapTag = '[object WeakMap]',
  13959. weakSetTag = '[object WeakSet]';
  13960. var arrayBufferTag = '[object ArrayBuffer]',
  13961. dataViewTag = '[object DataView]',
  13962. float32Tag = '[object Float32Array]',
  13963. float64Tag = '[object Float64Array]',
  13964. int8Tag = '[object Int8Array]',
  13965. int16Tag = '[object Int16Array]',
  13966. int32Tag = '[object Int32Array]',
  13967. uint8Tag = '[object Uint8Array]',
  13968. uint8ClampedTag = '[object Uint8ClampedArray]',
  13969. uint16Tag = '[object Uint16Array]',
  13970. uint32Tag = '[object Uint32Array]';
  13971. /** Used to match empty string literals in compiled template source. */
  13972. var reEmptyStringLeading = /\b__p \+= '';/g,
  13973. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  13974. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  13975. /** Used to match HTML entities and HTML characters. */
  13976. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  13977. reUnescapedHtml = /[&<>"']/g,
  13978. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  13979. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  13980. /** Used to match template delimiters. */
  13981. var reEscape = /<%-([\s\S]+?)%>/g,
  13982. reEvaluate = /<%([\s\S]+?)%>/g,
  13983. reInterpolate = /<%=([\s\S]+?)%>/g;
  13984. /** Used to match property names within property paths. */
  13985. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  13986. reIsPlainProp = /^\w*$/,
  13987. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  13988. /**
  13989. * Used to match `RegExp`
  13990. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  13991. */
  13992. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  13993. reHasRegExpChar = RegExp(reRegExpChar.source);
  13994. /** Used to match leading and trailing whitespace. */
  13995. var reTrim = /^\s+|\s+$/g,
  13996. reTrimStart = /^\s+/,
  13997. reTrimEnd = /\s+$/;
  13998. /** Used to match wrap detail comments. */
  13999. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  14000. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  14001. reSplitDetails = /,? & /;
  14002. /** Used to match words composed of alphanumeric characters. */
  14003. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  14004. /** Used to match backslashes in property paths. */
  14005. var reEscapeChar = /\\(\\)?/g;
  14006. /**
  14007. * Used to match
  14008. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  14009. */
  14010. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  14011. /** Used to match `RegExp` flags from their coerced string values. */
  14012. var reFlags = /\w*$/;
  14013. /** Used to detect bad signed hexadecimal string values. */
  14014. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14015. /** Used to detect binary string values. */
  14016. var reIsBinary = /^0b[01]+$/i;
  14017. /** Used to detect host constructors (Safari). */
  14018. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14019. /** Used to detect octal string values. */
  14020. var reIsOctal = /^0o[0-7]+$/i;
  14021. /** Used to detect unsigned integer values. */
  14022. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14023. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  14024. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  14025. /** Used to ensure capturing order of template delimiters. */
  14026. var reNoMatch = /($^)/;
  14027. /** Used to match unescaped characters in compiled string literals. */
  14028. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  14029. /** Used to compose unicode character classes. */
  14030. var rsAstralRange = '\\ud800-\\udfff',
  14031. rsComboMarksRange = '\\u0300-\\u036f',
  14032. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  14033. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  14034. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  14035. rsDingbatRange = '\\u2700-\\u27bf',
  14036. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  14037. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  14038. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  14039. rsPunctuationRange = '\\u2000-\\u206f',
  14040. 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',
  14041. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  14042. rsVarRange = '\\ufe0e\\ufe0f',
  14043. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  14044. /** Used to compose unicode capture groups. */
  14045. var rsApos = "['\u2019]",
  14046. rsAstral = '[' + rsAstralRange + ']',
  14047. rsBreak = '[' + rsBreakRange + ']',
  14048. rsCombo = '[' + rsComboRange + ']',
  14049. rsDigits = '\\d+',
  14050. rsDingbat = '[' + rsDingbatRange + ']',
  14051. rsLower = '[' + rsLowerRange + ']',
  14052. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  14053. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  14054. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  14055. rsNonAstral = '[^' + rsAstralRange + ']',
  14056. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  14057. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  14058. rsUpper = '[' + rsUpperRange + ']',
  14059. rsZWJ = '\\u200d';
  14060. /** Used to compose unicode regexes. */
  14061. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  14062. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  14063. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  14064. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  14065. reOptMod = rsModifier + '?',
  14066. rsOptVar = '[' + rsVarRange + ']?',
  14067. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  14068. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  14069. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  14070. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  14071. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  14072. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  14073. /** Used to match apostrophes. */
  14074. var reApos = RegExp(rsApos, 'g');
  14075. /**
  14076. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  14077. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  14078. */
  14079. var reComboMark = RegExp(rsCombo, 'g');
  14080. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  14081. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  14082. /** Used to match complex or compound words. */
  14083. var reUnicodeWord = RegExp([
  14084. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  14085. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  14086. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  14087. rsUpper + '+' + rsOptContrUpper,
  14088. rsOrdUpper,
  14089. rsOrdLower,
  14090. rsDigits,
  14091. rsEmoji
  14092. ].join('|'), 'g');
  14093. /** 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/). */
  14094. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  14095. /** Used to detect strings that need a more robust regexp to match words. */
  14096. 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 ]/;
  14097. /** Used to assign default `context` object properties. */
  14098. var contextProps = [
  14099. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  14100. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  14101. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  14102. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  14103. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  14104. ];
  14105. /** Used to make template sourceURLs easier to identify. */
  14106. var templateCounter = -1;
  14107. /** Used to identify `toStringTag` values of typed arrays. */
  14108. var typedArrayTags = {};
  14109. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  14110. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  14111. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  14112. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  14113. typedArrayTags[uint32Tag] = true;
  14114. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  14115. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  14116. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  14117. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  14118. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  14119. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  14120. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  14121. typedArrayTags[weakMapTag] = false;
  14122. /** Used to identify `toStringTag` values supported by `_.clone`. */
  14123. var cloneableTags = {};
  14124. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  14125. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  14126. cloneableTags[boolTag] = cloneableTags[dateTag] =
  14127. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  14128. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  14129. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  14130. cloneableTags[numberTag] = cloneableTags[objectTag] =
  14131. cloneableTags[regexpTag] = cloneableTags[setTag] =
  14132. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  14133. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  14134. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  14135. cloneableTags[errorTag] = cloneableTags[funcTag] =
  14136. cloneableTags[weakMapTag] = false;
  14137. /** Used to map Latin Unicode letters to basic Latin letters. */
  14138. var deburredLetters = {
  14139. // Latin-1 Supplement block.
  14140. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  14141. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  14142. '\xc7': 'C', '\xe7': 'c',
  14143. '\xd0': 'D', '\xf0': 'd',
  14144. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  14145. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  14146. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  14147. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  14148. '\xd1': 'N', '\xf1': 'n',
  14149. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  14150. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14151. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  14152. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  14153. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  14154. '\xc6': 'Ae', '\xe6': 'ae',
  14155. '\xde': 'Th', '\xfe': 'th',
  14156. '\xdf': 'ss',
  14157. // Latin Extended-A block.
  14158. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  14159. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  14160. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  14161. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  14162. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  14163. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  14164. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  14165. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  14166. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  14167. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  14168. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  14169. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  14170. '\u0134': 'J', '\u0135': 'j',
  14171. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  14172. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  14173. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  14174. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  14175. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  14176. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  14177. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  14178. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  14179. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  14180. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  14181. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  14182. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  14183. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  14184. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  14185. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  14186. '\u0174': 'W', '\u0175': 'w',
  14187. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  14188. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  14189. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  14190. '\u0132': 'IJ', '\u0133': 'ij',
  14191. '\u0152': 'Oe', '\u0153': 'oe',
  14192. '\u0149': "'n", '\u017f': 's'
  14193. };
  14194. /** Used to map characters to HTML entities. */
  14195. var htmlEscapes = {
  14196. '&': '&amp;',
  14197. '<': '&lt;',
  14198. '>': '&gt;',
  14199. '"': '&quot;',
  14200. "'": '&#39;'
  14201. };
  14202. /** Used to map HTML entities to characters. */
  14203. var htmlUnescapes = {
  14204. '&amp;': '&',
  14205. '&lt;': '<',
  14206. '&gt;': '>',
  14207. '&quot;': '"',
  14208. '&#39;': "'"
  14209. };
  14210. /** Used to escape characters for inclusion in compiled string literals. */
  14211. var stringEscapes = {
  14212. '\\': '\\',
  14213. "'": "'",
  14214. '\n': 'n',
  14215. '\r': 'r',
  14216. '\u2028': 'u2028',
  14217. '\u2029': 'u2029'
  14218. };
  14219. /** Built-in method references without a dependency on `root`. */
  14220. var freeParseFloat = parseFloat,
  14221. freeParseInt = parseInt;
  14222. /** Detect free variable `global` from Node.js. */
  14223. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  14224. /** Detect free variable `self`. */
  14225. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  14226. /** Used as a reference to the global object. */
  14227. var root = freeGlobal || freeSelf || Function('return this')();
  14228. /** Detect free variable `exports`. */
  14229. var freeExports = true && exports && !exports.nodeType && exports;
  14230. /** Detect free variable `module`. */
  14231. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  14232. /** Detect the popular CommonJS extension `module.exports`. */
  14233. var moduleExports = freeModule && freeModule.exports === freeExports;
  14234. /** Detect free variable `process` from Node.js. */
  14235. var freeProcess = moduleExports && freeGlobal.process;
  14236. /** Used to access faster Node.js helpers. */
  14237. var nodeUtil = (function() {
  14238. try {
  14239. // Use `util.types` for Node.js 10+.
  14240. var types = freeModule && freeModule.require && freeModule.require('util').types;
  14241. if (types) {
  14242. return types;
  14243. }
  14244. // Legacy `process.binding('util')` for Node.js < 10.
  14245. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  14246. } catch (e) {}
  14247. }());
  14248. /* Node.js helper references. */
  14249. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  14250. nodeIsDate = nodeUtil && nodeUtil.isDate,
  14251. nodeIsMap = nodeUtil && nodeUtil.isMap,
  14252. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  14253. nodeIsSet = nodeUtil && nodeUtil.isSet,
  14254. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  14255. /*--------------------------------------------------------------------------*/
  14256. /**
  14257. * A faster alternative to `Function#apply`, this function invokes `func`
  14258. * with the `this` binding of `thisArg` and the arguments of `args`.
  14259. *
  14260. * @private
  14261. * @param {Function} func The function to invoke.
  14262. * @param {*} thisArg The `this` binding of `func`.
  14263. * @param {Array} args The arguments to invoke `func` with.
  14264. * @returns {*} Returns the result of `func`.
  14265. */
  14266. function apply(func, thisArg, args) {
  14267. switch (args.length) {
  14268. case 0: return func.call(thisArg);
  14269. case 1: return func.call(thisArg, args[0]);
  14270. case 2: return func.call(thisArg, args[0], args[1]);
  14271. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  14272. }
  14273. return func.apply(thisArg, args);
  14274. }
  14275. /**
  14276. * A specialized version of `baseAggregator` for arrays.
  14277. *
  14278. * @private
  14279. * @param {Array} [array] The array to iterate over.
  14280. * @param {Function} setter The function to set `accumulator` values.
  14281. * @param {Function} iteratee The iteratee to transform keys.
  14282. * @param {Object} accumulator The initial aggregated object.
  14283. * @returns {Function} Returns `accumulator`.
  14284. */
  14285. function arrayAggregator(array, setter, iteratee, accumulator) {
  14286. var index = -1,
  14287. length = array == null ? 0 : array.length;
  14288. while (++index < length) {
  14289. var value = array[index];
  14290. setter(accumulator, value, iteratee(value), array);
  14291. }
  14292. return accumulator;
  14293. }
  14294. /**
  14295. * A specialized version of `_.forEach` for arrays without support for
  14296. * iteratee shorthands.
  14297. *
  14298. * @private
  14299. * @param {Array} [array] The array to iterate over.
  14300. * @param {Function} iteratee The function invoked per iteration.
  14301. * @returns {Array} Returns `array`.
  14302. */
  14303. function arrayEach(array, iteratee) {
  14304. var index = -1,
  14305. length = array == null ? 0 : array.length;
  14306. while (++index < length) {
  14307. if (iteratee(array[index], index, array) === false) {
  14308. break;
  14309. }
  14310. }
  14311. return array;
  14312. }
  14313. /**
  14314. * A specialized version of `_.forEachRight` for arrays without support for
  14315. * iteratee shorthands.
  14316. *
  14317. * @private
  14318. * @param {Array} [array] The array to iterate over.
  14319. * @param {Function} iteratee The function invoked per iteration.
  14320. * @returns {Array} Returns `array`.
  14321. */
  14322. function arrayEachRight(array, iteratee) {
  14323. var length = array == null ? 0 : array.length;
  14324. while (length--) {
  14325. if (iteratee(array[length], length, array) === false) {
  14326. break;
  14327. }
  14328. }
  14329. return array;
  14330. }
  14331. /**
  14332. * A specialized version of `_.every` for arrays without support for
  14333. * iteratee shorthands.
  14334. *
  14335. * @private
  14336. * @param {Array} [array] The array to iterate over.
  14337. * @param {Function} predicate The function invoked per iteration.
  14338. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14339. * else `false`.
  14340. */
  14341. function arrayEvery(array, predicate) {
  14342. var index = -1,
  14343. length = array == null ? 0 : array.length;
  14344. while (++index < length) {
  14345. if (!predicate(array[index], index, array)) {
  14346. return false;
  14347. }
  14348. }
  14349. return true;
  14350. }
  14351. /**
  14352. * A specialized version of `_.filter` for arrays without support for
  14353. * iteratee shorthands.
  14354. *
  14355. * @private
  14356. * @param {Array} [array] The array to iterate over.
  14357. * @param {Function} predicate The function invoked per iteration.
  14358. * @returns {Array} Returns the new filtered array.
  14359. */
  14360. function arrayFilter(array, predicate) {
  14361. var index = -1,
  14362. length = array == null ? 0 : array.length,
  14363. resIndex = 0,
  14364. result = [];
  14365. while (++index < length) {
  14366. var value = array[index];
  14367. if (predicate(value, index, array)) {
  14368. result[resIndex++] = value;
  14369. }
  14370. }
  14371. return result;
  14372. }
  14373. /**
  14374. * A specialized version of `_.includes` for arrays without support for
  14375. * specifying an index to search from.
  14376. *
  14377. * @private
  14378. * @param {Array} [array] The array to inspect.
  14379. * @param {*} target The value to search for.
  14380. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14381. */
  14382. function arrayIncludes(array, value) {
  14383. var length = array == null ? 0 : array.length;
  14384. return !!length && baseIndexOf(array, value, 0) > -1;
  14385. }
  14386. /**
  14387. * This function is like `arrayIncludes` except that it accepts a comparator.
  14388. *
  14389. * @private
  14390. * @param {Array} [array] The array to inspect.
  14391. * @param {*} target The value to search for.
  14392. * @param {Function} comparator The comparator invoked per element.
  14393. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14394. */
  14395. function arrayIncludesWith(array, value, comparator) {
  14396. var index = -1,
  14397. length = array == null ? 0 : array.length;
  14398. while (++index < length) {
  14399. if (comparator(value, array[index])) {
  14400. return true;
  14401. }
  14402. }
  14403. return false;
  14404. }
  14405. /**
  14406. * A specialized version of `_.map` for arrays without support for iteratee
  14407. * shorthands.
  14408. *
  14409. * @private
  14410. * @param {Array} [array] The array to iterate over.
  14411. * @param {Function} iteratee The function invoked per iteration.
  14412. * @returns {Array} Returns the new mapped array.
  14413. */
  14414. function arrayMap(array, iteratee) {
  14415. var index = -1,
  14416. length = array == null ? 0 : array.length,
  14417. result = Array(length);
  14418. while (++index < length) {
  14419. result[index] = iteratee(array[index], index, array);
  14420. }
  14421. return result;
  14422. }
  14423. /**
  14424. * Appends the elements of `values` to `array`.
  14425. *
  14426. * @private
  14427. * @param {Array} array The array to modify.
  14428. * @param {Array} values The values to append.
  14429. * @returns {Array} Returns `array`.
  14430. */
  14431. function arrayPush(array, values) {
  14432. var index = -1,
  14433. length = values.length,
  14434. offset = array.length;
  14435. while (++index < length) {
  14436. array[offset + index] = values[index];
  14437. }
  14438. return array;
  14439. }
  14440. /**
  14441. * A specialized version of `_.reduce` for arrays without support for
  14442. * iteratee shorthands.
  14443. *
  14444. * @private
  14445. * @param {Array} [array] The array to iterate over.
  14446. * @param {Function} iteratee The function invoked per iteration.
  14447. * @param {*} [accumulator] The initial value.
  14448. * @param {boolean} [initAccum] Specify using the first element of `array` as
  14449. * the initial value.
  14450. * @returns {*} Returns the accumulated value.
  14451. */
  14452. function arrayReduce(array, iteratee, accumulator, initAccum) {
  14453. var index = -1,
  14454. length = array == null ? 0 : array.length;
  14455. if (initAccum && length) {
  14456. accumulator = array[++index];
  14457. }
  14458. while (++index < length) {
  14459. accumulator = iteratee(accumulator, array[index], index, array);
  14460. }
  14461. return accumulator;
  14462. }
  14463. /**
  14464. * A specialized version of `_.reduceRight` for arrays without support for
  14465. * iteratee shorthands.
  14466. *
  14467. * @private
  14468. * @param {Array} [array] The array to iterate over.
  14469. * @param {Function} iteratee The function invoked per iteration.
  14470. * @param {*} [accumulator] The initial value.
  14471. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14472. * the initial value.
  14473. * @returns {*} Returns the accumulated value.
  14474. */
  14475. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14476. var length = array == null ? 0 : array.length;
  14477. if (initAccum && length) {
  14478. accumulator = array[--length];
  14479. }
  14480. while (length--) {
  14481. accumulator = iteratee(accumulator, array[length], length, array);
  14482. }
  14483. return accumulator;
  14484. }
  14485. /**
  14486. * A specialized version of `_.some` for arrays without support for iteratee
  14487. * shorthands.
  14488. *
  14489. * @private
  14490. * @param {Array} [array] The array to iterate over.
  14491. * @param {Function} predicate The function invoked per iteration.
  14492. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14493. * else `false`.
  14494. */
  14495. function arraySome(array, predicate) {
  14496. var index = -1,
  14497. length = array == null ? 0 : array.length;
  14498. while (++index < length) {
  14499. if (predicate(array[index], index, array)) {
  14500. return true;
  14501. }
  14502. }
  14503. return false;
  14504. }
  14505. /**
  14506. * Gets the size of an ASCII `string`.
  14507. *
  14508. * @private
  14509. * @param {string} string The string inspect.
  14510. * @returns {number} Returns the string size.
  14511. */
  14512. var asciiSize = baseProperty('length');
  14513. /**
  14514. * Converts an ASCII `string` to an array.
  14515. *
  14516. * @private
  14517. * @param {string} string The string to convert.
  14518. * @returns {Array} Returns the converted array.
  14519. */
  14520. function asciiToArray(string) {
  14521. return string.split('');
  14522. }
  14523. /**
  14524. * Splits an ASCII `string` into an array of its words.
  14525. *
  14526. * @private
  14527. * @param {string} The string to inspect.
  14528. * @returns {Array} Returns the words of `string`.
  14529. */
  14530. function asciiWords(string) {
  14531. return string.match(reAsciiWord) || [];
  14532. }
  14533. /**
  14534. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14535. * without support for iteratee shorthands, which iterates over `collection`
  14536. * using `eachFunc`.
  14537. *
  14538. * @private
  14539. * @param {Array|Object} collection The collection to inspect.
  14540. * @param {Function} predicate The function invoked per iteration.
  14541. * @param {Function} eachFunc The function to iterate over `collection`.
  14542. * @returns {*} Returns the found element or its key, else `undefined`.
  14543. */
  14544. function baseFindKey(collection, predicate, eachFunc) {
  14545. var result;
  14546. eachFunc(collection, function(value, key, collection) {
  14547. if (predicate(value, key, collection)) {
  14548. result = key;
  14549. return false;
  14550. }
  14551. });
  14552. return result;
  14553. }
  14554. /**
  14555. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14556. * support for iteratee shorthands.
  14557. *
  14558. * @private
  14559. * @param {Array} array The array to inspect.
  14560. * @param {Function} predicate The function invoked per iteration.
  14561. * @param {number} fromIndex The index to search from.
  14562. * @param {boolean} [fromRight] Specify iterating from right to left.
  14563. * @returns {number} Returns the index of the matched value, else `-1`.
  14564. */
  14565. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14566. var length = array.length,
  14567. index = fromIndex + (fromRight ? 1 : -1);
  14568. while ((fromRight ? index-- : ++index < length)) {
  14569. if (predicate(array[index], index, array)) {
  14570. return index;
  14571. }
  14572. }
  14573. return -1;
  14574. }
  14575. /**
  14576. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14577. *
  14578. * @private
  14579. * @param {Array} array The array to inspect.
  14580. * @param {*} value The value to search for.
  14581. * @param {number} fromIndex The index to search from.
  14582. * @returns {number} Returns the index of the matched value, else `-1`.
  14583. */
  14584. function baseIndexOf(array, value, fromIndex) {
  14585. return value === value
  14586. ? strictIndexOf(array, value, fromIndex)
  14587. : baseFindIndex(array, baseIsNaN, fromIndex);
  14588. }
  14589. /**
  14590. * This function is like `baseIndexOf` except that it accepts a comparator.
  14591. *
  14592. * @private
  14593. * @param {Array} array The array to inspect.
  14594. * @param {*} value The value to search for.
  14595. * @param {number} fromIndex The index to search from.
  14596. * @param {Function} comparator The comparator invoked per element.
  14597. * @returns {number} Returns the index of the matched value, else `-1`.
  14598. */
  14599. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14600. var index = fromIndex - 1,
  14601. length = array.length;
  14602. while (++index < length) {
  14603. if (comparator(array[index], value)) {
  14604. return index;
  14605. }
  14606. }
  14607. return -1;
  14608. }
  14609. /**
  14610. * The base implementation of `_.isNaN` without support for number objects.
  14611. *
  14612. * @private
  14613. * @param {*} value The value to check.
  14614. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14615. */
  14616. function baseIsNaN(value) {
  14617. return value !== value;
  14618. }
  14619. /**
  14620. * The base implementation of `_.mean` and `_.meanBy` without support for
  14621. * iteratee shorthands.
  14622. *
  14623. * @private
  14624. * @param {Array} array The array to iterate over.
  14625. * @param {Function} iteratee The function invoked per iteration.
  14626. * @returns {number} Returns the mean.
  14627. */
  14628. function baseMean(array, iteratee) {
  14629. var length = array == null ? 0 : array.length;
  14630. return length ? (baseSum(array, iteratee) / length) : NAN;
  14631. }
  14632. /**
  14633. * The base implementation of `_.property` without support for deep paths.
  14634. *
  14635. * @private
  14636. * @param {string} key The key of the property to get.
  14637. * @returns {Function} Returns the new accessor function.
  14638. */
  14639. function baseProperty(key) {
  14640. return function(object) {
  14641. return object == null ? undefined : object[key];
  14642. };
  14643. }
  14644. /**
  14645. * The base implementation of `_.propertyOf` without support for deep paths.
  14646. *
  14647. * @private
  14648. * @param {Object} object The object to query.
  14649. * @returns {Function} Returns the new accessor function.
  14650. */
  14651. function basePropertyOf(object) {
  14652. return function(key) {
  14653. return object == null ? undefined : object[key];
  14654. };
  14655. }
  14656. /**
  14657. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14658. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14659. *
  14660. * @private
  14661. * @param {Array|Object} collection The collection to iterate over.
  14662. * @param {Function} iteratee The function invoked per iteration.
  14663. * @param {*} accumulator The initial value.
  14664. * @param {boolean} initAccum Specify using the first or last element of
  14665. * `collection` as the initial value.
  14666. * @param {Function} eachFunc The function to iterate over `collection`.
  14667. * @returns {*} Returns the accumulated value.
  14668. */
  14669. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14670. eachFunc(collection, function(value, index, collection) {
  14671. accumulator = initAccum
  14672. ? (initAccum = false, value)
  14673. : iteratee(accumulator, value, index, collection);
  14674. });
  14675. return accumulator;
  14676. }
  14677. /**
  14678. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14679. * sort order of `array` and replaces criteria objects with their corresponding
  14680. * values.
  14681. *
  14682. * @private
  14683. * @param {Array} array The array to sort.
  14684. * @param {Function} comparer The function to define sort order.
  14685. * @returns {Array} Returns `array`.
  14686. */
  14687. function baseSortBy(array, comparer) {
  14688. var length = array.length;
  14689. array.sort(comparer);
  14690. while (length--) {
  14691. array[length] = array[length].value;
  14692. }
  14693. return array;
  14694. }
  14695. /**
  14696. * The base implementation of `_.sum` and `_.sumBy` without support for
  14697. * iteratee shorthands.
  14698. *
  14699. * @private
  14700. * @param {Array} array The array to iterate over.
  14701. * @param {Function} iteratee The function invoked per iteration.
  14702. * @returns {number} Returns the sum.
  14703. */
  14704. function baseSum(array, iteratee) {
  14705. var result,
  14706. index = -1,
  14707. length = array.length;
  14708. while (++index < length) {
  14709. var current = iteratee(array[index]);
  14710. if (current !== undefined) {
  14711. result = result === undefined ? current : (result + current);
  14712. }
  14713. }
  14714. return result;
  14715. }
  14716. /**
  14717. * The base implementation of `_.times` without support for iteratee shorthands
  14718. * or max array length checks.
  14719. *
  14720. * @private
  14721. * @param {number} n The number of times to invoke `iteratee`.
  14722. * @param {Function} iteratee The function invoked per iteration.
  14723. * @returns {Array} Returns the array of results.
  14724. */
  14725. function baseTimes(n, iteratee) {
  14726. var index = -1,
  14727. result = Array(n);
  14728. while (++index < n) {
  14729. result[index] = iteratee(index);
  14730. }
  14731. return result;
  14732. }
  14733. /**
  14734. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14735. * of key-value pairs for `object` corresponding to the property names of `props`.
  14736. *
  14737. * @private
  14738. * @param {Object} object The object to query.
  14739. * @param {Array} props The property names to get values for.
  14740. * @returns {Object} Returns the key-value pairs.
  14741. */
  14742. function baseToPairs(object, props) {
  14743. return arrayMap(props, function(key) {
  14744. return [key, object[key]];
  14745. });
  14746. }
  14747. /**
  14748. * The base implementation of `_.unary` without support for storing metadata.
  14749. *
  14750. * @private
  14751. * @param {Function} func The function to cap arguments for.
  14752. * @returns {Function} Returns the new capped function.
  14753. */
  14754. function baseUnary(func) {
  14755. return function(value) {
  14756. return func(value);
  14757. };
  14758. }
  14759. /**
  14760. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14761. * array of `object` property values corresponding to the property names
  14762. * of `props`.
  14763. *
  14764. * @private
  14765. * @param {Object} object The object to query.
  14766. * @param {Array} props The property names to get values for.
  14767. * @returns {Object} Returns the array of property values.
  14768. */
  14769. function baseValues(object, props) {
  14770. return arrayMap(props, function(key) {
  14771. return object[key];
  14772. });
  14773. }
  14774. /**
  14775. * Checks if a `cache` value for `key` exists.
  14776. *
  14777. * @private
  14778. * @param {Object} cache The cache to query.
  14779. * @param {string} key The key of the entry to check.
  14780. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14781. */
  14782. function cacheHas(cache, key) {
  14783. return cache.has(key);
  14784. }
  14785. /**
  14786. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14787. * that is not found in the character symbols.
  14788. *
  14789. * @private
  14790. * @param {Array} strSymbols The string symbols to inspect.
  14791. * @param {Array} chrSymbols The character symbols to find.
  14792. * @returns {number} Returns the index of the first unmatched string symbol.
  14793. */
  14794. function charsStartIndex(strSymbols, chrSymbols) {
  14795. var index = -1,
  14796. length = strSymbols.length;
  14797. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14798. return index;
  14799. }
  14800. /**
  14801. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14802. * that is not found in the character symbols.
  14803. *
  14804. * @private
  14805. * @param {Array} strSymbols The string symbols to inspect.
  14806. * @param {Array} chrSymbols The character symbols to find.
  14807. * @returns {number} Returns the index of the last unmatched string symbol.
  14808. */
  14809. function charsEndIndex(strSymbols, chrSymbols) {
  14810. var index = strSymbols.length;
  14811. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14812. return index;
  14813. }
  14814. /**
  14815. * Gets the number of `placeholder` occurrences in `array`.
  14816. *
  14817. * @private
  14818. * @param {Array} array The array to inspect.
  14819. * @param {*} placeholder The placeholder to search for.
  14820. * @returns {number} Returns the placeholder count.
  14821. */
  14822. function countHolders(array, placeholder) {
  14823. var length = array.length,
  14824. result = 0;
  14825. while (length--) {
  14826. if (array[length] === placeholder) {
  14827. ++result;
  14828. }
  14829. }
  14830. return result;
  14831. }
  14832. /**
  14833. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14834. * letters to basic Latin letters.
  14835. *
  14836. * @private
  14837. * @param {string} letter The matched letter to deburr.
  14838. * @returns {string} Returns the deburred letter.
  14839. */
  14840. var deburrLetter = basePropertyOf(deburredLetters);
  14841. /**
  14842. * Used by `_.escape` to convert characters to HTML entities.
  14843. *
  14844. * @private
  14845. * @param {string} chr The matched character to escape.
  14846. * @returns {string} Returns the escaped character.
  14847. */
  14848. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14849. /**
  14850. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14851. *
  14852. * @private
  14853. * @param {string} chr The matched character to escape.
  14854. * @returns {string} Returns the escaped character.
  14855. */
  14856. function escapeStringChar(chr) {
  14857. return '\\' + stringEscapes[chr];
  14858. }
  14859. /**
  14860. * Gets the value at `key` of `object`.
  14861. *
  14862. * @private
  14863. * @param {Object} [object] The object to query.
  14864. * @param {string} key The key of the property to get.
  14865. * @returns {*} Returns the property value.
  14866. */
  14867. function getValue(object, key) {
  14868. return object == null ? undefined : object[key];
  14869. }
  14870. /**
  14871. * Checks if `string` contains Unicode symbols.
  14872. *
  14873. * @private
  14874. * @param {string} string The string to inspect.
  14875. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  14876. */
  14877. function hasUnicode(string) {
  14878. return reHasUnicode.test(string);
  14879. }
  14880. /**
  14881. * Checks if `string` contains a word composed of Unicode symbols.
  14882. *
  14883. * @private
  14884. * @param {string} string The string to inspect.
  14885. * @returns {boolean} Returns `true` if a word is found, else `false`.
  14886. */
  14887. function hasUnicodeWord(string) {
  14888. return reHasUnicodeWord.test(string);
  14889. }
  14890. /**
  14891. * Converts `iterator` to an array.
  14892. *
  14893. * @private
  14894. * @param {Object} iterator The iterator to convert.
  14895. * @returns {Array} Returns the converted array.
  14896. */
  14897. function iteratorToArray(iterator) {
  14898. var data,
  14899. result = [];
  14900. while (!(data = iterator.next()).done) {
  14901. result.push(data.value);
  14902. }
  14903. return result;
  14904. }
  14905. /**
  14906. * Converts `map` to its key-value pairs.
  14907. *
  14908. * @private
  14909. * @param {Object} map The map to convert.
  14910. * @returns {Array} Returns the key-value pairs.
  14911. */
  14912. function mapToArray(map) {
  14913. var index = -1,
  14914. result = Array(map.size);
  14915. map.forEach(function(value, key) {
  14916. result[++index] = [key, value];
  14917. });
  14918. return result;
  14919. }
  14920. /**
  14921. * Creates a unary function that invokes `func` with its argument transformed.
  14922. *
  14923. * @private
  14924. * @param {Function} func The function to wrap.
  14925. * @param {Function} transform The argument transform.
  14926. * @returns {Function} Returns the new function.
  14927. */
  14928. function overArg(func, transform) {
  14929. return function(arg) {
  14930. return func(transform(arg));
  14931. };
  14932. }
  14933. /**
  14934. * Replaces all `placeholder` elements in `array` with an internal placeholder
  14935. * and returns an array of their indexes.
  14936. *
  14937. * @private
  14938. * @param {Array} array The array to modify.
  14939. * @param {*} placeholder The placeholder to replace.
  14940. * @returns {Array} Returns the new array of placeholder indexes.
  14941. */
  14942. function replaceHolders(array, placeholder) {
  14943. var index = -1,
  14944. length = array.length,
  14945. resIndex = 0,
  14946. result = [];
  14947. while (++index < length) {
  14948. var value = array[index];
  14949. if (value === placeholder || value === PLACEHOLDER) {
  14950. array[index] = PLACEHOLDER;
  14951. result[resIndex++] = index;
  14952. }
  14953. }
  14954. return result;
  14955. }
  14956. /**
  14957. * Converts `set` to an array of its values.
  14958. *
  14959. * @private
  14960. * @param {Object} set The set to convert.
  14961. * @returns {Array} Returns the values.
  14962. */
  14963. function setToArray(set) {
  14964. var index = -1,
  14965. result = Array(set.size);
  14966. set.forEach(function(value) {
  14967. result[++index] = value;
  14968. });
  14969. return result;
  14970. }
  14971. /**
  14972. * Converts `set` to its value-value pairs.
  14973. *
  14974. * @private
  14975. * @param {Object} set The set to convert.
  14976. * @returns {Array} Returns the value-value pairs.
  14977. */
  14978. function setToPairs(set) {
  14979. var index = -1,
  14980. result = Array(set.size);
  14981. set.forEach(function(value) {
  14982. result[++index] = [value, value];
  14983. });
  14984. return result;
  14985. }
  14986. /**
  14987. * A specialized version of `_.indexOf` which performs strict equality
  14988. * comparisons of values, i.e. `===`.
  14989. *
  14990. * @private
  14991. * @param {Array} array The array to inspect.
  14992. * @param {*} value The value to search for.
  14993. * @param {number} fromIndex The index to search from.
  14994. * @returns {number} Returns the index of the matched value, else `-1`.
  14995. */
  14996. function strictIndexOf(array, value, fromIndex) {
  14997. var index = fromIndex - 1,
  14998. length = array.length;
  14999. while (++index < length) {
  15000. if (array[index] === value) {
  15001. return index;
  15002. }
  15003. }
  15004. return -1;
  15005. }
  15006. /**
  15007. * A specialized version of `_.lastIndexOf` which performs strict equality
  15008. * comparisons of values, i.e. `===`.
  15009. *
  15010. * @private
  15011. * @param {Array} array The array to inspect.
  15012. * @param {*} value The value to search for.
  15013. * @param {number} fromIndex The index to search from.
  15014. * @returns {number} Returns the index of the matched value, else `-1`.
  15015. */
  15016. function strictLastIndexOf(array, value, fromIndex) {
  15017. var index = fromIndex + 1;
  15018. while (index--) {
  15019. if (array[index] === value) {
  15020. return index;
  15021. }
  15022. }
  15023. return index;
  15024. }
  15025. /**
  15026. * Gets the number of symbols in `string`.
  15027. *
  15028. * @private
  15029. * @param {string} string The string to inspect.
  15030. * @returns {number} Returns the string size.
  15031. */
  15032. function stringSize(string) {
  15033. return hasUnicode(string)
  15034. ? unicodeSize(string)
  15035. : asciiSize(string);
  15036. }
  15037. /**
  15038. * Converts `string` to an array.
  15039. *
  15040. * @private
  15041. * @param {string} string The string to convert.
  15042. * @returns {Array} Returns the converted array.
  15043. */
  15044. function stringToArray(string) {
  15045. return hasUnicode(string)
  15046. ? unicodeToArray(string)
  15047. : asciiToArray(string);
  15048. }
  15049. /**
  15050. * Used by `_.unescape` to convert HTML entities to characters.
  15051. *
  15052. * @private
  15053. * @param {string} chr The matched character to unescape.
  15054. * @returns {string} Returns the unescaped character.
  15055. */
  15056. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  15057. /**
  15058. * Gets the size of a Unicode `string`.
  15059. *
  15060. * @private
  15061. * @param {string} string The string inspect.
  15062. * @returns {number} Returns the string size.
  15063. */
  15064. function unicodeSize(string) {
  15065. var result = reUnicode.lastIndex = 0;
  15066. while (reUnicode.test(string)) {
  15067. ++result;
  15068. }
  15069. return result;
  15070. }
  15071. /**
  15072. * Converts a Unicode `string` to an array.
  15073. *
  15074. * @private
  15075. * @param {string} string The string to convert.
  15076. * @returns {Array} Returns the converted array.
  15077. */
  15078. function unicodeToArray(string) {
  15079. return string.match(reUnicode) || [];
  15080. }
  15081. /**
  15082. * Splits a Unicode `string` into an array of its words.
  15083. *
  15084. * @private
  15085. * @param {string} The string to inspect.
  15086. * @returns {Array} Returns the words of `string`.
  15087. */
  15088. function unicodeWords(string) {
  15089. return string.match(reUnicodeWord) || [];
  15090. }
  15091. /*--------------------------------------------------------------------------*/
  15092. /**
  15093. * Create a new pristine `lodash` function using the `context` object.
  15094. *
  15095. * @static
  15096. * @memberOf _
  15097. * @since 1.1.0
  15098. * @category Util
  15099. * @param {Object} [context=root] The context object.
  15100. * @returns {Function} Returns a new `lodash` function.
  15101. * @example
  15102. *
  15103. * _.mixin({ 'foo': _.constant('foo') });
  15104. *
  15105. * var lodash = _.runInContext();
  15106. * lodash.mixin({ 'bar': lodash.constant('bar') });
  15107. *
  15108. * _.isFunction(_.foo);
  15109. * // => true
  15110. * _.isFunction(_.bar);
  15111. * // => false
  15112. *
  15113. * lodash.isFunction(lodash.foo);
  15114. * // => false
  15115. * lodash.isFunction(lodash.bar);
  15116. * // => true
  15117. *
  15118. * // Create a suped-up `defer` in Node.js.
  15119. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  15120. */
  15121. var runInContext = (function runInContext(context) {
  15122. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  15123. /** Built-in constructor references. */
  15124. var Array = context.Array,
  15125. Date = context.Date,
  15126. Error = context.Error,
  15127. Function = context.Function,
  15128. Math = context.Math,
  15129. Object = context.Object,
  15130. RegExp = context.RegExp,
  15131. String = context.String,
  15132. TypeError = context.TypeError;
  15133. /** Used for built-in method references. */
  15134. var arrayProto = Array.prototype,
  15135. funcProto = Function.prototype,
  15136. objectProto = Object.prototype;
  15137. /** Used to detect overreaching core-js shims. */
  15138. var coreJsData = context['__core-js_shared__'];
  15139. /** Used to resolve the decompiled source of functions. */
  15140. var funcToString = funcProto.toString;
  15141. /** Used to check objects for own properties. */
  15142. var hasOwnProperty = objectProto.hasOwnProperty;
  15143. /** Used to generate unique IDs. */
  15144. var idCounter = 0;
  15145. /** Used to detect methods masquerading as native. */
  15146. var maskSrcKey = (function() {
  15147. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  15148. return uid ? ('Symbol(src)_1.' + uid) : '';
  15149. }());
  15150. /**
  15151. * Used to resolve the
  15152. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  15153. * of values.
  15154. */
  15155. var nativeObjectToString = objectProto.toString;
  15156. /** Used to infer the `Object` constructor. */
  15157. var objectCtorString = funcToString.call(Object);
  15158. /** Used to restore the original `_` reference in `_.noConflict`. */
  15159. var oldDash = root._;
  15160. /** Used to detect if a method is native. */
  15161. var reIsNative = RegExp('^' +
  15162. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  15163. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  15164. );
  15165. /** Built-in value references. */
  15166. var Buffer = moduleExports ? context.Buffer : undefined,
  15167. Symbol = context.Symbol,
  15168. Uint8Array = context.Uint8Array,
  15169. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  15170. getPrototype = overArg(Object.getPrototypeOf, Object),
  15171. objectCreate = Object.create,
  15172. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  15173. splice = arrayProto.splice,
  15174. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  15175. symIterator = Symbol ? Symbol.iterator : undefined,
  15176. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  15177. var defineProperty = (function() {
  15178. try {
  15179. var func = getNative(Object, 'defineProperty');
  15180. func({}, '', {});
  15181. return func;
  15182. } catch (e) {}
  15183. }());
  15184. /** Mocked built-ins. */
  15185. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  15186. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  15187. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  15188. /* Built-in method references for those with the same name as other `lodash` methods. */
  15189. var nativeCeil = Math.ceil,
  15190. nativeFloor = Math.floor,
  15191. nativeGetSymbols = Object.getOwnPropertySymbols,
  15192. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  15193. nativeIsFinite = context.isFinite,
  15194. nativeJoin = arrayProto.join,
  15195. nativeKeys = overArg(Object.keys, Object),
  15196. nativeMax = Math.max,
  15197. nativeMin = Math.min,
  15198. nativeNow = Date.now,
  15199. nativeParseInt = context.parseInt,
  15200. nativeRandom = Math.random,
  15201. nativeReverse = arrayProto.reverse;
  15202. /* Built-in method references that are verified to be native. */
  15203. var DataView = getNative(context, 'DataView'),
  15204. Map = getNative(context, 'Map'),
  15205. Promise = getNative(context, 'Promise'),
  15206. Set = getNative(context, 'Set'),
  15207. WeakMap = getNative(context, 'WeakMap'),
  15208. nativeCreate = getNative(Object, 'create');
  15209. /** Used to store function metadata. */
  15210. var metaMap = WeakMap && new WeakMap;
  15211. /** Used to lookup unminified function names. */
  15212. var realNames = {};
  15213. /** Used to detect maps, sets, and weakmaps. */
  15214. var dataViewCtorString = toSource(DataView),
  15215. mapCtorString = toSource(Map),
  15216. promiseCtorString = toSource(Promise),
  15217. setCtorString = toSource(Set),
  15218. weakMapCtorString = toSource(WeakMap);
  15219. /** Used to convert symbols to primitives and strings. */
  15220. var symbolProto = Symbol ? Symbol.prototype : undefined,
  15221. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  15222. symbolToString = symbolProto ? symbolProto.toString : undefined;
  15223. /*------------------------------------------------------------------------*/
  15224. /**
  15225. * Creates a `lodash` object which wraps `value` to enable implicit method
  15226. * chain sequences. Methods that operate on and return arrays, collections,
  15227. * and functions can be chained together. Methods that retrieve a single value
  15228. * or may return a primitive value will automatically end the chain sequence
  15229. * and return the unwrapped value. Otherwise, the value must be unwrapped
  15230. * with `_#value`.
  15231. *
  15232. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  15233. * enabled using `_.chain`.
  15234. *
  15235. * The execution of chained methods is lazy, that is, it's deferred until
  15236. * `_#value` is implicitly or explicitly called.
  15237. *
  15238. * Lazy evaluation allows several methods to support shortcut fusion.
  15239. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  15240. * the creation of intermediate arrays and can greatly reduce the number of
  15241. * iteratee executions. Sections of a chain sequence qualify for shortcut
  15242. * fusion if the section is applied to an array and iteratees accept only
  15243. * one argument. The heuristic for whether a section qualifies for shortcut
  15244. * fusion is subject to change.
  15245. *
  15246. * Chaining is supported in custom builds as long as the `_#value` method is
  15247. * directly or indirectly included in the build.
  15248. *
  15249. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  15250. *
  15251. * The wrapper `Array` methods are:
  15252. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  15253. *
  15254. * The wrapper `String` methods are:
  15255. * `replace` and `split`
  15256. *
  15257. * The wrapper methods that support shortcut fusion are:
  15258. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  15259. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  15260. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  15261. *
  15262. * The chainable wrapper methods are:
  15263. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  15264. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  15265. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  15266. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  15267. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  15268. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  15269. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  15270. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  15271. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  15272. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  15273. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  15274. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  15275. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  15276. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  15277. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  15278. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  15279. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  15280. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  15281. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  15282. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  15283. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  15284. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  15285. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  15286. * `zipObject`, `zipObjectDeep`, and `zipWith`
  15287. *
  15288. * The wrapper methods that are **not** chainable by default are:
  15289. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  15290. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  15291. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  15292. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  15293. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  15294. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  15295. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  15296. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  15297. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  15298. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  15299. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  15300. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  15301. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  15302. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  15303. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  15304. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  15305. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  15306. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  15307. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  15308. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  15309. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  15310. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  15311. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  15312. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  15313. * `upperFirst`, `value`, and `words`
  15314. *
  15315. * @name _
  15316. * @constructor
  15317. * @category Seq
  15318. * @param {*} value The value to wrap in a `lodash` instance.
  15319. * @returns {Object} Returns the new `lodash` wrapper instance.
  15320. * @example
  15321. *
  15322. * function square(n) {
  15323. * return n * n;
  15324. * }
  15325. *
  15326. * var wrapped = _([1, 2, 3]);
  15327. *
  15328. * // Returns an unwrapped value.
  15329. * wrapped.reduce(_.add);
  15330. * // => 6
  15331. *
  15332. * // Returns a wrapped value.
  15333. * var squares = wrapped.map(square);
  15334. *
  15335. * _.isArray(squares);
  15336. * // => false
  15337. *
  15338. * _.isArray(squares.value());
  15339. * // => true
  15340. */
  15341. function lodash(value) {
  15342. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  15343. if (value instanceof LodashWrapper) {
  15344. return value;
  15345. }
  15346. if (hasOwnProperty.call(value, '__wrapped__')) {
  15347. return wrapperClone(value);
  15348. }
  15349. }
  15350. return new LodashWrapper(value);
  15351. }
  15352. /**
  15353. * The base implementation of `_.create` without support for assigning
  15354. * properties to the created object.
  15355. *
  15356. * @private
  15357. * @param {Object} proto The object to inherit from.
  15358. * @returns {Object} Returns the new object.
  15359. */
  15360. var baseCreate = (function() {
  15361. function object() {}
  15362. return function(proto) {
  15363. if (!isObject(proto)) {
  15364. return {};
  15365. }
  15366. if (objectCreate) {
  15367. return objectCreate(proto);
  15368. }
  15369. object.prototype = proto;
  15370. var result = new object;
  15371. object.prototype = undefined;
  15372. return result;
  15373. };
  15374. }());
  15375. /**
  15376. * The function whose prototype chain sequence wrappers inherit from.
  15377. *
  15378. * @private
  15379. */
  15380. function baseLodash() {
  15381. // No operation performed.
  15382. }
  15383. /**
  15384. * The base constructor for creating `lodash` wrapper objects.
  15385. *
  15386. * @private
  15387. * @param {*} value The value to wrap.
  15388. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  15389. */
  15390. function LodashWrapper(value, chainAll) {
  15391. this.__wrapped__ = value;
  15392. this.__actions__ = [];
  15393. this.__chain__ = !!chainAll;
  15394. this.__index__ = 0;
  15395. this.__values__ = undefined;
  15396. }
  15397. /**
  15398. * By default, the template delimiters used by lodash are like those in
  15399. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  15400. * following template settings to use alternative delimiters.
  15401. *
  15402. * @static
  15403. * @memberOf _
  15404. * @type {Object}
  15405. */
  15406. lodash.templateSettings = {
  15407. /**
  15408. * Used to detect `data` property values to be HTML-escaped.
  15409. *
  15410. * @memberOf _.templateSettings
  15411. * @type {RegExp}
  15412. */
  15413. 'escape': reEscape,
  15414. /**
  15415. * Used to detect code to be evaluated.
  15416. *
  15417. * @memberOf _.templateSettings
  15418. * @type {RegExp}
  15419. */
  15420. 'evaluate': reEvaluate,
  15421. /**
  15422. * Used to detect `data` property values to inject.
  15423. *
  15424. * @memberOf _.templateSettings
  15425. * @type {RegExp}
  15426. */
  15427. 'interpolate': reInterpolate,
  15428. /**
  15429. * Used to reference the data object in the template text.
  15430. *
  15431. * @memberOf _.templateSettings
  15432. * @type {string}
  15433. */
  15434. 'variable': '',
  15435. /**
  15436. * Used to import variables into the compiled template.
  15437. *
  15438. * @memberOf _.templateSettings
  15439. * @type {Object}
  15440. */
  15441. 'imports': {
  15442. /**
  15443. * A reference to the `lodash` function.
  15444. *
  15445. * @memberOf _.templateSettings.imports
  15446. * @type {Function}
  15447. */
  15448. '_': lodash
  15449. }
  15450. };
  15451. // Ensure wrappers are instances of `baseLodash`.
  15452. lodash.prototype = baseLodash.prototype;
  15453. lodash.prototype.constructor = lodash;
  15454. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  15455. LodashWrapper.prototype.constructor = LodashWrapper;
  15456. /*------------------------------------------------------------------------*/
  15457. /**
  15458. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  15459. *
  15460. * @private
  15461. * @constructor
  15462. * @param {*} value The value to wrap.
  15463. */
  15464. function LazyWrapper(value) {
  15465. this.__wrapped__ = value;
  15466. this.__actions__ = [];
  15467. this.__dir__ = 1;
  15468. this.__filtered__ = false;
  15469. this.__iteratees__ = [];
  15470. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15471. this.__views__ = [];
  15472. }
  15473. /**
  15474. * Creates a clone of the lazy wrapper object.
  15475. *
  15476. * @private
  15477. * @name clone
  15478. * @memberOf LazyWrapper
  15479. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15480. */
  15481. function lazyClone() {
  15482. var result = new LazyWrapper(this.__wrapped__);
  15483. result.__actions__ = copyArray(this.__actions__);
  15484. result.__dir__ = this.__dir__;
  15485. result.__filtered__ = this.__filtered__;
  15486. result.__iteratees__ = copyArray(this.__iteratees__);
  15487. result.__takeCount__ = this.__takeCount__;
  15488. result.__views__ = copyArray(this.__views__);
  15489. return result;
  15490. }
  15491. /**
  15492. * Reverses the direction of lazy iteration.
  15493. *
  15494. * @private
  15495. * @name reverse
  15496. * @memberOf LazyWrapper
  15497. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15498. */
  15499. function lazyReverse() {
  15500. if (this.__filtered__) {
  15501. var result = new LazyWrapper(this);
  15502. result.__dir__ = -1;
  15503. result.__filtered__ = true;
  15504. } else {
  15505. result = this.clone();
  15506. result.__dir__ *= -1;
  15507. }
  15508. return result;
  15509. }
  15510. /**
  15511. * Extracts the unwrapped value from its lazy wrapper.
  15512. *
  15513. * @private
  15514. * @name value
  15515. * @memberOf LazyWrapper
  15516. * @returns {*} Returns the unwrapped value.
  15517. */
  15518. function lazyValue() {
  15519. var array = this.__wrapped__.value(),
  15520. dir = this.__dir__,
  15521. isArr = isArray(array),
  15522. isRight = dir < 0,
  15523. arrLength = isArr ? array.length : 0,
  15524. view = getView(0, arrLength, this.__views__),
  15525. start = view.start,
  15526. end = view.end,
  15527. length = end - start,
  15528. index = isRight ? end : (start - 1),
  15529. iteratees = this.__iteratees__,
  15530. iterLength = iteratees.length,
  15531. resIndex = 0,
  15532. takeCount = nativeMin(length, this.__takeCount__);
  15533. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15534. return baseWrapperValue(array, this.__actions__);
  15535. }
  15536. var result = [];
  15537. outer:
  15538. while (length-- && resIndex < takeCount) {
  15539. index += dir;
  15540. var iterIndex = -1,
  15541. value = array[index];
  15542. while (++iterIndex < iterLength) {
  15543. var data = iteratees[iterIndex],
  15544. iteratee = data.iteratee,
  15545. type = data.type,
  15546. computed = iteratee(value);
  15547. if (type == LAZY_MAP_FLAG) {
  15548. value = computed;
  15549. } else if (!computed) {
  15550. if (type == LAZY_FILTER_FLAG) {
  15551. continue outer;
  15552. } else {
  15553. break outer;
  15554. }
  15555. }
  15556. }
  15557. result[resIndex++] = value;
  15558. }
  15559. return result;
  15560. }
  15561. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15562. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15563. LazyWrapper.prototype.constructor = LazyWrapper;
  15564. /*------------------------------------------------------------------------*/
  15565. /**
  15566. * Creates a hash object.
  15567. *
  15568. * @private
  15569. * @constructor
  15570. * @param {Array} [entries] The key-value pairs to cache.
  15571. */
  15572. function Hash(entries) {
  15573. var index = -1,
  15574. length = entries == null ? 0 : entries.length;
  15575. this.clear();
  15576. while (++index < length) {
  15577. var entry = entries[index];
  15578. this.set(entry[0], entry[1]);
  15579. }
  15580. }
  15581. /**
  15582. * Removes all key-value entries from the hash.
  15583. *
  15584. * @private
  15585. * @name clear
  15586. * @memberOf Hash
  15587. */
  15588. function hashClear() {
  15589. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15590. this.size = 0;
  15591. }
  15592. /**
  15593. * Removes `key` and its value from the hash.
  15594. *
  15595. * @private
  15596. * @name delete
  15597. * @memberOf Hash
  15598. * @param {Object} hash The hash to modify.
  15599. * @param {string} key The key of the value to remove.
  15600. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15601. */
  15602. function hashDelete(key) {
  15603. var result = this.has(key) && delete this.__data__[key];
  15604. this.size -= result ? 1 : 0;
  15605. return result;
  15606. }
  15607. /**
  15608. * Gets the hash value for `key`.
  15609. *
  15610. * @private
  15611. * @name get
  15612. * @memberOf Hash
  15613. * @param {string} key The key of the value to get.
  15614. * @returns {*} Returns the entry value.
  15615. */
  15616. function hashGet(key) {
  15617. var data = this.__data__;
  15618. if (nativeCreate) {
  15619. var result = data[key];
  15620. return result === HASH_UNDEFINED ? undefined : result;
  15621. }
  15622. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15623. }
  15624. /**
  15625. * Checks if a hash value for `key` exists.
  15626. *
  15627. * @private
  15628. * @name has
  15629. * @memberOf Hash
  15630. * @param {string} key The key of the entry to check.
  15631. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15632. */
  15633. function hashHas(key) {
  15634. var data = this.__data__;
  15635. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15636. }
  15637. /**
  15638. * Sets the hash `key` to `value`.
  15639. *
  15640. * @private
  15641. * @name set
  15642. * @memberOf Hash
  15643. * @param {string} key The key of the value to set.
  15644. * @param {*} value The value to set.
  15645. * @returns {Object} Returns the hash instance.
  15646. */
  15647. function hashSet(key, value) {
  15648. var data = this.__data__;
  15649. this.size += this.has(key) ? 0 : 1;
  15650. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15651. return this;
  15652. }
  15653. // Add methods to `Hash`.
  15654. Hash.prototype.clear = hashClear;
  15655. Hash.prototype['delete'] = hashDelete;
  15656. Hash.prototype.get = hashGet;
  15657. Hash.prototype.has = hashHas;
  15658. Hash.prototype.set = hashSet;
  15659. /*------------------------------------------------------------------------*/
  15660. /**
  15661. * Creates an list cache object.
  15662. *
  15663. * @private
  15664. * @constructor
  15665. * @param {Array} [entries] The key-value pairs to cache.
  15666. */
  15667. function ListCache(entries) {
  15668. var index = -1,
  15669. length = entries == null ? 0 : entries.length;
  15670. this.clear();
  15671. while (++index < length) {
  15672. var entry = entries[index];
  15673. this.set(entry[0], entry[1]);
  15674. }
  15675. }
  15676. /**
  15677. * Removes all key-value entries from the list cache.
  15678. *
  15679. * @private
  15680. * @name clear
  15681. * @memberOf ListCache
  15682. */
  15683. function listCacheClear() {
  15684. this.__data__ = [];
  15685. this.size = 0;
  15686. }
  15687. /**
  15688. * Removes `key` and its value from the list cache.
  15689. *
  15690. * @private
  15691. * @name delete
  15692. * @memberOf ListCache
  15693. * @param {string} key The key of the value to remove.
  15694. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15695. */
  15696. function listCacheDelete(key) {
  15697. var data = this.__data__,
  15698. index = assocIndexOf(data, key);
  15699. if (index < 0) {
  15700. return false;
  15701. }
  15702. var lastIndex = data.length - 1;
  15703. if (index == lastIndex) {
  15704. data.pop();
  15705. } else {
  15706. splice.call(data, index, 1);
  15707. }
  15708. --this.size;
  15709. return true;
  15710. }
  15711. /**
  15712. * Gets the list cache value for `key`.
  15713. *
  15714. * @private
  15715. * @name get
  15716. * @memberOf ListCache
  15717. * @param {string} key The key of the value to get.
  15718. * @returns {*} Returns the entry value.
  15719. */
  15720. function listCacheGet(key) {
  15721. var data = this.__data__,
  15722. index = assocIndexOf(data, key);
  15723. return index < 0 ? undefined : data[index][1];
  15724. }
  15725. /**
  15726. * Checks if a list cache value for `key` exists.
  15727. *
  15728. * @private
  15729. * @name has
  15730. * @memberOf ListCache
  15731. * @param {string} key The key of the entry to check.
  15732. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15733. */
  15734. function listCacheHas(key) {
  15735. return assocIndexOf(this.__data__, key) > -1;
  15736. }
  15737. /**
  15738. * Sets the list cache `key` to `value`.
  15739. *
  15740. * @private
  15741. * @name set
  15742. * @memberOf ListCache
  15743. * @param {string} key The key of the value to set.
  15744. * @param {*} value The value to set.
  15745. * @returns {Object} Returns the list cache instance.
  15746. */
  15747. function listCacheSet(key, value) {
  15748. var data = this.__data__,
  15749. index = assocIndexOf(data, key);
  15750. if (index < 0) {
  15751. ++this.size;
  15752. data.push([key, value]);
  15753. } else {
  15754. data[index][1] = value;
  15755. }
  15756. return this;
  15757. }
  15758. // Add methods to `ListCache`.
  15759. ListCache.prototype.clear = listCacheClear;
  15760. ListCache.prototype['delete'] = listCacheDelete;
  15761. ListCache.prototype.get = listCacheGet;
  15762. ListCache.prototype.has = listCacheHas;
  15763. ListCache.prototype.set = listCacheSet;
  15764. /*------------------------------------------------------------------------*/
  15765. /**
  15766. * Creates a map cache object to store key-value pairs.
  15767. *
  15768. * @private
  15769. * @constructor
  15770. * @param {Array} [entries] The key-value pairs to cache.
  15771. */
  15772. function MapCache(entries) {
  15773. var index = -1,
  15774. length = entries == null ? 0 : entries.length;
  15775. this.clear();
  15776. while (++index < length) {
  15777. var entry = entries[index];
  15778. this.set(entry[0], entry[1]);
  15779. }
  15780. }
  15781. /**
  15782. * Removes all key-value entries from the map.
  15783. *
  15784. * @private
  15785. * @name clear
  15786. * @memberOf MapCache
  15787. */
  15788. function mapCacheClear() {
  15789. this.size = 0;
  15790. this.__data__ = {
  15791. 'hash': new Hash,
  15792. 'map': new (Map || ListCache),
  15793. 'string': new Hash
  15794. };
  15795. }
  15796. /**
  15797. * Removes `key` and its value from the map.
  15798. *
  15799. * @private
  15800. * @name delete
  15801. * @memberOf MapCache
  15802. * @param {string} key The key of the value to remove.
  15803. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15804. */
  15805. function mapCacheDelete(key) {
  15806. var result = getMapData(this, key)['delete'](key);
  15807. this.size -= result ? 1 : 0;
  15808. return result;
  15809. }
  15810. /**
  15811. * Gets the map value for `key`.
  15812. *
  15813. * @private
  15814. * @name get
  15815. * @memberOf MapCache
  15816. * @param {string} key The key of the value to get.
  15817. * @returns {*} Returns the entry value.
  15818. */
  15819. function mapCacheGet(key) {
  15820. return getMapData(this, key).get(key);
  15821. }
  15822. /**
  15823. * Checks if a map value for `key` exists.
  15824. *
  15825. * @private
  15826. * @name has
  15827. * @memberOf MapCache
  15828. * @param {string} key The key of the entry to check.
  15829. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15830. */
  15831. function mapCacheHas(key) {
  15832. return getMapData(this, key).has(key);
  15833. }
  15834. /**
  15835. * Sets the map `key` to `value`.
  15836. *
  15837. * @private
  15838. * @name set
  15839. * @memberOf MapCache
  15840. * @param {string} key The key of the value to set.
  15841. * @param {*} value The value to set.
  15842. * @returns {Object} Returns the map cache instance.
  15843. */
  15844. function mapCacheSet(key, value) {
  15845. var data = getMapData(this, key),
  15846. size = data.size;
  15847. data.set(key, value);
  15848. this.size += data.size == size ? 0 : 1;
  15849. return this;
  15850. }
  15851. // Add methods to `MapCache`.
  15852. MapCache.prototype.clear = mapCacheClear;
  15853. MapCache.prototype['delete'] = mapCacheDelete;
  15854. MapCache.prototype.get = mapCacheGet;
  15855. MapCache.prototype.has = mapCacheHas;
  15856. MapCache.prototype.set = mapCacheSet;
  15857. /*------------------------------------------------------------------------*/
  15858. /**
  15859. *
  15860. * Creates an array cache object to store unique values.
  15861. *
  15862. * @private
  15863. * @constructor
  15864. * @param {Array} [values] The values to cache.
  15865. */
  15866. function SetCache(values) {
  15867. var index = -1,
  15868. length = values == null ? 0 : values.length;
  15869. this.__data__ = new MapCache;
  15870. while (++index < length) {
  15871. this.add(values[index]);
  15872. }
  15873. }
  15874. /**
  15875. * Adds `value` to the array cache.
  15876. *
  15877. * @private
  15878. * @name add
  15879. * @memberOf SetCache
  15880. * @alias push
  15881. * @param {*} value The value to cache.
  15882. * @returns {Object} Returns the cache instance.
  15883. */
  15884. function setCacheAdd(value) {
  15885. this.__data__.set(value, HASH_UNDEFINED);
  15886. return this;
  15887. }
  15888. /**
  15889. * Checks if `value` is in the array cache.
  15890. *
  15891. * @private
  15892. * @name has
  15893. * @memberOf SetCache
  15894. * @param {*} value The value to search for.
  15895. * @returns {number} Returns `true` if `value` is found, else `false`.
  15896. */
  15897. function setCacheHas(value) {
  15898. return this.__data__.has(value);
  15899. }
  15900. // Add methods to `SetCache`.
  15901. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15902. SetCache.prototype.has = setCacheHas;
  15903. /*------------------------------------------------------------------------*/
  15904. /**
  15905. * Creates a stack cache object to store key-value pairs.
  15906. *
  15907. * @private
  15908. * @constructor
  15909. * @param {Array} [entries] The key-value pairs to cache.
  15910. */
  15911. function Stack(entries) {
  15912. var data = this.__data__ = new ListCache(entries);
  15913. this.size = data.size;
  15914. }
  15915. /**
  15916. * Removes all key-value entries from the stack.
  15917. *
  15918. * @private
  15919. * @name clear
  15920. * @memberOf Stack
  15921. */
  15922. function stackClear() {
  15923. this.__data__ = new ListCache;
  15924. this.size = 0;
  15925. }
  15926. /**
  15927. * Removes `key` and its value from the stack.
  15928. *
  15929. * @private
  15930. * @name delete
  15931. * @memberOf Stack
  15932. * @param {string} key The key of the value to remove.
  15933. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15934. */
  15935. function stackDelete(key) {
  15936. var data = this.__data__,
  15937. result = data['delete'](key);
  15938. this.size = data.size;
  15939. return result;
  15940. }
  15941. /**
  15942. * Gets the stack value for `key`.
  15943. *
  15944. * @private
  15945. * @name get
  15946. * @memberOf Stack
  15947. * @param {string} key The key of the value to get.
  15948. * @returns {*} Returns the entry value.
  15949. */
  15950. function stackGet(key) {
  15951. return this.__data__.get(key);
  15952. }
  15953. /**
  15954. * Checks if a stack value for `key` exists.
  15955. *
  15956. * @private
  15957. * @name has
  15958. * @memberOf Stack
  15959. * @param {string} key The key of the entry to check.
  15960. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15961. */
  15962. function stackHas(key) {
  15963. return this.__data__.has(key);
  15964. }
  15965. /**
  15966. * Sets the stack `key` to `value`.
  15967. *
  15968. * @private
  15969. * @name set
  15970. * @memberOf Stack
  15971. * @param {string} key The key of the value to set.
  15972. * @param {*} value The value to set.
  15973. * @returns {Object} Returns the stack cache instance.
  15974. */
  15975. function stackSet(key, value) {
  15976. var data = this.__data__;
  15977. if (data instanceof ListCache) {
  15978. var pairs = data.__data__;
  15979. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  15980. pairs.push([key, value]);
  15981. this.size = ++data.size;
  15982. return this;
  15983. }
  15984. data = this.__data__ = new MapCache(pairs);
  15985. }
  15986. data.set(key, value);
  15987. this.size = data.size;
  15988. return this;
  15989. }
  15990. // Add methods to `Stack`.
  15991. Stack.prototype.clear = stackClear;
  15992. Stack.prototype['delete'] = stackDelete;
  15993. Stack.prototype.get = stackGet;
  15994. Stack.prototype.has = stackHas;
  15995. Stack.prototype.set = stackSet;
  15996. /*------------------------------------------------------------------------*/
  15997. /**
  15998. * Creates an array of the enumerable property names of the array-like `value`.
  15999. *
  16000. * @private
  16001. * @param {*} value The value to query.
  16002. * @param {boolean} inherited Specify returning inherited property names.
  16003. * @returns {Array} Returns the array of property names.
  16004. */
  16005. function arrayLikeKeys(value, inherited) {
  16006. var isArr = isArray(value),
  16007. isArg = !isArr && isArguments(value),
  16008. isBuff = !isArr && !isArg && isBuffer(value),
  16009. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  16010. skipIndexes = isArr || isArg || isBuff || isType,
  16011. result = skipIndexes ? baseTimes(value.length, String) : [],
  16012. length = result.length;
  16013. for (var key in value) {
  16014. if ((inherited || hasOwnProperty.call(value, key)) &&
  16015. !(skipIndexes && (
  16016. // Safari 9 has enumerable `arguments.length` in strict mode.
  16017. key == 'length' ||
  16018. // Node.js 0.10 has enumerable non-index properties on buffers.
  16019. (isBuff && (key == 'offset' || key == 'parent')) ||
  16020. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  16021. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  16022. // Skip index properties.
  16023. isIndex(key, length)
  16024. ))) {
  16025. result.push(key);
  16026. }
  16027. }
  16028. return result;
  16029. }
  16030. /**
  16031. * A specialized version of `_.sample` for arrays.
  16032. *
  16033. * @private
  16034. * @param {Array} array The array to sample.
  16035. * @returns {*} Returns the random element.
  16036. */
  16037. function arraySample(array) {
  16038. var length = array.length;
  16039. return length ? array[baseRandom(0, length - 1)] : undefined;
  16040. }
  16041. /**
  16042. * A specialized version of `_.sampleSize` for arrays.
  16043. *
  16044. * @private
  16045. * @param {Array} array The array to sample.
  16046. * @param {number} n The number of elements to sample.
  16047. * @returns {Array} Returns the random elements.
  16048. */
  16049. function arraySampleSize(array, n) {
  16050. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  16051. }
  16052. /**
  16053. * A specialized version of `_.shuffle` for arrays.
  16054. *
  16055. * @private
  16056. * @param {Array} array The array to shuffle.
  16057. * @returns {Array} Returns the new shuffled array.
  16058. */
  16059. function arrayShuffle(array) {
  16060. return shuffleSelf(copyArray(array));
  16061. }
  16062. /**
  16063. * This function is like `assignValue` except that it doesn't assign
  16064. * `undefined` values.
  16065. *
  16066. * @private
  16067. * @param {Object} object The object to modify.
  16068. * @param {string} key The key of the property to assign.
  16069. * @param {*} value The value to assign.
  16070. */
  16071. function assignMergeValue(object, key, value) {
  16072. if ((value !== undefined && !eq(object[key], value)) ||
  16073. (value === undefined && !(key in object))) {
  16074. baseAssignValue(object, key, value);
  16075. }
  16076. }
  16077. /**
  16078. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  16079. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16080. * for equality comparisons.
  16081. *
  16082. * @private
  16083. * @param {Object} object The object to modify.
  16084. * @param {string} key The key of the property to assign.
  16085. * @param {*} value The value to assign.
  16086. */
  16087. function assignValue(object, key, value) {
  16088. var objValue = object[key];
  16089. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  16090. (value === undefined && !(key in object))) {
  16091. baseAssignValue(object, key, value);
  16092. }
  16093. }
  16094. /**
  16095. * Gets the index at which the `key` is found in `array` of key-value pairs.
  16096. *
  16097. * @private
  16098. * @param {Array} array The array to inspect.
  16099. * @param {*} key The key to search for.
  16100. * @returns {number} Returns the index of the matched value, else `-1`.
  16101. */
  16102. function assocIndexOf(array, key) {
  16103. var length = array.length;
  16104. while (length--) {
  16105. if (eq(array[length][0], key)) {
  16106. return length;
  16107. }
  16108. }
  16109. return -1;
  16110. }
  16111. /**
  16112. * Aggregates elements of `collection` on `accumulator` with keys transformed
  16113. * by `iteratee` and values set by `setter`.
  16114. *
  16115. * @private
  16116. * @param {Array|Object} collection The collection to iterate over.
  16117. * @param {Function} setter The function to set `accumulator` values.
  16118. * @param {Function} iteratee The iteratee to transform keys.
  16119. * @param {Object} accumulator The initial aggregated object.
  16120. * @returns {Function} Returns `accumulator`.
  16121. */
  16122. function baseAggregator(collection, setter, iteratee, accumulator) {
  16123. baseEach(collection, function(value, key, collection) {
  16124. setter(accumulator, value, iteratee(value), collection);
  16125. });
  16126. return accumulator;
  16127. }
  16128. /**
  16129. * The base implementation of `_.assign` without support for multiple sources
  16130. * or `customizer` functions.
  16131. *
  16132. * @private
  16133. * @param {Object} object The destination object.
  16134. * @param {Object} source The source object.
  16135. * @returns {Object} Returns `object`.
  16136. */
  16137. function baseAssign(object, source) {
  16138. return object && copyObject(source, keys(source), object);
  16139. }
  16140. /**
  16141. * The base implementation of `_.assignIn` without support for multiple sources
  16142. * or `customizer` functions.
  16143. *
  16144. * @private
  16145. * @param {Object} object The destination object.
  16146. * @param {Object} source The source object.
  16147. * @returns {Object} Returns `object`.
  16148. */
  16149. function baseAssignIn(object, source) {
  16150. return object && copyObject(source, keysIn(source), object);
  16151. }
  16152. /**
  16153. * The base implementation of `assignValue` and `assignMergeValue` without
  16154. * value checks.
  16155. *
  16156. * @private
  16157. * @param {Object} object The object to modify.
  16158. * @param {string} key The key of the property to assign.
  16159. * @param {*} value The value to assign.
  16160. */
  16161. function baseAssignValue(object, key, value) {
  16162. if (key == '__proto__' && defineProperty) {
  16163. defineProperty(object, key, {
  16164. 'configurable': true,
  16165. 'enumerable': true,
  16166. 'value': value,
  16167. 'writable': true
  16168. });
  16169. } else {
  16170. object[key] = value;
  16171. }
  16172. }
  16173. /**
  16174. * The base implementation of `_.at` without support for individual paths.
  16175. *
  16176. * @private
  16177. * @param {Object} object The object to iterate over.
  16178. * @param {string[]} paths The property paths to pick.
  16179. * @returns {Array} Returns the picked elements.
  16180. */
  16181. function baseAt(object, paths) {
  16182. var index = -1,
  16183. length = paths.length,
  16184. result = Array(length),
  16185. skip = object == null;
  16186. while (++index < length) {
  16187. result[index] = skip ? undefined : get(object, paths[index]);
  16188. }
  16189. return result;
  16190. }
  16191. /**
  16192. * The base implementation of `_.clamp` which doesn't coerce arguments.
  16193. *
  16194. * @private
  16195. * @param {number} number The number to clamp.
  16196. * @param {number} [lower] The lower bound.
  16197. * @param {number} upper The upper bound.
  16198. * @returns {number} Returns the clamped number.
  16199. */
  16200. function baseClamp(number, lower, upper) {
  16201. if (number === number) {
  16202. if (upper !== undefined) {
  16203. number = number <= upper ? number : upper;
  16204. }
  16205. if (lower !== undefined) {
  16206. number = number >= lower ? number : lower;
  16207. }
  16208. }
  16209. return number;
  16210. }
  16211. /**
  16212. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  16213. * traversed objects.
  16214. *
  16215. * @private
  16216. * @param {*} value The value to clone.
  16217. * @param {boolean} bitmask The bitmask flags.
  16218. * 1 - Deep clone
  16219. * 2 - Flatten inherited properties
  16220. * 4 - Clone symbols
  16221. * @param {Function} [customizer] The function to customize cloning.
  16222. * @param {string} [key] The key of `value`.
  16223. * @param {Object} [object] The parent object of `value`.
  16224. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  16225. * @returns {*} Returns the cloned value.
  16226. */
  16227. function baseClone(value, bitmask, customizer, key, object, stack) {
  16228. var result,
  16229. isDeep = bitmask & CLONE_DEEP_FLAG,
  16230. isFlat = bitmask & CLONE_FLAT_FLAG,
  16231. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  16232. if (customizer) {
  16233. result = object ? customizer(value, key, object, stack) : customizer(value);
  16234. }
  16235. if (result !== undefined) {
  16236. return result;
  16237. }
  16238. if (!isObject(value)) {
  16239. return value;
  16240. }
  16241. var isArr = isArray(value);
  16242. if (isArr) {
  16243. result = initCloneArray(value);
  16244. if (!isDeep) {
  16245. return copyArray(value, result);
  16246. }
  16247. } else {
  16248. var tag = getTag(value),
  16249. isFunc = tag == funcTag || tag == genTag;
  16250. if (isBuffer(value)) {
  16251. return cloneBuffer(value, isDeep);
  16252. }
  16253. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  16254. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  16255. if (!isDeep) {
  16256. return isFlat
  16257. ? copySymbolsIn(value, baseAssignIn(result, value))
  16258. : copySymbols(value, baseAssign(result, value));
  16259. }
  16260. } else {
  16261. if (!cloneableTags[tag]) {
  16262. return object ? value : {};
  16263. }
  16264. result = initCloneByTag(value, tag, isDeep);
  16265. }
  16266. }
  16267. // Check for circular references and return its corresponding clone.
  16268. stack || (stack = new Stack);
  16269. var stacked = stack.get(value);
  16270. if (stacked) {
  16271. return stacked;
  16272. }
  16273. stack.set(value, result);
  16274. if (isSet(value)) {
  16275. value.forEach(function(subValue) {
  16276. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  16277. });
  16278. } else if (isMap(value)) {
  16279. value.forEach(function(subValue, key) {
  16280. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16281. });
  16282. }
  16283. var keysFunc = isFull
  16284. ? (isFlat ? getAllKeysIn : getAllKeys)
  16285. : (isFlat ? keysIn : keys);
  16286. var props = isArr ? undefined : keysFunc(value);
  16287. arrayEach(props || value, function(subValue, key) {
  16288. if (props) {
  16289. key = subValue;
  16290. subValue = value[key];
  16291. }
  16292. // Recursively populate clone (susceptible to call stack limits).
  16293. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16294. });
  16295. return result;
  16296. }
  16297. /**
  16298. * The base implementation of `_.conforms` which doesn't clone `source`.
  16299. *
  16300. * @private
  16301. * @param {Object} source The object of property predicates to conform to.
  16302. * @returns {Function} Returns the new spec function.
  16303. */
  16304. function baseConforms(source) {
  16305. var props = keys(source);
  16306. return function(object) {
  16307. return baseConformsTo(object, source, props);
  16308. };
  16309. }
  16310. /**
  16311. * The base implementation of `_.conformsTo` which accepts `props` to check.
  16312. *
  16313. * @private
  16314. * @param {Object} object The object to inspect.
  16315. * @param {Object} source The object of property predicates to conform to.
  16316. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  16317. */
  16318. function baseConformsTo(object, source, props) {
  16319. var length = props.length;
  16320. if (object == null) {
  16321. return !length;
  16322. }
  16323. object = Object(object);
  16324. while (length--) {
  16325. var key = props[length],
  16326. predicate = source[key],
  16327. value = object[key];
  16328. if ((value === undefined && !(key in object)) || !predicate(value)) {
  16329. return false;
  16330. }
  16331. }
  16332. return true;
  16333. }
  16334. /**
  16335. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  16336. * to provide to `func`.
  16337. *
  16338. * @private
  16339. * @param {Function} func The function to delay.
  16340. * @param {number} wait The number of milliseconds to delay invocation.
  16341. * @param {Array} args The arguments to provide to `func`.
  16342. * @returns {number|Object} Returns the timer id or timeout object.
  16343. */
  16344. function baseDelay(func, wait, args) {
  16345. if (typeof func != 'function') {
  16346. throw new TypeError(FUNC_ERROR_TEXT);
  16347. }
  16348. return setTimeout(function() { func.apply(undefined, args); }, wait);
  16349. }
  16350. /**
  16351. * The base implementation of methods like `_.difference` without support
  16352. * for excluding multiple arrays or iteratee shorthands.
  16353. *
  16354. * @private
  16355. * @param {Array} array The array to inspect.
  16356. * @param {Array} values The values to exclude.
  16357. * @param {Function} [iteratee] The iteratee invoked per element.
  16358. * @param {Function} [comparator] The comparator invoked per element.
  16359. * @returns {Array} Returns the new array of filtered values.
  16360. */
  16361. function baseDifference(array, values, iteratee, comparator) {
  16362. var index = -1,
  16363. includes = arrayIncludes,
  16364. isCommon = true,
  16365. length = array.length,
  16366. result = [],
  16367. valuesLength = values.length;
  16368. if (!length) {
  16369. return result;
  16370. }
  16371. if (iteratee) {
  16372. values = arrayMap(values, baseUnary(iteratee));
  16373. }
  16374. if (comparator) {
  16375. includes = arrayIncludesWith;
  16376. isCommon = false;
  16377. }
  16378. else if (values.length >= LARGE_ARRAY_SIZE) {
  16379. includes = cacheHas;
  16380. isCommon = false;
  16381. values = new SetCache(values);
  16382. }
  16383. outer:
  16384. while (++index < length) {
  16385. var value = array[index],
  16386. computed = iteratee == null ? value : iteratee(value);
  16387. value = (comparator || value !== 0) ? value : 0;
  16388. if (isCommon && computed === computed) {
  16389. var valuesIndex = valuesLength;
  16390. while (valuesIndex--) {
  16391. if (values[valuesIndex] === computed) {
  16392. continue outer;
  16393. }
  16394. }
  16395. result.push(value);
  16396. }
  16397. else if (!includes(values, computed, comparator)) {
  16398. result.push(value);
  16399. }
  16400. }
  16401. return result;
  16402. }
  16403. /**
  16404. * The base implementation of `_.forEach` without support for iteratee shorthands.
  16405. *
  16406. * @private
  16407. * @param {Array|Object} collection The collection to iterate over.
  16408. * @param {Function} iteratee The function invoked per iteration.
  16409. * @returns {Array|Object} Returns `collection`.
  16410. */
  16411. var baseEach = createBaseEach(baseForOwn);
  16412. /**
  16413. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  16414. *
  16415. * @private
  16416. * @param {Array|Object} collection The collection to iterate over.
  16417. * @param {Function} iteratee The function invoked per iteration.
  16418. * @returns {Array|Object} Returns `collection`.
  16419. */
  16420. var baseEachRight = createBaseEach(baseForOwnRight, true);
  16421. /**
  16422. * The base implementation of `_.every` without support for iteratee shorthands.
  16423. *
  16424. * @private
  16425. * @param {Array|Object} collection The collection to iterate over.
  16426. * @param {Function} predicate The function invoked per iteration.
  16427. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  16428. * else `false`
  16429. */
  16430. function baseEvery(collection, predicate) {
  16431. var result = true;
  16432. baseEach(collection, function(value, index, collection) {
  16433. result = !!predicate(value, index, collection);
  16434. return result;
  16435. });
  16436. return result;
  16437. }
  16438. /**
  16439. * The base implementation of methods like `_.max` and `_.min` which accepts a
  16440. * `comparator` to determine the extremum value.
  16441. *
  16442. * @private
  16443. * @param {Array} array The array to iterate over.
  16444. * @param {Function} iteratee The iteratee invoked per iteration.
  16445. * @param {Function} comparator The comparator used to compare values.
  16446. * @returns {*} Returns the extremum value.
  16447. */
  16448. function baseExtremum(array, iteratee, comparator) {
  16449. var index = -1,
  16450. length = array.length;
  16451. while (++index < length) {
  16452. var value = array[index],
  16453. current = iteratee(value);
  16454. if (current != null && (computed === undefined
  16455. ? (current === current && !isSymbol(current))
  16456. : comparator(current, computed)
  16457. )) {
  16458. var computed = current,
  16459. result = value;
  16460. }
  16461. }
  16462. return result;
  16463. }
  16464. /**
  16465. * The base implementation of `_.fill` without an iteratee call guard.
  16466. *
  16467. * @private
  16468. * @param {Array} array The array to fill.
  16469. * @param {*} value The value to fill `array` with.
  16470. * @param {number} [start=0] The start position.
  16471. * @param {number} [end=array.length] The end position.
  16472. * @returns {Array} Returns `array`.
  16473. */
  16474. function baseFill(array, value, start, end) {
  16475. var length = array.length;
  16476. start = toInteger(start);
  16477. if (start < 0) {
  16478. start = -start > length ? 0 : (length + start);
  16479. }
  16480. end = (end === undefined || end > length) ? length : toInteger(end);
  16481. if (end < 0) {
  16482. end += length;
  16483. }
  16484. end = start > end ? 0 : toLength(end);
  16485. while (start < end) {
  16486. array[start++] = value;
  16487. }
  16488. return array;
  16489. }
  16490. /**
  16491. * The base implementation of `_.filter` without support for iteratee shorthands.
  16492. *
  16493. * @private
  16494. * @param {Array|Object} collection The collection to iterate over.
  16495. * @param {Function} predicate The function invoked per iteration.
  16496. * @returns {Array} Returns the new filtered array.
  16497. */
  16498. function baseFilter(collection, predicate) {
  16499. var result = [];
  16500. baseEach(collection, function(value, index, collection) {
  16501. if (predicate(value, index, collection)) {
  16502. result.push(value);
  16503. }
  16504. });
  16505. return result;
  16506. }
  16507. /**
  16508. * The base implementation of `_.flatten` with support for restricting flattening.
  16509. *
  16510. * @private
  16511. * @param {Array} array The array to flatten.
  16512. * @param {number} depth The maximum recursion depth.
  16513. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16514. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16515. * @param {Array} [result=[]] The initial result value.
  16516. * @returns {Array} Returns the new flattened array.
  16517. */
  16518. function baseFlatten(array, depth, predicate, isStrict, result) {
  16519. var index = -1,
  16520. length = array.length;
  16521. predicate || (predicate = isFlattenable);
  16522. result || (result = []);
  16523. while (++index < length) {
  16524. var value = array[index];
  16525. if (depth > 0 && predicate(value)) {
  16526. if (depth > 1) {
  16527. // Recursively flatten arrays (susceptible to call stack limits).
  16528. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16529. } else {
  16530. arrayPush(result, value);
  16531. }
  16532. } else if (!isStrict) {
  16533. result[result.length] = value;
  16534. }
  16535. }
  16536. return result;
  16537. }
  16538. /**
  16539. * The base implementation of `baseForOwn` which iterates over `object`
  16540. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16541. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16542. *
  16543. * @private
  16544. * @param {Object} object The object to iterate over.
  16545. * @param {Function} iteratee The function invoked per iteration.
  16546. * @param {Function} keysFunc The function to get the keys of `object`.
  16547. * @returns {Object} Returns `object`.
  16548. */
  16549. var baseFor = createBaseFor();
  16550. /**
  16551. * This function is like `baseFor` except that it iterates over properties
  16552. * in the opposite order.
  16553. *
  16554. * @private
  16555. * @param {Object} object The object to iterate over.
  16556. * @param {Function} iteratee The function invoked per iteration.
  16557. * @param {Function} keysFunc The function to get the keys of `object`.
  16558. * @returns {Object} Returns `object`.
  16559. */
  16560. var baseForRight = createBaseFor(true);
  16561. /**
  16562. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16563. *
  16564. * @private
  16565. * @param {Object} object The object to iterate over.
  16566. * @param {Function} iteratee The function invoked per iteration.
  16567. * @returns {Object} Returns `object`.
  16568. */
  16569. function baseForOwn(object, iteratee) {
  16570. return object && baseFor(object, iteratee, keys);
  16571. }
  16572. /**
  16573. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16574. *
  16575. * @private
  16576. * @param {Object} object The object to iterate over.
  16577. * @param {Function} iteratee The function invoked per iteration.
  16578. * @returns {Object} Returns `object`.
  16579. */
  16580. function baseForOwnRight(object, iteratee) {
  16581. return object && baseForRight(object, iteratee, keys);
  16582. }
  16583. /**
  16584. * The base implementation of `_.functions` which creates an array of
  16585. * `object` function property names filtered from `props`.
  16586. *
  16587. * @private
  16588. * @param {Object} object The object to inspect.
  16589. * @param {Array} props The property names to filter.
  16590. * @returns {Array} Returns the function names.
  16591. */
  16592. function baseFunctions(object, props) {
  16593. return arrayFilter(props, function(key) {
  16594. return isFunction(object[key]);
  16595. });
  16596. }
  16597. /**
  16598. * The base implementation of `_.get` without support for default values.
  16599. *
  16600. * @private
  16601. * @param {Object} object The object to query.
  16602. * @param {Array|string} path The path of the property to get.
  16603. * @returns {*} Returns the resolved value.
  16604. */
  16605. function baseGet(object, path) {
  16606. path = castPath(path, object);
  16607. var index = 0,
  16608. length = path.length;
  16609. while (object != null && index < length) {
  16610. object = object[toKey(path[index++])];
  16611. }
  16612. return (index && index == length) ? object : undefined;
  16613. }
  16614. /**
  16615. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16616. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16617. * symbols of `object`.
  16618. *
  16619. * @private
  16620. * @param {Object} object The object to query.
  16621. * @param {Function} keysFunc The function to get the keys of `object`.
  16622. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16623. * @returns {Array} Returns the array of property names and symbols.
  16624. */
  16625. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16626. var result = keysFunc(object);
  16627. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16628. }
  16629. /**
  16630. * The base implementation of `getTag` without fallbacks for buggy environments.
  16631. *
  16632. * @private
  16633. * @param {*} value The value to query.
  16634. * @returns {string} Returns the `toStringTag`.
  16635. */
  16636. function baseGetTag(value) {
  16637. if (value == null) {
  16638. return value === undefined ? undefinedTag : nullTag;
  16639. }
  16640. return (symToStringTag && symToStringTag in Object(value))
  16641. ? getRawTag(value)
  16642. : objectToString(value);
  16643. }
  16644. /**
  16645. * The base implementation of `_.gt` which doesn't coerce arguments.
  16646. *
  16647. * @private
  16648. * @param {*} value The value to compare.
  16649. * @param {*} other The other value to compare.
  16650. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16651. * else `false`.
  16652. */
  16653. function baseGt(value, other) {
  16654. return value > other;
  16655. }
  16656. /**
  16657. * The base implementation of `_.has` without support for deep paths.
  16658. *
  16659. * @private
  16660. * @param {Object} [object] The object to query.
  16661. * @param {Array|string} key The key to check.
  16662. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16663. */
  16664. function baseHas(object, key) {
  16665. return object != null && hasOwnProperty.call(object, key);
  16666. }
  16667. /**
  16668. * The base implementation of `_.hasIn` without support for deep paths.
  16669. *
  16670. * @private
  16671. * @param {Object} [object] The object to query.
  16672. * @param {Array|string} key The key to check.
  16673. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16674. */
  16675. function baseHasIn(object, key) {
  16676. return object != null && key in Object(object);
  16677. }
  16678. /**
  16679. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16680. *
  16681. * @private
  16682. * @param {number} number The number to check.
  16683. * @param {number} start The start of the range.
  16684. * @param {number} end The end of the range.
  16685. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16686. */
  16687. function baseInRange(number, start, end) {
  16688. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16689. }
  16690. /**
  16691. * The base implementation of methods like `_.intersection`, without support
  16692. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16693. *
  16694. * @private
  16695. * @param {Array} arrays The arrays to inspect.
  16696. * @param {Function} [iteratee] The iteratee invoked per element.
  16697. * @param {Function} [comparator] The comparator invoked per element.
  16698. * @returns {Array} Returns the new array of shared values.
  16699. */
  16700. function baseIntersection(arrays, iteratee, comparator) {
  16701. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16702. length = arrays[0].length,
  16703. othLength = arrays.length,
  16704. othIndex = othLength,
  16705. caches = Array(othLength),
  16706. maxLength = Infinity,
  16707. result = [];
  16708. while (othIndex--) {
  16709. var array = arrays[othIndex];
  16710. if (othIndex && iteratee) {
  16711. array = arrayMap(array, baseUnary(iteratee));
  16712. }
  16713. maxLength = nativeMin(array.length, maxLength);
  16714. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16715. ? new SetCache(othIndex && array)
  16716. : undefined;
  16717. }
  16718. array = arrays[0];
  16719. var index = -1,
  16720. seen = caches[0];
  16721. outer:
  16722. while (++index < length && result.length < maxLength) {
  16723. var value = array[index],
  16724. computed = iteratee ? iteratee(value) : value;
  16725. value = (comparator || value !== 0) ? value : 0;
  16726. if (!(seen
  16727. ? cacheHas(seen, computed)
  16728. : includes(result, computed, comparator)
  16729. )) {
  16730. othIndex = othLength;
  16731. while (--othIndex) {
  16732. var cache = caches[othIndex];
  16733. if (!(cache
  16734. ? cacheHas(cache, computed)
  16735. : includes(arrays[othIndex], computed, comparator))
  16736. ) {
  16737. continue outer;
  16738. }
  16739. }
  16740. if (seen) {
  16741. seen.push(computed);
  16742. }
  16743. result.push(value);
  16744. }
  16745. }
  16746. return result;
  16747. }
  16748. /**
  16749. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16750. * `object` with values transformed by `iteratee` and set by `setter`.
  16751. *
  16752. * @private
  16753. * @param {Object} object The object to iterate over.
  16754. * @param {Function} setter The function to set `accumulator` values.
  16755. * @param {Function} iteratee The iteratee to transform values.
  16756. * @param {Object} accumulator The initial inverted object.
  16757. * @returns {Function} Returns `accumulator`.
  16758. */
  16759. function baseInverter(object, setter, iteratee, accumulator) {
  16760. baseForOwn(object, function(value, key, object) {
  16761. setter(accumulator, iteratee(value), key, object);
  16762. });
  16763. return accumulator;
  16764. }
  16765. /**
  16766. * The base implementation of `_.invoke` without support for individual
  16767. * method arguments.
  16768. *
  16769. * @private
  16770. * @param {Object} object The object to query.
  16771. * @param {Array|string} path The path of the method to invoke.
  16772. * @param {Array} args The arguments to invoke the method with.
  16773. * @returns {*} Returns the result of the invoked method.
  16774. */
  16775. function baseInvoke(object, path, args) {
  16776. path = castPath(path, object);
  16777. object = parent(object, path);
  16778. var func = object == null ? object : object[toKey(last(path))];
  16779. return func == null ? undefined : apply(func, object, args);
  16780. }
  16781. /**
  16782. * The base implementation of `_.isArguments`.
  16783. *
  16784. * @private
  16785. * @param {*} value The value to check.
  16786. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16787. */
  16788. function baseIsArguments(value) {
  16789. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16790. }
  16791. /**
  16792. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16793. *
  16794. * @private
  16795. * @param {*} value The value to check.
  16796. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16797. */
  16798. function baseIsArrayBuffer(value) {
  16799. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16800. }
  16801. /**
  16802. * The base implementation of `_.isDate` without Node.js optimizations.
  16803. *
  16804. * @private
  16805. * @param {*} value The value to check.
  16806. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16807. */
  16808. function baseIsDate(value) {
  16809. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16810. }
  16811. /**
  16812. * The base implementation of `_.isEqual` which supports partial comparisons
  16813. * and tracks traversed objects.
  16814. *
  16815. * @private
  16816. * @param {*} value The value to compare.
  16817. * @param {*} other The other value to compare.
  16818. * @param {boolean} bitmask The bitmask flags.
  16819. * 1 - Unordered comparison
  16820. * 2 - Partial comparison
  16821. * @param {Function} [customizer] The function to customize comparisons.
  16822. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16823. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16824. */
  16825. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16826. if (value === other) {
  16827. return true;
  16828. }
  16829. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16830. return value !== value && other !== other;
  16831. }
  16832. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16833. }
  16834. /**
  16835. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16836. * deep comparisons and tracks traversed objects enabling objects with circular
  16837. * references to be compared.
  16838. *
  16839. * @private
  16840. * @param {Object} object The object to compare.
  16841. * @param {Object} other The other object to compare.
  16842. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16843. * @param {Function} customizer The function to customize comparisons.
  16844. * @param {Function} equalFunc The function to determine equivalents of values.
  16845. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16846. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16847. */
  16848. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16849. var objIsArr = isArray(object),
  16850. othIsArr = isArray(other),
  16851. objTag = objIsArr ? arrayTag : getTag(object),
  16852. othTag = othIsArr ? arrayTag : getTag(other);
  16853. objTag = objTag == argsTag ? objectTag : objTag;
  16854. othTag = othTag == argsTag ? objectTag : othTag;
  16855. var objIsObj = objTag == objectTag,
  16856. othIsObj = othTag == objectTag,
  16857. isSameTag = objTag == othTag;
  16858. if (isSameTag && isBuffer(object)) {
  16859. if (!isBuffer(other)) {
  16860. return false;
  16861. }
  16862. objIsArr = true;
  16863. objIsObj = false;
  16864. }
  16865. if (isSameTag && !objIsObj) {
  16866. stack || (stack = new Stack);
  16867. return (objIsArr || isTypedArray(object))
  16868. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16869. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  16870. }
  16871. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  16872. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  16873. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  16874. if (objIsWrapped || othIsWrapped) {
  16875. var objUnwrapped = objIsWrapped ? object.value() : object,
  16876. othUnwrapped = othIsWrapped ? other.value() : other;
  16877. stack || (stack = new Stack);
  16878. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  16879. }
  16880. }
  16881. if (!isSameTag) {
  16882. return false;
  16883. }
  16884. stack || (stack = new Stack);
  16885. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  16886. }
  16887. /**
  16888. * The base implementation of `_.isMap` without Node.js optimizations.
  16889. *
  16890. * @private
  16891. * @param {*} value The value to check.
  16892. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  16893. */
  16894. function baseIsMap(value) {
  16895. return isObjectLike(value) && getTag(value) == mapTag;
  16896. }
  16897. /**
  16898. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  16899. *
  16900. * @private
  16901. * @param {Object} object The object to inspect.
  16902. * @param {Object} source The object of property values to match.
  16903. * @param {Array} matchData The property names, values, and compare flags to match.
  16904. * @param {Function} [customizer] The function to customize comparisons.
  16905. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  16906. */
  16907. function baseIsMatch(object, source, matchData, customizer) {
  16908. var index = matchData.length,
  16909. length = index,
  16910. noCustomizer = !customizer;
  16911. if (object == null) {
  16912. return !length;
  16913. }
  16914. object = Object(object);
  16915. while (index--) {
  16916. var data = matchData[index];
  16917. if ((noCustomizer && data[2])
  16918. ? data[1] !== object[data[0]]
  16919. : !(data[0] in object)
  16920. ) {
  16921. return false;
  16922. }
  16923. }
  16924. while (++index < length) {
  16925. data = matchData[index];
  16926. var key = data[0],
  16927. objValue = object[key],
  16928. srcValue = data[1];
  16929. if (noCustomizer && data[2]) {
  16930. if (objValue === undefined && !(key in object)) {
  16931. return false;
  16932. }
  16933. } else {
  16934. var stack = new Stack;
  16935. if (customizer) {
  16936. var result = customizer(objValue, srcValue, key, object, source, stack);
  16937. }
  16938. if (!(result === undefined
  16939. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  16940. : result
  16941. )) {
  16942. return false;
  16943. }
  16944. }
  16945. }
  16946. return true;
  16947. }
  16948. /**
  16949. * The base implementation of `_.isNative` without bad shim checks.
  16950. *
  16951. * @private
  16952. * @param {*} value The value to check.
  16953. * @returns {boolean} Returns `true` if `value` is a native function,
  16954. * else `false`.
  16955. */
  16956. function baseIsNative(value) {
  16957. if (!isObject(value) || isMasked(value)) {
  16958. return false;
  16959. }
  16960. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  16961. return pattern.test(toSource(value));
  16962. }
  16963. /**
  16964. * The base implementation of `_.isRegExp` without Node.js optimizations.
  16965. *
  16966. * @private
  16967. * @param {*} value The value to check.
  16968. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  16969. */
  16970. function baseIsRegExp(value) {
  16971. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  16972. }
  16973. /**
  16974. * The base implementation of `_.isSet` without Node.js optimizations.
  16975. *
  16976. * @private
  16977. * @param {*} value The value to check.
  16978. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  16979. */
  16980. function baseIsSet(value) {
  16981. return isObjectLike(value) && getTag(value) == setTag;
  16982. }
  16983. /**
  16984. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  16985. *
  16986. * @private
  16987. * @param {*} value The value to check.
  16988. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  16989. */
  16990. function baseIsTypedArray(value) {
  16991. return isObjectLike(value) &&
  16992. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  16993. }
  16994. /**
  16995. * The base implementation of `_.iteratee`.
  16996. *
  16997. * @private
  16998. * @param {*} [value=_.identity] The value to convert to an iteratee.
  16999. * @returns {Function} Returns the iteratee.
  17000. */
  17001. function baseIteratee(value) {
  17002. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  17003. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  17004. if (typeof value == 'function') {
  17005. return value;
  17006. }
  17007. if (value == null) {
  17008. return identity;
  17009. }
  17010. if (typeof value == 'object') {
  17011. return isArray(value)
  17012. ? baseMatchesProperty(value[0], value[1])
  17013. : baseMatches(value);
  17014. }
  17015. return property(value);
  17016. }
  17017. /**
  17018. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  17019. *
  17020. * @private
  17021. * @param {Object} object The object to query.
  17022. * @returns {Array} Returns the array of property names.
  17023. */
  17024. function baseKeys(object) {
  17025. if (!isPrototype(object)) {
  17026. return nativeKeys(object);
  17027. }
  17028. var result = [];
  17029. for (var key in Object(object)) {
  17030. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  17031. result.push(key);
  17032. }
  17033. }
  17034. return result;
  17035. }
  17036. /**
  17037. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  17038. *
  17039. * @private
  17040. * @param {Object} object The object to query.
  17041. * @returns {Array} Returns the array of property names.
  17042. */
  17043. function baseKeysIn(object) {
  17044. if (!isObject(object)) {
  17045. return nativeKeysIn(object);
  17046. }
  17047. var isProto = isPrototype(object),
  17048. result = [];
  17049. for (var key in object) {
  17050. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  17051. result.push(key);
  17052. }
  17053. }
  17054. return result;
  17055. }
  17056. /**
  17057. * The base implementation of `_.lt` which doesn't coerce arguments.
  17058. *
  17059. * @private
  17060. * @param {*} value The value to compare.
  17061. * @param {*} other The other value to compare.
  17062. * @returns {boolean} Returns `true` if `value` is less than `other`,
  17063. * else `false`.
  17064. */
  17065. function baseLt(value, other) {
  17066. return value < other;
  17067. }
  17068. /**
  17069. * The base implementation of `_.map` without support for iteratee shorthands.
  17070. *
  17071. * @private
  17072. * @param {Array|Object} collection The collection to iterate over.
  17073. * @param {Function} iteratee The function invoked per iteration.
  17074. * @returns {Array} Returns the new mapped array.
  17075. */
  17076. function baseMap(collection, iteratee) {
  17077. var index = -1,
  17078. result = isArrayLike(collection) ? Array(collection.length) : [];
  17079. baseEach(collection, function(value, key, collection) {
  17080. result[++index] = iteratee(value, key, collection);
  17081. });
  17082. return result;
  17083. }
  17084. /**
  17085. * The base implementation of `_.matches` which doesn't clone `source`.
  17086. *
  17087. * @private
  17088. * @param {Object} source The object of property values to match.
  17089. * @returns {Function} Returns the new spec function.
  17090. */
  17091. function baseMatches(source) {
  17092. var matchData = getMatchData(source);
  17093. if (matchData.length == 1 && matchData[0][2]) {
  17094. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  17095. }
  17096. return function(object) {
  17097. return object === source || baseIsMatch(object, source, matchData);
  17098. };
  17099. }
  17100. /**
  17101. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  17102. *
  17103. * @private
  17104. * @param {string} path The path of the property to get.
  17105. * @param {*} srcValue The value to match.
  17106. * @returns {Function} Returns the new spec function.
  17107. */
  17108. function baseMatchesProperty(path, srcValue) {
  17109. if (isKey(path) && isStrictComparable(srcValue)) {
  17110. return matchesStrictComparable(toKey(path), srcValue);
  17111. }
  17112. return function(object) {
  17113. var objValue = get(object, path);
  17114. return (objValue === undefined && objValue === srcValue)
  17115. ? hasIn(object, path)
  17116. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  17117. };
  17118. }
  17119. /**
  17120. * The base implementation of `_.merge` without support for multiple sources.
  17121. *
  17122. * @private
  17123. * @param {Object} object The destination object.
  17124. * @param {Object} source The source object.
  17125. * @param {number} srcIndex The index of `source`.
  17126. * @param {Function} [customizer] The function to customize merged values.
  17127. * @param {Object} [stack] Tracks traversed source values and their merged
  17128. * counterparts.
  17129. */
  17130. function baseMerge(object, source, srcIndex, customizer, stack) {
  17131. if (object === source) {
  17132. return;
  17133. }
  17134. baseFor(source, function(srcValue, key) {
  17135. stack || (stack = new Stack);
  17136. if (isObject(srcValue)) {
  17137. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  17138. }
  17139. else {
  17140. var newValue = customizer
  17141. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  17142. : undefined;
  17143. if (newValue === undefined) {
  17144. newValue = srcValue;
  17145. }
  17146. assignMergeValue(object, key, newValue);
  17147. }
  17148. }, keysIn);
  17149. }
  17150. /**
  17151. * A specialized version of `baseMerge` for arrays and objects which performs
  17152. * deep merges and tracks traversed objects enabling objects with circular
  17153. * references to be merged.
  17154. *
  17155. * @private
  17156. * @param {Object} object The destination object.
  17157. * @param {Object} source The source object.
  17158. * @param {string} key The key of the value to merge.
  17159. * @param {number} srcIndex The index of `source`.
  17160. * @param {Function} mergeFunc The function to merge values.
  17161. * @param {Function} [customizer] The function to customize assigned values.
  17162. * @param {Object} [stack] Tracks traversed source values and their merged
  17163. * counterparts.
  17164. */
  17165. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  17166. var objValue = safeGet(object, key),
  17167. srcValue = safeGet(source, key),
  17168. stacked = stack.get(srcValue);
  17169. if (stacked) {
  17170. assignMergeValue(object, key, stacked);
  17171. return;
  17172. }
  17173. var newValue = customizer
  17174. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  17175. : undefined;
  17176. var isCommon = newValue === undefined;
  17177. if (isCommon) {
  17178. var isArr = isArray(srcValue),
  17179. isBuff = !isArr && isBuffer(srcValue),
  17180. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  17181. newValue = srcValue;
  17182. if (isArr || isBuff || isTyped) {
  17183. if (isArray(objValue)) {
  17184. newValue = objValue;
  17185. }
  17186. else if (isArrayLikeObject(objValue)) {
  17187. newValue = copyArray(objValue);
  17188. }
  17189. else if (isBuff) {
  17190. isCommon = false;
  17191. newValue = cloneBuffer(srcValue, true);
  17192. }
  17193. else if (isTyped) {
  17194. isCommon = false;
  17195. newValue = cloneTypedArray(srcValue, true);
  17196. }
  17197. else {
  17198. newValue = [];
  17199. }
  17200. }
  17201. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  17202. newValue = objValue;
  17203. if (isArguments(objValue)) {
  17204. newValue = toPlainObject(objValue);
  17205. }
  17206. else if (!isObject(objValue) || isFunction(objValue)) {
  17207. newValue = initCloneObject(srcValue);
  17208. }
  17209. }
  17210. else {
  17211. isCommon = false;
  17212. }
  17213. }
  17214. if (isCommon) {
  17215. // Recursively merge objects and arrays (susceptible to call stack limits).
  17216. stack.set(srcValue, newValue);
  17217. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  17218. stack['delete'](srcValue);
  17219. }
  17220. assignMergeValue(object, key, newValue);
  17221. }
  17222. /**
  17223. * The base implementation of `_.nth` which doesn't coerce arguments.
  17224. *
  17225. * @private
  17226. * @param {Array} array The array to query.
  17227. * @param {number} n The index of the element to return.
  17228. * @returns {*} Returns the nth element of `array`.
  17229. */
  17230. function baseNth(array, n) {
  17231. var length = array.length;
  17232. if (!length) {
  17233. return;
  17234. }
  17235. n += n < 0 ? length : 0;
  17236. return isIndex(n, length) ? array[n] : undefined;
  17237. }
  17238. /**
  17239. * The base implementation of `_.orderBy` without param guards.
  17240. *
  17241. * @private
  17242. * @param {Array|Object} collection The collection to iterate over.
  17243. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  17244. * @param {string[]} orders The sort orders of `iteratees`.
  17245. * @returns {Array} Returns the new sorted array.
  17246. */
  17247. function baseOrderBy(collection, iteratees, orders) {
  17248. var index = -1;
  17249. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  17250. var result = baseMap(collection, function(value, key, collection) {
  17251. var criteria = arrayMap(iteratees, function(iteratee) {
  17252. return iteratee(value);
  17253. });
  17254. return { 'criteria': criteria, 'index': ++index, 'value': value };
  17255. });
  17256. return baseSortBy(result, function(object, other) {
  17257. return compareMultiple(object, other, orders);
  17258. });
  17259. }
  17260. /**
  17261. * The base implementation of `_.pick` without support for individual
  17262. * property identifiers.
  17263. *
  17264. * @private
  17265. * @param {Object} object The source object.
  17266. * @param {string[]} paths The property paths to pick.
  17267. * @returns {Object} Returns the new object.
  17268. */
  17269. function basePick(object, paths) {
  17270. return basePickBy(object, paths, function(value, path) {
  17271. return hasIn(object, path);
  17272. });
  17273. }
  17274. /**
  17275. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  17276. *
  17277. * @private
  17278. * @param {Object} object The source object.
  17279. * @param {string[]} paths The property paths to pick.
  17280. * @param {Function} predicate The function invoked per property.
  17281. * @returns {Object} Returns the new object.
  17282. */
  17283. function basePickBy(object, paths, predicate) {
  17284. var index = -1,
  17285. length = paths.length,
  17286. result = {};
  17287. while (++index < length) {
  17288. var path = paths[index],
  17289. value = baseGet(object, path);
  17290. if (predicate(value, path)) {
  17291. baseSet(result, castPath(path, object), value);
  17292. }
  17293. }
  17294. return result;
  17295. }
  17296. /**
  17297. * A specialized version of `baseProperty` which supports deep paths.
  17298. *
  17299. * @private
  17300. * @param {Array|string} path The path of the property to get.
  17301. * @returns {Function} Returns the new accessor function.
  17302. */
  17303. function basePropertyDeep(path) {
  17304. return function(object) {
  17305. return baseGet(object, path);
  17306. };
  17307. }
  17308. /**
  17309. * The base implementation of `_.pullAllBy` without support for iteratee
  17310. * shorthands.
  17311. *
  17312. * @private
  17313. * @param {Array} array The array to modify.
  17314. * @param {Array} values The values to remove.
  17315. * @param {Function} [iteratee] The iteratee invoked per element.
  17316. * @param {Function} [comparator] The comparator invoked per element.
  17317. * @returns {Array} Returns `array`.
  17318. */
  17319. function basePullAll(array, values, iteratee, comparator) {
  17320. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  17321. index = -1,
  17322. length = values.length,
  17323. seen = array;
  17324. if (array === values) {
  17325. values = copyArray(values);
  17326. }
  17327. if (iteratee) {
  17328. seen = arrayMap(array, baseUnary(iteratee));
  17329. }
  17330. while (++index < length) {
  17331. var fromIndex = 0,
  17332. value = values[index],
  17333. computed = iteratee ? iteratee(value) : value;
  17334. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  17335. if (seen !== array) {
  17336. splice.call(seen, fromIndex, 1);
  17337. }
  17338. splice.call(array, fromIndex, 1);
  17339. }
  17340. }
  17341. return array;
  17342. }
  17343. /**
  17344. * The base implementation of `_.pullAt` without support for individual
  17345. * indexes or capturing the removed elements.
  17346. *
  17347. * @private
  17348. * @param {Array} array The array to modify.
  17349. * @param {number[]} indexes The indexes of elements to remove.
  17350. * @returns {Array} Returns `array`.
  17351. */
  17352. function basePullAt(array, indexes) {
  17353. var length = array ? indexes.length : 0,
  17354. lastIndex = length - 1;
  17355. while (length--) {
  17356. var index = indexes[length];
  17357. if (length == lastIndex || index !== previous) {
  17358. var previous = index;
  17359. if (isIndex(index)) {
  17360. splice.call(array, index, 1);
  17361. } else {
  17362. baseUnset(array, index);
  17363. }
  17364. }
  17365. }
  17366. return array;
  17367. }
  17368. /**
  17369. * The base implementation of `_.random` without support for returning
  17370. * floating-point numbers.
  17371. *
  17372. * @private
  17373. * @param {number} lower The lower bound.
  17374. * @param {number} upper The upper bound.
  17375. * @returns {number} Returns the random number.
  17376. */
  17377. function baseRandom(lower, upper) {
  17378. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  17379. }
  17380. /**
  17381. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  17382. * coerce arguments.
  17383. *
  17384. * @private
  17385. * @param {number} start The start of the range.
  17386. * @param {number} end The end of the range.
  17387. * @param {number} step The value to increment or decrement by.
  17388. * @param {boolean} [fromRight] Specify iterating from right to left.
  17389. * @returns {Array} Returns the range of numbers.
  17390. */
  17391. function baseRange(start, end, step, fromRight) {
  17392. var index = -1,
  17393. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  17394. result = Array(length);
  17395. while (length--) {
  17396. result[fromRight ? length : ++index] = start;
  17397. start += step;
  17398. }
  17399. return result;
  17400. }
  17401. /**
  17402. * The base implementation of `_.repeat` which doesn't coerce arguments.
  17403. *
  17404. * @private
  17405. * @param {string} string The string to repeat.
  17406. * @param {number} n The number of times to repeat the string.
  17407. * @returns {string} Returns the repeated string.
  17408. */
  17409. function baseRepeat(string, n) {
  17410. var result = '';
  17411. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  17412. return result;
  17413. }
  17414. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  17415. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  17416. do {
  17417. if (n % 2) {
  17418. result += string;
  17419. }
  17420. n = nativeFloor(n / 2);
  17421. if (n) {
  17422. string += string;
  17423. }
  17424. } while (n);
  17425. return result;
  17426. }
  17427. /**
  17428. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  17429. *
  17430. * @private
  17431. * @param {Function} func The function to apply a rest parameter to.
  17432. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17433. * @returns {Function} Returns the new function.
  17434. */
  17435. function baseRest(func, start) {
  17436. return setToString(overRest(func, start, identity), func + '');
  17437. }
  17438. /**
  17439. * The base implementation of `_.sample`.
  17440. *
  17441. * @private
  17442. * @param {Array|Object} collection The collection to sample.
  17443. * @returns {*} Returns the random element.
  17444. */
  17445. function baseSample(collection) {
  17446. return arraySample(values(collection));
  17447. }
  17448. /**
  17449. * The base implementation of `_.sampleSize` without param guards.
  17450. *
  17451. * @private
  17452. * @param {Array|Object} collection The collection to sample.
  17453. * @param {number} n The number of elements to sample.
  17454. * @returns {Array} Returns the random elements.
  17455. */
  17456. function baseSampleSize(collection, n) {
  17457. var array = values(collection);
  17458. return shuffleSelf(array, baseClamp(n, 0, array.length));
  17459. }
  17460. /**
  17461. * The base implementation of `_.set`.
  17462. *
  17463. * @private
  17464. * @param {Object} object The object to modify.
  17465. * @param {Array|string} path The path of the property to set.
  17466. * @param {*} value The value to set.
  17467. * @param {Function} [customizer] The function to customize path creation.
  17468. * @returns {Object} Returns `object`.
  17469. */
  17470. function baseSet(object, path, value, customizer) {
  17471. if (!isObject(object)) {
  17472. return object;
  17473. }
  17474. path = castPath(path, object);
  17475. var index = -1,
  17476. length = path.length,
  17477. lastIndex = length - 1,
  17478. nested = object;
  17479. while (nested != null && ++index < length) {
  17480. var key = toKey(path[index]),
  17481. newValue = value;
  17482. if (index != lastIndex) {
  17483. var objValue = nested[key];
  17484. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17485. if (newValue === undefined) {
  17486. newValue = isObject(objValue)
  17487. ? objValue
  17488. : (isIndex(path[index + 1]) ? [] : {});
  17489. }
  17490. }
  17491. assignValue(nested, key, newValue);
  17492. nested = nested[key];
  17493. }
  17494. return object;
  17495. }
  17496. /**
  17497. * The base implementation of `setData` without support for hot loop shorting.
  17498. *
  17499. * @private
  17500. * @param {Function} func The function to associate metadata with.
  17501. * @param {*} data The metadata.
  17502. * @returns {Function} Returns `func`.
  17503. */
  17504. var baseSetData = !metaMap ? identity : function(func, data) {
  17505. metaMap.set(func, data);
  17506. return func;
  17507. };
  17508. /**
  17509. * The base implementation of `setToString` without support for hot loop shorting.
  17510. *
  17511. * @private
  17512. * @param {Function} func The function to modify.
  17513. * @param {Function} string The `toString` result.
  17514. * @returns {Function} Returns `func`.
  17515. */
  17516. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17517. return defineProperty(func, 'toString', {
  17518. 'configurable': true,
  17519. 'enumerable': false,
  17520. 'value': constant(string),
  17521. 'writable': true
  17522. });
  17523. };
  17524. /**
  17525. * The base implementation of `_.shuffle`.
  17526. *
  17527. * @private
  17528. * @param {Array|Object} collection The collection to shuffle.
  17529. * @returns {Array} Returns the new shuffled array.
  17530. */
  17531. function baseShuffle(collection) {
  17532. return shuffleSelf(values(collection));
  17533. }
  17534. /**
  17535. * The base implementation of `_.slice` without an iteratee call guard.
  17536. *
  17537. * @private
  17538. * @param {Array} array The array to slice.
  17539. * @param {number} [start=0] The start position.
  17540. * @param {number} [end=array.length] The end position.
  17541. * @returns {Array} Returns the slice of `array`.
  17542. */
  17543. function baseSlice(array, start, end) {
  17544. var index = -1,
  17545. length = array.length;
  17546. if (start < 0) {
  17547. start = -start > length ? 0 : (length + start);
  17548. }
  17549. end = end > length ? length : end;
  17550. if (end < 0) {
  17551. end += length;
  17552. }
  17553. length = start > end ? 0 : ((end - start) >>> 0);
  17554. start >>>= 0;
  17555. var result = Array(length);
  17556. while (++index < length) {
  17557. result[index] = array[index + start];
  17558. }
  17559. return result;
  17560. }
  17561. /**
  17562. * The base implementation of `_.some` without support for iteratee shorthands.
  17563. *
  17564. * @private
  17565. * @param {Array|Object} collection The collection to iterate over.
  17566. * @param {Function} predicate The function invoked per iteration.
  17567. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17568. * else `false`.
  17569. */
  17570. function baseSome(collection, predicate) {
  17571. var result;
  17572. baseEach(collection, function(value, index, collection) {
  17573. result = predicate(value, index, collection);
  17574. return !result;
  17575. });
  17576. return !!result;
  17577. }
  17578. /**
  17579. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17580. * performs a binary search of `array` to determine the index at which `value`
  17581. * should be inserted into `array` in order to maintain its sort order.
  17582. *
  17583. * @private
  17584. * @param {Array} array The sorted array to inspect.
  17585. * @param {*} value The value to evaluate.
  17586. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17587. * @returns {number} Returns the index at which `value` should be inserted
  17588. * into `array`.
  17589. */
  17590. function baseSortedIndex(array, value, retHighest) {
  17591. var low = 0,
  17592. high = array == null ? low : array.length;
  17593. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17594. while (low < high) {
  17595. var mid = (low + high) >>> 1,
  17596. computed = array[mid];
  17597. if (computed !== null && !isSymbol(computed) &&
  17598. (retHighest ? (computed <= value) : (computed < value))) {
  17599. low = mid + 1;
  17600. } else {
  17601. high = mid;
  17602. }
  17603. }
  17604. return high;
  17605. }
  17606. return baseSortedIndexBy(array, value, identity, retHighest);
  17607. }
  17608. /**
  17609. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17610. * which invokes `iteratee` for `value` and each element of `array` to compute
  17611. * their sort ranking. The iteratee is invoked with one argument; (value).
  17612. *
  17613. * @private
  17614. * @param {Array} array The sorted array to inspect.
  17615. * @param {*} value The value to evaluate.
  17616. * @param {Function} iteratee The iteratee invoked per element.
  17617. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17618. * @returns {number} Returns the index at which `value` should be inserted
  17619. * into `array`.
  17620. */
  17621. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17622. value = iteratee(value);
  17623. var low = 0,
  17624. high = array == null ? 0 : array.length,
  17625. valIsNaN = value !== value,
  17626. valIsNull = value === null,
  17627. valIsSymbol = isSymbol(value),
  17628. valIsUndefined = value === undefined;
  17629. while (low < high) {
  17630. var mid = nativeFloor((low + high) / 2),
  17631. computed = iteratee(array[mid]),
  17632. othIsDefined = computed !== undefined,
  17633. othIsNull = computed === null,
  17634. othIsReflexive = computed === computed,
  17635. othIsSymbol = isSymbol(computed);
  17636. if (valIsNaN) {
  17637. var setLow = retHighest || othIsReflexive;
  17638. } else if (valIsUndefined) {
  17639. setLow = othIsReflexive && (retHighest || othIsDefined);
  17640. } else if (valIsNull) {
  17641. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17642. } else if (valIsSymbol) {
  17643. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17644. } else if (othIsNull || othIsSymbol) {
  17645. setLow = false;
  17646. } else {
  17647. setLow = retHighest ? (computed <= value) : (computed < value);
  17648. }
  17649. if (setLow) {
  17650. low = mid + 1;
  17651. } else {
  17652. high = mid;
  17653. }
  17654. }
  17655. return nativeMin(high, MAX_ARRAY_INDEX);
  17656. }
  17657. /**
  17658. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17659. * support for iteratee shorthands.
  17660. *
  17661. * @private
  17662. * @param {Array} array The array to inspect.
  17663. * @param {Function} [iteratee] The iteratee invoked per element.
  17664. * @returns {Array} Returns the new duplicate free array.
  17665. */
  17666. function baseSortedUniq(array, iteratee) {
  17667. var index = -1,
  17668. length = array.length,
  17669. resIndex = 0,
  17670. result = [];
  17671. while (++index < length) {
  17672. var value = array[index],
  17673. computed = iteratee ? iteratee(value) : value;
  17674. if (!index || !eq(computed, seen)) {
  17675. var seen = computed;
  17676. result[resIndex++] = value === 0 ? 0 : value;
  17677. }
  17678. }
  17679. return result;
  17680. }
  17681. /**
  17682. * The base implementation of `_.toNumber` which doesn't ensure correct
  17683. * conversions of binary, hexadecimal, or octal string values.
  17684. *
  17685. * @private
  17686. * @param {*} value The value to process.
  17687. * @returns {number} Returns the number.
  17688. */
  17689. function baseToNumber(value) {
  17690. if (typeof value == 'number') {
  17691. return value;
  17692. }
  17693. if (isSymbol(value)) {
  17694. return NAN;
  17695. }
  17696. return +value;
  17697. }
  17698. /**
  17699. * The base implementation of `_.toString` which doesn't convert nullish
  17700. * values to empty strings.
  17701. *
  17702. * @private
  17703. * @param {*} value The value to process.
  17704. * @returns {string} Returns the string.
  17705. */
  17706. function baseToString(value) {
  17707. // Exit early for strings to avoid a performance hit in some environments.
  17708. if (typeof value == 'string') {
  17709. return value;
  17710. }
  17711. if (isArray(value)) {
  17712. // Recursively convert values (susceptible to call stack limits).
  17713. return arrayMap(value, baseToString) + '';
  17714. }
  17715. if (isSymbol(value)) {
  17716. return symbolToString ? symbolToString.call(value) : '';
  17717. }
  17718. var result = (value + '');
  17719. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17720. }
  17721. /**
  17722. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17723. *
  17724. * @private
  17725. * @param {Array} array The array to inspect.
  17726. * @param {Function} [iteratee] The iteratee invoked per element.
  17727. * @param {Function} [comparator] The comparator invoked per element.
  17728. * @returns {Array} Returns the new duplicate free array.
  17729. */
  17730. function baseUniq(array, iteratee, comparator) {
  17731. var index = -1,
  17732. includes = arrayIncludes,
  17733. length = array.length,
  17734. isCommon = true,
  17735. result = [],
  17736. seen = result;
  17737. if (comparator) {
  17738. isCommon = false;
  17739. includes = arrayIncludesWith;
  17740. }
  17741. else if (length >= LARGE_ARRAY_SIZE) {
  17742. var set = iteratee ? null : createSet(array);
  17743. if (set) {
  17744. return setToArray(set);
  17745. }
  17746. isCommon = false;
  17747. includes = cacheHas;
  17748. seen = new SetCache;
  17749. }
  17750. else {
  17751. seen = iteratee ? [] : result;
  17752. }
  17753. outer:
  17754. while (++index < length) {
  17755. var value = array[index],
  17756. computed = iteratee ? iteratee(value) : value;
  17757. value = (comparator || value !== 0) ? value : 0;
  17758. if (isCommon && computed === computed) {
  17759. var seenIndex = seen.length;
  17760. while (seenIndex--) {
  17761. if (seen[seenIndex] === computed) {
  17762. continue outer;
  17763. }
  17764. }
  17765. if (iteratee) {
  17766. seen.push(computed);
  17767. }
  17768. result.push(value);
  17769. }
  17770. else if (!includes(seen, computed, comparator)) {
  17771. if (seen !== result) {
  17772. seen.push(computed);
  17773. }
  17774. result.push(value);
  17775. }
  17776. }
  17777. return result;
  17778. }
  17779. /**
  17780. * The base implementation of `_.unset`.
  17781. *
  17782. * @private
  17783. * @param {Object} object The object to modify.
  17784. * @param {Array|string} path The property path to unset.
  17785. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17786. */
  17787. function baseUnset(object, path) {
  17788. path = castPath(path, object);
  17789. object = parent(object, path);
  17790. return object == null || delete object[toKey(last(path))];
  17791. }
  17792. /**
  17793. * The base implementation of `_.update`.
  17794. *
  17795. * @private
  17796. * @param {Object} object The object to modify.
  17797. * @param {Array|string} path The path of the property to update.
  17798. * @param {Function} updater The function to produce the updated value.
  17799. * @param {Function} [customizer] The function to customize path creation.
  17800. * @returns {Object} Returns `object`.
  17801. */
  17802. function baseUpdate(object, path, updater, customizer) {
  17803. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17804. }
  17805. /**
  17806. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17807. * without support for iteratee shorthands.
  17808. *
  17809. * @private
  17810. * @param {Array} array The array to query.
  17811. * @param {Function} predicate The function invoked per iteration.
  17812. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17813. * @param {boolean} [fromRight] Specify iterating from right to left.
  17814. * @returns {Array} Returns the slice of `array`.
  17815. */
  17816. function baseWhile(array, predicate, isDrop, fromRight) {
  17817. var length = array.length,
  17818. index = fromRight ? length : -1;
  17819. while ((fromRight ? index-- : ++index < length) &&
  17820. predicate(array[index], index, array)) {}
  17821. return isDrop
  17822. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17823. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17824. }
  17825. /**
  17826. * The base implementation of `wrapperValue` which returns the result of
  17827. * performing a sequence of actions on the unwrapped `value`, where each
  17828. * successive action is supplied the return value of the previous.
  17829. *
  17830. * @private
  17831. * @param {*} value The unwrapped value.
  17832. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17833. * @returns {*} Returns the resolved value.
  17834. */
  17835. function baseWrapperValue(value, actions) {
  17836. var result = value;
  17837. if (result instanceof LazyWrapper) {
  17838. result = result.value();
  17839. }
  17840. return arrayReduce(actions, function(result, action) {
  17841. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17842. }, result);
  17843. }
  17844. /**
  17845. * The base implementation of methods like `_.xor`, without support for
  17846. * iteratee shorthands, that accepts an array of arrays to inspect.
  17847. *
  17848. * @private
  17849. * @param {Array} arrays The arrays to inspect.
  17850. * @param {Function} [iteratee] The iteratee invoked per element.
  17851. * @param {Function} [comparator] The comparator invoked per element.
  17852. * @returns {Array} Returns the new array of values.
  17853. */
  17854. function baseXor(arrays, iteratee, comparator) {
  17855. var length = arrays.length;
  17856. if (length < 2) {
  17857. return length ? baseUniq(arrays[0]) : [];
  17858. }
  17859. var index = -1,
  17860. result = Array(length);
  17861. while (++index < length) {
  17862. var array = arrays[index],
  17863. othIndex = -1;
  17864. while (++othIndex < length) {
  17865. if (othIndex != index) {
  17866. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  17867. }
  17868. }
  17869. }
  17870. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  17871. }
  17872. /**
  17873. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  17874. *
  17875. * @private
  17876. * @param {Array} props The property identifiers.
  17877. * @param {Array} values The property values.
  17878. * @param {Function} assignFunc The function to assign values.
  17879. * @returns {Object} Returns the new object.
  17880. */
  17881. function baseZipObject(props, values, assignFunc) {
  17882. var index = -1,
  17883. length = props.length,
  17884. valsLength = values.length,
  17885. result = {};
  17886. while (++index < length) {
  17887. var value = index < valsLength ? values[index] : undefined;
  17888. assignFunc(result, props[index], value);
  17889. }
  17890. return result;
  17891. }
  17892. /**
  17893. * Casts `value` to an empty array if it's not an array like object.
  17894. *
  17895. * @private
  17896. * @param {*} value The value to inspect.
  17897. * @returns {Array|Object} Returns the cast array-like object.
  17898. */
  17899. function castArrayLikeObject(value) {
  17900. return isArrayLikeObject(value) ? value : [];
  17901. }
  17902. /**
  17903. * Casts `value` to `identity` if it's not a function.
  17904. *
  17905. * @private
  17906. * @param {*} value The value to inspect.
  17907. * @returns {Function} Returns cast function.
  17908. */
  17909. function castFunction(value) {
  17910. return typeof value == 'function' ? value : identity;
  17911. }
  17912. /**
  17913. * Casts `value` to a path array if it's not one.
  17914. *
  17915. * @private
  17916. * @param {*} value The value to inspect.
  17917. * @param {Object} [object] The object to query keys on.
  17918. * @returns {Array} Returns the cast property path array.
  17919. */
  17920. function castPath(value, object) {
  17921. if (isArray(value)) {
  17922. return value;
  17923. }
  17924. return isKey(value, object) ? [value] : stringToPath(toString(value));
  17925. }
  17926. /**
  17927. * A `baseRest` alias which can be replaced with `identity` by module
  17928. * replacement plugins.
  17929. *
  17930. * @private
  17931. * @type {Function}
  17932. * @param {Function} func The function to apply a rest parameter to.
  17933. * @returns {Function} Returns the new function.
  17934. */
  17935. var castRest = baseRest;
  17936. /**
  17937. * Casts `array` to a slice if it's needed.
  17938. *
  17939. * @private
  17940. * @param {Array} array The array to inspect.
  17941. * @param {number} start The start position.
  17942. * @param {number} [end=array.length] The end position.
  17943. * @returns {Array} Returns the cast slice.
  17944. */
  17945. function castSlice(array, start, end) {
  17946. var length = array.length;
  17947. end = end === undefined ? length : end;
  17948. return (!start && end >= length) ? array : baseSlice(array, start, end);
  17949. }
  17950. /**
  17951. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  17952. *
  17953. * @private
  17954. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  17955. */
  17956. var clearTimeout = ctxClearTimeout || function(id) {
  17957. return root.clearTimeout(id);
  17958. };
  17959. /**
  17960. * Creates a clone of `buffer`.
  17961. *
  17962. * @private
  17963. * @param {Buffer} buffer The buffer to clone.
  17964. * @param {boolean} [isDeep] Specify a deep clone.
  17965. * @returns {Buffer} Returns the cloned buffer.
  17966. */
  17967. function cloneBuffer(buffer, isDeep) {
  17968. if (isDeep) {
  17969. return buffer.slice();
  17970. }
  17971. var length = buffer.length,
  17972. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  17973. buffer.copy(result);
  17974. return result;
  17975. }
  17976. /**
  17977. * Creates a clone of `arrayBuffer`.
  17978. *
  17979. * @private
  17980. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  17981. * @returns {ArrayBuffer} Returns the cloned array buffer.
  17982. */
  17983. function cloneArrayBuffer(arrayBuffer) {
  17984. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  17985. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  17986. return result;
  17987. }
  17988. /**
  17989. * Creates a clone of `dataView`.
  17990. *
  17991. * @private
  17992. * @param {Object} dataView The data view to clone.
  17993. * @param {boolean} [isDeep] Specify a deep clone.
  17994. * @returns {Object} Returns the cloned data view.
  17995. */
  17996. function cloneDataView(dataView, isDeep) {
  17997. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  17998. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  17999. }
  18000. /**
  18001. * Creates a clone of `regexp`.
  18002. *
  18003. * @private
  18004. * @param {Object} regexp The regexp to clone.
  18005. * @returns {Object} Returns the cloned regexp.
  18006. */
  18007. function cloneRegExp(regexp) {
  18008. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  18009. result.lastIndex = regexp.lastIndex;
  18010. return result;
  18011. }
  18012. /**
  18013. * Creates a clone of the `symbol` object.
  18014. *
  18015. * @private
  18016. * @param {Object} symbol The symbol object to clone.
  18017. * @returns {Object} Returns the cloned symbol object.
  18018. */
  18019. function cloneSymbol(symbol) {
  18020. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  18021. }
  18022. /**
  18023. * Creates a clone of `typedArray`.
  18024. *
  18025. * @private
  18026. * @param {Object} typedArray The typed array to clone.
  18027. * @param {boolean} [isDeep] Specify a deep clone.
  18028. * @returns {Object} Returns the cloned typed array.
  18029. */
  18030. function cloneTypedArray(typedArray, isDeep) {
  18031. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  18032. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  18033. }
  18034. /**
  18035. * Compares values to sort them in ascending order.
  18036. *
  18037. * @private
  18038. * @param {*} value The value to compare.
  18039. * @param {*} other The other value to compare.
  18040. * @returns {number} Returns the sort order indicator for `value`.
  18041. */
  18042. function compareAscending(value, other) {
  18043. if (value !== other) {
  18044. var valIsDefined = value !== undefined,
  18045. valIsNull = value === null,
  18046. valIsReflexive = value === value,
  18047. valIsSymbol = isSymbol(value);
  18048. var othIsDefined = other !== undefined,
  18049. othIsNull = other === null,
  18050. othIsReflexive = other === other,
  18051. othIsSymbol = isSymbol(other);
  18052. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  18053. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  18054. (valIsNull && othIsDefined && othIsReflexive) ||
  18055. (!valIsDefined && othIsReflexive) ||
  18056. !valIsReflexive) {
  18057. return 1;
  18058. }
  18059. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  18060. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  18061. (othIsNull && valIsDefined && valIsReflexive) ||
  18062. (!othIsDefined && valIsReflexive) ||
  18063. !othIsReflexive) {
  18064. return -1;
  18065. }
  18066. }
  18067. return 0;
  18068. }
  18069. /**
  18070. * Used by `_.orderBy` to compare multiple properties of a value to another
  18071. * and stable sort them.
  18072. *
  18073. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  18074. * specify an order of "desc" for descending or "asc" for ascending sort order
  18075. * of corresponding values.
  18076. *
  18077. * @private
  18078. * @param {Object} object The object to compare.
  18079. * @param {Object} other The other object to compare.
  18080. * @param {boolean[]|string[]} orders The order to sort by for each property.
  18081. * @returns {number} Returns the sort order indicator for `object`.
  18082. */
  18083. function compareMultiple(object, other, orders) {
  18084. var index = -1,
  18085. objCriteria = object.criteria,
  18086. othCriteria = other.criteria,
  18087. length = objCriteria.length,
  18088. ordersLength = orders.length;
  18089. while (++index < length) {
  18090. var result = compareAscending(objCriteria[index], othCriteria[index]);
  18091. if (result) {
  18092. if (index >= ordersLength) {
  18093. return result;
  18094. }
  18095. var order = orders[index];
  18096. return result * (order == 'desc' ? -1 : 1);
  18097. }
  18098. }
  18099. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  18100. // that causes it, under certain circumstances, to provide the same value for
  18101. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  18102. // for more details.
  18103. //
  18104. // This also ensures a stable sort in V8 and other engines.
  18105. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  18106. return object.index - other.index;
  18107. }
  18108. /**
  18109. * Creates an array that is the composition of partially applied arguments,
  18110. * placeholders, and provided arguments into a single array of arguments.
  18111. *
  18112. * @private
  18113. * @param {Array} args The provided arguments.
  18114. * @param {Array} partials The arguments to prepend to those provided.
  18115. * @param {Array} holders The `partials` placeholder indexes.
  18116. * @params {boolean} [isCurried] Specify composing for a curried function.
  18117. * @returns {Array} Returns the new array of composed arguments.
  18118. */
  18119. function composeArgs(args, partials, holders, isCurried) {
  18120. var argsIndex = -1,
  18121. argsLength = args.length,
  18122. holdersLength = holders.length,
  18123. leftIndex = -1,
  18124. leftLength = partials.length,
  18125. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18126. result = Array(leftLength + rangeLength),
  18127. isUncurried = !isCurried;
  18128. while (++leftIndex < leftLength) {
  18129. result[leftIndex] = partials[leftIndex];
  18130. }
  18131. while (++argsIndex < holdersLength) {
  18132. if (isUncurried || argsIndex < argsLength) {
  18133. result[holders[argsIndex]] = args[argsIndex];
  18134. }
  18135. }
  18136. while (rangeLength--) {
  18137. result[leftIndex++] = args[argsIndex++];
  18138. }
  18139. return result;
  18140. }
  18141. /**
  18142. * This function is like `composeArgs` except that the arguments composition
  18143. * is tailored for `_.partialRight`.
  18144. *
  18145. * @private
  18146. * @param {Array} args The provided arguments.
  18147. * @param {Array} partials The arguments to append to those provided.
  18148. * @param {Array} holders The `partials` placeholder indexes.
  18149. * @params {boolean} [isCurried] Specify composing for a curried function.
  18150. * @returns {Array} Returns the new array of composed arguments.
  18151. */
  18152. function composeArgsRight(args, partials, holders, isCurried) {
  18153. var argsIndex = -1,
  18154. argsLength = args.length,
  18155. holdersIndex = -1,
  18156. holdersLength = holders.length,
  18157. rightIndex = -1,
  18158. rightLength = partials.length,
  18159. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18160. result = Array(rangeLength + rightLength),
  18161. isUncurried = !isCurried;
  18162. while (++argsIndex < rangeLength) {
  18163. result[argsIndex] = args[argsIndex];
  18164. }
  18165. var offset = argsIndex;
  18166. while (++rightIndex < rightLength) {
  18167. result[offset + rightIndex] = partials[rightIndex];
  18168. }
  18169. while (++holdersIndex < holdersLength) {
  18170. if (isUncurried || argsIndex < argsLength) {
  18171. result[offset + holders[holdersIndex]] = args[argsIndex++];
  18172. }
  18173. }
  18174. return result;
  18175. }
  18176. /**
  18177. * Copies the values of `source` to `array`.
  18178. *
  18179. * @private
  18180. * @param {Array} source The array to copy values from.
  18181. * @param {Array} [array=[]] The array to copy values to.
  18182. * @returns {Array} Returns `array`.
  18183. */
  18184. function copyArray(source, array) {
  18185. var index = -1,
  18186. length = source.length;
  18187. array || (array = Array(length));
  18188. while (++index < length) {
  18189. array[index] = source[index];
  18190. }
  18191. return array;
  18192. }
  18193. /**
  18194. * Copies properties of `source` to `object`.
  18195. *
  18196. * @private
  18197. * @param {Object} source The object to copy properties from.
  18198. * @param {Array} props The property identifiers to copy.
  18199. * @param {Object} [object={}] The object to copy properties to.
  18200. * @param {Function} [customizer] The function to customize copied values.
  18201. * @returns {Object} Returns `object`.
  18202. */
  18203. function copyObject(source, props, object, customizer) {
  18204. var isNew = !object;
  18205. object || (object = {});
  18206. var index = -1,
  18207. length = props.length;
  18208. while (++index < length) {
  18209. var key = props[index];
  18210. var newValue = customizer
  18211. ? customizer(object[key], source[key], key, object, source)
  18212. : undefined;
  18213. if (newValue === undefined) {
  18214. newValue = source[key];
  18215. }
  18216. if (isNew) {
  18217. baseAssignValue(object, key, newValue);
  18218. } else {
  18219. assignValue(object, key, newValue);
  18220. }
  18221. }
  18222. return object;
  18223. }
  18224. /**
  18225. * Copies own symbols of `source` to `object`.
  18226. *
  18227. * @private
  18228. * @param {Object} source The object to copy symbols from.
  18229. * @param {Object} [object={}] The object to copy symbols to.
  18230. * @returns {Object} Returns `object`.
  18231. */
  18232. function copySymbols(source, object) {
  18233. return copyObject(source, getSymbols(source), object);
  18234. }
  18235. /**
  18236. * Copies own and inherited symbols of `source` to `object`.
  18237. *
  18238. * @private
  18239. * @param {Object} source The object to copy symbols from.
  18240. * @param {Object} [object={}] The object to copy symbols to.
  18241. * @returns {Object} Returns `object`.
  18242. */
  18243. function copySymbolsIn(source, object) {
  18244. return copyObject(source, getSymbolsIn(source), object);
  18245. }
  18246. /**
  18247. * Creates a function like `_.groupBy`.
  18248. *
  18249. * @private
  18250. * @param {Function} setter The function to set accumulator values.
  18251. * @param {Function} [initializer] The accumulator object initializer.
  18252. * @returns {Function} Returns the new aggregator function.
  18253. */
  18254. function createAggregator(setter, initializer) {
  18255. return function(collection, iteratee) {
  18256. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  18257. accumulator = initializer ? initializer() : {};
  18258. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  18259. };
  18260. }
  18261. /**
  18262. * Creates a function like `_.assign`.
  18263. *
  18264. * @private
  18265. * @param {Function} assigner The function to assign values.
  18266. * @returns {Function} Returns the new assigner function.
  18267. */
  18268. function createAssigner(assigner) {
  18269. return baseRest(function(object, sources) {
  18270. var index = -1,
  18271. length = sources.length,
  18272. customizer = length > 1 ? sources[length - 1] : undefined,
  18273. guard = length > 2 ? sources[2] : undefined;
  18274. customizer = (assigner.length > 3 && typeof customizer == 'function')
  18275. ? (length--, customizer)
  18276. : undefined;
  18277. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  18278. customizer = length < 3 ? undefined : customizer;
  18279. length = 1;
  18280. }
  18281. object = Object(object);
  18282. while (++index < length) {
  18283. var source = sources[index];
  18284. if (source) {
  18285. assigner(object, source, index, customizer);
  18286. }
  18287. }
  18288. return object;
  18289. });
  18290. }
  18291. /**
  18292. * Creates a `baseEach` or `baseEachRight` function.
  18293. *
  18294. * @private
  18295. * @param {Function} eachFunc The function to iterate over a collection.
  18296. * @param {boolean} [fromRight] Specify iterating from right to left.
  18297. * @returns {Function} Returns the new base function.
  18298. */
  18299. function createBaseEach(eachFunc, fromRight) {
  18300. return function(collection, iteratee) {
  18301. if (collection == null) {
  18302. return collection;
  18303. }
  18304. if (!isArrayLike(collection)) {
  18305. return eachFunc(collection, iteratee);
  18306. }
  18307. var length = collection.length,
  18308. index = fromRight ? length : -1,
  18309. iterable = Object(collection);
  18310. while ((fromRight ? index-- : ++index < length)) {
  18311. if (iteratee(iterable[index], index, iterable) === false) {
  18312. break;
  18313. }
  18314. }
  18315. return collection;
  18316. };
  18317. }
  18318. /**
  18319. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  18320. *
  18321. * @private
  18322. * @param {boolean} [fromRight] Specify iterating from right to left.
  18323. * @returns {Function} Returns the new base function.
  18324. */
  18325. function createBaseFor(fromRight) {
  18326. return function(object, iteratee, keysFunc) {
  18327. var index = -1,
  18328. iterable = Object(object),
  18329. props = keysFunc(object),
  18330. length = props.length;
  18331. while (length--) {
  18332. var key = props[fromRight ? length : ++index];
  18333. if (iteratee(iterable[key], key, iterable) === false) {
  18334. break;
  18335. }
  18336. }
  18337. return object;
  18338. };
  18339. }
  18340. /**
  18341. * Creates a function that wraps `func` to invoke it with the optional `this`
  18342. * binding of `thisArg`.
  18343. *
  18344. * @private
  18345. * @param {Function} func The function to wrap.
  18346. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18347. * @param {*} [thisArg] The `this` binding of `func`.
  18348. * @returns {Function} Returns the new wrapped function.
  18349. */
  18350. function createBind(func, bitmask, thisArg) {
  18351. var isBind = bitmask & WRAP_BIND_FLAG,
  18352. Ctor = createCtor(func);
  18353. function wrapper() {
  18354. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18355. return fn.apply(isBind ? thisArg : this, arguments);
  18356. }
  18357. return wrapper;
  18358. }
  18359. /**
  18360. * Creates a function like `_.lowerFirst`.
  18361. *
  18362. * @private
  18363. * @param {string} methodName The name of the `String` case method to use.
  18364. * @returns {Function} Returns the new case function.
  18365. */
  18366. function createCaseFirst(methodName) {
  18367. return function(string) {
  18368. string = toString(string);
  18369. var strSymbols = hasUnicode(string)
  18370. ? stringToArray(string)
  18371. : undefined;
  18372. var chr = strSymbols
  18373. ? strSymbols[0]
  18374. : string.charAt(0);
  18375. var trailing = strSymbols
  18376. ? castSlice(strSymbols, 1).join('')
  18377. : string.slice(1);
  18378. return chr[methodName]() + trailing;
  18379. };
  18380. }
  18381. /**
  18382. * Creates a function like `_.camelCase`.
  18383. *
  18384. * @private
  18385. * @param {Function} callback The function to combine each word.
  18386. * @returns {Function} Returns the new compounder function.
  18387. */
  18388. function createCompounder(callback) {
  18389. return function(string) {
  18390. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  18391. };
  18392. }
  18393. /**
  18394. * Creates a function that produces an instance of `Ctor` regardless of
  18395. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  18396. *
  18397. * @private
  18398. * @param {Function} Ctor The constructor to wrap.
  18399. * @returns {Function} Returns the new wrapped function.
  18400. */
  18401. function createCtor(Ctor) {
  18402. return function() {
  18403. // Use a `switch` statement to work with class constructors. See
  18404. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  18405. // for more details.
  18406. var args = arguments;
  18407. switch (args.length) {
  18408. case 0: return new Ctor;
  18409. case 1: return new Ctor(args[0]);
  18410. case 2: return new Ctor(args[0], args[1]);
  18411. case 3: return new Ctor(args[0], args[1], args[2]);
  18412. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  18413. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  18414. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  18415. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  18416. }
  18417. var thisBinding = baseCreate(Ctor.prototype),
  18418. result = Ctor.apply(thisBinding, args);
  18419. // Mimic the constructor's `return` behavior.
  18420. // See https://es5.github.io/#x13.2.2 for more details.
  18421. return isObject(result) ? result : thisBinding;
  18422. };
  18423. }
  18424. /**
  18425. * Creates a function that wraps `func` to enable currying.
  18426. *
  18427. * @private
  18428. * @param {Function} func The function to wrap.
  18429. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18430. * @param {number} arity The arity of `func`.
  18431. * @returns {Function} Returns the new wrapped function.
  18432. */
  18433. function createCurry(func, bitmask, arity) {
  18434. var Ctor = createCtor(func);
  18435. function wrapper() {
  18436. var length = arguments.length,
  18437. args = Array(length),
  18438. index = length,
  18439. placeholder = getHolder(wrapper);
  18440. while (index--) {
  18441. args[index] = arguments[index];
  18442. }
  18443. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  18444. ? []
  18445. : replaceHolders(args, placeholder);
  18446. length -= holders.length;
  18447. if (length < arity) {
  18448. return createRecurry(
  18449. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  18450. args, holders, undefined, undefined, arity - length);
  18451. }
  18452. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18453. return apply(fn, this, args);
  18454. }
  18455. return wrapper;
  18456. }
  18457. /**
  18458. * Creates a `_.find` or `_.findLast` function.
  18459. *
  18460. * @private
  18461. * @param {Function} findIndexFunc The function to find the collection index.
  18462. * @returns {Function} Returns the new find function.
  18463. */
  18464. function createFind(findIndexFunc) {
  18465. return function(collection, predicate, fromIndex) {
  18466. var iterable = Object(collection);
  18467. if (!isArrayLike(collection)) {
  18468. var iteratee = getIteratee(predicate, 3);
  18469. collection = keys(collection);
  18470. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18471. }
  18472. var index = findIndexFunc(collection, predicate, fromIndex);
  18473. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18474. };
  18475. }
  18476. /**
  18477. * Creates a `_.flow` or `_.flowRight` function.
  18478. *
  18479. * @private
  18480. * @param {boolean} [fromRight] Specify iterating from right to left.
  18481. * @returns {Function} Returns the new flow function.
  18482. */
  18483. function createFlow(fromRight) {
  18484. return flatRest(function(funcs) {
  18485. var length = funcs.length,
  18486. index = length,
  18487. prereq = LodashWrapper.prototype.thru;
  18488. if (fromRight) {
  18489. funcs.reverse();
  18490. }
  18491. while (index--) {
  18492. var func = funcs[index];
  18493. if (typeof func != 'function') {
  18494. throw new TypeError(FUNC_ERROR_TEXT);
  18495. }
  18496. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18497. var wrapper = new LodashWrapper([], true);
  18498. }
  18499. }
  18500. index = wrapper ? index : length;
  18501. while (++index < length) {
  18502. func = funcs[index];
  18503. var funcName = getFuncName(func),
  18504. data = funcName == 'wrapper' ? getData(func) : undefined;
  18505. if (data && isLaziable(data[0]) &&
  18506. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18507. !data[4].length && data[9] == 1
  18508. ) {
  18509. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18510. } else {
  18511. wrapper = (func.length == 1 && isLaziable(func))
  18512. ? wrapper[funcName]()
  18513. : wrapper.thru(func);
  18514. }
  18515. }
  18516. return function() {
  18517. var args = arguments,
  18518. value = args[0];
  18519. if (wrapper && args.length == 1 && isArray(value)) {
  18520. return wrapper.plant(value).value();
  18521. }
  18522. var index = 0,
  18523. result = length ? funcs[index].apply(this, args) : value;
  18524. while (++index < length) {
  18525. result = funcs[index].call(this, result);
  18526. }
  18527. return result;
  18528. };
  18529. });
  18530. }
  18531. /**
  18532. * Creates a function that wraps `func` to invoke it with optional `this`
  18533. * binding of `thisArg`, partial application, and currying.
  18534. *
  18535. * @private
  18536. * @param {Function|string} func The function or method name to wrap.
  18537. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18538. * @param {*} [thisArg] The `this` binding of `func`.
  18539. * @param {Array} [partials] The arguments to prepend to those provided to
  18540. * the new function.
  18541. * @param {Array} [holders] The `partials` placeholder indexes.
  18542. * @param {Array} [partialsRight] The arguments to append to those provided
  18543. * to the new function.
  18544. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18545. * @param {Array} [argPos] The argument positions of the new function.
  18546. * @param {number} [ary] The arity cap of `func`.
  18547. * @param {number} [arity] The arity of `func`.
  18548. * @returns {Function} Returns the new wrapped function.
  18549. */
  18550. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18551. var isAry = bitmask & WRAP_ARY_FLAG,
  18552. isBind = bitmask & WRAP_BIND_FLAG,
  18553. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18554. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18555. isFlip = bitmask & WRAP_FLIP_FLAG,
  18556. Ctor = isBindKey ? undefined : createCtor(func);
  18557. function wrapper() {
  18558. var length = arguments.length,
  18559. args = Array(length),
  18560. index = length;
  18561. while (index--) {
  18562. args[index] = arguments[index];
  18563. }
  18564. if (isCurried) {
  18565. var placeholder = getHolder(wrapper),
  18566. holdersCount = countHolders(args, placeholder);
  18567. }
  18568. if (partials) {
  18569. args = composeArgs(args, partials, holders, isCurried);
  18570. }
  18571. if (partialsRight) {
  18572. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18573. }
  18574. length -= holdersCount;
  18575. if (isCurried && length < arity) {
  18576. var newHolders = replaceHolders(args, placeholder);
  18577. return createRecurry(
  18578. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18579. args, newHolders, argPos, ary, arity - length
  18580. );
  18581. }
  18582. var thisBinding = isBind ? thisArg : this,
  18583. fn = isBindKey ? thisBinding[func] : func;
  18584. length = args.length;
  18585. if (argPos) {
  18586. args = reorder(args, argPos);
  18587. } else if (isFlip && length > 1) {
  18588. args.reverse();
  18589. }
  18590. if (isAry && ary < length) {
  18591. args.length = ary;
  18592. }
  18593. if (this && this !== root && this instanceof wrapper) {
  18594. fn = Ctor || createCtor(fn);
  18595. }
  18596. return fn.apply(thisBinding, args);
  18597. }
  18598. return wrapper;
  18599. }
  18600. /**
  18601. * Creates a function like `_.invertBy`.
  18602. *
  18603. * @private
  18604. * @param {Function} setter The function to set accumulator values.
  18605. * @param {Function} toIteratee The function to resolve iteratees.
  18606. * @returns {Function} Returns the new inverter function.
  18607. */
  18608. function createInverter(setter, toIteratee) {
  18609. return function(object, iteratee) {
  18610. return baseInverter(object, setter, toIteratee(iteratee), {});
  18611. };
  18612. }
  18613. /**
  18614. * Creates a function that performs a mathematical operation on two values.
  18615. *
  18616. * @private
  18617. * @param {Function} operator The function to perform the operation.
  18618. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18619. * @returns {Function} Returns the new mathematical operation function.
  18620. */
  18621. function createMathOperation(operator, defaultValue) {
  18622. return function(value, other) {
  18623. var result;
  18624. if (value === undefined && other === undefined) {
  18625. return defaultValue;
  18626. }
  18627. if (value !== undefined) {
  18628. result = value;
  18629. }
  18630. if (other !== undefined) {
  18631. if (result === undefined) {
  18632. return other;
  18633. }
  18634. if (typeof value == 'string' || typeof other == 'string') {
  18635. value = baseToString(value);
  18636. other = baseToString(other);
  18637. } else {
  18638. value = baseToNumber(value);
  18639. other = baseToNumber(other);
  18640. }
  18641. result = operator(value, other);
  18642. }
  18643. return result;
  18644. };
  18645. }
  18646. /**
  18647. * Creates a function like `_.over`.
  18648. *
  18649. * @private
  18650. * @param {Function} arrayFunc The function to iterate over iteratees.
  18651. * @returns {Function} Returns the new over function.
  18652. */
  18653. function createOver(arrayFunc) {
  18654. return flatRest(function(iteratees) {
  18655. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18656. return baseRest(function(args) {
  18657. var thisArg = this;
  18658. return arrayFunc(iteratees, function(iteratee) {
  18659. return apply(iteratee, thisArg, args);
  18660. });
  18661. });
  18662. });
  18663. }
  18664. /**
  18665. * Creates the padding for `string` based on `length`. The `chars` string
  18666. * is truncated if the number of characters exceeds `length`.
  18667. *
  18668. * @private
  18669. * @param {number} length The padding length.
  18670. * @param {string} [chars=' '] The string used as padding.
  18671. * @returns {string} Returns the padding for `string`.
  18672. */
  18673. function createPadding(length, chars) {
  18674. chars = chars === undefined ? ' ' : baseToString(chars);
  18675. var charsLength = chars.length;
  18676. if (charsLength < 2) {
  18677. return charsLength ? baseRepeat(chars, length) : chars;
  18678. }
  18679. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18680. return hasUnicode(chars)
  18681. ? castSlice(stringToArray(result), 0, length).join('')
  18682. : result.slice(0, length);
  18683. }
  18684. /**
  18685. * Creates a function that wraps `func` to invoke it with the `this` binding
  18686. * of `thisArg` and `partials` prepended to the arguments it receives.
  18687. *
  18688. * @private
  18689. * @param {Function} func The function to wrap.
  18690. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18691. * @param {*} thisArg The `this` binding of `func`.
  18692. * @param {Array} partials The arguments to prepend to those provided to
  18693. * the new function.
  18694. * @returns {Function} Returns the new wrapped function.
  18695. */
  18696. function createPartial(func, bitmask, thisArg, partials) {
  18697. var isBind = bitmask & WRAP_BIND_FLAG,
  18698. Ctor = createCtor(func);
  18699. function wrapper() {
  18700. var argsIndex = -1,
  18701. argsLength = arguments.length,
  18702. leftIndex = -1,
  18703. leftLength = partials.length,
  18704. args = Array(leftLength + argsLength),
  18705. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18706. while (++leftIndex < leftLength) {
  18707. args[leftIndex] = partials[leftIndex];
  18708. }
  18709. while (argsLength--) {
  18710. args[leftIndex++] = arguments[++argsIndex];
  18711. }
  18712. return apply(fn, isBind ? thisArg : this, args);
  18713. }
  18714. return wrapper;
  18715. }
  18716. /**
  18717. * Creates a `_.range` or `_.rangeRight` function.
  18718. *
  18719. * @private
  18720. * @param {boolean} [fromRight] Specify iterating from right to left.
  18721. * @returns {Function} Returns the new range function.
  18722. */
  18723. function createRange(fromRight) {
  18724. return function(start, end, step) {
  18725. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18726. end = step = undefined;
  18727. }
  18728. // Ensure the sign of `-0` is preserved.
  18729. start = toFinite(start);
  18730. if (end === undefined) {
  18731. end = start;
  18732. start = 0;
  18733. } else {
  18734. end = toFinite(end);
  18735. }
  18736. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18737. return baseRange(start, end, step, fromRight);
  18738. };
  18739. }
  18740. /**
  18741. * Creates a function that performs a relational operation on two values.
  18742. *
  18743. * @private
  18744. * @param {Function} operator The function to perform the operation.
  18745. * @returns {Function} Returns the new relational operation function.
  18746. */
  18747. function createRelationalOperation(operator) {
  18748. return function(value, other) {
  18749. if (!(typeof value == 'string' && typeof other == 'string')) {
  18750. value = toNumber(value);
  18751. other = toNumber(other);
  18752. }
  18753. return operator(value, other);
  18754. };
  18755. }
  18756. /**
  18757. * Creates a function that wraps `func` to continue currying.
  18758. *
  18759. * @private
  18760. * @param {Function} func The function to wrap.
  18761. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18762. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18763. * @param {*} placeholder The placeholder value.
  18764. * @param {*} [thisArg] The `this` binding of `func`.
  18765. * @param {Array} [partials] The arguments to prepend to those provided to
  18766. * the new function.
  18767. * @param {Array} [holders] The `partials` placeholder indexes.
  18768. * @param {Array} [argPos] The argument positions of the new function.
  18769. * @param {number} [ary] The arity cap of `func`.
  18770. * @param {number} [arity] The arity of `func`.
  18771. * @returns {Function} Returns the new wrapped function.
  18772. */
  18773. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18774. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18775. newHolders = isCurry ? holders : undefined,
  18776. newHoldersRight = isCurry ? undefined : holders,
  18777. newPartials = isCurry ? partials : undefined,
  18778. newPartialsRight = isCurry ? undefined : partials;
  18779. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18780. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18781. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18782. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18783. }
  18784. var newData = [
  18785. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18786. newHoldersRight, argPos, ary, arity
  18787. ];
  18788. var result = wrapFunc.apply(undefined, newData);
  18789. if (isLaziable(func)) {
  18790. setData(result, newData);
  18791. }
  18792. result.placeholder = placeholder;
  18793. return setWrapToString(result, func, bitmask);
  18794. }
  18795. /**
  18796. * Creates a function like `_.round`.
  18797. *
  18798. * @private
  18799. * @param {string} methodName The name of the `Math` method to use when rounding.
  18800. * @returns {Function} Returns the new round function.
  18801. */
  18802. function createRound(methodName) {
  18803. var func = Math[methodName];
  18804. return function(number, precision) {
  18805. number = toNumber(number);
  18806. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18807. if (precision && nativeIsFinite(number)) {
  18808. // Shift with exponential notation to avoid floating-point issues.
  18809. // See [MDN](https://mdn.io/round#Examples) for more details.
  18810. var pair = (toString(number) + 'e').split('e'),
  18811. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18812. pair = (toString(value) + 'e').split('e');
  18813. return +(pair[0] + 'e' + (+pair[1] - precision));
  18814. }
  18815. return func(number);
  18816. };
  18817. }
  18818. /**
  18819. * Creates a set object of `values`.
  18820. *
  18821. * @private
  18822. * @param {Array} values The values to add to the set.
  18823. * @returns {Object} Returns the new set.
  18824. */
  18825. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18826. return new Set(values);
  18827. };
  18828. /**
  18829. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18830. *
  18831. * @private
  18832. * @param {Function} keysFunc The function to get the keys of a given object.
  18833. * @returns {Function} Returns the new pairs function.
  18834. */
  18835. function createToPairs(keysFunc) {
  18836. return function(object) {
  18837. var tag = getTag(object);
  18838. if (tag == mapTag) {
  18839. return mapToArray(object);
  18840. }
  18841. if (tag == setTag) {
  18842. return setToPairs(object);
  18843. }
  18844. return baseToPairs(object, keysFunc(object));
  18845. };
  18846. }
  18847. /**
  18848. * Creates a function that either curries or invokes `func` with optional
  18849. * `this` binding and partially applied arguments.
  18850. *
  18851. * @private
  18852. * @param {Function|string} func The function or method name to wrap.
  18853. * @param {number} bitmask The bitmask flags.
  18854. * 1 - `_.bind`
  18855. * 2 - `_.bindKey`
  18856. * 4 - `_.curry` or `_.curryRight` of a bound function
  18857. * 8 - `_.curry`
  18858. * 16 - `_.curryRight`
  18859. * 32 - `_.partial`
  18860. * 64 - `_.partialRight`
  18861. * 128 - `_.rearg`
  18862. * 256 - `_.ary`
  18863. * 512 - `_.flip`
  18864. * @param {*} [thisArg] The `this` binding of `func`.
  18865. * @param {Array} [partials] The arguments to be partially applied.
  18866. * @param {Array} [holders] The `partials` placeholder indexes.
  18867. * @param {Array} [argPos] The argument positions of the new function.
  18868. * @param {number} [ary] The arity cap of `func`.
  18869. * @param {number} [arity] The arity of `func`.
  18870. * @returns {Function} Returns the new wrapped function.
  18871. */
  18872. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  18873. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  18874. if (!isBindKey && typeof func != 'function') {
  18875. throw new TypeError(FUNC_ERROR_TEXT);
  18876. }
  18877. var length = partials ? partials.length : 0;
  18878. if (!length) {
  18879. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  18880. partials = holders = undefined;
  18881. }
  18882. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  18883. arity = arity === undefined ? arity : toInteger(arity);
  18884. length -= holders ? holders.length : 0;
  18885. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  18886. var partialsRight = partials,
  18887. holdersRight = holders;
  18888. partials = holders = undefined;
  18889. }
  18890. var data = isBindKey ? undefined : getData(func);
  18891. var newData = [
  18892. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  18893. argPos, ary, arity
  18894. ];
  18895. if (data) {
  18896. mergeData(newData, data);
  18897. }
  18898. func = newData[0];
  18899. bitmask = newData[1];
  18900. thisArg = newData[2];
  18901. partials = newData[3];
  18902. holders = newData[4];
  18903. arity = newData[9] = newData[9] === undefined
  18904. ? (isBindKey ? 0 : func.length)
  18905. : nativeMax(newData[9] - length, 0);
  18906. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  18907. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  18908. }
  18909. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  18910. var result = createBind(func, bitmask, thisArg);
  18911. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  18912. result = createCurry(func, bitmask, arity);
  18913. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  18914. result = createPartial(func, bitmask, thisArg, partials);
  18915. } else {
  18916. result = createHybrid.apply(undefined, newData);
  18917. }
  18918. var setter = data ? baseSetData : setData;
  18919. return setWrapToString(setter(result, newData), func, bitmask);
  18920. }
  18921. /**
  18922. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  18923. * of source objects to the destination object for all destination properties
  18924. * that resolve to `undefined`.
  18925. *
  18926. * @private
  18927. * @param {*} objValue The destination value.
  18928. * @param {*} srcValue The source value.
  18929. * @param {string} key The key of the property to assign.
  18930. * @param {Object} object The parent object of `objValue`.
  18931. * @returns {*} Returns the value to assign.
  18932. */
  18933. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  18934. if (objValue === undefined ||
  18935. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  18936. return srcValue;
  18937. }
  18938. return objValue;
  18939. }
  18940. /**
  18941. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  18942. * objects into destination objects that are passed thru.
  18943. *
  18944. * @private
  18945. * @param {*} objValue The destination value.
  18946. * @param {*} srcValue The source value.
  18947. * @param {string} key The key of the property to merge.
  18948. * @param {Object} object The parent object of `objValue`.
  18949. * @param {Object} source The parent object of `srcValue`.
  18950. * @param {Object} [stack] Tracks traversed source values and their merged
  18951. * counterparts.
  18952. * @returns {*} Returns the value to assign.
  18953. */
  18954. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  18955. if (isObject(objValue) && isObject(srcValue)) {
  18956. // Recursively merge objects and arrays (susceptible to call stack limits).
  18957. stack.set(srcValue, objValue);
  18958. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  18959. stack['delete'](srcValue);
  18960. }
  18961. return objValue;
  18962. }
  18963. /**
  18964. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  18965. * objects.
  18966. *
  18967. * @private
  18968. * @param {*} value The value to inspect.
  18969. * @param {string} key The key of the property to inspect.
  18970. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  18971. */
  18972. function customOmitClone(value) {
  18973. return isPlainObject(value) ? undefined : value;
  18974. }
  18975. /**
  18976. * A specialized version of `baseIsEqualDeep` for arrays with support for
  18977. * partial deep comparisons.
  18978. *
  18979. * @private
  18980. * @param {Array} array The array to compare.
  18981. * @param {Array} other The other array to compare.
  18982. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  18983. * @param {Function} customizer The function to customize comparisons.
  18984. * @param {Function} equalFunc The function to determine equivalents of values.
  18985. * @param {Object} stack Tracks traversed `array` and `other` objects.
  18986. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  18987. */
  18988. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  18989. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  18990. arrLength = array.length,
  18991. othLength = other.length;
  18992. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  18993. return false;
  18994. }
  18995. // Assume cyclic values are equal.
  18996. var stacked = stack.get(array);
  18997. if (stacked && stack.get(other)) {
  18998. return stacked == other;
  18999. }
  19000. var index = -1,
  19001. result = true,
  19002. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19003. stack.set(array, other);
  19004. stack.set(other, array);
  19005. // Ignore non-index properties.
  19006. while (++index < arrLength) {
  19007. var arrValue = array[index],
  19008. othValue = other[index];
  19009. if (customizer) {
  19010. var compared = isPartial
  19011. ? customizer(othValue, arrValue, index, other, array, stack)
  19012. : customizer(arrValue, othValue, index, array, other, stack);
  19013. }
  19014. if (compared !== undefined) {
  19015. if (compared) {
  19016. continue;
  19017. }
  19018. result = false;
  19019. break;
  19020. }
  19021. // Recursively compare arrays (susceptible to call stack limits).
  19022. if (seen) {
  19023. if (!arraySome(other, function(othValue, othIndex) {
  19024. if (!cacheHas(seen, othIndex) &&
  19025. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19026. return seen.push(othIndex);
  19027. }
  19028. })) {
  19029. result = false;
  19030. break;
  19031. }
  19032. } else if (!(
  19033. arrValue === othValue ||
  19034. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19035. )) {
  19036. result = false;
  19037. break;
  19038. }
  19039. }
  19040. stack['delete'](array);
  19041. stack['delete'](other);
  19042. return result;
  19043. }
  19044. /**
  19045. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19046. * the same `toStringTag`.
  19047. *
  19048. * **Note:** This function only supports comparing values with tags of
  19049. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19050. *
  19051. * @private
  19052. * @param {Object} object The object to compare.
  19053. * @param {Object} other The other object to compare.
  19054. * @param {string} tag The `toStringTag` of the objects to compare.
  19055. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19056. * @param {Function} customizer The function to customize comparisons.
  19057. * @param {Function} equalFunc The function to determine equivalents of values.
  19058. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19059. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19060. */
  19061. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19062. switch (tag) {
  19063. case dataViewTag:
  19064. if ((object.byteLength != other.byteLength) ||
  19065. (object.byteOffset != other.byteOffset)) {
  19066. return false;
  19067. }
  19068. object = object.buffer;
  19069. other = other.buffer;
  19070. case arrayBufferTag:
  19071. if ((object.byteLength != other.byteLength) ||
  19072. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19073. return false;
  19074. }
  19075. return true;
  19076. case boolTag:
  19077. case dateTag:
  19078. case numberTag:
  19079. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19080. // Invalid dates are coerced to `NaN`.
  19081. return eq(+object, +other);
  19082. case errorTag:
  19083. return object.name == other.name && object.message == other.message;
  19084. case regexpTag:
  19085. case stringTag:
  19086. // Coerce regexes to strings and treat strings, primitives and objects,
  19087. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19088. // for more details.
  19089. return object == (other + '');
  19090. case mapTag:
  19091. var convert = mapToArray;
  19092. case setTag:
  19093. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19094. convert || (convert = setToArray);
  19095. if (object.size != other.size && !isPartial) {
  19096. return false;
  19097. }
  19098. // Assume cyclic values are equal.
  19099. var stacked = stack.get(object);
  19100. if (stacked) {
  19101. return stacked == other;
  19102. }
  19103. bitmask |= COMPARE_UNORDERED_FLAG;
  19104. // Recursively compare objects (susceptible to call stack limits).
  19105. stack.set(object, other);
  19106. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19107. stack['delete'](object);
  19108. return result;
  19109. case symbolTag:
  19110. if (symbolValueOf) {
  19111. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19112. }
  19113. }
  19114. return false;
  19115. }
  19116. /**
  19117. * A specialized version of `baseIsEqualDeep` for objects with support for
  19118. * partial deep comparisons.
  19119. *
  19120. * @private
  19121. * @param {Object} object The object to compare.
  19122. * @param {Object} other The other object to compare.
  19123. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19124. * @param {Function} customizer The function to customize comparisons.
  19125. * @param {Function} equalFunc The function to determine equivalents of values.
  19126. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19127. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19128. */
  19129. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19130. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19131. objProps = getAllKeys(object),
  19132. objLength = objProps.length,
  19133. othProps = getAllKeys(other),
  19134. othLength = othProps.length;
  19135. if (objLength != othLength && !isPartial) {
  19136. return false;
  19137. }
  19138. var index = objLength;
  19139. while (index--) {
  19140. var key = objProps[index];
  19141. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19142. return false;
  19143. }
  19144. }
  19145. // Assume cyclic values are equal.
  19146. var stacked = stack.get(object);
  19147. if (stacked && stack.get(other)) {
  19148. return stacked == other;
  19149. }
  19150. var result = true;
  19151. stack.set(object, other);
  19152. stack.set(other, object);
  19153. var skipCtor = isPartial;
  19154. while (++index < objLength) {
  19155. key = objProps[index];
  19156. var objValue = object[key],
  19157. othValue = other[key];
  19158. if (customizer) {
  19159. var compared = isPartial
  19160. ? customizer(othValue, objValue, key, other, object, stack)
  19161. : customizer(objValue, othValue, key, object, other, stack);
  19162. }
  19163. // Recursively compare objects (susceptible to call stack limits).
  19164. if (!(compared === undefined
  19165. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19166. : compared
  19167. )) {
  19168. result = false;
  19169. break;
  19170. }
  19171. skipCtor || (skipCtor = key == 'constructor');
  19172. }
  19173. if (result && !skipCtor) {
  19174. var objCtor = object.constructor,
  19175. othCtor = other.constructor;
  19176. // Non `Object` object instances with different constructors are not equal.
  19177. if (objCtor != othCtor &&
  19178. ('constructor' in object && 'constructor' in other) &&
  19179. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19180. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19181. result = false;
  19182. }
  19183. }
  19184. stack['delete'](object);
  19185. stack['delete'](other);
  19186. return result;
  19187. }
  19188. /**
  19189. * A specialized version of `baseRest` which flattens the rest array.
  19190. *
  19191. * @private
  19192. * @param {Function} func The function to apply a rest parameter to.
  19193. * @returns {Function} Returns the new function.
  19194. */
  19195. function flatRest(func) {
  19196. return setToString(overRest(func, undefined, flatten), func + '');
  19197. }
  19198. /**
  19199. * Creates an array of own enumerable property names and symbols of `object`.
  19200. *
  19201. * @private
  19202. * @param {Object} object The object to query.
  19203. * @returns {Array} Returns the array of property names and symbols.
  19204. */
  19205. function getAllKeys(object) {
  19206. return baseGetAllKeys(object, keys, getSymbols);
  19207. }
  19208. /**
  19209. * Creates an array of own and inherited enumerable property names and
  19210. * symbols of `object`.
  19211. *
  19212. * @private
  19213. * @param {Object} object The object to query.
  19214. * @returns {Array} Returns the array of property names and symbols.
  19215. */
  19216. function getAllKeysIn(object) {
  19217. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  19218. }
  19219. /**
  19220. * Gets metadata for `func`.
  19221. *
  19222. * @private
  19223. * @param {Function} func The function to query.
  19224. * @returns {*} Returns the metadata for `func`.
  19225. */
  19226. var getData = !metaMap ? noop : function(func) {
  19227. return metaMap.get(func);
  19228. };
  19229. /**
  19230. * Gets the name of `func`.
  19231. *
  19232. * @private
  19233. * @param {Function} func The function to query.
  19234. * @returns {string} Returns the function name.
  19235. */
  19236. function getFuncName(func) {
  19237. var result = (func.name + ''),
  19238. array = realNames[result],
  19239. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  19240. while (length--) {
  19241. var data = array[length],
  19242. otherFunc = data.func;
  19243. if (otherFunc == null || otherFunc == func) {
  19244. return data.name;
  19245. }
  19246. }
  19247. return result;
  19248. }
  19249. /**
  19250. * Gets the argument placeholder value for `func`.
  19251. *
  19252. * @private
  19253. * @param {Function} func The function to inspect.
  19254. * @returns {*} Returns the placeholder value.
  19255. */
  19256. function getHolder(func) {
  19257. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  19258. return object.placeholder;
  19259. }
  19260. /**
  19261. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  19262. * this function returns the custom method, otherwise it returns `baseIteratee`.
  19263. * If arguments are provided, the chosen function is invoked with them and
  19264. * its result is returned.
  19265. *
  19266. * @private
  19267. * @param {*} [value] The value to convert to an iteratee.
  19268. * @param {number} [arity] The arity of the created iteratee.
  19269. * @returns {Function} Returns the chosen function or its result.
  19270. */
  19271. function getIteratee() {
  19272. var result = lodash.iteratee || iteratee;
  19273. result = result === iteratee ? baseIteratee : result;
  19274. return arguments.length ? result(arguments[0], arguments[1]) : result;
  19275. }
  19276. /**
  19277. * Gets the data for `map`.
  19278. *
  19279. * @private
  19280. * @param {Object} map The map to query.
  19281. * @param {string} key The reference key.
  19282. * @returns {*} Returns the map data.
  19283. */
  19284. function getMapData(map, key) {
  19285. var data = map.__data__;
  19286. return isKeyable(key)
  19287. ? data[typeof key == 'string' ? 'string' : 'hash']
  19288. : data.map;
  19289. }
  19290. /**
  19291. * Gets the property names, values, and compare flags of `object`.
  19292. *
  19293. * @private
  19294. * @param {Object} object The object to query.
  19295. * @returns {Array} Returns the match data of `object`.
  19296. */
  19297. function getMatchData(object) {
  19298. var result = keys(object),
  19299. length = result.length;
  19300. while (length--) {
  19301. var key = result[length],
  19302. value = object[key];
  19303. result[length] = [key, value, isStrictComparable(value)];
  19304. }
  19305. return result;
  19306. }
  19307. /**
  19308. * Gets the native function at `key` of `object`.
  19309. *
  19310. * @private
  19311. * @param {Object} object The object to query.
  19312. * @param {string} key The key of the method to get.
  19313. * @returns {*} Returns the function if it's native, else `undefined`.
  19314. */
  19315. function getNative(object, key) {
  19316. var value = getValue(object, key);
  19317. return baseIsNative(value) ? value : undefined;
  19318. }
  19319. /**
  19320. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19321. *
  19322. * @private
  19323. * @param {*} value The value to query.
  19324. * @returns {string} Returns the raw `toStringTag`.
  19325. */
  19326. function getRawTag(value) {
  19327. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19328. tag = value[symToStringTag];
  19329. try {
  19330. value[symToStringTag] = undefined;
  19331. var unmasked = true;
  19332. } catch (e) {}
  19333. var result = nativeObjectToString.call(value);
  19334. if (unmasked) {
  19335. if (isOwn) {
  19336. value[symToStringTag] = tag;
  19337. } else {
  19338. delete value[symToStringTag];
  19339. }
  19340. }
  19341. return result;
  19342. }
  19343. /**
  19344. * Creates an array of the own enumerable symbols of `object`.
  19345. *
  19346. * @private
  19347. * @param {Object} object The object to query.
  19348. * @returns {Array} Returns the array of symbols.
  19349. */
  19350. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19351. if (object == null) {
  19352. return [];
  19353. }
  19354. object = Object(object);
  19355. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19356. return propertyIsEnumerable.call(object, symbol);
  19357. });
  19358. };
  19359. /**
  19360. * Creates an array of the own and inherited enumerable symbols of `object`.
  19361. *
  19362. * @private
  19363. * @param {Object} object The object to query.
  19364. * @returns {Array} Returns the array of symbols.
  19365. */
  19366. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  19367. var result = [];
  19368. while (object) {
  19369. arrayPush(result, getSymbols(object));
  19370. object = getPrototype(object);
  19371. }
  19372. return result;
  19373. };
  19374. /**
  19375. * Gets the `toStringTag` of `value`.
  19376. *
  19377. * @private
  19378. * @param {*} value The value to query.
  19379. * @returns {string} Returns the `toStringTag`.
  19380. */
  19381. var getTag = baseGetTag;
  19382. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19383. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19384. (Map && getTag(new Map) != mapTag) ||
  19385. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19386. (Set && getTag(new Set) != setTag) ||
  19387. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19388. getTag = function(value) {
  19389. var result = baseGetTag(value),
  19390. Ctor = result == objectTag ? value.constructor : undefined,
  19391. ctorString = Ctor ? toSource(Ctor) : '';
  19392. if (ctorString) {
  19393. switch (ctorString) {
  19394. case dataViewCtorString: return dataViewTag;
  19395. case mapCtorString: return mapTag;
  19396. case promiseCtorString: return promiseTag;
  19397. case setCtorString: return setTag;
  19398. case weakMapCtorString: return weakMapTag;
  19399. }
  19400. }
  19401. return result;
  19402. };
  19403. }
  19404. /**
  19405. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  19406. *
  19407. * @private
  19408. * @param {number} start The start of the view.
  19409. * @param {number} end The end of the view.
  19410. * @param {Array} transforms The transformations to apply to the view.
  19411. * @returns {Object} Returns an object containing the `start` and `end`
  19412. * positions of the view.
  19413. */
  19414. function getView(start, end, transforms) {
  19415. var index = -1,
  19416. length = transforms.length;
  19417. while (++index < length) {
  19418. var data = transforms[index],
  19419. size = data.size;
  19420. switch (data.type) {
  19421. case 'drop': start += size; break;
  19422. case 'dropRight': end -= size; break;
  19423. case 'take': end = nativeMin(end, start + size); break;
  19424. case 'takeRight': start = nativeMax(start, end - size); break;
  19425. }
  19426. }
  19427. return { 'start': start, 'end': end };
  19428. }
  19429. /**
  19430. * Extracts wrapper details from the `source` body comment.
  19431. *
  19432. * @private
  19433. * @param {string} source The source to inspect.
  19434. * @returns {Array} Returns the wrapper details.
  19435. */
  19436. function getWrapDetails(source) {
  19437. var match = source.match(reWrapDetails);
  19438. return match ? match[1].split(reSplitDetails) : [];
  19439. }
  19440. /**
  19441. * Checks if `path` exists on `object`.
  19442. *
  19443. * @private
  19444. * @param {Object} object The object to query.
  19445. * @param {Array|string} path The path to check.
  19446. * @param {Function} hasFunc The function to check properties.
  19447. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  19448. */
  19449. function hasPath(object, path, hasFunc) {
  19450. path = castPath(path, object);
  19451. var index = -1,
  19452. length = path.length,
  19453. result = false;
  19454. while (++index < length) {
  19455. var key = toKey(path[index]);
  19456. if (!(result = object != null && hasFunc(object, key))) {
  19457. break;
  19458. }
  19459. object = object[key];
  19460. }
  19461. if (result || ++index != length) {
  19462. return result;
  19463. }
  19464. length = object == null ? 0 : object.length;
  19465. return !!length && isLength(length) && isIndex(key, length) &&
  19466. (isArray(object) || isArguments(object));
  19467. }
  19468. /**
  19469. * Initializes an array clone.
  19470. *
  19471. * @private
  19472. * @param {Array} array The array to clone.
  19473. * @returns {Array} Returns the initialized clone.
  19474. */
  19475. function initCloneArray(array) {
  19476. var length = array.length,
  19477. result = new array.constructor(length);
  19478. // Add properties assigned by `RegExp#exec`.
  19479. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19480. result.index = array.index;
  19481. result.input = array.input;
  19482. }
  19483. return result;
  19484. }
  19485. /**
  19486. * Initializes an object clone.
  19487. *
  19488. * @private
  19489. * @param {Object} object The object to clone.
  19490. * @returns {Object} Returns the initialized clone.
  19491. */
  19492. function initCloneObject(object) {
  19493. return (typeof object.constructor == 'function' && !isPrototype(object))
  19494. ? baseCreate(getPrototype(object))
  19495. : {};
  19496. }
  19497. /**
  19498. * Initializes an object clone based on its `toStringTag`.
  19499. *
  19500. * **Note:** This function only supports cloning values with tags of
  19501. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19502. *
  19503. * @private
  19504. * @param {Object} object The object to clone.
  19505. * @param {string} tag The `toStringTag` of the object to clone.
  19506. * @param {boolean} [isDeep] Specify a deep clone.
  19507. * @returns {Object} Returns the initialized clone.
  19508. */
  19509. function initCloneByTag(object, tag, isDeep) {
  19510. var Ctor = object.constructor;
  19511. switch (tag) {
  19512. case arrayBufferTag:
  19513. return cloneArrayBuffer(object);
  19514. case boolTag:
  19515. case dateTag:
  19516. return new Ctor(+object);
  19517. case dataViewTag:
  19518. return cloneDataView(object, isDeep);
  19519. case float32Tag: case float64Tag:
  19520. case int8Tag: case int16Tag: case int32Tag:
  19521. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19522. return cloneTypedArray(object, isDeep);
  19523. case mapTag:
  19524. return new Ctor;
  19525. case numberTag:
  19526. case stringTag:
  19527. return new Ctor(object);
  19528. case regexpTag:
  19529. return cloneRegExp(object);
  19530. case setTag:
  19531. return new Ctor;
  19532. case symbolTag:
  19533. return cloneSymbol(object);
  19534. }
  19535. }
  19536. /**
  19537. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19538. *
  19539. * @private
  19540. * @param {string} source The source to modify.
  19541. * @returns {Array} details The details to insert.
  19542. * @returns {string} Returns the modified source.
  19543. */
  19544. function insertWrapDetails(source, details) {
  19545. var length = details.length;
  19546. if (!length) {
  19547. return source;
  19548. }
  19549. var lastIndex = length - 1;
  19550. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19551. details = details.join(length > 2 ? ', ' : ' ');
  19552. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19553. }
  19554. /**
  19555. * Checks if `value` is a flattenable `arguments` object or array.
  19556. *
  19557. * @private
  19558. * @param {*} value The value to check.
  19559. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19560. */
  19561. function isFlattenable(value) {
  19562. return isArray(value) || isArguments(value) ||
  19563. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19564. }
  19565. /**
  19566. * Checks if `value` is a valid array-like index.
  19567. *
  19568. * @private
  19569. * @param {*} value The value to check.
  19570. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19571. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19572. */
  19573. function isIndex(value, length) {
  19574. var type = typeof value;
  19575. length = length == null ? MAX_SAFE_INTEGER : length;
  19576. return !!length &&
  19577. (type == 'number' ||
  19578. (type != 'symbol' && reIsUint.test(value))) &&
  19579. (value > -1 && value % 1 == 0 && value < length);
  19580. }
  19581. /**
  19582. * Checks if the given arguments are from an iteratee call.
  19583. *
  19584. * @private
  19585. * @param {*} value The potential iteratee value argument.
  19586. * @param {*} index The potential iteratee index or key argument.
  19587. * @param {*} object The potential iteratee object argument.
  19588. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19589. * else `false`.
  19590. */
  19591. function isIterateeCall(value, index, object) {
  19592. if (!isObject(object)) {
  19593. return false;
  19594. }
  19595. var type = typeof index;
  19596. if (type == 'number'
  19597. ? (isArrayLike(object) && isIndex(index, object.length))
  19598. : (type == 'string' && index in object)
  19599. ) {
  19600. return eq(object[index], value);
  19601. }
  19602. return false;
  19603. }
  19604. /**
  19605. * Checks if `value` is a property name and not a property path.
  19606. *
  19607. * @private
  19608. * @param {*} value The value to check.
  19609. * @param {Object} [object] The object to query keys on.
  19610. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19611. */
  19612. function isKey(value, object) {
  19613. if (isArray(value)) {
  19614. return false;
  19615. }
  19616. var type = typeof value;
  19617. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19618. value == null || isSymbol(value)) {
  19619. return true;
  19620. }
  19621. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19622. (object != null && value in Object(object));
  19623. }
  19624. /**
  19625. * Checks if `value` is suitable for use as unique object key.
  19626. *
  19627. * @private
  19628. * @param {*} value The value to check.
  19629. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19630. */
  19631. function isKeyable(value) {
  19632. var type = typeof value;
  19633. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19634. ? (value !== '__proto__')
  19635. : (value === null);
  19636. }
  19637. /**
  19638. * Checks if `func` has a lazy counterpart.
  19639. *
  19640. * @private
  19641. * @param {Function} func The function to check.
  19642. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19643. * else `false`.
  19644. */
  19645. function isLaziable(func) {
  19646. var funcName = getFuncName(func),
  19647. other = lodash[funcName];
  19648. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19649. return false;
  19650. }
  19651. if (func === other) {
  19652. return true;
  19653. }
  19654. var data = getData(other);
  19655. return !!data && func === data[0];
  19656. }
  19657. /**
  19658. * Checks if `func` has its source masked.
  19659. *
  19660. * @private
  19661. * @param {Function} func The function to check.
  19662. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19663. */
  19664. function isMasked(func) {
  19665. return !!maskSrcKey && (maskSrcKey in func);
  19666. }
  19667. /**
  19668. * Checks if `func` is capable of being masked.
  19669. *
  19670. * @private
  19671. * @param {*} value The value to check.
  19672. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19673. */
  19674. var isMaskable = coreJsData ? isFunction : stubFalse;
  19675. /**
  19676. * Checks if `value` is likely a prototype object.
  19677. *
  19678. * @private
  19679. * @param {*} value The value to check.
  19680. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19681. */
  19682. function isPrototype(value) {
  19683. var Ctor = value && value.constructor,
  19684. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19685. return value === proto;
  19686. }
  19687. /**
  19688. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19689. *
  19690. * @private
  19691. * @param {*} value The value to check.
  19692. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19693. * equality comparisons, else `false`.
  19694. */
  19695. function isStrictComparable(value) {
  19696. return value === value && !isObject(value);
  19697. }
  19698. /**
  19699. * A specialized version of `matchesProperty` for source values suitable
  19700. * for strict equality comparisons, i.e. `===`.
  19701. *
  19702. * @private
  19703. * @param {string} key The key of the property to get.
  19704. * @param {*} srcValue The value to match.
  19705. * @returns {Function} Returns the new spec function.
  19706. */
  19707. function matchesStrictComparable(key, srcValue) {
  19708. return function(object) {
  19709. if (object == null) {
  19710. return false;
  19711. }
  19712. return object[key] === srcValue &&
  19713. (srcValue !== undefined || (key in Object(object)));
  19714. };
  19715. }
  19716. /**
  19717. * A specialized version of `_.memoize` which clears the memoized function's
  19718. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19719. *
  19720. * @private
  19721. * @param {Function} func The function to have its output memoized.
  19722. * @returns {Function} Returns the new memoized function.
  19723. */
  19724. function memoizeCapped(func) {
  19725. var result = memoize(func, function(key) {
  19726. if (cache.size === MAX_MEMOIZE_SIZE) {
  19727. cache.clear();
  19728. }
  19729. return key;
  19730. });
  19731. var cache = result.cache;
  19732. return result;
  19733. }
  19734. /**
  19735. * Merges the function metadata of `source` into `data`.
  19736. *
  19737. * Merging metadata reduces the number of wrappers used to invoke a function.
  19738. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19739. * may be applied regardless of execution order. Methods like `_.ary` and
  19740. * `_.rearg` modify function arguments, making the order in which they are
  19741. * executed important, preventing the merging of metadata. However, we make
  19742. * an exception for a safe combined case where curried functions have `_.ary`
  19743. * and or `_.rearg` applied.
  19744. *
  19745. * @private
  19746. * @param {Array} data The destination metadata.
  19747. * @param {Array} source The source metadata.
  19748. * @returns {Array} Returns `data`.
  19749. */
  19750. function mergeData(data, source) {
  19751. var bitmask = data[1],
  19752. srcBitmask = source[1],
  19753. newBitmask = bitmask | srcBitmask,
  19754. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19755. var isCombo =
  19756. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19757. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19758. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19759. // Exit early if metadata can't be merged.
  19760. if (!(isCommon || isCombo)) {
  19761. return data;
  19762. }
  19763. // Use source `thisArg` if available.
  19764. if (srcBitmask & WRAP_BIND_FLAG) {
  19765. data[2] = source[2];
  19766. // Set when currying a bound function.
  19767. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19768. }
  19769. // Compose partial arguments.
  19770. var value = source[3];
  19771. if (value) {
  19772. var partials = data[3];
  19773. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19774. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19775. }
  19776. // Compose partial right arguments.
  19777. value = source[5];
  19778. if (value) {
  19779. partials = data[5];
  19780. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19781. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19782. }
  19783. // Use source `argPos` if available.
  19784. value = source[7];
  19785. if (value) {
  19786. data[7] = value;
  19787. }
  19788. // Use source `ary` if it's smaller.
  19789. if (srcBitmask & WRAP_ARY_FLAG) {
  19790. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19791. }
  19792. // Use source `arity` if one is not provided.
  19793. if (data[9] == null) {
  19794. data[9] = source[9];
  19795. }
  19796. // Use source `func` and merge bitmasks.
  19797. data[0] = source[0];
  19798. data[1] = newBitmask;
  19799. return data;
  19800. }
  19801. /**
  19802. * This function is like
  19803. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19804. * except that it includes inherited enumerable properties.
  19805. *
  19806. * @private
  19807. * @param {Object} object The object to query.
  19808. * @returns {Array} Returns the array of property names.
  19809. */
  19810. function nativeKeysIn(object) {
  19811. var result = [];
  19812. if (object != null) {
  19813. for (var key in Object(object)) {
  19814. result.push(key);
  19815. }
  19816. }
  19817. return result;
  19818. }
  19819. /**
  19820. * Converts `value` to a string using `Object.prototype.toString`.
  19821. *
  19822. * @private
  19823. * @param {*} value The value to convert.
  19824. * @returns {string} Returns the converted string.
  19825. */
  19826. function objectToString(value) {
  19827. return nativeObjectToString.call(value);
  19828. }
  19829. /**
  19830. * A specialized version of `baseRest` which transforms the rest array.
  19831. *
  19832. * @private
  19833. * @param {Function} func The function to apply a rest parameter to.
  19834. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19835. * @param {Function} transform The rest array transform.
  19836. * @returns {Function} Returns the new function.
  19837. */
  19838. function overRest(func, start, transform) {
  19839. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19840. return function() {
  19841. var args = arguments,
  19842. index = -1,
  19843. length = nativeMax(args.length - start, 0),
  19844. array = Array(length);
  19845. while (++index < length) {
  19846. array[index] = args[start + index];
  19847. }
  19848. index = -1;
  19849. var otherArgs = Array(start + 1);
  19850. while (++index < start) {
  19851. otherArgs[index] = args[index];
  19852. }
  19853. otherArgs[start] = transform(array);
  19854. return apply(func, this, otherArgs);
  19855. };
  19856. }
  19857. /**
  19858. * Gets the parent value at `path` of `object`.
  19859. *
  19860. * @private
  19861. * @param {Object} object The object to query.
  19862. * @param {Array} path The path to get the parent value of.
  19863. * @returns {*} Returns the parent value.
  19864. */
  19865. function parent(object, path) {
  19866. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  19867. }
  19868. /**
  19869. * Reorder `array` according to the specified indexes where the element at
  19870. * the first index is assigned as the first element, the element at
  19871. * the second index is assigned as the second element, and so on.
  19872. *
  19873. * @private
  19874. * @param {Array} array The array to reorder.
  19875. * @param {Array} indexes The arranged array indexes.
  19876. * @returns {Array} Returns `array`.
  19877. */
  19878. function reorder(array, indexes) {
  19879. var arrLength = array.length,
  19880. length = nativeMin(indexes.length, arrLength),
  19881. oldArray = copyArray(array);
  19882. while (length--) {
  19883. var index = indexes[length];
  19884. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  19885. }
  19886. return array;
  19887. }
  19888. /**
  19889. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  19890. *
  19891. * @private
  19892. * @param {Object} object The object to query.
  19893. * @param {string} key The key of the property to get.
  19894. * @returns {*} Returns the property value.
  19895. */
  19896. function safeGet(object, key) {
  19897. if (key === 'constructor' && typeof object[key] === 'function') {
  19898. return;
  19899. }
  19900. if (key == '__proto__') {
  19901. return;
  19902. }
  19903. return object[key];
  19904. }
  19905. /**
  19906. * Sets metadata for `func`.
  19907. *
  19908. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  19909. * period of time, it will trip its breaker and transition to an identity
  19910. * function to avoid garbage collection pauses in V8. See
  19911. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  19912. * for more details.
  19913. *
  19914. * @private
  19915. * @param {Function} func The function to associate metadata with.
  19916. * @param {*} data The metadata.
  19917. * @returns {Function} Returns `func`.
  19918. */
  19919. var setData = shortOut(baseSetData);
  19920. /**
  19921. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  19922. *
  19923. * @private
  19924. * @param {Function} func The function to delay.
  19925. * @param {number} wait The number of milliseconds to delay invocation.
  19926. * @returns {number|Object} Returns the timer id or timeout object.
  19927. */
  19928. var setTimeout = ctxSetTimeout || function(func, wait) {
  19929. return root.setTimeout(func, wait);
  19930. };
  19931. /**
  19932. * Sets the `toString` method of `func` to return `string`.
  19933. *
  19934. * @private
  19935. * @param {Function} func The function to modify.
  19936. * @param {Function} string The `toString` result.
  19937. * @returns {Function} Returns `func`.
  19938. */
  19939. var setToString = shortOut(baseSetToString);
  19940. /**
  19941. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  19942. * with wrapper details in a comment at the top of the source body.
  19943. *
  19944. * @private
  19945. * @param {Function} wrapper The function to modify.
  19946. * @param {Function} reference The reference function.
  19947. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  19948. * @returns {Function} Returns `wrapper`.
  19949. */
  19950. function setWrapToString(wrapper, reference, bitmask) {
  19951. var source = (reference + '');
  19952. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  19953. }
  19954. /**
  19955. * Creates a function that'll short out and invoke `identity` instead
  19956. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  19957. * milliseconds.
  19958. *
  19959. * @private
  19960. * @param {Function} func The function to restrict.
  19961. * @returns {Function} Returns the new shortable function.
  19962. */
  19963. function shortOut(func) {
  19964. var count = 0,
  19965. lastCalled = 0;
  19966. return function() {
  19967. var stamp = nativeNow(),
  19968. remaining = HOT_SPAN - (stamp - lastCalled);
  19969. lastCalled = stamp;
  19970. if (remaining > 0) {
  19971. if (++count >= HOT_COUNT) {
  19972. return arguments[0];
  19973. }
  19974. } else {
  19975. count = 0;
  19976. }
  19977. return func.apply(undefined, arguments);
  19978. };
  19979. }
  19980. /**
  19981. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  19982. *
  19983. * @private
  19984. * @param {Array} array The array to shuffle.
  19985. * @param {number} [size=array.length] The size of `array`.
  19986. * @returns {Array} Returns `array`.
  19987. */
  19988. function shuffleSelf(array, size) {
  19989. var index = -1,
  19990. length = array.length,
  19991. lastIndex = length - 1;
  19992. size = size === undefined ? length : size;
  19993. while (++index < size) {
  19994. var rand = baseRandom(index, lastIndex),
  19995. value = array[rand];
  19996. array[rand] = array[index];
  19997. array[index] = value;
  19998. }
  19999. array.length = size;
  20000. return array;
  20001. }
  20002. /**
  20003. * Converts `string` to a property path array.
  20004. *
  20005. * @private
  20006. * @param {string} string The string to convert.
  20007. * @returns {Array} Returns the property path array.
  20008. */
  20009. var stringToPath = memoizeCapped(function(string) {
  20010. var result = [];
  20011. if (string.charCodeAt(0) === 46 /* . */) {
  20012. result.push('');
  20013. }
  20014. string.replace(rePropName, function(match, number, quote, subString) {
  20015. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  20016. });
  20017. return result;
  20018. });
  20019. /**
  20020. * Converts `value` to a string key if it's not a string or symbol.
  20021. *
  20022. * @private
  20023. * @param {*} value The value to inspect.
  20024. * @returns {string|symbol} Returns the key.
  20025. */
  20026. function toKey(value) {
  20027. if (typeof value == 'string' || isSymbol(value)) {
  20028. return value;
  20029. }
  20030. var result = (value + '');
  20031. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  20032. }
  20033. /**
  20034. * Converts `func` to its source code.
  20035. *
  20036. * @private
  20037. * @param {Function} func The function to convert.
  20038. * @returns {string} Returns the source code.
  20039. */
  20040. function toSource(func) {
  20041. if (func != null) {
  20042. try {
  20043. return funcToString.call(func);
  20044. } catch (e) {}
  20045. try {
  20046. return (func + '');
  20047. } catch (e) {}
  20048. }
  20049. return '';
  20050. }
  20051. /**
  20052. * Updates wrapper `details` based on `bitmask` flags.
  20053. *
  20054. * @private
  20055. * @returns {Array} details The details to modify.
  20056. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20057. * @returns {Array} Returns `details`.
  20058. */
  20059. function updateWrapDetails(details, bitmask) {
  20060. arrayEach(wrapFlags, function(pair) {
  20061. var value = '_.' + pair[0];
  20062. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  20063. details.push(value);
  20064. }
  20065. });
  20066. return details.sort();
  20067. }
  20068. /**
  20069. * Creates a clone of `wrapper`.
  20070. *
  20071. * @private
  20072. * @param {Object} wrapper The wrapper to clone.
  20073. * @returns {Object} Returns the cloned wrapper.
  20074. */
  20075. function wrapperClone(wrapper) {
  20076. if (wrapper instanceof LazyWrapper) {
  20077. return wrapper.clone();
  20078. }
  20079. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  20080. result.__actions__ = copyArray(wrapper.__actions__);
  20081. result.__index__ = wrapper.__index__;
  20082. result.__values__ = wrapper.__values__;
  20083. return result;
  20084. }
  20085. /*------------------------------------------------------------------------*/
  20086. /**
  20087. * Creates an array of elements split into groups the length of `size`.
  20088. * If `array` can't be split evenly, the final chunk will be the remaining
  20089. * elements.
  20090. *
  20091. * @static
  20092. * @memberOf _
  20093. * @since 3.0.0
  20094. * @category Array
  20095. * @param {Array} array The array to process.
  20096. * @param {number} [size=1] The length of each chunk
  20097. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20098. * @returns {Array} Returns the new array of chunks.
  20099. * @example
  20100. *
  20101. * _.chunk(['a', 'b', 'c', 'd'], 2);
  20102. * // => [['a', 'b'], ['c', 'd']]
  20103. *
  20104. * _.chunk(['a', 'b', 'c', 'd'], 3);
  20105. * // => [['a', 'b', 'c'], ['d']]
  20106. */
  20107. function chunk(array, size, guard) {
  20108. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  20109. size = 1;
  20110. } else {
  20111. size = nativeMax(toInteger(size), 0);
  20112. }
  20113. var length = array == null ? 0 : array.length;
  20114. if (!length || size < 1) {
  20115. return [];
  20116. }
  20117. var index = 0,
  20118. resIndex = 0,
  20119. result = Array(nativeCeil(length / size));
  20120. while (index < length) {
  20121. result[resIndex++] = baseSlice(array, index, (index += size));
  20122. }
  20123. return result;
  20124. }
  20125. /**
  20126. * Creates an array with all falsey values removed. The values `false`, `null`,
  20127. * `0`, `""`, `undefined`, and `NaN` are falsey.
  20128. *
  20129. * @static
  20130. * @memberOf _
  20131. * @since 0.1.0
  20132. * @category Array
  20133. * @param {Array} array The array to compact.
  20134. * @returns {Array} Returns the new array of filtered values.
  20135. * @example
  20136. *
  20137. * _.compact([0, 1, false, 2, '', 3]);
  20138. * // => [1, 2, 3]
  20139. */
  20140. function compact(array) {
  20141. var index = -1,
  20142. length = array == null ? 0 : array.length,
  20143. resIndex = 0,
  20144. result = [];
  20145. while (++index < length) {
  20146. var value = array[index];
  20147. if (value) {
  20148. result[resIndex++] = value;
  20149. }
  20150. }
  20151. return result;
  20152. }
  20153. /**
  20154. * Creates a new array concatenating `array` with any additional arrays
  20155. * and/or values.
  20156. *
  20157. * @static
  20158. * @memberOf _
  20159. * @since 4.0.0
  20160. * @category Array
  20161. * @param {Array} array The array to concatenate.
  20162. * @param {...*} [values] The values to concatenate.
  20163. * @returns {Array} Returns the new concatenated array.
  20164. * @example
  20165. *
  20166. * var array = [1];
  20167. * var other = _.concat(array, 2, [3], [[4]]);
  20168. *
  20169. * console.log(other);
  20170. * // => [1, 2, 3, [4]]
  20171. *
  20172. * console.log(array);
  20173. * // => [1]
  20174. */
  20175. function concat() {
  20176. var length = arguments.length;
  20177. if (!length) {
  20178. return [];
  20179. }
  20180. var args = Array(length - 1),
  20181. array = arguments[0],
  20182. index = length;
  20183. while (index--) {
  20184. args[index - 1] = arguments[index];
  20185. }
  20186. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  20187. }
  20188. /**
  20189. * Creates an array of `array` values not included in the other given arrays
  20190. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20191. * for equality comparisons. The order and references of result values are
  20192. * determined by the first array.
  20193. *
  20194. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  20195. *
  20196. * @static
  20197. * @memberOf _
  20198. * @since 0.1.0
  20199. * @category Array
  20200. * @param {Array} array The array to inspect.
  20201. * @param {...Array} [values] The values to exclude.
  20202. * @returns {Array} Returns the new array of filtered values.
  20203. * @see _.without, _.xor
  20204. * @example
  20205. *
  20206. * _.difference([2, 1], [2, 3]);
  20207. * // => [1]
  20208. */
  20209. var difference = baseRest(function(array, values) {
  20210. return isArrayLikeObject(array)
  20211. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  20212. : [];
  20213. });
  20214. /**
  20215. * This method is like `_.difference` except that it accepts `iteratee` which
  20216. * is invoked for each element of `array` and `values` to generate the criterion
  20217. * by which they're compared. The order and references of result values are
  20218. * determined by the first array. The iteratee is invoked with one argument:
  20219. * (value).
  20220. *
  20221. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  20222. *
  20223. * @static
  20224. * @memberOf _
  20225. * @since 4.0.0
  20226. * @category Array
  20227. * @param {Array} array The array to inspect.
  20228. * @param {...Array} [values] The values to exclude.
  20229. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20230. * @returns {Array} Returns the new array of filtered values.
  20231. * @example
  20232. *
  20233. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20234. * // => [1.2]
  20235. *
  20236. * // The `_.property` iteratee shorthand.
  20237. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  20238. * // => [{ 'x': 2 }]
  20239. */
  20240. var differenceBy = baseRest(function(array, values) {
  20241. var iteratee = last(values);
  20242. if (isArrayLikeObject(iteratee)) {
  20243. iteratee = undefined;
  20244. }
  20245. return isArrayLikeObject(array)
  20246. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  20247. : [];
  20248. });
  20249. /**
  20250. * This method is like `_.difference` except that it accepts `comparator`
  20251. * which is invoked to compare elements of `array` to `values`. The order and
  20252. * references of result values are determined by the first array. The comparator
  20253. * is invoked with two arguments: (arrVal, othVal).
  20254. *
  20255. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  20256. *
  20257. * @static
  20258. * @memberOf _
  20259. * @since 4.0.0
  20260. * @category Array
  20261. * @param {Array} array The array to inspect.
  20262. * @param {...Array} [values] The values to exclude.
  20263. * @param {Function} [comparator] The comparator invoked per element.
  20264. * @returns {Array} Returns the new array of filtered values.
  20265. * @example
  20266. *
  20267. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20268. *
  20269. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  20270. * // => [{ 'x': 2, 'y': 1 }]
  20271. */
  20272. var differenceWith = baseRest(function(array, values) {
  20273. var comparator = last(values);
  20274. if (isArrayLikeObject(comparator)) {
  20275. comparator = undefined;
  20276. }
  20277. return isArrayLikeObject(array)
  20278. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  20279. : [];
  20280. });
  20281. /**
  20282. * Creates a slice of `array` with `n` elements dropped from the beginning.
  20283. *
  20284. * @static
  20285. * @memberOf _
  20286. * @since 0.5.0
  20287. * @category Array
  20288. * @param {Array} array The array to query.
  20289. * @param {number} [n=1] The number of elements to drop.
  20290. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20291. * @returns {Array} Returns the slice of `array`.
  20292. * @example
  20293. *
  20294. * _.drop([1, 2, 3]);
  20295. * // => [2, 3]
  20296. *
  20297. * _.drop([1, 2, 3], 2);
  20298. * // => [3]
  20299. *
  20300. * _.drop([1, 2, 3], 5);
  20301. * // => []
  20302. *
  20303. * _.drop([1, 2, 3], 0);
  20304. * // => [1, 2, 3]
  20305. */
  20306. function drop(array, n, guard) {
  20307. var length = array == null ? 0 : array.length;
  20308. if (!length) {
  20309. return [];
  20310. }
  20311. n = (guard || n === undefined) ? 1 : toInteger(n);
  20312. return baseSlice(array, n < 0 ? 0 : n, length);
  20313. }
  20314. /**
  20315. * Creates a slice of `array` with `n` elements dropped from the end.
  20316. *
  20317. * @static
  20318. * @memberOf _
  20319. * @since 3.0.0
  20320. * @category Array
  20321. * @param {Array} array The array to query.
  20322. * @param {number} [n=1] The number of elements to drop.
  20323. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20324. * @returns {Array} Returns the slice of `array`.
  20325. * @example
  20326. *
  20327. * _.dropRight([1, 2, 3]);
  20328. * // => [1, 2]
  20329. *
  20330. * _.dropRight([1, 2, 3], 2);
  20331. * // => [1]
  20332. *
  20333. * _.dropRight([1, 2, 3], 5);
  20334. * // => []
  20335. *
  20336. * _.dropRight([1, 2, 3], 0);
  20337. * // => [1, 2, 3]
  20338. */
  20339. function dropRight(array, n, guard) {
  20340. var length = array == null ? 0 : array.length;
  20341. if (!length) {
  20342. return [];
  20343. }
  20344. n = (guard || n === undefined) ? 1 : toInteger(n);
  20345. n = length - n;
  20346. return baseSlice(array, 0, n < 0 ? 0 : n);
  20347. }
  20348. /**
  20349. * Creates a slice of `array` excluding elements dropped from the end.
  20350. * Elements are dropped until `predicate` returns falsey. The predicate is
  20351. * invoked with three arguments: (value, index, array).
  20352. *
  20353. * @static
  20354. * @memberOf _
  20355. * @since 3.0.0
  20356. * @category Array
  20357. * @param {Array} array The array to query.
  20358. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20359. * @returns {Array} Returns the slice of `array`.
  20360. * @example
  20361. *
  20362. * var users = [
  20363. * { 'user': 'barney', 'active': true },
  20364. * { 'user': 'fred', 'active': false },
  20365. * { 'user': 'pebbles', 'active': false }
  20366. * ];
  20367. *
  20368. * _.dropRightWhile(users, function(o) { return !o.active; });
  20369. * // => objects for ['barney']
  20370. *
  20371. * // The `_.matches` iteratee shorthand.
  20372. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  20373. * // => objects for ['barney', 'fred']
  20374. *
  20375. * // The `_.matchesProperty` iteratee shorthand.
  20376. * _.dropRightWhile(users, ['active', false]);
  20377. * // => objects for ['barney']
  20378. *
  20379. * // The `_.property` iteratee shorthand.
  20380. * _.dropRightWhile(users, 'active');
  20381. * // => objects for ['barney', 'fred', 'pebbles']
  20382. */
  20383. function dropRightWhile(array, predicate) {
  20384. return (array && array.length)
  20385. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  20386. : [];
  20387. }
  20388. /**
  20389. * Creates a slice of `array` excluding elements dropped from the beginning.
  20390. * Elements are dropped until `predicate` returns falsey. The predicate is
  20391. * invoked with three arguments: (value, index, array).
  20392. *
  20393. * @static
  20394. * @memberOf _
  20395. * @since 3.0.0
  20396. * @category Array
  20397. * @param {Array} array The array to query.
  20398. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20399. * @returns {Array} Returns the slice of `array`.
  20400. * @example
  20401. *
  20402. * var users = [
  20403. * { 'user': 'barney', 'active': false },
  20404. * { 'user': 'fred', 'active': false },
  20405. * { 'user': 'pebbles', 'active': true }
  20406. * ];
  20407. *
  20408. * _.dropWhile(users, function(o) { return !o.active; });
  20409. * // => objects for ['pebbles']
  20410. *
  20411. * // The `_.matches` iteratee shorthand.
  20412. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  20413. * // => objects for ['fred', 'pebbles']
  20414. *
  20415. * // The `_.matchesProperty` iteratee shorthand.
  20416. * _.dropWhile(users, ['active', false]);
  20417. * // => objects for ['pebbles']
  20418. *
  20419. * // The `_.property` iteratee shorthand.
  20420. * _.dropWhile(users, 'active');
  20421. * // => objects for ['barney', 'fred', 'pebbles']
  20422. */
  20423. function dropWhile(array, predicate) {
  20424. return (array && array.length)
  20425. ? baseWhile(array, getIteratee(predicate, 3), true)
  20426. : [];
  20427. }
  20428. /**
  20429. * Fills elements of `array` with `value` from `start` up to, but not
  20430. * including, `end`.
  20431. *
  20432. * **Note:** This method mutates `array`.
  20433. *
  20434. * @static
  20435. * @memberOf _
  20436. * @since 3.2.0
  20437. * @category Array
  20438. * @param {Array} array The array to fill.
  20439. * @param {*} value The value to fill `array` with.
  20440. * @param {number} [start=0] The start position.
  20441. * @param {number} [end=array.length] The end position.
  20442. * @returns {Array} Returns `array`.
  20443. * @example
  20444. *
  20445. * var array = [1, 2, 3];
  20446. *
  20447. * _.fill(array, 'a');
  20448. * console.log(array);
  20449. * // => ['a', 'a', 'a']
  20450. *
  20451. * _.fill(Array(3), 2);
  20452. * // => [2, 2, 2]
  20453. *
  20454. * _.fill([4, 6, 8, 10], '*', 1, 3);
  20455. * // => [4, '*', '*', 10]
  20456. */
  20457. function fill(array, value, start, end) {
  20458. var length = array == null ? 0 : array.length;
  20459. if (!length) {
  20460. return [];
  20461. }
  20462. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  20463. start = 0;
  20464. end = length;
  20465. }
  20466. return baseFill(array, value, start, end);
  20467. }
  20468. /**
  20469. * This method is like `_.find` except that it returns the index of the first
  20470. * element `predicate` returns truthy for instead of the element itself.
  20471. *
  20472. * @static
  20473. * @memberOf _
  20474. * @since 1.1.0
  20475. * @category Array
  20476. * @param {Array} array The array to inspect.
  20477. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20478. * @param {number} [fromIndex=0] The index to search from.
  20479. * @returns {number} Returns the index of the found element, else `-1`.
  20480. * @example
  20481. *
  20482. * var users = [
  20483. * { 'user': 'barney', 'active': false },
  20484. * { 'user': 'fred', 'active': false },
  20485. * { 'user': 'pebbles', 'active': true }
  20486. * ];
  20487. *
  20488. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20489. * // => 0
  20490. *
  20491. * // The `_.matches` iteratee shorthand.
  20492. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20493. * // => 1
  20494. *
  20495. * // The `_.matchesProperty` iteratee shorthand.
  20496. * _.findIndex(users, ['active', false]);
  20497. * // => 0
  20498. *
  20499. * // The `_.property` iteratee shorthand.
  20500. * _.findIndex(users, 'active');
  20501. * // => 2
  20502. */
  20503. function findIndex(array, predicate, fromIndex) {
  20504. var length = array == null ? 0 : array.length;
  20505. if (!length) {
  20506. return -1;
  20507. }
  20508. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20509. if (index < 0) {
  20510. index = nativeMax(length + index, 0);
  20511. }
  20512. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20513. }
  20514. /**
  20515. * This method is like `_.findIndex` except that it iterates over elements
  20516. * of `collection` from right to left.
  20517. *
  20518. * @static
  20519. * @memberOf _
  20520. * @since 2.0.0
  20521. * @category Array
  20522. * @param {Array} array The array to inspect.
  20523. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20524. * @param {number} [fromIndex=array.length-1] The index to search from.
  20525. * @returns {number} Returns the index of the found element, else `-1`.
  20526. * @example
  20527. *
  20528. * var users = [
  20529. * { 'user': 'barney', 'active': true },
  20530. * { 'user': 'fred', 'active': false },
  20531. * { 'user': 'pebbles', 'active': false }
  20532. * ];
  20533. *
  20534. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20535. * // => 2
  20536. *
  20537. * // The `_.matches` iteratee shorthand.
  20538. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20539. * // => 0
  20540. *
  20541. * // The `_.matchesProperty` iteratee shorthand.
  20542. * _.findLastIndex(users, ['active', false]);
  20543. * // => 2
  20544. *
  20545. * // The `_.property` iteratee shorthand.
  20546. * _.findLastIndex(users, 'active');
  20547. * // => 0
  20548. */
  20549. function findLastIndex(array, predicate, fromIndex) {
  20550. var length = array == null ? 0 : array.length;
  20551. if (!length) {
  20552. return -1;
  20553. }
  20554. var index = length - 1;
  20555. if (fromIndex !== undefined) {
  20556. index = toInteger(fromIndex);
  20557. index = fromIndex < 0
  20558. ? nativeMax(length + index, 0)
  20559. : nativeMin(index, length - 1);
  20560. }
  20561. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20562. }
  20563. /**
  20564. * Flattens `array` a single level deep.
  20565. *
  20566. * @static
  20567. * @memberOf _
  20568. * @since 0.1.0
  20569. * @category Array
  20570. * @param {Array} array The array to flatten.
  20571. * @returns {Array} Returns the new flattened array.
  20572. * @example
  20573. *
  20574. * _.flatten([1, [2, [3, [4]], 5]]);
  20575. * // => [1, 2, [3, [4]], 5]
  20576. */
  20577. function flatten(array) {
  20578. var length = array == null ? 0 : array.length;
  20579. return length ? baseFlatten(array, 1) : [];
  20580. }
  20581. /**
  20582. * Recursively flattens `array`.
  20583. *
  20584. * @static
  20585. * @memberOf _
  20586. * @since 3.0.0
  20587. * @category Array
  20588. * @param {Array} array The array to flatten.
  20589. * @returns {Array} Returns the new flattened array.
  20590. * @example
  20591. *
  20592. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20593. * // => [1, 2, 3, 4, 5]
  20594. */
  20595. function flattenDeep(array) {
  20596. var length = array == null ? 0 : array.length;
  20597. return length ? baseFlatten(array, INFINITY) : [];
  20598. }
  20599. /**
  20600. * Recursively flatten `array` up to `depth` times.
  20601. *
  20602. * @static
  20603. * @memberOf _
  20604. * @since 4.4.0
  20605. * @category Array
  20606. * @param {Array} array The array to flatten.
  20607. * @param {number} [depth=1] The maximum recursion depth.
  20608. * @returns {Array} Returns the new flattened array.
  20609. * @example
  20610. *
  20611. * var array = [1, [2, [3, [4]], 5]];
  20612. *
  20613. * _.flattenDepth(array, 1);
  20614. * // => [1, 2, [3, [4]], 5]
  20615. *
  20616. * _.flattenDepth(array, 2);
  20617. * // => [1, 2, 3, [4], 5]
  20618. */
  20619. function flattenDepth(array, depth) {
  20620. var length = array == null ? 0 : array.length;
  20621. if (!length) {
  20622. return [];
  20623. }
  20624. depth = depth === undefined ? 1 : toInteger(depth);
  20625. return baseFlatten(array, depth);
  20626. }
  20627. /**
  20628. * The inverse of `_.toPairs`; this method returns an object composed
  20629. * from key-value `pairs`.
  20630. *
  20631. * @static
  20632. * @memberOf _
  20633. * @since 4.0.0
  20634. * @category Array
  20635. * @param {Array} pairs The key-value pairs.
  20636. * @returns {Object} Returns the new object.
  20637. * @example
  20638. *
  20639. * _.fromPairs([['a', 1], ['b', 2]]);
  20640. * // => { 'a': 1, 'b': 2 }
  20641. */
  20642. function fromPairs(pairs) {
  20643. var index = -1,
  20644. length = pairs == null ? 0 : pairs.length,
  20645. result = {};
  20646. while (++index < length) {
  20647. var pair = pairs[index];
  20648. result[pair[0]] = pair[1];
  20649. }
  20650. return result;
  20651. }
  20652. /**
  20653. * Gets the first element of `array`.
  20654. *
  20655. * @static
  20656. * @memberOf _
  20657. * @since 0.1.0
  20658. * @alias first
  20659. * @category Array
  20660. * @param {Array} array The array to query.
  20661. * @returns {*} Returns the first element of `array`.
  20662. * @example
  20663. *
  20664. * _.head([1, 2, 3]);
  20665. * // => 1
  20666. *
  20667. * _.head([]);
  20668. * // => undefined
  20669. */
  20670. function head(array) {
  20671. return (array && array.length) ? array[0] : undefined;
  20672. }
  20673. /**
  20674. * Gets the index at which the first occurrence of `value` is found in `array`
  20675. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20676. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20677. * offset from the end of `array`.
  20678. *
  20679. * @static
  20680. * @memberOf _
  20681. * @since 0.1.0
  20682. * @category Array
  20683. * @param {Array} array The array to inspect.
  20684. * @param {*} value The value to search for.
  20685. * @param {number} [fromIndex=0] The index to search from.
  20686. * @returns {number} Returns the index of the matched value, else `-1`.
  20687. * @example
  20688. *
  20689. * _.indexOf([1, 2, 1, 2], 2);
  20690. * // => 1
  20691. *
  20692. * // Search from the `fromIndex`.
  20693. * _.indexOf([1, 2, 1, 2], 2, 2);
  20694. * // => 3
  20695. */
  20696. function indexOf(array, value, fromIndex) {
  20697. var length = array == null ? 0 : array.length;
  20698. if (!length) {
  20699. return -1;
  20700. }
  20701. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20702. if (index < 0) {
  20703. index = nativeMax(length + index, 0);
  20704. }
  20705. return baseIndexOf(array, value, index);
  20706. }
  20707. /**
  20708. * Gets all but the last element of `array`.
  20709. *
  20710. * @static
  20711. * @memberOf _
  20712. * @since 0.1.0
  20713. * @category Array
  20714. * @param {Array} array The array to query.
  20715. * @returns {Array} Returns the slice of `array`.
  20716. * @example
  20717. *
  20718. * _.initial([1, 2, 3]);
  20719. * // => [1, 2]
  20720. */
  20721. function initial(array) {
  20722. var length = array == null ? 0 : array.length;
  20723. return length ? baseSlice(array, 0, -1) : [];
  20724. }
  20725. /**
  20726. * Creates an array of unique values that are included in all given arrays
  20727. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20728. * for equality comparisons. The order and references of result values are
  20729. * determined by the first array.
  20730. *
  20731. * @static
  20732. * @memberOf _
  20733. * @since 0.1.0
  20734. * @category Array
  20735. * @param {...Array} [arrays] The arrays to inspect.
  20736. * @returns {Array} Returns the new array of intersecting values.
  20737. * @example
  20738. *
  20739. * _.intersection([2, 1], [2, 3]);
  20740. * // => [2]
  20741. */
  20742. var intersection = baseRest(function(arrays) {
  20743. var mapped = arrayMap(arrays, castArrayLikeObject);
  20744. return (mapped.length && mapped[0] === arrays[0])
  20745. ? baseIntersection(mapped)
  20746. : [];
  20747. });
  20748. /**
  20749. * This method is like `_.intersection` except that it accepts `iteratee`
  20750. * which is invoked for each element of each `arrays` to generate the criterion
  20751. * by which they're compared. The order and references of result values are
  20752. * determined by the first array. The iteratee is invoked with one argument:
  20753. * (value).
  20754. *
  20755. * @static
  20756. * @memberOf _
  20757. * @since 4.0.0
  20758. * @category Array
  20759. * @param {...Array} [arrays] The arrays to inspect.
  20760. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20761. * @returns {Array} Returns the new array of intersecting values.
  20762. * @example
  20763. *
  20764. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20765. * // => [2.1]
  20766. *
  20767. * // The `_.property` iteratee shorthand.
  20768. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20769. * // => [{ 'x': 1 }]
  20770. */
  20771. var intersectionBy = baseRest(function(arrays) {
  20772. var iteratee = last(arrays),
  20773. mapped = arrayMap(arrays, castArrayLikeObject);
  20774. if (iteratee === last(mapped)) {
  20775. iteratee = undefined;
  20776. } else {
  20777. mapped.pop();
  20778. }
  20779. return (mapped.length && mapped[0] === arrays[0])
  20780. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20781. : [];
  20782. });
  20783. /**
  20784. * This method is like `_.intersection` except that it accepts `comparator`
  20785. * which is invoked to compare elements of `arrays`. The order and references
  20786. * of result values are determined by the first array. The comparator is
  20787. * invoked with two arguments: (arrVal, othVal).
  20788. *
  20789. * @static
  20790. * @memberOf _
  20791. * @since 4.0.0
  20792. * @category Array
  20793. * @param {...Array} [arrays] The arrays to inspect.
  20794. * @param {Function} [comparator] The comparator invoked per element.
  20795. * @returns {Array} Returns the new array of intersecting values.
  20796. * @example
  20797. *
  20798. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20799. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20800. *
  20801. * _.intersectionWith(objects, others, _.isEqual);
  20802. * // => [{ 'x': 1, 'y': 2 }]
  20803. */
  20804. var intersectionWith = baseRest(function(arrays) {
  20805. var comparator = last(arrays),
  20806. mapped = arrayMap(arrays, castArrayLikeObject);
  20807. comparator = typeof comparator == 'function' ? comparator : undefined;
  20808. if (comparator) {
  20809. mapped.pop();
  20810. }
  20811. return (mapped.length && mapped[0] === arrays[0])
  20812. ? baseIntersection(mapped, undefined, comparator)
  20813. : [];
  20814. });
  20815. /**
  20816. * Converts all elements in `array` into a string separated by `separator`.
  20817. *
  20818. * @static
  20819. * @memberOf _
  20820. * @since 4.0.0
  20821. * @category Array
  20822. * @param {Array} array The array to convert.
  20823. * @param {string} [separator=','] The element separator.
  20824. * @returns {string} Returns the joined string.
  20825. * @example
  20826. *
  20827. * _.join(['a', 'b', 'c'], '~');
  20828. * // => 'a~b~c'
  20829. */
  20830. function join(array, separator) {
  20831. return array == null ? '' : nativeJoin.call(array, separator);
  20832. }
  20833. /**
  20834. * Gets the last element of `array`.
  20835. *
  20836. * @static
  20837. * @memberOf _
  20838. * @since 0.1.0
  20839. * @category Array
  20840. * @param {Array} array The array to query.
  20841. * @returns {*} Returns the last element of `array`.
  20842. * @example
  20843. *
  20844. * _.last([1, 2, 3]);
  20845. * // => 3
  20846. */
  20847. function last(array) {
  20848. var length = array == null ? 0 : array.length;
  20849. return length ? array[length - 1] : undefined;
  20850. }
  20851. /**
  20852. * This method is like `_.indexOf` except that it iterates over elements of
  20853. * `array` from right to left.
  20854. *
  20855. * @static
  20856. * @memberOf _
  20857. * @since 0.1.0
  20858. * @category Array
  20859. * @param {Array} array The array to inspect.
  20860. * @param {*} value The value to search for.
  20861. * @param {number} [fromIndex=array.length-1] The index to search from.
  20862. * @returns {number} Returns the index of the matched value, else `-1`.
  20863. * @example
  20864. *
  20865. * _.lastIndexOf([1, 2, 1, 2], 2);
  20866. * // => 3
  20867. *
  20868. * // Search from the `fromIndex`.
  20869. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  20870. * // => 1
  20871. */
  20872. function lastIndexOf(array, value, fromIndex) {
  20873. var length = array == null ? 0 : array.length;
  20874. if (!length) {
  20875. return -1;
  20876. }
  20877. var index = length;
  20878. if (fromIndex !== undefined) {
  20879. index = toInteger(fromIndex);
  20880. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  20881. }
  20882. return value === value
  20883. ? strictLastIndexOf(array, value, index)
  20884. : baseFindIndex(array, baseIsNaN, index, true);
  20885. }
  20886. /**
  20887. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  20888. * element from the end is returned.
  20889. *
  20890. * @static
  20891. * @memberOf _
  20892. * @since 4.11.0
  20893. * @category Array
  20894. * @param {Array} array The array to query.
  20895. * @param {number} [n=0] The index of the element to return.
  20896. * @returns {*} Returns the nth element of `array`.
  20897. * @example
  20898. *
  20899. * var array = ['a', 'b', 'c', 'd'];
  20900. *
  20901. * _.nth(array, 1);
  20902. * // => 'b'
  20903. *
  20904. * _.nth(array, -2);
  20905. * // => 'c';
  20906. */
  20907. function nth(array, n) {
  20908. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  20909. }
  20910. /**
  20911. * Removes all given values from `array` using
  20912. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20913. * for equality comparisons.
  20914. *
  20915. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  20916. * to remove elements from an array by predicate.
  20917. *
  20918. * @static
  20919. * @memberOf _
  20920. * @since 2.0.0
  20921. * @category Array
  20922. * @param {Array} array The array to modify.
  20923. * @param {...*} [values] The values to remove.
  20924. * @returns {Array} Returns `array`.
  20925. * @example
  20926. *
  20927. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20928. *
  20929. * _.pull(array, 'a', 'c');
  20930. * console.log(array);
  20931. * // => ['b', 'b']
  20932. */
  20933. var pull = baseRest(pullAll);
  20934. /**
  20935. * This method is like `_.pull` except that it accepts an array of values to remove.
  20936. *
  20937. * **Note:** Unlike `_.difference`, this method mutates `array`.
  20938. *
  20939. * @static
  20940. * @memberOf _
  20941. * @since 4.0.0
  20942. * @category Array
  20943. * @param {Array} array The array to modify.
  20944. * @param {Array} values The values to remove.
  20945. * @returns {Array} Returns `array`.
  20946. * @example
  20947. *
  20948. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20949. *
  20950. * _.pullAll(array, ['a', 'c']);
  20951. * console.log(array);
  20952. * // => ['b', 'b']
  20953. */
  20954. function pullAll(array, values) {
  20955. return (array && array.length && values && values.length)
  20956. ? basePullAll(array, values)
  20957. : array;
  20958. }
  20959. /**
  20960. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  20961. * invoked for each element of `array` and `values` to generate the criterion
  20962. * by which they're compared. The iteratee is invoked with one argument: (value).
  20963. *
  20964. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  20965. *
  20966. * @static
  20967. * @memberOf _
  20968. * @since 4.0.0
  20969. * @category Array
  20970. * @param {Array} array The array to modify.
  20971. * @param {Array} values The values to remove.
  20972. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20973. * @returns {Array} Returns `array`.
  20974. * @example
  20975. *
  20976. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  20977. *
  20978. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  20979. * console.log(array);
  20980. * // => [{ 'x': 2 }]
  20981. */
  20982. function pullAllBy(array, values, iteratee) {
  20983. return (array && array.length && values && values.length)
  20984. ? basePullAll(array, values, getIteratee(iteratee, 2))
  20985. : array;
  20986. }
  20987. /**
  20988. * This method is like `_.pullAll` except that it accepts `comparator` which
  20989. * is invoked to compare elements of `array` to `values`. The comparator is
  20990. * invoked with two arguments: (arrVal, othVal).
  20991. *
  20992. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  20993. *
  20994. * @static
  20995. * @memberOf _
  20996. * @since 4.6.0
  20997. * @category Array
  20998. * @param {Array} array The array to modify.
  20999. * @param {Array} values The values to remove.
  21000. * @param {Function} [comparator] The comparator invoked per element.
  21001. * @returns {Array} Returns `array`.
  21002. * @example
  21003. *
  21004. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  21005. *
  21006. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  21007. * console.log(array);
  21008. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  21009. */
  21010. function pullAllWith(array, values, comparator) {
  21011. return (array && array.length && values && values.length)
  21012. ? basePullAll(array, values, undefined, comparator)
  21013. : array;
  21014. }
  21015. /**
  21016. * Removes elements from `array` corresponding to `indexes` and returns an
  21017. * array of removed elements.
  21018. *
  21019. * **Note:** Unlike `_.at`, this method mutates `array`.
  21020. *
  21021. * @static
  21022. * @memberOf _
  21023. * @since 3.0.0
  21024. * @category Array
  21025. * @param {Array} array The array to modify.
  21026. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  21027. * @returns {Array} Returns the new array of removed elements.
  21028. * @example
  21029. *
  21030. * var array = ['a', 'b', 'c', 'd'];
  21031. * var pulled = _.pullAt(array, [1, 3]);
  21032. *
  21033. * console.log(array);
  21034. * // => ['a', 'c']
  21035. *
  21036. * console.log(pulled);
  21037. * // => ['b', 'd']
  21038. */
  21039. var pullAt = flatRest(function(array, indexes) {
  21040. var length = array == null ? 0 : array.length,
  21041. result = baseAt(array, indexes);
  21042. basePullAt(array, arrayMap(indexes, function(index) {
  21043. return isIndex(index, length) ? +index : index;
  21044. }).sort(compareAscending));
  21045. return result;
  21046. });
  21047. /**
  21048. * Removes all elements from `array` that `predicate` returns truthy for
  21049. * and returns an array of the removed elements. The predicate is invoked
  21050. * with three arguments: (value, index, array).
  21051. *
  21052. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  21053. * to pull elements from an array by value.
  21054. *
  21055. * @static
  21056. * @memberOf _
  21057. * @since 2.0.0
  21058. * @category Array
  21059. * @param {Array} array The array to modify.
  21060. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21061. * @returns {Array} Returns the new array of removed elements.
  21062. * @example
  21063. *
  21064. * var array = [1, 2, 3, 4];
  21065. * var evens = _.remove(array, function(n) {
  21066. * return n % 2 == 0;
  21067. * });
  21068. *
  21069. * console.log(array);
  21070. * // => [1, 3]
  21071. *
  21072. * console.log(evens);
  21073. * // => [2, 4]
  21074. */
  21075. function remove(array, predicate) {
  21076. var result = [];
  21077. if (!(array && array.length)) {
  21078. return result;
  21079. }
  21080. var index = -1,
  21081. indexes = [],
  21082. length = array.length;
  21083. predicate = getIteratee(predicate, 3);
  21084. while (++index < length) {
  21085. var value = array[index];
  21086. if (predicate(value, index, array)) {
  21087. result.push(value);
  21088. indexes.push(index);
  21089. }
  21090. }
  21091. basePullAt(array, indexes);
  21092. return result;
  21093. }
  21094. /**
  21095. * Reverses `array` so that the first element becomes the last, the second
  21096. * element becomes the second to last, and so on.
  21097. *
  21098. * **Note:** This method mutates `array` and is based on
  21099. * [`Array#reverse`](https://mdn.io/Array/reverse).
  21100. *
  21101. * @static
  21102. * @memberOf _
  21103. * @since 4.0.0
  21104. * @category Array
  21105. * @param {Array} array The array to modify.
  21106. * @returns {Array} Returns `array`.
  21107. * @example
  21108. *
  21109. * var array = [1, 2, 3];
  21110. *
  21111. * _.reverse(array);
  21112. * // => [3, 2, 1]
  21113. *
  21114. * console.log(array);
  21115. * // => [3, 2, 1]
  21116. */
  21117. function reverse(array) {
  21118. return array == null ? array : nativeReverse.call(array);
  21119. }
  21120. /**
  21121. * Creates a slice of `array` from `start` up to, but not including, `end`.
  21122. *
  21123. * **Note:** This method is used instead of
  21124. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  21125. * returned.
  21126. *
  21127. * @static
  21128. * @memberOf _
  21129. * @since 3.0.0
  21130. * @category Array
  21131. * @param {Array} array The array to slice.
  21132. * @param {number} [start=0] The start position.
  21133. * @param {number} [end=array.length] The end position.
  21134. * @returns {Array} Returns the slice of `array`.
  21135. */
  21136. function slice(array, start, end) {
  21137. var length = array == null ? 0 : array.length;
  21138. if (!length) {
  21139. return [];
  21140. }
  21141. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  21142. start = 0;
  21143. end = length;
  21144. }
  21145. else {
  21146. start = start == null ? 0 : toInteger(start);
  21147. end = end === undefined ? length : toInteger(end);
  21148. }
  21149. return baseSlice(array, start, end);
  21150. }
  21151. /**
  21152. * Uses a binary search to determine the lowest index at which `value`
  21153. * should be inserted into `array` in order to maintain its sort order.
  21154. *
  21155. * @static
  21156. * @memberOf _
  21157. * @since 0.1.0
  21158. * @category Array
  21159. * @param {Array} array The sorted array to inspect.
  21160. * @param {*} value The value to evaluate.
  21161. * @returns {number} Returns the index at which `value` should be inserted
  21162. * into `array`.
  21163. * @example
  21164. *
  21165. * _.sortedIndex([30, 50], 40);
  21166. * // => 1
  21167. */
  21168. function sortedIndex(array, value) {
  21169. return baseSortedIndex(array, value);
  21170. }
  21171. /**
  21172. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  21173. * which is invoked for `value` and each element of `array` to compute their
  21174. * sort ranking. The iteratee is invoked with one argument: (value).
  21175. *
  21176. * @static
  21177. * @memberOf _
  21178. * @since 4.0.0
  21179. * @category Array
  21180. * @param {Array} array The sorted array to inspect.
  21181. * @param {*} value The value to evaluate.
  21182. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21183. * @returns {number} Returns the index at which `value` should be inserted
  21184. * into `array`.
  21185. * @example
  21186. *
  21187. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21188. *
  21189. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21190. * // => 0
  21191. *
  21192. * // The `_.property` iteratee shorthand.
  21193. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  21194. * // => 0
  21195. */
  21196. function sortedIndexBy(array, value, iteratee) {
  21197. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  21198. }
  21199. /**
  21200. * This method is like `_.indexOf` except that it performs a binary
  21201. * search on a sorted `array`.
  21202. *
  21203. * @static
  21204. * @memberOf _
  21205. * @since 4.0.0
  21206. * @category Array
  21207. * @param {Array} array The array to inspect.
  21208. * @param {*} value The value to search for.
  21209. * @returns {number} Returns the index of the matched value, else `-1`.
  21210. * @example
  21211. *
  21212. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  21213. * // => 1
  21214. */
  21215. function sortedIndexOf(array, value) {
  21216. var length = array == null ? 0 : array.length;
  21217. if (length) {
  21218. var index = baseSortedIndex(array, value);
  21219. if (index < length && eq(array[index], value)) {
  21220. return index;
  21221. }
  21222. }
  21223. return -1;
  21224. }
  21225. /**
  21226. * This method is like `_.sortedIndex` except that it returns the highest
  21227. * index at which `value` should be inserted into `array` in order to
  21228. * maintain its sort order.
  21229. *
  21230. * @static
  21231. * @memberOf _
  21232. * @since 3.0.0
  21233. * @category Array
  21234. * @param {Array} array The sorted array to inspect.
  21235. * @param {*} value The value to evaluate.
  21236. * @returns {number} Returns the index at which `value` should be inserted
  21237. * into `array`.
  21238. * @example
  21239. *
  21240. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  21241. * // => 4
  21242. */
  21243. function sortedLastIndex(array, value) {
  21244. return baseSortedIndex(array, value, true);
  21245. }
  21246. /**
  21247. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  21248. * which is invoked for `value` and each element of `array` to compute their
  21249. * sort ranking. The iteratee is invoked with one argument: (value).
  21250. *
  21251. * @static
  21252. * @memberOf _
  21253. * @since 4.0.0
  21254. * @category Array
  21255. * @param {Array} array The sorted array to inspect.
  21256. * @param {*} value The value to evaluate.
  21257. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21258. * @returns {number} Returns the index at which `value` should be inserted
  21259. * into `array`.
  21260. * @example
  21261. *
  21262. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21263. *
  21264. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21265. * // => 1
  21266. *
  21267. * // The `_.property` iteratee shorthand.
  21268. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  21269. * // => 1
  21270. */
  21271. function sortedLastIndexBy(array, value, iteratee) {
  21272. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  21273. }
  21274. /**
  21275. * This method is like `_.lastIndexOf` except that it performs a binary
  21276. * search on a sorted `array`.
  21277. *
  21278. * @static
  21279. * @memberOf _
  21280. * @since 4.0.0
  21281. * @category Array
  21282. * @param {Array} array The array to inspect.
  21283. * @param {*} value The value to search for.
  21284. * @returns {number} Returns the index of the matched value, else `-1`.
  21285. * @example
  21286. *
  21287. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  21288. * // => 3
  21289. */
  21290. function sortedLastIndexOf(array, value) {
  21291. var length = array == null ? 0 : array.length;
  21292. if (length) {
  21293. var index = baseSortedIndex(array, value, true) - 1;
  21294. if (eq(array[index], value)) {
  21295. return index;
  21296. }
  21297. }
  21298. return -1;
  21299. }
  21300. /**
  21301. * This method is like `_.uniq` except that it's designed and optimized
  21302. * for sorted arrays.
  21303. *
  21304. * @static
  21305. * @memberOf _
  21306. * @since 4.0.0
  21307. * @category Array
  21308. * @param {Array} array The array to inspect.
  21309. * @returns {Array} Returns the new duplicate free array.
  21310. * @example
  21311. *
  21312. * _.sortedUniq([1, 1, 2]);
  21313. * // => [1, 2]
  21314. */
  21315. function sortedUniq(array) {
  21316. return (array && array.length)
  21317. ? baseSortedUniq(array)
  21318. : [];
  21319. }
  21320. /**
  21321. * This method is like `_.uniqBy` except that it's designed and optimized
  21322. * for sorted arrays.
  21323. *
  21324. * @static
  21325. * @memberOf _
  21326. * @since 4.0.0
  21327. * @category Array
  21328. * @param {Array} array The array to inspect.
  21329. * @param {Function} [iteratee] The iteratee invoked per element.
  21330. * @returns {Array} Returns the new duplicate free array.
  21331. * @example
  21332. *
  21333. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  21334. * // => [1.1, 2.3]
  21335. */
  21336. function sortedUniqBy(array, iteratee) {
  21337. return (array && array.length)
  21338. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  21339. : [];
  21340. }
  21341. /**
  21342. * Gets all but the first element of `array`.
  21343. *
  21344. * @static
  21345. * @memberOf _
  21346. * @since 4.0.0
  21347. * @category Array
  21348. * @param {Array} array The array to query.
  21349. * @returns {Array} Returns the slice of `array`.
  21350. * @example
  21351. *
  21352. * _.tail([1, 2, 3]);
  21353. * // => [2, 3]
  21354. */
  21355. function tail(array) {
  21356. var length = array == null ? 0 : array.length;
  21357. return length ? baseSlice(array, 1, length) : [];
  21358. }
  21359. /**
  21360. * Creates a slice of `array` with `n` elements taken from the beginning.
  21361. *
  21362. * @static
  21363. * @memberOf _
  21364. * @since 0.1.0
  21365. * @category Array
  21366. * @param {Array} array The array to query.
  21367. * @param {number} [n=1] The number of elements to take.
  21368. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21369. * @returns {Array} Returns the slice of `array`.
  21370. * @example
  21371. *
  21372. * _.take([1, 2, 3]);
  21373. * // => [1]
  21374. *
  21375. * _.take([1, 2, 3], 2);
  21376. * // => [1, 2]
  21377. *
  21378. * _.take([1, 2, 3], 5);
  21379. * // => [1, 2, 3]
  21380. *
  21381. * _.take([1, 2, 3], 0);
  21382. * // => []
  21383. */
  21384. function take(array, n, guard) {
  21385. if (!(array && array.length)) {
  21386. return [];
  21387. }
  21388. n = (guard || n === undefined) ? 1 : toInteger(n);
  21389. return baseSlice(array, 0, n < 0 ? 0 : n);
  21390. }
  21391. /**
  21392. * Creates a slice of `array` with `n` elements taken from the end.
  21393. *
  21394. * @static
  21395. * @memberOf _
  21396. * @since 3.0.0
  21397. * @category Array
  21398. * @param {Array} array The array to query.
  21399. * @param {number} [n=1] The number of elements to take.
  21400. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21401. * @returns {Array} Returns the slice of `array`.
  21402. * @example
  21403. *
  21404. * _.takeRight([1, 2, 3]);
  21405. * // => [3]
  21406. *
  21407. * _.takeRight([1, 2, 3], 2);
  21408. * // => [2, 3]
  21409. *
  21410. * _.takeRight([1, 2, 3], 5);
  21411. * // => [1, 2, 3]
  21412. *
  21413. * _.takeRight([1, 2, 3], 0);
  21414. * // => []
  21415. */
  21416. function takeRight(array, n, guard) {
  21417. var length = array == null ? 0 : array.length;
  21418. if (!length) {
  21419. return [];
  21420. }
  21421. n = (guard || n === undefined) ? 1 : toInteger(n);
  21422. n = length - n;
  21423. return baseSlice(array, n < 0 ? 0 : n, length);
  21424. }
  21425. /**
  21426. * Creates a slice of `array` with elements taken from the end. Elements are
  21427. * taken until `predicate` returns falsey. The predicate is invoked with
  21428. * three arguments: (value, index, array).
  21429. *
  21430. * @static
  21431. * @memberOf _
  21432. * @since 3.0.0
  21433. * @category Array
  21434. * @param {Array} array The array to query.
  21435. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21436. * @returns {Array} Returns the slice of `array`.
  21437. * @example
  21438. *
  21439. * var users = [
  21440. * { 'user': 'barney', 'active': true },
  21441. * { 'user': 'fred', 'active': false },
  21442. * { 'user': 'pebbles', 'active': false }
  21443. * ];
  21444. *
  21445. * _.takeRightWhile(users, function(o) { return !o.active; });
  21446. * // => objects for ['fred', 'pebbles']
  21447. *
  21448. * // The `_.matches` iteratee shorthand.
  21449. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  21450. * // => objects for ['pebbles']
  21451. *
  21452. * // The `_.matchesProperty` iteratee shorthand.
  21453. * _.takeRightWhile(users, ['active', false]);
  21454. * // => objects for ['fred', 'pebbles']
  21455. *
  21456. * // The `_.property` iteratee shorthand.
  21457. * _.takeRightWhile(users, 'active');
  21458. * // => []
  21459. */
  21460. function takeRightWhile(array, predicate) {
  21461. return (array && array.length)
  21462. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  21463. : [];
  21464. }
  21465. /**
  21466. * Creates a slice of `array` with elements taken from the beginning. Elements
  21467. * are taken until `predicate` returns falsey. The predicate is invoked with
  21468. * three arguments: (value, index, array).
  21469. *
  21470. * @static
  21471. * @memberOf _
  21472. * @since 3.0.0
  21473. * @category Array
  21474. * @param {Array} array The array to query.
  21475. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21476. * @returns {Array} Returns the slice of `array`.
  21477. * @example
  21478. *
  21479. * var users = [
  21480. * { 'user': 'barney', 'active': false },
  21481. * { 'user': 'fred', 'active': false },
  21482. * { 'user': 'pebbles', 'active': true }
  21483. * ];
  21484. *
  21485. * _.takeWhile(users, function(o) { return !o.active; });
  21486. * // => objects for ['barney', 'fred']
  21487. *
  21488. * // The `_.matches` iteratee shorthand.
  21489. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21490. * // => objects for ['barney']
  21491. *
  21492. * // The `_.matchesProperty` iteratee shorthand.
  21493. * _.takeWhile(users, ['active', false]);
  21494. * // => objects for ['barney', 'fred']
  21495. *
  21496. * // The `_.property` iteratee shorthand.
  21497. * _.takeWhile(users, 'active');
  21498. * // => []
  21499. */
  21500. function takeWhile(array, predicate) {
  21501. return (array && array.length)
  21502. ? baseWhile(array, getIteratee(predicate, 3))
  21503. : [];
  21504. }
  21505. /**
  21506. * Creates an array of unique values, in order, from all given arrays using
  21507. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21508. * for equality comparisons.
  21509. *
  21510. * @static
  21511. * @memberOf _
  21512. * @since 0.1.0
  21513. * @category Array
  21514. * @param {...Array} [arrays] The arrays to inspect.
  21515. * @returns {Array} Returns the new array of combined values.
  21516. * @example
  21517. *
  21518. * _.union([2], [1, 2]);
  21519. * // => [2, 1]
  21520. */
  21521. var union = baseRest(function(arrays) {
  21522. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21523. });
  21524. /**
  21525. * This method is like `_.union` except that it accepts `iteratee` which is
  21526. * invoked for each element of each `arrays` to generate the criterion by
  21527. * which uniqueness is computed. Result values are chosen from the first
  21528. * array in which the value occurs. The iteratee is invoked with one argument:
  21529. * (value).
  21530. *
  21531. * @static
  21532. * @memberOf _
  21533. * @since 4.0.0
  21534. * @category Array
  21535. * @param {...Array} [arrays] The arrays to inspect.
  21536. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21537. * @returns {Array} Returns the new array of combined values.
  21538. * @example
  21539. *
  21540. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21541. * // => [2.1, 1.2]
  21542. *
  21543. * // The `_.property` iteratee shorthand.
  21544. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21545. * // => [{ 'x': 1 }, { 'x': 2 }]
  21546. */
  21547. var unionBy = baseRest(function(arrays) {
  21548. var iteratee = last(arrays);
  21549. if (isArrayLikeObject(iteratee)) {
  21550. iteratee = undefined;
  21551. }
  21552. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21553. });
  21554. /**
  21555. * This method is like `_.union` except that it accepts `comparator` which
  21556. * is invoked to compare elements of `arrays`. Result values are chosen from
  21557. * the first array in which the value occurs. The comparator is invoked
  21558. * with two arguments: (arrVal, othVal).
  21559. *
  21560. * @static
  21561. * @memberOf _
  21562. * @since 4.0.0
  21563. * @category Array
  21564. * @param {...Array} [arrays] The arrays to inspect.
  21565. * @param {Function} [comparator] The comparator invoked per element.
  21566. * @returns {Array} Returns the new array of combined values.
  21567. * @example
  21568. *
  21569. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21570. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21571. *
  21572. * _.unionWith(objects, others, _.isEqual);
  21573. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21574. */
  21575. var unionWith = baseRest(function(arrays) {
  21576. var comparator = last(arrays);
  21577. comparator = typeof comparator == 'function' ? comparator : undefined;
  21578. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21579. });
  21580. /**
  21581. * Creates a duplicate-free version of an array, using
  21582. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21583. * for equality comparisons, in which only the first occurrence of each element
  21584. * is kept. The order of result values is determined by the order they occur
  21585. * in the array.
  21586. *
  21587. * @static
  21588. * @memberOf _
  21589. * @since 0.1.0
  21590. * @category Array
  21591. * @param {Array} array The array to inspect.
  21592. * @returns {Array} Returns the new duplicate free array.
  21593. * @example
  21594. *
  21595. * _.uniq([2, 1, 2]);
  21596. * // => [2, 1]
  21597. */
  21598. function uniq(array) {
  21599. return (array && array.length) ? baseUniq(array) : [];
  21600. }
  21601. /**
  21602. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21603. * invoked for each element in `array` to generate the criterion by which
  21604. * uniqueness is computed. The order of result values is determined by the
  21605. * order they occur in the array. The iteratee is invoked with one argument:
  21606. * (value).
  21607. *
  21608. * @static
  21609. * @memberOf _
  21610. * @since 4.0.0
  21611. * @category Array
  21612. * @param {Array} array The array to inspect.
  21613. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21614. * @returns {Array} Returns the new duplicate free array.
  21615. * @example
  21616. *
  21617. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21618. * // => [2.1, 1.2]
  21619. *
  21620. * // The `_.property` iteratee shorthand.
  21621. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21622. * // => [{ 'x': 1 }, { 'x': 2 }]
  21623. */
  21624. function uniqBy(array, iteratee) {
  21625. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21626. }
  21627. /**
  21628. * This method is like `_.uniq` except that it accepts `comparator` which
  21629. * is invoked to compare elements of `array`. The order of result values is
  21630. * determined by the order they occur in the array.The comparator is invoked
  21631. * with two arguments: (arrVal, othVal).
  21632. *
  21633. * @static
  21634. * @memberOf _
  21635. * @since 4.0.0
  21636. * @category Array
  21637. * @param {Array} array The array to inspect.
  21638. * @param {Function} [comparator] The comparator invoked per element.
  21639. * @returns {Array} Returns the new duplicate free array.
  21640. * @example
  21641. *
  21642. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21643. *
  21644. * _.uniqWith(objects, _.isEqual);
  21645. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21646. */
  21647. function uniqWith(array, comparator) {
  21648. comparator = typeof comparator == 'function' ? comparator : undefined;
  21649. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21650. }
  21651. /**
  21652. * This method is like `_.zip` except that it accepts an array of grouped
  21653. * elements and creates an array regrouping the elements to their pre-zip
  21654. * configuration.
  21655. *
  21656. * @static
  21657. * @memberOf _
  21658. * @since 1.2.0
  21659. * @category Array
  21660. * @param {Array} array The array of grouped elements to process.
  21661. * @returns {Array} Returns the new array of regrouped elements.
  21662. * @example
  21663. *
  21664. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21665. * // => [['a', 1, true], ['b', 2, false]]
  21666. *
  21667. * _.unzip(zipped);
  21668. * // => [['a', 'b'], [1, 2], [true, false]]
  21669. */
  21670. function unzip(array) {
  21671. if (!(array && array.length)) {
  21672. return [];
  21673. }
  21674. var length = 0;
  21675. array = arrayFilter(array, function(group) {
  21676. if (isArrayLikeObject(group)) {
  21677. length = nativeMax(group.length, length);
  21678. return true;
  21679. }
  21680. });
  21681. return baseTimes(length, function(index) {
  21682. return arrayMap(array, baseProperty(index));
  21683. });
  21684. }
  21685. /**
  21686. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21687. * how regrouped values should be combined. The iteratee is invoked with the
  21688. * elements of each group: (...group).
  21689. *
  21690. * @static
  21691. * @memberOf _
  21692. * @since 3.8.0
  21693. * @category Array
  21694. * @param {Array} array The array of grouped elements to process.
  21695. * @param {Function} [iteratee=_.identity] The function to combine
  21696. * regrouped values.
  21697. * @returns {Array} Returns the new array of regrouped elements.
  21698. * @example
  21699. *
  21700. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21701. * // => [[1, 10, 100], [2, 20, 200]]
  21702. *
  21703. * _.unzipWith(zipped, _.add);
  21704. * // => [3, 30, 300]
  21705. */
  21706. function unzipWith(array, iteratee) {
  21707. if (!(array && array.length)) {
  21708. return [];
  21709. }
  21710. var result = unzip(array);
  21711. if (iteratee == null) {
  21712. return result;
  21713. }
  21714. return arrayMap(result, function(group) {
  21715. return apply(iteratee, undefined, group);
  21716. });
  21717. }
  21718. /**
  21719. * Creates an array excluding all given values using
  21720. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21721. * for equality comparisons.
  21722. *
  21723. * **Note:** Unlike `_.pull`, this method returns a new array.
  21724. *
  21725. * @static
  21726. * @memberOf _
  21727. * @since 0.1.0
  21728. * @category Array
  21729. * @param {Array} array The array to inspect.
  21730. * @param {...*} [values] The values to exclude.
  21731. * @returns {Array} Returns the new array of filtered values.
  21732. * @see _.difference, _.xor
  21733. * @example
  21734. *
  21735. * _.without([2, 1, 2, 3], 1, 2);
  21736. * // => [3]
  21737. */
  21738. var without = baseRest(function(array, values) {
  21739. return isArrayLikeObject(array)
  21740. ? baseDifference(array, values)
  21741. : [];
  21742. });
  21743. /**
  21744. * Creates an array of unique values that is the
  21745. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21746. * of the given arrays. The order of result values is determined by the order
  21747. * they occur in the arrays.
  21748. *
  21749. * @static
  21750. * @memberOf _
  21751. * @since 2.4.0
  21752. * @category Array
  21753. * @param {...Array} [arrays] The arrays to inspect.
  21754. * @returns {Array} Returns the new array of filtered values.
  21755. * @see _.difference, _.without
  21756. * @example
  21757. *
  21758. * _.xor([2, 1], [2, 3]);
  21759. * // => [1, 3]
  21760. */
  21761. var xor = baseRest(function(arrays) {
  21762. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21763. });
  21764. /**
  21765. * This method is like `_.xor` except that it accepts `iteratee` which is
  21766. * invoked for each element of each `arrays` to generate the criterion by
  21767. * which by which they're compared. The order of result values is determined
  21768. * by the order they occur in the arrays. The iteratee is invoked with one
  21769. * argument: (value).
  21770. *
  21771. * @static
  21772. * @memberOf _
  21773. * @since 4.0.0
  21774. * @category Array
  21775. * @param {...Array} [arrays] The arrays to inspect.
  21776. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21777. * @returns {Array} Returns the new array of filtered values.
  21778. * @example
  21779. *
  21780. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21781. * // => [1.2, 3.4]
  21782. *
  21783. * // The `_.property` iteratee shorthand.
  21784. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21785. * // => [{ 'x': 2 }]
  21786. */
  21787. var xorBy = baseRest(function(arrays) {
  21788. var iteratee = last(arrays);
  21789. if (isArrayLikeObject(iteratee)) {
  21790. iteratee = undefined;
  21791. }
  21792. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21793. });
  21794. /**
  21795. * This method is like `_.xor` except that it accepts `comparator` which is
  21796. * invoked to compare elements of `arrays`. The order of result values is
  21797. * determined by the order they occur in the arrays. The comparator is invoked
  21798. * with two arguments: (arrVal, othVal).
  21799. *
  21800. * @static
  21801. * @memberOf _
  21802. * @since 4.0.0
  21803. * @category Array
  21804. * @param {...Array} [arrays] The arrays to inspect.
  21805. * @param {Function} [comparator] The comparator invoked per element.
  21806. * @returns {Array} Returns the new array of filtered values.
  21807. * @example
  21808. *
  21809. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21810. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21811. *
  21812. * _.xorWith(objects, others, _.isEqual);
  21813. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21814. */
  21815. var xorWith = baseRest(function(arrays) {
  21816. var comparator = last(arrays);
  21817. comparator = typeof comparator == 'function' ? comparator : undefined;
  21818. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21819. });
  21820. /**
  21821. * Creates an array of grouped elements, the first of which contains the
  21822. * first elements of the given arrays, the second of which contains the
  21823. * second elements of the given arrays, and so on.
  21824. *
  21825. * @static
  21826. * @memberOf _
  21827. * @since 0.1.0
  21828. * @category Array
  21829. * @param {...Array} [arrays] The arrays to process.
  21830. * @returns {Array} Returns the new array of grouped elements.
  21831. * @example
  21832. *
  21833. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21834. * // => [['a', 1, true], ['b', 2, false]]
  21835. */
  21836. var zip = baseRest(unzip);
  21837. /**
  21838. * This method is like `_.fromPairs` except that it accepts two arrays,
  21839. * one of property identifiers and one of corresponding values.
  21840. *
  21841. * @static
  21842. * @memberOf _
  21843. * @since 0.4.0
  21844. * @category Array
  21845. * @param {Array} [props=[]] The property identifiers.
  21846. * @param {Array} [values=[]] The property values.
  21847. * @returns {Object} Returns the new object.
  21848. * @example
  21849. *
  21850. * _.zipObject(['a', 'b'], [1, 2]);
  21851. * // => { 'a': 1, 'b': 2 }
  21852. */
  21853. function zipObject(props, values) {
  21854. return baseZipObject(props || [], values || [], assignValue);
  21855. }
  21856. /**
  21857. * This method is like `_.zipObject` except that it supports property paths.
  21858. *
  21859. * @static
  21860. * @memberOf _
  21861. * @since 4.1.0
  21862. * @category Array
  21863. * @param {Array} [props=[]] The property identifiers.
  21864. * @param {Array} [values=[]] The property values.
  21865. * @returns {Object} Returns the new object.
  21866. * @example
  21867. *
  21868. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  21869. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  21870. */
  21871. function zipObjectDeep(props, values) {
  21872. return baseZipObject(props || [], values || [], baseSet);
  21873. }
  21874. /**
  21875. * This method is like `_.zip` except that it accepts `iteratee` to specify
  21876. * how grouped values should be combined. The iteratee is invoked with the
  21877. * elements of each group: (...group).
  21878. *
  21879. * @static
  21880. * @memberOf _
  21881. * @since 3.8.0
  21882. * @category Array
  21883. * @param {...Array} [arrays] The arrays to process.
  21884. * @param {Function} [iteratee=_.identity] The function to combine
  21885. * grouped values.
  21886. * @returns {Array} Returns the new array of grouped elements.
  21887. * @example
  21888. *
  21889. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  21890. * return a + b + c;
  21891. * });
  21892. * // => [111, 222]
  21893. */
  21894. var zipWith = baseRest(function(arrays) {
  21895. var length = arrays.length,
  21896. iteratee = length > 1 ? arrays[length - 1] : undefined;
  21897. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  21898. return unzipWith(arrays, iteratee);
  21899. });
  21900. /*------------------------------------------------------------------------*/
  21901. /**
  21902. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  21903. * chain sequences enabled. The result of such sequences must be unwrapped
  21904. * with `_#value`.
  21905. *
  21906. * @static
  21907. * @memberOf _
  21908. * @since 1.3.0
  21909. * @category Seq
  21910. * @param {*} value The value to wrap.
  21911. * @returns {Object} Returns the new `lodash` wrapper instance.
  21912. * @example
  21913. *
  21914. * var users = [
  21915. * { 'user': 'barney', 'age': 36 },
  21916. * { 'user': 'fred', 'age': 40 },
  21917. * { 'user': 'pebbles', 'age': 1 }
  21918. * ];
  21919. *
  21920. * var youngest = _
  21921. * .chain(users)
  21922. * .sortBy('age')
  21923. * .map(function(o) {
  21924. * return o.user + ' is ' + o.age;
  21925. * })
  21926. * .head()
  21927. * .value();
  21928. * // => 'pebbles is 1'
  21929. */
  21930. function chain(value) {
  21931. var result = lodash(value);
  21932. result.__chain__ = true;
  21933. return result;
  21934. }
  21935. /**
  21936. * This method invokes `interceptor` and returns `value`. The interceptor
  21937. * is invoked with one argument; (value). The purpose of this method is to
  21938. * "tap into" a method chain sequence in order to modify intermediate results.
  21939. *
  21940. * @static
  21941. * @memberOf _
  21942. * @since 0.1.0
  21943. * @category Seq
  21944. * @param {*} value The value to provide to `interceptor`.
  21945. * @param {Function} interceptor The function to invoke.
  21946. * @returns {*} Returns `value`.
  21947. * @example
  21948. *
  21949. * _([1, 2, 3])
  21950. * .tap(function(array) {
  21951. * // Mutate input array.
  21952. * array.pop();
  21953. * })
  21954. * .reverse()
  21955. * .value();
  21956. * // => [2, 1]
  21957. */
  21958. function tap(value, interceptor) {
  21959. interceptor(value);
  21960. return value;
  21961. }
  21962. /**
  21963. * This method is like `_.tap` except that it returns the result of `interceptor`.
  21964. * The purpose of this method is to "pass thru" values replacing intermediate
  21965. * results in a method chain sequence.
  21966. *
  21967. * @static
  21968. * @memberOf _
  21969. * @since 3.0.0
  21970. * @category Seq
  21971. * @param {*} value The value to provide to `interceptor`.
  21972. * @param {Function} interceptor The function to invoke.
  21973. * @returns {*} Returns the result of `interceptor`.
  21974. * @example
  21975. *
  21976. * _(' abc ')
  21977. * .chain()
  21978. * .trim()
  21979. * .thru(function(value) {
  21980. * return [value];
  21981. * })
  21982. * .value();
  21983. * // => ['abc']
  21984. */
  21985. function thru(value, interceptor) {
  21986. return interceptor(value);
  21987. }
  21988. /**
  21989. * This method is the wrapper version of `_.at`.
  21990. *
  21991. * @name at
  21992. * @memberOf _
  21993. * @since 1.0.0
  21994. * @category Seq
  21995. * @param {...(string|string[])} [paths] The property paths to pick.
  21996. * @returns {Object} Returns the new `lodash` wrapper instance.
  21997. * @example
  21998. *
  21999. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  22000. *
  22001. * _(object).at(['a[0].b.c', 'a[1]']).value();
  22002. * // => [3, 4]
  22003. */
  22004. var wrapperAt = flatRest(function(paths) {
  22005. var length = paths.length,
  22006. start = length ? paths[0] : 0,
  22007. value = this.__wrapped__,
  22008. interceptor = function(object) { return baseAt(object, paths); };
  22009. if (length > 1 || this.__actions__.length ||
  22010. !(value instanceof LazyWrapper) || !isIndex(start)) {
  22011. return this.thru(interceptor);
  22012. }
  22013. value = value.slice(start, +start + (length ? 1 : 0));
  22014. value.__actions__.push({
  22015. 'func': thru,
  22016. 'args': [interceptor],
  22017. 'thisArg': undefined
  22018. });
  22019. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  22020. if (length && !array.length) {
  22021. array.push(undefined);
  22022. }
  22023. return array;
  22024. });
  22025. });
  22026. /**
  22027. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  22028. *
  22029. * @name chain
  22030. * @memberOf _
  22031. * @since 0.1.0
  22032. * @category Seq
  22033. * @returns {Object} Returns the new `lodash` wrapper instance.
  22034. * @example
  22035. *
  22036. * var users = [
  22037. * { 'user': 'barney', 'age': 36 },
  22038. * { 'user': 'fred', 'age': 40 }
  22039. * ];
  22040. *
  22041. * // A sequence without explicit chaining.
  22042. * _(users).head();
  22043. * // => { 'user': 'barney', 'age': 36 }
  22044. *
  22045. * // A sequence with explicit chaining.
  22046. * _(users)
  22047. * .chain()
  22048. * .head()
  22049. * .pick('user')
  22050. * .value();
  22051. * // => { 'user': 'barney' }
  22052. */
  22053. function wrapperChain() {
  22054. return chain(this);
  22055. }
  22056. /**
  22057. * Executes the chain sequence and returns the wrapped result.
  22058. *
  22059. * @name commit
  22060. * @memberOf _
  22061. * @since 3.2.0
  22062. * @category Seq
  22063. * @returns {Object} Returns the new `lodash` wrapper instance.
  22064. * @example
  22065. *
  22066. * var array = [1, 2];
  22067. * var wrapped = _(array).push(3);
  22068. *
  22069. * console.log(array);
  22070. * // => [1, 2]
  22071. *
  22072. * wrapped = wrapped.commit();
  22073. * console.log(array);
  22074. * // => [1, 2, 3]
  22075. *
  22076. * wrapped.last();
  22077. * // => 3
  22078. *
  22079. * console.log(array);
  22080. * // => [1, 2, 3]
  22081. */
  22082. function wrapperCommit() {
  22083. return new LodashWrapper(this.value(), this.__chain__);
  22084. }
  22085. /**
  22086. * Gets the next value on a wrapped object following the
  22087. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  22088. *
  22089. * @name next
  22090. * @memberOf _
  22091. * @since 4.0.0
  22092. * @category Seq
  22093. * @returns {Object} Returns the next iterator value.
  22094. * @example
  22095. *
  22096. * var wrapped = _([1, 2]);
  22097. *
  22098. * wrapped.next();
  22099. * // => { 'done': false, 'value': 1 }
  22100. *
  22101. * wrapped.next();
  22102. * // => { 'done': false, 'value': 2 }
  22103. *
  22104. * wrapped.next();
  22105. * // => { 'done': true, 'value': undefined }
  22106. */
  22107. function wrapperNext() {
  22108. if (this.__values__ === undefined) {
  22109. this.__values__ = toArray(this.value());
  22110. }
  22111. var done = this.__index__ >= this.__values__.length,
  22112. value = done ? undefined : this.__values__[this.__index__++];
  22113. return { 'done': done, 'value': value };
  22114. }
  22115. /**
  22116. * Enables the wrapper to be iterable.
  22117. *
  22118. * @name Symbol.iterator
  22119. * @memberOf _
  22120. * @since 4.0.0
  22121. * @category Seq
  22122. * @returns {Object} Returns the wrapper object.
  22123. * @example
  22124. *
  22125. * var wrapped = _([1, 2]);
  22126. *
  22127. * wrapped[Symbol.iterator]() === wrapped;
  22128. * // => true
  22129. *
  22130. * Array.from(wrapped);
  22131. * // => [1, 2]
  22132. */
  22133. function wrapperToIterator() {
  22134. return this;
  22135. }
  22136. /**
  22137. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  22138. *
  22139. * @name plant
  22140. * @memberOf _
  22141. * @since 3.2.0
  22142. * @category Seq
  22143. * @param {*} value The value to plant.
  22144. * @returns {Object} Returns the new `lodash` wrapper instance.
  22145. * @example
  22146. *
  22147. * function square(n) {
  22148. * return n * n;
  22149. * }
  22150. *
  22151. * var wrapped = _([1, 2]).map(square);
  22152. * var other = wrapped.plant([3, 4]);
  22153. *
  22154. * other.value();
  22155. * // => [9, 16]
  22156. *
  22157. * wrapped.value();
  22158. * // => [1, 4]
  22159. */
  22160. function wrapperPlant(value) {
  22161. var result,
  22162. parent = this;
  22163. while (parent instanceof baseLodash) {
  22164. var clone = wrapperClone(parent);
  22165. clone.__index__ = 0;
  22166. clone.__values__ = undefined;
  22167. if (result) {
  22168. previous.__wrapped__ = clone;
  22169. } else {
  22170. result = clone;
  22171. }
  22172. var previous = clone;
  22173. parent = parent.__wrapped__;
  22174. }
  22175. previous.__wrapped__ = value;
  22176. return result;
  22177. }
  22178. /**
  22179. * This method is the wrapper version of `_.reverse`.
  22180. *
  22181. * **Note:** This method mutates the wrapped array.
  22182. *
  22183. * @name reverse
  22184. * @memberOf _
  22185. * @since 0.1.0
  22186. * @category Seq
  22187. * @returns {Object} Returns the new `lodash` wrapper instance.
  22188. * @example
  22189. *
  22190. * var array = [1, 2, 3];
  22191. *
  22192. * _(array).reverse().value()
  22193. * // => [3, 2, 1]
  22194. *
  22195. * console.log(array);
  22196. * // => [3, 2, 1]
  22197. */
  22198. function wrapperReverse() {
  22199. var value = this.__wrapped__;
  22200. if (value instanceof LazyWrapper) {
  22201. var wrapped = value;
  22202. if (this.__actions__.length) {
  22203. wrapped = new LazyWrapper(this);
  22204. }
  22205. wrapped = wrapped.reverse();
  22206. wrapped.__actions__.push({
  22207. 'func': thru,
  22208. 'args': [reverse],
  22209. 'thisArg': undefined
  22210. });
  22211. return new LodashWrapper(wrapped, this.__chain__);
  22212. }
  22213. return this.thru(reverse);
  22214. }
  22215. /**
  22216. * Executes the chain sequence to resolve the unwrapped value.
  22217. *
  22218. * @name value
  22219. * @memberOf _
  22220. * @since 0.1.0
  22221. * @alias toJSON, valueOf
  22222. * @category Seq
  22223. * @returns {*} Returns the resolved unwrapped value.
  22224. * @example
  22225. *
  22226. * _([1, 2, 3]).value();
  22227. * // => [1, 2, 3]
  22228. */
  22229. function wrapperValue() {
  22230. return baseWrapperValue(this.__wrapped__, this.__actions__);
  22231. }
  22232. /*------------------------------------------------------------------------*/
  22233. /**
  22234. * Creates an object composed of keys generated from the results of running
  22235. * each element of `collection` thru `iteratee`. The corresponding value of
  22236. * each key is the number of times the key was returned by `iteratee`. The
  22237. * iteratee is invoked with one argument: (value).
  22238. *
  22239. * @static
  22240. * @memberOf _
  22241. * @since 0.5.0
  22242. * @category Collection
  22243. * @param {Array|Object} collection The collection to iterate over.
  22244. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22245. * @returns {Object} Returns the composed aggregate object.
  22246. * @example
  22247. *
  22248. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  22249. * // => { '4': 1, '6': 2 }
  22250. *
  22251. * // The `_.property` iteratee shorthand.
  22252. * _.countBy(['one', 'two', 'three'], 'length');
  22253. * // => { '3': 2, '5': 1 }
  22254. */
  22255. var countBy = createAggregator(function(result, value, key) {
  22256. if (hasOwnProperty.call(result, key)) {
  22257. ++result[key];
  22258. } else {
  22259. baseAssignValue(result, key, 1);
  22260. }
  22261. });
  22262. /**
  22263. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  22264. * Iteration is stopped once `predicate` returns falsey. The predicate is
  22265. * invoked with three arguments: (value, index|key, collection).
  22266. *
  22267. * **Note:** This method returns `true` for
  22268. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  22269. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  22270. * elements of empty collections.
  22271. *
  22272. * @static
  22273. * @memberOf _
  22274. * @since 0.1.0
  22275. * @category Collection
  22276. * @param {Array|Object} collection The collection to iterate over.
  22277. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22278. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22279. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  22280. * else `false`.
  22281. * @example
  22282. *
  22283. * _.every([true, 1, null, 'yes'], Boolean);
  22284. * // => false
  22285. *
  22286. * var users = [
  22287. * { 'user': 'barney', 'age': 36, 'active': false },
  22288. * { 'user': 'fred', 'age': 40, 'active': false }
  22289. * ];
  22290. *
  22291. * // The `_.matches` iteratee shorthand.
  22292. * _.every(users, { 'user': 'barney', 'active': false });
  22293. * // => false
  22294. *
  22295. * // The `_.matchesProperty` iteratee shorthand.
  22296. * _.every(users, ['active', false]);
  22297. * // => true
  22298. *
  22299. * // The `_.property` iteratee shorthand.
  22300. * _.every(users, 'active');
  22301. * // => false
  22302. */
  22303. function every(collection, predicate, guard) {
  22304. var func = isArray(collection) ? arrayEvery : baseEvery;
  22305. if (guard && isIterateeCall(collection, predicate, guard)) {
  22306. predicate = undefined;
  22307. }
  22308. return func(collection, getIteratee(predicate, 3));
  22309. }
  22310. /**
  22311. * Iterates over elements of `collection`, returning an array of all elements
  22312. * `predicate` returns truthy for. The predicate is invoked with three
  22313. * arguments: (value, index|key, collection).
  22314. *
  22315. * **Note:** Unlike `_.remove`, this method returns a new array.
  22316. *
  22317. * @static
  22318. * @memberOf _
  22319. * @since 0.1.0
  22320. * @category Collection
  22321. * @param {Array|Object} collection The collection to iterate over.
  22322. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22323. * @returns {Array} Returns the new filtered array.
  22324. * @see _.reject
  22325. * @example
  22326. *
  22327. * var users = [
  22328. * { 'user': 'barney', 'age': 36, 'active': true },
  22329. * { 'user': 'fred', 'age': 40, 'active': false }
  22330. * ];
  22331. *
  22332. * _.filter(users, function(o) { return !o.active; });
  22333. * // => objects for ['fred']
  22334. *
  22335. * // The `_.matches` iteratee shorthand.
  22336. * _.filter(users, { 'age': 36, 'active': true });
  22337. * // => objects for ['barney']
  22338. *
  22339. * // The `_.matchesProperty` iteratee shorthand.
  22340. * _.filter(users, ['active', false]);
  22341. * // => objects for ['fred']
  22342. *
  22343. * // The `_.property` iteratee shorthand.
  22344. * _.filter(users, 'active');
  22345. * // => objects for ['barney']
  22346. */
  22347. function filter(collection, predicate) {
  22348. var func = isArray(collection) ? arrayFilter : baseFilter;
  22349. return func(collection, getIteratee(predicate, 3));
  22350. }
  22351. /**
  22352. * Iterates over elements of `collection`, returning the first element
  22353. * `predicate` returns truthy for. The predicate is invoked with three
  22354. * arguments: (value, index|key, collection).
  22355. *
  22356. * @static
  22357. * @memberOf _
  22358. * @since 0.1.0
  22359. * @category Collection
  22360. * @param {Array|Object} collection The collection to inspect.
  22361. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22362. * @param {number} [fromIndex=0] The index to search from.
  22363. * @returns {*} Returns the matched element, else `undefined`.
  22364. * @example
  22365. *
  22366. * var users = [
  22367. * { 'user': 'barney', 'age': 36, 'active': true },
  22368. * { 'user': 'fred', 'age': 40, 'active': false },
  22369. * { 'user': 'pebbles', 'age': 1, 'active': true }
  22370. * ];
  22371. *
  22372. * _.find(users, function(o) { return o.age < 40; });
  22373. * // => object for 'barney'
  22374. *
  22375. * // The `_.matches` iteratee shorthand.
  22376. * _.find(users, { 'age': 1, 'active': true });
  22377. * // => object for 'pebbles'
  22378. *
  22379. * // The `_.matchesProperty` iteratee shorthand.
  22380. * _.find(users, ['active', false]);
  22381. * // => object for 'fred'
  22382. *
  22383. * // The `_.property` iteratee shorthand.
  22384. * _.find(users, 'active');
  22385. * // => object for 'barney'
  22386. */
  22387. var find = createFind(findIndex);
  22388. /**
  22389. * This method is like `_.find` except that it iterates over elements of
  22390. * `collection` from right to left.
  22391. *
  22392. * @static
  22393. * @memberOf _
  22394. * @since 2.0.0
  22395. * @category Collection
  22396. * @param {Array|Object} collection The collection to inspect.
  22397. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22398. * @param {number} [fromIndex=collection.length-1] The index to search from.
  22399. * @returns {*} Returns the matched element, else `undefined`.
  22400. * @example
  22401. *
  22402. * _.findLast([1, 2, 3, 4], function(n) {
  22403. * return n % 2 == 1;
  22404. * });
  22405. * // => 3
  22406. */
  22407. var findLast = createFind(findLastIndex);
  22408. /**
  22409. * Creates a flattened array of values by running each element in `collection`
  22410. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  22411. * with three arguments: (value, index|key, collection).
  22412. *
  22413. * @static
  22414. * @memberOf _
  22415. * @since 4.0.0
  22416. * @category Collection
  22417. * @param {Array|Object} collection The collection to iterate over.
  22418. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22419. * @returns {Array} Returns the new flattened array.
  22420. * @example
  22421. *
  22422. * function duplicate(n) {
  22423. * return [n, n];
  22424. * }
  22425. *
  22426. * _.flatMap([1, 2], duplicate);
  22427. * // => [1, 1, 2, 2]
  22428. */
  22429. function flatMap(collection, iteratee) {
  22430. return baseFlatten(map(collection, iteratee), 1);
  22431. }
  22432. /**
  22433. * This method is like `_.flatMap` except that it recursively flattens the
  22434. * mapped results.
  22435. *
  22436. * @static
  22437. * @memberOf _
  22438. * @since 4.7.0
  22439. * @category Collection
  22440. * @param {Array|Object} collection The collection to iterate over.
  22441. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22442. * @returns {Array} Returns the new flattened array.
  22443. * @example
  22444. *
  22445. * function duplicate(n) {
  22446. * return [[[n, n]]];
  22447. * }
  22448. *
  22449. * _.flatMapDeep([1, 2], duplicate);
  22450. * // => [1, 1, 2, 2]
  22451. */
  22452. function flatMapDeep(collection, iteratee) {
  22453. return baseFlatten(map(collection, iteratee), INFINITY);
  22454. }
  22455. /**
  22456. * This method is like `_.flatMap` except that it recursively flattens the
  22457. * mapped results up to `depth` times.
  22458. *
  22459. * @static
  22460. * @memberOf _
  22461. * @since 4.7.0
  22462. * @category Collection
  22463. * @param {Array|Object} collection The collection to iterate over.
  22464. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22465. * @param {number} [depth=1] The maximum recursion depth.
  22466. * @returns {Array} Returns the new flattened array.
  22467. * @example
  22468. *
  22469. * function duplicate(n) {
  22470. * return [[[n, n]]];
  22471. * }
  22472. *
  22473. * _.flatMapDepth([1, 2], duplicate, 2);
  22474. * // => [[1, 1], [2, 2]]
  22475. */
  22476. function flatMapDepth(collection, iteratee, depth) {
  22477. depth = depth === undefined ? 1 : toInteger(depth);
  22478. return baseFlatten(map(collection, iteratee), depth);
  22479. }
  22480. /**
  22481. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22482. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22483. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22484. *
  22485. * **Note:** As with other "Collections" methods, objects with a "length"
  22486. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22487. * or `_.forOwn` for object iteration.
  22488. *
  22489. * @static
  22490. * @memberOf _
  22491. * @since 0.1.0
  22492. * @alias each
  22493. * @category Collection
  22494. * @param {Array|Object} collection The collection to iterate over.
  22495. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22496. * @returns {Array|Object} Returns `collection`.
  22497. * @see _.forEachRight
  22498. * @example
  22499. *
  22500. * _.forEach([1, 2], function(value) {
  22501. * console.log(value);
  22502. * });
  22503. * // => Logs `1` then `2`.
  22504. *
  22505. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22506. * console.log(key);
  22507. * });
  22508. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22509. */
  22510. function forEach(collection, iteratee) {
  22511. var func = isArray(collection) ? arrayEach : baseEach;
  22512. return func(collection, getIteratee(iteratee, 3));
  22513. }
  22514. /**
  22515. * This method is like `_.forEach` except that it iterates over elements of
  22516. * `collection` from right to left.
  22517. *
  22518. * @static
  22519. * @memberOf _
  22520. * @since 2.0.0
  22521. * @alias eachRight
  22522. * @category Collection
  22523. * @param {Array|Object} collection The collection to iterate over.
  22524. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22525. * @returns {Array|Object} Returns `collection`.
  22526. * @see _.forEach
  22527. * @example
  22528. *
  22529. * _.forEachRight([1, 2], function(value) {
  22530. * console.log(value);
  22531. * });
  22532. * // => Logs `2` then `1`.
  22533. */
  22534. function forEachRight(collection, iteratee) {
  22535. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22536. return func(collection, getIteratee(iteratee, 3));
  22537. }
  22538. /**
  22539. * Creates an object composed of keys generated from the results of running
  22540. * each element of `collection` thru `iteratee`. The order of grouped values
  22541. * is determined by the order they occur in `collection`. The corresponding
  22542. * value of each key is an array of elements responsible for generating the
  22543. * key. The iteratee is invoked with one argument: (value).
  22544. *
  22545. * @static
  22546. * @memberOf _
  22547. * @since 0.1.0
  22548. * @category Collection
  22549. * @param {Array|Object} collection The collection to iterate over.
  22550. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22551. * @returns {Object} Returns the composed aggregate object.
  22552. * @example
  22553. *
  22554. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22555. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22556. *
  22557. * // The `_.property` iteratee shorthand.
  22558. * _.groupBy(['one', 'two', 'three'], 'length');
  22559. * // => { '3': ['one', 'two'], '5': ['three'] }
  22560. */
  22561. var groupBy = createAggregator(function(result, value, key) {
  22562. if (hasOwnProperty.call(result, key)) {
  22563. result[key].push(value);
  22564. } else {
  22565. baseAssignValue(result, key, [value]);
  22566. }
  22567. });
  22568. /**
  22569. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22570. * checked for a substring of `value`, otherwise
  22571. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22572. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22573. * the offset from the end of `collection`.
  22574. *
  22575. * @static
  22576. * @memberOf _
  22577. * @since 0.1.0
  22578. * @category Collection
  22579. * @param {Array|Object|string} collection The collection to inspect.
  22580. * @param {*} value The value to search for.
  22581. * @param {number} [fromIndex=0] The index to search from.
  22582. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22583. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22584. * @example
  22585. *
  22586. * _.includes([1, 2, 3], 1);
  22587. * // => true
  22588. *
  22589. * _.includes([1, 2, 3], 1, 2);
  22590. * // => false
  22591. *
  22592. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22593. * // => true
  22594. *
  22595. * _.includes('abcd', 'bc');
  22596. * // => true
  22597. */
  22598. function includes(collection, value, fromIndex, guard) {
  22599. collection = isArrayLike(collection) ? collection : values(collection);
  22600. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22601. var length = collection.length;
  22602. if (fromIndex < 0) {
  22603. fromIndex = nativeMax(length + fromIndex, 0);
  22604. }
  22605. return isString(collection)
  22606. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22607. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22608. }
  22609. /**
  22610. * Invokes the method at `path` of each element in `collection`, returning
  22611. * an array of the results of each invoked method. Any additional arguments
  22612. * are provided to each invoked method. If `path` is a function, it's invoked
  22613. * for, and `this` bound to, each element in `collection`.
  22614. *
  22615. * @static
  22616. * @memberOf _
  22617. * @since 4.0.0
  22618. * @category Collection
  22619. * @param {Array|Object} collection The collection to iterate over.
  22620. * @param {Array|Function|string} path The path of the method to invoke or
  22621. * the function invoked per iteration.
  22622. * @param {...*} [args] The arguments to invoke each method with.
  22623. * @returns {Array} Returns the array of results.
  22624. * @example
  22625. *
  22626. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22627. * // => [[1, 5, 7], [1, 2, 3]]
  22628. *
  22629. * _.invokeMap([123, 456], String.prototype.split, '');
  22630. * // => [['1', '2', '3'], ['4', '5', '6']]
  22631. */
  22632. var invokeMap = baseRest(function(collection, path, args) {
  22633. var index = -1,
  22634. isFunc = typeof path == 'function',
  22635. result = isArrayLike(collection) ? Array(collection.length) : [];
  22636. baseEach(collection, function(value) {
  22637. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22638. });
  22639. return result;
  22640. });
  22641. /**
  22642. * Creates an object composed of keys generated from the results of running
  22643. * each element of `collection` thru `iteratee`. The corresponding value of
  22644. * each key is the last element responsible for generating the key. The
  22645. * iteratee is invoked with one argument: (value).
  22646. *
  22647. * @static
  22648. * @memberOf _
  22649. * @since 4.0.0
  22650. * @category Collection
  22651. * @param {Array|Object} collection The collection to iterate over.
  22652. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22653. * @returns {Object} Returns the composed aggregate object.
  22654. * @example
  22655. *
  22656. * var array = [
  22657. * { 'dir': 'left', 'code': 97 },
  22658. * { 'dir': 'right', 'code': 100 }
  22659. * ];
  22660. *
  22661. * _.keyBy(array, function(o) {
  22662. * return String.fromCharCode(o.code);
  22663. * });
  22664. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22665. *
  22666. * _.keyBy(array, 'dir');
  22667. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22668. */
  22669. var keyBy = createAggregator(function(result, value, key) {
  22670. baseAssignValue(result, key, value);
  22671. });
  22672. /**
  22673. * Creates an array of values by running each element in `collection` thru
  22674. * `iteratee`. The iteratee is invoked with three arguments:
  22675. * (value, index|key, collection).
  22676. *
  22677. * Many lodash methods are guarded to work as iteratees for methods like
  22678. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22679. *
  22680. * The guarded methods are:
  22681. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22682. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22683. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22684. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22685. *
  22686. * @static
  22687. * @memberOf _
  22688. * @since 0.1.0
  22689. * @category Collection
  22690. * @param {Array|Object} collection The collection to iterate over.
  22691. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22692. * @returns {Array} Returns the new mapped array.
  22693. * @example
  22694. *
  22695. * function square(n) {
  22696. * return n * n;
  22697. * }
  22698. *
  22699. * _.map([4, 8], square);
  22700. * // => [16, 64]
  22701. *
  22702. * _.map({ 'a': 4, 'b': 8 }, square);
  22703. * // => [16, 64] (iteration order is not guaranteed)
  22704. *
  22705. * var users = [
  22706. * { 'user': 'barney' },
  22707. * { 'user': 'fred' }
  22708. * ];
  22709. *
  22710. * // The `_.property` iteratee shorthand.
  22711. * _.map(users, 'user');
  22712. * // => ['barney', 'fred']
  22713. */
  22714. function map(collection, iteratee) {
  22715. var func = isArray(collection) ? arrayMap : baseMap;
  22716. return func(collection, getIteratee(iteratee, 3));
  22717. }
  22718. /**
  22719. * This method is like `_.sortBy` except that it allows specifying the sort
  22720. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22721. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22722. * descending or "asc" for ascending sort order of corresponding values.
  22723. *
  22724. * @static
  22725. * @memberOf _
  22726. * @since 4.0.0
  22727. * @category Collection
  22728. * @param {Array|Object} collection The collection to iterate over.
  22729. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22730. * The iteratees to sort by.
  22731. * @param {string[]} [orders] The sort orders of `iteratees`.
  22732. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22733. * @returns {Array} Returns the new sorted array.
  22734. * @example
  22735. *
  22736. * var users = [
  22737. * { 'user': 'fred', 'age': 48 },
  22738. * { 'user': 'barney', 'age': 34 },
  22739. * { 'user': 'fred', 'age': 40 },
  22740. * { 'user': 'barney', 'age': 36 }
  22741. * ];
  22742. *
  22743. * // Sort by `user` in ascending order and by `age` in descending order.
  22744. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22745. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22746. */
  22747. function orderBy(collection, iteratees, orders, guard) {
  22748. if (collection == null) {
  22749. return [];
  22750. }
  22751. if (!isArray(iteratees)) {
  22752. iteratees = iteratees == null ? [] : [iteratees];
  22753. }
  22754. orders = guard ? undefined : orders;
  22755. if (!isArray(orders)) {
  22756. orders = orders == null ? [] : [orders];
  22757. }
  22758. return baseOrderBy(collection, iteratees, orders);
  22759. }
  22760. /**
  22761. * Creates an array of elements split into two groups, the first of which
  22762. * contains elements `predicate` returns truthy for, the second of which
  22763. * contains elements `predicate` returns falsey for. The predicate is
  22764. * invoked with one argument: (value).
  22765. *
  22766. * @static
  22767. * @memberOf _
  22768. * @since 3.0.0
  22769. * @category Collection
  22770. * @param {Array|Object} collection The collection to iterate over.
  22771. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22772. * @returns {Array} Returns the array of grouped elements.
  22773. * @example
  22774. *
  22775. * var users = [
  22776. * { 'user': 'barney', 'age': 36, 'active': false },
  22777. * { 'user': 'fred', 'age': 40, 'active': true },
  22778. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22779. * ];
  22780. *
  22781. * _.partition(users, function(o) { return o.active; });
  22782. * // => objects for [['fred'], ['barney', 'pebbles']]
  22783. *
  22784. * // The `_.matches` iteratee shorthand.
  22785. * _.partition(users, { 'age': 1, 'active': false });
  22786. * // => objects for [['pebbles'], ['barney', 'fred']]
  22787. *
  22788. * // The `_.matchesProperty` iteratee shorthand.
  22789. * _.partition(users, ['active', false]);
  22790. * // => objects for [['barney', 'pebbles'], ['fred']]
  22791. *
  22792. * // The `_.property` iteratee shorthand.
  22793. * _.partition(users, 'active');
  22794. * // => objects for [['fred'], ['barney', 'pebbles']]
  22795. */
  22796. var partition = createAggregator(function(result, value, key) {
  22797. result[key ? 0 : 1].push(value);
  22798. }, function() { return [[], []]; });
  22799. /**
  22800. * Reduces `collection` to a value which is the accumulated result of running
  22801. * each element in `collection` thru `iteratee`, where each successive
  22802. * invocation is supplied the return value of the previous. If `accumulator`
  22803. * is not given, the first element of `collection` is used as the initial
  22804. * value. The iteratee is invoked with four arguments:
  22805. * (accumulator, value, index|key, collection).
  22806. *
  22807. * Many lodash methods are guarded to work as iteratees for methods like
  22808. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22809. *
  22810. * The guarded methods are:
  22811. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22812. * and `sortBy`
  22813. *
  22814. * @static
  22815. * @memberOf _
  22816. * @since 0.1.0
  22817. * @category Collection
  22818. * @param {Array|Object} collection The collection to iterate over.
  22819. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22820. * @param {*} [accumulator] The initial value.
  22821. * @returns {*} Returns the accumulated value.
  22822. * @see _.reduceRight
  22823. * @example
  22824. *
  22825. * _.reduce([1, 2], function(sum, n) {
  22826. * return sum + n;
  22827. * }, 0);
  22828. * // => 3
  22829. *
  22830. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22831. * (result[value] || (result[value] = [])).push(key);
  22832. * return result;
  22833. * }, {});
  22834. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22835. */
  22836. function reduce(collection, iteratee, accumulator) {
  22837. var func = isArray(collection) ? arrayReduce : baseReduce,
  22838. initAccum = arguments.length < 3;
  22839. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22840. }
  22841. /**
  22842. * This method is like `_.reduce` except that it iterates over elements of
  22843. * `collection` from right to left.
  22844. *
  22845. * @static
  22846. * @memberOf _
  22847. * @since 0.1.0
  22848. * @category Collection
  22849. * @param {Array|Object} collection The collection to iterate over.
  22850. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22851. * @param {*} [accumulator] The initial value.
  22852. * @returns {*} Returns the accumulated value.
  22853. * @see _.reduce
  22854. * @example
  22855. *
  22856. * var array = [[0, 1], [2, 3], [4, 5]];
  22857. *
  22858. * _.reduceRight(array, function(flattened, other) {
  22859. * return flattened.concat(other);
  22860. * }, []);
  22861. * // => [4, 5, 2, 3, 0, 1]
  22862. */
  22863. function reduceRight(collection, iteratee, accumulator) {
  22864. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  22865. initAccum = arguments.length < 3;
  22866. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  22867. }
  22868. /**
  22869. * The opposite of `_.filter`; this method returns the elements of `collection`
  22870. * that `predicate` does **not** return truthy for.
  22871. *
  22872. * @static
  22873. * @memberOf _
  22874. * @since 0.1.0
  22875. * @category Collection
  22876. * @param {Array|Object} collection The collection to iterate over.
  22877. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22878. * @returns {Array} Returns the new filtered array.
  22879. * @see _.filter
  22880. * @example
  22881. *
  22882. * var users = [
  22883. * { 'user': 'barney', 'age': 36, 'active': false },
  22884. * { 'user': 'fred', 'age': 40, 'active': true }
  22885. * ];
  22886. *
  22887. * _.reject(users, function(o) { return !o.active; });
  22888. * // => objects for ['fred']
  22889. *
  22890. * // The `_.matches` iteratee shorthand.
  22891. * _.reject(users, { 'age': 40, 'active': true });
  22892. * // => objects for ['barney']
  22893. *
  22894. * // The `_.matchesProperty` iteratee shorthand.
  22895. * _.reject(users, ['active', false]);
  22896. * // => objects for ['fred']
  22897. *
  22898. * // The `_.property` iteratee shorthand.
  22899. * _.reject(users, 'active');
  22900. * // => objects for ['barney']
  22901. */
  22902. function reject(collection, predicate) {
  22903. var func = isArray(collection) ? arrayFilter : baseFilter;
  22904. return func(collection, negate(getIteratee(predicate, 3)));
  22905. }
  22906. /**
  22907. * Gets a random element from `collection`.
  22908. *
  22909. * @static
  22910. * @memberOf _
  22911. * @since 2.0.0
  22912. * @category Collection
  22913. * @param {Array|Object} collection The collection to sample.
  22914. * @returns {*} Returns the random element.
  22915. * @example
  22916. *
  22917. * _.sample([1, 2, 3, 4]);
  22918. * // => 2
  22919. */
  22920. function sample(collection) {
  22921. var func = isArray(collection) ? arraySample : baseSample;
  22922. return func(collection);
  22923. }
  22924. /**
  22925. * Gets `n` random elements at unique keys from `collection` up to the
  22926. * size of `collection`.
  22927. *
  22928. * @static
  22929. * @memberOf _
  22930. * @since 4.0.0
  22931. * @category Collection
  22932. * @param {Array|Object} collection The collection to sample.
  22933. * @param {number} [n=1] The number of elements to sample.
  22934. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22935. * @returns {Array} Returns the random elements.
  22936. * @example
  22937. *
  22938. * _.sampleSize([1, 2, 3], 2);
  22939. * // => [3, 1]
  22940. *
  22941. * _.sampleSize([1, 2, 3], 4);
  22942. * // => [2, 3, 1]
  22943. */
  22944. function sampleSize(collection, n, guard) {
  22945. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  22946. n = 1;
  22947. } else {
  22948. n = toInteger(n);
  22949. }
  22950. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  22951. return func(collection, n);
  22952. }
  22953. /**
  22954. * Creates an array of shuffled values, using a version of the
  22955. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  22956. *
  22957. * @static
  22958. * @memberOf _
  22959. * @since 0.1.0
  22960. * @category Collection
  22961. * @param {Array|Object} collection The collection to shuffle.
  22962. * @returns {Array} Returns the new shuffled array.
  22963. * @example
  22964. *
  22965. * _.shuffle([1, 2, 3, 4]);
  22966. * // => [4, 1, 3, 2]
  22967. */
  22968. function shuffle(collection) {
  22969. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  22970. return func(collection);
  22971. }
  22972. /**
  22973. * Gets the size of `collection` by returning its length for array-like
  22974. * values or the number of own enumerable string keyed properties for objects.
  22975. *
  22976. * @static
  22977. * @memberOf _
  22978. * @since 0.1.0
  22979. * @category Collection
  22980. * @param {Array|Object|string} collection The collection to inspect.
  22981. * @returns {number} Returns the collection size.
  22982. * @example
  22983. *
  22984. * _.size([1, 2, 3]);
  22985. * // => 3
  22986. *
  22987. * _.size({ 'a': 1, 'b': 2 });
  22988. * // => 2
  22989. *
  22990. * _.size('pebbles');
  22991. * // => 7
  22992. */
  22993. function size(collection) {
  22994. if (collection == null) {
  22995. return 0;
  22996. }
  22997. if (isArrayLike(collection)) {
  22998. return isString(collection) ? stringSize(collection) : collection.length;
  22999. }
  23000. var tag = getTag(collection);
  23001. if (tag == mapTag || tag == setTag) {
  23002. return collection.size;
  23003. }
  23004. return baseKeys(collection).length;
  23005. }
  23006. /**
  23007. * Checks if `predicate` returns truthy for **any** element of `collection`.
  23008. * Iteration is stopped once `predicate` returns truthy. The predicate is
  23009. * invoked with three arguments: (value, index|key, collection).
  23010. *
  23011. * @static
  23012. * @memberOf _
  23013. * @since 0.1.0
  23014. * @category Collection
  23015. * @param {Array|Object} collection The collection to iterate over.
  23016. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23017. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23018. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23019. * else `false`.
  23020. * @example
  23021. *
  23022. * _.some([null, 0, 'yes', false], Boolean);
  23023. * // => true
  23024. *
  23025. * var users = [
  23026. * { 'user': 'barney', 'active': true },
  23027. * { 'user': 'fred', 'active': false }
  23028. * ];
  23029. *
  23030. * // The `_.matches` iteratee shorthand.
  23031. * _.some(users, { 'user': 'barney', 'active': false });
  23032. * // => false
  23033. *
  23034. * // The `_.matchesProperty` iteratee shorthand.
  23035. * _.some(users, ['active', false]);
  23036. * // => true
  23037. *
  23038. * // The `_.property` iteratee shorthand.
  23039. * _.some(users, 'active');
  23040. * // => true
  23041. */
  23042. function some(collection, predicate, guard) {
  23043. var func = isArray(collection) ? arraySome : baseSome;
  23044. if (guard && isIterateeCall(collection, predicate, guard)) {
  23045. predicate = undefined;
  23046. }
  23047. return func(collection, getIteratee(predicate, 3));
  23048. }
  23049. /**
  23050. * Creates an array of elements, sorted in ascending order by the results of
  23051. * running each element in a collection thru each iteratee. This method
  23052. * performs a stable sort, that is, it preserves the original sort order of
  23053. * equal elements. The iteratees are invoked with one argument: (value).
  23054. *
  23055. * @static
  23056. * @memberOf _
  23057. * @since 0.1.0
  23058. * @category Collection
  23059. * @param {Array|Object} collection The collection to iterate over.
  23060. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23061. * The iteratees to sort by.
  23062. * @returns {Array} Returns the new sorted array.
  23063. * @example
  23064. *
  23065. * var users = [
  23066. * { 'user': 'fred', 'age': 48 },
  23067. * { 'user': 'barney', 'age': 36 },
  23068. * { 'user': 'fred', 'age': 40 },
  23069. * { 'user': 'barney', 'age': 34 }
  23070. * ];
  23071. *
  23072. * _.sortBy(users, [function(o) { return o.user; }]);
  23073. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  23074. *
  23075. * _.sortBy(users, ['user', 'age']);
  23076. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  23077. */
  23078. var sortBy = baseRest(function(collection, iteratees) {
  23079. if (collection == null) {
  23080. return [];
  23081. }
  23082. var length = iteratees.length;
  23083. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  23084. iteratees = [];
  23085. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  23086. iteratees = [iteratees[0]];
  23087. }
  23088. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  23089. });
  23090. /*------------------------------------------------------------------------*/
  23091. /**
  23092. * Gets the timestamp of the number of milliseconds that have elapsed since
  23093. * the Unix epoch (1 January 1970 00:00:00 UTC).
  23094. *
  23095. * @static
  23096. * @memberOf _
  23097. * @since 2.4.0
  23098. * @category Date
  23099. * @returns {number} Returns the timestamp.
  23100. * @example
  23101. *
  23102. * _.defer(function(stamp) {
  23103. * console.log(_.now() - stamp);
  23104. * }, _.now());
  23105. * // => Logs the number of milliseconds it took for the deferred invocation.
  23106. */
  23107. var now = ctxNow || function() {
  23108. return root.Date.now();
  23109. };
  23110. /*------------------------------------------------------------------------*/
  23111. /**
  23112. * The opposite of `_.before`; this method creates a function that invokes
  23113. * `func` once it's called `n` or more times.
  23114. *
  23115. * @static
  23116. * @memberOf _
  23117. * @since 0.1.0
  23118. * @category Function
  23119. * @param {number} n The number of calls before `func` is invoked.
  23120. * @param {Function} func The function to restrict.
  23121. * @returns {Function} Returns the new restricted function.
  23122. * @example
  23123. *
  23124. * var saves = ['profile', 'settings'];
  23125. *
  23126. * var done = _.after(saves.length, function() {
  23127. * console.log('done saving!');
  23128. * });
  23129. *
  23130. * _.forEach(saves, function(type) {
  23131. * asyncSave({ 'type': type, 'complete': done });
  23132. * });
  23133. * // => Logs 'done saving!' after the two async saves have completed.
  23134. */
  23135. function after(n, func) {
  23136. if (typeof func != 'function') {
  23137. throw new TypeError(FUNC_ERROR_TEXT);
  23138. }
  23139. n = toInteger(n);
  23140. return function() {
  23141. if (--n < 1) {
  23142. return func.apply(this, arguments);
  23143. }
  23144. };
  23145. }
  23146. /**
  23147. * Creates a function that invokes `func`, with up to `n` arguments,
  23148. * ignoring any additional arguments.
  23149. *
  23150. * @static
  23151. * @memberOf _
  23152. * @since 3.0.0
  23153. * @category Function
  23154. * @param {Function} func The function to cap arguments for.
  23155. * @param {number} [n=func.length] The arity cap.
  23156. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23157. * @returns {Function} Returns the new capped function.
  23158. * @example
  23159. *
  23160. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  23161. * // => [6, 8, 10]
  23162. */
  23163. function ary(func, n, guard) {
  23164. n = guard ? undefined : n;
  23165. n = (func && n == null) ? func.length : n;
  23166. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  23167. }
  23168. /**
  23169. * Creates a function that invokes `func`, with the `this` binding and arguments
  23170. * of the created function, while it's called less than `n` times. Subsequent
  23171. * calls to the created function return the result of the last `func` invocation.
  23172. *
  23173. * @static
  23174. * @memberOf _
  23175. * @since 3.0.0
  23176. * @category Function
  23177. * @param {number} n The number of calls at which `func` is no longer invoked.
  23178. * @param {Function} func The function to restrict.
  23179. * @returns {Function} Returns the new restricted function.
  23180. * @example
  23181. *
  23182. * jQuery(element).on('click', _.before(5, addContactToList));
  23183. * // => Allows adding up to 4 contacts to the list.
  23184. */
  23185. function before(n, func) {
  23186. var result;
  23187. if (typeof func != 'function') {
  23188. throw new TypeError(FUNC_ERROR_TEXT);
  23189. }
  23190. n = toInteger(n);
  23191. return function() {
  23192. if (--n > 0) {
  23193. result = func.apply(this, arguments);
  23194. }
  23195. if (n <= 1) {
  23196. func = undefined;
  23197. }
  23198. return result;
  23199. };
  23200. }
  23201. /**
  23202. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  23203. * and `partials` prepended to the arguments it receives.
  23204. *
  23205. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  23206. * may be used as a placeholder for partially applied arguments.
  23207. *
  23208. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  23209. * property of bound functions.
  23210. *
  23211. * @static
  23212. * @memberOf _
  23213. * @since 0.1.0
  23214. * @category Function
  23215. * @param {Function} func The function to bind.
  23216. * @param {*} thisArg The `this` binding of `func`.
  23217. * @param {...*} [partials] The arguments to be partially applied.
  23218. * @returns {Function} Returns the new bound function.
  23219. * @example
  23220. *
  23221. * function greet(greeting, punctuation) {
  23222. * return greeting + ' ' + this.user + punctuation;
  23223. * }
  23224. *
  23225. * var object = { 'user': 'fred' };
  23226. *
  23227. * var bound = _.bind(greet, object, 'hi');
  23228. * bound('!');
  23229. * // => 'hi fred!'
  23230. *
  23231. * // Bound with placeholders.
  23232. * var bound = _.bind(greet, object, _, '!');
  23233. * bound('hi');
  23234. * // => 'hi fred!'
  23235. */
  23236. var bind = baseRest(function(func, thisArg, partials) {
  23237. var bitmask = WRAP_BIND_FLAG;
  23238. if (partials.length) {
  23239. var holders = replaceHolders(partials, getHolder(bind));
  23240. bitmask |= WRAP_PARTIAL_FLAG;
  23241. }
  23242. return createWrap(func, bitmask, thisArg, partials, holders);
  23243. });
  23244. /**
  23245. * Creates a function that invokes the method at `object[key]` with `partials`
  23246. * prepended to the arguments it receives.
  23247. *
  23248. * This method differs from `_.bind` by allowing bound functions to reference
  23249. * methods that may be redefined or don't yet exist. See
  23250. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  23251. * for more details.
  23252. *
  23253. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  23254. * builds, may be used as a placeholder for partially applied arguments.
  23255. *
  23256. * @static
  23257. * @memberOf _
  23258. * @since 0.10.0
  23259. * @category Function
  23260. * @param {Object} object The object to invoke the method on.
  23261. * @param {string} key The key of the method.
  23262. * @param {...*} [partials] The arguments to be partially applied.
  23263. * @returns {Function} Returns the new bound function.
  23264. * @example
  23265. *
  23266. * var object = {
  23267. * 'user': 'fred',
  23268. * 'greet': function(greeting, punctuation) {
  23269. * return greeting + ' ' + this.user + punctuation;
  23270. * }
  23271. * };
  23272. *
  23273. * var bound = _.bindKey(object, 'greet', 'hi');
  23274. * bound('!');
  23275. * // => 'hi fred!'
  23276. *
  23277. * object.greet = function(greeting, punctuation) {
  23278. * return greeting + 'ya ' + this.user + punctuation;
  23279. * };
  23280. *
  23281. * bound('!');
  23282. * // => 'hiya fred!'
  23283. *
  23284. * // Bound with placeholders.
  23285. * var bound = _.bindKey(object, 'greet', _, '!');
  23286. * bound('hi');
  23287. * // => 'hiya fred!'
  23288. */
  23289. var bindKey = baseRest(function(object, key, partials) {
  23290. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  23291. if (partials.length) {
  23292. var holders = replaceHolders(partials, getHolder(bindKey));
  23293. bitmask |= WRAP_PARTIAL_FLAG;
  23294. }
  23295. return createWrap(key, bitmask, object, partials, holders);
  23296. });
  23297. /**
  23298. * Creates a function that accepts arguments of `func` and either invokes
  23299. * `func` returning its result, if at least `arity` number of arguments have
  23300. * been provided, or returns a function that accepts the remaining `func`
  23301. * arguments, and so on. The arity of `func` may be specified if `func.length`
  23302. * is not sufficient.
  23303. *
  23304. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  23305. * may be used as a placeholder for provided arguments.
  23306. *
  23307. * **Note:** This method doesn't set the "length" property of curried functions.
  23308. *
  23309. * @static
  23310. * @memberOf _
  23311. * @since 2.0.0
  23312. * @category Function
  23313. * @param {Function} func The function to curry.
  23314. * @param {number} [arity=func.length] The arity of `func`.
  23315. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23316. * @returns {Function} Returns the new curried function.
  23317. * @example
  23318. *
  23319. * var abc = function(a, b, c) {
  23320. * return [a, b, c];
  23321. * };
  23322. *
  23323. * var curried = _.curry(abc);
  23324. *
  23325. * curried(1)(2)(3);
  23326. * // => [1, 2, 3]
  23327. *
  23328. * curried(1, 2)(3);
  23329. * // => [1, 2, 3]
  23330. *
  23331. * curried(1, 2, 3);
  23332. * // => [1, 2, 3]
  23333. *
  23334. * // Curried with placeholders.
  23335. * curried(1)(_, 3)(2);
  23336. * // => [1, 2, 3]
  23337. */
  23338. function curry(func, arity, guard) {
  23339. arity = guard ? undefined : arity;
  23340. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23341. result.placeholder = curry.placeholder;
  23342. return result;
  23343. }
  23344. /**
  23345. * This method is like `_.curry` except that arguments are applied to `func`
  23346. * in the manner of `_.partialRight` instead of `_.partial`.
  23347. *
  23348. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  23349. * builds, may be used as a placeholder for provided arguments.
  23350. *
  23351. * **Note:** This method doesn't set the "length" property of curried functions.
  23352. *
  23353. * @static
  23354. * @memberOf _
  23355. * @since 3.0.0
  23356. * @category Function
  23357. * @param {Function} func The function to curry.
  23358. * @param {number} [arity=func.length] The arity of `func`.
  23359. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23360. * @returns {Function} Returns the new curried function.
  23361. * @example
  23362. *
  23363. * var abc = function(a, b, c) {
  23364. * return [a, b, c];
  23365. * };
  23366. *
  23367. * var curried = _.curryRight(abc);
  23368. *
  23369. * curried(3)(2)(1);
  23370. * // => [1, 2, 3]
  23371. *
  23372. * curried(2, 3)(1);
  23373. * // => [1, 2, 3]
  23374. *
  23375. * curried(1, 2, 3);
  23376. * // => [1, 2, 3]
  23377. *
  23378. * // Curried with placeholders.
  23379. * curried(3)(1, _)(2);
  23380. * // => [1, 2, 3]
  23381. */
  23382. function curryRight(func, arity, guard) {
  23383. arity = guard ? undefined : arity;
  23384. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23385. result.placeholder = curryRight.placeholder;
  23386. return result;
  23387. }
  23388. /**
  23389. * Creates a debounced function that delays invoking `func` until after `wait`
  23390. * milliseconds have elapsed since the last time the debounced function was
  23391. * invoked. The debounced function comes with a `cancel` method to cancel
  23392. * delayed `func` invocations and a `flush` method to immediately invoke them.
  23393. * Provide `options` to indicate whether `func` should be invoked on the
  23394. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  23395. * with the last arguments provided to the debounced function. Subsequent
  23396. * calls to the debounced function return the result of the last `func`
  23397. * invocation.
  23398. *
  23399. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23400. * invoked on the trailing edge of the timeout only if the debounced function
  23401. * is invoked more than once during the `wait` timeout.
  23402. *
  23403. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23404. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23405. *
  23406. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23407. * for details over the differences between `_.debounce` and `_.throttle`.
  23408. *
  23409. * @static
  23410. * @memberOf _
  23411. * @since 0.1.0
  23412. * @category Function
  23413. * @param {Function} func The function to debounce.
  23414. * @param {number} [wait=0] The number of milliseconds to delay.
  23415. * @param {Object} [options={}] The options object.
  23416. * @param {boolean} [options.leading=false]
  23417. * Specify invoking on the leading edge of the timeout.
  23418. * @param {number} [options.maxWait]
  23419. * The maximum time `func` is allowed to be delayed before it's invoked.
  23420. * @param {boolean} [options.trailing=true]
  23421. * Specify invoking on the trailing edge of the timeout.
  23422. * @returns {Function} Returns the new debounced function.
  23423. * @example
  23424. *
  23425. * // Avoid costly calculations while the window size is in flux.
  23426. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  23427. *
  23428. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  23429. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  23430. * 'leading': true,
  23431. * 'trailing': false
  23432. * }));
  23433. *
  23434. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  23435. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  23436. * var source = new EventSource('/stream');
  23437. * jQuery(source).on('message', debounced);
  23438. *
  23439. * // Cancel the trailing debounced invocation.
  23440. * jQuery(window).on('popstate', debounced.cancel);
  23441. */
  23442. function debounce(func, wait, options) {
  23443. var lastArgs,
  23444. lastThis,
  23445. maxWait,
  23446. result,
  23447. timerId,
  23448. lastCallTime,
  23449. lastInvokeTime = 0,
  23450. leading = false,
  23451. maxing = false,
  23452. trailing = true;
  23453. if (typeof func != 'function') {
  23454. throw new TypeError(FUNC_ERROR_TEXT);
  23455. }
  23456. wait = toNumber(wait) || 0;
  23457. if (isObject(options)) {
  23458. leading = !!options.leading;
  23459. maxing = 'maxWait' in options;
  23460. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  23461. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23462. }
  23463. function invokeFunc(time) {
  23464. var args = lastArgs,
  23465. thisArg = lastThis;
  23466. lastArgs = lastThis = undefined;
  23467. lastInvokeTime = time;
  23468. result = func.apply(thisArg, args);
  23469. return result;
  23470. }
  23471. function leadingEdge(time) {
  23472. // Reset any `maxWait` timer.
  23473. lastInvokeTime = time;
  23474. // Start the timer for the trailing edge.
  23475. timerId = setTimeout(timerExpired, wait);
  23476. // Invoke the leading edge.
  23477. return leading ? invokeFunc(time) : result;
  23478. }
  23479. function remainingWait(time) {
  23480. var timeSinceLastCall = time - lastCallTime,
  23481. timeSinceLastInvoke = time - lastInvokeTime,
  23482. timeWaiting = wait - timeSinceLastCall;
  23483. return maxing
  23484. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23485. : timeWaiting;
  23486. }
  23487. function shouldInvoke(time) {
  23488. var timeSinceLastCall = time - lastCallTime,
  23489. timeSinceLastInvoke = time - lastInvokeTime;
  23490. // Either this is the first call, activity has stopped and we're at the
  23491. // trailing edge, the system time has gone backwards and we're treating
  23492. // it as the trailing edge, or we've hit the `maxWait` limit.
  23493. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23494. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23495. }
  23496. function timerExpired() {
  23497. var time = now();
  23498. if (shouldInvoke(time)) {
  23499. return trailingEdge(time);
  23500. }
  23501. // Restart the timer.
  23502. timerId = setTimeout(timerExpired, remainingWait(time));
  23503. }
  23504. function trailingEdge(time) {
  23505. timerId = undefined;
  23506. // Only invoke if we have `lastArgs` which means `func` has been
  23507. // debounced at least once.
  23508. if (trailing && lastArgs) {
  23509. return invokeFunc(time);
  23510. }
  23511. lastArgs = lastThis = undefined;
  23512. return result;
  23513. }
  23514. function cancel() {
  23515. if (timerId !== undefined) {
  23516. clearTimeout(timerId);
  23517. }
  23518. lastInvokeTime = 0;
  23519. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23520. }
  23521. function flush() {
  23522. return timerId === undefined ? result : trailingEdge(now());
  23523. }
  23524. function debounced() {
  23525. var time = now(),
  23526. isInvoking = shouldInvoke(time);
  23527. lastArgs = arguments;
  23528. lastThis = this;
  23529. lastCallTime = time;
  23530. if (isInvoking) {
  23531. if (timerId === undefined) {
  23532. return leadingEdge(lastCallTime);
  23533. }
  23534. if (maxing) {
  23535. // Handle invocations in a tight loop.
  23536. clearTimeout(timerId);
  23537. timerId = setTimeout(timerExpired, wait);
  23538. return invokeFunc(lastCallTime);
  23539. }
  23540. }
  23541. if (timerId === undefined) {
  23542. timerId = setTimeout(timerExpired, wait);
  23543. }
  23544. return result;
  23545. }
  23546. debounced.cancel = cancel;
  23547. debounced.flush = flush;
  23548. return debounced;
  23549. }
  23550. /**
  23551. * Defers invoking the `func` until the current call stack has cleared. Any
  23552. * additional arguments are provided to `func` when it's invoked.
  23553. *
  23554. * @static
  23555. * @memberOf _
  23556. * @since 0.1.0
  23557. * @category Function
  23558. * @param {Function} func The function to defer.
  23559. * @param {...*} [args] The arguments to invoke `func` with.
  23560. * @returns {number} Returns the timer id.
  23561. * @example
  23562. *
  23563. * _.defer(function(text) {
  23564. * console.log(text);
  23565. * }, 'deferred');
  23566. * // => Logs 'deferred' after one millisecond.
  23567. */
  23568. var defer = baseRest(function(func, args) {
  23569. return baseDelay(func, 1, args);
  23570. });
  23571. /**
  23572. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23573. * provided to `func` when it's invoked.
  23574. *
  23575. * @static
  23576. * @memberOf _
  23577. * @since 0.1.0
  23578. * @category Function
  23579. * @param {Function} func The function to delay.
  23580. * @param {number} wait The number of milliseconds to delay invocation.
  23581. * @param {...*} [args] The arguments to invoke `func` with.
  23582. * @returns {number} Returns the timer id.
  23583. * @example
  23584. *
  23585. * _.delay(function(text) {
  23586. * console.log(text);
  23587. * }, 1000, 'later');
  23588. * // => Logs 'later' after one second.
  23589. */
  23590. var delay = baseRest(function(func, wait, args) {
  23591. return baseDelay(func, toNumber(wait) || 0, args);
  23592. });
  23593. /**
  23594. * Creates a function that invokes `func` with arguments reversed.
  23595. *
  23596. * @static
  23597. * @memberOf _
  23598. * @since 4.0.0
  23599. * @category Function
  23600. * @param {Function} func The function to flip arguments for.
  23601. * @returns {Function} Returns the new flipped function.
  23602. * @example
  23603. *
  23604. * var flipped = _.flip(function() {
  23605. * return _.toArray(arguments);
  23606. * });
  23607. *
  23608. * flipped('a', 'b', 'c', 'd');
  23609. * // => ['d', 'c', 'b', 'a']
  23610. */
  23611. function flip(func) {
  23612. return createWrap(func, WRAP_FLIP_FLAG);
  23613. }
  23614. /**
  23615. * Creates a function that memoizes the result of `func`. If `resolver` is
  23616. * provided, it determines the cache key for storing the result based on the
  23617. * arguments provided to the memoized function. By default, the first argument
  23618. * provided to the memoized function is used as the map cache key. The `func`
  23619. * is invoked with the `this` binding of the memoized function.
  23620. *
  23621. * **Note:** The cache is exposed as the `cache` property on the memoized
  23622. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23623. * constructor with one whose instances implement the
  23624. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23625. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23626. *
  23627. * @static
  23628. * @memberOf _
  23629. * @since 0.1.0
  23630. * @category Function
  23631. * @param {Function} func The function to have its output memoized.
  23632. * @param {Function} [resolver] The function to resolve the cache key.
  23633. * @returns {Function} Returns the new memoized function.
  23634. * @example
  23635. *
  23636. * var object = { 'a': 1, 'b': 2 };
  23637. * var other = { 'c': 3, 'd': 4 };
  23638. *
  23639. * var values = _.memoize(_.values);
  23640. * values(object);
  23641. * // => [1, 2]
  23642. *
  23643. * values(other);
  23644. * // => [3, 4]
  23645. *
  23646. * object.a = 2;
  23647. * values(object);
  23648. * // => [1, 2]
  23649. *
  23650. * // Modify the result cache.
  23651. * values.cache.set(object, ['a', 'b']);
  23652. * values(object);
  23653. * // => ['a', 'b']
  23654. *
  23655. * // Replace `_.memoize.Cache`.
  23656. * _.memoize.Cache = WeakMap;
  23657. */
  23658. function memoize(func, resolver) {
  23659. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23660. throw new TypeError(FUNC_ERROR_TEXT);
  23661. }
  23662. var memoized = function() {
  23663. var args = arguments,
  23664. key = resolver ? resolver.apply(this, args) : args[0],
  23665. cache = memoized.cache;
  23666. if (cache.has(key)) {
  23667. return cache.get(key);
  23668. }
  23669. var result = func.apply(this, args);
  23670. memoized.cache = cache.set(key, result) || cache;
  23671. return result;
  23672. };
  23673. memoized.cache = new (memoize.Cache || MapCache);
  23674. return memoized;
  23675. }
  23676. // Expose `MapCache`.
  23677. memoize.Cache = MapCache;
  23678. /**
  23679. * Creates a function that negates the result of the predicate `func`. The
  23680. * `func` predicate is invoked with the `this` binding and arguments of the
  23681. * created function.
  23682. *
  23683. * @static
  23684. * @memberOf _
  23685. * @since 3.0.0
  23686. * @category Function
  23687. * @param {Function} predicate The predicate to negate.
  23688. * @returns {Function} Returns the new negated function.
  23689. * @example
  23690. *
  23691. * function isEven(n) {
  23692. * return n % 2 == 0;
  23693. * }
  23694. *
  23695. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23696. * // => [1, 3, 5]
  23697. */
  23698. function negate(predicate) {
  23699. if (typeof predicate != 'function') {
  23700. throw new TypeError(FUNC_ERROR_TEXT);
  23701. }
  23702. return function() {
  23703. var args = arguments;
  23704. switch (args.length) {
  23705. case 0: return !predicate.call(this);
  23706. case 1: return !predicate.call(this, args[0]);
  23707. case 2: return !predicate.call(this, args[0], args[1]);
  23708. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23709. }
  23710. return !predicate.apply(this, args);
  23711. };
  23712. }
  23713. /**
  23714. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23715. * to the function return the value of the first invocation. The `func` is
  23716. * invoked with the `this` binding and arguments of the created function.
  23717. *
  23718. * @static
  23719. * @memberOf _
  23720. * @since 0.1.0
  23721. * @category Function
  23722. * @param {Function} func The function to restrict.
  23723. * @returns {Function} Returns the new restricted function.
  23724. * @example
  23725. *
  23726. * var initialize = _.once(createApplication);
  23727. * initialize();
  23728. * initialize();
  23729. * // => `createApplication` is invoked once
  23730. */
  23731. function once(func) {
  23732. return before(2, func);
  23733. }
  23734. /**
  23735. * Creates a function that invokes `func` with its arguments transformed.
  23736. *
  23737. * @static
  23738. * @since 4.0.0
  23739. * @memberOf _
  23740. * @category Function
  23741. * @param {Function} func The function to wrap.
  23742. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23743. * The argument transforms.
  23744. * @returns {Function} Returns the new function.
  23745. * @example
  23746. *
  23747. * function doubled(n) {
  23748. * return n * 2;
  23749. * }
  23750. *
  23751. * function square(n) {
  23752. * return n * n;
  23753. * }
  23754. *
  23755. * var func = _.overArgs(function(x, y) {
  23756. * return [x, y];
  23757. * }, [square, doubled]);
  23758. *
  23759. * func(9, 3);
  23760. * // => [81, 6]
  23761. *
  23762. * func(10, 5);
  23763. * // => [100, 10]
  23764. */
  23765. var overArgs = castRest(function(func, transforms) {
  23766. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23767. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23768. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23769. var funcsLength = transforms.length;
  23770. return baseRest(function(args) {
  23771. var index = -1,
  23772. length = nativeMin(args.length, funcsLength);
  23773. while (++index < length) {
  23774. args[index] = transforms[index].call(this, args[index]);
  23775. }
  23776. return apply(func, this, args);
  23777. });
  23778. });
  23779. /**
  23780. * Creates a function that invokes `func` with `partials` prepended to the
  23781. * arguments it receives. This method is like `_.bind` except it does **not**
  23782. * alter the `this` binding.
  23783. *
  23784. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23785. * builds, may be used as a placeholder for partially applied arguments.
  23786. *
  23787. * **Note:** This method doesn't set the "length" property of partially
  23788. * applied functions.
  23789. *
  23790. * @static
  23791. * @memberOf _
  23792. * @since 0.2.0
  23793. * @category Function
  23794. * @param {Function} func The function to partially apply arguments to.
  23795. * @param {...*} [partials] The arguments to be partially applied.
  23796. * @returns {Function} Returns the new partially applied function.
  23797. * @example
  23798. *
  23799. * function greet(greeting, name) {
  23800. * return greeting + ' ' + name;
  23801. * }
  23802. *
  23803. * var sayHelloTo = _.partial(greet, 'hello');
  23804. * sayHelloTo('fred');
  23805. * // => 'hello fred'
  23806. *
  23807. * // Partially applied with placeholders.
  23808. * var greetFred = _.partial(greet, _, 'fred');
  23809. * greetFred('hi');
  23810. * // => 'hi fred'
  23811. */
  23812. var partial = baseRest(function(func, partials) {
  23813. var holders = replaceHolders(partials, getHolder(partial));
  23814. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23815. });
  23816. /**
  23817. * This method is like `_.partial` except that partially applied arguments
  23818. * are appended to the arguments it receives.
  23819. *
  23820. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23821. * builds, may be used as a placeholder for partially applied arguments.
  23822. *
  23823. * **Note:** This method doesn't set the "length" property of partially
  23824. * applied functions.
  23825. *
  23826. * @static
  23827. * @memberOf _
  23828. * @since 1.0.0
  23829. * @category Function
  23830. * @param {Function} func The function to partially apply arguments to.
  23831. * @param {...*} [partials] The arguments to be partially applied.
  23832. * @returns {Function} Returns the new partially applied function.
  23833. * @example
  23834. *
  23835. * function greet(greeting, name) {
  23836. * return greeting + ' ' + name;
  23837. * }
  23838. *
  23839. * var greetFred = _.partialRight(greet, 'fred');
  23840. * greetFred('hi');
  23841. * // => 'hi fred'
  23842. *
  23843. * // Partially applied with placeholders.
  23844. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23845. * sayHelloTo('fred');
  23846. * // => 'hello fred'
  23847. */
  23848. var partialRight = baseRest(function(func, partials) {
  23849. var holders = replaceHolders(partials, getHolder(partialRight));
  23850. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  23851. });
  23852. /**
  23853. * Creates a function that invokes `func` with arguments arranged according
  23854. * to the specified `indexes` where the argument value at the first index is
  23855. * provided as the first argument, the argument value at the second index is
  23856. * provided as the second argument, and so on.
  23857. *
  23858. * @static
  23859. * @memberOf _
  23860. * @since 3.0.0
  23861. * @category Function
  23862. * @param {Function} func The function to rearrange arguments for.
  23863. * @param {...(number|number[])} indexes The arranged argument indexes.
  23864. * @returns {Function} Returns the new function.
  23865. * @example
  23866. *
  23867. * var rearged = _.rearg(function(a, b, c) {
  23868. * return [a, b, c];
  23869. * }, [2, 0, 1]);
  23870. *
  23871. * rearged('b', 'c', 'a')
  23872. * // => ['a', 'b', 'c']
  23873. */
  23874. var rearg = flatRest(function(func, indexes) {
  23875. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  23876. });
  23877. /**
  23878. * Creates a function that invokes `func` with the `this` binding of the
  23879. * created function and arguments from `start` and beyond provided as
  23880. * an array.
  23881. *
  23882. * **Note:** This method is based on the
  23883. * [rest parameter](https://mdn.io/rest_parameters).
  23884. *
  23885. * @static
  23886. * @memberOf _
  23887. * @since 4.0.0
  23888. * @category Function
  23889. * @param {Function} func The function to apply a rest parameter to.
  23890. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23891. * @returns {Function} Returns the new function.
  23892. * @example
  23893. *
  23894. * var say = _.rest(function(what, names) {
  23895. * return what + ' ' + _.initial(names).join(', ') +
  23896. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  23897. * });
  23898. *
  23899. * say('hello', 'fred', 'barney', 'pebbles');
  23900. * // => 'hello fred, barney, & pebbles'
  23901. */
  23902. function rest(func, start) {
  23903. if (typeof func != 'function') {
  23904. throw new TypeError(FUNC_ERROR_TEXT);
  23905. }
  23906. start = start === undefined ? start : toInteger(start);
  23907. return baseRest(func, start);
  23908. }
  23909. /**
  23910. * Creates a function that invokes `func` with the `this` binding of the
  23911. * create function and an array of arguments much like
  23912. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  23913. *
  23914. * **Note:** This method is based on the
  23915. * [spread operator](https://mdn.io/spread_operator).
  23916. *
  23917. * @static
  23918. * @memberOf _
  23919. * @since 3.2.0
  23920. * @category Function
  23921. * @param {Function} func The function to spread arguments over.
  23922. * @param {number} [start=0] The start position of the spread.
  23923. * @returns {Function} Returns the new function.
  23924. * @example
  23925. *
  23926. * var say = _.spread(function(who, what) {
  23927. * return who + ' says ' + what;
  23928. * });
  23929. *
  23930. * say(['fred', 'hello']);
  23931. * // => 'fred says hello'
  23932. *
  23933. * var numbers = Promise.all([
  23934. * Promise.resolve(40),
  23935. * Promise.resolve(36)
  23936. * ]);
  23937. *
  23938. * numbers.then(_.spread(function(x, y) {
  23939. * return x + y;
  23940. * }));
  23941. * // => a Promise of 76
  23942. */
  23943. function spread(func, start) {
  23944. if (typeof func != 'function') {
  23945. throw new TypeError(FUNC_ERROR_TEXT);
  23946. }
  23947. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  23948. return baseRest(function(args) {
  23949. var array = args[start],
  23950. otherArgs = castSlice(args, 0, start);
  23951. if (array) {
  23952. arrayPush(otherArgs, array);
  23953. }
  23954. return apply(func, this, otherArgs);
  23955. });
  23956. }
  23957. /**
  23958. * Creates a throttled function that only invokes `func` at most once per
  23959. * every `wait` milliseconds. The throttled function comes with a `cancel`
  23960. * method to cancel delayed `func` invocations and a `flush` method to
  23961. * immediately invoke them. Provide `options` to indicate whether `func`
  23962. * should be invoked on the leading and/or trailing edge of the `wait`
  23963. * timeout. The `func` is invoked with the last arguments provided to the
  23964. * throttled function. Subsequent calls to the throttled function return the
  23965. * result of the last `func` invocation.
  23966. *
  23967. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23968. * invoked on the trailing edge of the timeout only if the throttled function
  23969. * is invoked more than once during the `wait` timeout.
  23970. *
  23971. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23972. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23973. *
  23974. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23975. * for details over the differences between `_.throttle` and `_.debounce`.
  23976. *
  23977. * @static
  23978. * @memberOf _
  23979. * @since 0.1.0
  23980. * @category Function
  23981. * @param {Function} func The function to throttle.
  23982. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  23983. * @param {Object} [options={}] The options object.
  23984. * @param {boolean} [options.leading=true]
  23985. * Specify invoking on the leading edge of the timeout.
  23986. * @param {boolean} [options.trailing=true]
  23987. * Specify invoking on the trailing edge of the timeout.
  23988. * @returns {Function} Returns the new throttled function.
  23989. * @example
  23990. *
  23991. * // Avoid excessively updating the position while scrolling.
  23992. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  23993. *
  23994. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  23995. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  23996. * jQuery(element).on('click', throttled);
  23997. *
  23998. * // Cancel the trailing throttled invocation.
  23999. * jQuery(window).on('popstate', throttled.cancel);
  24000. */
  24001. function throttle(func, wait, options) {
  24002. var leading = true,
  24003. trailing = true;
  24004. if (typeof func != 'function') {
  24005. throw new TypeError(FUNC_ERROR_TEXT);
  24006. }
  24007. if (isObject(options)) {
  24008. leading = 'leading' in options ? !!options.leading : leading;
  24009. trailing = 'trailing' in options ? !!options.trailing : trailing;
  24010. }
  24011. return debounce(func, wait, {
  24012. 'leading': leading,
  24013. 'maxWait': wait,
  24014. 'trailing': trailing
  24015. });
  24016. }
  24017. /**
  24018. * Creates a function that accepts up to one argument, ignoring any
  24019. * additional arguments.
  24020. *
  24021. * @static
  24022. * @memberOf _
  24023. * @since 4.0.0
  24024. * @category Function
  24025. * @param {Function} func The function to cap arguments for.
  24026. * @returns {Function} Returns the new capped function.
  24027. * @example
  24028. *
  24029. * _.map(['6', '8', '10'], _.unary(parseInt));
  24030. * // => [6, 8, 10]
  24031. */
  24032. function unary(func) {
  24033. return ary(func, 1);
  24034. }
  24035. /**
  24036. * Creates a function that provides `value` to `wrapper` as its first
  24037. * argument. Any additional arguments provided to the function are appended
  24038. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  24039. * binding of the created function.
  24040. *
  24041. * @static
  24042. * @memberOf _
  24043. * @since 0.1.0
  24044. * @category Function
  24045. * @param {*} value The value to wrap.
  24046. * @param {Function} [wrapper=identity] The wrapper function.
  24047. * @returns {Function} Returns the new function.
  24048. * @example
  24049. *
  24050. * var p = _.wrap(_.escape, function(func, text) {
  24051. * return '<p>' + func(text) + '</p>';
  24052. * });
  24053. *
  24054. * p('fred, barney, & pebbles');
  24055. * // => '<p>fred, barney, &amp; pebbles</p>'
  24056. */
  24057. function wrap(value, wrapper) {
  24058. return partial(castFunction(wrapper), value);
  24059. }
  24060. /*------------------------------------------------------------------------*/
  24061. /**
  24062. * Casts `value` as an array if it's not one.
  24063. *
  24064. * @static
  24065. * @memberOf _
  24066. * @since 4.4.0
  24067. * @category Lang
  24068. * @param {*} value The value to inspect.
  24069. * @returns {Array} Returns the cast array.
  24070. * @example
  24071. *
  24072. * _.castArray(1);
  24073. * // => [1]
  24074. *
  24075. * _.castArray({ 'a': 1 });
  24076. * // => [{ 'a': 1 }]
  24077. *
  24078. * _.castArray('abc');
  24079. * // => ['abc']
  24080. *
  24081. * _.castArray(null);
  24082. * // => [null]
  24083. *
  24084. * _.castArray(undefined);
  24085. * // => [undefined]
  24086. *
  24087. * _.castArray();
  24088. * // => []
  24089. *
  24090. * var array = [1, 2, 3];
  24091. * console.log(_.castArray(array) === array);
  24092. * // => true
  24093. */
  24094. function castArray() {
  24095. if (!arguments.length) {
  24096. return [];
  24097. }
  24098. var value = arguments[0];
  24099. return isArray(value) ? value : [value];
  24100. }
  24101. /**
  24102. * Creates a shallow clone of `value`.
  24103. *
  24104. * **Note:** This method is loosely based on the
  24105. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  24106. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  24107. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  24108. * arrays. The own enumerable properties of `arguments` objects are cloned
  24109. * as plain objects. An empty object is returned for uncloneable values such
  24110. * as error objects, functions, DOM nodes, and WeakMaps.
  24111. *
  24112. * @static
  24113. * @memberOf _
  24114. * @since 0.1.0
  24115. * @category Lang
  24116. * @param {*} value The value to clone.
  24117. * @returns {*} Returns the cloned value.
  24118. * @see _.cloneDeep
  24119. * @example
  24120. *
  24121. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24122. *
  24123. * var shallow = _.clone(objects);
  24124. * console.log(shallow[0] === objects[0]);
  24125. * // => true
  24126. */
  24127. function clone(value) {
  24128. return baseClone(value, CLONE_SYMBOLS_FLAG);
  24129. }
  24130. /**
  24131. * This method is like `_.clone` except that it accepts `customizer` which
  24132. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  24133. * cloning is handled by the method instead. The `customizer` is invoked with
  24134. * up to four arguments; (value [, index|key, object, stack]).
  24135. *
  24136. * @static
  24137. * @memberOf _
  24138. * @since 4.0.0
  24139. * @category Lang
  24140. * @param {*} value The value to clone.
  24141. * @param {Function} [customizer] The function to customize cloning.
  24142. * @returns {*} Returns the cloned value.
  24143. * @see _.cloneDeepWith
  24144. * @example
  24145. *
  24146. * function customizer(value) {
  24147. * if (_.isElement(value)) {
  24148. * return value.cloneNode(false);
  24149. * }
  24150. * }
  24151. *
  24152. * var el = _.cloneWith(document.body, customizer);
  24153. *
  24154. * console.log(el === document.body);
  24155. * // => false
  24156. * console.log(el.nodeName);
  24157. * // => 'BODY'
  24158. * console.log(el.childNodes.length);
  24159. * // => 0
  24160. */
  24161. function cloneWith(value, customizer) {
  24162. customizer = typeof customizer == 'function' ? customizer : undefined;
  24163. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  24164. }
  24165. /**
  24166. * This method is like `_.clone` except that it recursively clones `value`.
  24167. *
  24168. * @static
  24169. * @memberOf _
  24170. * @since 1.0.0
  24171. * @category Lang
  24172. * @param {*} value The value to recursively clone.
  24173. * @returns {*} Returns the deep cloned value.
  24174. * @see _.clone
  24175. * @example
  24176. *
  24177. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24178. *
  24179. * var deep = _.cloneDeep(objects);
  24180. * console.log(deep[0] === objects[0]);
  24181. * // => false
  24182. */
  24183. function cloneDeep(value) {
  24184. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  24185. }
  24186. /**
  24187. * This method is like `_.cloneWith` except that it recursively clones `value`.
  24188. *
  24189. * @static
  24190. * @memberOf _
  24191. * @since 4.0.0
  24192. * @category Lang
  24193. * @param {*} value The value to recursively clone.
  24194. * @param {Function} [customizer] The function to customize cloning.
  24195. * @returns {*} Returns the deep cloned value.
  24196. * @see _.cloneWith
  24197. * @example
  24198. *
  24199. * function customizer(value) {
  24200. * if (_.isElement(value)) {
  24201. * return value.cloneNode(true);
  24202. * }
  24203. * }
  24204. *
  24205. * var el = _.cloneDeepWith(document.body, customizer);
  24206. *
  24207. * console.log(el === document.body);
  24208. * // => false
  24209. * console.log(el.nodeName);
  24210. * // => 'BODY'
  24211. * console.log(el.childNodes.length);
  24212. * // => 20
  24213. */
  24214. function cloneDeepWith(value, customizer) {
  24215. customizer = typeof customizer == 'function' ? customizer : undefined;
  24216. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  24217. }
  24218. /**
  24219. * Checks if `object` conforms to `source` by invoking the predicate
  24220. * properties of `source` with the corresponding property values of `object`.
  24221. *
  24222. * **Note:** This method is equivalent to `_.conforms` when `source` is
  24223. * partially applied.
  24224. *
  24225. * @static
  24226. * @memberOf _
  24227. * @since 4.14.0
  24228. * @category Lang
  24229. * @param {Object} object The object to inspect.
  24230. * @param {Object} source The object of property predicates to conform to.
  24231. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  24232. * @example
  24233. *
  24234. * var object = { 'a': 1, 'b': 2 };
  24235. *
  24236. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  24237. * // => true
  24238. *
  24239. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  24240. * // => false
  24241. */
  24242. function conformsTo(object, source) {
  24243. return source == null || baseConformsTo(object, source, keys(source));
  24244. }
  24245. /**
  24246. * Performs a
  24247. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24248. * comparison between two values to determine if they are equivalent.
  24249. *
  24250. * @static
  24251. * @memberOf _
  24252. * @since 4.0.0
  24253. * @category Lang
  24254. * @param {*} value The value to compare.
  24255. * @param {*} other The other value to compare.
  24256. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24257. * @example
  24258. *
  24259. * var object = { 'a': 1 };
  24260. * var other = { 'a': 1 };
  24261. *
  24262. * _.eq(object, object);
  24263. * // => true
  24264. *
  24265. * _.eq(object, other);
  24266. * // => false
  24267. *
  24268. * _.eq('a', 'a');
  24269. * // => true
  24270. *
  24271. * _.eq('a', Object('a'));
  24272. * // => false
  24273. *
  24274. * _.eq(NaN, NaN);
  24275. * // => true
  24276. */
  24277. function eq(value, other) {
  24278. return value === other || (value !== value && other !== other);
  24279. }
  24280. /**
  24281. * Checks if `value` is greater than `other`.
  24282. *
  24283. * @static
  24284. * @memberOf _
  24285. * @since 3.9.0
  24286. * @category Lang
  24287. * @param {*} value The value to compare.
  24288. * @param {*} other The other value to compare.
  24289. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  24290. * else `false`.
  24291. * @see _.lt
  24292. * @example
  24293. *
  24294. * _.gt(3, 1);
  24295. * // => true
  24296. *
  24297. * _.gt(3, 3);
  24298. * // => false
  24299. *
  24300. * _.gt(1, 3);
  24301. * // => false
  24302. */
  24303. var gt = createRelationalOperation(baseGt);
  24304. /**
  24305. * Checks if `value` is greater than or equal to `other`.
  24306. *
  24307. * @static
  24308. * @memberOf _
  24309. * @since 3.9.0
  24310. * @category Lang
  24311. * @param {*} value The value to compare.
  24312. * @param {*} other The other value to compare.
  24313. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  24314. * `other`, else `false`.
  24315. * @see _.lte
  24316. * @example
  24317. *
  24318. * _.gte(3, 1);
  24319. * // => true
  24320. *
  24321. * _.gte(3, 3);
  24322. * // => true
  24323. *
  24324. * _.gte(1, 3);
  24325. * // => false
  24326. */
  24327. var gte = createRelationalOperation(function(value, other) {
  24328. return value >= other;
  24329. });
  24330. /**
  24331. * Checks if `value` is likely an `arguments` object.
  24332. *
  24333. * @static
  24334. * @memberOf _
  24335. * @since 0.1.0
  24336. * @category Lang
  24337. * @param {*} value The value to check.
  24338. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  24339. * else `false`.
  24340. * @example
  24341. *
  24342. * _.isArguments(function() { return arguments; }());
  24343. * // => true
  24344. *
  24345. * _.isArguments([1, 2, 3]);
  24346. * // => false
  24347. */
  24348. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  24349. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  24350. !propertyIsEnumerable.call(value, 'callee');
  24351. };
  24352. /**
  24353. * Checks if `value` is classified as an `Array` object.
  24354. *
  24355. * @static
  24356. * @memberOf _
  24357. * @since 0.1.0
  24358. * @category Lang
  24359. * @param {*} value The value to check.
  24360. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  24361. * @example
  24362. *
  24363. * _.isArray([1, 2, 3]);
  24364. * // => true
  24365. *
  24366. * _.isArray(document.body.children);
  24367. * // => false
  24368. *
  24369. * _.isArray('abc');
  24370. * // => false
  24371. *
  24372. * _.isArray(_.noop);
  24373. * // => false
  24374. */
  24375. var isArray = Array.isArray;
  24376. /**
  24377. * Checks if `value` is classified as an `ArrayBuffer` object.
  24378. *
  24379. * @static
  24380. * @memberOf _
  24381. * @since 4.3.0
  24382. * @category Lang
  24383. * @param {*} value The value to check.
  24384. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24385. * @example
  24386. *
  24387. * _.isArrayBuffer(new ArrayBuffer(2));
  24388. * // => true
  24389. *
  24390. * _.isArrayBuffer(new Array(2));
  24391. * // => false
  24392. */
  24393. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  24394. /**
  24395. * Checks if `value` is array-like. A value is considered array-like if it's
  24396. * not a function and has a `value.length` that's an integer greater than or
  24397. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  24398. *
  24399. * @static
  24400. * @memberOf _
  24401. * @since 4.0.0
  24402. * @category Lang
  24403. * @param {*} value The value to check.
  24404. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  24405. * @example
  24406. *
  24407. * _.isArrayLike([1, 2, 3]);
  24408. * // => true
  24409. *
  24410. * _.isArrayLike(document.body.children);
  24411. * // => true
  24412. *
  24413. * _.isArrayLike('abc');
  24414. * // => true
  24415. *
  24416. * _.isArrayLike(_.noop);
  24417. * // => false
  24418. */
  24419. function isArrayLike(value) {
  24420. return value != null && isLength(value.length) && !isFunction(value);
  24421. }
  24422. /**
  24423. * This method is like `_.isArrayLike` except that it also checks if `value`
  24424. * is an object.
  24425. *
  24426. * @static
  24427. * @memberOf _
  24428. * @since 4.0.0
  24429. * @category Lang
  24430. * @param {*} value The value to check.
  24431. * @returns {boolean} Returns `true` if `value` is an array-like object,
  24432. * else `false`.
  24433. * @example
  24434. *
  24435. * _.isArrayLikeObject([1, 2, 3]);
  24436. * // => true
  24437. *
  24438. * _.isArrayLikeObject(document.body.children);
  24439. * // => true
  24440. *
  24441. * _.isArrayLikeObject('abc');
  24442. * // => false
  24443. *
  24444. * _.isArrayLikeObject(_.noop);
  24445. * // => false
  24446. */
  24447. function isArrayLikeObject(value) {
  24448. return isObjectLike(value) && isArrayLike(value);
  24449. }
  24450. /**
  24451. * Checks if `value` is classified as a boolean primitive or object.
  24452. *
  24453. * @static
  24454. * @memberOf _
  24455. * @since 0.1.0
  24456. * @category Lang
  24457. * @param {*} value The value to check.
  24458. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  24459. * @example
  24460. *
  24461. * _.isBoolean(false);
  24462. * // => true
  24463. *
  24464. * _.isBoolean(null);
  24465. * // => false
  24466. */
  24467. function isBoolean(value) {
  24468. return value === true || value === false ||
  24469. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24470. }
  24471. /**
  24472. * Checks if `value` is a buffer.
  24473. *
  24474. * @static
  24475. * @memberOf _
  24476. * @since 4.3.0
  24477. * @category Lang
  24478. * @param {*} value The value to check.
  24479. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24480. * @example
  24481. *
  24482. * _.isBuffer(new Buffer(2));
  24483. * // => true
  24484. *
  24485. * _.isBuffer(new Uint8Array(2));
  24486. * // => false
  24487. */
  24488. var isBuffer = nativeIsBuffer || stubFalse;
  24489. /**
  24490. * Checks if `value` is classified as a `Date` object.
  24491. *
  24492. * @static
  24493. * @memberOf _
  24494. * @since 0.1.0
  24495. * @category Lang
  24496. * @param {*} value The value to check.
  24497. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24498. * @example
  24499. *
  24500. * _.isDate(new Date);
  24501. * // => true
  24502. *
  24503. * _.isDate('Mon April 23 2012');
  24504. * // => false
  24505. */
  24506. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24507. /**
  24508. * Checks if `value` is likely a DOM element.
  24509. *
  24510. * @static
  24511. * @memberOf _
  24512. * @since 0.1.0
  24513. * @category Lang
  24514. * @param {*} value The value to check.
  24515. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  24516. * @example
  24517. *
  24518. * _.isElement(document.body);
  24519. * // => true
  24520. *
  24521. * _.isElement('<body>');
  24522. * // => false
  24523. */
  24524. function isElement(value) {
  24525. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24526. }
  24527. /**
  24528. * Checks if `value` is an empty object, collection, map, or set.
  24529. *
  24530. * Objects are considered empty if they have no own enumerable string keyed
  24531. * properties.
  24532. *
  24533. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24534. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24535. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24536. *
  24537. * @static
  24538. * @memberOf _
  24539. * @since 0.1.0
  24540. * @category Lang
  24541. * @param {*} value The value to check.
  24542. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24543. * @example
  24544. *
  24545. * _.isEmpty(null);
  24546. * // => true
  24547. *
  24548. * _.isEmpty(true);
  24549. * // => true
  24550. *
  24551. * _.isEmpty(1);
  24552. * // => true
  24553. *
  24554. * _.isEmpty([1, 2, 3]);
  24555. * // => false
  24556. *
  24557. * _.isEmpty({ 'a': 1 });
  24558. * // => false
  24559. */
  24560. function isEmpty(value) {
  24561. if (value == null) {
  24562. return true;
  24563. }
  24564. if (isArrayLike(value) &&
  24565. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24566. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24567. return !value.length;
  24568. }
  24569. var tag = getTag(value);
  24570. if (tag == mapTag || tag == setTag) {
  24571. return !value.size;
  24572. }
  24573. if (isPrototype(value)) {
  24574. return !baseKeys(value).length;
  24575. }
  24576. for (var key in value) {
  24577. if (hasOwnProperty.call(value, key)) {
  24578. return false;
  24579. }
  24580. }
  24581. return true;
  24582. }
  24583. /**
  24584. * Performs a deep comparison between two values to determine if they are
  24585. * equivalent.
  24586. *
  24587. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24588. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24589. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24590. * by their own, not inherited, enumerable properties. Functions and DOM
  24591. * nodes are compared by strict equality, i.e. `===`.
  24592. *
  24593. * @static
  24594. * @memberOf _
  24595. * @since 0.1.0
  24596. * @category Lang
  24597. * @param {*} value The value to compare.
  24598. * @param {*} other The other value to compare.
  24599. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24600. * @example
  24601. *
  24602. * var object = { 'a': 1 };
  24603. * var other = { 'a': 1 };
  24604. *
  24605. * _.isEqual(object, other);
  24606. * // => true
  24607. *
  24608. * object === other;
  24609. * // => false
  24610. */
  24611. function isEqual(value, other) {
  24612. return baseIsEqual(value, other);
  24613. }
  24614. /**
  24615. * This method is like `_.isEqual` except that it accepts `customizer` which
  24616. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24617. * are handled by the method instead. The `customizer` is invoked with up to
  24618. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24619. *
  24620. * @static
  24621. * @memberOf _
  24622. * @since 4.0.0
  24623. * @category Lang
  24624. * @param {*} value The value to compare.
  24625. * @param {*} other The other value to compare.
  24626. * @param {Function} [customizer] The function to customize comparisons.
  24627. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24628. * @example
  24629. *
  24630. * function isGreeting(value) {
  24631. * return /^h(?:i|ello)$/.test(value);
  24632. * }
  24633. *
  24634. * function customizer(objValue, othValue) {
  24635. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24636. * return true;
  24637. * }
  24638. * }
  24639. *
  24640. * var array = ['hello', 'goodbye'];
  24641. * var other = ['hi', 'goodbye'];
  24642. *
  24643. * _.isEqualWith(array, other, customizer);
  24644. * // => true
  24645. */
  24646. function isEqualWith(value, other, customizer) {
  24647. customizer = typeof customizer == 'function' ? customizer : undefined;
  24648. var result = customizer ? customizer(value, other) : undefined;
  24649. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24650. }
  24651. /**
  24652. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24653. * `SyntaxError`, `TypeError`, or `URIError` object.
  24654. *
  24655. * @static
  24656. * @memberOf _
  24657. * @since 3.0.0
  24658. * @category Lang
  24659. * @param {*} value The value to check.
  24660. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24661. * @example
  24662. *
  24663. * _.isError(new Error);
  24664. * // => true
  24665. *
  24666. * _.isError(Error);
  24667. * // => false
  24668. */
  24669. function isError(value) {
  24670. if (!isObjectLike(value)) {
  24671. return false;
  24672. }
  24673. var tag = baseGetTag(value);
  24674. return tag == errorTag || tag == domExcTag ||
  24675. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24676. }
  24677. /**
  24678. * Checks if `value` is a finite primitive number.
  24679. *
  24680. * **Note:** This method is based on
  24681. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24682. *
  24683. * @static
  24684. * @memberOf _
  24685. * @since 0.1.0
  24686. * @category Lang
  24687. * @param {*} value The value to check.
  24688. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24689. * @example
  24690. *
  24691. * _.isFinite(3);
  24692. * // => true
  24693. *
  24694. * _.isFinite(Number.MIN_VALUE);
  24695. * // => true
  24696. *
  24697. * _.isFinite(Infinity);
  24698. * // => false
  24699. *
  24700. * _.isFinite('3');
  24701. * // => false
  24702. */
  24703. function isFinite(value) {
  24704. return typeof value == 'number' && nativeIsFinite(value);
  24705. }
  24706. /**
  24707. * Checks if `value` is classified as a `Function` object.
  24708. *
  24709. * @static
  24710. * @memberOf _
  24711. * @since 0.1.0
  24712. * @category Lang
  24713. * @param {*} value The value to check.
  24714. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24715. * @example
  24716. *
  24717. * _.isFunction(_);
  24718. * // => true
  24719. *
  24720. * _.isFunction(/abc/);
  24721. * // => false
  24722. */
  24723. function isFunction(value) {
  24724. if (!isObject(value)) {
  24725. return false;
  24726. }
  24727. // The use of `Object#toString` avoids issues with the `typeof` operator
  24728. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24729. var tag = baseGetTag(value);
  24730. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24731. }
  24732. /**
  24733. * Checks if `value` is an integer.
  24734. *
  24735. * **Note:** This method is based on
  24736. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24737. *
  24738. * @static
  24739. * @memberOf _
  24740. * @since 4.0.0
  24741. * @category Lang
  24742. * @param {*} value The value to check.
  24743. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24744. * @example
  24745. *
  24746. * _.isInteger(3);
  24747. * // => true
  24748. *
  24749. * _.isInteger(Number.MIN_VALUE);
  24750. * // => false
  24751. *
  24752. * _.isInteger(Infinity);
  24753. * // => false
  24754. *
  24755. * _.isInteger('3');
  24756. * // => false
  24757. */
  24758. function isInteger(value) {
  24759. return typeof value == 'number' && value == toInteger(value);
  24760. }
  24761. /**
  24762. * Checks if `value` is a valid array-like length.
  24763. *
  24764. * **Note:** This method is loosely based on
  24765. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24766. *
  24767. * @static
  24768. * @memberOf _
  24769. * @since 4.0.0
  24770. * @category Lang
  24771. * @param {*} value The value to check.
  24772. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24773. * @example
  24774. *
  24775. * _.isLength(3);
  24776. * // => true
  24777. *
  24778. * _.isLength(Number.MIN_VALUE);
  24779. * // => false
  24780. *
  24781. * _.isLength(Infinity);
  24782. * // => false
  24783. *
  24784. * _.isLength('3');
  24785. * // => false
  24786. */
  24787. function isLength(value) {
  24788. return typeof value == 'number' &&
  24789. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24790. }
  24791. /**
  24792. * Checks if `value` is the
  24793. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24794. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24795. *
  24796. * @static
  24797. * @memberOf _
  24798. * @since 0.1.0
  24799. * @category Lang
  24800. * @param {*} value The value to check.
  24801. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24802. * @example
  24803. *
  24804. * _.isObject({});
  24805. * // => true
  24806. *
  24807. * _.isObject([1, 2, 3]);
  24808. * // => true
  24809. *
  24810. * _.isObject(_.noop);
  24811. * // => true
  24812. *
  24813. * _.isObject(null);
  24814. * // => false
  24815. */
  24816. function isObject(value) {
  24817. var type = typeof value;
  24818. return value != null && (type == 'object' || type == 'function');
  24819. }
  24820. /**
  24821. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24822. * and has a `typeof` result of "object".
  24823. *
  24824. * @static
  24825. * @memberOf _
  24826. * @since 4.0.0
  24827. * @category Lang
  24828. * @param {*} value The value to check.
  24829. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24830. * @example
  24831. *
  24832. * _.isObjectLike({});
  24833. * // => true
  24834. *
  24835. * _.isObjectLike([1, 2, 3]);
  24836. * // => true
  24837. *
  24838. * _.isObjectLike(_.noop);
  24839. * // => false
  24840. *
  24841. * _.isObjectLike(null);
  24842. * // => false
  24843. */
  24844. function isObjectLike(value) {
  24845. return value != null && typeof value == 'object';
  24846. }
  24847. /**
  24848. * Checks if `value` is classified as a `Map` object.
  24849. *
  24850. * @static
  24851. * @memberOf _
  24852. * @since 4.3.0
  24853. * @category Lang
  24854. * @param {*} value The value to check.
  24855. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24856. * @example
  24857. *
  24858. * _.isMap(new Map);
  24859. * // => true
  24860. *
  24861. * _.isMap(new WeakMap);
  24862. * // => false
  24863. */
  24864. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  24865. /**
  24866. * Performs a partial deep comparison between `object` and `source` to
  24867. * determine if `object` contains equivalent property values.
  24868. *
  24869. * **Note:** This method is equivalent to `_.matches` when `source` is
  24870. * partially applied.
  24871. *
  24872. * Partial comparisons will match empty array and empty object `source`
  24873. * values against any array or object value, respectively. See `_.isEqual`
  24874. * for a list of supported value comparisons.
  24875. *
  24876. * @static
  24877. * @memberOf _
  24878. * @since 3.0.0
  24879. * @category Lang
  24880. * @param {Object} object The object to inspect.
  24881. * @param {Object} source The object of property values to match.
  24882. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24883. * @example
  24884. *
  24885. * var object = { 'a': 1, 'b': 2 };
  24886. *
  24887. * _.isMatch(object, { 'b': 2 });
  24888. * // => true
  24889. *
  24890. * _.isMatch(object, { 'b': 1 });
  24891. * // => false
  24892. */
  24893. function isMatch(object, source) {
  24894. return object === source || baseIsMatch(object, source, getMatchData(source));
  24895. }
  24896. /**
  24897. * This method is like `_.isMatch` except that it accepts `customizer` which
  24898. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24899. * are handled by the method instead. The `customizer` is invoked with five
  24900. * arguments: (objValue, srcValue, index|key, object, source).
  24901. *
  24902. * @static
  24903. * @memberOf _
  24904. * @since 4.0.0
  24905. * @category Lang
  24906. * @param {Object} object The object to inspect.
  24907. * @param {Object} source The object of property values to match.
  24908. * @param {Function} [customizer] The function to customize comparisons.
  24909. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24910. * @example
  24911. *
  24912. * function isGreeting(value) {
  24913. * return /^h(?:i|ello)$/.test(value);
  24914. * }
  24915. *
  24916. * function customizer(objValue, srcValue) {
  24917. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  24918. * return true;
  24919. * }
  24920. * }
  24921. *
  24922. * var object = { 'greeting': 'hello' };
  24923. * var source = { 'greeting': 'hi' };
  24924. *
  24925. * _.isMatchWith(object, source, customizer);
  24926. * // => true
  24927. */
  24928. function isMatchWith(object, source, customizer) {
  24929. customizer = typeof customizer == 'function' ? customizer : undefined;
  24930. return baseIsMatch(object, source, getMatchData(source), customizer);
  24931. }
  24932. /**
  24933. * Checks if `value` is `NaN`.
  24934. *
  24935. * **Note:** This method is based on
  24936. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  24937. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  24938. * `undefined` and other non-number values.
  24939. *
  24940. * @static
  24941. * @memberOf _
  24942. * @since 0.1.0
  24943. * @category Lang
  24944. * @param {*} value The value to check.
  24945. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  24946. * @example
  24947. *
  24948. * _.isNaN(NaN);
  24949. * // => true
  24950. *
  24951. * _.isNaN(new Number(NaN));
  24952. * // => true
  24953. *
  24954. * isNaN(undefined);
  24955. * // => true
  24956. *
  24957. * _.isNaN(undefined);
  24958. * // => false
  24959. */
  24960. function isNaN(value) {
  24961. // An `NaN` primitive is the only value that is not equal to itself.
  24962. // Perform the `toStringTag` check first to avoid errors with some
  24963. // ActiveX objects in IE.
  24964. return isNumber(value) && value != +value;
  24965. }
  24966. /**
  24967. * Checks if `value` is a pristine native function.
  24968. *
  24969. * **Note:** This method can't reliably detect native functions in the presence
  24970. * of the core-js package because core-js circumvents this kind of detection.
  24971. * Despite multiple requests, the core-js maintainer has made it clear: any
  24972. * attempt to fix the detection will be obstructed. As a result, we're left
  24973. * with little choice but to throw an error. Unfortunately, this also affects
  24974. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  24975. * which rely on core-js.
  24976. *
  24977. * @static
  24978. * @memberOf _
  24979. * @since 3.0.0
  24980. * @category Lang
  24981. * @param {*} value The value to check.
  24982. * @returns {boolean} Returns `true` if `value` is a native function,
  24983. * else `false`.
  24984. * @example
  24985. *
  24986. * _.isNative(Array.prototype.push);
  24987. * // => true
  24988. *
  24989. * _.isNative(_);
  24990. * // => false
  24991. */
  24992. function isNative(value) {
  24993. if (isMaskable(value)) {
  24994. throw new Error(CORE_ERROR_TEXT);
  24995. }
  24996. return baseIsNative(value);
  24997. }
  24998. /**
  24999. * Checks if `value` is `null`.
  25000. *
  25001. * @static
  25002. * @memberOf _
  25003. * @since 0.1.0
  25004. * @category Lang
  25005. * @param {*} value The value to check.
  25006. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  25007. * @example
  25008. *
  25009. * _.isNull(null);
  25010. * // => true
  25011. *
  25012. * _.isNull(void 0);
  25013. * // => false
  25014. */
  25015. function isNull(value) {
  25016. return value === null;
  25017. }
  25018. /**
  25019. * Checks if `value` is `null` or `undefined`.
  25020. *
  25021. * @static
  25022. * @memberOf _
  25023. * @since 4.0.0
  25024. * @category Lang
  25025. * @param {*} value The value to check.
  25026. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  25027. * @example
  25028. *
  25029. * _.isNil(null);
  25030. * // => true
  25031. *
  25032. * _.isNil(void 0);
  25033. * // => true
  25034. *
  25035. * _.isNil(NaN);
  25036. * // => false
  25037. */
  25038. function isNil(value) {
  25039. return value == null;
  25040. }
  25041. /**
  25042. * Checks if `value` is classified as a `Number` primitive or object.
  25043. *
  25044. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  25045. * classified as numbers, use the `_.isFinite` method.
  25046. *
  25047. * @static
  25048. * @memberOf _
  25049. * @since 0.1.0
  25050. * @category Lang
  25051. * @param {*} value The value to check.
  25052. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  25053. * @example
  25054. *
  25055. * _.isNumber(3);
  25056. * // => true
  25057. *
  25058. * _.isNumber(Number.MIN_VALUE);
  25059. * // => true
  25060. *
  25061. * _.isNumber(Infinity);
  25062. * // => true
  25063. *
  25064. * _.isNumber('3');
  25065. * // => false
  25066. */
  25067. function isNumber(value) {
  25068. return typeof value == 'number' ||
  25069. (isObjectLike(value) && baseGetTag(value) == numberTag);
  25070. }
  25071. /**
  25072. * Checks if `value` is a plain object, that is, an object created by the
  25073. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  25074. *
  25075. * @static
  25076. * @memberOf _
  25077. * @since 0.8.0
  25078. * @category Lang
  25079. * @param {*} value The value to check.
  25080. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  25081. * @example
  25082. *
  25083. * function Foo() {
  25084. * this.a = 1;
  25085. * }
  25086. *
  25087. * _.isPlainObject(new Foo);
  25088. * // => false
  25089. *
  25090. * _.isPlainObject([1, 2, 3]);
  25091. * // => false
  25092. *
  25093. * _.isPlainObject({ 'x': 0, 'y': 0 });
  25094. * // => true
  25095. *
  25096. * _.isPlainObject(Object.create(null));
  25097. * // => true
  25098. */
  25099. function isPlainObject(value) {
  25100. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  25101. return false;
  25102. }
  25103. var proto = getPrototype(value);
  25104. if (proto === null) {
  25105. return true;
  25106. }
  25107. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  25108. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  25109. funcToString.call(Ctor) == objectCtorString;
  25110. }
  25111. /**
  25112. * Checks if `value` is classified as a `RegExp` object.
  25113. *
  25114. * @static
  25115. * @memberOf _
  25116. * @since 0.1.0
  25117. * @category Lang
  25118. * @param {*} value The value to check.
  25119. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  25120. * @example
  25121. *
  25122. * _.isRegExp(/abc/);
  25123. * // => true
  25124. *
  25125. * _.isRegExp('/abc/');
  25126. * // => false
  25127. */
  25128. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  25129. /**
  25130. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  25131. * double precision number which isn't the result of a rounded unsafe integer.
  25132. *
  25133. * **Note:** This method is based on
  25134. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  25135. *
  25136. * @static
  25137. * @memberOf _
  25138. * @since 4.0.0
  25139. * @category Lang
  25140. * @param {*} value The value to check.
  25141. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  25142. * @example
  25143. *
  25144. * _.isSafeInteger(3);
  25145. * // => true
  25146. *
  25147. * _.isSafeInteger(Number.MIN_VALUE);
  25148. * // => false
  25149. *
  25150. * _.isSafeInteger(Infinity);
  25151. * // => false
  25152. *
  25153. * _.isSafeInteger('3');
  25154. * // => false
  25155. */
  25156. function isSafeInteger(value) {
  25157. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  25158. }
  25159. /**
  25160. * Checks if `value` is classified as a `Set` object.
  25161. *
  25162. * @static
  25163. * @memberOf _
  25164. * @since 4.3.0
  25165. * @category Lang
  25166. * @param {*} value The value to check.
  25167. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  25168. * @example
  25169. *
  25170. * _.isSet(new Set);
  25171. * // => true
  25172. *
  25173. * _.isSet(new WeakSet);
  25174. * // => false
  25175. */
  25176. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  25177. /**
  25178. * Checks if `value` is classified as a `String` primitive or object.
  25179. *
  25180. * @static
  25181. * @since 0.1.0
  25182. * @memberOf _
  25183. * @category Lang
  25184. * @param {*} value The value to check.
  25185. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  25186. * @example
  25187. *
  25188. * _.isString('abc');
  25189. * // => true
  25190. *
  25191. * _.isString(1);
  25192. * // => false
  25193. */
  25194. function isString(value) {
  25195. return typeof value == 'string' ||
  25196. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  25197. }
  25198. /**
  25199. * Checks if `value` is classified as a `Symbol` primitive or object.
  25200. *
  25201. * @static
  25202. * @memberOf _
  25203. * @since 4.0.0
  25204. * @category Lang
  25205. * @param {*} value The value to check.
  25206. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  25207. * @example
  25208. *
  25209. * _.isSymbol(Symbol.iterator);
  25210. * // => true
  25211. *
  25212. * _.isSymbol('abc');
  25213. * // => false
  25214. */
  25215. function isSymbol(value) {
  25216. return typeof value == 'symbol' ||
  25217. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  25218. }
  25219. /**
  25220. * Checks if `value` is classified as a typed array.
  25221. *
  25222. * @static
  25223. * @memberOf _
  25224. * @since 3.0.0
  25225. * @category Lang
  25226. * @param {*} value The value to check.
  25227. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  25228. * @example
  25229. *
  25230. * _.isTypedArray(new Uint8Array);
  25231. * // => true
  25232. *
  25233. * _.isTypedArray([]);
  25234. * // => false
  25235. */
  25236. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  25237. /**
  25238. * Checks if `value` is `undefined`.
  25239. *
  25240. * @static
  25241. * @since 0.1.0
  25242. * @memberOf _
  25243. * @category Lang
  25244. * @param {*} value The value to check.
  25245. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  25246. * @example
  25247. *
  25248. * _.isUndefined(void 0);
  25249. * // => true
  25250. *
  25251. * _.isUndefined(null);
  25252. * // => false
  25253. */
  25254. function isUndefined(value) {
  25255. return value === undefined;
  25256. }
  25257. /**
  25258. * Checks if `value` is classified as a `WeakMap` object.
  25259. *
  25260. * @static
  25261. * @memberOf _
  25262. * @since 4.3.0
  25263. * @category Lang
  25264. * @param {*} value The value to check.
  25265. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  25266. * @example
  25267. *
  25268. * _.isWeakMap(new WeakMap);
  25269. * // => true
  25270. *
  25271. * _.isWeakMap(new Map);
  25272. * // => false
  25273. */
  25274. function isWeakMap(value) {
  25275. return isObjectLike(value) && getTag(value) == weakMapTag;
  25276. }
  25277. /**
  25278. * Checks if `value` is classified as a `WeakSet` object.
  25279. *
  25280. * @static
  25281. * @memberOf _
  25282. * @since 4.3.0
  25283. * @category Lang
  25284. * @param {*} value The value to check.
  25285. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  25286. * @example
  25287. *
  25288. * _.isWeakSet(new WeakSet);
  25289. * // => true
  25290. *
  25291. * _.isWeakSet(new Set);
  25292. * // => false
  25293. */
  25294. function isWeakSet(value) {
  25295. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  25296. }
  25297. /**
  25298. * Checks if `value` is less than `other`.
  25299. *
  25300. * @static
  25301. * @memberOf _
  25302. * @since 3.9.0
  25303. * @category Lang
  25304. * @param {*} value The value to compare.
  25305. * @param {*} other The other value to compare.
  25306. * @returns {boolean} Returns `true` if `value` is less than `other`,
  25307. * else `false`.
  25308. * @see _.gt
  25309. * @example
  25310. *
  25311. * _.lt(1, 3);
  25312. * // => true
  25313. *
  25314. * _.lt(3, 3);
  25315. * // => false
  25316. *
  25317. * _.lt(3, 1);
  25318. * // => false
  25319. */
  25320. var lt = createRelationalOperation(baseLt);
  25321. /**
  25322. * Checks if `value` is less than or equal to `other`.
  25323. *
  25324. * @static
  25325. * @memberOf _
  25326. * @since 3.9.0
  25327. * @category Lang
  25328. * @param {*} value The value to compare.
  25329. * @param {*} other The other value to compare.
  25330. * @returns {boolean} Returns `true` if `value` is less than or equal to
  25331. * `other`, else `false`.
  25332. * @see _.gte
  25333. * @example
  25334. *
  25335. * _.lte(1, 3);
  25336. * // => true
  25337. *
  25338. * _.lte(3, 3);
  25339. * // => true
  25340. *
  25341. * _.lte(3, 1);
  25342. * // => false
  25343. */
  25344. var lte = createRelationalOperation(function(value, other) {
  25345. return value <= other;
  25346. });
  25347. /**
  25348. * Converts `value` to an array.
  25349. *
  25350. * @static
  25351. * @since 0.1.0
  25352. * @memberOf _
  25353. * @category Lang
  25354. * @param {*} value The value to convert.
  25355. * @returns {Array} Returns the converted array.
  25356. * @example
  25357. *
  25358. * _.toArray({ 'a': 1, 'b': 2 });
  25359. * // => [1, 2]
  25360. *
  25361. * _.toArray('abc');
  25362. * // => ['a', 'b', 'c']
  25363. *
  25364. * _.toArray(1);
  25365. * // => []
  25366. *
  25367. * _.toArray(null);
  25368. * // => []
  25369. */
  25370. function toArray(value) {
  25371. if (!value) {
  25372. return [];
  25373. }
  25374. if (isArrayLike(value)) {
  25375. return isString(value) ? stringToArray(value) : copyArray(value);
  25376. }
  25377. if (symIterator && value[symIterator]) {
  25378. return iteratorToArray(value[symIterator]());
  25379. }
  25380. var tag = getTag(value),
  25381. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  25382. return func(value);
  25383. }
  25384. /**
  25385. * Converts `value` to a finite number.
  25386. *
  25387. * @static
  25388. * @memberOf _
  25389. * @since 4.12.0
  25390. * @category Lang
  25391. * @param {*} value The value to convert.
  25392. * @returns {number} Returns the converted number.
  25393. * @example
  25394. *
  25395. * _.toFinite(3.2);
  25396. * // => 3.2
  25397. *
  25398. * _.toFinite(Number.MIN_VALUE);
  25399. * // => 5e-324
  25400. *
  25401. * _.toFinite(Infinity);
  25402. * // => 1.7976931348623157e+308
  25403. *
  25404. * _.toFinite('3.2');
  25405. * // => 3.2
  25406. */
  25407. function toFinite(value) {
  25408. if (!value) {
  25409. return value === 0 ? value : 0;
  25410. }
  25411. value = toNumber(value);
  25412. if (value === INFINITY || value === -INFINITY) {
  25413. var sign = (value < 0 ? -1 : 1);
  25414. return sign * MAX_INTEGER;
  25415. }
  25416. return value === value ? value : 0;
  25417. }
  25418. /**
  25419. * Converts `value` to an integer.
  25420. *
  25421. * **Note:** This method is loosely based on
  25422. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  25423. *
  25424. * @static
  25425. * @memberOf _
  25426. * @since 4.0.0
  25427. * @category Lang
  25428. * @param {*} value The value to convert.
  25429. * @returns {number} Returns the converted integer.
  25430. * @example
  25431. *
  25432. * _.toInteger(3.2);
  25433. * // => 3
  25434. *
  25435. * _.toInteger(Number.MIN_VALUE);
  25436. * // => 0
  25437. *
  25438. * _.toInteger(Infinity);
  25439. * // => 1.7976931348623157e+308
  25440. *
  25441. * _.toInteger('3.2');
  25442. * // => 3
  25443. */
  25444. function toInteger(value) {
  25445. var result = toFinite(value),
  25446. remainder = result % 1;
  25447. return result === result ? (remainder ? result - remainder : result) : 0;
  25448. }
  25449. /**
  25450. * Converts `value` to an integer suitable for use as the length of an
  25451. * array-like object.
  25452. *
  25453. * **Note:** This method is based on
  25454. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  25455. *
  25456. * @static
  25457. * @memberOf _
  25458. * @since 4.0.0
  25459. * @category Lang
  25460. * @param {*} value The value to convert.
  25461. * @returns {number} Returns the converted integer.
  25462. * @example
  25463. *
  25464. * _.toLength(3.2);
  25465. * // => 3
  25466. *
  25467. * _.toLength(Number.MIN_VALUE);
  25468. * // => 0
  25469. *
  25470. * _.toLength(Infinity);
  25471. * // => 4294967295
  25472. *
  25473. * _.toLength('3.2');
  25474. * // => 3
  25475. */
  25476. function toLength(value) {
  25477. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25478. }
  25479. /**
  25480. * Converts `value` to a number.
  25481. *
  25482. * @static
  25483. * @memberOf _
  25484. * @since 4.0.0
  25485. * @category Lang
  25486. * @param {*} value The value to process.
  25487. * @returns {number} Returns the number.
  25488. * @example
  25489. *
  25490. * _.toNumber(3.2);
  25491. * // => 3.2
  25492. *
  25493. * _.toNumber(Number.MIN_VALUE);
  25494. * // => 5e-324
  25495. *
  25496. * _.toNumber(Infinity);
  25497. * // => Infinity
  25498. *
  25499. * _.toNumber('3.2');
  25500. * // => 3.2
  25501. */
  25502. function toNumber(value) {
  25503. if (typeof value == 'number') {
  25504. return value;
  25505. }
  25506. if (isSymbol(value)) {
  25507. return NAN;
  25508. }
  25509. if (isObject(value)) {
  25510. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25511. value = isObject(other) ? (other + '') : other;
  25512. }
  25513. if (typeof value != 'string') {
  25514. return value === 0 ? value : +value;
  25515. }
  25516. value = value.replace(reTrim, '');
  25517. var isBinary = reIsBinary.test(value);
  25518. return (isBinary || reIsOctal.test(value))
  25519. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25520. : (reIsBadHex.test(value) ? NAN : +value);
  25521. }
  25522. /**
  25523. * Converts `value` to a plain object flattening inherited enumerable string
  25524. * keyed properties of `value` to own properties of the plain object.
  25525. *
  25526. * @static
  25527. * @memberOf _
  25528. * @since 3.0.0
  25529. * @category Lang
  25530. * @param {*} value The value to convert.
  25531. * @returns {Object} Returns the converted plain object.
  25532. * @example
  25533. *
  25534. * function Foo() {
  25535. * this.b = 2;
  25536. * }
  25537. *
  25538. * Foo.prototype.c = 3;
  25539. *
  25540. * _.assign({ 'a': 1 }, new Foo);
  25541. * // => { 'a': 1, 'b': 2 }
  25542. *
  25543. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25544. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25545. */
  25546. function toPlainObject(value) {
  25547. return copyObject(value, keysIn(value));
  25548. }
  25549. /**
  25550. * Converts `value` to a safe integer. A safe integer can be compared and
  25551. * represented correctly.
  25552. *
  25553. * @static
  25554. * @memberOf _
  25555. * @since 4.0.0
  25556. * @category Lang
  25557. * @param {*} value The value to convert.
  25558. * @returns {number} Returns the converted integer.
  25559. * @example
  25560. *
  25561. * _.toSafeInteger(3.2);
  25562. * // => 3
  25563. *
  25564. * _.toSafeInteger(Number.MIN_VALUE);
  25565. * // => 0
  25566. *
  25567. * _.toSafeInteger(Infinity);
  25568. * // => 9007199254740991
  25569. *
  25570. * _.toSafeInteger('3.2');
  25571. * // => 3
  25572. */
  25573. function toSafeInteger(value) {
  25574. return value
  25575. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25576. : (value === 0 ? value : 0);
  25577. }
  25578. /**
  25579. * Converts `value` to a string. An empty string is returned for `null`
  25580. * and `undefined` values. The sign of `-0` is preserved.
  25581. *
  25582. * @static
  25583. * @memberOf _
  25584. * @since 4.0.0
  25585. * @category Lang
  25586. * @param {*} value The value to convert.
  25587. * @returns {string} Returns the converted string.
  25588. * @example
  25589. *
  25590. * _.toString(null);
  25591. * // => ''
  25592. *
  25593. * _.toString(-0);
  25594. * // => '-0'
  25595. *
  25596. * _.toString([1, 2, 3]);
  25597. * // => '1,2,3'
  25598. */
  25599. function toString(value) {
  25600. return value == null ? '' : baseToString(value);
  25601. }
  25602. /*------------------------------------------------------------------------*/
  25603. /**
  25604. * Assigns own enumerable string keyed properties of source objects to the
  25605. * destination object. Source objects are applied from left to right.
  25606. * Subsequent sources overwrite property assignments of previous sources.
  25607. *
  25608. * **Note:** This method mutates `object` and is loosely based on
  25609. * [`Object.assign`](https://mdn.io/Object/assign).
  25610. *
  25611. * @static
  25612. * @memberOf _
  25613. * @since 0.10.0
  25614. * @category Object
  25615. * @param {Object} object The destination object.
  25616. * @param {...Object} [sources] The source objects.
  25617. * @returns {Object} Returns `object`.
  25618. * @see _.assignIn
  25619. * @example
  25620. *
  25621. * function Foo() {
  25622. * this.a = 1;
  25623. * }
  25624. *
  25625. * function Bar() {
  25626. * this.c = 3;
  25627. * }
  25628. *
  25629. * Foo.prototype.b = 2;
  25630. * Bar.prototype.d = 4;
  25631. *
  25632. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25633. * // => { 'a': 1, 'c': 3 }
  25634. */
  25635. var assign = createAssigner(function(object, source) {
  25636. if (isPrototype(source) || isArrayLike(source)) {
  25637. copyObject(source, keys(source), object);
  25638. return;
  25639. }
  25640. for (var key in source) {
  25641. if (hasOwnProperty.call(source, key)) {
  25642. assignValue(object, key, source[key]);
  25643. }
  25644. }
  25645. });
  25646. /**
  25647. * This method is like `_.assign` except that it iterates over own and
  25648. * inherited source properties.
  25649. *
  25650. * **Note:** This method mutates `object`.
  25651. *
  25652. * @static
  25653. * @memberOf _
  25654. * @since 4.0.0
  25655. * @alias extend
  25656. * @category Object
  25657. * @param {Object} object The destination object.
  25658. * @param {...Object} [sources] The source objects.
  25659. * @returns {Object} Returns `object`.
  25660. * @see _.assign
  25661. * @example
  25662. *
  25663. * function Foo() {
  25664. * this.a = 1;
  25665. * }
  25666. *
  25667. * function Bar() {
  25668. * this.c = 3;
  25669. * }
  25670. *
  25671. * Foo.prototype.b = 2;
  25672. * Bar.prototype.d = 4;
  25673. *
  25674. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25675. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25676. */
  25677. var assignIn = createAssigner(function(object, source) {
  25678. copyObject(source, keysIn(source), object);
  25679. });
  25680. /**
  25681. * This method is like `_.assignIn` except that it accepts `customizer`
  25682. * which is invoked to produce the assigned values. If `customizer` returns
  25683. * `undefined`, assignment is handled by the method instead. The `customizer`
  25684. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25685. *
  25686. * **Note:** This method mutates `object`.
  25687. *
  25688. * @static
  25689. * @memberOf _
  25690. * @since 4.0.0
  25691. * @alias extendWith
  25692. * @category Object
  25693. * @param {Object} object The destination object.
  25694. * @param {...Object} sources The source objects.
  25695. * @param {Function} [customizer] The function to customize assigned values.
  25696. * @returns {Object} Returns `object`.
  25697. * @see _.assignWith
  25698. * @example
  25699. *
  25700. * function customizer(objValue, srcValue) {
  25701. * return _.isUndefined(objValue) ? srcValue : objValue;
  25702. * }
  25703. *
  25704. * var defaults = _.partialRight(_.assignInWith, customizer);
  25705. *
  25706. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25707. * // => { 'a': 1, 'b': 2 }
  25708. */
  25709. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25710. copyObject(source, keysIn(source), object, customizer);
  25711. });
  25712. /**
  25713. * This method is like `_.assign` except that it accepts `customizer`
  25714. * which is invoked to produce the assigned values. If `customizer` returns
  25715. * `undefined`, assignment is handled by the method instead. The `customizer`
  25716. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25717. *
  25718. * **Note:** This method mutates `object`.
  25719. *
  25720. * @static
  25721. * @memberOf _
  25722. * @since 4.0.0
  25723. * @category Object
  25724. * @param {Object} object The destination object.
  25725. * @param {...Object} sources The source objects.
  25726. * @param {Function} [customizer] The function to customize assigned values.
  25727. * @returns {Object} Returns `object`.
  25728. * @see _.assignInWith
  25729. * @example
  25730. *
  25731. * function customizer(objValue, srcValue) {
  25732. * return _.isUndefined(objValue) ? srcValue : objValue;
  25733. * }
  25734. *
  25735. * var defaults = _.partialRight(_.assignWith, customizer);
  25736. *
  25737. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25738. * // => { 'a': 1, 'b': 2 }
  25739. */
  25740. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25741. copyObject(source, keys(source), object, customizer);
  25742. });
  25743. /**
  25744. * Creates an array of values corresponding to `paths` of `object`.
  25745. *
  25746. * @static
  25747. * @memberOf _
  25748. * @since 1.0.0
  25749. * @category Object
  25750. * @param {Object} object The object to iterate over.
  25751. * @param {...(string|string[])} [paths] The property paths to pick.
  25752. * @returns {Array} Returns the picked values.
  25753. * @example
  25754. *
  25755. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25756. *
  25757. * _.at(object, ['a[0].b.c', 'a[1]']);
  25758. * // => [3, 4]
  25759. */
  25760. var at = flatRest(baseAt);
  25761. /**
  25762. * Creates an object that inherits from the `prototype` object. If a
  25763. * `properties` object is given, its own enumerable string keyed properties
  25764. * are assigned to the created object.
  25765. *
  25766. * @static
  25767. * @memberOf _
  25768. * @since 2.3.0
  25769. * @category Object
  25770. * @param {Object} prototype The object to inherit from.
  25771. * @param {Object} [properties] The properties to assign to the object.
  25772. * @returns {Object} Returns the new object.
  25773. * @example
  25774. *
  25775. * function Shape() {
  25776. * this.x = 0;
  25777. * this.y = 0;
  25778. * }
  25779. *
  25780. * function Circle() {
  25781. * Shape.call(this);
  25782. * }
  25783. *
  25784. * Circle.prototype = _.create(Shape.prototype, {
  25785. * 'constructor': Circle
  25786. * });
  25787. *
  25788. * var circle = new Circle;
  25789. * circle instanceof Circle;
  25790. * // => true
  25791. *
  25792. * circle instanceof Shape;
  25793. * // => true
  25794. */
  25795. function create(prototype, properties) {
  25796. var result = baseCreate(prototype);
  25797. return properties == null ? result : baseAssign(result, properties);
  25798. }
  25799. /**
  25800. * Assigns own and inherited enumerable string keyed properties of source
  25801. * objects to the destination object for all destination properties that
  25802. * resolve to `undefined`. Source objects are applied from left to right.
  25803. * Once a property is set, additional values of the same property are ignored.
  25804. *
  25805. * **Note:** This method mutates `object`.
  25806. *
  25807. * @static
  25808. * @since 0.1.0
  25809. * @memberOf _
  25810. * @category Object
  25811. * @param {Object} object The destination object.
  25812. * @param {...Object} [sources] The source objects.
  25813. * @returns {Object} Returns `object`.
  25814. * @see _.defaultsDeep
  25815. * @example
  25816. *
  25817. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25818. * // => { 'a': 1, 'b': 2 }
  25819. */
  25820. var defaults = baseRest(function(object, sources) {
  25821. object = Object(object);
  25822. var index = -1;
  25823. var length = sources.length;
  25824. var guard = length > 2 ? sources[2] : undefined;
  25825. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25826. length = 1;
  25827. }
  25828. while (++index < length) {
  25829. var source = sources[index];
  25830. var props = keysIn(source);
  25831. var propsIndex = -1;
  25832. var propsLength = props.length;
  25833. while (++propsIndex < propsLength) {
  25834. var key = props[propsIndex];
  25835. var value = object[key];
  25836. if (value === undefined ||
  25837. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25838. object[key] = source[key];
  25839. }
  25840. }
  25841. }
  25842. return object;
  25843. });
  25844. /**
  25845. * This method is like `_.defaults` except that it recursively assigns
  25846. * default properties.
  25847. *
  25848. * **Note:** This method mutates `object`.
  25849. *
  25850. * @static
  25851. * @memberOf _
  25852. * @since 3.10.0
  25853. * @category Object
  25854. * @param {Object} object The destination object.
  25855. * @param {...Object} [sources] The source objects.
  25856. * @returns {Object} Returns `object`.
  25857. * @see _.defaults
  25858. * @example
  25859. *
  25860. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  25861. * // => { 'a': { 'b': 2, 'c': 3 } }
  25862. */
  25863. var defaultsDeep = baseRest(function(args) {
  25864. args.push(undefined, customDefaultsMerge);
  25865. return apply(mergeWith, undefined, args);
  25866. });
  25867. /**
  25868. * This method is like `_.find` except that it returns the key of the first
  25869. * element `predicate` returns truthy for instead of the element itself.
  25870. *
  25871. * @static
  25872. * @memberOf _
  25873. * @since 1.1.0
  25874. * @category Object
  25875. * @param {Object} object The object to inspect.
  25876. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25877. * @returns {string|undefined} Returns the key of the matched element,
  25878. * else `undefined`.
  25879. * @example
  25880. *
  25881. * var users = {
  25882. * 'barney': { 'age': 36, 'active': true },
  25883. * 'fred': { 'age': 40, 'active': false },
  25884. * 'pebbles': { 'age': 1, 'active': true }
  25885. * };
  25886. *
  25887. * _.findKey(users, function(o) { return o.age < 40; });
  25888. * // => 'barney' (iteration order is not guaranteed)
  25889. *
  25890. * // The `_.matches` iteratee shorthand.
  25891. * _.findKey(users, { 'age': 1, 'active': true });
  25892. * // => 'pebbles'
  25893. *
  25894. * // The `_.matchesProperty` iteratee shorthand.
  25895. * _.findKey(users, ['active', false]);
  25896. * // => 'fred'
  25897. *
  25898. * // The `_.property` iteratee shorthand.
  25899. * _.findKey(users, 'active');
  25900. * // => 'barney'
  25901. */
  25902. function findKey(object, predicate) {
  25903. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  25904. }
  25905. /**
  25906. * This method is like `_.findKey` except that it iterates over elements of
  25907. * a collection in the opposite order.
  25908. *
  25909. * @static
  25910. * @memberOf _
  25911. * @since 2.0.0
  25912. * @category Object
  25913. * @param {Object} object The object to inspect.
  25914. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25915. * @returns {string|undefined} Returns the key of the matched element,
  25916. * else `undefined`.
  25917. * @example
  25918. *
  25919. * var users = {
  25920. * 'barney': { 'age': 36, 'active': true },
  25921. * 'fred': { 'age': 40, 'active': false },
  25922. * 'pebbles': { 'age': 1, 'active': true }
  25923. * };
  25924. *
  25925. * _.findLastKey(users, function(o) { return o.age < 40; });
  25926. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  25927. *
  25928. * // The `_.matches` iteratee shorthand.
  25929. * _.findLastKey(users, { 'age': 36, 'active': true });
  25930. * // => 'barney'
  25931. *
  25932. * // The `_.matchesProperty` iteratee shorthand.
  25933. * _.findLastKey(users, ['active', false]);
  25934. * // => 'fred'
  25935. *
  25936. * // The `_.property` iteratee shorthand.
  25937. * _.findLastKey(users, 'active');
  25938. * // => 'pebbles'
  25939. */
  25940. function findLastKey(object, predicate) {
  25941. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  25942. }
  25943. /**
  25944. * Iterates over own and inherited enumerable string keyed properties of an
  25945. * object and invokes `iteratee` for each property. The iteratee is invoked
  25946. * with three arguments: (value, key, object). Iteratee functions may exit
  25947. * iteration early by explicitly returning `false`.
  25948. *
  25949. * @static
  25950. * @memberOf _
  25951. * @since 0.3.0
  25952. * @category Object
  25953. * @param {Object} object The object to iterate over.
  25954. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25955. * @returns {Object} Returns `object`.
  25956. * @see _.forInRight
  25957. * @example
  25958. *
  25959. * function Foo() {
  25960. * this.a = 1;
  25961. * this.b = 2;
  25962. * }
  25963. *
  25964. * Foo.prototype.c = 3;
  25965. *
  25966. * _.forIn(new Foo, function(value, key) {
  25967. * console.log(key);
  25968. * });
  25969. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  25970. */
  25971. function forIn(object, iteratee) {
  25972. return object == null
  25973. ? object
  25974. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  25975. }
  25976. /**
  25977. * This method is like `_.forIn` except that it iterates over properties of
  25978. * `object` in the opposite order.
  25979. *
  25980. * @static
  25981. * @memberOf _
  25982. * @since 2.0.0
  25983. * @category Object
  25984. * @param {Object} object The object to iterate over.
  25985. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25986. * @returns {Object} Returns `object`.
  25987. * @see _.forIn
  25988. * @example
  25989. *
  25990. * function Foo() {
  25991. * this.a = 1;
  25992. * this.b = 2;
  25993. * }
  25994. *
  25995. * Foo.prototype.c = 3;
  25996. *
  25997. * _.forInRight(new Foo, function(value, key) {
  25998. * console.log(key);
  25999. * });
  26000. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  26001. */
  26002. function forInRight(object, iteratee) {
  26003. return object == null
  26004. ? object
  26005. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  26006. }
  26007. /**
  26008. * Iterates over own enumerable string keyed properties of an object and
  26009. * invokes `iteratee` for each property. The iteratee is invoked with three
  26010. * arguments: (value, key, object). Iteratee functions may exit iteration
  26011. * early by explicitly returning `false`.
  26012. *
  26013. * @static
  26014. * @memberOf _
  26015. * @since 0.3.0
  26016. * @category Object
  26017. * @param {Object} object The object to iterate over.
  26018. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26019. * @returns {Object} Returns `object`.
  26020. * @see _.forOwnRight
  26021. * @example
  26022. *
  26023. * function Foo() {
  26024. * this.a = 1;
  26025. * this.b = 2;
  26026. * }
  26027. *
  26028. * Foo.prototype.c = 3;
  26029. *
  26030. * _.forOwn(new Foo, function(value, key) {
  26031. * console.log(key);
  26032. * });
  26033. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26034. */
  26035. function forOwn(object, iteratee) {
  26036. return object && baseForOwn(object, getIteratee(iteratee, 3));
  26037. }
  26038. /**
  26039. * This method is like `_.forOwn` except that it iterates over properties of
  26040. * `object` in the opposite order.
  26041. *
  26042. * @static
  26043. * @memberOf _
  26044. * @since 2.0.0
  26045. * @category Object
  26046. * @param {Object} object The object to iterate over.
  26047. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26048. * @returns {Object} Returns `object`.
  26049. * @see _.forOwn
  26050. * @example
  26051. *
  26052. * function Foo() {
  26053. * this.a = 1;
  26054. * this.b = 2;
  26055. * }
  26056. *
  26057. * Foo.prototype.c = 3;
  26058. *
  26059. * _.forOwnRight(new Foo, function(value, key) {
  26060. * console.log(key);
  26061. * });
  26062. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  26063. */
  26064. function forOwnRight(object, iteratee) {
  26065. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  26066. }
  26067. /**
  26068. * Creates an array of function property names from own enumerable properties
  26069. * of `object`.
  26070. *
  26071. * @static
  26072. * @since 0.1.0
  26073. * @memberOf _
  26074. * @category Object
  26075. * @param {Object} object The object to inspect.
  26076. * @returns {Array} Returns the function names.
  26077. * @see _.functionsIn
  26078. * @example
  26079. *
  26080. * function Foo() {
  26081. * this.a = _.constant('a');
  26082. * this.b = _.constant('b');
  26083. * }
  26084. *
  26085. * Foo.prototype.c = _.constant('c');
  26086. *
  26087. * _.functions(new Foo);
  26088. * // => ['a', 'b']
  26089. */
  26090. function functions(object) {
  26091. return object == null ? [] : baseFunctions(object, keys(object));
  26092. }
  26093. /**
  26094. * Creates an array of function property names from own and inherited
  26095. * enumerable properties of `object`.
  26096. *
  26097. * @static
  26098. * @memberOf _
  26099. * @since 4.0.0
  26100. * @category Object
  26101. * @param {Object} object The object to inspect.
  26102. * @returns {Array} Returns the function names.
  26103. * @see _.functions
  26104. * @example
  26105. *
  26106. * function Foo() {
  26107. * this.a = _.constant('a');
  26108. * this.b = _.constant('b');
  26109. * }
  26110. *
  26111. * Foo.prototype.c = _.constant('c');
  26112. *
  26113. * _.functionsIn(new Foo);
  26114. * // => ['a', 'b', 'c']
  26115. */
  26116. function functionsIn(object) {
  26117. return object == null ? [] : baseFunctions(object, keysIn(object));
  26118. }
  26119. /**
  26120. * Gets the value at `path` of `object`. If the resolved value is
  26121. * `undefined`, the `defaultValue` is returned in its place.
  26122. *
  26123. * @static
  26124. * @memberOf _
  26125. * @since 3.7.0
  26126. * @category Object
  26127. * @param {Object} object The object to query.
  26128. * @param {Array|string} path The path of the property to get.
  26129. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26130. * @returns {*} Returns the resolved value.
  26131. * @example
  26132. *
  26133. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26134. *
  26135. * _.get(object, 'a[0].b.c');
  26136. * // => 3
  26137. *
  26138. * _.get(object, ['a', '0', 'b', 'c']);
  26139. * // => 3
  26140. *
  26141. * _.get(object, 'a.b.c', 'default');
  26142. * // => 'default'
  26143. */
  26144. function get(object, path, defaultValue) {
  26145. var result = object == null ? undefined : baseGet(object, path);
  26146. return result === undefined ? defaultValue : result;
  26147. }
  26148. /**
  26149. * Checks if `path` is a direct property of `object`.
  26150. *
  26151. * @static
  26152. * @since 0.1.0
  26153. * @memberOf _
  26154. * @category Object
  26155. * @param {Object} object The object to query.
  26156. * @param {Array|string} path The path to check.
  26157. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26158. * @example
  26159. *
  26160. * var object = { 'a': { 'b': 2 } };
  26161. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  26162. *
  26163. * _.has(object, 'a');
  26164. * // => true
  26165. *
  26166. * _.has(object, 'a.b');
  26167. * // => true
  26168. *
  26169. * _.has(object, ['a', 'b']);
  26170. * // => true
  26171. *
  26172. * _.has(other, 'a');
  26173. * // => false
  26174. */
  26175. function has(object, path) {
  26176. return object != null && hasPath(object, path, baseHas);
  26177. }
  26178. /**
  26179. * Checks if `path` is a direct or inherited property of `object`.
  26180. *
  26181. * @static
  26182. * @memberOf _
  26183. * @since 4.0.0
  26184. * @category Object
  26185. * @param {Object} object The object to query.
  26186. * @param {Array|string} path The path to check.
  26187. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26188. * @example
  26189. *
  26190. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  26191. *
  26192. * _.hasIn(object, 'a');
  26193. * // => true
  26194. *
  26195. * _.hasIn(object, 'a.b');
  26196. * // => true
  26197. *
  26198. * _.hasIn(object, ['a', 'b']);
  26199. * // => true
  26200. *
  26201. * _.hasIn(object, 'b');
  26202. * // => false
  26203. */
  26204. function hasIn(object, path) {
  26205. return object != null && hasPath(object, path, baseHasIn);
  26206. }
  26207. /**
  26208. * Creates an object composed of the inverted keys and values of `object`.
  26209. * If `object` contains duplicate values, subsequent values overwrite
  26210. * property assignments of previous values.
  26211. *
  26212. * @static
  26213. * @memberOf _
  26214. * @since 0.7.0
  26215. * @category Object
  26216. * @param {Object} object The object to invert.
  26217. * @returns {Object} Returns the new inverted object.
  26218. * @example
  26219. *
  26220. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26221. *
  26222. * _.invert(object);
  26223. * // => { '1': 'c', '2': 'b' }
  26224. */
  26225. var invert = createInverter(function(result, value, key) {
  26226. if (value != null &&
  26227. typeof value.toString != 'function') {
  26228. value = nativeObjectToString.call(value);
  26229. }
  26230. result[value] = key;
  26231. }, constant(identity));
  26232. /**
  26233. * This method is like `_.invert` except that the inverted object is generated
  26234. * from the results of running each element of `object` thru `iteratee`. The
  26235. * corresponding inverted value of each inverted key is an array of keys
  26236. * responsible for generating the inverted value. The iteratee is invoked
  26237. * with one argument: (value).
  26238. *
  26239. * @static
  26240. * @memberOf _
  26241. * @since 4.1.0
  26242. * @category Object
  26243. * @param {Object} object The object to invert.
  26244. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26245. * @returns {Object} Returns the new inverted object.
  26246. * @example
  26247. *
  26248. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26249. *
  26250. * _.invertBy(object);
  26251. * // => { '1': ['a', 'c'], '2': ['b'] }
  26252. *
  26253. * _.invertBy(object, function(value) {
  26254. * return 'group' + value;
  26255. * });
  26256. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  26257. */
  26258. var invertBy = createInverter(function(result, value, key) {
  26259. if (value != null &&
  26260. typeof value.toString != 'function') {
  26261. value = nativeObjectToString.call(value);
  26262. }
  26263. if (hasOwnProperty.call(result, value)) {
  26264. result[value].push(key);
  26265. } else {
  26266. result[value] = [key];
  26267. }
  26268. }, getIteratee);
  26269. /**
  26270. * Invokes the method at `path` of `object`.
  26271. *
  26272. * @static
  26273. * @memberOf _
  26274. * @since 4.0.0
  26275. * @category Object
  26276. * @param {Object} object The object to query.
  26277. * @param {Array|string} path The path of the method to invoke.
  26278. * @param {...*} [args] The arguments to invoke the method with.
  26279. * @returns {*} Returns the result of the invoked method.
  26280. * @example
  26281. *
  26282. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  26283. *
  26284. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  26285. * // => [2, 3]
  26286. */
  26287. var invoke = baseRest(baseInvoke);
  26288. /**
  26289. * Creates an array of the own enumerable property names of `object`.
  26290. *
  26291. * **Note:** Non-object values are coerced to objects. See the
  26292. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  26293. * for more details.
  26294. *
  26295. * @static
  26296. * @since 0.1.0
  26297. * @memberOf _
  26298. * @category Object
  26299. * @param {Object} object The object to query.
  26300. * @returns {Array} Returns the array of property names.
  26301. * @example
  26302. *
  26303. * function Foo() {
  26304. * this.a = 1;
  26305. * this.b = 2;
  26306. * }
  26307. *
  26308. * Foo.prototype.c = 3;
  26309. *
  26310. * _.keys(new Foo);
  26311. * // => ['a', 'b'] (iteration order is not guaranteed)
  26312. *
  26313. * _.keys('hi');
  26314. * // => ['0', '1']
  26315. */
  26316. function keys(object) {
  26317. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  26318. }
  26319. /**
  26320. * Creates an array of the own and inherited enumerable property names of `object`.
  26321. *
  26322. * **Note:** Non-object values are coerced to objects.
  26323. *
  26324. * @static
  26325. * @memberOf _
  26326. * @since 3.0.0
  26327. * @category Object
  26328. * @param {Object} object The object to query.
  26329. * @returns {Array} Returns the array of property names.
  26330. * @example
  26331. *
  26332. * function Foo() {
  26333. * this.a = 1;
  26334. * this.b = 2;
  26335. * }
  26336. *
  26337. * Foo.prototype.c = 3;
  26338. *
  26339. * _.keysIn(new Foo);
  26340. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26341. */
  26342. function keysIn(object) {
  26343. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  26344. }
  26345. /**
  26346. * The opposite of `_.mapValues`; this method creates an object with the
  26347. * same values as `object` and keys generated by running each own enumerable
  26348. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  26349. * with three arguments: (value, key, object).
  26350. *
  26351. * @static
  26352. * @memberOf _
  26353. * @since 3.8.0
  26354. * @category Object
  26355. * @param {Object} object The object to iterate over.
  26356. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26357. * @returns {Object} Returns the new mapped object.
  26358. * @see _.mapValues
  26359. * @example
  26360. *
  26361. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  26362. * return key + value;
  26363. * });
  26364. * // => { 'a1': 1, 'b2': 2 }
  26365. */
  26366. function mapKeys(object, iteratee) {
  26367. var result = {};
  26368. iteratee = getIteratee(iteratee, 3);
  26369. baseForOwn(object, function(value, key, object) {
  26370. baseAssignValue(result, iteratee(value, key, object), value);
  26371. });
  26372. return result;
  26373. }
  26374. /**
  26375. * Creates an object with the same keys as `object` and values generated
  26376. * by running each own enumerable string keyed property of `object` thru
  26377. * `iteratee`. The iteratee is invoked with three arguments:
  26378. * (value, key, object).
  26379. *
  26380. * @static
  26381. * @memberOf _
  26382. * @since 2.4.0
  26383. * @category Object
  26384. * @param {Object} object The object to iterate over.
  26385. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26386. * @returns {Object} Returns the new mapped object.
  26387. * @see _.mapKeys
  26388. * @example
  26389. *
  26390. * var users = {
  26391. * 'fred': { 'user': 'fred', 'age': 40 },
  26392. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  26393. * };
  26394. *
  26395. * _.mapValues(users, function(o) { return o.age; });
  26396. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26397. *
  26398. * // The `_.property` iteratee shorthand.
  26399. * _.mapValues(users, 'age');
  26400. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26401. */
  26402. function mapValues(object, iteratee) {
  26403. var result = {};
  26404. iteratee = getIteratee(iteratee, 3);
  26405. baseForOwn(object, function(value, key, object) {
  26406. baseAssignValue(result, key, iteratee(value, key, object));
  26407. });
  26408. return result;
  26409. }
  26410. /**
  26411. * This method is like `_.assign` except that it recursively merges own and
  26412. * inherited enumerable string keyed properties of source objects into the
  26413. * destination object. Source properties that resolve to `undefined` are
  26414. * skipped if a destination value exists. Array and plain object properties
  26415. * are merged recursively. Other objects and value types are overridden by
  26416. * assignment. Source objects are applied from left to right. Subsequent
  26417. * sources overwrite property assignments of previous sources.
  26418. *
  26419. * **Note:** This method mutates `object`.
  26420. *
  26421. * @static
  26422. * @memberOf _
  26423. * @since 0.5.0
  26424. * @category Object
  26425. * @param {Object} object The destination object.
  26426. * @param {...Object} [sources] The source objects.
  26427. * @returns {Object} Returns `object`.
  26428. * @example
  26429. *
  26430. * var object = {
  26431. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  26432. * };
  26433. *
  26434. * var other = {
  26435. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  26436. * };
  26437. *
  26438. * _.merge(object, other);
  26439. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  26440. */
  26441. var merge = createAssigner(function(object, source, srcIndex) {
  26442. baseMerge(object, source, srcIndex);
  26443. });
  26444. /**
  26445. * This method is like `_.merge` except that it accepts `customizer` which
  26446. * is invoked to produce the merged values of the destination and source
  26447. * properties. If `customizer` returns `undefined`, merging is handled by the
  26448. * method instead. The `customizer` is invoked with six arguments:
  26449. * (objValue, srcValue, key, object, source, stack).
  26450. *
  26451. * **Note:** This method mutates `object`.
  26452. *
  26453. * @static
  26454. * @memberOf _
  26455. * @since 4.0.0
  26456. * @category Object
  26457. * @param {Object} object The destination object.
  26458. * @param {...Object} sources The source objects.
  26459. * @param {Function} customizer The function to customize assigned values.
  26460. * @returns {Object} Returns `object`.
  26461. * @example
  26462. *
  26463. * function customizer(objValue, srcValue) {
  26464. * if (_.isArray(objValue)) {
  26465. * return objValue.concat(srcValue);
  26466. * }
  26467. * }
  26468. *
  26469. * var object = { 'a': [1], 'b': [2] };
  26470. * var other = { 'a': [3], 'b': [4] };
  26471. *
  26472. * _.mergeWith(object, other, customizer);
  26473. * // => { 'a': [1, 3], 'b': [2, 4] }
  26474. */
  26475. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26476. baseMerge(object, source, srcIndex, customizer);
  26477. });
  26478. /**
  26479. * The opposite of `_.pick`; this method creates an object composed of the
  26480. * own and inherited enumerable property paths of `object` that are not omitted.
  26481. *
  26482. * **Note:** This method is considerably slower than `_.pick`.
  26483. *
  26484. * @static
  26485. * @since 0.1.0
  26486. * @memberOf _
  26487. * @category Object
  26488. * @param {Object} object The source object.
  26489. * @param {...(string|string[])} [paths] The property paths to omit.
  26490. * @returns {Object} Returns the new object.
  26491. * @example
  26492. *
  26493. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26494. *
  26495. * _.omit(object, ['a', 'c']);
  26496. * // => { 'b': '2' }
  26497. */
  26498. var omit = flatRest(function(object, paths) {
  26499. var result = {};
  26500. if (object == null) {
  26501. return result;
  26502. }
  26503. var isDeep = false;
  26504. paths = arrayMap(paths, function(path) {
  26505. path = castPath(path, object);
  26506. isDeep || (isDeep = path.length > 1);
  26507. return path;
  26508. });
  26509. copyObject(object, getAllKeysIn(object), result);
  26510. if (isDeep) {
  26511. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26512. }
  26513. var length = paths.length;
  26514. while (length--) {
  26515. baseUnset(result, paths[length]);
  26516. }
  26517. return result;
  26518. });
  26519. /**
  26520. * The opposite of `_.pickBy`; this method creates an object composed of
  26521. * the own and inherited enumerable string keyed properties of `object` that
  26522. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26523. * arguments: (value, key).
  26524. *
  26525. * @static
  26526. * @memberOf _
  26527. * @since 4.0.0
  26528. * @category Object
  26529. * @param {Object} object The source object.
  26530. * @param {Function} [predicate=_.identity] The function invoked per property.
  26531. * @returns {Object} Returns the new object.
  26532. * @example
  26533. *
  26534. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26535. *
  26536. * _.omitBy(object, _.isNumber);
  26537. * // => { 'b': '2' }
  26538. */
  26539. function omitBy(object, predicate) {
  26540. return pickBy(object, negate(getIteratee(predicate)));
  26541. }
  26542. /**
  26543. * Creates an object composed of the picked `object` properties.
  26544. *
  26545. * @static
  26546. * @since 0.1.0
  26547. * @memberOf _
  26548. * @category Object
  26549. * @param {Object} object The source object.
  26550. * @param {...(string|string[])} [paths] The property paths to pick.
  26551. * @returns {Object} Returns the new object.
  26552. * @example
  26553. *
  26554. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26555. *
  26556. * _.pick(object, ['a', 'c']);
  26557. * // => { 'a': 1, 'c': 3 }
  26558. */
  26559. var pick = flatRest(function(object, paths) {
  26560. return object == null ? {} : basePick(object, paths);
  26561. });
  26562. /**
  26563. * Creates an object composed of the `object` properties `predicate` returns
  26564. * truthy for. The predicate is invoked with two arguments: (value, key).
  26565. *
  26566. * @static
  26567. * @memberOf _
  26568. * @since 4.0.0
  26569. * @category Object
  26570. * @param {Object} object The source object.
  26571. * @param {Function} [predicate=_.identity] The function invoked per property.
  26572. * @returns {Object} Returns the new object.
  26573. * @example
  26574. *
  26575. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26576. *
  26577. * _.pickBy(object, _.isNumber);
  26578. * // => { 'a': 1, 'c': 3 }
  26579. */
  26580. function pickBy(object, predicate) {
  26581. if (object == null) {
  26582. return {};
  26583. }
  26584. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26585. return [prop];
  26586. });
  26587. predicate = getIteratee(predicate);
  26588. return basePickBy(object, props, function(value, path) {
  26589. return predicate(value, path[0]);
  26590. });
  26591. }
  26592. /**
  26593. * This method is like `_.get` except that if the resolved value is a
  26594. * function it's invoked with the `this` binding of its parent object and
  26595. * its result is returned.
  26596. *
  26597. * @static
  26598. * @since 0.1.0
  26599. * @memberOf _
  26600. * @category Object
  26601. * @param {Object} object The object to query.
  26602. * @param {Array|string} path The path of the property to resolve.
  26603. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26604. * @returns {*} Returns the resolved value.
  26605. * @example
  26606. *
  26607. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26608. *
  26609. * _.result(object, 'a[0].b.c1');
  26610. * // => 3
  26611. *
  26612. * _.result(object, 'a[0].b.c2');
  26613. * // => 4
  26614. *
  26615. * _.result(object, 'a[0].b.c3', 'default');
  26616. * // => 'default'
  26617. *
  26618. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26619. * // => 'default'
  26620. */
  26621. function result(object, path, defaultValue) {
  26622. path = castPath(path, object);
  26623. var index = -1,
  26624. length = path.length;
  26625. // Ensure the loop is entered when path is empty.
  26626. if (!length) {
  26627. length = 1;
  26628. object = undefined;
  26629. }
  26630. while (++index < length) {
  26631. var value = object == null ? undefined : object[toKey(path[index])];
  26632. if (value === undefined) {
  26633. index = length;
  26634. value = defaultValue;
  26635. }
  26636. object = isFunction(value) ? value.call(object) : value;
  26637. }
  26638. return object;
  26639. }
  26640. /**
  26641. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26642. * it's created. Arrays are created for missing index properties while objects
  26643. * are created for all other missing properties. Use `_.setWith` to customize
  26644. * `path` creation.
  26645. *
  26646. * **Note:** This method mutates `object`.
  26647. *
  26648. * @static
  26649. * @memberOf _
  26650. * @since 3.7.0
  26651. * @category Object
  26652. * @param {Object} object The object to modify.
  26653. * @param {Array|string} path The path of the property to set.
  26654. * @param {*} value The value to set.
  26655. * @returns {Object} Returns `object`.
  26656. * @example
  26657. *
  26658. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26659. *
  26660. * _.set(object, 'a[0].b.c', 4);
  26661. * console.log(object.a[0].b.c);
  26662. * // => 4
  26663. *
  26664. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26665. * console.log(object.x[0].y.z);
  26666. * // => 5
  26667. */
  26668. function set(object, path, value) {
  26669. return object == null ? object : baseSet(object, path, value);
  26670. }
  26671. /**
  26672. * This method is like `_.set` except that it accepts `customizer` which is
  26673. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26674. * path creation is handled by the method instead. The `customizer` is invoked
  26675. * with three arguments: (nsValue, key, nsObject).
  26676. *
  26677. * **Note:** This method mutates `object`.
  26678. *
  26679. * @static
  26680. * @memberOf _
  26681. * @since 4.0.0
  26682. * @category Object
  26683. * @param {Object} object The object to modify.
  26684. * @param {Array|string} path The path of the property to set.
  26685. * @param {*} value The value to set.
  26686. * @param {Function} [customizer] The function to customize assigned values.
  26687. * @returns {Object} Returns `object`.
  26688. * @example
  26689. *
  26690. * var object = {};
  26691. *
  26692. * _.setWith(object, '[0][1]', 'a', Object);
  26693. * // => { '0': { '1': 'a' } }
  26694. */
  26695. function setWith(object, path, value, customizer) {
  26696. customizer = typeof customizer == 'function' ? customizer : undefined;
  26697. return object == null ? object : baseSet(object, path, value, customizer);
  26698. }
  26699. /**
  26700. * Creates an array of own enumerable string keyed-value pairs for `object`
  26701. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26702. * entries are returned.
  26703. *
  26704. * @static
  26705. * @memberOf _
  26706. * @since 4.0.0
  26707. * @alias entries
  26708. * @category Object
  26709. * @param {Object} object The object to query.
  26710. * @returns {Array} Returns the key-value pairs.
  26711. * @example
  26712. *
  26713. * function Foo() {
  26714. * this.a = 1;
  26715. * this.b = 2;
  26716. * }
  26717. *
  26718. * Foo.prototype.c = 3;
  26719. *
  26720. * _.toPairs(new Foo);
  26721. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26722. */
  26723. var toPairs = createToPairs(keys);
  26724. /**
  26725. * Creates an array of own and inherited enumerable string keyed-value pairs
  26726. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26727. * or set, its entries are returned.
  26728. *
  26729. * @static
  26730. * @memberOf _
  26731. * @since 4.0.0
  26732. * @alias entriesIn
  26733. * @category Object
  26734. * @param {Object} object The object to query.
  26735. * @returns {Array} Returns the key-value pairs.
  26736. * @example
  26737. *
  26738. * function Foo() {
  26739. * this.a = 1;
  26740. * this.b = 2;
  26741. * }
  26742. *
  26743. * Foo.prototype.c = 3;
  26744. *
  26745. * _.toPairsIn(new Foo);
  26746. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26747. */
  26748. var toPairsIn = createToPairs(keysIn);
  26749. /**
  26750. * An alternative to `_.reduce`; this method transforms `object` to a new
  26751. * `accumulator` object which is the result of running each of its own
  26752. * enumerable string keyed properties thru `iteratee`, with each invocation
  26753. * potentially mutating the `accumulator` object. If `accumulator` is not
  26754. * provided, a new object with the same `[[Prototype]]` will be used. The
  26755. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26756. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26757. *
  26758. * @static
  26759. * @memberOf _
  26760. * @since 1.3.0
  26761. * @category Object
  26762. * @param {Object} object The object to iterate over.
  26763. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26764. * @param {*} [accumulator] The custom accumulator value.
  26765. * @returns {*} Returns the accumulated value.
  26766. * @example
  26767. *
  26768. * _.transform([2, 3, 4], function(result, n) {
  26769. * result.push(n *= n);
  26770. * return n % 2 == 0;
  26771. * }, []);
  26772. * // => [4, 9]
  26773. *
  26774. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26775. * (result[value] || (result[value] = [])).push(key);
  26776. * }, {});
  26777. * // => { '1': ['a', 'c'], '2': ['b'] }
  26778. */
  26779. function transform(object, iteratee, accumulator) {
  26780. var isArr = isArray(object),
  26781. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26782. iteratee = getIteratee(iteratee, 4);
  26783. if (accumulator == null) {
  26784. var Ctor = object && object.constructor;
  26785. if (isArrLike) {
  26786. accumulator = isArr ? new Ctor : [];
  26787. }
  26788. else if (isObject(object)) {
  26789. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26790. }
  26791. else {
  26792. accumulator = {};
  26793. }
  26794. }
  26795. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26796. return iteratee(accumulator, value, index, object);
  26797. });
  26798. return accumulator;
  26799. }
  26800. /**
  26801. * Removes the property at `path` of `object`.
  26802. *
  26803. * **Note:** This method mutates `object`.
  26804. *
  26805. * @static
  26806. * @memberOf _
  26807. * @since 4.0.0
  26808. * @category Object
  26809. * @param {Object} object The object to modify.
  26810. * @param {Array|string} path The path of the property to unset.
  26811. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26812. * @example
  26813. *
  26814. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26815. * _.unset(object, 'a[0].b.c');
  26816. * // => true
  26817. *
  26818. * console.log(object);
  26819. * // => { 'a': [{ 'b': {} }] };
  26820. *
  26821. * _.unset(object, ['a', '0', 'b', 'c']);
  26822. * // => true
  26823. *
  26824. * console.log(object);
  26825. * // => { 'a': [{ 'b': {} }] };
  26826. */
  26827. function unset(object, path) {
  26828. return object == null ? true : baseUnset(object, path);
  26829. }
  26830. /**
  26831. * This method is like `_.set` except that accepts `updater` to produce the
  26832. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26833. * is invoked with one argument: (value).
  26834. *
  26835. * **Note:** This method mutates `object`.
  26836. *
  26837. * @static
  26838. * @memberOf _
  26839. * @since 4.6.0
  26840. * @category Object
  26841. * @param {Object} object The object to modify.
  26842. * @param {Array|string} path The path of the property to set.
  26843. * @param {Function} updater The function to produce the updated value.
  26844. * @returns {Object} Returns `object`.
  26845. * @example
  26846. *
  26847. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26848. *
  26849. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  26850. * console.log(object.a[0].b.c);
  26851. * // => 9
  26852. *
  26853. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  26854. * console.log(object.x[0].y.z);
  26855. * // => 0
  26856. */
  26857. function update(object, path, updater) {
  26858. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  26859. }
  26860. /**
  26861. * This method is like `_.update` except that it accepts `customizer` which is
  26862. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26863. * path creation is handled by the method instead. The `customizer` is invoked
  26864. * with three arguments: (nsValue, key, nsObject).
  26865. *
  26866. * **Note:** This method mutates `object`.
  26867. *
  26868. * @static
  26869. * @memberOf _
  26870. * @since 4.6.0
  26871. * @category Object
  26872. * @param {Object} object The object to modify.
  26873. * @param {Array|string} path The path of the property to set.
  26874. * @param {Function} updater The function to produce the updated value.
  26875. * @param {Function} [customizer] The function to customize assigned values.
  26876. * @returns {Object} Returns `object`.
  26877. * @example
  26878. *
  26879. * var object = {};
  26880. *
  26881. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  26882. * // => { '0': { '1': 'a' } }
  26883. */
  26884. function updateWith(object, path, updater, customizer) {
  26885. customizer = typeof customizer == 'function' ? customizer : undefined;
  26886. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  26887. }
  26888. /**
  26889. * Creates an array of the own enumerable string keyed property values of `object`.
  26890. *
  26891. * **Note:** Non-object values are coerced to objects.
  26892. *
  26893. * @static
  26894. * @since 0.1.0
  26895. * @memberOf _
  26896. * @category Object
  26897. * @param {Object} object The object to query.
  26898. * @returns {Array} Returns the array of property values.
  26899. * @example
  26900. *
  26901. * function Foo() {
  26902. * this.a = 1;
  26903. * this.b = 2;
  26904. * }
  26905. *
  26906. * Foo.prototype.c = 3;
  26907. *
  26908. * _.values(new Foo);
  26909. * // => [1, 2] (iteration order is not guaranteed)
  26910. *
  26911. * _.values('hi');
  26912. * // => ['h', 'i']
  26913. */
  26914. function values(object) {
  26915. return object == null ? [] : baseValues(object, keys(object));
  26916. }
  26917. /**
  26918. * Creates an array of the own and inherited enumerable string keyed property
  26919. * values of `object`.
  26920. *
  26921. * **Note:** Non-object values are coerced to objects.
  26922. *
  26923. * @static
  26924. * @memberOf _
  26925. * @since 3.0.0
  26926. * @category Object
  26927. * @param {Object} object The object to query.
  26928. * @returns {Array} Returns the array of property values.
  26929. * @example
  26930. *
  26931. * function Foo() {
  26932. * this.a = 1;
  26933. * this.b = 2;
  26934. * }
  26935. *
  26936. * Foo.prototype.c = 3;
  26937. *
  26938. * _.valuesIn(new Foo);
  26939. * // => [1, 2, 3] (iteration order is not guaranteed)
  26940. */
  26941. function valuesIn(object) {
  26942. return object == null ? [] : baseValues(object, keysIn(object));
  26943. }
  26944. /*------------------------------------------------------------------------*/
  26945. /**
  26946. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  26947. *
  26948. * @static
  26949. * @memberOf _
  26950. * @since 4.0.0
  26951. * @category Number
  26952. * @param {number} number The number to clamp.
  26953. * @param {number} [lower] The lower bound.
  26954. * @param {number} upper The upper bound.
  26955. * @returns {number} Returns the clamped number.
  26956. * @example
  26957. *
  26958. * _.clamp(-10, -5, 5);
  26959. * // => -5
  26960. *
  26961. * _.clamp(10, -5, 5);
  26962. * // => 5
  26963. */
  26964. function clamp(number, lower, upper) {
  26965. if (upper === undefined) {
  26966. upper = lower;
  26967. lower = undefined;
  26968. }
  26969. if (upper !== undefined) {
  26970. upper = toNumber(upper);
  26971. upper = upper === upper ? upper : 0;
  26972. }
  26973. if (lower !== undefined) {
  26974. lower = toNumber(lower);
  26975. lower = lower === lower ? lower : 0;
  26976. }
  26977. return baseClamp(toNumber(number), lower, upper);
  26978. }
  26979. /**
  26980. * Checks if `n` is between `start` and up to, but not including, `end`. If
  26981. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  26982. * If `start` is greater than `end` the params are swapped to support
  26983. * negative ranges.
  26984. *
  26985. * @static
  26986. * @memberOf _
  26987. * @since 3.3.0
  26988. * @category Number
  26989. * @param {number} number The number to check.
  26990. * @param {number} [start=0] The start of the range.
  26991. * @param {number} end The end of the range.
  26992. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  26993. * @see _.range, _.rangeRight
  26994. * @example
  26995. *
  26996. * _.inRange(3, 2, 4);
  26997. * // => true
  26998. *
  26999. * _.inRange(4, 8);
  27000. * // => true
  27001. *
  27002. * _.inRange(4, 2);
  27003. * // => false
  27004. *
  27005. * _.inRange(2, 2);
  27006. * // => false
  27007. *
  27008. * _.inRange(1.2, 2);
  27009. * // => true
  27010. *
  27011. * _.inRange(5.2, 4);
  27012. * // => false
  27013. *
  27014. * _.inRange(-3, -2, -6);
  27015. * // => true
  27016. */
  27017. function inRange(number, start, end) {
  27018. start = toFinite(start);
  27019. if (end === undefined) {
  27020. end = start;
  27021. start = 0;
  27022. } else {
  27023. end = toFinite(end);
  27024. }
  27025. number = toNumber(number);
  27026. return baseInRange(number, start, end);
  27027. }
  27028. /**
  27029. * Produces a random number between the inclusive `lower` and `upper` bounds.
  27030. * If only one argument is provided a number between `0` and the given number
  27031. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  27032. * floats, a floating-point number is returned instead of an integer.
  27033. *
  27034. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  27035. * floating-point values which can produce unexpected results.
  27036. *
  27037. * @static
  27038. * @memberOf _
  27039. * @since 0.7.0
  27040. * @category Number
  27041. * @param {number} [lower=0] The lower bound.
  27042. * @param {number} [upper=1] The upper bound.
  27043. * @param {boolean} [floating] Specify returning a floating-point number.
  27044. * @returns {number} Returns the random number.
  27045. * @example
  27046. *
  27047. * _.random(0, 5);
  27048. * // => an integer between 0 and 5
  27049. *
  27050. * _.random(5);
  27051. * // => also an integer between 0 and 5
  27052. *
  27053. * _.random(5, true);
  27054. * // => a floating-point number between 0 and 5
  27055. *
  27056. * _.random(1.2, 5.2);
  27057. * // => a floating-point number between 1.2 and 5.2
  27058. */
  27059. function random(lower, upper, floating) {
  27060. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  27061. upper = floating = undefined;
  27062. }
  27063. if (floating === undefined) {
  27064. if (typeof upper == 'boolean') {
  27065. floating = upper;
  27066. upper = undefined;
  27067. }
  27068. else if (typeof lower == 'boolean') {
  27069. floating = lower;
  27070. lower = undefined;
  27071. }
  27072. }
  27073. if (lower === undefined && upper === undefined) {
  27074. lower = 0;
  27075. upper = 1;
  27076. }
  27077. else {
  27078. lower = toFinite(lower);
  27079. if (upper === undefined) {
  27080. upper = lower;
  27081. lower = 0;
  27082. } else {
  27083. upper = toFinite(upper);
  27084. }
  27085. }
  27086. if (lower > upper) {
  27087. var temp = lower;
  27088. lower = upper;
  27089. upper = temp;
  27090. }
  27091. if (floating || lower % 1 || upper % 1) {
  27092. var rand = nativeRandom();
  27093. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  27094. }
  27095. return baseRandom(lower, upper);
  27096. }
  27097. /*------------------------------------------------------------------------*/
  27098. /**
  27099. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  27100. *
  27101. * @static
  27102. * @memberOf _
  27103. * @since 3.0.0
  27104. * @category String
  27105. * @param {string} [string=''] The string to convert.
  27106. * @returns {string} Returns the camel cased string.
  27107. * @example
  27108. *
  27109. * _.camelCase('Foo Bar');
  27110. * // => 'fooBar'
  27111. *
  27112. * _.camelCase('--foo-bar--');
  27113. * // => 'fooBar'
  27114. *
  27115. * _.camelCase('__FOO_BAR__');
  27116. * // => 'fooBar'
  27117. */
  27118. var camelCase = createCompounder(function(result, word, index) {
  27119. word = word.toLowerCase();
  27120. return result + (index ? capitalize(word) : word);
  27121. });
  27122. /**
  27123. * Converts the first character of `string` to upper case and the remaining
  27124. * to lower case.
  27125. *
  27126. * @static
  27127. * @memberOf _
  27128. * @since 3.0.0
  27129. * @category String
  27130. * @param {string} [string=''] The string to capitalize.
  27131. * @returns {string} Returns the capitalized string.
  27132. * @example
  27133. *
  27134. * _.capitalize('FRED');
  27135. * // => 'Fred'
  27136. */
  27137. function capitalize(string) {
  27138. return upperFirst(toString(string).toLowerCase());
  27139. }
  27140. /**
  27141. * Deburrs `string` by converting
  27142. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  27143. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  27144. * letters to basic Latin letters and removing
  27145. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  27146. *
  27147. * @static
  27148. * @memberOf _
  27149. * @since 3.0.0
  27150. * @category String
  27151. * @param {string} [string=''] The string to deburr.
  27152. * @returns {string} Returns the deburred string.
  27153. * @example
  27154. *
  27155. * _.deburr('déjà vu');
  27156. * // => 'deja vu'
  27157. */
  27158. function deburr(string) {
  27159. string = toString(string);
  27160. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  27161. }
  27162. /**
  27163. * Checks if `string` ends with the given target string.
  27164. *
  27165. * @static
  27166. * @memberOf _
  27167. * @since 3.0.0
  27168. * @category String
  27169. * @param {string} [string=''] The string to inspect.
  27170. * @param {string} [target] The string to search for.
  27171. * @param {number} [position=string.length] The position to search up to.
  27172. * @returns {boolean} Returns `true` if `string` ends with `target`,
  27173. * else `false`.
  27174. * @example
  27175. *
  27176. * _.endsWith('abc', 'c');
  27177. * // => true
  27178. *
  27179. * _.endsWith('abc', 'b');
  27180. * // => false
  27181. *
  27182. * _.endsWith('abc', 'b', 2);
  27183. * // => true
  27184. */
  27185. function endsWith(string, target, position) {
  27186. string = toString(string);
  27187. target = baseToString(target);
  27188. var length = string.length;
  27189. position = position === undefined
  27190. ? length
  27191. : baseClamp(toInteger(position), 0, length);
  27192. var end = position;
  27193. position -= target.length;
  27194. return position >= 0 && string.slice(position, end) == target;
  27195. }
  27196. /**
  27197. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  27198. * corresponding HTML entities.
  27199. *
  27200. * **Note:** No other characters are escaped. To escape additional
  27201. * characters use a third-party library like [_he_](https://mths.be/he).
  27202. *
  27203. * Though the ">" character is escaped for symmetry, characters like
  27204. * ">" and "/" don't need escaping in HTML and have no special meaning
  27205. * unless they're part of a tag or unquoted attribute value. See
  27206. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  27207. * (under "semi-related fun fact") for more details.
  27208. *
  27209. * When working with HTML you should always
  27210. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  27211. * XSS vectors.
  27212. *
  27213. * @static
  27214. * @since 0.1.0
  27215. * @memberOf _
  27216. * @category String
  27217. * @param {string} [string=''] The string to escape.
  27218. * @returns {string} Returns the escaped string.
  27219. * @example
  27220. *
  27221. * _.escape('fred, barney, & pebbles');
  27222. * // => 'fred, barney, &amp; pebbles'
  27223. */
  27224. function escape(string) {
  27225. string = toString(string);
  27226. return (string && reHasUnescapedHtml.test(string))
  27227. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  27228. : string;
  27229. }
  27230. /**
  27231. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  27232. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  27233. *
  27234. * @static
  27235. * @memberOf _
  27236. * @since 3.0.0
  27237. * @category String
  27238. * @param {string} [string=''] The string to escape.
  27239. * @returns {string} Returns the escaped string.
  27240. * @example
  27241. *
  27242. * _.escapeRegExp('[lodash](https://lodash.com/)');
  27243. * // => '\[lodash\]\(https://lodash\.com/\)'
  27244. */
  27245. function escapeRegExp(string) {
  27246. string = toString(string);
  27247. return (string && reHasRegExpChar.test(string))
  27248. ? string.replace(reRegExpChar, '\\$&')
  27249. : string;
  27250. }
  27251. /**
  27252. * Converts `string` to
  27253. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  27254. *
  27255. * @static
  27256. * @memberOf _
  27257. * @since 3.0.0
  27258. * @category String
  27259. * @param {string} [string=''] The string to convert.
  27260. * @returns {string} Returns the kebab cased string.
  27261. * @example
  27262. *
  27263. * _.kebabCase('Foo Bar');
  27264. * // => 'foo-bar'
  27265. *
  27266. * _.kebabCase('fooBar');
  27267. * // => 'foo-bar'
  27268. *
  27269. * _.kebabCase('__FOO_BAR__');
  27270. * // => 'foo-bar'
  27271. */
  27272. var kebabCase = createCompounder(function(result, word, index) {
  27273. return result + (index ? '-' : '') + word.toLowerCase();
  27274. });
  27275. /**
  27276. * Converts `string`, as space separated words, to lower case.
  27277. *
  27278. * @static
  27279. * @memberOf _
  27280. * @since 4.0.0
  27281. * @category String
  27282. * @param {string} [string=''] The string to convert.
  27283. * @returns {string} Returns the lower cased string.
  27284. * @example
  27285. *
  27286. * _.lowerCase('--Foo-Bar--');
  27287. * // => 'foo bar'
  27288. *
  27289. * _.lowerCase('fooBar');
  27290. * // => 'foo bar'
  27291. *
  27292. * _.lowerCase('__FOO_BAR__');
  27293. * // => 'foo bar'
  27294. */
  27295. var lowerCase = createCompounder(function(result, word, index) {
  27296. return result + (index ? ' ' : '') + word.toLowerCase();
  27297. });
  27298. /**
  27299. * Converts the first character of `string` to lower case.
  27300. *
  27301. * @static
  27302. * @memberOf _
  27303. * @since 4.0.0
  27304. * @category String
  27305. * @param {string} [string=''] The string to convert.
  27306. * @returns {string} Returns the converted string.
  27307. * @example
  27308. *
  27309. * _.lowerFirst('Fred');
  27310. * // => 'fred'
  27311. *
  27312. * _.lowerFirst('FRED');
  27313. * // => 'fRED'
  27314. */
  27315. var lowerFirst = createCaseFirst('toLowerCase');
  27316. /**
  27317. * Pads `string` on the left and right sides if it's shorter than `length`.
  27318. * Padding characters are truncated if they can't be evenly divided by `length`.
  27319. *
  27320. * @static
  27321. * @memberOf _
  27322. * @since 3.0.0
  27323. * @category String
  27324. * @param {string} [string=''] The string to pad.
  27325. * @param {number} [length=0] The padding length.
  27326. * @param {string} [chars=' '] The string used as padding.
  27327. * @returns {string} Returns the padded string.
  27328. * @example
  27329. *
  27330. * _.pad('abc', 8);
  27331. * // => ' abc '
  27332. *
  27333. * _.pad('abc', 8, '_-');
  27334. * // => '_-abc_-_'
  27335. *
  27336. * _.pad('abc', 3);
  27337. * // => 'abc'
  27338. */
  27339. function pad(string, length, chars) {
  27340. string = toString(string);
  27341. length = toInteger(length);
  27342. var strLength = length ? stringSize(string) : 0;
  27343. if (!length || strLength >= length) {
  27344. return string;
  27345. }
  27346. var mid = (length - strLength) / 2;
  27347. return (
  27348. createPadding(nativeFloor(mid), chars) +
  27349. string +
  27350. createPadding(nativeCeil(mid), chars)
  27351. );
  27352. }
  27353. /**
  27354. * Pads `string` on the right side if it's shorter than `length`. Padding
  27355. * characters are truncated if they exceed `length`.
  27356. *
  27357. * @static
  27358. * @memberOf _
  27359. * @since 4.0.0
  27360. * @category String
  27361. * @param {string} [string=''] The string to pad.
  27362. * @param {number} [length=0] The padding length.
  27363. * @param {string} [chars=' '] The string used as padding.
  27364. * @returns {string} Returns the padded string.
  27365. * @example
  27366. *
  27367. * _.padEnd('abc', 6);
  27368. * // => 'abc '
  27369. *
  27370. * _.padEnd('abc', 6, '_-');
  27371. * // => 'abc_-_'
  27372. *
  27373. * _.padEnd('abc', 3);
  27374. * // => 'abc'
  27375. */
  27376. function padEnd(string, length, chars) {
  27377. string = toString(string);
  27378. length = toInteger(length);
  27379. var strLength = length ? stringSize(string) : 0;
  27380. return (length && strLength < length)
  27381. ? (string + createPadding(length - strLength, chars))
  27382. : string;
  27383. }
  27384. /**
  27385. * Pads `string` on the left side if it's shorter than `length`. Padding
  27386. * characters are truncated if they exceed `length`.
  27387. *
  27388. * @static
  27389. * @memberOf _
  27390. * @since 4.0.0
  27391. * @category String
  27392. * @param {string} [string=''] The string to pad.
  27393. * @param {number} [length=0] The padding length.
  27394. * @param {string} [chars=' '] The string used as padding.
  27395. * @returns {string} Returns the padded string.
  27396. * @example
  27397. *
  27398. * _.padStart('abc', 6);
  27399. * // => ' abc'
  27400. *
  27401. * _.padStart('abc', 6, '_-');
  27402. * // => '_-_abc'
  27403. *
  27404. * _.padStart('abc', 3);
  27405. * // => 'abc'
  27406. */
  27407. function padStart(string, length, chars) {
  27408. string = toString(string);
  27409. length = toInteger(length);
  27410. var strLength = length ? stringSize(string) : 0;
  27411. return (length && strLength < length)
  27412. ? (createPadding(length - strLength, chars) + string)
  27413. : string;
  27414. }
  27415. /**
  27416. * Converts `string` to an integer of the specified radix. If `radix` is
  27417. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  27418. * hexadecimal, in which case a `radix` of `16` is used.
  27419. *
  27420. * **Note:** This method aligns with the
  27421. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  27422. *
  27423. * @static
  27424. * @memberOf _
  27425. * @since 1.1.0
  27426. * @category String
  27427. * @param {string} string The string to convert.
  27428. * @param {number} [radix=10] The radix to interpret `value` by.
  27429. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27430. * @returns {number} Returns the converted integer.
  27431. * @example
  27432. *
  27433. * _.parseInt('08');
  27434. * // => 8
  27435. *
  27436. * _.map(['6', '08', '10'], _.parseInt);
  27437. * // => [6, 8, 10]
  27438. */
  27439. function parseInt(string, radix, guard) {
  27440. if (guard || radix == null) {
  27441. radix = 0;
  27442. } else if (radix) {
  27443. radix = +radix;
  27444. }
  27445. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  27446. }
  27447. /**
  27448. * Repeats the given string `n` times.
  27449. *
  27450. * @static
  27451. * @memberOf _
  27452. * @since 3.0.0
  27453. * @category String
  27454. * @param {string} [string=''] The string to repeat.
  27455. * @param {number} [n=1] The number of times to repeat the string.
  27456. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27457. * @returns {string} Returns the repeated string.
  27458. * @example
  27459. *
  27460. * _.repeat('*', 3);
  27461. * // => '***'
  27462. *
  27463. * _.repeat('abc', 2);
  27464. * // => 'abcabc'
  27465. *
  27466. * _.repeat('abc', 0);
  27467. * // => ''
  27468. */
  27469. function repeat(string, n, guard) {
  27470. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27471. n = 1;
  27472. } else {
  27473. n = toInteger(n);
  27474. }
  27475. return baseRepeat(toString(string), n);
  27476. }
  27477. /**
  27478. * Replaces matches for `pattern` in `string` with `replacement`.
  27479. *
  27480. * **Note:** This method is based on
  27481. * [`String#replace`](https://mdn.io/String/replace).
  27482. *
  27483. * @static
  27484. * @memberOf _
  27485. * @since 4.0.0
  27486. * @category String
  27487. * @param {string} [string=''] The string to modify.
  27488. * @param {RegExp|string} pattern The pattern to replace.
  27489. * @param {Function|string} replacement The match replacement.
  27490. * @returns {string} Returns the modified string.
  27491. * @example
  27492. *
  27493. * _.replace('Hi Fred', 'Fred', 'Barney');
  27494. * // => 'Hi Barney'
  27495. */
  27496. function replace() {
  27497. var args = arguments,
  27498. string = toString(args[0]);
  27499. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27500. }
  27501. /**
  27502. * Converts `string` to
  27503. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27504. *
  27505. * @static
  27506. * @memberOf _
  27507. * @since 3.0.0
  27508. * @category String
  27509. * @param {string} [string=''] The string to convert.
  27510. * @returns {string} Returns the snake cased string.
  27511. * @example
  27512. *
  27513. * _.snakeCase('Foo Bar');
  27514. * // => 'foo_bar'
  27515. *
  27516. * _.snakeCase('fooBar');
  27517. * // => 'foo_bar'
  27518. *
  27519. * _.snakeCase('--FOO-BAR--');
  27520. * // => 'foo_bar'
  27521. */
  27522. var snakeCase = createCompounder(function(result, word, index) {
  27523. return result + (index ? '_' : '') + word.toLowerCase();
  27524. });
  27525. /**
  27526. * Splits `string` by `separator`.
  27527. *
  27528. * **Note:** This method is based on
  27529. * [`String#split`](https://mdn.io/String/split).
  27530. *
  27531. * @static
  27532. * @memberOf _
  27533. * @since 4.0.0
  27534. * @category String
  27535. * @param {string} [string=''] The string to split.
  27536. * @param {RegExp|string} separator The separator pattern to split by.
  27537. * @param {number} [limit] The length to truncate results to.
  27538. * @returns {Array} Returns the string segments.
  27539. * @example
  27540. *
  27541. * _.split('a-b-c', '-', 2);
  27542. * // => ['a', 'b']
  27543. */
  27544. function split(string, separator, limit) {
  27545. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27546. separator = limit = undefined;
  27547. }
  27548. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27549. if (!limit) {
  27550. return [];
  27551. }
  27552. string = toString(string);
  27553. if (string && (
  27554. typeof separator == 'string' ||
  27555. (separator != null && !isRegExp(separator))
  27556. )) {
  27557. separator = baseToString(separator);
  27558. if (!separator && hasUnicode(string)) {
  27559. return castSlice(stringToArray(string), 0, limit);
  27560. }
  27561. }
  27562. return string.split(separator, limit);
  27563. }
  27564. /**
  27565. * Converts `string` to
  27566. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27567. *
  27568. * @static
  27569. * @memberOf _
  27570. * @since 3.1.0
  27571. * @category String
  27572. * @param {string} [string=''] The string to convert.
  27573. * @returns {string} Returns the start cased string.
  27574. * @example
  27575. *
  27576. * _.startCase('--foo-bar--');
  27577. * // => 'Foo Bar'
  27578. *
  27579. * _.startCase('fooBar');
  27580. * // => 'Foo Bar'
  27581. *
  27582. * _.startCase('__FOO_BAR__');
  27583. * // => 'FOO BAR'
  27584. */
  27585. var startCase = createCompounder(function(result, word, index) {
  27586. return result + (index ? ' ' : '') + upperFirst(word);
  27587. });
  27588. /**
  27589. * Checks if `string` starts with the given target string.
  27590. *
  27591. * @static
  27592. * @memberOf _
  27593. * @since 3.0.0
  27594. * @category String
  27595. * @param {string} [string=''] The string to inspect.
  27596. * @param {string} [target] The string to search for.
  27597. * @param {number} [position=0] The position to search from.
  27598. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27599. * else `false`.
  27600. * @example
  27601. *
  27602. * _.startsWith('abc', 'a');
  27603. * // => true
  27604. *
  27605. * _.startsWith('abc', 'b');
  27606. * // => false
  27607. *
  27608. * _.startsWith('abc', 'b', 1);
  27609. * // => true
  27610. */
  27611. function startsWith(string, target, position) {
  27612. string = toString(string);
  27613. position = position == null
  27614. ? 0
  27615. : baseClamp(toInteger(position), 0, string.length);
  27616. target = baseToString(target);
  27617. return string.slice(position, position + target.length) == target;
  27618. }
  27619. /**
  27620. * Creates a compiled template function that can interpolate data properties
  27621. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27622. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27623. * properties may be accessed as free variables in the template. If a setting
  27624. * object is given, it takes precedence over `_.templateSettings` values.
  27625. *
  27626. * **Note:** In the development build `_.template` utilizes
  27627. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27628. * for easier debugging.
  27629. *
  27630. * For more information on precompiling templates see
  27631. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27632. *
  27633. * For more information on Chrome extension sandboxes see
  27634. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27635. *
  27636. * @static
  27637. * @since 0.1.0
  27638. * @memberOf _
  27639. * @category String
  27640. * @param {string} [string=''] The template string.
  27641. * @param {Object} [options={}] The options object.
  27642. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27643. * The HTML "escape" delimiter.
  27644. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27645. * The "evaluate" delimiter.
  27646. * @param {Object} [options.imports=_.templateSettings.imports]
  27647. * An object to import into the template as free variables.
  27648. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27649. * The "interpolate" delimiter.
  27650. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27651. * The sourceURL of the compiled template.
  27652. * @param {string} [options.variable='obj']
  27653. * The data object variable name.
  27654. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27655. * @returns {Function} Returns the compiled template function.
  27656. * @example
  27657. *
  27658. * // Use the "interpolate" delimiter to create a compiled template.
  27659. * var compiled = _.template('hello <%= user %>!');
  27660. * compiled({ 'user': 'fred' });
  27661. * // => 'hello fred!'
  27662. *
  27663. * // Use the HTML "escape" delimiter to escape data property values.
  27664. * var compiled = _.template('<b><%- value %></b>');
  27665. * compiled({ 'value': '<script>' });
  27666. * // => '<b>&lt;script&gt;</b>'
  27667. *
  27668. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27669. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27670. * compiled({ 'users': ['fred', 'barney'] });
  27671. * // => '<li>fred</li><li>barney</li>'
  27672. *
  27673. * // Use the internal `print` function in "evaluate" delimiters.
  27674. * var compiled = _.template('<% print("hello " + user); %>!');
  27675. * compiled({ 'user': 'barney' });
  27676. * // => 'hello barney!'
  27677. *
  27678. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27679. * // Disable support by replacing the "interpolate" delimiter.
  27680. * var compiled = _.template('hello ${ user }!');
  27681. * compiled({ 'user': 'pebbles' });
  27682. * // => 'hello pebbles!'
  27683. *
  27684. * // Use backslashes to treat delimiters as plain text.
  27685. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27686. * compiled({ 'value': 'ignored' });
  27687. * // => '<%- value %>'
  27688. *
  27689. * // Use the `imports` option to import `jQuery` as `jq`.
  27690. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27691. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27692. * compiled({ 'users': ['fred', 'barney'] });
  27693. * // => '<li>fred</li><li>barney</li>'
  27694. *
  27695. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27696. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27697. * compiled(data);
  27698. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27699. *
  27700. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27701. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27702. * compiled.source;
  27703. * // => function(data) {
  27704. * // var __t, __p = '';
  27705. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27706. * // return __p;
  27707. * // }
  27708. *
  27709. * // Use custom template delimiters.
  27710. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27711. * var compiled = _.template('hello {{ user }}!');
  27712. * compiled({ 'user': 'mustache' });
  27713. * // => 'hello mustache!'
  27714. *
  27715. * // Use the `source` property to inline compiled templates for meaningful
  27716. * // line numbers in error messages and stack traces.
  27717. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27718. * var JST = {\
  27719. * "main": ' + _.template(mainText).source + '\
  27720. * };\
  27721. * ');
  27722. */
  27723. function template(string, options, guard) {
  27724. // Based on John Resig's `tmpl` implementation
  27725. // (http://ejohn.org/blog/javascript-micro-templating/)
  27726. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27727. var settings = lodash.templateSettings;
  27728. if (guard && isIterateeCall(string, options, guard)) {
  27729. options = undefined;
  27730. }
  27731. string = toString(string);
  27732. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27733. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27734. importsKeys = keys(imports),
  27735. importsValues = baseValues(imports, importsKeys);
  27736. var isEscaping,
  27737. isEvaluating,
  27738. index = 0,
  27739. interpolate = options.interpolate || reNoMatch,
  27740. source = "__p += '";
  27741. // Compile the regexp to match each delimiter.
  27742. var reDelimiters = RegExp(
  27743. (options.escape || reNoMatch).source + '|' +
  27744. interpolate.source + '|' +
  27745. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27746. (options.evaluate || reNoMatch).source + '|$'
  27747. , 'g');
  27748. // Use a sourceURL for easier debugging.
  27749. // The sourceURL gets injected into the source that's eval-ed, so be careful
  27750. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  27751. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  27752. var sourceURL = '//# sourceURL=' +
  27753. (hasOwnProperty.call(options, 'sourceURL')
  27754. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  27755. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27756. ) + '\n';
  27757. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27758. interpolateValue || (interpolateValue = esTemplateValue);
  27759. // Escape characters that can't be included in string literals.
  27760. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27761. // Replace delimiters with snippets.
  27762. if (escapeValue) {
  27763. isEscaping = true;
  27764. source += "' +\n__e(" + escapeValue + ") +\n'";
  27765. }
  27766. if (evaluateValue) {
  27767. isEvaluating = true;
  27768. source += "';\n" + evaluateValue + ";\n__p += '";
  27769. }
  27770. if (interpolateValue) {
  27771. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27772. }
  27773. index = offset + match.length;
  27774. // The JS engine embedded in Adobe products needs `match` returned in
  27775. // order to produce the correct `offset` value.
  27776. return match;
  27777. });
  27778. source += "';\n";
  27779. // If `variable` is not specified wrap a with-statement around the generated
  27780. // code to add the data object to the top of the scope chain.
  27781. // Like with sourceURL, we take care to not check the option's prototype,
  27782. // as this configuration is a code injection vector.
  27783. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  27784. if (!variable) {
  27785. source = 'with (obj) {\n' + source + '\n}\n';
  27786. }
  27787. // Cleanup code by stripping empty strings.
  27788. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27789. .replace(reEmptyStringMiddle, '$1')
  27790. .replace(reEmptyStringTrailing, '$1;');
  27791. // Frame code as the function body.
  27792. source = 'function(' + (variable || 'obj') + ') {\n' +
  27793. (variable
  27794. ? ''
  27795. : 'obj || (obj = {});\n'
  27796. ) +
  27797. "var __t, __p = ''" +
  27798. (isEscaping
  27799. ? ', __e = _.escape'
  27800. : ''
  27801. ) +
  27802. (isEvaluating
  27803. ? ', __j = Array.prototype.join;\n' +
  27804. "function print() { __p += __j.call(arguments, '') }\n"
  27805. : ';\n'
  27806. ) +
  27807. source +
  27808. 'return __p\n}';
  27809. var result = attempt(function() {
  27810. return Function(importsKeys, sourceURL + 'return ' + source)
  27811. .apply(undefined, importsValues);
  27812. });
  27813. // Provide the compiled function's source by its `toString` method or
  27814. // the `source` property as a convenience for inlining compiled templates.
  27815. result.source = source;
  27816. if (isError(result)) {
  27817. throw result;
  27818. }
  27819. return result;
  27820. }
  27821. /**
  27822. * Converts `string`, as a whole, to lower case just like
  27823. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27824. *
  27825. * @static
  27826. * @memberOf _
  27827. * @since 4.0.0
  27828. * @category String
  27829. * @param {string} [string=''] The string to convert.
  27830. * @returns {string} Returns the lower cased string.
  27831. * @example
  27832. *
  27833. * _.toLower('--Foo-Bar--');
  27834. * // => '--foo-bar--'
  27835. *
  27836. * _.toLower('fooBar');
  27837. * // => 'foobar'
  27838. *
  27839. * _.toLower('__FOO_BAR__');
  27840. * // => '__foo_bar__'
  27841. */
  27842. function toLower(value) {
  27843. return toString(value).toLowerCase();
  27844. }
  27845. /**
  27846. * Converts `string`, as a whole, to upper case just like
  27847. * [String#toUpperCase](https://mdn.io/toUpperCase).
  27848. *
  27849. * @static
  27850. * @memberOf _
  27851. * @since 4.0.0
  27852. * @category String
  27853. * @param {string} [string=''] The string to convert.
  27854. * @returns {string} Returns the upper cased string.
  27855. * @example
  27856. *
  27857. * _.toUpper('--foo-bar--');
  27858. * // => '--FOO-BAR--'
  27859. *
  27860. * _.toUpper('fooBar');
  27861. * // => 'FOOBAR'
  27862. *
  27863. * _.toUpper('__foo_bar__');
  27864. * // => '__FOO_BAR__'
  27865. */
  27866. function toUpper(value) {
  27867. return toString(value).toUpperCase();
  27868. }
  27869. /**
  27870. * Removes leading and trailing whitespace or specified characters from `string`.
  27871. *
  27872. * @static
  27873. * @memberOf _
  27874. * @since 3.0.0
  27875. * @category String
  27876. * @param {string} [string=''] The string to trim.
  27877. * @param {string} [chars=whitespace] The characters to trim.
  27878. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27879. * @returns {string} Returns the trimmed string.
  27880. * @example
  27881. *
  27882. * _.trim(' abc ');
  27883. * // => 'abc'
  27884. *
  27885. * _.trim('-_-abc-_-', '_-');
  27886. * // => 'abc'
  27887. *
  27888. * _.map([' foo ', ' bar '], _.trim);
  27889. * // => ['foo', 'bar']
  27890. */
  27891. function trim(string, chars, guard) {
  27892. string = toString(string);
  27893. if (string && (guard || chars === undefined)) {
  27894. return string.replace(reTrim, '');
  27895. }
  27896. if (!string || !(chars = baseToString(chars))) {
  27897. return string;
  27898. }
  27899. var strSymbols = stringToArray(string),
  27900. chrSymbols = stringToArray(chars),
  27901. start = charsStartIndex(strSymbols, chrSymbols),
  27902. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  27903. return castSlice(strSymbols, start, end).join('');
  27904. }
  27905. /**
  27906. * Removes trailing whitespace or specified characters from `string`.
  27907. *
  27908. * @static
  27909. * @memberOf _
  27910. * @since 4.0.0
  27911. * @category String
  27912. * @param {string} [string=''] The string to trim.
  27913. * @param {string} [chars=whitespace] The characters to trim.
  27914. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27915. * @returns {string} Returns the trimmed string.
  27916. * @example
  27917. *
  27918. * _.trimEnd(' abc ');
  27919. * // => ' abc'
  27920. *
  27921. * _.trimEnd('-_-abc-_-', '_-');
  27922. * // => '-_-abc'
  27923. */
  27924. function trimEnd(string, chars, guard) {
  27925. string = toString(string);
  27926. if (string && (guard || chars === undefined)) {
  27927. return string.replace(reTrimEnd, '');
  27928. }
  27929. if (!string || !(chars = baseToString(chars))) {
  27930. return string;
  27931. }
  27932. var strSymbols = stringToArray(string),
  27933. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  27934. return castSlice(strSymbols, 0, end).join('');
  27935. }
  27936. /**
  27937. * Removes leading whitespace or specified characters from `string`.
  27938. *
  27939. * @static
  27940. * @memberOf _
  27941. * @since 4.0.0
  27942. * @category String
  27943. * @param {string} [string=''] The string to trim.
  27944. * @param {string} [chars=whitespace] The characters to trim.
  27945. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27946. * @returns {string} Returns the trimmed string.
  27947. * @example
  27948. *
  27949. * _.trimStart(' abc ');
  27950. * // => 'abc '
  27951. *
  27952. * _.trimStart('-_-abc-_-', '_-');
  27953. * // => 'abc-_-'
  27954. */
  27955. function trimStart(string, chars, guard) {
  27956. string = toString(string);
  27957. if (string && (guard || chars === undefined)) {
  27958. return string.replace(reTrimStart, '');
  27959. }
  27960. if (!string || !(chars = baseToString(chars))) {
  27961. return string;
  27962. }
  27963. var strSymbols = stringToArray(string),
  27964. start = charsStartIndex(strSymbols, stringToArray(chars));
  27965. return castSlice(strSymbols, start).join('');
  27966. }
  27967. /**
  27968. * Truncates `string` if it's longer than the given maximum string length.
  27969. * The last characters of the truncated string are replaced with the omission
  27970. * string which defaults to "...".
  27971. *
  27972. * @static
  27973. * @memberOf _
  27974. * @since 4.0.0
  27975. * @category String
  27976. * @param {string} [string=''] The string to truncate.
  27977. * @param {Object} [options={}] The options object.
  27978. * @param {number} [options.length=30] The maximum string length.
  27979. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  27980. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  27981. * @returns {string} Returns the truncated string.
  27982. * @example
  27983. *
  27984. * _.truncate('hi-diddly-ho there, neighborino');
  27985. * // => 'hi-diddly-ho there, neighbo...'
  27986. *
  27987. * _.truncate('hi-diddly-ho there, neighborino', {
  27988. * 'length': 24,
  27989. * 'separator': ' '
  27990. * });
  27991. * // => 'hi-diddly-ho there,...'
  27992. *
  27993. * _.truncate('hi-diddly-ho there, neighborino', {
  27994. * 'length': 24,
  27995. * 'separator': /,? +/
  27996. * });
  27997. * // => 'hi-diddly-ho there...'
  27998. *
  27999. * _.truncate('hi-diddly-ho there, neighborino', {
  28000. * 'omission': ' [...]'
  28001. * });
  28002. * // => 'hi-diddly-ho there, neig [...]'
  28003. */
  28004. function truncate(string, options) {
  28005. var length = DEFAULT_TRUNC_LENGTH,
  28006. omission = DEFAULT_TRUNC_OMISSION;
  28007. if (isObject(options)) {
  28008. var separator = 'separator' in options ? options.separator : separator;
  28009. length = 'length' in options ? toInteger(options.length) : length;
  28010. omission = 'omission' in options ? baseToString(options.omission) : omission;
  28011. }
  28012. string = toString(string);
  28013. var strLength = string.length;
  28014. if (hasUnicode(string)) {
  28015. var strSymbols = stringToArray(string);
  28016. strLength = strSymbols.length;
  28017. }
  28018. if (length >= strLength) {
  28019. return string;
  28020. }
  28021. var end = length - stringSize(omission);
  28022. if (end < 1) {
  28023. return omission;
  28024. }
  28025. var result = strSymbols
  28026. ? castSlice(strSymbols, 0, end).join('')
  28027. : string.slice(0, end);
  28028. if (separator === undefined) {
  28029. return result + omission;
  28030. }
  28031. if (strSymbols) {
  28032. end += (result.length - end);
  28033. }
  28034. if (isRegExp(separator)) {
  28035. if (string.slice(end).search(separator)) {
  28036. var match,
  28037. substring = result;
  28038. if (!separator.global) {
  28039. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  28040. }
  28041. separator.lastIndex = 0;
  28042. while ((match = separator.exec(substring))) {
  28043. var newEnd = match.index;
  28044. }
  28045. result = result.slice(0, newEnd === undefined ? end : newEnd);
  28046. }
  28047. } else if (string.indexOf(baseToString(separator), end) != end) {
  28048. var index = result.lastIndexOf(separator);
  28049. if (index > -1) {
  28050. result = result.slice(0, index);
  28051. }
  28052. }
  28053. return result + omission;
  28054. }
  28055. /**
  28056. * The inverse of `_.escape`; this method converts the HTML entities
  28057. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  28058. * their corresponding characters.
  28059. *
  28060. * **Note:** No other HTML entities are unescaped. To unescape additional
  28061. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  28062. *
  28063. * @static
  28064. * @memberOf _
  28065. * @since 0.6.0
  28066. * @category String
  28067. * @param {string} [string=''] The string to unescape.
  28068. * @returns {string} Returns the unescaped string.
  28069. * @example
  28070. *
  28071. * _.unescape('fred, barney, &amp; pebbles');
  28072. * // => 'fred, barney, & pebbles'
  28073. */
  28074. function unescape(string) {
  28075. string = toString(string);
  28076. return (string && reHasEscapedHtml.test(string))
  28077. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  28078. : string;
  28079. }
  28080. /**
  28081. * Converts `string`, as space separated words, to upper case.
  28082. *
  28083. * @static
  28084. * @memberOf _
  28085. * @since 4.0.0
  28086. * @category String
  28087. * @param {string} [string=''] The string to convert.
  28088. * @returns {string} Returns the upper cased string.
  28089. * @example
  28090. *
  28091. * _.upperCase('--foo-bar');
  28092. * // => 'FOO BAR'
  28093. *
  28094. * _.upperCase('fooBar');
  28095. * // => 'FOO BAR'
  28096. *
  28097. * _.upperCase('__foo_bar__');
  28098. * // => 'FOO BAR'
  28099. */
  28100. var upperCase = createCompounder(function(result, word, index) {
  28101. return result + (index ? ' ' : '') + word.toUpperCase();
  28102. });
  28103. /**
  28104. * Converts the first character of `string` to upper case.
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 4.0.0
  28109. * @category String
  28110. * @param {string} [string=''] The string to convert.
  28111. * @returns {string} Returns the converted string.
  28112. * @example
  28113. *
  28114. * _.upperFirst('fred');
  28115. * // => 'Fred'
  28116. *
  28117. * _.upperFirst('FRED');
  28118. * // => 'FRED'
  28119. */
  28120. var upperFirst = createCaseFirst('toUpperCase');
  28121. /**
  28122. * Splits `string` into an array of its words.
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 3.0.0
  28127. * @category String
  28128. * @param {string} [string=''] The string to inspect.
  28129. * @param {RegExp|string} [pattern] The pattern to match words.
  28130. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28131. * @returns {Array} Returns the words of `string`.
  28132. * @example
  28133. *
  28134. * _.words('fred, barney, & pebbles');
  28135. * // => ['fred', 'barney', 'pebbles']
  28136. *
  28137. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  28138. * // => ['fred', 'barney', '&', 'pebbles']
  28139. */
  28140. function words(string, pattern, guard) {
  28141. string = toString(string);
  28142. pattern = guard ? undefined : pattern;
  28143. if (pattern === undefined) {
  28144. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  28145. }
  28146. return string.match(pattern) || [];
  28147. }
  28148. /*------------------------------------------------------------------------*/
  28149. /**
  28150. * Attempts to invoke `func`, returning either the result or the caught error
  28151. * object. Any additional arguments are provided to `func` when it's invoked.
  28152. *
  28153. * @static
  28154. * @memberOf _
  28155. * @since 3.0.0
  28156. * @category Util
  28157. * @param {Function} func The function to attempt.
  28158. * @param {...*} [args] The arguments to invoke `func` with.
  28159. * @returns {*} Returns the `func` result or error object.
  28160. * @example
  28161. *
  28162. * // Avoid throwing errors for invalid selectors.
  28163. * var elements = _.attempt(function(selector) {
  28164. * return document.querySelectorAll(selector);
  28165. * }, '>_>');
  28166. *
  28167. * if (_.isError(elements)) {
  28168. * elements = [];
  28169. * }
  28170. */
  28171. var attempt = baseRest(function(func, args) {
  28172. try {
  28173. return apply(func, undefined, args);
  28174. } catch (e) {
  28175. return isError(e) ? e : new Error(e);
  28176. }
  28177. });
  28178. /**
  28179. * Binds methods of an object to the object itself, overwriting the existing
  28180. * method.
  28181. *
  28182. * **Note:** This method doesn't set the "length" property of bound functions.
  28183. *
  28184. * @static
  28185. * @since 0.1.0
  28186. * @memberOf _
  28187. * @category Util
  28188. * @param {Object} object The object to bind and assign the bound methods to.
  28189. * @param {...(string|string[])} methodNames The object method names to bind.
  28190. * @returns {Object} Returns `object`.
  28191. * @example
  28192. *
  28193. * var view = {
  28194. * 'label': 'docs',
  28195. * 'click': function() {
  28196. * console.log('clicked ' + this.label);
  28197. * }
  28198. * };
  28199. *
  28200. * _.bindAll(view, ['click']);
  28201. * jQuery(element).on('click', view.click);
  28202. * // => Logs 'clicked docs' when clicked.
  28203. */
  28204. var bindAll = flatRest(function(object, methodNames) {
  28205. arrayEach(methodNames, function(key) {
  28206. key = toKey(key);
  28207. baseAssignValue(object, key, bind(object[key], object));
  28208. });
  28209. return object;
  28210. });
  28211. /**
  28212. * Creates a function that iterates over `pairs` and invokes the corresponding
  28213. * function of the first predicate to return truthy. The predicate-function
  28214. * pairs are invoked with the `this` binding and arguments of the created
  28215. * function.
  28216. *
  28217. * @static
  28218. * @memberOf _
  28219. * @since 4.0.0
  28220. * @category Util
  28221. * @param {Array} pairs The predicate-function pairs.
  28222. * @returns {Function} Returns the new composite function.
  28223. * @example
  28224. *
  28225. * var func = _.cond([
  28226. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  28227. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  28228. * [_.stubTrue, _.constant('no match')]
  28229. * ]);
  28230. *
  28231. * func({ 'a': 1, 'b': 2 });
  28232. * // => 'matches A'
  28233. *
  28234. * func({ 'a': 0, 'b': 1 });
  28235. * // => 'matches B'
  28236. *
  28237. * func({ 'a': '1', 'b': '2' });
  28238. * // => 'no match'
  28239. */
  28240. function cond(pairs) {
  28241. var length = pairs == null ? 0 : pairs.length,
  28242. toIteratee = getIteratee();
  28243. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  28244. if (typeof pair[1] != 'function') {
  28245. throw new TypeError(FUNC_ERROR_TEXT);
  28246. }
  28247. return [toIteratee(pair[0]), pair[1]];
  28248. });
  28249. return baseRest(function(args) {
  28250. var index = -1;
  28251. while (++index < length) {
  28252. var pair = pairs[index];
  28253. if (apply(pair[0], this, args)) {
  28254. return apply(pair[1], this, args);
  28255. }
  28256. }
  28257. });
  28258. }
  28259. /**
  28260. * Creates a function that invokes the predicate properties of `source` with
  28261. * the corresponding property values of a given object, returning `true` if
  28262. * all predicates return truthy, else `false`.
  28263. *
  28264. * **Note:** The created function is equivalent to `_.conformsTo` with
  28265. * `source` partially applied.
  28266. *
  28267. * @static
  28268. * @memberOf _
  28269. * @since 4.0.0
  28270. * @category Util
  28271. * @param {Object} source The object of property predicates to conform to.
  28272. * @returns {Function} Returns the new spec function.
  28273. * @example
  28274. *
  28275. * var objects = [
  28276. * { 'a': 2, 'b': 1 },
  28277. * { 'a': 1, 'b': 2 }
  28278. * ];
  28279. *
  28280. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  28281. * // => [{ 'a': 1, 'b': 2 }]
  28282. */
  28283. function conforms(source) {
  28284. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  28285. }
  28286. /**
  28287. * Creates a function that returns `value`.
  28288. *
  28289. * @static
  28290. * @memberOf _
  28291. * @since 2.4.0
  28292. * @category Util
  28293. * @param {*} value The value to return from the new function.
  28294. * @returns {Function} Returns the new constant function.
  28295. * @example
  28296. *
  28297. * var objects = _.times(2, _.constant({ 'a': 1 }));
  28298. *
  28299. * console.log(objects);
  28300. * // => [{ 'a': 1 }, { 'a': 1 }]
  28301. *
  28302. * console.log(objects[0] === objects[1]);
  28303. * // => true
  28304. */
  28305. function constant(value) {
  28306. return function() {
  28307. return value;
  28308. };
  28309. }
  28310. /**
  28311. * Checks `value` to determine whether a default value should be returned in
  28312. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  28313. * or `undefined`.
  28314. *
  28315. * @static
  28316. * @memberOf _
  28317. * @since 4.14.0
  28318. * @category Util
  28319. * @param {*} value The value to check.
  28320. * @param {*} defaultValue The default value.
  28321. * @returns {*} Returns the resolved value.
  28322. * @example
  28323. *
  28324. * _.defaultTo(1, 10);
  28325. * // => 1
  28326. *
  28327. * _.defaultTo(undefined, 10);
  28328. * // => 10
  28329. */
  28330. function defaultTo(value, defaultValue) {
  28331. return (value == null || value !== value) ? defaultValue : value;
  28332. }
  28333. /**
  28334. * Creates a function that returns the result of invoking the given functions
  28335. * with the `this` binding of the created function, where each successive
  28336. * invocation is supplied the return value of the previous.
  28337. *
  28338. * @static
  28339. * @memberOf _
  28340. * @since 3.0.0
  28341. * @category Util
  28342. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28343. * @returns {Function} Returns the new composite function.
  28344. * @see _.flowRight
  28345. * @example
  28346. *
  28347. * function square(n) {
  28348. * return n * n;
  28349. * }
  28350. *
  28351. * var addSquare = _.flow([_.add, square]);
  28352. * addSquare(1, 2);
  28353. * // => 9
  28354. */
  28355. var flow = createFlow();
  28356. /**
  28357. * This method is like `_.flow` except that it creates a function that
  28358. * invokes the given functions from right to left.
  28359. *
  28360. * @static
  28361. * @since 3.0.0
  28362. * @memberOf _
  28363. * @category Util
  28364. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28365. * @returns {Function} Returns the new composite function.
  28366. * @see _.flow
  28367. * @example
  28368. *
  28369. * function square(n) {
  28370. * return n * n;
  28371. * }
  28372. *
  28373. * var addSquare = _.flowRight([square, _.add]);
  28374. * addSquare(1, 2);
  28375. * // => 9
  28376. */
  28377. var flowRight = createFlow(true);
  28378. /**
  28379. * This method returns the first argument it receives.
  28380. *
  28381. * @static
  28382. * @since 0.1.0
  28383. * @memberOf _
  28384. * @category Util
  28385. * @param {*} value Any value.
  28386. * @returns {*} Returns `value`.
  28387. * @example
  28388. *
  28389. * var object = { 'a': 1 };
  28390. *
  28391. * console.log(_.identity(object) === object);
  28392. * // => true
  28393. */
  28394. function identity(value) {
  28395. return value;
  28396. }
  28397. /**
  28398. * Creates a function that invokes `func` with the arguments of the created
  28399. * function. If `func` is a property name, the created function returns the
  28400. * property value for a given element. If `func` is an array or object, the
  28401. * created function returns `true` for elements that contain the equivalent
  28402. * source properties, otherwise it returns `false`.
  28403. *
  28404. * @static
  28405. * @since 4.0.0
  28406. * @memberOf _
  28407. * @category Util
  28408. * @param {*} [func=_.identity] The value to convert to a callback.
  28409. * @returns {Function} Returns the callback.
  28410. * @example
  28411. *
  28412. * var users = [
  28413. * { 'user': 'barney', 'age': 36, 'active': true },
  28414. * { 'user': 'fred', 'age': 40, 'active': false }
  28415. * ];
  28416. *
  28417. * // The `_.matches` iteratee shorthand.
  28418. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  28419. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  28420. *
  28421. * // The `_.matchesProperty` iteratee shorthand.
  28422. * _.filter(users, _.iteratee(['user', 'fred']));
  28423. * // => [{ 'user': 'fred', 'age': 40 }]
  28424. *
  28425. * // The `_.property` iteratee shorthand.
  28426. * _.map(users, _.iteratee('user'));
  28427. * // => ['barney', 'fred']
  28428. *
  28429. * // Create custom iteratee shorthands.
  28430. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  28431. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  28432. * return func.test(string);
  28433. * };
  28434. * });
  28435. *
  28436. * _.filter(['abc', 'def'], /ef/);
  28437. * // => ['def']
  28438. */
  28439. function iteratee(func) {
  28440. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  28441. }
  28442. /**
  28443. * Creates a function that performs a partial deep comparison between a given
  28444. * object and `source`, returning `true` if the given object has equivalent
  28445. * property values, else `false`.
  28446. *
  28447. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  28448. * partially applied.
  28449. *
  28450. * Partial comparisons will match empty array and empty object `source`
  28451. * values against any array or object value, respectively. See `_.isEqual`
  28452. * for a list of supported value comparisons.
  28453. *
  28454. * @static
  28455. * @memberOf _
  28456. * @since 3.0.0
  28457. * @category Util
  28458. * @param {Object} source The object of property values to match.
  28459. * @returns {Function} Returns the new spec function.
  28460. * @example
  28461. *
  28462. * var objects = [
  28463. * { 'a': 1, 'b': 2, 'c': 3 },
  28464. * { 'a': 4, 'b': 5, 'c': 6 }
  28465. * ];
  28466. *
  28467. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  28468. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  28469. */
  28470. function matches(source) {
  28471. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  28472. }
  28473. /**
  28474. * Creates a function that performs a partial deep comparison between the
  28475. * value at `path` of a given object to `srcValue`, returning `true` if the
  28476. * object value is equivalent, else `false`.
  28477. *
  28478. * **Note:** Partial comparisons will match empty array and empty object
  28479. * `srcValue` values against any array or object value, respectively. See
  28480. * `_.isEqual` for a list of supported value comparisons.
  28481. *
  28482. * @static
  28483. * @memberOf _
  28484. * @since 3.2.0
  28485. * @category Util
  28486. * @param {Array|string} path The path of the property to get.
  28487. * @param {*} srcValue The value to match.
  28488. * @returns {Function} Returns the new spec function.
  28489. * @example
  28490. *
  28491. * var objects = [
  28492. * { 'a': 1, 'b': 2, 'c': 3 },
  28493. * { 'a': 4, 'b': 5, 'c': 6 }
  28494. * ];
  28495. *
  28496. * _.find(objects, _.matchesProperty('a', 4));
  28497. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28498. */
  28499. function matchesProperty(path, srcValue) {
  28500. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28501. }
  28502. /**
  28503. * Creates a function that invokes the method at `path` of a given object.
  28504. * Any additional arguments are provided to the invoked method.
  28505. *
  28506. * @static
  28507. * @memberOf _
  28508. * @since 3.7.0
  28509. * @category Util
  28510. * @param {Array|string} path The path of the method to invoke.
  28511. * @param {...*} [args] The arguments to invoke the method with.
  28512. * @returns {Function} Returns the new invoker function.
  28513. * @example
  28514. *
  28515. * var objects = [
  28516. * { 'a': { 'b': _.constant(2) } },
  28517. * { 'a': { 'b': _.constant(1) } }
  28518. * ];
  28519. *
  28520. * _.map(objects, _.method('a.b'));
  28521. * // => [2, 1]
  28522. *
  28523. * _.map(objects, _.method(['a', 'b']));
  28524. * // => [2, 1]
  28525. */
  28526. var method = baseRest(function(path, args) {
  28527. return function(object) {
  28528. return baseInvoke(object, path, args);
  28529. };
  28530. });
  28531. /**
  28532. * The opposite of `_.method`; this method creates a function that invokes
  28533. * the method at a given path of `object`. Any additional arguments are
  28534. * provided to the invoked method.
  28535. *
  28536. * @static
  28537. * @memberOf _
  28538. * @since 3.7.0
  28539. * @category Util
  28540. * @param {Object} object The object to query.
  28541. * @param {...*} [args] The arguments to invoke the method with.
  28542. * @returns {Function} Returns the new invoker function.
  28543. * @example
  28544. *
  28545. * var array = _.times(3, _.constant),
  28546. * object = { 'a': array, 'b': array, 'c': array };
  28547. *
  28548. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28549. * // => [2, 0]
  28550. *
  28551. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28552. * // => [2, 0]
  28553. */
  28554. var methodOf = baseRest(function(object, args) {
  28555. return function(path) {
  28556. return baseInvoke(object, path, args);
  28557. };
  28558. });
  28559. /**
  28560. * Adds all own enumerable string keyed function properties of a source
  28561. * object to the destination object. If `object` is a function, then methods
  28562. * are added to its prototype as well.
  28563. *
  28564. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28565. * avoid conflicts caused by modifying the original.
  28566. *
  28567. * @static
  28568. * @since 0.1.0
  28569. * @memberOf _
  28570. * @category Util
  28571. * @param {Function|Object} [object=lodash] The destination object.
  28572. * @param {Object} source The object of functions to add.
  28573. * @param {Object} [options={}] The options object.
  28574. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28575. * @returns {Function|Object} Returns `object`.
  28576. * @example
  28577. *
  28578. * function vowels(string) {
  28579. * return _.filter(string, function(v) {
  28580. * return /[aeiou]/i.test(v);
  28581. * });
  28582. * }
  28583. *
  28584. * _.mixin({ 'vowels': vowels });
  28585. * _.vowels('fred');
  28586. * // => ['e']
  28587. *
  28588. * _('fred').vowels().value();
  28589. * // => ['e']
  28590. *
  28591. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28592. * _('fred').vowels();
  28593. * // => ['e']
  28594. */
  28595. function mixin(object, source, options) {
  28596. var props = keys(source),
  28597. methodNames = baseFunctions(source, props);
  28598. if (options == null &&
  28599. !(isObject(source) && (methodNames.length || !props.length))) {
  28600. options = source;
  28601. source = object;
  28602. object = this;
  28603. methodNames = baseFunctions(source, keys(source));
  28604. }
  28605. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28606. isFunc = isFunction(object);
  28607. arrayEach(methodNames, function(methodName) {
  28608. var func = source[methodName];
  28609. object[methodName] = func;
  28610. if (isFunc) {
  28611. object.prototype[methodName] = function() {
  28612. var chainAll = this.__chain__;
  28613. if (chain || chainAll) {
  28614. var result = object(this.__wrapped__),
  28615. actions = result.__actions__ = copyArray(this.__actions__);
  28616. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28617. result.__chain__ = chainAll;
  28618. return result;
  28619. }
  28620. return func.apply(object, arrayPush([this.value()], arguments));
  28621. };
  28622. }
  28623. });
  28624. return object;
  28625. }
  28626. /**
  28627. * Reverts the `_` variable to its previous value and returns a reference to
  28628. * the `lodash` function.
  28629. *
  28630. * @static
  28631. * @since 0.1.0
  28632. * @memberOf _
  28633. * @category Util
  28634. * @returns {Function} Returns the `lodash` function.
  28635. * @example
  28636. *
  28637. * var lodash = _.noConflict();
  28638. */
  28639. function noConflict() {
  28640. if (root._ === this) {
  28641. root._ = oldDash;
  28642. }
  28643. return this;
  28644. }
  28645. /**
  28646. * This method returns `undefined`.
  28647. *
  28648. * @static
  28649. * @memberOf _
  28650. * @since 2.3.0
  28651. * @category Util
  28652. * @example
  28653. *
  28654. * _.times(2, _.noop);
  28655. * // => [undefined, undefined]
  28656. */
  28657. function noop() {
  28658. // No operation performed.
  28659. }
  28660. /**
  28661. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28662. * the nth argument from the end is returned.
  28663. *
  28664. * @static
  28665. * @memberOf _
  28666. * @since 4.0.0
  28667. * @category Util
  28668. * @param {number} [n=0] The index of the argument to return.
  28669. * @returns {Function} Returns the new pass-thru function.
  28670. * @example
  28671. *
  28672. * var func = _.nthArg(1);
  28673. * func('a', 'b', 'c', 'd');
  28674. * // => 'b'
  28675. *
  28676. * var func = _.nthArg(-2);
  28677. * func('a', 'b', 'c', 'd');
  28678. * // => 'c'
  28679. */
  28680. function nthArg(n) {
  28681. n = toInteger(n);
  28682. return baseRest(function(args) {
  28683. return baseNth(args, n);
  28684. });
  28685. }
  28686. /**
  28687. * Creates a function that invokes `iteratees` with the arguments it receives
  28688. * and returns their results.
  28689. *
  28690. * @static
  28691. * @memberOf _
  28692. * @since 4.0.0
  28693. * @category Util
  28694. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28695. * The iteratees to invoke.
  28696. * @returns {Function} Returns the new function.
  28697. * @example
  28698. *
  28699. * var func = _.over([Math.max, Math.min]);
  28700. *
  28701. * func(1, 2, 3, 4);
  28702. * // => [4, 1]
  28703. */
  28704. var over = createOver(arrayMap);
  28705. /**
  28706. * Creates a function that checks if **all** of the `predicates` return
  28707. * truthy when invoked with the arguments it receives.
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 4.0.0
  28712. * @category Util
  28713. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28714. * The predicates to check.
  28715. * @returns {Function} Returns the new function.
  28716. * @example
  28717. *
  28718. * var func = _.overEvery([Boolean, isFinite]);
  28719. *
  28720. * func('1');
  28721. * // => true
  28722. *
  28723. * func(null);
  28724. * // => false
  28725. *
  28726. * func(NaN);
  28727. * // => false
  28728. */
  28729. var overEvery = createOver(arrayEvery);
  28730. /**
  28731. * Creates a function that checks if **any** of the `predicates` return
  28732. * truthy when invoked with the arguments it receives.
  28733. *
  28734. * @static
  28735. * @memberOf _
  28736. * @since 4.0.0
  28737. * @category Util
  28738. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28739. * The predicates to check.
  28740. * @returns {Function} Returns the new function.
  28741. * @example
  28742. *
  28743. * var func = _.overSome([Boolean, isFinite]);
  28744. *
  28745. * func('1');
  28746. * // => true
  28747. *
  28748. * func(null);
  28749. * // => true
  28750. *
  28751. * func(NaN);
  28752. * // => false
  28753. */
  28754. var overSome = createOver(arraySome);
  28755. /**
  28756. * Creates a function that returns the value at `path` of a given object.
  28757. *
  28758. * @static
  28759. * @memberOf _
  28760. * @since 2.4.0
  28761. * @category Util
  28762. * @param {Array|string} path The path of the property to get.
  28763. * @returns {Function} Returns the new accessor function.
  28764. * @example
  28765. *
  28766. * var objects = [
  28767. * { 'a': { 'b': 2 } },
  28768. * { 'a': { 'b': 1 } }
  28769. * ];
  28770. *
  28771. * _.map(objects, _.property('a.b'));
  28772. * // => [2, 1]
  28773. *
  28774. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28775. * // => [1, 2]
  28776. */
  28777. function property(path) {
  28778. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28779. }
  28780. /**
  28781. * The opposite of `_.property`; this method creates a function that returns
  28782. * the value at a given path of `object`.
  28783. *
  28784. * @static
  28785. * @memberOf _
  28786. * @since 3.0.0
  28787. * @category Util
  28788. * @param {Object} object The object to query.
  28789. * @returns {Function} Returns the new accessor function.
  28790. * @example
  28791. *
  28792. * var array = [0, 1, 2],
  28793. * object = { 'a': array, 'b': array, 'c': array };
  28794. *
  28795. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28796. * // => [2, 0]
  28797. *
  28798. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28799. * // => [2, 0]
  28800. */
  28801. function propertyOf(object) {
  28802. return function(path) {
  28803. return object == null ? undefined : baseGet(object, path);
  28804. };
  28805. }
  28806. /**
  28807. * Creates an array of numbers (positive and/or negative) progressing from
  28808. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28809. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28810. * it's set to `start` with `start` then set to `0`.
  28811. *
  28812. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28813. * floating-point values which can produce unexpected results.
  28814. *
  28815. * @static
  28816. * @since 0.1.0
  28817. * @memberOf _
  28818. * @category Util
  28819. * @param {number} [start=0] The start of the range.
  28820. * @param {number} end The end of the range.
  28821. * @param {number} [step=1] The value to increment or decrement by.
  28822. * @returns {Array} Returns the range of numbers.
  28823. * @see _.inRange, _.rangeRight
  28824. * @example
  28825. *
  28826. * _.range(4);
  28827. * // => [0, 1, 2, 3]
  28828. *
  28829. * _.range(-4);
  28830. * // => [0, -1, -2, -3]
  28831. *
  28832. * _.range(1, 5);
  28833. * // => [1, 2, 3, 4]
  28834. *
  28835. * _.range(0, 20, 5);
  28836. * // => [0, 5, 10, 15]
  28837. *
  28838. * _.range(0, -4, -1);
  28839. * // => [0, -1, -2, -3]
  28840. *
  28841. * _.range(1, 4, 0);
  28842. * // => [1, 1, 1]
  28843. *
  28844. * _.range(0);
  28845. * // => []
  28846. */
  28847. var range = createRange();
  28848. /**
  28849. * This method is like `_.range` except that it populates values in
  28850. * descending order.
  28851. *
  28852. * @static
  28853. * @memberOf _
  28854. * @since 4.0.0
  28855. * @category Util
  28856. * @param {number} [start=0] The start of the range.
  28857. * @param {number} end The end of the range.
  28858. * @param {number} [step=1] The value to increment or decrement by.
  28859. * @returns {Array} Returns the range of numbers.
  28860. * @see _.inRange, _.range
  28861. * @example
  28862. *
  28863. * _.rangeRight(4);
  28864. * // => [3, 2, 1, 0]
  28865. *
  28866. * _.rangeRight(-4);
  28867. * // => [-3, -2, -1, 0]
  28868. *
  28869. * _.rangeRight(1, 5);
  28870. * // => [4, 3, 2, 1]
  28871. *
  28872. * _.rangeRight(0, 20, 5);
  28873. * // => [15, 10, 5, 0]
  28874. *
  28875. * _.rangeRight(0, -4, -1);
  28876. * // => [-3, -2, -1, 0]
  28877. *
  28878. * _.rangeRight(1, 4, 0);
  28879. * // => [1, 1, 1]
  28880. *
  28881. * _.rangeRight(0);
  28882. * // => []
  28883. */
  28884. var rangeRight = createRange(true);
  28885. /**
  28886. * This method returns a new empty array.
  28887. *
  28888. * @static
  28889. * @memberOf _
  28890. * @since 4.13.0
  28891. * @category Util
  28892. * @returns {Array} Returns the new empty array.
  28893. * @example
  28894. *
  28895. * var arrays = _.times(2, _.stubArray);
  28896. *
  28897. * console.log(arrays);
  28898. * // => [[], []]
  28899. *
  28900. * console.log(arrays[0] === arrays[1]);
  28901. * // => false
  28902. */
  28903. function stubArray() {
  28904. return [];
  28905. }
  28906. /**
  28907. * This method returns `false`.
  28908. *
  28909. * @static
  28910. * @memberOf _
  28911. * @since 4.13.0
  28912. * @category Util
  28913. * @returns {boolean} Returns `false`.
  28914. * @example
  28915. *
  28916. * _.times(2, _.stubFalse);
  28917. * // => [false, false]
  28918. */
  28919. function stubFalse() {
  28920. return false;
  28921. }
  28922. /**
  28923. * This method returns a new empty object.
  28924. *
  28925. * @static
  28926. * @memberOf _
  28927. * @since 4.13.0
  28928. * @category Util
  28929. * @returns {Object} Returns the new empty object.
  28930. * @example
  28931. *
  28932. * var objects = _.times(2, _.stubObject);
  28933. *
  28934. * console.log(objects);
  28935. * // => [{}, {}]
  28936. *
  28937. * console.log(objects[0] === objects[1]);
  28938. * // => false
  28939. */
  28940. function stubObject() {
  28941. return {};
  28942. }
  28943. /**
  28944. * This method returns an empty string.
  28945. *
  28946. * @static
  28947. * @memberOf _
  28948. * @since 4.13.0
  28949. * @category Util
  28950. * @returns {string} Returns the empty string.
  28951. * @example
  28952. *
  28953. * _.times(2, _.stubString);
  28954. * // => ['', '']
  28955. */
  28956. function stubString() {
  28957. return '';
  28958. }
  28959. /**
  28960. * This method returns `true`.
  28961. *
  28962. * @static
  28963. * @memberOf _
  28964. * @since 4.13.0
  28965. * @category Util
  28966. * @returns {boolean} Returns `true`.
  28967. * @example
  28968. *
  28969. * _.times(2, _.stubTrue);
  28970. * // => [true, true]
  28971. */
  28972. function stubTrue() {
  28973. return true;
  28974. }
  28975. /**
  28976. * Invokes the iteratee `n` times, returning an array of the results of
  28977. * each invocation. The iteratee is invoked with one argument; (index).
  28978. *
  28979. * @static
  28980. * @since 0.1.0
  28981. * @memberOf _
  28982. * @category Util
  28983. * @param {number} n The number of times to invoke `iteratee`.
  28984. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28985. * @returns {Array} Returns the array of results.
  28986. * @example
  28987. *
  28988. * _.times(3, String);
  28989. * // => ['0', '1', '2']
  28990. *
  28991. * _.times(4, _.constant(0));
  28992. * // => [0, 0, 0, 0]
  28993. */
  28994. function times(n, iteratee) {
  28995. n = toInteger(n);
  28996. if (n < 1 || n > MAX_SAFE_INTEGER) {
  28997. return [];
  28998. }
  28999. var index = MAX_ARRAY_LENGTH,
  29000. length = nativeMin(n, MAX_ARRAY_LENGTH);
  29001. iteratee = getIteratee(iteratee);
  29002. n -= MAX_ARRAY_LENGTH;
  29003. var result = baseTimes(length, iteratee);
  29004. while (++index < n) {
  29005. iteratee(index);
  29006. }
  29007. return result;
  29008. }
  29009. /**
  29010. * Converts `value` to a property path array.
  29011. *
  29012. * @static
  29013. * @memberOf _
  29014. * @since 4.0.0
  29015. * @category Util
  29016. * @param {*} value The value to convert.
  29017. * @returns {Array} Returns the new property path array.
  29018. * @example
  29019. *
  29020. * _.toPath('a.b.c');
  29021. * // => ['a', 'b', 'c']
  29022. *
  29023. * _.toPath('a[0].b.c');
  29024. * // => ['a', '0', 'b', 'c']
  29025. */
  29026. function toPath(value) {
  29027. if (isArray(value)) {
  29028. return arrayMap(value, toKey);
  29029. }
  29030. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  29031. }
  29032. /**
  29033. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  29034. *
  29035. * @static
  29036. * @since 0.1.0
  29037. * @memberOf _
  29038. * @category Util
  29039. * @param {string} [prefix=''] The value to prefix the ID with.
  29040. * @returns {string} Returns the unique ID.
  29041. * @example
  29042. *
  29043. * _.uniqueId('contact_');
  29044. * // => 'contact_104'
  29045. *
  29046. * _.uniqueId();
  29047. * // => '105'
  29048. */
  29049. function uniqueId(prefix) {
  29050. var id = ++idCounter;
  29051. return toString(prefix) + id;
  29052. }
  29053. /*------------------------------------------------------------------------*/
  29054. /**
  29055. * Adds two numbers.
  29056. *
  29057. * @static
  29058. * @memberOf _
  29059. * @since 3.4.0
  29060. * @category Math
  29061. * @param {number} augend The first number in an addition.
  29062. * @param {number} addend The second number in an addition.
  29063. * @returns {number} Returns the total.
  29064. * @example
  29065. *
  29066. * _.add(6, 4);
  29067. * // => 10
  29068. */
  29069. var add = createMathOperation(function(augend, addend) {
  29070. return augend + addend;
  29071. }, 0);
  29072. /**
  29073. * Computes `number` rounded up to `precision`.
  29074. *
  29075. * @static
  29076. * @memberOf _
  29077. * @since 3.10.0
  29078. * @category Math
  29079. * @param {number} number The number to round up.
  29080. * @param {number} [precision=0] The precision to round up to.
  29081. * @returns {number} Returns the rounded up number.
  29082. * @example
  29083. *
  29084. * _.ceil(4.006);
  29085. * // => 5
  29086. *
  29087. * _.ceil(6.004, 2);
  29088. * // => 6.01
  29089. *
  29090. * _.ceil(6040, -2);
  29091. * // => 6100
  29092. */
  29093. var ceil = createRound('ceil');
  29094. /**
  29095. * Divide two numbers.
  29096. *
  29097. * @static
  29098. * @memberOf _
  29099. * @since 4.7.0
  29100. * @category Math
  29101. * @param {number} dividend The first number in a division.
  29102. * @param {number} divisor The second number in a division.
  29103. * @returns {number} Returns the quotient.
  29104. * @example
  29105. *
  29106. * _.divide(6, 4);
  29107. * // => 1.5
  29108. */
  29109. var divide = createMathOperation(function(dividend, divisor) {
  29110. return dividend / divisor;
  29111. }, 1);
  29112. /**
  29113. * Computes `number` rounded down to `precision`.
  29114. *
  29115. * @static
  29116. * @memberOf _
  29117. * @since 3.10.0
  29118. * @category Math
  29119. * @param {number} number The number to round down.
  29120. * @param {number} [precision=0] The precision to round down to.
  29121. * @returns {number} Returns the rounded down number.
  29122. * @example
  29123. *
  29124. * _.floor(4.006);
  29125. * // => 4
  29126. *
  29127. * _.floor(0.046, 2);
  29128. * // => 0.04
  29129. *
  29130. * _.floor(4060, -2);
  29131. * // => 4000
  29132. */
  29133. var floor = createRound('floor');
  29134. /**
  29135. * Computes the maximum value of `array`. If `array` is empty or falsey,
  29136. * `undefined` is returned.
  29137. *
  29138. * @static
  29139. * @since 0.1.0
  29140. * @memberOf _
  29141. * @category Math
  29142. * @param {Array} array The array to iterate over.
  29143. * @returns {*} Returns the maximum value.
  29144. * @example
  29145. *
  29146. * _.max([4, 2, 8, 6]);
  29147. * // => 8
  29148. *
  29149. * _.max([]);
  29150. * // => undefined
  29151. */
  29152. function max(array) {
  29153. return (array && array.length)
  29154. ? baseExtremum(array, identity, baseGt)
  29155. : undefined;
  29156. }
  29157. /**
  29158. * This method is like `_.max` except that it accepts `iteratee` which is
  29159. * invoked for each element in `array` to generate the criterion by which
  29160. * the value is ranked. The iteratee is invoked with one argument: (value).
  29161. *
  29162. * @static
  29163. * @memberOf _
  29164. * @since 4.0.0
  29165. * @category Math
  29166. * @param {Array} array The array to iterate over.
  29167. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29168. * @returns {*} Returns the maximum value.
  29169. * @example
  29170. *
  29171. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29172. *
  29173. * _.maxBy(objects, function(o) { return o.n; });
  29174. * // => { 'n': 2 }
  29175. *
  29176. * // The `_.property` iteratee shorthand.
  29177. * _.maxBy(objects, 'n');
  29178. * // => { 'n': 2 }
  29179. */
  29180. function maxBy(array, iteratee) {
  29181. return (array && array.length)
  29182. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  29183. : undefined;
  29184. }
  29185. /**
  29186. * Computes the mean of the values in `array`.
  29187. *
  29188. * @static
  29189. * @memberOf _
  29190. * @since 4.0.0
  29191. * @category Math
  29192. * @param {Array} array The array to iterate over.
  29193. * @returns {number} Returns the mean.
  29194. * @example
  29195. *
  29196. * _.mean([4, 2, 8, 6]);
  29197. * // => 5
  29198. */
  29199. function mean(array) {
  29200. return baseMean(array, identity);
  29201. }
  29202. /**
  29203. * This method is like `_.mean` except that it accepts `iteratee` which is
  29204. * invoked for each element in `array` to generate the value to be averaged.
  29205. * The iteratee is invoked with one argument: (value).
  29206. *
  29207. * @static
  29208. * @memberOf _
  29209. * @since 4.7.0
  29210. * @category Math
  29211. * @param {Array} array The array to iterate over.
  29212. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29213. * @returns {number} Returns the mean.
  29214. * @example
  29215. *
  29216. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29217. *
  29218. * _.meanBy(objects, function(o) { return o.n; });
  29219. * // => 5
  29220. *
  29221. * // The `_.property` iteratee shorthand.
  29222. * _.meanBy(objects, 'n');
  29223. * // => 5
  29224. */
  29225. function meanBy(array, iteratee) {
  29226. return baseMean(array, getIteratee(iteratee, 2));
  29227. }
  29228. /**
  29229. * Computes the minimum value of `array`. If `array` is empty or falsey,
  29230. * `undefined` is returned.
  29231. *
  29232. * @static
  29233. * @since 0.1.0
  29234. * @memberOf _
  29235. * @category Math
  29236. * @param {Array} array The array to iterate over.
  29237. * @returns {*} Returns the minimum value.
  29238. * @example
  29239. *
  29240. * _.min([4, 2, 8, 6]);
  29241. * // => 2
  29242. *
  29243. * _.min([]);
  29244. * // => undefined
  29245. */
  29246. function min(array) {
  29247. return (array && array.length)
  29248. ? baseExtremum(array, identity, baseLt)
  29249. : undefined;
  29250. }
  29251. /**
  29252. * This method is like `_.min` except that it accepts `iteratee` which is
  29253. * invoked for each element in `array` to generate the criterion by which
  29254. * the value is ranked. The iteratee is invoked with one argument: (value).
  29255. *
  29256. * @static
  29257. * @memberOf _
  29258. * @since 4.0.0
  29259. * @category Math
  29260. * @param {Array} array The array to iterate over.
  29261. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29262. * @returns {*} Returns the minimum value.
  29263. * @example
  29264. *
  29265. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29266. *
  29267. * _.minBy(objects, function(o) { return o.n; });
  29268. * // => { 'n': 1 }
  29269. *
  29270. * // The `_.property` iteratee shorthand.
  29271. * _.minBy(objects, 'n');
  29272. * // => { 'n': 1 }
  29273. */
  29274. function minBy(array, iteratee) {
  29275. return (array && array.length)
  29276. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  29277. : undefined;
  29278. }
  29279. /**
  29280. * Multiply two numbers.
  29281. *
  29282. * @static
  29283. * @memberOf _
  29284. * @since 4.7.0
  29285. * @category Math
  29286. * @param {number} multiplier The first number in a multiplication.
  29287. * @param {number} multiplicand The second number in a multiplication.
  29288. * @returns {number} Returns the product.
  29289. * @example
  29290. *
  29291. * _.multiply(6, 4);
  29292. * // => 24
  29293. */
  29294. var multiply = createMathOperation(function(multiplier, multiplicand) {
  29295. return multiplier * multiplicand;
  29296. }, 1);
  29297. /**
  29298. * Computes `number` rounded to `precision`.
  29299. *
  29300. * @static
  29301. * @memberOf _
  29302. * @since 3.10.0
  29303. * @category Math
  29304. * @param {number} number The number to round.
  29305. * @param {number} [precision=0] The precision to round to.
  29306. * @returns {number} Returns the rounded number.
  29307. * @example
  29308. *
  29309. * _.round(4.006);
  29310. * // => 4
  29311. *
  29312. * _.round(4.006, 2);
  29313. * // => 4.01
  29314. *
  29315. * _.round(4060, -2);
  29316. * // => 4100
  29317. */
  29318. var round = createRound('round');
  29319. /**
  29320. * Subtract two numbers.
  29321. *
  29322. * @static
  29323. * @memberOf _
  29324. * @since 4.0.0
  29325. * @category Math
  29326. * @param {number} minuend The first number in a subtraction.
  29327. * @param {number} subtrahend The second number in a subtraction.
  29328. * @returns {number} Returns the difference.
  29329. * @example
  29330. *
  29331. * _.subtract(6, 4);
  29332. * // => 2
  29333. */
  29334. var subtract = createMathOperation(function(minuend, subtrahend) {
  29335. return minuend - subtrahend;
  29336. }, 0);
  29337. /**
  29338. * Computes the sum of the values in `array`.
  29339. *
  29340. * @static
  29341. * @memberOf _
  29342. * @since 3.4.0
  29343. * @category Math
  29344. * @param {Array} array The array to iterate over.
  29345. * @returns {number} Returns the sum.
  29346. * @example
  29347. *
  29348. * _.sum([4, 2, 8, 6]);
  29349. * // => 20
  29350. */
  29351. function sum(array) {
  29352. return (array && array.length)
  29353. ? baseSum(array, identity)
  29354. : 0;
  29355. }
  29356. /**
  29357. * This method is like `_.sum` except that it accepts `iteratee` which is
  29358. * invoked for each element in `array` to generate the value to be summed.
  29359. * The iteratee is invoked with one argument: (value).
  29360. *
  29361. * @static
  29362. * @memberOf _
  29363. * @since 4.0.0
  29364. * @category Math
  29365. * @param {Array} array The array to iterate over.
  29366. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29367. * @returns {number} Returns the sum.
  29368. * @example
  29369. *
  29370. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29371. *
  29372. * _.sumBy(objects, function(o) { return o.n; });
  29373. * // => 20
  29374. *
  29375. * // The `_.property` iteratee shorthand.
  29376. * _.sumBy(objects, 'n');
  29377. * // => 20
  29378. */
  29379. function sumBy(array, iteratee) {
  29380. return (array && array.length)
  29381. ? baseSum(array, getIteratee(iteratee, 2))
  29382. : 0;
  29383. }
  29384. /*------------------------------------------------------------------------*/
  29385. // Add methods that return wrapped values in chain sequences.
  29386. lodash.after = after;
  29387. lodash.ary = ary;
  29388. lodash.assign = assign;
  29389. lodash.assignIn = assignIn;
  29390. lodash.assignInWith = assignInWith;
  29391. lodash.assignWith = assignWith;
  29392. lodash.at = at;
  29393. lodash.before = before;
  29394. lodash.bind = bind;
  29395. lodash.bindAll = bindAll;
  29396. lodash.bindKey = bindKey;
  29397. lodash.castArray = castArray;
  29398. lodash.chain = chain;
  29399. lodash.chunk = chunk;
  29400. lodash.compact = compact;
  29401. lodash.concat = concat;
  29402. lodash.cond = cond;
  29403. lodash.conforms = conforms;
  29404. lodash.constant = constant;
  29405. lodash.countBy = countBy;
  29406. lodash.create = create;
  29407. lodash.curry = curry;
  29408. lodash.curryRight = curryRight;
  29409. lodash.debounce = debounce;
  29410. lodash.defaults = defaults;
  29411. lodash.defaultsDeep = defaultsDeep;
  29412. lodash.defer = defer;
  29413. lodash.delay = delay;
  29414. lodash.difference = difference;
  29415. lodash.differenceBy = differenceBy;
  29416. lodash.differenceWith = differenceWith;
  29417. lodash.drop = drop;
  29418. lodash.dropRight = dropRight;
  29419. lodash.dropRightWhile = dropRightWhile;
  29420. lodash.dropWhile = dropWhile;
  29421. lodash.fill = fill;
  29422. lodash.filter = filter;
  29423. lodash.flatMap = flatMap;
  29424. lodash.flatMapDeep = flatMapDeep;
  29425. lodash.flatMapDepth = flatMapDepth;
  29426. lodash.flatten = flatten;
  29427. lodash.flattenDeep = flattenDeep;
  29428. lodash.flattenDepth = flattenDepth;
  29429. lodash.flip = flip;
  29430. lodash.flow = flow;
  29431. lodash.flowRight = flowRight;
  29432. lodash.fromPairs = fromPairs;
  29433. lodash.functions = functions;
  29434. lodash.functionsIn = functionsIn;
  29435. lodash.groupBy = groupBy;
  29436. lodash.initial = initial;
  29437. lodash.intersection = intersection;
  29438. lodash.intersectionBy = intersectionBy;
  29439. lodash.intersectionWith = intersectionWith;
  29440. lodash.invert = invert;
  29441. lodash.invertBy = invertBy;
  29442. lodash.invokeMap = invokeMap;
  29443. lodash.iteratee = iteratee;
  29444. lodash.keyBy = keyBy;
  29445. lodash.keys = keys;
  29446. lodash.keysIn = keysIn;
  29447. lodash.map = map;
  29448. lodash.mapKeys = mapKeys;
  29449. lodash.mapValues = mapValues;
  29450. lodash.matches = matches;
  29451. lodash.matchesProperty = matchesProperty;
  29452. lodash.memoize = memoize;
  29453. lodash.merge = merge;
  29454. lodash.mergeWith = mergeWith;
  29455. lodash.method = method;
  29456. lodash.methodOf = methodOf;
  29457. lodash.mixin = mixin;
  29458. lodash.negate = negate;
  29459. lodash.nthArg = nthArg;
  29460. lodash.omit = omit;
  29461. lodash.omitBy = omitBy;
  29462. lodash.once = once;
  29463. lodash.orderBy = orderBy;
  29464. lodash.over = over;
  29465. lodash.overArgs = overArgs;
  29466. lodash.overEvery = overEvery;
  29467. lodash.overSome = overSome;
  29468. lodash.partial = partial;
  29469. lodash.partialRight = partialRight;
  29470. lodash.partition = partition;
  29471. lodash.pick = pick;
  29472. lodash.pickBy = pickBy;
  29473. lodash.property = property;
  29474. lodash.propertyOf = propertyOf;
  29475. lodash.pull = pull;
  29476. lodash.pullAll = pullAll;
  29477. lodash.pullAllBy = pullAllBy;
  29478. lodash.pullAllWith = pullAllWith;
  29479. lodash.pullAt = pullAt;
  29480. lodash.range = range;
  29481. lodash.rangeRight = rangeRight;
  29482. lodash.rearg = rearg;
  29483. lodash.reject = reject;
  29484. lodash.remove = remove;
  29485. lodash.rest = rest;
  29486. lodash.reverse = reverse;
  29487. lodash.sampleSize = sampleSize;
  29488. lodash.set = set;
  29489. lodash.setWith = setWith;
  29490. lodash.shuffle = shuffle;
  29491. lodash.slice = slice;
  29492. lodash.sortBy = sortBy;
  29493. lodash.sortedUniq = sortedUniq;
  29494. lodash.sortedUniqBy = sortedUniqBy;
  29495. lodash.split = split;
  29496. lodash.spread = spread;
  29497. lodash.tail = tail;
  29498. lodash.take = take;
  29499. lodash.takeRight = takeRight;
  29500. lodash.takeRightWhile = takeRightWhile;
  29501. lodash.takeWhile = takeWhile;
  29502. lodash.tap = tap;
  29503. lodash.throttle = throttle;
  29504. lodash.thru = thru;
  29505. lodash.toArray = toArray;
  29506. lodash.toPairs = toPairs;
  29507. lodash.toPairsIn = toPairsIn;
  29508. lodash.toPath = toPath;
  29509. lodash.toPlainObject = toPlainObject;
  29510. lodash.transform = transform;
  29511. lodash.unary = unary;
  29512. lodash.union = union;
  29513. lodash.unionBy = unionBy;
  29514. lodash.unionWith = unionWith;
  29515. lodash.uniq = uniq;
  29516. lodash.uniqBy = uniqBy;
  29517. lodash.uniqWith = uniqWith;
  29518. lodash.unset = unset;
  29519. lodash.unzip = unzip;
  29520. lodash.unzipWith = unzipWith;
  29521. lodash.update = update;
  29522. lodash.updateWith = updateWith;
  29523. lodash.values = values;
  29524. lodash.valuesIn = valuesIn;
  29525. lodash.without = without;
  29526. lodash.words = words;
  29527. lodash.wrap = wrap;
  29528. lodash.xor = xor;
  29529. lodash.xorBy = xorBy;
  29530. lodash.xorWith = xorWith;
  29531. lodash.zip = zip;
  29532. lodash.zipObject = zipObject;
  29533. lodash.zipObjectDeep = zipObjectDeep;
  29534. lodash.zipWith = zipWith;
  29535. // Add aliases.
  29536. lodash.entries = toPairs;
  29537. lodash.entriesIn = toPairsIn;
  29538. lodash.extend = assignIn;
  29539. lodash.extendWith = assignInWith;
  29540. // Add methods to `lodash.prototype`.
  29541. mixin(lodash, lodash);
  29542. /*------------------------------------------------------------------------*/
  29543. // Add methods that return unwrapped values in chain sequences.
  29544. lodash.add = add;
  29545. lodash.attempt = attempt;
  29546. lodash.camelCase = camelCase;
  29547. lodash.capitalize = capitalize;
  29548. lodash.ceil = ceil;
  29549. lodash.clamp = clamp;
  29550. lodash.clone = clone;
  29551. lodash.cloneDeep = cloneDeep;
  29552. lodash.cloneDeepWith = cloneDeepWith;
  29553. lodash.cloneWith = cloneWith;
  29554. lodash.conformsTo = conformsTo;
  29555. lodash.deburr = deburr;
  29556. lodash.defaultTo = defaultTo;
  29557. lodash.divide = divide;
  29558. lodash.endsWith = endsWith;
  29559. lodash.eq = eq;
  29560. lodash.escape = escape;
  29561. lodash.escapeRegExp = escapeRegExp;
  29562. lodash.every = every;
  29563. lodash.find = find;
  29564. lodash.findIndex = findIndex;
  29565. lodash.findKey = findKey;
  29566. lodash.findLast = findLast;
  29567. lodash.findLastIndex = findLastIndex;
  29568. lodash.findLastKey = findLastKey;
  29569. lodash.floor = floor;
  29570. lodash.forEach = forEach;
  29571. lodash.forEachRight = forEachRight;
  29572. lodash.forIn = forIn;
  29573. lodash.forInRight = forInRight;
  29574. lodash.forOwn = forOwn;
  29575. lodash.forOwnRight = forOwnRight;
  29576. lodash.get = get;
  29577. lodash.gt = gt;
  29578. lodash.gte = gte;
  29579. lodash.has = has;
  29580. lodash.hasIn = hasIn;
  29581. lodash.head = head;
  29582. lodash.identity = identity;
  29583. lodash.includes = includes;
  29584. lodash.indexOf = indexOf;
  29585. lodash.inRange = inRange;
  29586. lodash.invoke = invoke;
  29587. lodash.isArguments = isArguments;
  29588. lodash.isArray = isArray;
  29589. lodash.isArrayBuffer = isArrayBuffer;
  29590. lodash.isArrayLike = isArrayLike;
  29591. lodash.isArrayLikeObject = isArrayLikeObject;
  29592. lodash.isBoolean = isBoolean;
  29593. lodash.isBuffer = isBuffer;
  29594. lodash.isDate = isDate;
  29595. lodash.isElement = isElement;
  29596. lodash.isEmpty = isEmpty;
  29597. lodash.isEqual = isEqual;
  29598. lodash.isEqualWith = isEqualWith;
  29599. lodash.isError = isError;
  29600. lodash.isFinite = isFinite;
  29601. lodash.isFunction = isFunction;
  29602. lodash.isInteger = isInteger;
  29603. lodash.isLength = isLength;
  29604. lodash.isMap = isMap;
  29605. lodash.isMatch = isMatch;
  29606. lodash.isMatchWith = isMatchWith;
  29607. lodash.isNaN = isNaN;
  29608. lodash.isNative = isNative;
  29609. lodash.isNil = isNil;
  29610. lodash.isNull = isNull;
  29611. lodash.isNumber = isNumber;
  29612. lodash.isObject = isObject;
  29613. lodash.isObjectLike = isObjectLike;
  29614. lodash.isPlainObject = isPlainObject;
  29615. lodash.isRegExp = isRegExp;
  29616. lodash.isSafeInteger = isSafeInteger;
  29617. lodash.isSet = isSet;
  29618. lodash.isString = isString;
  29619. lodash.isSymbol = isSymbol;
  29620. lodash.isTypedArray = isTypedArray;
  29621. lodash.isUndefined = isUndefined;
  29622. lodash.isWeakMap = isWeakMap;
  29623. lodash.isWeakSet = isWeakSet;
  29624. lodash.join = join;
  29625. lodash.kebabCase = kebabCase;
  29626. lodash.last = last;
  29627. lodash.lastIndexOf = lastIndexOf;
  29628. lodash.lowerCase = lowerCase;
  29629. lodash.lowerFirst = lowerFirst;
  29630. lodash.lt = lt;
  29631. lodash.lte = lte;
  29632. lodash.max = max;
  29633. lodash.maxBy = maxBy;
  29634. lodash.mean = mean;
  29635. lodash.meanBy = meanBy;
  29636. lodash.min = min;
  29637. lodash.minBy = minBy;
  29638. lodash.stubArray = stubArray;
  29639. lodash.stubFalse = stubFalse;
  29640. lodash.stubObject = stubObject;
  29641. lodash.stubString = stubString;
  29642. lodash.stubTrue = stubTrue;
  29643. lodash.multiply = multiply;
  29644. lodash.nth = nth;
  29645. lodash.noConflict = noConflict;
  29646. lodash.noop = noop;
  29647. lodash.now = now;
  29648. lodash.pad = pad;
  29649. lodash.padEnd = padEnd;
  29650. lodash.padStart = padStart;
  29651. lodash.parseInt = parseInt;
  29652. lodash.random = random;
  29653. lodash.reduce = reduce;
  29654. lodash.reduceRight = reduceRight;
  29655. lodash.repeat = repeat;
  29656. lodash.replace = replace;
  29657. lodash.result = result;
  29658. lodash.round = round;
  29659. lodash.runInContext = runInContext;
  29660. lodash.sample = sample;
  29661. lodash.size = size;
  29662. lodash.snakeCase = snakeCase;
  29663. lodash.some = some;
  29664. lodash.sortedIndex = sortedIndex;
  29665. lodash.sortedIndexBy = sortedIndexBy;
  29666. lodash.sortedIndexOf = sortedIndexOf;
  29667. lodash.sortedLastIndex = sortedLastIndex;
  29668. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29669. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29670. lodash.startCase = startCase;
  29671. lodash.startsWith = startsWith;
  29672. lodash.subtract = subtract;
  29673. lodash.sum = sum;
  29674. lodash.sumBy = sumBy;
  29675. lodash.template = template;
  29676. lodash.times = times;
  29677. lodash.toFinite = toFinite;
  29678. lodash.toInteger = toInteger;
  29679. lodash.toLength = toLength;
  29680. lodash.toLower = toLower;
  29681. lodash.toNumber = toNumber;
  29682. lodash.toSafeInteger = toSafeInteger;
  29683. lodash.toString = toString;
  29684. lodash.toUpper = toUpper;
  29685. lodash.trim = trim;
  29686. lodash.trimEnd = trimEnd;
  29687. lodash.trimStart = trimStart;
  29688. lodash.truncate = truncate;
  29689. lodash.unescape = unescape;
  29690. lodash.uniqueId = uniqueId;
  29691. lodash.upperCase = upperCase;
  29692. lodash.upperFirst = upperFirst;
  29693. // Add aliases.
  29694. lodash.each = forEach;
  29695. lodash.eachRight = forEachRight;
  29696. lodash.first = head;
  29697. mixin(lodash, (function() {
  29698. var source = {};
  29699. baseForOwn(lodash, function(func, methodName) {
  29700. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29701. source[methodName] = func;
  29702. }
  29703. });
  29704. return source;
  29705. }()), { 'chain': false });
  29706. /*------------------------------------------------------------------------*/
  29707. /**
  29708. * The semantic version number.
  29709. *
  29710. * @static
  29711. * @memberOf _
  29712. * @type {string}
  29713. */
  29714. lodash.VERSION = VERSION;
  29715. // Assign default placeholders.
  29716. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29717. lodash[methodName].placeholder = lodash;
  29718. });
  29719. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29720. arrayEach(['drop', 'take'], function(methodName, index) {
  29721. LazyWrapper.prototype[methodName] = function(n) {
  29722. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29723. var result = (this.__filtered__ && !index)
  29724. ? new LazyWrapper(this)
  29725. : this.clone();
  29726. if (result.__filtered__) {
  29727. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29728. } else {
  29729. result.__views__.push({
  29730. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29731. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29732. });
  29733. }
  29734. return result;
  29735. };
  29736. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29737. return this.reverse()[methodName](n).reverse();
  29738. };
  29739. });
  29740. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29741. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29742. var type = index + 1,
  29743. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29744. LazyWrapper.prototype[methodName] = function(iteratee) {
  29745. var result = this.clone();
  29746. result.__iteratees__.push({
  29747. 'iteratee': getIteratee(iteratee, 3),
  29748. 'type': type
  29749. });
  29750. result.__filtered__ = result.__filtered__ || isFilter;
  29751. return result;
  29752. };
  29753. });
  29754. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29755. arrayEach(['head', 'last'], function(methodName, index) {
  29756. var takeName = 'take' + (index ? 'Right' : '');
  29757. LazyWrapper.prototype[methodName] = function() {
  29758. return this[takeName](1).value()[0];
  29759. };
  29760. });
  29761. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29762. arrayEach(['initial', 'tail'], function(methodName, index) {
  29763. var dropName = 'drop' + (index ? '' : 'Right');
  29764. LazyWrapper.prototype[methodName] = function() {
  29765. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29766. };
  29767. });
  29768. LazyWrapper.prototype.compact = function() {
  29769. return this.filter(identity);
  29770. };
  29771. LazyWrapper.prototype.find = function(predicate) {
  29772. return this.filter(predicate).head();
  29773. };
  29774. LazyWrapper.prototype.findLast = function(predicate) {
  29775. return this.reverse().find(predicate);
  29776. };
  29777. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29778. if (typeof path == 'function') {
  29779. return new LazyWrapper(this);
  29780. }
  29781. return this.map(function(value) {
  29782. return baseInvoke(value, path, args);
  29783. });
  29784. });
  29785. LazyWrapper.prototype.reject = function(predicate) {
  29786. return this.filter(negate(getIteratee(predicate)));
  29787. };
  29788. LazyWrapper.prototype.slice = function(start, end) {
  29789. start = toInteger(start);
  29790. var result = this;
  29791. if (result.__filtered__ && (start > 0 || end < 0)) {
  29792. return new LazyWrapper(result);
  29793. }
  29794. if (start < 0) {
  29795. result = result.takeRight(-start);
  29796. } else if (start) {
  29797. result = result.drop(start);
  29798. }
  29799. if (end !== undefined) {
  29800. end = toInteger(end);
  29801. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29802. }
  29803. return result;
  29804. };
  29805. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29806. return this.reverse().takeWhile(predicate).reverse();
  29807. };
  29808. LazyWrapper.prototype.toArray = function() {
  29809. return this.take(MAX_ARRAY_LENGTH);
  29810. };
  29811. // Add `LazyWrapper` methods to `lodash.prototype`.
  29812. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29813. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29814. isTaker = /^(?:head|last)$/.test(methodName),
  29815. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29816. retUnwrapped = isTaker || /^find/.test(methodName);
  29817. if (!lodashFunc) {
  29818. return;
  29819. }
  29820. lodash.prototype[methodName] = function() {
  29821. var value = this.__wrapped__,
  29822. args = isTaker ? [1] : arguments,
  29823. isLazy = value instanceof LazyWrapper,
  29824. iteratee = args[0],
  29825. useLazy = isLazy || isArray(value);
  29826. var interceptor = function(value) {
  29827. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  29828. return (isTaker && chainAll) ? result[0] : result;
  29829. };
  29830. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  29831. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  29832. isLazy = useLazy = false;
  29833. }
  29834. var chainAll = this.__chain__,
  29835. isHybrid = !!this.__actions__.length,
  29836. isUnwrapped = retUnwrapped && !chainAll,
  29837. onlyLazy = isLazy && !isHybrid;
  29838. if (!retUnwrapped && useLazy) {
  29839. value = onlyLazy ? value : new LazyWrapper(this);
  29840. var result = func.apply(value, args);
  29841. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  29842. return new LodashWrapper(result, chainAll);
  29843. }
  29844. if (isUnwrapped && onlyLazy) {
  29845. return func.apply(this, args);
  29846. }
  29847. result = this.thru(interceptor);
  29848. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  29849. };
  29850. });
  29851. // Add `Array` methods to `lodash.prototype`.
  29852. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  29853. var func = arrayProto[methodName],
  29854. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  29855. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  29856. lodash.prototype[methodName] = function() {
  29857. var args = arguments;
  29858. if (retUnwrapped && !this.__chain__) {
  29859. var value = this.value();
  29860. return func.apply(isArray(value) ? value : [], args);
  29861. }
  29862. return this[chainName](function(value) {
  29863. return func.apply(isArray(value) ? value : [], args);
  29864. });
  29865. };
  29866. });
  29867. // Map minified method names to their real names.
  29868. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29869. var lodashFunc = lodash[methodName];
  29870. if (lodashFunc) {
  29871. var key = lodashFunc.name + '';
  29872. if (!hasOwnProperty.call(realNames, key)) {
  29873. realNames[key] = [];
  29874. }
  29875. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  29876. }
  29877. });
  29878. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  29879. 'name': 'wrapper',
  29880. 'func': undefined
  29881. }];
  29882. // Add methods to `LazyWrapper`.
  29883. LazyWrapper.prototype.clone = lazyClone;
  29884. LazyWrapper.prototype.reverse = lazyReverse;
  29885. LazyWrapper.prototype.value = lazyValue;
  29886. // Add chain sequence methods to the `lodash` wrapper.
  29887. lodash.prototype.at = wrapperAt;
  29888. lodash.prototype.chain = wrapperChain;
  29889. lodash.prototype.commit = wrapperCommit;
  29890. lodash.prototype.next = wrapperNext;
  29891. lodash.prototype.plant = wrapperPlant;
  29892. lodash.prototype.reverse = wrapperReverse;
  29893. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  29894. // Add lazy aliases.
  29895. lodash.prototype.first = lodash.prototype.head;
  29896. if (symIterator) {
  29897. lodash.prototype[symIterator] = wrapperToIterator;
  29898. }
  29899. return lodash;
  29900. });
  29901. /*--------------------------------------------------------------------------*/
  29902. // Export lodash.
  29903. var _ = runInContext();
  29904. // Some AMD build optimizers, like r.js, check for condition patterns like:
  29905. if (true) {
  29906. // Expose Lodash on the global object to prevent errors when Lodash is
  29907. // loaded by a script tag in the presence of an AMD loader.
  29908. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  29909. // Use `_.noConflict` to remove Lodash from the global object.
  29910. root._ = _;
  29911. // Define as an anonymous module so, through path mapping, it can be
  29912. // referenced as the "underscore" module.
  29913. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  29914. return _;
  29915. }).call(exports, __webpack_require__, exports, module),
  29916. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  29917. }
  29918. // Check for `exports` after `define` in case a build optimizer adds it.
  29919. else {}
  29920. }.call(this));
  29921. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  29922. /***/ }),
  29923. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  29924. /*!***************************************************!*\
  29925. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  29926. \***************************************************/
  29927. /*! exports provided: default */
  29928. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  29929. "use strict";
  29930. __webpack_require__.r(__webpack_exports__);
  29931. /* WEBPACK VAR INJECTION */(function(global) {/**!
  29932. * @fileOverview Kickass library to create and place poppers near their reference elements.
  29933. * @version 1.16.0
  29934. * @license
  29935. * Copyright (c) 2016 Federico Zivolo and contributors
  29936. *
  29937. * Permission is hereby granted, free of charge, to any person obtaining a copy
  29938. * of this software and associated documentation files (the "Software"), to deal
  29939. * in the Software without restriction, including without limitation the rights
  29940. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  29941. * copies of the Software, and to permit persons to whom the Software is
  29942. * furnished to do so, subject to the following conditions:
  29943. *
  29944. * The above copyright notice and this permission notice shall be included in all
  29945. * copies or substantial portions of the Software.
  29946. *
  29947. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  29948. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  29949. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  29950. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29951. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  29952. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29953. * SOFTWARE.
  29954. */
  29955. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  29956. var timeoutDuration = function () {
  29957. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  29958. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  29959. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  29960. return 1;
  29961. }
  29962. }
  29963. return 0;
  29964. }();
  29965. function microtaskDebounce(fn) {
  29966. var called = false;
  29967. return function () {
  29968. if (called) {
  29969. return;
  29970. }
  29971. called = true;
  29972. window.Promise.resolve().then(function () {
  29973. called = false;
  29974. fn();
  29975. });
  29976. };
  29977. }
  29978. function taskDebounce(fn) {
  29979. var scheduled = false;
  29980. return function () {
  29981. if (!scheduled) {
  29982. scheduled = true;
  29983. setTimeout(function () {
  29984. scheduled = false;
  29985. fn();
  29986. }, timeoutDuration);
  29987. }
  29988. };
  29989. }
  29990. var supportsMicroTasks = isBrowser && window.Promise;
  29991. /**
  29992. * Create a debounced version of a method, that's asynchronously deferred
  29993. * but called in the minimum time possible.
  29994. *
  29995. * @method
  29996. * @memberof Popper.Utils
  29997. * @argument {Function} fn
  29998. * @returns {Function}
  29999. */
  30000. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  30001. /**
  30002. * Check if the given variable is a function
  30003. * @method
  30004. * @memberof Popper.Utils
  30005. * @argument {Any} functionToCheck - variable to check
  30006. * @returns {Boolean} answer to: is a function?
  30007. */
  30008. function isFunction(functionToCheck) {
  30009. var getType = {};
  30010. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  30011. }
  30012. /**
  30013. * Get CSS computed property of the given element
  30014. * @method
  30015. * @memberof Popper.Utils
  30016. * @argument {Eement} element
  30017. * @argument {String} property
  30018. */
  30019. function getStyleComputedProperty(element, property) {
  30020. if (element.nodeType !== 1) {
  30021. return [];
  30022. }
  30023. // NOTE: 1 DOM access here
  30024. var window = element.ownerDocument.defaultView;
  30025. var css = window.getComputedStyle(element, null);
  30026. return property ? css[property] : css;
  30027. }
  30028. /**
  30029. * Returns the parentNode or the host of the element
  30030. * @method
  30031. * @memberof Popper.Utils
  30032. * @argument {Element} element
  30033. * @returns {Element} parent
  30034. */
  30035. function getParentNode(element) {
  30036. if (element.nodeName === 'HTML') {
  30037. return element;
  30038. }
  30039. return element.parentNode || element.host;
  30040. }
  30041. /**
  30042. * Returns the scrolling parent of the given element
  30043. * @method
  30044. * @memberof Popper.Utils
  30045. * @argument {Element} element
  30046. * @returns {Element} scroll parent
  30047. */
  30048. function getScrollParent(element) {
  30049. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  30050. if (!element) {
  30051. return document.body;
  30052. }
  30053. switch (element.nodeName) {
  30054. case 'HTML':
  30055. case 'BODY':
  30056. return element.ownerDocument.body;
  30057. case '#document':
  30058. return element.body;
  30059. }
  30060. // Firefox want us to check `-x` and `-y` variations as well
  30061. var _getStyleComputedProp = getStyleComputedProperty(element),
  30062. overflow = _getStyleComputedProp.overflow,
  30063. overflowX = _getStyleComputedProp.overflowX,
  30064. overflowY = _getStyleComputedProp.overflowY;
  30065. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  30066. return element;
  30067. }
  30068. return getScrollParent(getParentNode(element));
  30069. }
  30070. /**
  30071. * Returns the reference node of the reference object, or the reference object itself.
  30072. * @method
  30073. * @memberof Popper.Utils
  30074. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  30075. * @returns {Element} parent
  30076. */
  30077. function getReferenceNode(reference) {
  30078. return reference && reference.referenceNode ? reference.referenceNode : reference;
  30079. }
  30080. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  30081. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  30082. /**
  30083. * Determines if the browser is Internet Explorer
  30084. * @method
  30085. * @memberof Popper.Utils
  30086. * @param {Number} version to check
  30087. * @returns {Boolean} isIE
  30088. */
  30089. function isIE(version) {
  30090. if (version === 11) {
  30091. return isIE11;
  30092. }
  30093. if (version === 10) {
  30094. return isIE10;
  30095. }
  30096. return isIE11 || isIE10;
  30097. }
  30098. /**
  30099. * Returns the offset parent of the given element
  30100. * @method
  30101. * @memberof Popper.Utils
  30102. * @argument {Element} element
  30103. * @returns {Element} offset parent
  30104. */
  30105. function getOffsetParent(element) {
  30106. if (!element) {
  30107. return document.documentElement;
  30108. }
  30109. var noOffsetParent = isIE(10) ? document.body : null;
  30110. // NOTE: 1 DOM access here
  30111. var offsetParent = element.offsetParent || null;
  30112. // Skip hidden elements which don't have an offsetParent
  30113. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  30114. offsetParent = (element = element.nextElementSibling).offsetParent;
  30115. }
  30116. var nodeName = offsetParent && offsetParent.nodeName;
  30117. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  30118. return element ? element.ownerDocument.documentElement : document.documentElement;
  30119. }
  30120. // .offsetParent will return the closest TH, TD or TABLE in case
  30121. // no offsetParent is present, I hate this job...
  30122. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  30123. return getOffsetParent(offsetParent);
  30124. }
  30125. return offsetParent;
  30126. }
  30127. function isOffsetContainer(element) {
  30128. var nodeName = element.nodeName;
  30129. if (nodeName === 'BODY') {
  30130. return false;
  30131. }
  30132. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  30133. }
  30134. /**
  30135. * Finds the root node (document, shadowDOM root) of the given element
  30136. * @method
  30137. * @memberof Popper.Utils
  30138. * @argument {Element} node
  30139. * @returns {Element} root node
  30140. */
  30141. function getRoot(node) {
  30142. if (node.parentNode !== null) {
  30143. return getRoot(node.parentNode);
  30144. }
  30145. return node;
  30146. }
  30147. /**
  30148. * Finds the offset parent common to the two provided nodes
  30149. * @method
  30150. * @memberof Popper.Utils
  30151. * @argument {Element} element1
  30152. * @argument {Element} element2
  30153. * @returns {Element} common offset parent
  30154. */
  30155. function findCommonOffsetParent(element1, element2) {
  30156. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30157. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  30158. return document.documentElement;
  30159. }
  30160. // Here we make sure to give as "start" the element that comes first in the DOM
  30161. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  30162. var start = order ? element1 : element2;
  30163. var end = order ? element2 : element1;
  30164. // Get common ancestor container
  30165. var range = document.createRange();
  30166. range.setStart(start, 0);
  30167. range.setEnd(end, 0);
  30168. var commonAncestorContainer = range.commonAncestorContainer;
  30169. // Both nodes are inside #document
  30170. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  30171. if (isOffsetContainer(commonAncestorContainer)) {
  30172. return commonAncestorContainer;
  30173. }
  30174. return getOffsetParent(commonAncestorContainer);
  30175. }
  30176. // one of the nodes is inside shadowDOM, find which one
  30177. var element1root = getRoot(element1);
  30178. if (element1root.host) {
  30179. return findCommonOffsetParent(element1root.host, element2);
  30180. } else {
  30181. return findCommonOffsetParent(element1, getRoot(element2).host);
  30182. }
  30183. }
  30184. /**
  30185. * Gets the scroll value of the given element in the given side (top and left)
  30186. * @method
  30187. * @memberof Popper.Utils
  30188. * @argument {Element} element
  30189. * @argument {String} side `top` or `left`
  30190. * @returns {number} amount of scrolled pixels
  30191. */
  30192. function getScroll(element) {
  30193. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  30194. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  30195. var nodeName = element.nodeName;
  30196. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30197. var html = element.ownerDocument.documentElement;
  30198. var scrollingElement = element.ownerDocument.scrollingElement || html;
  30199. return scrollingElement[upperSide];
  30200. }
  30201. return element[upperSide];
  30202. }
  30203. /*
  30204. * Sum or subtract the element scroll values (left and top) from a given rect object
  30205. * @method
  30206. * @memberof Popper.Utils
  30207. * @param {Object} rect - Rect object you want to change
  30208. * @param {HTMLElement} element - The element from the function reads the scroll values
  30209. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  30210. * @return {Object} rect - The modifier rect object
  30211. */
  30212. function includeScroll(rect, element) {
  30213. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30214. var scrollTop = getScroll(element, 'top');
  30215. var scrollLeft = getScroll(element, 'left');
  30216. var modifier = subtract ? -1 : 1;
  30217. rect.top += scrollTop * modifier;
  30218. rect.bottom += scrollTop * modifier;
  30219. rect.left += scrollLeft * modifier;
  30220. rect.right += scrollLeft * modifier;
  30221. return rect;
  30222. }
  30223. /*
  30224. * Helper to detect borders of a given element
  30225. * @method
  30226. * @memberof Popper.Utils
  30227. * @param {CSSStyleDeclaration} styles
  30228. * Result of `getStyleComputedProperty` on the given element
  30229. * @param {String} axis - `x` or `y`
  30230. * @return {number} borders - The borders size of the given axis
  30231. */
  30232. function getBordersSize(styles, axis) {
  30233. var sideA = axis === 'x' ? 'Left' : 'Top';
  30234. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  30235. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  30236. }
  30237. function getSize(axis, body, html, computedStyle) {
  30238. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  30239. }
  30240. function getWindowSizes(document) {
  30241. var body = document.body;
  30242. var html = document.documentElement;
  30243. var computedStyle = isIE(10) && getComputedStyle(html);
  30244. return {
  30245. height: getSize('Height', body, html, computedStyle),
  30246. width: getSize('Width', body, html, computedStyle)
  30247. };
  30248. }
  30249. var classCallCheck = function (instance, Constructor) {
  30250. if (!(instance instanceof Constructor)) {
  30251. throw new TypeError("Cannot call a class as a function");
  30252. }
  30253. };
  30254. var createClass = function () {
  30255. function defineProperties(target, props) {
  30256. for (var i = 0; i < props.length; i++) {
  30257. var descriptor = props[i];
  30258. descriptor.enumerable = descriptor.enumerable || false;
  30259. descriptor.configurable = true;
  30260. if ("value" in descriptor) descriptor.writable = true;
  30261. Object.defineProperty(target, descriptor.key, descriptor);
  30262. }
  30263. }
  30264. return function (Constructor, protoProps, staticProps) {
  30265. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  30266. if (staticProps) defineProperties(Constructor, staticProps);
  30267. return Constructor;
  30268. };
  30269. }();
  30270. var defineProperty = function (obj, key, value) {
  30271. if (key in obj) {
  30272. Object.defineProperty(obj, key, {
  30273. value: value,
  30274. enumerable: true,
  30275. configurable: true,
  30276. writable: true
  30277. });
  30278. } else {
  30279. obj[key] = value;
  30280. }
  30281. return obj;
  30282. };
  30283. var _extends = Object.assign || function (target) {
  30284. for (var i = 1; i < arguments.length; i++) {
  30285. var source = arguments[i];
  30286. for (var key in source) {
  30287. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30288. target[key] = source[key];
  30289. }
  30290. }
  30291. }
  30292. return target;
  30293. };
  30294. /**
  30295. * Given element offsets, generate an output similar to getBoundingClientRect
  30296. * @method
  30297. * @memberof Popper.Utils
  30298. * @argument {Object} offsets
  30299. * @returns {Object} ClientRect like output
  30300. */
  30301. function getClientRect(offsets) {
  30302. return _extends({}, offsets, {
  30303. right: offsets.left + offsets.width,
  30304. bottom: offsets.top + offsets.height
  30305. });
  30306. }
  30307. /**
  30308. * Get bounding client rect of given element
  30309. * @method
  30310. * @memberof Popper.Utils
  30311. * @param {HTMLElement} element
  30312. * @return {Object} client rect
  30313. */
  30314. function getBoundingClientRect(element) {
  30315. var rect = {};
  30316. // IE10 10 FIX: Please, don't ask, the element isn't
  30317. // considered in DOM in some circumstances...
  30318. // This isn't reproducible in IE10 compatibility mode of IE11
  30319. try {
  30320. if (isIE(10)) {
  30321. rect = element.getBoundingClientRect();
  30322. var scrollTop = getScroll(element, 'top');
  30323. var scrollLeft = getScroll(element, 'left');
  30324. rect.top += scrollTop;
  30325. rect.left += scrollLeft;
  30326. rect.bottom += scrollTop;
  30327. rect.right += scrollLeft;
  30328. } else {
  30329. rect = element.getBoundingClientRect();
  30330. }
  30331. } catch (e) {}
  30332. var result = {
  30333. left: rect.left,
  30334. top: rect.top,
  30335. width: rect.right - rect.left,
  30336. height: rect.bottom - rect.top
  30337. };
  30338. // subtract scrollbar size from sizes
  30339. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  30340. var width = sizes.width || element.clientWidth || result.width;
  30341. var height = sizes.height || element.clientHeight || result.height;
  30342. var horizScrollbar = element.offsetWidth - width;
  30343. var vertScrollbar = element.offsetHeight - height;
  30344. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  30345. // we make this check conditional for performance reasons
  30346. if (horizScrollbar || vertScrollbar) {
  30347. var styles = getStyleComputedProperty(element);
  30348. horizScrollbar -= getBordersSize(styles, 'x');
  30349. vertScrollbar -= getBordersSize(styles, 'y');
  30350. result.width -= horizScrollbar;
  30351. result.height -= vertScrollbar;
  30352. }
  30353. return getClientRect(result);
  30354. }
  30355. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  30356. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30357. var isIE10 = isIE(10);
  30358. var isHTML = parent.nodeName === 'HTML';
  30359. var childrenRect = getBoundingClientRect(children);
  30360. var parentRect = getBoundingClientRect(parent);
  30361. var scrollParent = getScrollParent(children);
  30362. var styles = getStyleComputedProperty(parent);
  30363. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  30364. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  30365. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  30366. if (fixedPosition && isHTML) {
  30367. parentRect.top = Math.max(parentRect.top, 0);
  30368. parentRect.left = Math.max(parentRect.left, 0);
  30369. }
  30370. var offsets = getClientRect({
  30371. top: childrenRect.top - parentRect.top - borderTopWidth,
  30372. left: childrenRect.left - parentRect.left - borderLeftWidth,
  30373. width: childrenRect.width,
  30374. height: childrenRect.height
  30375. });
  30376. offsets.marginTop = 0;
  30377. offsets.marginLeft = 0;
  30378. // Subtract margins of documentElement in case it's being used as parent
  30379. // we do this only on HTML because it's the only element that behaves
  30380. // differently when margins are applied to it. The margins are included in
  30381. // the box of the documentElement, in the other cases not.
  30382. if (!isIE10 && isHTML) {
  30383. var marginTop = parseFloat(styles.marginTop, 10);
  30384. var marginLeft = parseFloat(styles.marginLeft, 10);
  30385. offsets.top -= borderTopWidth - marginTop;
  30386. offsets.bottom -= borderTopWidth - marginTop;
  30387. offsets.left -= borderLeftWidth - marginLeft;
  30388. offsets.right -= borderLeftWidth - marginLeft;
  30389. // Attach marginTop and marginLeft because in some circumstances we may need them
  30390. offsets.marginTop = marginTop;
  30391. offsets.marginLeft = marginLeft;
  30392. }
  30393. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  30394. offsets = includeScroll(offsets, parent);
  30395. }
  30396. return offsets;
  30397. }
  30398. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  30399. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30400. var html = element.ownerDocument.documentElement;
  30401. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  30402. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  30403. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  30404. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  30405. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  30406. var offset = {
  30407. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  30408. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  30409. width: width,
  30410. height: height
  30411. };
  30412. return getClientRect(offset);
  30413. }
  30414. /**
  30415. * Check if the given element is fixed or is inside a fixed parent
  30416. * @method
  30417. * @memberof Popper.Utils
  30418. * @argument {Element} element
  30419. * @argument {Element} customContainer
  30420. * @returns {Boolean} answer to "isFixed?"
  30421. */
  30422. function isFixed(element) {
  30423. var nodeName = element.nodeName;
  30424. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30425. return false;
  30426. }
  30427. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  30428. return true;
  30429. }
  30430. var parentNode = getParentNode(element);
  30431. if (!parentNode) {
  30432. return false;
  30433. }
  30434. return isFixed(parentNode);
  30435. }
  30436. /**
  30437. * Finds the first parent of an element that has a transformed property defined
  30438. * @method
  30439. * @memberof Popper.Utils
  30440. * @argument {Element} element
  30441. * @returns {Element} first transformed parent or documentElement
  30442. */
  30443. function getFixedPositionOffsetParent(element) {
  30444. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30445. if (!element || !element.parentElement || isIE()) {
  30446. return document.documentElement;
  30447. }
  30448. var el = element.parentElement;
  30449. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  30450. el = el.parentElement;
  30451. }
  30452. return el || document.documentElement;
  30453. }
  30454. /**
  30455. * Computed the boundaries limits and return them
  30456. * @method
  30457. * @memberof Popper.Utils
  30458. * @param {HTMLElement} popper
  30459. * @param {HTMLElement} reference
  30460. * @param {number} padding
  30461. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  30462. * @param {Boolean} fixedPosition - Is in fixed position mode
  30463. * @returns {Object} Coordinates of the boundaries
  30464. */
  30465. function getBoundaries(popper, reference, padding, boundariesElement) {
  30466. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  30467. // NOTE: 1 DOM access here
  30468. var boundaries = { top: 0, left: 0 };
  30469. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30470. // Handle viewport case
  30471. if (boundariesElement === 'viewport') {
  30472. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  30473. } else {
  30474. // Handle other cases based on DOM element used as boundaries
  30475. var boundariesNode = void 0;
  30476. if (boundariesElement === 'scrollParent') {
  30477. boundariesNode = getScrollParent(getParentNode(reference));
  30478. if (boundariesNode.nodeName === 'BODY') {
  30479. boundariesNode = popper.ownerDocument.documentElement;
  30480. }
  30481. } else if (boundariesElement === 'window') {
  30482. boundariesNode = popper.ownerDocument.documentElement;
  30483. } else {
  30484. boundariesNode = boundariesElement;
  30485. }
  30486. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30487. // In case of HTML, we need a different computation
  30488. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30489. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30490. height = _getWindowSizes.height,
  30491. width = _getWindowSizes.width;
  30492. boundaries.top += offsets.top - offsets.marginTop;
  30493. boundaries.bottom = height + offsets.top;
  30494. boundaries.left += offsets.left - offsets.marginLeft;
  30495. boundaries.right = width + offsets.left;
  30496. } else {
  30497. // for all the other DOM elements, this one is good
  30498. boundaries = offsets;
  30499. }
  30500. }
  30501. // Add paddings
  30502. padding = padding || 0;
  30503. var isPaddingNumber = typeof padding === 'number';
  30504. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30505. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30506. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30507. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30508. return boundaries;
  30509. }
  30510. function getArea(_ref) {
  30511. var width = _ref.width,
  30512. height = _ref.height;
  30513. return width * height;
  30514. }
  30515. /**
  30516. * Utility used to transform the `auto` placement to the placement with more
  30517. * available space.
  30518. * @method
  30519. * @memberof Popper.Utils
  30520. * @argument {Object} data - The data object generated by update method
  30521. * @argument {Object} options - Modifiers configuration and options
  30522. * @returns {Object} The data object, properly modified
  30523. */
  30524. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30525. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30526. if (placement.indexOf('auto') === -1) {
  30527. return placement;
  30528. }
  30529. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30530. var rects = {
  30531. top: {
  30532. width: boundaries.width,
  30533. height: refRect.top - boundaries.top
  30534. },
  30535. right: {
  30536. width: boundaries.right - refRect.right,
  30537. height: boundaries.height
  30538. },
  30539. bottom: {
  30540. width: boundaries.width,
  30541. height: boundaries.bottom - refRect.bottom
  30542. },
  30543. left: {
  30544. width: refRect.left - boundaries.left,
  30545. height: boundaries.height
  30546. }
  30547. };
  30548. var sortedAreas = Object.keys(rects).map(function (key) {
  30549. return _extends({
  30550. key: key
  30551. }, rects[key], {
  30552. area: getArea(rects[key])
  30553. });
  30554. }).sort(function (a, b) {
  30555. return b.area - a.area;
  30556. });
  30557. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30558. var width = _ref2.width,
  30559. height = _ref2.height;
  30560. return width >= popper.clientWidth && height >= popper.clientHeight;
  30561. });
  30562. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30563. var variation = placement.split('-')[1];
  30564. return computedPlacement + (variation ? '-' + variation : '');
  30565. }
  30566. /**
  30567. * Get offsets to the reference element
  30568. * @method
  30569. * @memberof Popper.Utils
  30570. * @param {Object} state
  30571. * @param {Element} popper - the popper element
  30572. * @param {Element} reference - the reference element (the popper will be relative to this)
  30573. * @param {Element} fixedPosition - is in fixed position mode
  30574. * @returns {Object} An object containing the offsets which will be applied to the popper
  30575. */
  30576. function getReferenceOffsets(state, popper, reference) {
  30577. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30578. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30579. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30580. }
  30581. /**
  30582. * Get the outer sizes of the given element (offset size + margins)
  30583. * @method
  30584. * @memberof Popper.Utils
  30585. * @argument {Element} element
  30586. * @returns {Object} object containing width and height properties
  30587. */
  30588. function getOuterSizes(element) {
  30589. var window = element.ownerDocument.defaultView;
  30590. var styles = window.getComputedStyle(element);
  30591. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30592. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30593. var result = {
  30594. width: element.offsetWidth + y,
  30595. height: element.offsetHeight + x
  30596. };
  30597. return result;
  30598. }
  30599. /**
  30600. * Get the opposite placement of the given one
  30601. * @method
  30602. * @memberof Popper.Utils
  30603. * @argument {String} placement
  30604. * @returns {String} flipped placement
  30605. */
  30606. function getOppositePlacement(placement) {
  30607. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30608. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30609. return hash[matched];
  30610. });
  30611. }
  30612. /**
  30613. * Get offsets to the popper
  30614. * @method
  30615. * @memberof Popper.Utils
  30616. * @param {Object} position - CSS position the Popper will get applied
  30617. * @param {HTMLElement} popper - the popper element
  30618. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30619. * @param {String} placement - one of the valid placement options
  30620. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30621. */
  30622. function getPopperOffsets(popper, referenceOffsets, placement) {
  30623. placement = placement.split('-')[0];
  30624. // Get popper node sizes
  30625. var popperRect = getOuterSizes(popper);
  30626. // Add position, width and height to our offsets object
  30627. var popperOffsets = {
  30628. width: popperRect.width,
  30629. height: popperRect.height
  30630. };
  30631. // depending by the popper placement we have to compute its offsets slightly differently
  30632. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30633. var mainSide = isHoriz ? 'top' : 'left';
  30634. var secondarySide = isHoriz ? 'left' : 'top';
  30635. var measurement = isHoriz ? 'height' : 'width';
  30636. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30637. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30638. if (placement === secondarySide) {
  30639. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30640. } else {
  30641. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30642. }
  30643. return popperOffsets;
  30644. }
  30645. /**
  30646. * Mimics the `find` method of Array
  30647. * @method
  30648. * @memberof Popper.Utils
  30649. * @argument {Array} arr
  30650. * @argument prop
  30651. * @argument value
  30652. * @returns index or -1
  30653. */
  30654. function find(arr, check) {
  30655. // use native find if supported
  30656. if (Array.prototype.find) {
  30657. return arr.find(check);
  30658. }
  30659. // use `filter` to obtain the same behavior of `find`
  30660. return arr.filter(check)[0];
  30661. }
  30662. /**
  30663. * Return the index of the matching object
  30664. * @method
  30665. * @memberof Popper.Utils
  30666. * @argument {Array} arr
  30667. * @argument prop
  30668. * @argument value
  30669. * @returns index or -1
  30670. */
  30671. function findIndex(arr, prop, value) {
  30672. // use native findIndex if supported
  30673. if (Array.prototype.findIndex) {
  30674. return arr.findIndex(function (cur) {
  30675. return cur[prop] === value;
  30676. });
  30677. }
  30678. // use `find` + `indexOf` if `findIndex` isn't supported
  30679. var match = find(arr, function (obj) {
  30680. return obj[prop] === value;
  30681. });
  30682. return arr.indexOf(match);
  30683. }
  30684. /**
  30685. * Loop trough the list of modifiers and run them in order,
  30686. * each of them will then edit the data object.
  30687. * @method
  30688. * @memberof Popper.Utils
  30689. * @param {dataObject} data
  30690. * @param {Array} modifiers
  30691. * @param {String} ends - Optional modifier name used as stopper
  30692. * @returns {dataObject}
  30693. */
  30694. function runModifiers(modifiers, data, ends) {
  30695. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30696. modifiersToRun.forEach(function (modifier) {
  30697. if (modifier['function']) {
  30698. // eslint-disable-line dot-notation
  30699. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30700. }
  30701. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30702. if (modifier.enabled && isFunction(fn)) {
  30703. // Add properties to offsets to make them a complete clientRect object
  30704. // we do this before each modifier to make sure the previous one doesn't
  30705. // mess with these values
  30706. data.offsets.popper = getClientRect(data.offsets.popper);
  30707. data.offsets.reference = getClientRect(data.offsets.reference);
  30708. data = fn(data, modifier);
  30709. }
  30710. });
  30711. return data;
  30712. }
  30713. /**
  30714. * Updates the position of the popper, computing the new offsets and applying
  30715. * the new style.<br />
  30716. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30717. * @method
  30718. * @memberof Popper
  30719. */
  30720. function update() {
  30721. // if popper is destroyed, don't perform any further update
  30722. if (this.state.isDestroyed) {
  30723. return;
  30724. }
  30725. var data = {
  30726. instance: this,
  30727. styles: {},
  30728. arrowStyles: {},
  30729. attributes: {},
  30730. flipped: false,
  30731. offsets: {}
  30732. };
  30733. // compute reference element offsets
  30734. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30735. // compute auto placement, store placement inside the data object,
  30736. // modifiers will be able to edit `placement` if needed
  30737. // and refer to originalPlacement to know the original value
  30738. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30739. // store the computed placement inside `originalPlacement`
  30740. data.originalPlacement = data.placement;
  30741. data.positionFixed = this.options.positionFixed;
  30742. // compute the popper offsets
  30743. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30744. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30745. // run the modifiers
  30746. data = runModifiers(this.modifiers, data);
  30747. // the first `update` will call `onCreate` callback
  30748. // the other ones will call `onUpdate` callback
  30749. if (!this.state.isCreated) {
  30750. this.state.isCreated = true;
  30751. this.options.onCreate(data);
  30752. } else {
  30753. this.options.onUpdate(data);
  30754. }
  30755. }
  30756. /**
  30757. * Helper used to know if the given modifier is enabled.
  30758. * @method
  30759. * @memberof Popper.Utils
  30760. * @returns {Boolean}
  30761. */
  30762. function isModifierEnabled(modifiers, modifierName) {
  30763. return modifiers.some(function (_ref) {
  30764. var name = _ref.name,
  30765. enabled = _ref.enabled;
  30766. return enabled && name === modifierName;
  30767. });
  30768. }
  30769. /**
  30770. * Get the prefixed supported property name
  30771. * @method
  30772. * @memberof Popper.Utils
  30773. * @argument {String} property (camelCase)
  30774. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30775. */
  30776. function getSupportedPropertyName(property) {
  30777. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30778. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30779. for (var i = 0; i < prefixes.length; i++) {
  30780. var prefix = prefixes[i];
  30781. var toCheck = prefix ? '' + prefix + upperProp : property;
  30782. if (typeof document.body.style[toCheck] !== 'undefined') {
  30783. return toCheck;
  30784. }
  30785. }
  30786. return null;
  30787. }
  30788. /**
  30789. * Destroys the popper.
  30790. * @method
  30791. * @memberof Popper
  30792. */
  30793. function destroy() {
  30794. this.state.isDestroyed = true;
  30795. // touch DOM only if `applyStyle` modifier is enabled
  30796. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30797. this.popper.removeAttribute('x-placement');
  30798. this.popper.style.position = '';
  30799. this.popper.style.top = '';
  30800. this.popper.style.left = '';
  30801. this.popper.style.right = '';
  30802. this.popper.style.bottom = '';
  30803. this.popper.style.willChange = '';
  30804. this.popper.style[getSupportedPropertyName('transform')] = '';
  30805. }
  30806. this.disableEventListeners();
  30807. // remove the popper if user explicitly asked for the deletion on destroy
  30808. // do not use `remove` because IE11 doesn't support it
  30809. if (this.options.removeOnDestroy) {
  30810. this.popper.parentNode.removeChild(this.popper);
  30811. }
  30812. return this;
  30813. }
  30814. /**
  30815. * Get the window associated with the element
  30816. * @argument {Element} element
  30817. * @returns {Window}
  30818. */
  30819. function getWindow(element) {
  30820. var ownerDocument = element.ownerDocument;
  30821. return ownerDocument ? ownerDocument.defaultView : window;
  30822. }
  30823. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  30824. var isBody = scrollParent.nodeName === 'BODY';
  30825. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  30826. target.addEventListener(event, callback, { passive: true });
  30827. if (!isBody) {
  30828. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  30829. }
  30830. scrollParents.push(target);
  30831. }
  30832. /**
  30833. * Setup needed event listeners used to update the popper position
  30834. * @method
  30835. * @memberof Popper.Utils
  30836. * @private
  30837. */
  30838. function setupEventListeners(reference, options, state, updateBound) {
  30839. // Resize event listener on window
  30840. state.updateBound = updateBound;
  30841. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  30842. // Scroll event listener on scroll parents
  30843. var scrollElement = getScrollParent(reference);
  30844. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  30845. state.scrollElement = scrollElement;
  30846. state.eventsEnabled = true;
  30847. return state;
  30848. }
  30849. /**
  30850. * It will add resize/scroll events and start recalculating
  30851. * position of the popper element when they are triggered.
  30852. * @method
  30853. * @memberof Popper
  30854. */
  30855. function enableEventListeners() {
  30856. if (!this.state.eventsEnabled) {
  30857. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  30858. }
  30859. }
  30860. /**
  30861. * Remove event listeners used to update the popper position
  30862. * @method
  30863. * @memberof Popper.Utils
  30864. * @private
  30865. */
  30866. function removeEventListeners(reference, state) {
  30867. // Remove resize event listener on window
  30868. getWindow(reference).removeEventListener('resize', state.updateBound);
  30869. // Remove scroll event listener on scroll parents
  30870. state.scrollParents.forEach(function (target) {
  30871. target.removeEventListener('scroll', state.updateBound);
  30872. });
  30873. // Reset state
  30874. state.updateBound = null;
  30875. state.scrollParents = [];
  30876. state.scrollElement = null;
  30877. state.eventsEnabled = false;
  30878. return state;
  30879. }
  30880. /**
  30881. * It will remove resize/scroll events and won't recalculate popper position
  30882. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  30883. * unless you call `update` method manually.
  30884. * @method
  30885. * @memberof Popper
  30886. */
  30887. function disableEventListeners() {
  30888. if (this.state.eventsEnabled) {
  30889. cancelAnimationFrame(this.scheduleUpdate);
  30890. this.state = removeEventListeners(this.reference, this.state);
  30891. }
  30892. }
  30893. /**
  30894. * Tells if a given input is a number
  30895. * @method
  30896. * @memberof Popper.Utils
  30897. * @param {*} input to check
  30898. * @return {Boolean}
  30899. */
  30900. function isNumeric(n) {
  30901. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  30902. }
  30903. /**
  30904. * Set the style to the given popper
  30905. * @method
  30906. * @memberof Popper.Utils
  30907. * @argument {Element} element - Element to apply the style to
  30908. * @argument {Object} styles
  30909. * Object with a list of properties and values which will be applied to the element
  30910. */
  30911. function setStyles(element, styles) {
  30912. Object.keys(styles).forEach(function (prop) {
  30913. var unit = '';
  30914. // add unit if the value is numeric and is one of the following
  30915. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  30916. unit = 'px';
  30917. }
  30918. element.style[prop] = styles[prop] + unit;
  30919. });
  30920. }
  30921. /**
  30922. * Set the attributes to the given popper
  30923. * @method
  30924. * @memberof Popper.Utils
  30925. * @argument {Element} element - Element to apply the attributes to
  30926. * @argument {Object} styles
  30927. * Object with a list of properties and values which will be applied to the element
  30928. */
  30929. function setAttributes(element, attributes) {
  30930. Object.keys(attributes).forEach(function (prop) {
  30931. var value = attributes[prop];
  30932. if (value !== false) {
  30933. element.setAttribute(prop, attributes[prop]);
  30934. } else {
  30935. element.removeAttribute(prop);
  30936. }
  30937. });
  30938. }
  30939. /**
  30940. * @function
  30941. * @memberof Modifiers
  30942. * @argument {Object} data - The data object generated by `update` method
  30943. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  30944. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  30945. * @argument {Object} options - Modifiers configuration and options
  30946. * @returns {Object} The same data object
  30947. */
  30948. function applyStyle(data) {
  30949. // any property present in `data.styles` will be applied to the popper,
  30950. // in this way we can make the 3rd party modifiers add custom styles to it
  30951. // Be aware, modifiers could override the properties defined in the previous
  30952. // lines of this modifier!
  30953. setStyles(data.instance.popper, data.styles);
  30954. // any property present in `data.attributes` will be applied to the popper,
  30955. // they will be set as HTML attributes of the element
  30956. setAttributes(data.instance.popper, data.attributes);
  30957. // if arrowElement is defined and arrowStyles has some properties
  30958. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  30959. setStyles(data.arrowElement, data.arrowStyles);
  30960. }
  30961. return data;
  30962. }
  30963. /**
  30964. * Set the x-placement attribute before everything else because it could be used
  30965. * to add margins to the popper margins needs to be calculated to get the
  30966. * correct popper offsets.
  30967. * @method
  30968. * @memberof Popper.modifiers
  30969. * @param {HTMLElement} reference - The reference element used to position the popper
  30970. * @param {HTMLElement} popper - The HTML element used as popper
  30971. * @param {Object} options - Popper.js options
  30972. */
  30973. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  30974. // compute reference element offsets
  30975. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  30976. // compute auto placement, store placement inside the data object,
  30977. // modifiers will be able to edit `placement` if needed
  30978. // and refer to originalPlacement to know the original value
  30979. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  30980. popper.setAttribute('x-placement', placement);
  30981. // Apply `position` to popper before anything else because
  30982. // without the position applied we can't guarantee correct computations
  30983. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  30984. return options;
  30985. }
  30986. /**
  30987. * @function
  30988. * @memberof Popper.Utils
  30989. * @argument {Object} data - The data object generated by `update` method
  30990. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  30991. * @returns {Object} The popper's position offsets rounded
  30992. *
  30993. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  30994. * good as it can be within reason.
  30995. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  30996. *
  30997. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  30998. * as well on High DPI screens).
  30999. *
  31000. * Firefox prefers no rounding for positioning and does not have blurriness on
  31001. * high DPI screens.
  31002. *
  31003. * Only horizontal placement and left/right values need to be considered.
  31004. */
  31005. function getRoundedOffsets(data, shouldRound) {
  31006. var _data$offsets = data.offsets,
  31007. popper = _data$offsets.popper,
  31008. reference = _data$offsets.reference;
  31009. var round = Math.round,
  31010. floor = Math.floor;
  31011. var noRound = function noRound(v) {
  31012. return v;
  31013. };
  31014. var referenceWidth = round(reference.width);
  31015. var popperWidth = round(popper.width);
  31016. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  31017. var isVariation = data.placement.indexOf('-') !== -1;
  31018. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  31019. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  31020. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  31021. var verticalToInteger = !shouldRound ? noRound : round;
  31022. return {
  31023. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  31024. top: verticalToInteger(popper.top),
  31025. bottom: verticalToInteger(popper.bottom),
  31026. right: horizontalToInteger(popper.right)
  31027. };
  31028. }
  31029. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  31030. /**
  31031. * @function
  31032. * @memberof Modifiers
  31033. * @argument {Object} data - The data object generated by `update` method
  31034. * @argument {Object} options - Modifiers configuration and options
  31035. * @returns {Object} The data object, properly modified
  31036. */
  31037. function computeStyle(data, options) {
  31038. var x = options.x,
  31039. y = options.y;
  31040. var popper = data.offsets.popper;
  31041. // Remove this legacy support in Popper.js v2
  31042. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  31043. return modifier.name === 'applyStyle';
  31044. }).gpuAcceleration;
  31045. if (legacyGpuAccelerationOption !== undefined) {
  31046. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  31047. }
  31048. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  31049. var offsetParent = getOffsetParent(data.instance.popper);
  31050. var offsetParentRect = getBoundingClientRect(offsetParent);
  31051. // Styles
  31052. var styles = {
  31053. position: popper.position
  31054. };
  31055. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  31056. var sideA = x === 'bottom' ? 'top' : 'bottom';
  31057. var sideB = y === 'right' ? 'left' : 'right';
  31058. // if gpuAcceleration is set to `true` and transform is supported,
  31059. // we use `translate3d` to apply the position to the popper we
  31060. // automatically use the supported prefixed version if needed
  31061. var prefixedProperty = getSupportedPropertyName('transform');
  31062. // now, let's make a step back and look at this code closely (wtf?)
  31063. // If the content of the popper grows once it's been positioned, it
  31064. // may happen that the popper gets misplaced because of the new content
  31065. // overflowing its reference element
  31066. // To avoid this problem, we provide two options (x and y), which allow
  31067. // the consumer to define the offset origin.
  31068. // If we position a popper on top of a reference element, we can set
  31069. // `x` to `top` to make the popper grow towards its top instead of
  31070. // its bottom.
  31071. var left = void 0,
  31072. top = void 0;
  31073. if (sideA === 'bottom') {
  31074. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  31075. // and not the bottom of the html element
  31076. if (offsetParent.nodeName === 'HTML') {
  31077. top = -offsetParent.clientHeight + offsets.bottom;
  31078. } else {
  31079. top = -offsetParentRect.height + offsets.bottom;
  31080. }
  31081. } else {
  31082. top = offsets.top;
  31083. }
  31084. if (sideB === 'right') {
  31085. if (offsetParent.nodeName === 'HTML') {
  31086. left = -offsetParent.clientWidth + offsets.right;
  31087. } else {
  31088. left = -offsetParentRect.width + offsets.right;
  31089. }
  31090. } else {
  31091. left = offsets.left;
  31092. }
  31093. if (gpuAcceleration && prefixedProperty) {
  31094. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  31095. styles[sideA] = 0;
  31096. styles[sideB] = 0;
  31097. styles.willChange = 'transform';
  31098. } else {
  31099. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  31100. var invertTop = sideA === 'bottom' ? -1 : 1;
  31101. var invertLeft = sideB === 'right' ? -1 : 1;
  31102. styles[sideA] = top * invertTop;
  31103. styles[sideB] = left * invertLeft;
  31104. styles.willChange = sideA + ', ' + sideB;
  31105. }
  31106. // Attributes
  31107. var attributes = {
  31108. 'x-placement': data.placement
  31109. };
  31110. // Update `data` attributes, styles and arrowStyles
  31111. data.attributes = _extends({}, attributes, data.attributes);
  31112. data.styles = _extends({}, styles, data.styles);
  31113. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  31114. return data;
  31115. }
  31116. /**
  31117. * Helper used to know if the given modifier depends from another one.<br />
  31118. * It checks if the needed modifier is listed and enabled.
  31119. * @method
  31120. * @memberof Popper.Utils
  31121. * @param {Array} modifiers - list of modifiers
  31122. * @param {String} requestingName - name of requesting modifier
  31123. * @param {String} requestedName - name of requested modifier
  31124. * @returns {Boolean}
  31125. */
  31126. function isModifierRequired(modifiers, requestingName, requestedName) {
  31127. var requesting = find(modifiers, function (_ref) {
  31128. var name = _ref.name;
  31129. return name === requestingName;
  31130. });
  31131. var isRequired = !!requesting && modifiers.some(function (modifier) {
  31132. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  31133. });
  31134. if (!isRequired) {
  31135. var _requesting = '`' + requestingName + '`';
  31136. var requested = '`' + requestedName + '`';
  31137. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  31138. }
  31139. return isRequired;
  31140. }
  31141. /**
  31142. * @function
  31143. * @memberof Modifiers
  31144. * @argument {Object} data - The data object generated by update method
  31145. * @argument {Object} options - Modifiers configuration and options
  31146. * @returns {Object} The data object, properly modified
  31147. */
  31148. function arrow(data, options) {
  31149. var _data$offsets$arrow;
  31150. // arrow depends on keepTogether in order to work
  31151. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  31152. return data;
  31153. }
  31154. var arrowElement = options.element;
  31155. // if arrowElement is a string, suppose it's a CSS selector
  31156. if (typeof arrowElement === 'string') {
  31157. arrowElement = data.instance.popper.querySelector(arrowElement);
  31158. // if arrowElement is not found, don't run the modifier
  31159. if (!arrowElement) {
  31160. return data;
  31161. }
  31162. } else {
  31163. // if the arrowElement isn't a query selector we must check that the
  31164. // provided DOM node is child of its popper node
  31165. if (!data.instance.popper.contains(arrowElement)) {
  31166. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  31167. return data;
  31168. }
  31169. }
  31170. var placement = data.placement.split('-')[0];
  31171. var _data$offsets = data.offsets,
  31172. popper = _data$offsets.popper,
  31173. reference = _data$offsets.reference;
  31174. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  31175. var len = isVertical ? 'height' : 'width';
  31176. var sideCapitalized = isVertical ? 'Top' : 'Left';
  31177. var side = sideCapitalized.toLowerCase();
  31178. var altSide = isVertical ? 'left' : 'top';
  31179. var opSide = isVertical ? 'bottom' : 'right';
  31180. var arrowElementSize = getOuterSizes(arrowElement)[len];
  31181. //
  31182. // extends keepTogether behavior making sure the popper and its
  31183. // reference have enough pixels in conjunction
  31184. //
  31185. // top/left side
  31186. if (reference[opSide] - arrowElementSize < popper[side]) {
  31187. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  31188. }
  31189. // bottom/right side
  31190. if (reference[side] + arrowElementSize > popper[opSide]) {
  31191. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  31192. }
  31193. data.offsets.popper = getClientRect(data.offsets.popper);
  31194. // compute center of the popper
  31195. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  31196. // Compute the sideValue using the updated popper offsets
  31197. // take popper margin in account because we don't have this info available
  31198. var css = getStyleComputedProperty(data.instance.popper);
  31199. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  31200. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  31201. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  31202. // prevent arrowElement from being placed not contiguously to its popper
  31203. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  31204. data.arrowElement = arrowElement;
  31205. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  31206. return data;
  31207. }
  31208. /**
  31209. * Get the opposite placement variation of the given one
  31210. * @method
  31211. * @memberof Popper.Utils
  31212. * @argument {String} placement variation
  31213. * @returns {String} flipped placement variation
  31214. */
  31215. function getOppositeVariation(variation) {
  31216. if (variation === 'end') {
  31217. return 'start';
  31218. } else if (variation === 'start') {
  31219. return 'end';
  31220. }
  31221. return variation;
  31222. }
  31223. /**
  31224. * List of accepted placements to use as values of the `placement` option.<br />
  31225. * Valid placements are:
  31226. * - `auto`
  31227. * - `top`
  31228. * - `right`
  31229. * - `bottom`
  31230. * - `left`
  31231. *
  31232. * Each placement can have a variation from this list:
  31233. * - `-start`
  31234. * - `-end`
  31235. *
  31236. * Variations are interpreted easily if you think of them as the left to right
  31237. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  31238. * is right.<br />
  31239. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  31240. *
  31241. * Some valid examples are:
  31242. * - `top-end` (on top of reference, right aligned)
  31243. * - `right-start` (on right of reference, top aligned)
  31244. * - `bottom` (on bottom, centered)
  31245. * - `auto-end` (on the side with more space available, alignment depends by placement)
  31246. *
  31247. * @static
  31248. * @type {Array}
  31249. * @enum {String}
  31250. * @readonly
  31251. * @method placements
  31252. * @memberof Popper
  31253. */
  31254. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  31255. // Get rid of `auto` `auto-start` and `auto-end`
  31256. var validPlacements = placements.slice(3);
  31257. /**
  31258. * Given an initial placement, returns all the subsequent placements
  31259. * clockwise (or counter-clockwise).
  31260. *
  31261. * @method
  31262. * @memberof Popper.Utils
  31263. * @argument {String} placement - A valid placement (it accepts variations)
  31264. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  31265. * @returns {Array} placements including their variations
  31266. */
  31267. function clockwise(placement) {
  31268. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  31269. var index = validPlacements.indexOf(placement);
  31270. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  31271. return counter ? arr.reverse() : arr;
  31272. }
  31273. var BEHAVIORS = {
  31274. FLIP: 'flip',
  31275. CLOCKWISE: 'clockwise',
  31276. COUNTERCLOCKWISE: 'counterclockwise'
  31277. };
  31278. /**
  31279. * @function
  31280. * @memberof Modifiers
  31281. * @argument {Object} data - The data object generated by update method
  31282. * @argument {Object} options - Modifiers configuration and options
  31283. * @returns {Object} The data object, properly modified
  31284. */
  31285. function flip(data, options) {
  31286. // if `inner` modifier is enabled, we can't use the `flip` modifier
  31287. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  31288. return data;
  31289. }
  31290. if (data.flipped && data.placement === data.originalPlacement) {
  31291. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  31292. return data;
  31293. }
  31294. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  31295. var placement = data.placement.split('-')[0];
  31296. var placementOpposite = getOppositePlacement(placement);
  31297. var variation = data.placement.split('-')[1] || '';
  31298. var flipOrder = [];
  31299. switch (options.behavior) {
  31300. case BEHAVIORS.FLIP:
  31301. flipOrder = [placement, placementOpposite];
  31302. break;
  31303. case BEHAVIORS.CLOCKWISE:
  31304. flipOrder = clockwise(placement);
  31305. break;
  31306. case BEHAVIORS.COUNTERCLOCKWISE:
  31307. flipOrder = clockwise(placement, true);
  31308. break;
  31309. default:
  31310. flipOrder = options.behavior;
  31311. }
  31312. flipOrder.forEach(function (step, index) {
  31313. if (placement !== step || flipOrder.length === index + 1) {
  31314. return data;
  31315. }
  31316. placement = data.placement.split('-')[0];
  31317. placementOpposite = getOppositePlacement(placement);
  31318. var popperOffsets = data.offsets.popper;
  31319. var refOffsets = data.offsets.reference;
  31320. // using floor because the reference offsets may contain decimals we are not going to consider here
  31321. var floor = Math.floor;
  31322. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  31323. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  31324. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  31325. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  31326. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  31327. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  31328. // flip the variation if required
  31329. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31330. // flips variation if reference element overflows boundaries
  31331. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  31332. // flips variation if popper content overflows boundaries
  31333. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  31334. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  31335. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  31336. // this boolean to detect any flip loop
  31337. data.flipped = true;
  31338. if (overlapsRef || overflowsBoundaries) {
  31339. placement = flipOrder[index + 1];
  31340. }
  31341. if (flippedVariation) {
  31342. variation = getOppositeVariation(variation);
  31343. }
  31344. data.placement = placement + (variation ? '-' + variation : '');
  31345. // this object contains `position`, we want to preserve it along with
  31346. // any additional property we may add in the future
  31347. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  31348. data = runModifiers(data.instance.modifiers, data, 'flip');
  31349. }
  31350. });
  31351. return data;
  31352. }
  31353. /**
  31354. * @function
  31355. * @memberof Modifiers
  31356. * @argument {Object} data - The data object generated by update method
  31357. * @argument {Object} options - Modifiers configuration and options
  31358. * @returns {Object} The data object, properly modified
  31359. */
  31360. function keepTogether(data) {
  31361. var _data$offsets = data.offsets,
  31362. popper = _data$offsets.popper,
  31363. reference = _data$offsets.reference;
  31364. var placement = data.placement.split('-')[0];
  31365. var floor = Math.floor;
  31366. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31367. var side = isVertical ? 'right' : 'bottom';
  31368. var opSide = isVertical ? 'left' : 'top';
  31369. var measurement = isVertical ? 'width' : 'height';
  31370. if (popper[side] < floor(reference[opSide])) {
  31371. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  31372. }
  31373. if (popper[opSide] > floor(reference[side])) {
  31374. data.offsets.popper[opSide] = floor(reference[side]);
  31375. }
  31376. return data;
  31377. }
  31378. /**
  31379. * Converts a string containing value + unit into a px value number
  31380. * @function
  31381. * @memberof {modifiers~offset}
  31382. * @private
  31383. * @argument {String} str - Value + unit string
  31384. * @argument {String} measurement - `height` or `width`
  31385. * @argument {Object} popperOffsets
  31386. * @argument {Object} referenceOffsets
  31387. * @returns {Number|String}
  31388. * Value in pixels, or original string if no values were extracted
  31389. */
  31390. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  31391. // separate value from unit
  31392. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  31393. var value = +split[1];
  31394. var unit = split[2];
  31395. // If it's not a number it's an operator, I guess
  31396. if (!value) {
  31397. return str;
  31398. }
  31399. if (unit.indexOf('%') === 0) {
  31400. var element = void 0;
  31401. switch (unit) {
  31402. case '%p':
  31403. element = popperOffsets;
  31404. break;
  31405. case '%':
  31406. case '%r':
  31407. default:
  31408. element = referenceOffsets;
  31409. }
  31410. var rect = getClientRect(element);
  31411. return rect[measurement] / 100 * value;
  31412. } else if (unit === 'vh' || unit === 'vw') {
  31413. // if is a vh or vw, we calculate the size based on the viewport
  31414. var size = void 0;
  31415. if (unit === 'vh') {
  31416. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  31417. } else {
  31418. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  31419. }
  31420. return size / 100 * value;
  31421. } else {
  31422. // if is an explicit pixel unit, we get rid of the unit and keep the value
  31423. // if is an implicit unit, it's px, and we return just the value
  31424. return value;
  31425. }
  31426. }
  31427. /**
  31428. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  31429. * @function
  31430. * @memberof {modifiers~offset}
  31431. * @private
  31432. * @argument {String} offset
  31433. * @argument {Object} popperOffsets
  31434. * @argument {Object} referenceOffsets
  31435. * @argument {String} basePlacement
  31436. * @returns {Array} a two cells array with x and y offsets in numbers
  31437. */
  31438. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  31439. var offsets = [0, 0];
  31440. // Use height if placement is left or right and index is 0 otherwise use width
  31441. // in this way the first offset will use an axis and the second one
  31442. // will use the other one
  31443. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  31444. // Split the offset string to obtain a list of values and operands
  31445. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  31446. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  31447. return frag.trim();
  31448. });
  31449. // Detect if the offset string contains a pair of values or a single one
  31450. // they could be separated by comma or space
  31451. var divider = fragments.indexOf(find(fragments, function (frag) {
  31452. return frag.search(/,|\s/) !== -1;
  31453. }));
  31454. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  31455. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  31456. }
  31457. // If divider is found, we divide the list of values and operands to divide
  31458. // them by ofset X and Y.
  31459. var splitRegex = /\s*,\s*|\s+/;
  31460. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  31461. // Convert the values with units to absolute pixels to allow our computations
  31462. ops = ops.map(function (op, index) {
  31463. // Most of the units rely on the orientation of the popper
  31464. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  31465. var mergeWithPrevious = false;
  31466. return op
  31467. // This aggregates any `+` or `-` sign that aren't considered operators
  31468. // e.g.: 10 + +5 => [10, +, +5]
  31469. .reduce(function (a, b) {
  31470. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  31471. a[a.length - 1] = b;
  31472. mergeWithPrevious = true;
  31473. return a;
  31474. } else if (mergeWithPrevious) {
  31475. a[a.length - 1] += b;
  31476. mergeWithPrevious = false;
  31477. return a;
  31478. } else {
  31479. return a.concat(b);
  31480. }
  31481. }, [])
  31482. // Here we convert the string values into number values (in px)
  31483. .map(function (str) {
  31484. return toValue(str, measurement, popperOffsets, referenceOffsets);
  31485. });
  31486. });
  31487. // Loop trough the offsets arrays and execute the operations
  31488. ops.forEach(function (op, index) {
  31489. op.forEach(function (frag, index2) {
  31490. if (isNumeric(frag)) {
  31491. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31492. }
  31493. });
  31494. });
  31495. return offsets;
  31496. }
  31497. /**
  31498. * @function
  31499. * @memberof Modifiers
  31500. * @argument {Object} data - The data object generated by update method
  31501. * @argument {Object} options - Modifiers configuration and options
  31502. * @argument {Number|String} options.offset=0
  31503. * The offset value as described in the modifier description
  31504. * @returns {Object} The data object, properly modified
  31505. */
  31506. function offset(data, _ref) {
  31507. var offset = _ref.offset;
  31508. var placement = data.placement,
  31509. _data$offsets = data.offsets,
  31510. popper = _data$offsets.popper,
  31511. reference = _data$offsets.reference;
  31512. var basePlacement = placement.split('-')[0];
  31513. var offsets = void 0;
  31514. if (isNumeric(+offset)) {
  31515. offsets = [+offset, 0];
  31516. } else {
  31517. offsets = parseOffset(offset, popper, reference, basePlacement);
  31518. }
  31519. if (basePlacement === 'left') {
  31520. popper.top += offsets[0];
  31521. popper.left -= offsets[1];
  31522. } else if (basePlacement === 'right') {
  31523. popper.top += offsets[0];
  31524. popper.left += offsets[1];
  31525. } else if (basePlacement === 'top') {
  31526. popper.left += offsets[0];
  31527. popper.top -= offsets[1];
  31528. } else if (basePlacement === 'bottom') {
  31529. popper.left += offsets[0];
  31530. popper.top += offsets[1];
  31531. }
  31532. data.popper = popper;
  31533. return data;
  31534. }
  31535. /**
  31536. * @function
  31537. * @memberof Modifiers
  31538. * @argument {Object} data - The data object generated by `update` method
  31539. * @argument {Object} options - Modifiers configuration and options
  31540. * @returns {Object} The data object, properly modified
  31541. */
  31542. function preventOverflow(data, options) {
  31543. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31544. // If offsetParent is the reference element, we really want to
  31545. // go one step up and use the next offsetParent as reference to
  31546. // avoid to make this modifier completely useless and look like broken
  31547. if (data.instance.reference === boundariesElement) {
  31548. boundariesElement = getOffsetParent(boundariesElement);
  31549. }
  31550. // NOTE: DOM access here
  31551. // resets the popper's position so that the document size can be calculated excluding
  31552. // the size of the popper element itself
  31553. var transformProp = getSupportedPropertyName('transform');
  31554. var popperStyles = data.instance.popper.style; // assignment to help minification
  31555. var top = popperStyles.top,
  31556. left = popperStyles.left,
  31557. transform = popperStyles[transformProp];
  31558. popperStyles.top = '';
  31559. popperStyles.left = '';
  31560. popperStyles[transformProp] = '';
  31561. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31562. // NOTE: DOM access here
  31563. // restores the original style properties after the offsets have been computed
  31564. popperStyles.top = top;
  31565. popperStyles.left = left;
  31566. popperStyles[transformProp] = transform;
  31567. options.boundaries = boundaries;
  31568. var order = options.priority;
  31569. var popper = data.offsets.popper;
  31570. var check = {
  31571. primary: function primary(placement) {
  31572. var value = popper[placement];
  31573. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31574. value = Math.max(popper[placement], boundaries[placement]);
  31575. }
  31576. return defineProperty({}, placement, value);
  31577. },
  31578. secondary: function secondary(placement) {
  31579. var mainSide = placement === 'right' ? 'left' : 'top';
  31580. var value = popper[mainSide];
  31581. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31582. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31583. }
  31584. return defineProperty({}, mainSide, value);
  31585. }
  31586. };
  31587. order.forEach(function (placement) {
  31588. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31589. popper = _extends({}, popper, check[side](placement));
  31590. });
  31591. data.offsets.popper = popper;
  31592. return data;
  31593. }
  31594. /**
  31595. * @function
  31596. * @memberof Modifiers
  31597. * @argument {Object} data - The data object generated by `update` method
  31598. * @argument {Object} options - Modifiers configuration and options
  31599. * @returns {Object} The data object, properly modified
  31600. */
  31601. function shift(data) {
  31602. var placement = data.placement;
  31603. var basePlacement = placement.split('-')[0];
  31604. var shiftvariation = placement.split('-')[1];
  31605. // if shift shiftvariation is specified, run the modifier
  31606. if (shiftvariation) {
  31607. var _data$offsets = data.offsets,
  31608. reference = _data$offsets.reference,
  31609. popper = _data$offsets.popper;
  31610. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31611. var side = isVertical ? 'left' : 'top';
  31612. var measurement = isVertical ? 'width' : 'height';
  31613. var shiftOffsets = {
  31614. start: defineProperty({}, side, reference[side]),
  31615. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31616. };
  31617. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31618. }
  31619. return data;
  31620. }
  31621. /**
  31622. * @function
  31623. * @memberof Modifiers
  31624. * @argument {Object} data - The data object generated by update method
  31625. * @argument {Object} options - Modifiers configuration and options
  31626. * @returns {Object} The data object, properly modified
  31627. */
  31628. function hide(data) {
  31629. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31630. return data;
  31631. }
  31632. var refRect = data.offsets.reference;
  31633. var bound = find(data.instance.modifiers, function (modifier) {
  31634. return modifier.name === 'preventOverflow';
  31635. }).boundaries;
  31636. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31637. // Avoid unnecessary DOM access if visibility hasn't changed
  31638. if (data.hide === true) {
  31639. return data;
  31640. }
  31641. data.hide = true;
  31642. data.attributes['x-out-of-boundaries'] = '';
  31643. } else {
  31644. // Avoid unnecessary DOM access if visibility hasn't changed
  31645. if (data.hide === false) {
  31646. return data;
  31647. }
  31648. data.hide = false;
  31649. data.attributes['x-out-of-boundaries'] = false;
  31650. }
  31651. return data;
  31652. }
  31653. /**
  31654. * @function
  31655. * @memberof Modifiers
  31656. * @argument {Object} data - The data object generated by `update` method
  31657. * @argument {Object} options - Modifiers configuration and options
  31658. * @returns {Object} The data object, properly modified
  31659. */
  31660. function inner(data) {
  31661. var placement = data.placement;
  31662. var basePlacement = placement.split('-')[0];
  31663. var _data$offsets = data.offsets,
  31664. popper = _data$offsets.popper,
  31665. reference = _data$offsets.reference;
  31666. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31667. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31668. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31669. data.placement = getOppositePlacement(placement);
  31670. data.offsets.popper = getClientRect(popper);
  31671. return data;
  31672. }
  31673. /**
  31674. * Modifier function, each modifier can have a function of this type assigned
  31675. * to its `fn` property.<br />
  31676. * These functions will be called on each update, this means that you must
  31677. * make sure they are performant enough to avoid performance bottlenecks.
  31678. *
  31679. * @function ModifierFn
  31680. * @argument {dataObject} data - The data object generated by `update` method
  31681. * @argument {Object} options - Modifiers configuration and options
  31682. * @returns {dataObject} The data object, properly modified
  31683. */
  31684. /**
  31685. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31686. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31687. * needed by the library.
  31688. *
  31689. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31690. * All the other properties are configurations that could be tweaked.
  31691. * @namespace modifiers
  31692. */
  31693. var modifiers = {
  31694. /**
  31695. * Modifier used to shift the popper on the start or end of its reference
  31696. * element.<br />
  31697. * It will read the variation of the `placement` property.<br />
  31698. * It can be one either `-end` or `-start`.
  31699. * @memberof modifiers
  31700. * @inner
  31701. */
  31702. shift: {
  31703. /** @prop {number} order=100 - Index used to define the order of execution */
  31704. order: 100,
  31705. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31706. enabled: true,
  31707. /** @prop {ModifierFn} */
  31708. fn: shift
  31709. },
  31710. /**
  31711. * The `offset` modifier can shift your popper on both its axis.
  31712. *
  31713. * It accepts the following units:
  31714. * - `px` or unit-less, interpreted as pixels
  31715. * - `%` or `%r`, percentage relative to the length of the reference element
  31716. * - `%p`, percentage relative to the length of the popper element
  31717. * - `vw`, CSS viewport width unit
  31718. * - `vh`, CSS viewport height unit
  31719. *
  31720. * For length is intended the main axis relative to the placement of the popper.<br />
  31721. * This means that if the placement is `top` or `bottom`, the length will be the
  31722. * `width`. In case of `left` or `right`, it will be the `height`.
  31723. *
  31724. * You can provide a single value (as `Number` or `String`), or a pair of values
  31725. * as `String` divided by a comma or one (or more) white spaces.<br />
  31726. * The latter is a deprecated method because it leads to confusion and will be
  31727. * removed in v2.<br />
  31728. * Additionally, it accepts additions and subtractions between different units.
  31729. * Note that multiplications and divisions aren't supported.
  31730. *
  31731. * Valid examples are:
  31732. * ```
  31733. * 10
  31734. * '10%'
  31735. * '10, 10'
  31736. * '10%, 10'
  31737. * '10 + 10%'
  31738. * '10 - 5vh + 3%'
  31739. * '-10px + 5vh, 5px - 6%'
  31740. * ```
  31741. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31742. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31743. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31744. *
  31745. * @memberof modifiers
  31746. * @inner
  31747. */
  31748. offset: {
  31749. /** @prop {number} order=200 - Index used to define the order of execution */
  31750. order: 200,
  31751. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31752. enabled: true,
  31753. /** @prop {ModifierFn} */
  31754. fn: offset,
  31755. /** @prop {Number|String} offset=0
  31756. * The offset value as described in the modifier description
  31757. */
  31758. offset: 0
  31759. },
  31760. /**
  31761. * Modifier used to prevent the popper from being positioned outside the boundary.
  31762. *
  31763. * A scenario exists where the reference itself is not within the boundaries.<br />
  31764. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31765. * In this case we need to decide whether the popper should either:
  31766. *
  31767. * - detach from the reference and remain "trapped" in the boundaries, or
  31768. * - if it should ignore the boundary and "escape with its reference"
  31769. *
  31770. * When `escapeWithReference` is set to`true` and reference is completely
  31771. * outside its boundaries, the popper will overflow (or completely leave)
  31772. * the boundaries in order to remain attached to the edge of the reference.
  31773. *
  31774. * @memberof modifiers
  31775. * @inner
  31776. */
  31777. preventOverflow: {
  31778. /** @prop {number} order=300 - Index used to define the order of execution */
  31779. order: 300,
  31780. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31781. enabled: true,
  31782. /** @prop {ModifierFn} */
  31783. fn: preventOverflow,
  31784. /**
  31785. * @prop {Array} [priority=['left','right','top','bottom']]
  31786. * Popper will try to prevent overflow following these priorities by default,
  31787. * then, it could overflow on the left and on top of the `boundariesElement`
  31788. */
  31789. priority: ['left', 'right', 'top', 'bottom'],
  31790. /**
  31791. * @prop {number} padding=5
  31792. * Amount of pixel used to define a minimum distance between the boundaries
  31793. * and the popper. This makes sure the popper always has a little padding
  31794. * between the edges of its container
  31795. */
  31796. padding: 5,
  31797. /**
  31798. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31799. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31800. * `viewport` or any DOM element.
  31801. */
  31802. boundariesElement: 'scrollParent'
  31803. },
  31804. /**
  31805. * Modifier used to make sure the reference and its popper stay near each other
  31806. * without leaving any gap between the two. Especially useful when the arrow is
  31807. * enabled and you want to ensure that it points to its reference element.
  31808. * It cares only about the first axis. You can still have poppers with margin
  31809. * between the popper and its reference element.
  31810. * @memberof modifiers
  31811. * @inner
  31812. */
  31813. keepTogether: {
  31814. /** @prop {number} order=400 - Index used to define the order of execution */
  31815. order: 400,
  31816. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31817. enabled: true,
  31818. /** @prop {ModifierFn} */
  31819. fn: keepTogether
  31820. },
  31821. /**
  31822. * This modifier is used to move the `arrowElement` of the popper to make
  31823. * sure it is positioned between the reference element and its popper element.
  31824. * It will read the outer size of the `arrowElement` node to detect how many
  31825. * pixels of conjunction are needed.
  31826. *
  31827. * It has no effect if no `arrowElement` is provided.
  31828. * @memberof modifiers
  31829. * @inner
  31830. */
  31831. arrow: {
  31832. /** @prop {number} order=500 - Index used to define the order of execution */
  31833. order: 500,
  31834. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31835. enabled: true,
  31836. /** @prop {ModifierFn} */
  31837. fn: arrow,
  31838. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  31839. element: '[x-arrow]'
  31840. },
  31841. /**
  31842. * Modifier used to flip the popper's placement when it starts to overlap its
  31843. * reference element.
  31844. *
  31845. * Requires the `preventOverflow` modifier before it in order to work.
  31846. *
  31847. * **NOTE:** this modifier will interrupt the current update cycle and will
  31848. * restart it if it detects the need to flip the placement.
  31849. * @memberof modifiers
  31850. * @inner
  31851. */
  31852. flip: {
  31853. /** @prop {number} order=600 - Index used to define the order of execution */
  31854. order: 600,
  31855. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31856. enabled: true,
  31857. /** @prop {ModifierFn} */
  31858. fn: flip,
  31859. /**
  31860. * @prop {String|Array} behavior='flip'
  31861. * The behavior used to change the popper's placement. It can be one of
  31862. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  31863. * placements (with optional variations)
  31864. */
  31865. behavior: 'flip',
  31866. /**
  31867. * @prop {number} padding=5
  31868. * The popper will flip if it hits the edges of the `boundariesElement`
  31869. */
  31870. padding: 5,
  31871. /**
  31872. * @prop {String|HTMLElement} boundariesElement='viewport'
  31873. * The element which will define the boundaries of the popper position.
  31874. * The popper will never be placed outside of the defined boundaries
  31875. * (except if `keepTogether` is enabled)
  31876. */
  31877. boundariesElement: 'viewport',
  31878. /**
  31879. * @prop {Boolean} flipVariations=false
  31880. * The popper will switch placement variation between `-start` and `-end` when
  31881. * the reference element overlaps its boundaries.
  31882. *
  31883. * The original placement should have a set variation.
  31884. */
  31885. flipVariations: false,
  31886. /**
  31887. * @prop {Boolean} flipVariationsByContent=false
  31888. * The popper will switch placement variation between `-start` and `-end` when
  31889. * the popper element overlaps its reference boundaries.
  31890. *
  31891. * The original placement should have a set variation.
  31892. */
  31893. flipVariationsByContent: false
  31894. },
  31895. /**
  31896. * Modifier used to make the popper flow toward the inner of the reference element.
  31897. * By default, when this modifier is disabled, the popper will be placed outside
  31898. * the reference element.
  31899. * @memberof modifiers
  31900. * @inner
  31901. */
  31902. inner: {
  31903. /** @prop {number} order=700 - Index used to define the order of execution */
  31904. order: 700,
  31905. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  31906. enabled: false,
  31907. /** @prop {ModifierFn} */
  31908. fn: inner
  31909. },
  31910. /**
  31911. * Modifier used to hide the popper when its reference element is outside of the
  31912. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  31913. * be used to hide with a CSS selector the popper when its reference is
  31914. * out of boundaries.
  31915. *
  31916. * Requires the `preventOverflow` modifier before it in order to work.
  31917. * @memberof modifiers
  31918. * @inner
  31919. */
  31920. hide: {
  31921. /** @prop {number} order=800 - Index used to define the order of execution */
  31922. order: 800,
  31923. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31924. enabled: true,
  31925. /** @prop {ModifierFn} */
  31926. fn: hide
  31927. },
  31928. /**
  31929. * Computes the style that will be applied to the popper element to gets
  31930. * properly positioned.
  31931. *
  31932. * Note that this modifier will not touch the DOM, it just prepares the styles
  31933. * so that `applyStyle` modifier can apply it. This separation is useful
  31934. * in case you need to replace `applyStyle` with a custom implementation.
  31935. *
  31936. * This modifier has `850` as `order` value to maintain backward compatibility
  31937. * with previous versions of Popper.js. Expect the modifiers ordering method
  31938. * to change in future major versions of the library.
  31939. *
  31940. * @memberof modifiers
  31941. * @inner
  31942. */
  31943. computeStyle: {
  31944. /** @prop {number} order=850 - Index used to define the order of execution */
  31945. order: 850,
  31946. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31947. enabled: true,
  31948. /** @prop {ModifierFn} */
  31949. fn: computeStyle,
  31950. /**
  31951. * @prop {Boolean} gpuAcceleration=true
  31952. * If true, it uses the CSS 3D transformation to position the popper.
  31953. * Otherwise, it will use the `top` and `left` properties
  31954. */
  31955. gpuAcceleration: true,
  31956. /**
  31957. * @prop {string} [x='bottom']
  31958. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  31959. * Change this if your popper should grow in a direction different from `bottom`
  31960. */
  31961. x: 'bottom',
  31962. /**
  31963. * @prop {string} [x='left']
  31964. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  31965. * Change this if your popper should grow in a direction different from `right`
  31966. */
  31967. y: 'right'
  31968. },
  31969. /**
  31970. * Applies the computed styles to the popper element.
  31971. *
  31972. * All the DOM manipulations are limited to this modifier. This is useful in case
  31973. * you want to integrate Popper.js inside a framework or view library and you
  31974. * want to delegate all the DOM manipulations to it.
  31975. *
  31976. * Note that if you disable this modifier, you must make sure the popper element
  31977. * has its position set to `absolute` before Popper.js can do its work!
  31978. *
  31979. * Just disable this modifier and define your own to achieve the desired effect.
  31980. *
  31981. * @memberof modifiers
  31982. * @inner
  31983. */
  31984. applyStyle: {
  31985. /** @prop {number} order=900 - Index used to define the order of execution */
  31986. order: 900,
  31987. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31988. enabled: true,
  31989. /** @prop {ModifierFn} */
  31990. fn: applyStyle,
  31991. /** @prop {Function} */
  31992. onLoad: applyStyleOnLoad,
  31993. /**
  31994. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  31995. * @prop {Boolean} gpuAcceleration=true
  31996. * If true, it uses the CSS 3D transformation to position the popper.
  31997. * Otherwise, it will use the `top` and `left` properties
  31998. */
  31999. gpuAcceleration: undefined
  32000. }
  32001. };
  32002. /**
  32003. * The `dataObject` is an object containing all the information used by Popper.js.
  32004. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  32005. * @name dataObject
  32006. * @property {Object} data.instance The Popper.js instance
  32007. * @property {String} data.placement Placement applied to popper
  32008. * @property {String} data.originalPlacement Placement originally defined on init
  32009. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  32010. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  32011. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  32012. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32013. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32014. * @property {Object} data.boundaries Offsets of the popper boundaries
  32015. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  32016. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  32017. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  32018. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  32019. */
  32020. /**
  32021. * Default options provided to Popper.js constructor.<br />
  32022. * These can be overridden using the `options` argument of Popper.js.<br />
  32023. * To override an option, simply pass an object with the same
  32024. * structure of the `options` object, as the 3rd argument. For example:
  32025. * ```
  32026. * new Popper(ref, pop, {
  32027. * modifiers: {
  32028. * preventOverflow: { enabled: false }
  32029. * }
  32030. * })
  32031. * ```
  32032. * @type {Object}
  32033. * @static
  32034. * @memberof Popper
  32035. */
  32036. var Defaults = {
  32037. /**
  32038. * Popper's placement.
  32039. * @prop {Popper.placements} placement='bottom'
  32040. */
  32041. placement: 'bottom',
  32042. /**
  32043. * Set this to true if you want popper to position it self in 'fixed' mode
  32044. * @prop {Boolean} positionFixed=false
  32045. */
  32046. positionFixed: false,
  32047. /**
  32048. * Whether events (resize, scroll) are initially enabled.
  32049. * @prop {Boolean} eventsEnabled=true
  32050. */
  32051. eventsEnabled: true,
  32052. /**
  32053. * Set to true if you want to automatically remove the popper when
  32054. * you call the `destroy` method.
  32055. * @prop {Boolean} removeOnDestroy=false
  32056. */
  32057. removeOnDestroy: false,
  32058. /**
  32059. * Callback called when the popper is created.<br />
  32060. * By default, it is set to no-op.<br />
  32061. * Access Popper.js instance with `data.instance`.
  32062. * @prop {onCreate}
  32063. */
  32064. onCreate: function onCreate() {},
  32065. /**
  32066. * Callback called when the popper is updated. This callback is not called
  32067. * on the initialization/creation of the popper, but only on subsequent
  32068. * updates.<br />
  32069. * By default, it is set to no-op.<br />
  32070. * Access Popper.js instance with `data.instance`.
  32071. * @prop {onUpdate}
  32072. */
  32073. onUpdate: function onUpdate() {},
  32074. /**
  32075. * List of modifiers used to modify the offsets before they are applied to the popper.
  32076. * They provide most of the functionalities of Popper.js.
  32077. * @prop {modifiers}
  32078. */
  32079. modifiers: modifiers
  32080. };
  32081. /**
  32082. * @callback onCreate
  32083. * @param {dataObject} data
  32084. */
  32085. /**
  32086. * @callback onUpdate
  32087. * @param {dataObject} data
  32088. */
  32089. // Utils
  32090. // Methods
  32091. var Popper = function () {
  32092. /**
  32093. * Creates a new Popper.js instance.
  32094. * @class Popper
  32095. * @param {Element|referenceObject} reference - The reference element used to position the popper
  32096. * @param {Element} popper - The HTML / XML element used as the popper
  32097. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  32098. * @return {Object} instance - The generated Popper.js instance
  32099. */
  32100. function Popper(reference, popper) {
  32101. var _this = this;
  32102. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  32103. classCallCheck(this, Popper);
  32104. this.scheduleUpdate = function () {
  32105. return requestAnimationFrame(_this.update);
  32106. };
  32107. // make update() debounced, so that it only runs at most once-per-tick
  32108. this.update = debounce(this.update.bind(this));
  32109. // with {} we create a new object with the options inside it
  32110. this.options = _extends({}, Popper.Defaults, options);
  32111. // init state
  32112. this.state = {
  32113. isDestroyed: false,
  32114. isCreated: false,
  32115. scrollParents: []
  32116. };
  32117. // get reference and popper elements (allow jQuery wrappers)
  32118. this.reference = reference && reference.jquery ? reference[0] : reference;
  32119. this.popper = popper && popper.jquery ? popper[0] : popper;
  32120. // Deep merge modifiers options
  32121. this.options.modifiers = {};
  32122. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  32123. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  32124. });
  32125. // Refactoring modifiers' list (Object => Array)
  32126. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  32127. return _extends({
  32128. name: name
  32129. }, _this.options.modifiers[name]);
  32130. })
  32131. // sort the modifiers by order
  32132. .sort(function (a, b) {
  32133. return a.order - b.order;
  32134. });
  32135. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  32136. // such code is executed in the same order of its modifier
  32137. // they could add new properties to their options configuration
  32138. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  32139. this.modifiers.forEach(function (modifierOptions) {
  32140. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  32141. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  32142. }
  32143. });
  32144. // fire the first update to position the popper in the right place
  32145. this.update();
  32146. var eventsEnabled = this.options.eventsEnabled;
  32147. if (eventsEnabled) {
  32148. // setup event listeners, they will take care of update the position in specific situations
  32149. this.enableEventListeners();
  32150. }
  32151. this.state.eventsEnabled = eventsEnabled;
  32152. }
  32153. // We can't use class properties because they don't get listed in the
  32154. // class prototype and break stuff like Sinon stubs
  32155. createClass(Popper, [{
  32156. key: 'update',
  32157. value: function update$$1() {
  32158. return update.call(this);
  32159. }
  32160. }, {
  32161. key: 'destroy',
  32162. value: function destroy$$1() {
  32163. return destroy.call(this);
  32164. }
  32165. }, {
  32166. key: 'enableEventListeners',
  32167. value: function enableEventListeners$$1() {
  32168. return enableEventListeners.call(this);
  32169. }
  32170. }, {
  32171. key: 'disableEventListeners',
  32172. value: function disableEventListeners$$1() {
  32173. return disableEventListeners.call(this);
  32174. }
  32175. /**
  32176. * Schedules an update. It will run on the next UI update available.
  32177. * @method scheduleUpdate
  32178. * @memberof Popper
  32179. */
  32180. /**
  32181. * Collection of utilities useful when writing custom modifiers.
  32182. * Starting from version 1.7, this method is available only if you
  32183. * include `popper-utils.js` before `popper.js`.
  32184. *
  32185. * **DEPRECATION**: This way to access PopperUtils is deprecated
  32186. * and will be removed in v2! Use the PopperUtils module directly instead.
  32187. * Due to the high instability of the methods contained in Utils, we can't
  32188. * guarantee them to follow semver. Use them at your own risk!
  32189. * @static
  32190. * @private
  32191. * @type {Object}
  32192. * @deprecated since version 1.8
  32193. * @member Utils
  32194. * @memberof Popper
  32195. */
  32196. }]);
  32197. return Popper;
  32198. }();
  32199. /**
  32200. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  32201. * and lets you use it as replacement of a real DOM node.<br />
  32202. * You can use this method to position a popper relatively to a set of coordinates
  32203. * in case you don't have a DOM node to use as reference.
  32204. *
  32205. * ```
  32206. * new Popper(referenceObject, popperNode);
  32207. * ```
  32208. *
  32209. * NB: This feature isn't supported in Internet Explorer 10.
  32210. * @name referenceObject
  32211. * @property {Function} data.getBoundingClientRect
  32212. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  32213. * @property {number} data.clientWidth
  32214. * An ES6 getter that will return the width of the virtual reference element.
  32215. * @property {number} data.clientHeight
  32216. * An ES6 getter that will return the height of the virtual reference element.
  32217. */
  32218. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  32219. Popper.placements = placements;
  32220. Popper.Defaults = Defaults;
  32221. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  32222. //# sourceMappingURL=popper.js.map
  32223. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32224. /***/ }),
  32225. /***/ "./node_modules/process/browser.js":
  32226. /*!*****************************************!*\
  32227. !*** ./node_modules/process/browser.js ***!
  32228. \*****************************************/
  32229. /*! no static exports found */
  32230. /***/ (function(module, exports) {
  32231. // shim for using process in browser
  32232. var process = module.exports = {};
  32233. // cached from whatever global is present so that test runners that stub it
  32234. // don't break things. But we need to wrap it in a try catch in case it is
  32235. // wrapped in strict mode code which doesn't define any globals. It's inside a
  32236. // function because try/catches deoptimize in certain engines.
  32237. var cachedSetTimeout;
  32238. var cachedClearTimeout;
  32239. function defaultSetTimout() {
  32240. throw new Error('setTimeout has not been defined');
  32241. }
  32242. function defaultClearTimeout () {
  32243. throw new Error('clearTimeout has not been defined');
  32244. }
  32245. (function () {
  32246. try {
  32247. if (typeof setTimeout === 'function') {
  32248. cachedSetTimeout = setTimeout;
  32249. } else {
  32250. cachedSetTimeout = defaultSetTimout;
  32251. }
  32252. } catch (e) {
  32253. cachedSetTimeout = defaultSetTimout;
  32254. }
  32255. try {
  32256. if (typeof clearTimeout === 'function') {
  32257. cachedClearTimeout = clearTimeout;
  32258. } else {
  32259. cachedClearTimeout = defaultClearTimeout;
  32260. }
  32261. } catch (e) {
  32262. cachedClearTimeout = defaultClearTimeout;
  32263. }
  32264. } ())
  32265. function runTimeout(fun) {
  32266. if (cachedSetTimeout === setTimeout) {
  32267. //normal enviroments in sane situations
  32268. return setTimeout(fun, 0);
  32269. }
  32270. // if setTimeout wasn't available but was latter defined
  32271. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  32272. cachedSetTimeout = setTimeout;
  32273. return setTimeout(fun, 0);
  32274. }
  32275. try {
  32276. // when when somebody has screwed with setTimeout but no I.E. maddness
  32277. return cachedSetTimeout(fun, 0);
  32278. } catch(e){
  32279. try {
  32280. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32281. return cachedSetTimeout.call(null, fun, 0);
  32282. } catch(e){
  32283. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  32284. return cachedSetTimeout.call(this, fun, 0);
  32285. }
  32286. }
  32287. }
  32288. function runClearTimeout(marker) {
  32289. if (cachedClearTimeout === clearTimeout) {
  32290. //normal enviroments in sane situations
  32291. return clearTimeout(marker);
  32292. }
  32293. // if clearTimeout wasn't available but was latter defined
  32294. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  32295. cachedClearTimeout = clearTimeout;
  32296. return clearTimeout(marker);
  32297. }
  32298. try {
  32299. // when when somebody has screwed with setTimeout but no I.E. maddness
  32300. return cachedClearTimeout(marker);
  32301. } catch (e){
  32302. try {
  32303. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32304. return cachedClearTimeout.call(null, marker);
  32305. } catch (e){
  32306. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  32307. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  32308. return cachedClearTimeout.call(this, marker);
  32309. }
  32310. }
  32311. }
  32312. var queue = [];
  32313. var draining = false;
  32314. var currentQueue;
  32315. var queueIndex = -1;
  32316. function cleanUpNextTick() {
  32317. if (!draining || !currentQueue) {
  32318. return;
  32319. }
  32320. draining = false;
  32321. if (currentQueue.length) {
  32322. queue = currentQueue.concat(queue);
  32323. } else {
  32324. queueIndex = -1;
  32325. }
  32326. if (queue.length) {
  32327. drainQueue();
  32328. }
  32329. }
  32330. function drainQueue() {
  32331. if (draining) {
  32332. return;
  32333. }
  32334. var timeout = runTimeout(cleanUpNextTick);
  32335. draining = true;
  32336. var len = queue.length;
  32337. while(len) {
  32338. currentQueue = queue;
  32339. queue = [];
  32340. while (++queueIndex < len) {
  32341. if (currentQueue) {
  32342. currentQueue[queueIndex].run();
  32343. }
  32344. }
  32345. queueIndex = -1;
  32346. len = queue.length;
  32347. }
  32348. currentQueue = null;
  32349. draining = false;
  32350. runClearTimeout(timeout);
  32351. }
  32352. process.nextTick = function (fun) {
  32353. var args = new Array(arguments.length - 1);
  32354. if (arguments.length > 1) {
  32355. for (var i = 1; i < arguments.length; i++) {
  32356. args[i - 1] = arguments[i];
  32357. }
  32358. }
  32359. queue.push(new Item(fun, args));
  32360. if (queue.length === 1 && !draining) {
  32361. runTimeout(drainQueue);
  32362. }
  32363. };
  32364. // v8 likes predictible objects
  32365. function Item(fun, array) {
  32366. this.fun = fun;
  32367. this.array = array;
  32368. }
  32369. Item.prototype.run = function () {
  32370. this.fun.apply(null, this.array);
  32371. };
  32372. process.title = 'browser';
  32373. process.browser = true;
  32374. process.env = {};
  32375. process.argv = [];
  32376. process.version = ''; // empty string to avoid regexp issues
  32377. process.versions = {};
  32378. function noop() {}
  32379. process.on = noop;
  32380. process.addListener = noop;
  32381. process.once = noop;
  32382. process.off = noop;
  32383. process.removeListener = noop;
  32384. process.removeAllListeners = noop;
  32385. process.emit = noop;
  32386. process.prependListener = noop;
  32387. process.prependOnceListener = noop;
  32388. process.listeners = function (name) { return [] }
  32389. process.binding = function (name) {
  32390. throw new Error('process.binding is not supported');
  32391. };
  32392. process.cwd = function () { return '/' };
  32393. process.chdir = function (dir) {
  32394. throw new Error('process.chdir is not supported');
  32395. };
  32396. process.umask = function() { return 0; };
  32397. /***/ }),
  32398. /***/ "./node_modules/setimmediate/setImmediate.js":
  32399. /*!***************************************************!*\
  32400. !*** ./node_modules/setimmediate/setImmediate.js ***!
  32401. \***************************************************/
  32402. /*! no static exports found */
  32403. /***/ (function(module, exports, __webpack_require__) {
  32404. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  32405. "use strict";
  32406. if (global.setImmediate) {
  32407. return;
  32408. }
  32409. var nextHandle = 1; // Spec says greater than zero
  32410. var tasksByHandle = {};
  32411. var currentlyRunningATask = false;
  32412. var doc = global.document;
  32413. var registerImmediate;
  32414. function setImmediate(callback) {
  32415. // Callback can either be a function or a string
  32416. if (typeof callback !== "function") {
  32417. callback = new Function("" + callback);
  32418. }
  32419. // Copy function arguments
  32420. var args = new Array(arguments.length - 1);
  32421. for (var i = 0; i < args.length; i++) {
  32422. args[i] = arguments[i + 1];
  32423. }
  32424. // Store and register the task
  32425. var task = { callback: callback, args: args };
  32426. tasksByHandle[nextHandle] = task;
  32427. registerImmediate(nextHandle);
  32428. return nextHandle++;
  32429. }
  32430. function clearImmediate(handle) {
  32431. delete tasksByHandle[handle];
  32432. }
  32433. function run(task) {
  32434. var callback = task.callback;
  32435. var args = task.args;
  32436. switch (args.length) {
  32437. case 0:
  32438. callback();
  32439. break;
  32440. case 1:
  32441. callback(args[0]);
  32442. break;
  32443. case 2:
  32444. callback(args[0], args[1]);
  32445. break;
  32446. case 3:
  32447. callback(args[0], args[1], args[2]);
  32448. break;
  32449. default:
  32450. callback.apply(undefined, args);
  32451. break;
  32452. }
  32453. }
  32454. function runIfPresent(handle) {
  32455. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  32456. // So if we're currently running a task, we'll need to delay this invocation.
  32457. if (currentlyRunningATask) {
  32458. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  32459. // "too much recursion" error.
  32460. setTimeout(runIfPresent, 0, handle);
  32461. } else {
  32462. var task = tasksByHandle[handle];
  32463. if (task) {
  32464. currentlyRunningATask = true;
  32465. try {
  32466. run(task);
  32467. } finally {
  32468. clearImmediate(handle);
  32469. currentlyRunningATask = false;
  32470. }
  32471. }
  32472. }
  32473. }
  32474. function installNextTickImplementation() {
  32475. registerImmediate = function(handle) {
  32476. process.nextTick(function () { runIfPresent(handle); });
  32477. };
  32478. }
  32479. function canUsePostMessage() {
  32480. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  32481. // where `global.postMessage` means something completely different and can't be used for this purpose.
  32482. if (global.postMessage && !global.importScripts) {
  32483. var postMessageIsAsynchronous = true;
  32484. var oldOnMessage = global.onmessage;
  32485. global.onmessage = function() {
  32486. postMessageIsAsynchronous = false;
  32487. };
  32488. global.postMessage("", "*");
  32489. global.onmessage = oldOnMessage;
  32490. return postMessageIsAsynchronous;
  32491. }
  32492. }
  32493. function installPostMessageImplementation() {
  32494. // Installs an event handler on `global` for the `message` event: see
  32495. // * https://developer.mozilla.org/en/DOM/window.postMessage
  32496. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  32497. var messagePrefix = "setImmediate$" + Math.random() + "$";
  32498. var onGlobalMessage = function(event) {
  32499. if (event.source === global &&
  32500. typeof event.data === "string" &&
  32501. event.data.indexOf(messagePrefix) === 0) {
  32502. runIfPresent(+event.data.slice(messagePrefix.length));
  32503. }
  32504. };
  32505. if (global.addEventListener) {
  32506. global.addEventListener("message", onGlobalMessage, false);
  32507. } else {
  32508. global.attachEvent("onmessage", onGlobalMessage);
  32509. }
  32510. registerImmediate = function(handle) {
  32511. global.postMessage(messagePrefix + handle, "*");
  32512. };
  32513. }
  32514. function installMessageChannelImplementation() {
  32515. var channel = new MessageChannel();
  32516. channel.port1.onmessage = function(event) {
  32517. var handle = event.data;
  32518. runIfPresent(handle);
  32519. };
  32520. registerImmediate = function(handle) {
  32521. channel.port2.postMessage(handle);
  32522. };
  32523. }
  32524. function installReadyStateChangeImplementation() {
  32525. var html = doc.documentElement;
  32526. registerImmediate = function(handle) {
  32527. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32528. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32529. var script = doc.createElement("script");
  32530. script.onreadystatechange = function () {
  32531. runIfPresent(handle);
  32532. script.onreadystatechange = null;
  32533. html.removeChild(script);
  32534. script = null;
  32535. };
  32536. html.appendChild(script);
  32537. };
  32538. }
  32539. function installSetTimeoutImplementation() {
  32540. registerImmediate = function(handle) {
  32541. setTimeout(runIfPresent, 0, handle);
  32542. };
  32543. }
  32544. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32545. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32546. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32547. // Don't get fooled by e.g. browserify environments.
  32548. if ({}.toString.call(global.process) === "[object process]") {
  32549. // For Node.js before 0.9
  32550. installNextTickImplementation();
  32551. } else if (canUsePostMessage()) {
  32552. // For non-IE10 modern browsers
  32553. installPostMessageImplementation();
  32554. } else if (global.MessageChannel) {
  32555. // For web workers, where supported
  32556. installMessageChannelImplementation();
  32557. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32558. // For IE 6–8
  32559. installReadyStateChangeImplementation();
  32560. } else {
  32561. // For older browsers
  32562. installSetTimeoutImplementation();
  32563. }
  32564. attachTo.setImmediate = setImmediate;
  32565. attachTo.clearImmediate = clearImmediate;
  32566. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32567. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
  32568. /***/ }),
  32569. /***/ "./node_modules/timers-browserify/main.js":
  32570. /*!************************************************!*\
  32571. !*** ./node_modules/timers-browserify/main.js ***!
  32572. \************************************************/
  32573. /*! no static exports found */
  32574. /***/ (function(module, exports, __webpack_require__) {
  32575. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32576. (typeof self !== "undefined" && self) ||
  32577. window;
  32578. var apply = Function.prototype.apply;
  32579. // DOM APIs, for completeness
  32580. exports.setTimeout = function() {
  32581. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32582. };
  32583. exports.setInterval = function() {
  32584. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32585. };
  32586. exports.clearTimeout =
  32587. exports.clearInterval = function(timeout) {
  32588. if (timeout) {
  32589. timeout.close();
  32590. }
  32591. };
  32592. function Timeout(id, clearFn) {
  32593. this._id = id;
  32594. this._clearFn = clearFn;
  32595. }
  32596. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32597. Timeout.prototype.close = function() {
  32598. this._clearFn.call(scope, this._id);
  32599. };
  32600. // Does not start the time, just sets up the members needed.
  32601. exports.enroll = function(item, msecs) {
  32602. clearTimeout(item._idleTimeoutId);
  32603. item._idleTimeout = msecs;
  32604. };
  32605. exports.unenroll = function(item) {
  32606. clearTimeout(item._idleTimeoutId);
  32607. item._idleTimeout = -1;
  32608. };
  32609. exports._unrefActive = exports.active = function(item) {
  32610. clearTimeout(item._idleTimeoutId);
  32611. var msecs = item._idleTimeout;
  32612. if (msecs >= 0) {
  32613. item._idleTimeoutId = setTimeout(function onTimeout() {
  32614. if (item._onTimeout)
  32615. item._onTimeout();
  32616. }, msecs);
  32617. }
  32618. };
  32619. // setimmediate attaches itself to the global object
  32620. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  32621. // On some exotic environments, it's not clear which object `setimmediate` was
  32622. // able to install onto. Search each possibility in the same order as the
  32623. // `setimmediate` library.
  32624. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32625. (typeof global !== "undefined" && global.setImmediate) ||
  32626. (this && this.setImmediate);
  32627. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32628. (typeof global !== "undefined" && global.clearImmediate) ||
  32629. (this && this.clearImmediate);
  32630. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32631. /***/ }),
  32632. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  32633. /*!*******************************************************************************************************************************************************************************************************************!*\
  32634. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  32635. \*******************************************************************************************************************************************************************************************************************/
  32636. /*! exports provided: render, staticRenderFns */
  32637. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32638. "use strict";
  32639. __webpack_require__.r(__webpack_exports__);
  32640. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  32641. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  32642. var render = function() {
  32643. var _vm = this
  32644. var _h = _vm.$createElement
  32645. var _c = _vm._self._c || _h
  32646. return _vm._m(0)
  32647. }
  32648. var staticRenderFns = [
  32649. function() {
  32650. var _vm = this
  32651. var _h = _vm.$createElement
  32652. var _c = _vm._self._c || _h
  32653. return _c("div", { staticClass: "container" }, [
  32654. _c("div", { staticClass: "row justify-content-center" }, [
  32655. _c("div", { staticClass: "col-md-8" }, [
  32656. _c("div", { staticClass: "card" }, [
  32657. _c("div", { staticClass: "card-header" }, [
  32658. _vm._v("Example Component")
  32659. ]),
  32660. _vm._v(" "),
  32661. _c("div", { staticClass: "card-body" }, [
  32662. _vm._v(
  32663. "\n I'm an example component.\n "
  32664. )
  32665. ])
  32666. ])
  32667. ])
  32668. ])
  32669. ])
  32670. }
  32671. ]
  32672. render._withStripped = true
  32673. /***/ }),
  32674. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  32675. /*!********************************************************************!*\
  32676. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  32677. \********************************************************************/
  32678. /*! exports provided: default */
  32679. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32680. "use strict";
  32681. __webpack_require__.r(__webpack_exports__);
  32682. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  32683. /* globals __VUE_SSR_CONTEXT__ */
  32684. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  32685. // This module is a runtime utility for cleaner component module output and will
  32686. // be included in the final webpack user bundle.
  32687. function normalizeComponent (
  32688. scriptExports,
  32689. render,
  32690. staticRenderFns,
  32691. functionalTemplate,
  32692. injectStyles,
  32693. scopeId,
  32694. moduleIdentifier, /* server only */
  32695. shadowMode /* vue-cli only */
  32696. ) {
  32697. // Vue.extend constructor export interop
  32698. var options = typeof scriptExports === 'function'
  32699. ? scriptExports.options
  32700. : scriptExports
  32701. // render functions
  32702. if (render) {
  32703. options.render = render
  32704. options.staticRenderFns = staticRenderFns
  32705. options._compiled = true
  32706. }
  32707. // functional template
  32708. if (functionalTemplate) {
  32709. options.functional = true
  32710. }
  32711. // scopedId
  32712. if (scopeId) {
  32713. options._scopeId = 'data-v-' + scopeId
  32714. }
  32715. var hook
  32716. if (moduleIdentifier) { // server build
  32717. hook = function (context) {
  32718. // 2.3 injection
  32719. context =
  32720. context || // cached call
  32721. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32722. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32723. // 2.2 with runInNewContext: true
  32724. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32725. context = __VUE_SSR_CONTEXT__
  32726. }
  32727. // inject component styles
  32728. if (injectStyles) {
  32729. injectStyles.call(this, context)
  32730. }
  32731. // register component module identifier for async chunk inferrence
  32732. if (context && context._registeredComponents) {
  32733. context._registeredComponents.add(moduleIdentifier)
  32734. }
  32735. }
  32736. // used by ssr in case component is cached and beforeCreate
  32737. // never gets called
  32738. options._ssrRegister = hook
  32739. } else if (injectStyles) {
  32740. hook = shadowMode
  32741. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  32742. : injectStyles
  32743. }
  32744. if (hook) {
  32745. if (options.functional) {
  32746. // for template-only hot-reload because in that case the render fn doesn't
  32747. // go through the normalizer
  32748. options._injectStyles = hook
  32749. // register for functioal component in vue file
  32750. var originalRender = options.render
  32751. options.render = function renderWithStyleInjection (h, context) {
  32752. hook.call(context)
  32753. return originalRender(h, context)
  32754. }
  32755. } else {
  32756. // inject component registration as beforeCreate hook
  32757. var existing = options.beforeCreate
  32758. options.beforeCreate = existing
  32759. ? [].concat(existing, hook)
  32760. : [hook]
  32761. }
  32762. }
  32763. return {
  32764. exports: scriptExports,
  32765. options: options
  32766. }
  32767. }
  32768. /***/ }),
  32769. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32770. /*!*************************************************!*\
  32771. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  32772. \*************************************************/
  32773. /*! no static exports found */
  32774. /***/ (function(module, exports, __webpack_require__) {
  32775. "use strict";
  32776. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32777. * Vue.js v2.6.10
  32778. * (c) 2014-2019 Evan You
  32779. * Released under the MIT License.
  32780. */
  32781. /* */
  32782. var emptyObject = Object.freeze({});
  32783. // These helpers produce better VM code in JS engines due to their
  32784. // explicitness and function inlining.
  32785. function isUndef (v) {
  32786. return v === undefined || v === null
  32787. }
  32788. function isDef (v) {
  32789. return v !== undefined && v !== null
  32790. }
  32791. function isTrue (v) {
  32792. return v === true
  32793. }
  32794. function isFalse (v) {
  32795. return v === false
  32796. }
  32797. /**
  32798. * Check if value is primitive.
  32799. */
  32800. function isPrimitive (value) {
  32801. return (
  32802. typeof value === 'string' ||
  32803. typeof value === 'number' ||
  32804. // $flow-disable-line
  32805. typeof value === 'symbol' ||
  32806. typeof value === 'boolean'
  32807. )
  32808. }
  32809. /**
  32810. * Quick object check - this is primarily used to tell
  32811. * Objects from primitive values when we know the value
  32812. * is a JSON-compliant type.
  32813. */
  32814. function isObject (obj) {
  32815. return obj !== null && typeof obj === 'object'
  32816. }
  32817. /**
  32818. * Get the raw type string of a value, e.g., [object Object].
  32819. */
  32820. var _toString = Object.prototype.toString;
  32821. function toRawType (value) {
  32822. return _toString.call(value).slice(8, -1)
  32823. }
  32824. /**
  32825. * Strict object type check. Only returns true
  32826. * for plain JavaScript objects.
  32827. */
  32828. function isPlainObject (obj) {
  32829. return _toString.call(obj) === '[object Object]'
  32830. }
  32831. function isRegExp (v) {
  32832. return _toString.call(v) === '[object RegExp]'
  32833. }
  32834. /**
  32835. * Check if val is a valid array index.
  32836. */
  32837. function isValidArrayIndex (val) {
  32838. var n = parseFloat(String(val));
  32839. return n >= 0 && Math.floor(n) === n && isFinite(val)
  32840. }
  32841. function isPromise (val) {
  32842. return (
  32843. isDef(val) &&
  32844. typeof val.then === 'function' &&
  32845. typeof val.catch === 'function'
  32846. )
  32847. }
  32848. /**
  32849. * Convert a value to a string that is actually rendered.
  32850. */
  32851. function toString (val) {
  32852. return val == null
  32853. ? ''
  32854. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  32855. ? JSON.stringify(val, null, 2)
  32856. : String(val)
  32857. }
  32858. /**
  32859. * Convert an input value to a number for persistence.
  32860. * If the conversion fails, return original string.
  32861. */
  32862. function toNumber (val) {
  32863. var n = parseFloat(val);
  32864. return isNaN(n) ? val : n
  32865. }
  32866. /**
  32867. * Make a map and return a function for checking if a key
  32868. * is in that map.
  32869. */
  32870. function makeMap (
  32871. str,
  32872. expectsLowerCase
  32873. ) {
  32874. var map = Object.create(null);
  32875. var list = str.split(',');
  32876. for (var i = 0; i < list.length; i++) {
  32877. map[list[i]] = true;
  32878. }
  32879. return expectsLowerCase
  32880. ? function (val) { return map[val.toLowerCase()]; }
  32881. : function (val) { return map[val]; }
  32882. }
  32883. /**
  32884. * Check if a tag is a built-in tag.
  32885. */
  32886. var isBuiltInTag = makeMap('slot,component', true);
  32887. /**
  32888. * Check if an attribute is a reserved attribute.
  32889. */
  32890. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  32891. /**
  32892. * Remove an item from an array.
  32893. */
  32894. function remove (arr, item) {
  32895. if (arr.length) {
  32896. var index = arr.indexOf(item);
  32897. if (index > -1) {
  32898. return arr.splice(index, 1)
  32899. }
  32900. }
  32901. }
  32902. /**
  32903. * Check whether an object has the property.
  32904. */
  32905. var hasOwnProperty = Object.prototype.hasOwnProperty;
  32906. function hasOwn (obj, key) {
  32907. return hasOwnProperty.call(obj, key)
  32908. }
  32909. /**
  32910. * Create a cached version of a pure function.
  32911. */
  32912. function cached (fn) {
  32913. var cache = Object.create(null);
  32914. return (function cachedFn (str) {
  32915. var hit = cache[str];
  32916. return hit || (cache[str] = fn(str))
  32917. })
  32918. }
  32919. /**
  32920. * Camelize a hyphen-delimited string.
  32921. */
  32922. var camelizeRE = /-(\w)/g;
  32923. var camelize = cached(function (str) {
  32924. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  32925. });
  32926. /**
  32927. * Capitalize a string.
  32928. */
  32929. var capitalize = cached(function (str) {
  32930. return str.charAt(0).toUpperCase() + str.slice(1)
  32931. });
  32932. /**
  32933. * Hyphenate a camelCase string.
  32934. */
  32935. var hyphenateRE = /\B([A-Z])/g;
  32936. var hyphenate = cached(function (str) {
  32937. return str.replace(hyphenateRE, '-$1').toLowerCase()
  32938. });
  32939. /**
  32940. * Simple bind polyfill for environments that do not support it,
  32941. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  32942. * since native bind is now performant enough in most browsers.
  32943. * But removing it would mean breaking code that was able to run in
  32944. * PhantomJS 1.x, so this must be kept for backward compatibility.
  32945. */
  32946. /* istanbul ignore next */
  32947. function polyfillBind (fn, ctx) {
  32948. function boundFn (a) {
  32949. var l = arguments.length;
  32950. return l
  32951. ? l > 1
  32952. ? fn.apply(ctx, arguments)
  32953. : fn.call(ctx, a)
  32954. : fn.call(ctx)
  32955. }
  32956. boundFn._length = fn.length;
  32957. return boundFn
  32958. }
  32959. function nativeBind (fn, ctx) {
  32960. return fn.bind(ctx)
  32961. }
  32962. var bind = Function.prototype.bind
  32963. ? nativeBind
  32964. : polyfillBind;
  32965. /**
  32966. * Convert an Array-like object to a real Array.
  32967. */
  32968. function toArray (list, start) {
  32969. start = start || 0;
  32970. var i = list.length - start;
  32971. var ret = new Array(i);
  32972. while (i--) {
  32973. ret[i] = list[i + start];
  32974. }
  32975. return ret
  32976. }
  32977. /**
  32978. * Mix properties into target object.
  32979. */
  32980. function extend (to, _from) {
  32981. for (var key in _from) {
  32982. to[key] = _from[key];
  32983. }
  32984. return to
  32985. }
  32986. /**
  32987. * Merge an Array of Objects into a single Object.
  32988. */
  32989. function toObject (arr) {
  32990. var res = {};
  32991. for (var i = 0; i < arr.length; i++) {
  32992. if (arr[i]) {
  32993. extend(res, arr[i]);
  32994. }
  32995. }
  32996. return res
  32997. }
  32998. /* eslint-disable no-unused-vars */
  32999. /**
  33000. * Perform no operation.
  33001. * Stubbing args to make Flow happy without leaving useless transpiled code
  33002. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  33003. */
  33004. function noop (a, b, c) {}
  33005. /**
  33006. * Always return false.
  33007. */
  33008. var no = function (a, b, c) { return false; };
  33009. /* eslint-enable no-unused-vars */
  33010. /**
  33011. * Return the same value.
  33012. */
  33013. var identity = function (_) { return _; };
  33014. /**
  33015. * Generate a string containing static keys from compiler modules.
  33016. */
  33017. function genStaticKeys (modules) {
  33018. return modules.reduce(function (keys, m) {
  33019. return keys.concat(m.staticKeys || [])
  33020. }, []).join(',')
  33021. }
  33022. /**
  33023. * Check if two values are loosely equal - that is,
  33024. * if they are plain objects, do they have the same shape?
  33025. */
  33026. function looseEqual (a, b) {
  33027. if (a === b) { return true }
  33028. var isObjectA = isObject(a);
  33029. var isObjectB = isObject(b);
  33030. if (isObjectA && isObjectB) {
  33031. try {
  33032. var isArrayA = Array.isArray(a);
  33033. var isArrayB = Array.isArray(b);
  33034. if (isArrayA && isArrayB) {
  33035. return a.length === b.length && a.every(function (e, i) {
  33036. return looseEqual(e, b[i])
  33037. })
  33038. } else if (a instanceof Date && b instanceof Date) {
  33039. return a.getTime() === b.getTime()
  33040. } else if (!isArrayA && !isArrayB) {
  33041. var keysA = Object.keys(a);
  33042. var keysB = Object.keys(b);
  33043. return keysA.length === keysB.length && keysA.every(function (key) {
  33044. return looseEqual(a[key], b[key])
  33045. })
  33046. } else {
  33047. /* istanbul ignore next */
  33048. return false
  33049. }
  33050. } catch (e) {
  33051. /* istanbul ignore next */
  33052. return false
  33053. }
  33054. } else if (!isObjectA && !isObjectB) {
  33055. return String(a) === String(b)
  33056. } else {
  33057. return false
  33058. }
  33059. }
  33060. /**
  33061. * Return the first index at which a loosely equal value can be
  33062. * found in the array (if value is a plain object, the array must
  33063. * contain an object of the same shape), or -1 if it is not present.
  33064. */
  33065. function looseIndexOf (arr, val) {
  33066. for (var i = 0; i < arr.length; i++) {
  33067. if (looseEqual(arr[i], val)) { return i }
  33068. }
  33069. return -1
  33070. }
  33071. /**
  33072. * Ensure a function is called only once.
  33073. */
  33074. function once (fn) {
  33075. var called = false;
  33076. return function () {
  33077. if (!called) {
  33078. called = true;
  33079. fn.apply(this, arguments);
  33080. }
  33081. }
  33082. }
  33083. var SSR_ATTR = 'data-server-rendered';
  33084. var ASSET_TYPES = [
  33085. 'component',
  33086. 'directive',
  33087. 'filter'
  33088. ];
  33089. var LIFECYCLE_HOOKS = [
  33090. 'beforeCreate',
  33091. 'created',
  33092. 'beforeMount',
  33093. 'mounted',
  33094. 'beforeUpdate',
  33095. 'updated',
  33096. 'beforeDestroy',
  33097. 'destroyed',
  33098. 'activated',
  33099. 'deactivated',
  33100. 'errorCaptured',
  33101. 'serverPrefetch'
  33102. ];
  33103. /* */
  33104. var config = ({
  33105. /**
  33106. * Option merge strategies (used in core/util/options)
  33107. */
  33108. // $flow-disable-line
  33109. optionMergeStrategies: Object.create(null),
  33110. /**
  33111. * Whether to suppress warnings.
  33112. */
  33113. silent: false,
  33114. /**
  33115. * Show production mode tip message on boot?
  33116. */
  33117. productionTip: "development" !== 'production',
  33118. /**
  33119. * Whether to enable devtools
  33120. */
  33121. devtools: "development" !== 'production',
  33122. /**
  33123. * Whether to record perf
  33124. */
  33125. performance: false,
  33126. /**
  33127. * Error handler for watcher errors
  33128. */
  33129. errorHandler: null,
  33130. /**
  33131. * Warn handler for watcher warns
  33132. */
  33133. warnHandler: null,
  33134. /**
  33135. * Ignore certain custom elements
  33136. */
  33137. ignoredElements: [],
  33138. /**
  33139. * Custom user key aliases for v-on
  33140. */
  33141. // $flow-disable-line
  33142. keyCodes: Object.create(null),
  33143. /**
  33144. * Check if a tag is reserved so that it cannot be registered as a
  33145. * component. This is platform-dependent and may be overwritten.
  33146. */
  33147. isReservedTag: no,
  33148. /**
  33149. * Check if an attribute is reserved so that it cannot be used as a component
  33150. * prop. This is platform-dependent and may be overwritten.
  33151. */
  33152. isReservedAttr: no,
  33153. /**
  33154. * Check if a tag is an unknown element.
  33155. * Platform-dependent.
  33156. */
  33157. isUnknownElement: no,
  33158. /**
  33159. * Get the namespace of an element
  33160. */
  33161. getTagNamespace: noop,
  33162. /**
  33163. * Parse the real tag name for the specific platform.
  33164. */
  33165. parsePlatformTagName: identity,
  33166. /**
  33167. * Check if an attribute must be bound using property, e.g. value
  33168. * Platform-dependent.
  33169. */
  33170. mustUseProp: no,
  33171. /**
  33172. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  33173. * This will significantly reduce performance if set to false.
  33174. */
  33175. async: true,
  33176. /**
  33177. * Exposed for legacy reasons
  33178. */
  33179. _lifecycleHooks: LIFECYCLE_HOOKS
  33180. });
  33181. /* */
  33182. /**
  33183. * unicode letters used for parsing html tags, component names and property paths.
  33184. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  33185. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  33186. */
  33187. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  33188. /**
  33189. * Check if a string starts with $ or _
  33190. */
  33191. function isReserved (str) {
  33192. var c = (str + '').charCodeAt(0);
  33193. return c === 0x24 || c === 0x5F
  33194. }
  33195. /**
  33196. * Define a property.
  33197. */
  33198. function def (obj, key, val, enumerable) {
  33199. Object.defineProperty(obj, key, {
  33200. value: val,
  33201. enumerable: !!enumerable,
  33202. writable: true,
  33203. configurable: true
  33204. });
  33205. }
  33206. /**
  33207. * Parse simple path.
  33208. */
  33209. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  33210. function parsePath (path) {
  33211. if (bailRE.test(path)) {
  33212. return
  33213. }
  33214. var segments = path.split('.');
  33215. return function (obj) {
  33216. for (var i = 0; i < segments.length; i++) {
  33217. if (!obj) { return }
  33218. obj = obj[segments[i]];
  33219. }
  33220. return obj
  33221. }
  33222. }
  33223. /* */
  33224. // can we use __proto__?
  33225. var hasProto = '__proto__' in {};
  33226. // Browser environment sniffing
  33227. var inBrowser = typeof window !== 'undefined';
  33228. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  33229. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  33230. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  33231. var isIE = UA && /msie|trident/.test(UA);
  33232. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  33233. var isEdge = UA && UA.indexOf('edge/') > 0;
  33234. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  33235. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  33236. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  33237. var isPhantomJS = UA && /phantomjs/.test(UA);
  33238. var isFF = UA && UA.match(/firefox\/(\d+)/);
  33239. // Firefox has a "watch" function on Object.prototype...
  33240. var nativeWatch = ({}).watch;
  33241. var supportsPassive = false;
  33242. if (inBrowser) {
  33243. try {
  33244. var opts = {};
  33245. Object.defineProperty(opts, 'passive', ({
  33246. get: function get () {
  33247. /* istanbul ignore next */
  33248. supportsPassive = true;
  33249. }
  33250. })); // https://github.com/facebook/flow/issues/285
  33251. window.addEventListener('test-passive', null, opts);
  33252. } catch (e) {}
  33253. }
  33254. // this needs to be lazy-evaled because vue may be required before
  33255. // vue-server-renderer can set VUE_ENV
  33256. var _isServer;
  33257. var isServerRendering = function () {
  33258. if (_isServer === undefined) {
  33259. /* istanbul ignore if */
  33260. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  33261. // detect presence of vue-server-renderer and avoid
  33262. // Webpack shimming the process
  33263. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  33264. } else {
  33265. _isServer = false;
  33266. }
  33267. }
  33268. return _isServer
  33269. };
  33270. // detect devtools
  33271. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  33272. /* istanbul ignore next */
  33273. function isNative (Ctor) {
  33274. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  33275. }
  33276. var hasSymbol =
  33277. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  33278. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  33279. var _Set;
  33280. /* istanbul ignore if */ // $flow-disable-line
  33281. if (typeof Set !== 'undefined' && isNative(Set)) {
  33282. // use native Set when available.
  33283. _Set = Set;
  33284. } else {
  33285. // a non-standard Set polyfill that only works with primitive keys.
  33286. _Set = /*@__PURE__*/(function () {
  33287. function Set () {
  33288. this.set = Object.create(null);
  33289. }
  33290. Set.prototype.has = function has (key) {
  33291. return this.set[key] === true
  33292. };
  33293. Set.prototype.add = function add (key) {
  33294. this.set[key] = true;
  33295. };
  33296. Set.prototype.clear = function clear () {
  33297. this.set = Object.create(null);
  33298. };
  33299. return Set;
  33300. }());
  33301. }
  33302. /* */
  33303. var warn = noop;
  33304. var tip = noop;
  33305. var generateComponentTrace = (noop); // work around flow check
  33306. var formatComponentName = (noop);
  33307. {
  33308. var hasConsole = typeof console !== 'undefined';
  33309. var classifyRE = /(?:^|[-_])(\w)/g;
  33310. var classify = function (str) { return str
  33311. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  33312. .replace(/[-_]/g, ''); };
  33313. warn = function (msg, vm) {
  33314. var trace = vm ? generateComponentTrace(vm) : '';
  33315. if (config.warnHandler) {
  33316. config.warnHandler.call(null, msg, vm, trace);
  33317. } else if (hasConsole && (!config.silent)) {
  33318. console.error(("[Vue warn]: " + msg + trace));
  33319. }
  33320. };
  33321. tip = function (msg, vm) {
  33322. if (hasConsole && (!config.silent)) {
  33323. console.warn("[Vue tip]: " + msg + (
  33324. vm ? generateComponentTrace(vm) : ''
  33325. ));
  33326. }
  33327. };
  33328. formatComponentName = function (vm, includeFile) {
  33329. if (vm.$root === vm) {
  33330. return '<Root>'
  33331. }
  33332. var options = typeof vm === 'function' && vm.cid != null
  33333. ? vm.options
  33334. : vm._isVue
  33335. ? vm.$options || vm.constructor.options
  33336. : vm;
  33337. var name = options.name || options._componentTag;
  33338. var file = options.__file;
  33339. if (!name && file) {
  33340. var match = file.match(/([^/\\]+)\.vue$/);
  33341. name = match && match[1];
  33342. }
  33343. return (
  33344. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  33345. (file && includeFile !== false ? (" at " + file) : '')
  33346. )
  33347. };
  33348. var repeat = function (str, n) {
  33349. var res = '';
  33350. while (n) {
  33351. if (n % 2 === 1) { res += str; }
  33352. if (n > 1) { str += str; }
  33353. n >>= 1;
  33354. }
  33355. return res
  33356. };
  33357. generateComponentTrace = function (vm) {
  33358. if (vm._isVue && vm.$parent) {
  33359. var tree = [];
  33360. var currentRecursiveSequence = 0;
  33361. while (vm) {
  33362. if (tree.length > 0) {
  33363. var last = tree[tree.length - 1];
  33364. if (last.constructor === vm.constructor) {
  33365. currentRecursiveSequence++;
  33366. vm = vm.$parent;
  33367. continue
  33368. } else if (currentRecursiveSequence > 0) {
  33369. tree[tree.length - 1] = [last, currentRecursiveSequence];
  33370. currentRecursiveSequence = 0;
  33371. }
  33372. }
  33373. tree.push(vm);
  33374. vm = vm.$parent;
  33375. }
  33376. return '\n\nfound in\n\n' + tree
  33377. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  33378. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  33379. : formatComponentName(vm))); })
  33380. .join('\n')
  33381. } else {
  33382. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  33383. }
  33384. };
  33385. }
  33386. /* */
  33387. var uid = 0;
  33388. /**
  33389. * A dep is an observable that can have multiple
  33390. * directives subscribing to it.
  33391. */
  33392. var Dep = function Dep () {
  33393. this.id = uid++;
  33394. this.subs = [];
  33395. };
  33396. Dep.prototype.addSub = function addSub (sub) {
  33397. this.subs.push(sub);
  33398. };
  33399. Dep.prototype.removeSub = function removeSub (sub) {
  33400. remove(this.subs, sub);
  33401. };
  33402. Dep.prototype.depend = function depend () {
  33403. if (Dep.target) {
  33404. Dep.target.addDep(this);
  33405. }
  33406. };
  33407. Dep.prototype.notify = function notify () {
  33408. // stabilize the subscriber list first
  33409. var subs = this.subs.slice();
  33410. if (!config.async) {
  33411. // subs aren't sorted in scheduler if not running async
  33412. // we need to sort them now to make sure they fire in correct
  33413. // order
  33414. subs.sort(function (a, b) { return a.id - b.id; });
  33415. }
  33416. for (var i = 0, l = subs.length; i < l; i++) {
  33417. subs[i].update();
  33418. }
  33419. };
  33420. // The current target watcher being evaluated.
  33421. // This is globally unique because only one watcher
  33422. // can be evaluated at a time.
  33423. Dep.target = null;
  33424. var targetStack = [];
  33425. function pushTarget (target) {
  33426. targetStack.push(target);
  33427. Dep.target = target;
  33428. }
  33429. function popTarget () {
  33430. targetStack.pop();
  33431. Dep.target = targetStack[targetStack.length - 1];
  33432. }
  33433. /* */
  33434. var VNode = function VNode (
  33435. tag,
  33436. data,
  33437. children,
  33438. text,
  33439. elm,
  33440. context,
  33441. componentOptions,
  33442. asyncFactory
  33443. ) {
  33444. this.tag = tag;
  33445. this.data = data;
  33446. this.children = children;
  33447. this.text = text;
  33448. this.elm = elm;
  33449. this.ns = undefined;
  33450. this.context = context;
  33451. this.fnContext = undefined;
  33452. this.fnOptions = undefined;
  33453. this.fnScopeId = undefined;
  33454. this.key = data && data.key;
  33455. this.componentOptions = componentOptions;
  33456. this.componentInstance = undefined;
  33457. this.parent = undefined;
  33458. this.raw = false;
  33459. this.isStatic = false;
  33460. this.isRootInsert = true;
  33461. this.isComment = false;
  33462. this.isCloned = false;
  33463. this.isOnce = false;
  33464. this.asyncFactory = asyncFactory;
  33465. this.asyncMeta = undefined;
  33466. this.isAsyncPlaceholder = false;
  33467. };
  33468. var prototypeAccessors = { child: { configurable: true } };
  33469. // DEPRECATED: alias for componentInstance for backwards compat.
  33470. /* istanbul ignore next */
  33471. prototypeAccessors.child.get = function () {
  33472. return this.componentInstance
  33473. };
  33474. Object.defineProperties( VNode.prototype, prototypeAccessors );
  33475. var createEmptyVNode = function (text) {
  33476. if ( text === void 0 ) text = '';
  33477. var node = new VNode();
  33478. node.text = text;
  33479. node.isComment = true;
  33480. return node
  33481. };
  33482. function createTextVNode (val) {
  33483. return new VNode(undefined, undefined, undefined, String(val))
  33484. }
  33485. // optimized shallow clone
  33486. // used for static nodes and slot nodes because they may be reused across
  33487. // multiple renders, cloning them avoids errors when DOM manipulations rely
  33488. // on their elm reference.
  33489. function cloneVNode (vnode) {
  33490. var cloned = new VNode(
  33491. vnode.tag,
  33492. vnode.data,
  33493. // #7975
  33494. // clone children array to avoid mutating original in case of cloning
  33495. // a child.
  33496. vnode.children && vnode.children.slice(),
  33497. vnode.text,
  33498. vnode.elm,
  33499. vnode.context,
  33500. vnode.componentOptions,
  33501. vnode.asyncFactory
  33502. );
  33503. cloned.ns = vnode.ns;
  33504. cloned.isStatic = vnode.isStatic;
  33505. cloned.key = vnode.key;
  33506. cloned.isComment = vnode.isComment;
  33507. cloned.fnContext = vnode.fnContext;
  33508. cloned.fnOptions = vnode.fnOptions;
  33509. cloned.fnScopeId = vnode.fnScopeId;
  33510. cloned.asyncMeta = vnode.asyncMeta;
  33511. cloned.isCloned = true;
  33512. return cloned
  33513. }
  33514. /*
  33515. * not type checking this file because flow doesn't play well with
  33516. * dynamically accessing methods on Array prototype
  33517. */
  33518. var arrayProto = Array.prototype;
  33519. var arrayMethods = Object.create(arrayProto);
  33520. var methodsToPatch = [
  33521. 'push',
  33522. 'pop',
  33523. 'shift',
  33524. 'unshift',
  33525. 'splice',
  33526. 'sort',
  33527. 'reverse'
  33528. ];
  33529. /**
  33530. * Intercept mutating methods and emit events
  33531. */
  33532. methodsToPatch.forEach(function (method) {
  33533. // cache original method
  33534. var original = arrayProto[method];
  33535. def(arrayMethods, method, function mutator () {
  33536. var args = [], len = arguments.length;
  33537. while ( len-- ) args[ len ] = arguments[ len ];
  33538. var result = original.apply(this, args);
  33539. var ob = this.__ob__;
  33540. var inserted;
  33541. switch (method) {
  33542. case 'push':
  33543. case 'unshift':
  33544. inserted = args;
  33545. break
  33546. case 'splice':
  33547. inserted = args.slice(2);
  33548. break
  33549. }
  33550. if (inserted) { ob.observeArray(inserted); }
  33551. // notify change
  33552. ob.dep.notify();
  33553. return result
  33554. });
  33555. });
  33556. /* */
  33557. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33558. /**
  33559. * In some cases we may want to disable observation inside a component's
  33560. * update computation.
  33561. */
  33562. var shouldObserve = true;
  33563. function toggleObserving (value) {
  33564. shouldObserve = value;
  33565. }
  33566. /**
  33567. * Observer class that is attached to each observed
  33568. * object. Once attached, the observer converts the target
  33569. * object's property keys into getter/setters that
  33570. * collect dependencies and dispatch updates.
  33571. */
  33572. var Observer = function Observer (value) {
  33573. this.value = value;
  33574. this.dep = new Dep();
  33575. this.vmCount = 0;
  33576. def(value, '__ob__', this);
  33577. if (Array.isArray(value)) {
  33578. if (hasProto) {
  33579. protoAugment(value, arrayMethods);
  33580. } else {
  33581. copyAugment(value, arrayMethods, arrayKeys);
  33582. }
  33583. this.observeArray(value);
  33584. } else {
  33585. this.walk(value);
  33586. }
  33587. };
  33588. /**
  33589. * Walk through all properties and convert them into
  33590. * getter/setters. This method should only be called when
  33591. * value type is Object.
  33592. */
  33593. Observer.prototype.walk = function walk (obj) {
  33594. var keys = Object.keys(obj);
  33595. for (var i = 0; i < keys.length; i++) {
  33596. defineReactive$$1(obj, keys[i]);
  33597. }
  33598. };
  33599. /**
  33600. * Observe a list of Array items.
  33601. */
  33602. Observer.prototype.observeArray = function observeArray (items) {
  33603. for (var i = 0, l = items.length; i < l; i++) {
  33604. observe(items[i]);
  33605. }
  33606. };
  33607. // helpers
  33608. /**
  33609. * Augment a target Object or Array by intercepting
  33610. * the prototype chain using __proto__
  33611. */
  33612. function protoAugment (target, src) {
  33613. /* eslint-disable no-proto */
  33614. target.__proto__ = src;
  33615. /* eslint-enable no-proto */
  33616. }
  33617. /**
  33618. * Augment a target Object or Array by defining
  33619. * hidden properties.
  33620. */
  33621. /* istanbul ignore next */
  33622. function copyAugment (target, src, keys) {
  33623. for (var i = 0, l = keys.length; i < l; i++) {
  33624. var key = keys[i];
  33625. def(target, key, src[key]);
  33626. }
  33627. }
  33628. /**
  33629. * Attempt to create an observer instance for a value,
  33630. * returns the new observer if successfully observed,
  33631. * or the existing observer if the value already has one.
  33632. */
  33633. function observe (value, asRootData) {
  33634. if (!isObject(value) || value instanceof VNode) {
  33635. return
  33636. }
  33637. var ob;
  33638. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33639. ob = value.__ob__;
  33640. } else if (
  33641. shouldObserve &&
  33642. !isServerRendering() &&
  33643. (Array.isArray(value) || isPlainObject(value)) &&
  33644. Object.isExtensible(value) &&
  33645. !value._isVue
  33646. ) {
  33647. ob = new Observer(value);
  33648. }
  33649. if (asRootData && ob) {
  33650. ob.vmCount++;
  33651. }
  33652. return ob
  33653. }
  33654. /**
  33655. * Define a reactive property on an Object.
  33656. */
  33657. function defineReactive$$1 (
  33658. obj,
  33659. key,
  33660. val,
  33661. customSetter,
  33662. shallow
  33663. ) {
  33664. var dep = new Dep();
  33665. var property = Object.getOwnPropertyDescriptor(obj, key);
  33666. if (property && property.configurable === false) {
  33667. return
  33668. }
  33669. // cater for pre-defined getter/setters
  33670. var getter = property && property.get;
  33671. var setter = property && property.set;
  33672. if ((!getter || setter) && arguments.length === 2) {
  33673. val = obj[key];
  33674. }
  33675. var childOb = !shallow && observe(val);
  33676. Object.defineProperty(obj, key, {
  33677. enumerable: true,
  33678. configurable: true,
  33679. get: function reactiveGetter () {
  33680. var value = getter ? getter.call(obj) : val;
  33681. if (Dep.target) {
  33682. dep.depend();
  33683. if (childOb) {
  33684. childOb.dep.depend();
  33685. if (Array.isArray(value)) {
  33686. dependArray(value);
  33687. }
  33688. }
  33689. }
  33690. return value
  33691. },
  33692. set: function reactiveSetter (newVal) {
  33693. var value = getter ? getter.call(obj) : val;
  33694. /* eslint-disable no-self-compare */
  33695. if (newVal === value || (newVal !== newVal && value !== value)) {
  33696. return
  33697. }
  33698. /* eslint-enable no-self-compare */
  33699. if (customSetter) {
  33700. customSetter();
  33701. }
  33702. // #7981: for accessor properties without setter
  33703. if (getter && !setter) { return }
  33704. if (setter) {
  33705. setter.call(obj, newVal);
  33706. } else {
  33707. val = newVal;
  33708. }
  33709. childOb = !shallow && observe(newVal);
  33710. dep.notify();
  33711. }
  33712. });
  33713. }
  33714. /**
  33715. * Set a property on an object. Adds the new property and
  33716. * triggers change notification if the property doesn't
  33717. * already exist.
  33718. */
  33719. function set (target, key, val) {
  33720. if (isUndef(target) || isPrimitive(target)
  33721. ) {
  33722. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33723. }
  33724. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33725. target.length = Math.max(target.length, key);
  33726. target.splice(key, 1, val);
  33727. return val
  33728. }
  33729. if (key in target && !(key in Object.prototype)) {
  33730. target[key] = val;
  33731. return val
  33732. }
  33733. var ob = (target).__ob__;
  33734. if (target._isVue || (ob && ob.vmCount)) {
  33735. warn(
  33736. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33737. 'at runtime - declare it upfront in the data option.'
  33738. );
  33739. return val
  33740. }
  33741. if (!ob) {
  33742. target[key] = val;
  33743. return val
  33744. }
  33745. defineReactive$$1(ob.value, key, val);
  33746. ob.dep.notify();
  33747. return val
  33748. }
  33749. /**
  33750. * Delete a property and trigger change if necessary.
  33751. */
  33752. function del (target, key) {
  33753. if (isUndef(target) || isPrimitive(target)
  33754. ) {
  33755. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33756. }
  33757. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33758. target.splice(key, 1);
  33759. return
  33760. }
  33761. var ob = (target).__ob__;
  33762. if (target._isVue || (ob && ob.vmCount)) {
  33763. warn(
  33764. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33765. '- just set it to null.'
  33766. );
  33767. return
  33768. }
  33769. if (!hasOwn(target, key)) {
  33770. return
  33771. }
  33772. delete target[key];
  33773. if (!ob) {
  33774. return
  33775. }
  33776. ob.dep.notify();
  33777. }
  33778. /**
  33779. * Collect dependencies on array elements when the array is touched, since
  33780. * we cannot intercept array element access like property getters.
  33781. */
  33782. function dependArray (value) {
  33783. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33784. e = value[i];
  33785. e && e.__ob__ && e.__ob__.dep.depend();
  33786. if (Array.isArray(e)) {
  33787. dependArray(e);
  33788. }
  33789. }
  33790. }
  33791. /* */
  33792. /**
  33793. * Option overwriting strategies are functions that handle
  33794. * how to merge a parent option value and a child option
  33795. * value into the final value.
  33796. */
  33797. var strats = config.optionMergeStrategies;
  33798. /**
  33799. * Options with restrictions
  33800. */
  33801. {
  33802. strats.el = strats.propsData = function (parent, child, vm, key) {
  33803. if (!vm) {
  33804. warn(
  33805. "option \"" + key + "\" can only be used during instance " +
  33806. 'creation with the `new` keyword.'
  33807. );
  33808. }
  33809. return defaultStrat(parent, child)
  33810. };
  33811. }
  33812. /**
  33813. * Helper that recursively merges two data objects together.
  33814. */
  33815. function mergeData (to, from) {
  33816. if (!from) { return to }
  33817. var key, toVal, fromVal;
  33818. var keys = hasSymbol
  33819. ? Reflect.ownKeys(from)
  33820. : Object.keys(from);
  33821. for (var i = 0; i < keys.length; i++) {
  33822. key = keys[i];
  33823. // in case the object is already observed...
  33824. if (key === '__ob__') { continue }
  33825. toVal = to[key];
  33826. fromVal = from[key];
  33827. if (!hasOwn(to, key)) {
  33828. set(to, key, fromVal);
  33829. } else if (
  33830. toVal !== fromVal &&
  33831. isPlainObject(toVal) &&
  33832. isPlainObject(fromVal)
  33833. ) {
  33834. mergeData(toVal, fromVal);
  33835. }
  33836. }
  33837. return to
  33838. }
  33839. /**
  33840. * Data
  33841. */
  33842. function mergeDataOrFn (
  33843. parentVal,
  33844. childVal,
  33845. vm
  33846. ) {
  33847. if (!vm) {
  33848. // in a Vue.extend merge, both should be functions
  33849. if (!childVal) {
  33850. return parentVal
  33851. }
  33852. if (!parentVal) {
  33853. return childVal
  33854. }
  33855. // when parentVal & childVal are both present,
  33856. // we need to return a function that returns the
  33857. // merged result of both functions... no need to
  33858. // check if parentVal is a function here because
  33859. // it has to be a function to pass previous merges.
  33860. return function mergedDataFn () {
  33861. return mergeData(
  33862. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  33863. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  33864. )
  33865. }
  33866. } else {
  33867. return function mergedInstanceDataFn () {
  33868. // instance merge
  33869. var instanceData = typeof childVal === 'function'
  33870. ? childVal.call(vm, vm)
  33871. : childVal;
  33872. var defaultData = typeof parentVal === 'function'
  33873. ? parentVal.call(vm, vm)
  33874. : parentVal;
  33875. if (instanceData) {
  33876. return mergeData(instanceData, defaultData)
  33877. } else {
  33878. return defaultData
  33879. }
  33880. }
  33881. }
  33882. }
  33883. strats.data = function (
  33884. parentVal,
  33885. childVal,
  33886. vm
  33887. ) {
  33888. if (!vm) {
  33889. if (childVal && typeof childVal !== 'function') {
  33890. warn(
  33891. 'The "data" option should be a function ' +
  33892. 'that returns a per-instance value in component ' +
  33893. 'definitions.',
  33894. vm
  33895. );
  33896. return parentVal
  33897. }
  33898. return mergeDataOrFn(parentVal, childVal)
  33899. }
  33900. return mergeDataOrFn(parentVal, childVal, vm)
  33901. };
  33902. /**
  33903. * Hooks and props are merged as arrays.
  33904. */
  33905. function mergeHook (
  33906. parentVal,
  33907. childVal
  33908. ) {
  33909. var res = childVal
  33910. ? parentVal
  33911. ? parentVal.concat(childVal)
  33912. : Array.isArray(childVal)
  33913. ? childVal
  33914. : [childVal]
  33915. : parentVal;
  33916. return res
  33917. ? dedupeHooks(res)
  33918. : res
  33919. }
  33920. function dedupeHooks (hooks) {
  33921. var res = [];
  33922. for (var i = 0; i < hooks.length; i++) {
  33923. if (res.indexOf(hooks[i]) === -1) {
  33924. res.push(hooks[i]);
  33925. }
  33926. }
  33927. return res
  33928. }
  33929. LIFECYCLE_HOOKS.forEach(function (hook) {
  33930. strats[hook] = mergeHook;
  33931. });
  33932. /**
  33933. * Assets
  33934. *
  33935. * When a vm is present (instance creation), we need to do
  33936. * a three-way merge between constructor options, instance
  33937. * options and parent options.
  33938. */
  33939. function mergeAssets (
  33940. parentVal,
  33941. childVal,
  33942. vm,
  33943. key
  33944. ) {
  33945. var res = Object.create(parentVal || null);
  33946. if (childVal) {
  33947. assertObjectType(key, childVal, vm);
  33948. return extend(res, childVal)
  33949. } else {
  33950. return res
  33951. }
  33952. }
  33953. ASSET_TYPES.forEach(function (type) {
  33954. strats[type + 's'] = mergeAssets;
  33955. });
  33956. /**
  33957. * Watchers.
  33958. *
  33959. * Watchers hashes should not overwrite one
  33960. * another, so we merge them as arrays.
  33961. */
  33962. strats.watch = function (
  33963. parentVal,
  33964. childVal,
  33965. vm,
  33966. key
  33967. ) {
  33968. // work around Firefox's Object.prototype.watch...
  33969. if (parentVal === nativeWatch) { parentVal = undefined; }
  33970. if (childVal === nativeWatch) { childVal = undefined; }
  33971. /* istanbul ignore if */
  33972. if (!childVal) { return Object.create(parentVal || null) }
  33973. {
  33974. assertObjectType(key, childVal, vm);
  33975. }
  33976. if (!parentVal) { return childVal }
  33977. var ret = {};
  33978. extend(ret, parentVal);
  33979. for (var key$1 in childVal) {
  33980. var parent = ret[key$1];
  33981. var child = childVal[key$1];
  33982. if (parent && !Array.isArray(parent)) {
  33983. parent = [parent];
  33984. }
  33985. ret[key$1] = parent
  33986. ? parent.concat(child)
  33987. : Array.isArray(child) ? child : [child];
  33988. }
  33989. return ret
  33990. };
  33991. /**
  33992. * Other object hashes.
  33993. */
  33994. strats.props =
  33995. strats.methods =
  33996. strats.inject =
  33997. strats.computed = function (
  33998. parentVal,
  33999. childVal,
  34000. vm,
  34001. key
  34002. ) {
  34003. if (childVal && "development" !== 'production') {
  34004. assertObjectType(key, childVal, vm);
  34005. }
  34006. if (!parentVal) { return childVal }
  34007. var ret = Object.create(null);
  34008. extend(ret, parentVal);
  34009. if (childVal) { extend(ret, childVal); }
  34010. return ret
  34011. };
  34012. strats.provide = mergeDataOrFn;
  34013. /**
  34014. * Default strategy.
  34015. */
  34016. var defaultStrat = function (parentVal, childVal) {
  34017. return childVal === undefined
  34018. ? parentVal
  34019. : childVal
  34020. };
  34021. /**
  34022. * Validate component names
  34023. */
  34024. function checkComponents (options) {
  34025. for (var key in options.components) {
  34026. validateComponentName(key);
  34027. }
  34028. }
  34029. function validateComponentName (name) {
  34030. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  34031. warn(
  34032. 'Invalid component name: "' + name + '". Component names ' +
  34033. 'should conform to valid custom element name in html5 specification.'
  34034. );
  34035. }
  34036. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  34037. warn(
  34038. 'Do not use built-in or reserved HTML elements as component ' +
  34039. 'id: ' + name
  34040. );
  34041. }
  34042. }
  34043. /**
  34044. * Ensure all props option syntax are normalized into the
  34045. * Object-based format.
  34046. */
  34047. function normalizeProps (options, vm) {
  34048. var props = options.props;
  34049. if (!props) { return }
  34050. var res = {};
  34051. var i, val, name;
  34052. if (Array.isArray(props)) {
  34053. i = props.length;
  34054. while (i--) {
  34055. val = props[i];
  34056. if (typeof val === 'string') {
  34057. name = camelize(val);
  34058. res[name] = { type: null };
  34059. } else {
  34060. warn('props must be strings when using array syntax.');
  34061. }
  34062. }
  34063. } else if (isPlainObject(props)) {
  34064. for (var key in props) {
  34065. val = props[key];
  34066. name = camelize(key);
  34067. res[name] = isPlainObject(val)
  34068. ? val
  34069. : { type: val };
  34070. }
  34071. } else {
  34072. warn(
  34073. "Invalid value for option \"props\": expected an Array or an Object, " +
  34074. "but got " + (toRawType(props)) + ".",
  34075. vm
  34076. );
  34077. }
  34078. options.props = res;
  34079. }
  34080. /**
  34081. * Normalize all injections into Object-based format
  34082. */
  34083. function normalizeInject (options, vm) {
  34084. var inject = options.inject;
  34085. if (!inject) { return }
  34086. var normalized = options.inject = {};
  34087. if (Array.isArray(inject)) {
  34088. for (var i = 0; i < inject.length; i++) {
  34089. normalized[inject[i]] = { from: inject[i] };
  34090. }
  34091. } else if (isPlainObject(inject)) {
  34092. for (var key in inject) {
  34093. var val = inject[key];
  34094. normalized[key] = isPlainObject(val)
  34095. ? extend({ from: key }, val)
  34096. : { from: val };
  34097. }
  34098. } else {
  34099. warn(
  34100. "Invalid value for option \"inject\": expected an Array or an Object, " +
  34101. "but got " + (toRawType(inject)) + ".",
  34102. vm
  34103. );
  34104. }
  34105. }
  34106. /**
  34107. * Normalize raw function directives into object format.
  34108. */
  34109. function normalizeDirectives (options) {
  34110. var dirs = options.directives;
  34111. if (dirs) {
  34112. for (var key in dirs) {
  34113. var def$$1 = dirs[key];
  34114. if (typeof def$$1 === 'function') {
  34115. dirs[key] = { bind: def$$1, update: def$$1 };
  34116. }
  34117. }
  34118. }
  34119. }
  34120. function assertObjectType (name, value, vm) {
  34121. if (!isPlainObject(value)) {
  34122. warn(
  34123. "Invalid value for option \"" + name + "\": expected an Object, " +
  34124. "but got " + (toRawType(value)) + ".",
  34125. vm
  34126. );
  34127. }
  34128. }
  34129. /**
  34130. * Merge two option objects into a new one.
  34131. * Core utility used in both instantiation and inheritance.
  34132. */
  34133. function mergeOptions (
  34134. parent,
  34135. child,
  34136. vm
  34137. ) {
  34138. {
  34139. checkComponents(child);
  34140. }
  34141. if (typeof child === 'function') {
  34142. child = child.options;
  34143. }
  34144. normalizeProps(child, vm);
  34145. normalizeInject(child, vm);
  34146. normalizeDirectives(child);
  34147. // Apply extends and mixins on the child options,
  34148. // but only if it is a raw options object that isn't
  34149. // the result of another mergeOptions call.
  34150. // Only merged options has the _base property.
  34151. if (!child._base) {
  34152. if (child.extends) {
  34153. parent = mergeOptions(parent, child.extends, vm);
  34154. }
  34155. if (child.mixins) {
  34156. for (var i = 0, l = child.mixins.length; i < l; i++) {
  34157. parent = mergeOptions(parent, child.mixins[i], vm);
  34158. }
  34159. }
  34160. }
  34161. var options = {};
  34162. var key;
  34163. for (key in parent) {
  34164. mergeField(key);
  34165. }
  34166. for (key in child) {
  34167. if (!hasOwn(parent, key)) {
  34168. mergeField(key);
  34169. }
  34170. }
  34171. function mergeField (key) {
  34172. var strat = strats[key] || defaultStrat;
  34173. options[key] = strat(parent[key], child[key], vm, key);
  34174. }
  34175. return options
  34176. }
  34177. /**
  34178. * Resolve an asset.
  34179. * This function is used because child instances need access
  34180. * to assets defined in its ancestor chain.
  34181. */
  34182. function resolveAsset (
  34183. options,
  34184. type,
  34185. id,
  34186. warnMissing
  34187. ) {
  34188. /* istanbul ignore if */
  34189. if (typeof id !== 'string') {
  34190. return
  34191. }
  34192. var assets = options[type];
  34193. // check local registration variations first
  34194. if (hasOwn(assets, id)) { return assets[id] }
  34195. var camelizedId = camelize(id);
  34196. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  34197. var PascalCaseId = capitalize(camelizedId);
  34198. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  34199. // fallback to prototype chain
  34200. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  34201. if (warnMissing && !res) {
  34202. warn(
  34203. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  34204. options
  34205. );
  34206. }
  34207. return res
  34208. }
  34209. /* */
  34210. function validateProp (
  34211. key,
  34212. propOptions,
  34213. propsData,
  34214. vm
  34215. ) {
  34216. var prop = propOptions[key];
  34217. var absent = !hasOwn(propsData, key);
  34218. var value = propsData[key];
  34219. // boolean casting
  34220. var booleanIndex = getTypeIndex(Boolean, prop.type);
  34221. if (booleanIndex > -1) {
  34222. if (absent && !hasOwn(prop, 'default')) {
  34223. value = false;
  34224. } else if (value === '' || value === hyphenate(key)) {
  34225. // only cast empty string / same name to boolean if
  34226. // boolean has higher priority
  34227. var stringIndex = getTypeIndex(String, prop.type);
  34228. if (stringIndex < 0 || booleanIndex < stringIndex) {
  34229. value = true;
  34230. }
  34231. }
  34232. }
  34233. // check default value
  34234. if (value === undefined) {
  34235. value = getPropDefaultValue(vm, prop, key);
  34236. // since the default value is a fresh copy,
  34237. // make sure to observe it.
  34238. var prevShouldObserve = shouldObserve;
  34239. toggleObserving(true);
  34240. observe(value);
  34241. toggleObserving(prevShouldObserve);
  34242. }
  34243. {
  34244. assertProp(prop, key, value, vm, absent);
  34245. }
  34246. return value
  34247. }
  34248. /**
  34249. * Get the default value of a prop.
  34250. */
  34251. function getPropDefaultValue (vm, prop, key) {
  34252. // no default, return undefined
  34253. if (!hasOwn(prop, 'default')) {
  34254. return undefined
  34255. }
  34256. var def = prop.default;
  34257. // warn against non-factory defaults for Object & Array
  34258. if (isObject(def)) {
  34259. warn(
  34260. 'Invalid default value for prop "' + key + '": ' +
  34261. 'Props with type Object/Array must use a factory function ' +
  34262. 'to return the default value.',
  34263. vm
  34264. );
  34265. }
  34266. // the raw prop value was also undefined from previous render,
  34267. // return previous default value to avoid unnecessary watcher trigger
  34268. if (vm && vm.$options.propsData &&
  34269. vm.$options.propsData[key] === undefined &&
  34270. vm._props[key] !== undefined
  34271. ) {
  34272. return vm._props[key]
  34273. }
  34274. // call factory function for non-Function types
  34275. // a value is Function if its prototype is function even across different execution context
  34276. return typeof def === 'function' && getType(prop.type) !== 'Function'
  34277. ? def.call(vm)
  34278. : def
  34279. }
  34280. /**
  34281. * Assert whether a prop is valid.
  34282. */
  34283. function assertProp (
  34284. prop,
  34285. name,
  34286. value,
  34287. vm,
  34288. absent
  34289. ) {
  34290. if (prop.required && absent) {
  34291. warn(
  34292. 'Missing required prop: "' + name + '"',
  34293. vm
  34294. );
  34295. return
  34296. }
  34297. if (value == null && !prop.required) {
  34298. return
  34299. }
  34300. var type = prop.type;
  34301. var valid = !type || type === true;
  34302. var expectedTypes = [];
  34303. if (type) {
  34304. if (!Array.isArray(type)) {
  34305. type = [type];
  34306. }
  34307. for (var i = 0; i < type.length && !valid; i++) {
  34308. var assertedType = assertType(value, type[i]);
  34309. expectedTypes.push(assertedType.expectedType || '');
  34310. valid = assertedType.valid;
  34311. }
  34312. }
  34313. if (!valid) {
  34314. warn(
  34315. getInvalidTypeMessage(name, value, expectedTypes),
  34316. vm
  34317. );
  34318. return
  34319. }
  34320. var validator = prop.validator;
  34321. if (validator) {
  34322. if (!validator(value)) {
  34323. warn(
  34324. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  34325. vm
  34326. );
  34327. }
  34328. }
  34329. }
  34330. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  34331. function assertType (value, type) {
  34332. var valid;
  34333. var expectedType = getType(type);
  34334. if (simpleCheckRE.test(expectedType)) {
  34335. var t = typeof value;
  34336. valid = t === expectedType.toLowerCase();
  34337. // for primitive wrapper objects
  34338. if (!valid && t === 'object') {
  34339. valid = value instanceof type;
  34340. }
  34341. } else if (expectedType === 'Object') {
  34342. valid = isPlainObject(value);
  34343. } else if (expectedType === 'Array') {
  34344. valid = Array.isArray(value);
  34345. } else {
  34346. valid = value instanceof type;
  34347. }
  34348. return {
  34349. valid: valid,
  34350. expectedType: expectedType
  34351. }
  34352. }
  34353. /**
  34354. * Use function string name to check built-in types,
  34355. * because a simple equality check will fail when running
  34356. * across different vms / iframes.
  34357. */
  34358. function getType (fn) {
  34359. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  34360. return match ? match[1] : ''
  34361. }
  34362. function isSameType (a, b) {
  34363. return getType(a) === getType(b)
  34364. }
  34365. function getTypeIndex (type, expectedTypes) {
  34366. if (!Array.isArray(expectedTypes)) {
  34367. return isSameType(expectedTypes, type) ? 0 : -1
  34368. }
  34369. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  34370. if (isSameType(expectedTypes[i], type)) {
  34371. return i
  34372. }
  34373. }
  34374. return -1
  34375. }
  34376. function getInvalidTypeMessage (name, value, expectedTypes) {
  34377. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  34378. " Expected " + (expectedTypes.map(capitalize).join(', '));
  34379. var expectedType = expectedTypes[0];
  34380. var receivedType = toRawType(value);
  34381. var expectedValue = styleValue(value, expectedType);
  34382. var receivedValue = styleValue(value, receivedType);
  34383. // check if we need to specify expected value
  34384. if (expectedTypes.length === 1 &&
  34385. isExplicable(expectedType) &&
  34386. !isBoolean(expectedType, receivedType)) {
  34387. message += " with value " + expectedValue;
  34388. }
  34389. message += ", got " + receivedType + " ";
  34390. // check if we need to specify received value
  34391. if (isExplicable(receivedType)) {
  34392. message += "with value " + receivedValue + ".";
  34393. }
  34394. return message
  34395. }
  34396. function styleValue (value, type) {
  34397. if (type === 'String') {
  34398. return ("\"" + value + "\"")
  34399. } else if (type === 'Number') {
  34400. return ("" + (Number(value)))
  34401. } else {
  34402. return ("" + value)
  34403. }
  34404. }
  34405. function isExplicable (value) {
  34406. var explicitTypes = ['string', 'number', 'boolean'];
  34407. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  34408. }
  34409. function isBoolean () {
  34410. var args = [], len = arguments.length;
  34411. while ( len-- ) args[ len ] = arguments[ len ];
  34412. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  34413. }
  34414. /* */
  34415. function handleError (err, vm, info) {
  34416. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  34417. // See: https://github.com/vuejs/vuex/issues/1505
  34418. pushTarget();
  34419. try {
  34420. if (vm) {
  34421. var cur = vm;
  34422. while ((cur = cur.$parent)) {
  34423. var hooks = cur.$options.errorCaptured;
  34424. if (hooks) {
  34425. for (var i = 0; i < hooks.length; i++) {
  34426. try {
  34427. var capture = hooks[i].call(cur, err, vm, info) === false;
  34428. if (capture) { return }
  34429. } catch (e) {
  34430. globalHandleError(e, cur, 'errorCaptured hook');
  34431. }
  34432. }
  34433. }
  34434. }
  34435. }
  34436. globalHandleError(err, vm, info);
  34437. } finally {
  34438. popTarget();
  34439. }
  34440. }
  34441. function invokeWithErrorHandling (
  34442. handler,
  34443. context,
  34444. args,
  34445. vm,
  34446. info
  34447. ) {
  34448. var res;
  34449. try {
  34450. res = args ? handler.apply(context, args) : handler.call(context);
  34451. if (res && !res._isVue && isPromise(res) && !res._handled) {
  34452. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  34453. // issue #9511
  34454. // avoid catch triggering multiple times when nested calls
  34455. res._handled = true;
  34456. }
  34457. } catch (e) {
  34458. handleError(e, vm, info);
  34459. }
  34460. return res
  34461. }
  34462. function globalHandleError (err, vm, info) {
  34463. if (config.errorHandler) {
  34464. try {
  34465. return config.errorHandler.call(null, err, vm, info)
  34466. } catch (e) {
  34467. // if the user intentionally throws the original error in the handler,
  34468. // do not log it twice
  34469. if (e !== err) {
  34470. logError(e, null, 'config.errorHandler');
  34471. }
  34472. }
  34473. }
  34474. logError(err, vm, info);
  34475. }
  34476. function logError (err, vm, info) {
  34477. {
  34478. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  34479. }
  34480. /* istanbul ignore else */
  34481. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  34482. console.error(err);
  34483. } else {
  34484. throw err
  34485. }
  34486. }
  34487. /* */
  34488. var isUsingMicroTask = false;
  34489. var callbacks = [];
  34490. var pending = false;
  34491. function flushCallbacks () {
  34492. pending = false;
  34493. var copies = callbacks.slice(0);
  34494. callbacks.length = 0;
  34495. for (var i = 0; i < copies.length; i++) {
  34496. copies[i]();
  34497. }
  34498. }
  34499. // Here we have async deferring wrappers using microtasks.
  34500. // In 2.5 we used (macro) tasks (in combination with microtasks).
  34501. // However, it has subtle problems when state is changed right before repaint
  34502. // (e.g. #6813, out-in transitions).
  34503. // Also, using (macro) tasks in event handler would cause some weird behaviors
  34504. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  34505. // So we now use microtasks everywhere, again.
  34506. // A major drawback of this tradeoff is that there are some scenarios
  34507. // where microtasks have too high a priority and fire in between supposedly
  34508. // sequential events (e.g. #4521, #6690, which have workarounds)
  34509. // or even between bubbling of the same event (#6566).
  34510. var timerFunc;
  34511. // The nextTick behavior leverages the microtask queue, which can be accessed
  34512. // via either native Promise.then or MutationObserver.
  34513. // MutationObserver has wider support, however it is seriously bugged in
  34514. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  34515. // completely stops working after triggering a few times... so, if native
  34516. // Promise is available, we will use it:
  34517. /* istanbul ignore next, $flow-disable-line */
  34518. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  34519. var p = Promise.resolve();
  34520. timerFunc = function () {
  34521. p.then(flushCallbacks);
  34522. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34523. // it can get stuck in a weird state where callbacks are pushed into the
  34524. // microtask queue but the queue isn't being flushed, until the browser
  34525. // needs to do some other work, e.g. handle a timer. Therefore we can
  34526. // "force" the microtask queue to be flushed by adding an empty timer.
  34527. if (isIOS) { setTimeout(noop); }
  34528. };
  34529. isUsingMicroTask = true;
  34530. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34531. isNative(MutationObserver) ||
  34532. // PhantomJS and iOS 7.x
  34533. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34534. )) {
  34535. // Use MutationObserver where native Promise is not available,
  34536. // e.g. PhantomJS, iOS7, Android 4.4
  34537. // (#6466 MutationObserver is unreliable in IE11)
  34538. var counter = 1;
  34539. var observer = new MutationObserver(flushCallbacks);
  34540. var textNode = document.createTextNode(String(counter));
  34541. observer.observe(textNode, {
  34542. characterData: true
  34543. });
  34544. timerFunc = function () {
  34545. counter = (counter + 1) % 2;
  34546. textNode.data = String(counter);
  34547. };
  34548. isUsingMicroTask = true;
  34549. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34550. // Fallback to setImmediate.
  34551. // Techinically it leverages the (macro) task queue,
  34552. // but it is still a better choice than setTimeout.
  34553. timerFunc = function () {
  34554. setImmediate(flushCallbacks);
  34555. };
  34556. } else {
  34557. // Fallback to setTimeout.
  34558. timerFunc = function () {
  34559. setTimeout(flushCallbacks, 0);
  34560. };
  34561. }
  34562. function nextTick (cb, ctx) {
  34563. var _resolve;
  34564. callbacks.push(function () {
  34565. if (cb) {
  34566. try {
  34567. cb.call(ctx);
  34568. } catch (e) {
  34569. handleError(e, ctx, 'nextTick');
  34570. }
  34571. } else if (_resolve) {
  34572. _resolve(ctx);
  34573. }
  34574. });
  34575. if (!pending) {
  34576. pending = true;
  34577. timerFunc();
  34578. }
  34579. // $flow-disable-line
  34580. if (!cb && typeof Promise !== 'undefined') {
  34581. return new Promise(function (resolve) {
  34582. _resolve = resolve;
  34583. })
  34584. }
  34585. }
  34586. /* */
  34587. var mark;
  34588. var measure;
  34589. {
  34590. var perf = inBrowser && window.performance;
  34591. /* istanbul ignore if */
  34592. if (
  34593. perf &&
  34594. perf.mark &&
  34595. perf.measure &&
  34596. perf.clearMarks &&
  34597. perf.clearMeasures
  34598. ) {
  34599. mark = function (tag) { return perf.mark(tag); };
  34600. measure = function (name, startTag, endTag) {
  34601. perf.measure(name, startTag, endTag);
  34602. perf.clearMarks(startTag);
  34603. perf.clearMarks(endTag);
  34604. // perf.clearMeasures(name)
  34605. };
  34606. }
  34607. }
  34608. /* not type checking this file because flow doesn't play well with Proxy */
  34609. var initProxy;
  34610. {
  34611. var allowedGlobals = makeMap(
  34612. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34613. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34614. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34615. 'require' // for Webpack/Browserify
  34616. );
  34617. var warnNonPresent = function (target, key) {
  34618. warn(
  34619. "Property or method \"" + key + "\" is not defined on the instance but " +
  34620. 'referenced during render. Make sure that this property is reactive, ' +
  34621. 'either in the data option, or for class-based components, by ' +
  34622. 'initializing the property. ' +
  34623. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34624. target
  34625. );
  34626. };
  34627. var warnReservedPrefix = function (target, key) {
  34628. warn(
  34629. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34630. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34631. 'prevent conflicts with Vue internals' +
  34632. 'See: https://vuejs.org/v2/api/#data',
  34633. target
  34634. );
  34635. };
  34636. var hasProxy =
  34637. typeof Proxy !== 'undefined' && isNative(Proxy);
  34638. if (hasProxy) {
  34639. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34640. config.keyCodes = new Proxy(config.keyCodes, {
  34641. set: function set (target, key, value) {
  34642. if (isBuiltInModifier(key)) {
  34643. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34644. return false
  34645. } else {
  34646. target[key] = value;
  34647. return true
  34648. }
  34649. }
  34650. });
  34651. }
  34652. var hasHandler = {
  34653. has: function has (target, key) {
  34654. var has = key in target;
  34655. var isAllowed = allowedGlobals(key) ||
  34656. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34657. if (!has && !isAllowed) {
  34658. if (key in target.$data) { warnReservedPrefix(target, key); }
  34659. else { warnNonPresent(target, key); }
  34660. }
  34661. return has || !isAllowed
  34662. }
  34663. };
  34664. var getHandler = {
  34665. get: function get (target, key) {
  34666. if (typeof key === 'string' && !(key in target)) {
  34667. if (key in target.$data) { warnReservedPrefix(target, key); }
  34668. else { warnNonPresent(target, key); }
  34669. }
  34670. return target[key]
  34671. }
  34672. };
  34673. initProxy = function initProxy (vm) {
  34674. if (hasProxy) {
  34675. // determine which proxy handler to use
  34676. var options = vm.$options;
  34677. var handlers = options.render && options.render._withStripped
  34678. ? getHandler
  34679. : hasHandler;
  34680. vm._renderProxy = new Proxy(vm, handlers);
  34681. } else {
  34682. vm._renderProxy = vm;
  34683. }
  34684. };
  34685. }
  34686. /* */
  34687. var seenObjects = new _Set();
  34688. /**
  34689. * Recursively traverse an object to evoke all converted
  34690. * getters, so that every nested property inside the object
  34691. * is collected as a "deep" dependency.
  34692. */
  34693. function traverse (val) {
  34694. _traverse(val, seenObjects);
  34695. seenObjects.clear();
  34696. }
  34697. function _traverse (val, seen) {
  34698. var i, keys;
  34699. var isA = Array.isArray(val);
  34700. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34701. return
  34702. }
  34703. if (val.__ob__) {
  34704. var depId = val.__ob__.dep.id;
  34705. if (seen.has(depId)) {
  34706. return
  34707. }
  34708. seen.add(depId);
  34709. }
  34710. if (isA) {
  34711. i = val.length;
  34712. while (i--) { _traverse(val[i], seen); }
  34713. } else {
  34714. keys = Object.keys(val);
  34715. i = keys.length;
  34716. while (i--) { _traverse(val[keys[i]], seen); }
  34717. }
  34718. }
  34719. /* */
  34720. var normalizeEvent = cached(function (name) {
  34721. var passive = name.charAt(0) === '&';
  34722. name = passive ? name.slice(1) : name;
  34723. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34724. name = once$$1 ? name.slice(1) : name;
  34725. var capture = name.charAt(0) === '!';
  34726. name = capture ? name.slice(1) : name;
  34727. return {
  34728. name: name,
  34729. once: once$$1,
  34730. capture: capture,
  34731. passive: passive
  34732. }
  34733. });
  34734. function createFnInvoker (fns, vm) {
  34735. function invoker () {
  34736. var arguments$1 = arguments;
  34737. var fns = invoker.fns;
  34738. if (Array.isArray(fns)) {
  34739. var cloned = fns.slice();
  34740. for (var i = 0; i < cloned.length; i++) {
  34741. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34742. }
  34743. } else {
  34744. // return handler return value for single handlers
  34745. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34746. }
  34747. }
  34748. invoker.fns = fns;
  34749. return invoker
  34750. }
  34751. function updateListeners (
  34752. on,
  34753. oldOn,
  34754. add,
  34755. remove$$1,
  34756. createOnceHandler,
  34757. vm
  34758. ) {
  34759. var name, def$$1, cur, old, event;
  34760. for (name in on) {
  34761. def$$1 = cur = on[name];
  34762. old = oldOn[name];
  34763. event = normalizeEvent(name);
  34764. if (isUndef(cur)) {
  34765. warn(
  34766. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34767. vm
  34768. );
  34769. } else if (isUndef(old)) {
  34770. if (isUndef(cur.fns)) {
  34771. cur = on[name] = createFnInvoker(cur, vm);
  34772. }
  34773. if (isTrue(event.once)) {
  34774. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34775. }
  34776. add(event.name, cur, event.capture, event.passive, event.params);
  34777. } else if (cur !== old) {
  34778. old.fns = cur;
  34779. on[name] = old;
  34780. }
  34781. }
  34782. for (name in oldOn) {
  34783. if (isUndef(on[name])) {
  34784. event = normalizeEvent(name);
  34785. remove$$1(event.name, oldOn[name], event.capture);
  34786. }
  34787. }
  34788. }
  34789. /* */
  34790. function mergeVNodeHook (def, hookKey, hook) {
  34791. if (def instanceof VNode) {
  34792. def = def.data.hook || (def.data.hook = {});
  34793. }
  34794. var invoker;
  34795. var oldHook = def[hookKey];
  34796. function wrappedHook () {
  34797. hook.apply(this, arguments);
  34798. // important: remove merged hook to ensure it's called only once
  34799. // and prevent memory leak
  34800. remove(invoker.fns, wrappedHook);
  34801. }
  34802. if (isUndef(oldHook)) {
  34803. // no existing hook
  34804. invoker = createFnInvoker([wrappedHook]);
  34805. } else {
  34806. /* istanbul ignore if */
  34807. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34808. // already a merged invoker
  34809. invoker = oldHook;
  34810. invoker.fns.push(wrappedHook);
  34811. } else {
  34812. // existing plain hook
  34813. invoker = createFnInvoker([oldHook, wrappedHook]);
  34814. }
  34815. }
  34816. invoker.merged = true;
  34817. def[hookKey] = invoker;
  34818. }
  34819. /* */
  34820. function extractPropsFromVNodeData (
  34821. data,
  34822. Ctor,
  34823. tag
  34824. ) {
  34825. // we are only extracting raw values here.
  34826. // validation and default values are handled in the child
  34827. // component itself.
  34828. var propOptions = Ctor.options.props;
  34829. if (isUndef(propOptions)) {
  34830. return
  34831. }
  34832. var res = {};
  34833. var attrs = data.attrs;
  34834. var props = data.props;
  34835. if (isDef(attrs) || isDef(props)) {
  34836. for (var key in propOptions) {
  34837. var altKey = hyphenate(key);
  34838. {
  34839. var keyInLowerCase = key.toLowerCase();
  34840. if (
  34841. key !== keyInLowerCase &&
  34842. attrs && hasOwn(attrs, keyInLowerCase)
  34843. ) {
  34844. tip(
  34845. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  34846. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  34847. " \"" + key + "\". " +
  34848. "Note that HTML attributes are case-insensitive and camelCased " +
  34849. "props need to use their kebab-case equivalents when using in-DOM " +
  34850. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  34851. );
  34852. }
  34853. }
  34854. checkProp(res, props, key, altKey, true) ||
  34855. checkProp(res, attrs, key, altKey, false);
  34856. }
  34857. }
  34858. return res
  34859. }
  34860. function checkProp (
  34861. res,
  34862. hash,
  34863. key,
  34864. altKey,
  34865. preserve
  34866. ) {
  34867. if (isDef(hash)) {
  34868. if (hasOwn(hash, key)) {
  34869. res[key] = hash[key];
  34870. if (!preserve) {
  34871. delete hash[key];
  34872. }
  34873. return true
  34874. } else if (hasOwn(hash, altKey)) {
  34875. res[key] = hash[altKey];
  34876. if (!preserve) {
  34877. delete hash[altKey];
  34878. }
  34879. return true
  34880. }
  34881. }
  34882. return false
  34883. }
  34884. /* */
  34885. // The template compiler attempts to minimize the need for normalization by
  34886. // statically analyzing the template at compile time.
  34887. //
  34888. // For plain HTML markup, normalization can be completely skipped because the
  34889. // generated render function is guaranteed to return Array<VNode>. There are
  34890. // two cases where extra normalization is needed:
  34891. // 1. When the children contains components - because a functional component
  34892. // may return an Array instead of a single root. In this case, just a simple
  34893. // normalization is needed - if any child is an Array, we flatten the whole
  34894. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  34895. // because functional components already normalize their own children.
  34896. function simpleNormalizeChildren (children) {
  34897. for (var i = 0; i < children.length; i++) {
  34898. if (Array.isArray(children[i])) {
  34899. return Array.prototype.concat.apply([], children)
  34900. }
  34901. }
  34902. return children
  34903. }
  34904. // 2. When the children contains constructs that always generated nested Arrays,
  34905. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  34906. // with hand-written render functions / JSX. In such cases a full normalization
  34907. // is needed to cater to all possible types of children values.
  34908. function normalizeChildren (children) {
  34909. return isPrimitive(children)
  34910. ? [createTextVNode(children)]
  34911. : Array.isArray(children)
  34912. ? normalizeArrayChildren(children)
  34913. : undefined
  34914. }
  34915. function isTextNode (node) {
  34916. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  34917. }
  34918. function normalizeArrayChildren (children, nestedIndex) {
  34919. var res = [];
  34920. var i, c, lastIndex, last;
  34921. for (i = 0; i < children.length; i++) {
  34922. c = children[i];
  34923. if (isUndef(c) || typeof c === 'boolean') { continue }
  34924. lastIndex = res.length - 1;
  34925. last = res[lastIndex];
  34926. // nested
  34927. if (Array.isArray(c)) {
  34928. if (c.length > 0) {
  34929. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  34930. // merge adjacent text nodes
  34931. if (isTextNode(c[0]) && isTextNode(last)) {
  34932. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  34933. c.shift();
  34934. }
  34935. res.push.apply(res, c);
  34936. }
  34937. } else if (isPrimitive(c)) {
  34938. if (isTextNode(last)) {
  34939. // merge adjacent text nodes
  34940. // this is necessary for SSR hydration because text nodes are
  34941. // essentially merged when rendered to HTML strings
  34942. res[lastIndex] = createTextVNode(last.text + c);
  34943. } else if (c !== '') {
  34944. // convert primitive to vnode
  34945. res.push(createTextVNode(c));
  34946. }
  34947. } else {
  34948. if (isTextNode(c) && isTextNode(last)) {
  34949. // merge adjacent text nodes
  34950. res[lastIndex] = createTextVNode(last.text + c.text);
  34951. } else {
  34952. // default key for nested array children (likely generated by v-for)
  34953. if (isTrue(children._isVList) &&
  34954. isDef(c.tag) &&
  34955. isUndef(c.key) &&
  34956. isDef(nestedIndex)) {
  34957. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  34958. }
  34959. res.push(c);
  34960. }
  34961. }
  34962. }
  34963. return res
  34964. }
  34965. /* */
  34966. function initProvide (vm) {
  34967. var provide = vm.$options.provide;
  34968. if (provide) {
  34969. vm._provided = typeof provide === 'function'
  34970. ? provide.call(vm)
  34971. : provide;
  34972. }
  34973. }
  34974. function initInjections (vm) {
  34975. var result = resolveInject(vm.$options.inject, vm);
  34976. if (result) {
  34977. toggleObserving(false);
  34978. Object.keys(result).forEach(function (key) {
  34979. /* istanbul ignore else */
  34980. {
  34981. defineReactive$$1(vm, key, result[key], function () {
  34982. warn(
  34983. "Avoid mutating an injected value directly since the changes will be " +
  34984. "overwritten whenever the provided component re-renders. " +
  34985. "injection being mutated: \"" + key + "\"",
  34986. vm
  34987. );
  34988. });
  34989. }
  34990. });
  34991. toggleObserving(true);
  34992. }
  34993. }
  34994. function resolveInject (inject, vm) {
  34995. if (inject) {
  34996. // inject is :any because flow is not smart enough to figure out cached
  34997. var result = Object.create(null);
  34998. var keys = hasSymbol
  34999. ? Reflect.ownKeys(inject)
  35000. : Object.keys(inject);
  35001. for (var i = 0; i < keys.length; i++) {
  35002. var key = keys[i];
  35003. // #6574 in case the inject object is observed...
  35004. if (key === '__ob__') { continue }
  35005. var provideKey = inject[key].from;
  35006. var source = vm;
  35007. while (source) {
  35008. if (source._provided && hasOwn(source._provided, provideKey)) {
  35009. result[key] = source._provided[provideKey];
  35010. break
  35011. }
  35012. source = source.$parent;
  35013. }
  35014. if (!source) {
  35015. if ('default' in inject[key]) {
  35016. var provideDefault = inject[key].default;
  35017. result[key] = typeof provideDefault === 'function'
  35018. ? provideDefault.call(vm)
  35019. : provideDefault;
  35020. } else {
  35021. warn(("Injection \"" + key + "\" not found"), vm);
  35022. }
  35023. }
  35024. }
  35025. return result
  35026. }
  35027. }
  35028. /* */
  35029. /**
  35030. * Runtime helper for resolving raw children VNodes into a slot object.
  35031. */
  35032. function resolveSlots (
  35033. children,
  35034. context
  35035. ) {
  35036. if (!children || !children.length) {
  35037. return {}
  35038. }
  35039. var slots = {};
  35040. for (var i = 0, l = children.length; i < l; i++) {
  35041. var child = children[i];
  35042. var data = child.data;
  35043. // remove slot attribute if the node is resolved as a Vue slot node
  35044. if (data && data.attrs && data.attrs.slot) {
  35045. delete data.attrs.slot;
  35046. }
  35047. // named slots should only be respected if the vnode was rendered in the
  35048. // same context.
  35049. if ((child.context === context || child.fnContext === context) &&
  35050. data && data.slot != null
  35051. ) {
  35052. var name = data.slot;
  35053. var slot = (slots[name] || (slots[name] = []));
  35054. if (child.tag === 'template') {
  35055. slot.push.apply(slot, child.children || []);
  35056. } else {
  35057. slot.push(child);
  35058. }
  35059. } else {
  35060. (slots.default || (slots.default = [])).push(child);
  35061. }
  35062. }
  35063. // ignore slots that contains only whitespace
  35064. for (var name$1 in slots) {
  35065. if (slots[name$1].every(isWhitespace)) {
  35066. delete slots[name$1];
  35067. }
  35068. }
  35069. return slots
  35070. }
  35071. function isWhitespace (node) {
  35072. return (node.isComment && !node.asyncFactory) || node.text === ' '
  35073. }
  35074. /* */
  35075. function normalizeScopedSlots (
  35076. slots,
  35077. normalSlots,
  35078. prevSlots
  35079. ) {
  35080. var res;
  35081. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  35082. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  35083. var key = slots && slots.$key;
  35084. if (!slots) {
  35085. res = {};
  35086. } else if (slots._normalized) {
  35087. // fast path 1: child component re-render only, parent did not change
  35088. return slots._normalized
  35089. } else if (
  35090. isStable &&
  35091. prevSlots &&
  35092. prevSlots !== emptyObject &&
  35093. key === prevSlots.$key &&
  35094. !hasNormalSlots &&
  35095. !prevSlots.$hasNormal
  35096. ) {
  35097. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  35098. // only need to normalize once
  35099. return prevSlots
  35100. } else {
  35101. res = {};
  35102. for (var key$1 in slots) {
  35103. if (slots[key$1] && key$1[0] !== '$') {
  35104. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  35105. }
  35106. }
  35107. }
  35108. // expose normal slots on scopedSlots
  35109. for (var key$2 in normalSlots) {
  35110. if (!(key$2 in res)) {
  35111. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  35112. }
  35113. }
  35114. // avoriaz seems to mock a non-extensible $scopedSlots object
  35115. // and when that is passed down this would cause an error
  35116. if (slots && Object.isExtensible(slots)) {
  35117. (slots)._normalized = res;
  35118. }
  35119. def(res, '$stable', isStable);
  35120. def(res, '$key', key);
  35121. def(res, '$hasNormal', hasNormalSlots);
  35122. return res
  35123. }
  35124. function normalizeScopedSlot(normalSlots, key, fn) {
  35125. var normalized = function () {
  35126. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  35127. res = res && typeof res === 'object' && !Array.isArray(res)
  35128. ? [res] // single vnode
  35129. : normalizeChildren(res);
  35130. return res && (
  35131. res.length === 0 ||
  35132. (res.length === 1 && res[0].isComment) // #9658
  35133. ) ? undefined
  35134. : res
  35135. };
  35136. // this is a slot using the new v-slot syntax without scope. although it is
  35137. // compiled as a scoped slot, render fn users would expect it to be present
  35138. // on this.$slots because the usage is semantically a normal slot.
  35139. if (fn.proxy) {
  35140. Object.defineProperty(normalSlots, key, {
  35141. get: normalized,
  35142. enumerable: true,
  35143. configurable: true
  35144. });
  35145. }
  35146. return normalized
  35147. }
  35148. function proxyNormalSlot(slots, key) {
  35149. return function () { return slots[key]; }
  35150. }
  35151. /* */
  35152. /**
  35153. * Runtime helper for rendering v-for lists.
  35154. */
  35155. function renderList (
  35156. val,
  35157. render
  35158. ) {
  35159. var ret, i, l, keys, key;
  35160. if (Array.isArray(val) || typeof val === 'string') {
  35161. ret = new Array(val.length);
  35162. for (i = 0, l = val.length; i < l; i++) {
  35163. ret[i] = render(val[i], i);
  35164. }
  35165. } else if (typeof val === 'number') {
  35166. ret = new Array(val);
  35167. for (i = 0; i < val; i++) {
  35168. ret[i] = render(i + 1, i);
  35169. }
  35170. } else if (isObject(val)) {
  35171. if (hasSymbol && val[Symbol.iterator]) {
  35172. ret = [];
  35173. var iterator = val[Symbol.iterator]();
  35174. var result = iterator.next();
  35175. while (!result.done) {
  35176. ret.push(render(result.value, ret.length));
  35177. result = iterator.next();
  35178. }
  35179. } else {
  35180. keys = Object.keys(val);
  35181. ret = new Array(keys.length);
  35182. for (i = 0, l = keys.length; i < l; i++) {
  35183. key = keys[i];
  35184. ret[i] = render(val[key], key, i);
  35185. }
  35186. }
  35187. }
  35188. if (!isDef(ret)) {
  35189. ret = [];
  35190. }
  35191. (ret)._isVList = true;
  35192. return ret
  35193. }
  35194. /* */
  35195. /**
  35196. * Runtime helper for rendering <slot>
  35197. */
  35198. function renderSlot (
  35199. name,
  35200. fallback,
  35201. props,
  35202. bindObject
  35203. ) {
  35204. var scopedSlotFn = this.$scopedSlots[name];
  35205. var nodes;
  35206. if (scopedSlotFn) { // scoped slot
  35207. props = props || {};
  35208. if (bindObject) {
  35209. if (!isObject(bindObject)) {
  35210. warn(
  35211. 'slot v-bind without argument expects an Object',
  35212. this
  35213. );
  35214. }
  35215. props = extend(extend({}, bindObject), props);
  35216. }
  35217. nodes = scopedSlotFn(props) || fallback;
  35218. } else {
  35219. nodes = this.$slots[name] || fallback;
  35220. }
  35221. var target = props && props.slot;
  35222. if (target) {
  35223. return this.$createElement('template', { slot: target }, nodes)
  35224. } else {
  35225. return nodes
  35226. }
  35227. }
  35228. /* */
  35229. /**
  35230. * Runtime helper for resolving filters
  35231. */
  35232. function resolveFilter (id) {
  35233. return resolveAsset(this.$options, 'filters', id, true) || identity
  35234. }
  35235. /* */
  35236. function isKeyNotMatch (expect, actual) {
  35237. if (Array.isArray(expect)) {
  35238. return expect.indexOf(actual) === -1
  35239. } else {
  35240. return expect !== actual
  35241. }
  35242. }
  35243. /**
  35244. * Runtime helper for checking keyCodes from config.
  35245. * exposed as Vue.prototype._k
  35246. * passing in eventKeyName as last argument separately for backwards compat
  35247. */
  35248. function checkKeyCodes (
  35249. eventKeyCode,
  35250. key,
  35251. builtInKeyCode,
  35252. eventKeyName,
  35253. builtInKeyName
  35254. ) {
  35255. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  35256. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  35257. return isKeyNotMatch(builtInKeyName, eventKeyName)
  35258. } else if (mappedKeyCode) {
  35259. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  35260. } else if (eventKeyName) {
  35261. return hyphenate(eventKeyName) !== key
  35262. }
  35263. }
  35264. /* */
  35265. /**
  35266. * Runtime helper for merging v-bind="object" into a VNode's data.
  35267. */
  35268. function bindObjectProps (
  35269. data,
  35270. tag,
  35271. value,
  35272. asProp,
  35273. isSync
  35274. ) {
  35275. if (value) {
  35276. if (!isObject(value)) {
  35277. warn(
  35278. 'v-bind without argument expects an Object or Array value',
  35279. this
  35280. );
  35281. } else {
  35282. if (Array.isArray(value)) {
  35283. value = toObject(value);
  35284. }
  35285. var hash;
  35286. var loop = function ( key ) {
  35287. if (
  35288. key === 'class' ||
  35289. key === 'style' ||
  35290. isReservedAttribute(key)
  35291. ) {
  35292. hash = data;
  35293. } else {
  35294. var type = data.attrs && data.attrs.type;
  35295. hash = asProp || config.mustUseProp(tag, type, key)
  35296. ? data.domProps || (data.domProps = {})
  35297. : data.attrs || (data.attrs = {});
  35298. }
  35299. var camelizedKey = camelize(key);
  35300. var hyphenatedKey = hyphenate(key);
  35301. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  35302. hash[key] = value[key];
  35303. if (isSync) {
  35304. var on = data.on || (data.on = {});
  35305. on[("update:" + key)] = function ($event) {
  35306. value[key] = $event;
  35307. };
  35308. }
  35309. }
  35310. };
  35311. for (var key in value) loop( key );
  35312. }
  35313. }
  35314. return data
  35315. }
  35316. /* */
  35317. /**
  35318. * Runtime helper for rendering static trees.
  35319. */
  35320. function renderStatic (
  35321. index,
  35322. isInFor
  35323. ) {
  35324. var cached = this._staticTrees || (this._staticTrees = []);
  35325. var tree = cached[index];
  35326. // if has already-rendered static tree and not inside v-for,
  35327. // we can reuse the same tree.
  35328. if (tree && !isInFor) {
  35329. return tree
  35330. }
  35331. // otherwise, render a fresh tree.
  35332. tree = cached[index] = this.$options.staticRenderFns[index].call(
  35333. this._renderProxy,
  35334. null,
  35335. this // for render fns generated for functional component templates
  35336. );
  35337. markStatic(tree, ("__static__" + index), false);
  35338. return tree
  35339. }
  35340. /**
  35341. * Runtime helper for v-once.
  35342. * Effectively it means marking the node as static with a unique key.
  35343. */
  35344. function markOnce (
  35345. tree,
  35346. index,
  35347. key
  35348. ) {
  35349. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  35350. return tree
  35351. }
  35352. function markStatic (
  35353. tree,
  35354. key,
  35355. isOnce
  35356. ) {
  35357. if (Array.isArray(tree)) {
  35358. for (var i = 0; i < tree.length; i++) {
  35359. if (tree[i] && typeof tree[i] !== 'string') {
  35360. markStaticNode(tree[i], (key + "_" + i), isOnce);
  35361. }
  35362. }
  35363. } else {
  35364. markStaticNode(tree, key, isOnce);
  35365. }
  35366. }
  35367. function markStaticNode (node, key, isOnce) {
  35368. node.isStatic = true;
  35369. node.key = key;
  35370. node.isOnce = isOnce;
  35371. }
  35372. /* */
  35373. function bindObjectListeners (data, value) {
  35374. if (value) {
  35375. if (!isPlainObject(value)) {
  35376. warn(
  35377. 'v-on without argument expects an Object value',
  35378. this
  35379. );
  35380. } else {
  35381. var on = data.on = data.on ? extend({}, data.on) : {};
  35382. for (var key in value) {
  35383. var existing = on[key];
  35384. var ours = value[key];
  35385. on[key] = existing ? [].concat(existing, ours) : ours;
  35386. }
  35387. }
  35388. }
  35389. return data
  35390. }
  35391. /* */
  35392. function resolveScopedSlots (
  35393. fns, // see flow/vnode
  35394. res,
  35395. // the following are added in 2.6
  35396. hasDynamicKeys,
  35397. contentHashKey
  35398. ) {
  35399. res = res || { $stable: !hasDynamicKeys };
  35400. for (var i = 0; i < fns.length; i++) {
  35401. var slot = fns[i];
  35402. if (Array.isArray(slot)) {
  35403. resolveScopedSlots(slot, res, hasDynamicKeys);
  35404. } else if (slot) {
  35405. // marker for reverse proxying v-slot without scope on this.$slots
  35406. if (slot.proxy) {
  35407. slot.fn.proxy = true;
  35408. }
  35409. res[slot.key] = slot.fn;
  35410. }
  35411. }
  35412. if (contentHashKey) {
  35413. (res).$key = contentHashKey;
  35414. }
  35415. return res
  35416. }
  35417. /* */
  35418. function bindDynamicKeys (baseObj, values) {
  35419. for (var i = 0; i < values.length; i += 2) {
  35420. var key = values[i];
  35421. if (typeof key === 'string' && key) {
  35422. baseObj[values[i]] = values[i + 1];
  35423. } else if (key !== '' && key !== null) {
  35424. // null is a speical value for explicitly removing a binding
  35425. warn(
  35426. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  35427. this
  35428. );
  35429. }
  35430. }
  35431. return baseObj
  35432. }
  35433. // helper to dynamically append modifier runtime markers to event names.
  35434. // ensure only append when value is already string, otherwise it will be cast
  35435. // to string and cause the type check to miss.
  35436. function prependModifier (value, symbol) {
  35437. return typeof value === 'string' ? symbol + value : value
  35438. }
  35439. /* */
  35440. function installRenderHelpers (target) {
  35441. target._o = markOnce;
  35442. target._n = toNumber;
  35443. target._s = toString;
  35444. target._l = renderList;
  35445. target._t = renderSlot;
  35446. target._q = looseEqual;
  35447. target._i = looseIndexOf;
  35448. target._m = renderStatic;
  35449. target._f = resolveFilter;
  35450. target._k = checkKeyCodes;
  35451. target._b = bindObjectProps;
  35452. target._v = createTextVNode;
  35453. target._e = createEmptyVNode;
  35454. target._u = resolveScopedSlots;
  35455. target._g = bindObjectListeners;
  35456. target._d = bindDynamicKeys;
  35457. target._p = prependModifier;
  35458. }
  35459. /* */
  35460. function FunctionalRenderContext (
  35461. data,
  35462. props,
  35463. children,
  35464. parent,
  35465. Ctor
  35466. ) {
  35467. var this$1 = this;
  35468. var options = Ctor.options;
  35469. // ensure the createElement function in functional components
  35470. // gets a unique context - this is necessary for correct named slot check
  35471. var contextVm;
  35472. if (hasOwn(parent, '_uid')) {
  35473. contextVm = Object.create(parent);
  35474. // $flow-disable-line
  35475. contextVm._original = parent;
  35476. } else {
  35477. // the context vm passed in is a functional context as well.
  35478. // in this case we want to make sure we are able to get a hold to the
  35479. // real context instance.
  35480. contextVm = parent;
  35481. // $flow-disable-line
  35482. parent = parent._original;
  35483. }
  35484. var isCompiled = isTrue(options._compiled);
  35485. var needNormalization = !isCompiled;
  35486. this.data = data;
  35487. this.props = props;
  35488. this.children = children;
  35489. this.parent = parent;
  35490. this.listeners = data.on || emptyObject;
  35491. this.injections = resolveInject(options.inject, parent);
  35492. this.slots = function () {
  35493. if (!this$1.$slots) {
  35494. normalizeScopedSlots(
  35495. data.scopedSlots,
  35496. this$1.$slots = resolveSlots(children, parent)
  35497. );
  35498. }
  35499. return this$1.$slots
  35500. };
  35501. Object.defineProperty(this, 'scopedSlots', ({
  35502. enumerable: true,
  35503. get: function get () {
  35504. return normalizeScopedSlots(data.scopedSlots, this.slots())
  35505. }
  35506. }));
  35507. // support for compiled functional template
  35508. if (isCompiled) {
  35509. // exposing $options for renderStatic()
  35510. this.$options = options;
  35511. // pre-resolve slots for renderSlot()
  35512. this.$slots = this.slots();
  35513. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  35514. }
  35515. if (options._scopeId) {
  35516. this._c = function (a, b, c, d) {
  35517. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  35518. if (vnode && !Array.isArray(vnode)) {
  35519. vnode.fnScopeId = options._scopeId;
  35520. vnode.fnContext = parent;
  35521. }
  35522. return vnode
  35523. };
  35524. } else {
  35525. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35526. }
  35527. }
  35528. installRenderHelpers(FunctionalRenderContext.prototype);
  35529. function createFunctionalComponent (
  35530. Ctor,
  35531. propsData,
  35532. data,
  35533. contextVm,
  35534. children
  35535. ) {
  35536. var options = Ctor.options;
  35537. var props = {};
  35538. var propOptions = options.props;
  35539. if (isDef(propOptions)) {
  35540. for (var key in propOptions) {
  35541. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35542. }
  35543. } else {
  35544. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35545. if (isDef(data.props)) { mergeProps(props, data.props); }
  35546. }
  35547. var renderContext = new FunctionalRenderContext(
  35548. data,
  35549. props,
  35550. children,
  35551. contextVm,
  35552. Ctor
  35553. );
  35554. var vnode = options.render.call(null, renderContext._c, renderContext);
  35555. if (vnode instanceof VNode) {
  35556. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35557. } else if (Array.isArray(vnode)) {
  35558. var vnodes = normalizeChildren(vnode) || [];
  35559. var res = new Array(vnodes.length);
  35560. for (var i = 0; i < vnodes.length; i++) {
  35561. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35562. }
  35563. return res
  35564. }
  35565. }
  35566. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35567. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35568. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35569. // that should not be matched to match.
  35570. var clone = cloneVNode(vnode);
  35571. clone.fnContext = contextVm;
  35572. clone.fnOptions = options;
  35573. {
  35574. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35575. }
  35576. if (data.slot) {
  35577. (clone.data || (clone.data = {})).slot = data.slot;
  35578. }
  35579. return clone
  35580. }
  35581. function mergeProps (to, from) {
  35582. for (var key in from) {
  35583. to[camelize(key)] = from[key];
  35584. }
  35585. }
  35586. /* */
  35587. /* */
  35588. /* */
  35589. /* */
  35590. // inline hooks to be invoked on component VNodes during patch
  35591. var componentVNodeHooks = {
  35592. init: function init (vnode, hydrating) {
  35593. if (
  35594. vnode.componentInstance &&
  35595. !vnode.componentInstance._isDestroyed &&
  35596. vnode.data.keepAlive
  35597. ) {
  35598. // kept-alive components, treat as a patch
  35599. var mountedNode = vnode; // work around flow
  35600. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35601. } else {
  35602. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35603. vnode,
  35604. activeInstance
  35605. );
  35606. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35607. }
  35608. },
  35609. prepatch: function prepatch (oldVnode, vnode) {
  35610. var options = vnode.componentOptions;
  35611. var child = vnode.componentInstance = oldVnode.componentInstance;
  35612. updateChildComponent(
  35613. child,
  35614. options.propsData, // updated props
  35615. options.listeners, // updated listeners
  35616. vnode, // new parent vnode
  35617. options.children // new children
  35618. );
  35619. },
  35620. insert: function insert (vnode) {
  35621. var context = vnode.context;
  35622. var componentInstance = vnode.componentInstance;
  35623. if (!componentInstance._isMounted) {
  35624. componentInstance._isMounted = true;
  35625. callHook(componentInstance, 'mounted');
  35626. }
  35627. if (vnode.data.keepAlive) {
  35628. if (context._isMounted) {
  35629. // vue-router#1212
  35630. // During updates, a kept-alive component's child components may
  35631. // change, so directly walking the tree here may call activated hooks
  35632. // on incorrect children. Instead we push them into a queue which will
  35633. // be processed after the whole patch process ended.
  35634. queueActivatedComponent(componentInstance);
  35635. } else {
  35636. activateChildComponent(componentInstance, true /* direct */);
  35637. }
  35638. }
  35639. },
  35640. destroy: function destroy (vnode) {
  35641. var componentInstance = vnode.componentInstance;
  35642. if (!componentInstance._isDestroyed) {
  35643. if (!vnode.data.keepAlive) {
  35644. componentInstance.$destroy();
  35645. } else {
  35646. deactivateChildComponent(componentInstance, true /* direct */);
  35647. }
  35648. }
  35649. }
  35650. };
  35651. var hooksToMerge = Object.keys(componentVNodeHooks);
  35652. function createComponent (
  35653. Ctor,
  35654. data,
  35655. context,
  35656. children,
  35657. tag
  35658. ) {
  35659. if (isUndef(Ctor)) {
  35660. return
  35661. }
  35662. var baseCtor = context.$options._base;
  35663. // plain options object: turn it into a constructor
  35664. if (isObject(Ctor)) {
  35665. Ctor = baseCtor.extend(Ctor);
  35666. }
  35667. // if at this stage it's not a constructor or an async component factory,
  35668. // reject.
  35669. if (typeof Ctor !== 'function') {
  35670. {
  35671. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35672. }
  35673. return
  35674. }
  35675. // async component
  35676. var asyncFactory;
  35677. if (isUndef(Ctor.cid)) {
  35678. asyncFactory = Ctor;
  35679. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35680. if (Ctor === undefined) {
  35681. // return a placeholder node for async component, which is rendered
  35682. // as a comment node but preserves all the raw information for the node.
  35683. // the information will be used for async server-rendering and hydration.
  35684. return createAsyncPlaceholder(
  35685. asyncFactory,
  35686. data,
  35687. context,
  35688. children,
  35689. tag
  35690. )
  35691. }
  35692. }
  35693. data = data || {};
  35694. // resolve constructor options in case global mixins are applied after
  35695. // component constructor creation
  35696. resolveConstructorOptions(Ctor);
  35697. // transform component v-model data into props & events
  35698. if (isDef(data.model)) {
  35699. transformModel(Ctor.options, data);
  35700. }
  35701. // extract props
  35702. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35703. // functional component
  35704. if (isTrue(Ctor.options.functional)) {
  35705. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35706. }
  35707. // extract listeners, since these needs to be treated as
  35708. // child component listeners instead of DOM listeners
  35709. var listeners = data.on;
  35710. // replace with listeners with .native modifier
  35711. // so it gets processed during parent component patch.
  35712. data.on = data.nativeOn;
  35713. if (isTrue(Ctor.options.abstract)) {
  35714. // abstract components do not keep anything
  35715. // other than props & listeners & slot
  35716. // work around flow
  35717. var slot = data.slot;
  35718. data = {};
  35719. if (slot) {
  35720. data.slot = slot;
  35721. }
  35722. }
  35723. // install component management hooks onto the placeholder node
  35724. installComponentHooks(data);
  35725. // return a placeholder vnode
  35726. var name = Ctor.options.name || tag;
  35727. var vnode = new VNode(
  35728. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35729. data, undefined, undefined, undefined, context,
  35730. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35731. asyncFactory
  35732. );
  35733. return vnode
  35734. }
  35735. function createComponentInstanceForVnode (
  35736. vnode, // we know it's MountedComponentVNode but flow doesn't
  35737. parent // activeInstance in lifecycle state
  35738. ) {
  35739. var options = {
  35740. _isComponent: true,
  35741. _parentVnode: vnode,
  35742. parent: parent
  35743. };
  35744. // check inline-template render functions
  35745. var inlineTemplate = vnode.data.inlineTemplate;
  35746. if (isDef(inlineTemplate)) {
  35747. options.render = inlineTemplate.render;
  35748. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35749. }
  35750. return new vnode.componentOptions.Ctor(options)
  35751. }
  35752. function installComponentHooks (data) {
  35753. var hooks = data.hook || (data.hook = {});
  35754. for (var i = 0; i < hooksToMerge.length; i++) {
  35755. var key = hooksToMerge[i];
  35756. var existing = hooks[key];
  35757. var toMerge = componentVNodeHooks[key];
  35758. if (existing !== toMerge && !(existing && existing._merged)) {
  35759. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35760. }
  35761. }
  35762. }
  35763. function mergeHook$1 (f1, f2) {
  35764. var merged = function (a, b) {
  35765. // flow complains about extra args which is why we use any
  35766. f1(a, b);
  35767. f2(a, b);
  35768. };
  35769. merged._merged = true;
  35770. return merged
  35771. }
  35772. // transform component v-model info (value and callback) into
  35773. // prop and event handler respectively.
  35774. function transformModel (options, data) {
  35775. var prop = (options.model && options.model.prop) || 'value';
  35776. var event = (options.model && options.model.event) || 'input'
  35777. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35778. var on = data.on || (data.on = {});
  35779. var existing = on[event];
  35780. var callback = data.model.callback;
  35781. if (isDef(existing)) {
  35782. if (
  35783. Array.isArray(existing)
  35784. ? existing.indexOf(callback) === -1
  35785. : existing !== callback
  35786. ) {
  35787. on[event] = [callback].concat(existing);
  35788. }
  35789. } else {
  35790. on[event] = callback;
  35791. }
  35792. }
  35793. /* */
  35794. var SIMPLE_NORMALIZE = 1;
  35795. var ALWAYS_NORMALIZE = 2;
  35796. // wrapper function for providing a more flexible interface
  35797. // without getting yelled at by flow
  35798. function createElement (
  35799. context,
  35800. tag,
  35801. data,
  35802. children,
  35803. normalizationType,
  35804. alwaysNormalize
  35805. ) {
  35806. if (Array.isArray(data) || isPrimitive(data)) {
  35807. normalizationType = children;
  35808. children = data;
  35809. data = undefined;
  35810. }
  35811. if (isTrue(alwaysNormalize)) {
  35812. normalizationType = ALWAYS_NORMALIZE;
  35813. }
  35814. return _createElement(context, tag, data, children, normalizationType)
  35815. }
  35816. function _createElement (
  35817. context,
  35818. tag,
  35819. data,
  35820. children,
  35821. normalizationType
  35822. ) {
  35823. if (isDef(data) && isDef((data).__ob__)) {
  35824. warn(
  35825. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35826. 'Always create fresh vnode data objects in each render!',
  35827. context
  35828. );
  35829. return createEmptyVNode()
  35830. }
  35831. // object syntax in v-bind
  35832. if (isDef(data) && isDef(data.is)) {
  35833. tag = data.is;
  35834. }
  35835. if (!tag) {
  35836. // in case of component :is set to falsy value
  35837. return createEmptyVNode()
  35838. }
  35839. // warn against non-primitive key
  35840. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  35841. ) {
  35842. {
  35843. warn(
  35844. 'Avoid using non-primitive value as key, ' +
  35845. 'use string/number value instead.',
  35846. context
  35847. );
  35848. }
  35849. }
  35850. // support single function children as default scoped slot
  35851. if (Array.isArray(children) &&
  35852. typeof children[0] === 'function'
  35853. ) {
  35854. data = data || {};
  35855. data.scopedSlots = { default: children[0] };
  35856. children.length = 0;
  35857. }
  35858. if (normalizationType === ALWAYS_NORMALIZE) {
  35859. children = normalizeChildren(children);
  35860. } else if (normalizationType === SIMPLE_NORMALIZE) {
  35861. children = simpleNormalizeChildren(children);
  35862. }
  35863. var vnode, ns;
  35864. if (typeof tag === 'string') {
  35865. var Ctor;
  35866. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  35867. if (config.isReservedTag(tag)) {
  35868. // platform built-in elements
  35869. vnode = new VNode(
  35870. config.parsePlatformTagName(tag), data, children,
  35871. undefined, undefined, context
  35872. );
  35873. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  35874. // component
  35875. vnode = createComponent(Ctor, data, context, children, tag);
  35876. } else {
  35877. // unknown or unlisted namespaced elements
  35878. // check at runtime because it may get assigned a namespace when its
  35879. // parent normalizes children
  35880. vnode = new VNode(
  35881. tag, data, children,
  35882. undefined, undefined, context
  35883. );
  35884. }
  35885. } else {
  35886. // direct component options / constructor
  35887. vnode = createComponent(tag, data, context, children);
  35888. }
  35889. if (Array.isArray(vnode)) {
  35890. return vnode
  35891. } else if (isDef(vnode)) {
  35892. if (isDef(ns)) { applyNS(vnode, ns); }
  35893. if (isDef(data)) { registerDeepBindings(data); }
  35894. return vnode
  35895. } else {
  35896. return createEmptyVNode()
  35897. }
  35898. }
  35899. function applyNS (vnode, ns, force) {
  35900. vnode.ns = ns;
  35901. if (vnode.tag === 'foreignObject') {
  35902. // use default namespace inside foreignObject
  35903. ns = undefined;
  35904. force = true;
  35905. }
  35906. if (isDef(vnode.children)) {
  35907. for (var i = 0, l = vnode.children.length; i < l; i++) {
  35908. var child = vnode.children[i];
  35909. if (isDef(child.tag) && (
  35910. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  35911. applyNS(child, ns, force);
  35912. }
  35913. }
  35914. }
  35915. }
  35916. // ref #5318
  35917. // necessary to ensure parent re-render when deep bindings like :style and
  35918. // :class are used on slot nodes
  35919. function registerDeepBindings (data) {
  35920. if (isObject(data.style)) {
  35921. traverse(data.style);
  35922. }
  35923. if (isObject(data.class)) {
  35924. traverse(data.class);
  35925. }
  35926. }
  35927. /* */
  35928. function initRender (vm) {
  35929. vm._vnode = null; // the root of the child tree
  35930. vm._staticTrees = null; // v-once cached trees
  35931. var options = vm.$options;
  35932. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  35933. var renderContext = parentVnode && parentVnode.context;
  35934. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  35935. vm.$scopedSlots = emptyObject;
  35936. // bind the createElement fn to this instance
  35937. // so that we get proper render context inside it.
  35938. // args order: tag, data, children, normalizationType, alwaysNormalize
  35939. // internal version is used by render functions compiled from templates
  35940. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  35941. // normalization is always applied for the public version, used in
  35942. // user-written render functions.
  35943. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  35944. // $attrs & $listeners are exposed for easier HOC creation.
  35945. // they need to be reactive so that HOCs using them are always updated
  35946. var parentData = parentVnode && parentVnode.data;
  35947. /* istanbul ignore else */
  35948. {
  35949. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  35950. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  35951. }, true);
  35952. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  35953. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  35954. }, true);
  35955. }
  35956. }
  35957. var currentRenderingInstance = null;
  35958. function renderMixin (Vue) {
  35959. // install runtime convenience helpers
  35960. installRenderHelpers(Vue.prototype);
  35961. Vue.prototype.$nextTick = function (fn) {
  35962. return nextTick(fn, this)
  35963. };
  35964. Vue.prototype._render = function () {
  35965. var vm = this;
  35966. var ref = vm.$options;
  35967. var render = ref.render;
  35968. var _parentVnode = ref._parentVnode;
  35969. if (_parentVnode) {
  35970. vm.$scopedSlots = normalizeScopedSlots(
  35971. _parentVnode.data.scopedSlots,
  35972. vm.$slots,
  35973. vm.$scopedSlots
  35974. );
  35975. }
  35976. // set parent vnode. this allows render functions to have access
  35977. // to the data on the placeholder node.
  35978. vm.$vnode = _parentVnode;
  35979. // render self
  35980. var vnode;
  35981. try {
  35982. // There's no need to maintain a stack becaues all render fns are called
  35983. // separately from one another. Nested component's render fns are called
  35984. // when parent component is patched.
  35985. currentRenderingInstance = vm;
  35986. vnode = render.call(vm._renderProxy, vm.$createElement);
  35987. } catch (e) {
  35988. handleError(e, vm, "render");
  35989. // return error render result,
  35990. // or previous vnode to prevent render error causing blank component
  35991. /* istanbul ignore else */
  35992. if (vm.$options.renderError) {
  35993. try {
  35994. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  35995. } catch (e) {
  35996. handleError(e, vm, "renderError");
  35997. vnode = vm._vnode;
  35998. }
  35999. } else {
  36000. vnode = vm._vnode;
  36001. }
  36002. } finally {
  36003. currentRenderingInstance = null;
  36004. }
  36005. // if the returned array contains only a single node, allow it
  36006. if (Array.isArray(vnode) && vnode.length === 1) {
  36007. vnode = vnode[0];
  36008. }
  36009. // return empty vnode in case the render function errored out
  36010. if (!(vnode instanceof VNode)) {
  36011. if (Array.isArray(vnode)) {
  36012. warn(
  36013. 'Multiple root nodes returned from render function. Render function ' +
  36014. 'should return a single root node.',
  36015. vm
  36016. );
  36017. }
  36018. vnode = createEmptyVNode();
  36019. }
  36020. // set parent
  36021. vnode.parent = _parentVnode;
  36022. return vnode
  36023. };
  36024. }
  36025. /* */
  36026. function ensureCtor (comp, base) {
  36027. if (
  36028. comp.__esModule ||
  36029. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  36030. ) {
  36031. comp = comp.default;
  36032. }
  36033. return isObject(comp)
  36034. ? base.extend(comp)
  36035. : comp
  36036. }
  36037. function createAsyncPlaceholder (
  36038. factory,
  36039. data,
  36040. context,
  36041. children,
  36042. tag
  36043. ) {
  36044. var node = createEmptyVNode();
  36045. node.asyncFactory = factory;
  36046. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  36047. return node
  36048. }
  36049. function resolveAsyncComponent (
  36050. factory,
  36051. baseCtor
  36052. ) {
  36053. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  36054. return factory.errorComp
  36055. }
  36056. if (isDef(factory.resolved)) {
  36057. return factory.resolved
  36058. }
  36059. var owner = currentRenderingInstance;
  36060. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  36061. // already pending
  36062. factory.owners.push(owner);
  36063. }
  36064. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  36065. return factory.loadingComp
  36066. }
  36067. if (owner && !isDef(factory.owners)) {
  36068. var owners = factory.owners = [owner];
  36069. var sync = true;
  36070. var timerLoading = null;
  36071. var timerTimeout = null
  36072. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  36073. var forceRender = function (renderCompleted) {
  36074. for (var i = 0, l = owners.length; i < l; i++) {
  36075. (owners[i]).$forceUpdate();
  36076. }
  36077. if (renderCompleted) {
  36078. owners.length = 0;
  36079. if (timerLoading !== null) {
  36080. clearTimeout(timerLoading);
  36081. timerLoading = null;
  36082. }
  36083. if (timerTimeout !== null) {
  36084. clearTimeout(timerTimeout);
  36085. timerTimeout = null;
  36086. }
  36087. }
  36088. };
  36089. var resolve = once(function (res) {
  36090. // cache resolved
  36091. factory.resolved = ensureCtor(res, baseCtor);
  36092. // invoke callbacks only if this is not a synchronous resolve
  36093. // (async resolves are shimmed as synchronous during SSR)
  36094. if (!sync) {
  36095. forceRender(true);
  36096. } else {
  36097. owners.length = 0;
  36098. }
  36099. });
  36100. var reject = once(function (reason) {
  36101. warn(
  36102. "Failed to resolve async component: " + (String(factory)) +
  36103. (reason ? ("\nReason: " + reason) : '')
  36104. );
  36105. if (isDef(factory.errorComp)) {
  36106. factory.error = true;
  36107. forceRender(true);
  36108. }
  36109. });
  36110. var res = factory(resolve, reject);
  36111. if (isObject(res)) {
  36112. if (isPromise(res)) {
  36113. // () => Promise
  36114. if (isUndef(factory.resolved)) {
  36115. res.then(resolve, reject);
  36116. }
  36117. } else if (isPromise(res.component)) {
  36118. res.component.then(resolve, reject);
  36119. if (isDef(res.error)) {
  36120. factory.errorComp = ensureCtor(res.error, baseCtor);
  36121. }
  36122. if (isDef(res.loading)) {
  36123. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  36124. if (res.delay === 0) {
  36125. factory.loading = true;
  36126. } else {
  36127. timerLoading = setTimeout(function () {
  36128. timerLoading = null;
  36129. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  36130. factory.loading = true;
  36131. forceRender(false);
  36132. }
  36133. }, res.delay || 200);
  36134. }
  36135. }
  36136. if (isDef(res.timeout)) {
  36137. timerTimeout = setTimeout(function () {
  36138. timerTimeout = null;
  36139. if (isUndef(factory.resolved)) {
  36140. reject(
  36141. "timeout (" + (res.timeout) + "ms)"
  36142. );
  36143. }
  36144. }, res.timeout);
  36145. }
  36146. }
  36147. }
  36148. sync = false;
  36149. // return in case resolved synchronously
  36150. return factory.loading
  36151. ? factory.loadingComp
  36152. : factory.resolved
  36153. }
  36154. }
  36155. /* */
  36156. function isAsyncPlaceholder (node) {
  36157. return node.isComment && node.asyncFactory
  36158. }
  36159. /* */
  36160. function getFirstComponentChild (children) {
  36161. if (Array.isArray(children)) {
  36162. for (var i = 0; i < children.length; i++) {
  36163. var c = children[i];
  36164. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  36165. return c
  36166. }
  36167. }
  36168. }
  36169. }
  36170. /* */
  36171. /* */
  36172. function initEvents (vm) {
  36173. vm._events = Object.create(null);
  36174. vm._hasHookEvent = false;
  36175. // init parent attached events
  36176. var listeners = vm.$options._parentListeners;
  36177. if (listeners) {
  36178. updateComponentListeners(vm, listeners);
  36179. }
  36180. }
  36181. var target;
  36182. function add (event, fn) {
  36183. target.$on(event, fn);
  36184. }
  36185. function remove$1 (event, fn) {
  36186. target.$off(event, fn);
  36187. }
  36188. function createOnceHandler (event, fn) {
  36189. var _target = target;
  36190. return function onceHandler () {
  36191. var res = fn.apply(null, arguments);
  36192. if (res !== null) {
  36193. _target.$off(event, onceHandler);
  36194. }
  36195. }
  36196. }
  36197. function updateComponentListeners (
  36198. vm,
  36199. listeners,
  36200. oldListeners
  36201. ) {
  36202. target = vm;
  36203. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  36204. target = undefined;
  36205. }
  36206. function eventsMixin (Vue) {
  36207. var hookRE = /^hook:/;
  36208. Vue.prototype.$on = function (event, fn) {
  36209. var vm = this;
  36210. if (Array.isArray(event)) {
  36211. for (var i = 0, l = event.length; i < l; i++) {
  36212. vm.$on(event[i], fn);
  36213. }
  36214. } else {
  36215. (vm._events[event] || (vm._events[event] = [])).push(fn);
  36216. // optimize hook:event cost by using a boolean flag marked at registration
  36217. // instead of a hash lookup
  36218. if (hookRE.test(event)) {
  36219. vm._hasHookEvent = true;
  36220. }
  36221. }
  36222. return vm
  36223. };
  36224. Vue.prototype.$once = function (event, fn) {
  36225. var vm = this;
  36226. function on () {
  36227. vm.$off(event, on);
  36228. fn.apply(vm, arguments);
  36229. }
  36230. on.fn = fn;
  36231. vm.$on(event, on);
  36232. return vm
  36233. };
  36234. Vue.prototype.$off = function (event, fn) {
  36235. var vm = this;
  36236. // all
  36237. if (!arguments.length) {
  36238. vm._events = Object.create(null);
  36239. return vm
  36240. }
  36241. // array of events
  36242. if (Array.isArray(event)) {
  36243. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  36244. vm.$off(event[i$1], fn);
  36245. }
  36246. return vm
  36247. }
  36248. // specific event
  36249. var cbs = vm._events[event];
  36250. if (!cbs) {
  36251. return vm
  36252. }
  36253. if (!fn) {
  36254. vm._events[event] = null;
  36255. return vm
  36256. }
  36257. // specific handler
  36258. var cb;
  36259. var i = cbs.length;
  36260. while (i--) {
  36261. cb = cbs[i];
  36262. if (cb === fn || cb.fn === fn) {
  36263. cbs.splice(i, 1);
  36264. break
  36265. }
  36266. }
  36267. return vm
  36268. };
  36269. Vue.prototype.$emit = function (event) {
  36270. var vm = this;
  36271. {
  36272. var lowerCaseEvent = event.toLowerCase();
  36273. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  36274. tip(
  36275. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  36276. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  36277. "Note that HTML attributes are case-insensitive and you cannot use " +
  36278. "v-on to listen to camelCase events when using in-DOM templates. " +
  36279. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  36280. );
  36281. }
  36282. }
  36283. var cbs = vm._events[event];
  36284. if (cbs) {
  36285. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  36286. var args = toArray(arguments, 1);
  36287. var info = "event handler for \"" + event + "\"";
  36288. for (var i = 0, l = cbs.length; i < l; i++) {
  36289. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  36290. }
  36291. }
  36292. return vm
  36293. };
  36294. }
  36295. /* */
  36296. var activeInstance = null;
  36297. var isUpdatingChildComponent = false;
  36298. function setActiveInstance(vm) {
  36299. var prevActiveInstance = activeInstance;
  36300. activeInstance = vm;
  36301. return function () {
  36302. activeInstance = prevActiveInstance;
  36303. }
  36304. }
  36305. function initLifecycle (vm) {
  36306. var options = vm.$options;
  36307. // locate first non-abstract parent
  36308. var parent = options.parent;
  36309. if (parent && !options.abstract) {
  36310. while (parent.$options.abstract && parent.$parent) {
  36311. parent = parent.$parent;
  36312. }
  36313. parent.$children.push(vm);
  36314. }
  36315. vm.$parent = parent;
  36316. vm.$root = parent ? parent.$root : vm;
  36317. vm.$children = [];
  36318. vm.$refs = {};
  36319. vm._watcher = null;
  36320. vm._inactive = null;
  36321. vm._directInactive = false;
  36322. vm._isMounted = false;
  36323. vm._isDestroyed = false;
  36324. vm._isBeingDestroyed = false;
  36325. }
  36326. function lifecycleMixin (Vue) {
  36327. Vue.prototype._update = function (vnode, hydrating) {
  36328. var vm = this;
  36329. var prevEl = vm.$el;
  36330. var prevVnode = vm._vnode;
  36331. var restoreActiveInstance = setActiveInstance(vm);
  36332. vm._vnode = vnode;
  36333. // Vue.prototype.__patch__ is injected in entry points
  36334. // based on the rendering backend used.
  36335. if (!prevVnode) {
  36336. // initial render
  36337. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  36338. } else {
  36339. // updates
  36340. vm.$el = vm.__patch__(prevVnode, vnode);
  36341. }
  36342. restoreActiveInstance();
  36343. // update __vue__ reference
  36344. if (prevEl) {
  36345. prevEl.__vue__ = null;
  36346. }
  36347. if (vm.$el) {
  36348. vm.$el.__vue__ = vm;
  36349. }
  36350. // if parent is an HOC, update its $el as well
  36351. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  36352. vm.$parent.$el = vm.$el;
  36353. }
  36354. // updated hook is called by the scheduler to ensure that children are
  36355. // updated in a parent's updated hook.
  36356. };
  36357. Vue.prototype.$forceUpdate = function () {
  36358. var vm = this;
  36359. if (vm._watcher) {
  36360. vm._watcher.update();
  36361. }
  36362. };
  36363. Vue.prototype.$destroy = function () {
  36364. var vm = this;
  36365. if (vm._isBeingDestroyed) {
  36366. return
  36367. }
  36368. callHook(vm, 'beforeDestroy');
  36369. vm._isBeingDestroyed = true;
  36370. // remove self from parent
  36371. var parent = vm.$parent;
  36372. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  36373. remove(parent.$children, vm);
  36374. }
  36375. // teardown watchers
  36376. if (vm._watcher) {
  36377. vm._watcher.teardown();
  36378. }
  36379. var i = vm._watchers.length;
  36380. while (i--) {
  36381. vm._watchers[i].teardown();
  36382. }
  36383. // remove reference from data ob
  36384. // frozen object may not have observer.
  36385. if (vm._data.__ob__) {
  36386. vm._data.__ob__.vmCount--;
  36387. }
  36388. // call the last hook...
  36389. vm._isDestroyed = true;
  36390. // invoke destroy hooks on current rendered tree
  36391. vm.__patch__(vm._vnode, null);
  36392. // fire destroyed hook
  36393. callHook(vm, 'destroyed');
  36394. // turn off all instance listeners.
  36395. vm.$off();
  36396. // remove __vue__ reference
  36397. if (vm.$el) {
  36398. vm.$el.__vue__ = null;
  36399. }
  36400. // release circular reference (#6759)
  36401. if (vm.$vnode) {
  36402. vm.$vnode.parent = null;
  36403. }
  36404. };
  36405. }
  36406. function mountComponent (
  36407. vm,
  36408. el,
  36409. hydrating
  36410. ) {
  36411. vm.$el = el;
  36412. if (!vm.$options.render) {
  36413. vm.$options.render = createEmptyVNode;
  36414. {
  36415. /* istanbul ignore if */
  36416. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  36417. vm.$options.el || el) {
  36418. warn(
  36419. 'You are using the runtime-only build of Vue where the template ' +
  36420. 'compiler is not available. Either pre-compile the templates into ' +
  36421. 'render functions, or use the compiler-included build.',
  36422. vm
  36423. );
  36424. } else {
  36425. warn(
  36426. 'Failed to mount component: template or render function not defined.',
  36427. vm
  36428. );
  36429. }
  36430. }
  36431. }
  36432. callHook(vm, 'beforeMount');
  36433. var updateComponent;
  36434. /* istanbul ignore if */
  36435. if (config.performance && mark) {
  36436. updateComponent = function () {
  36437. var name = vm._name;
  36438. var id = vm._uid;
  36439. var startTag = "vue-perf-start:" + id;
  36440. var endTag = "vue-perf-end:" + id;
  36441. mark(startTag);
  36442. var vnode = vm._render();
  36443. mark(endTag);
  36444. measure(("vue " + name + " render"), startTag, endTag);
  36445. mark(startTag);
  36446. vm._update(vnode, hydrating);
  36447. mark(endTag);
  36448. measure(("vue " + name + " patch"), startTag, endTag);
  36449. };
  36450. } else {
  36451. updateComponent = function () {
  36452. vm._update(vm._render(), hydrating);
  36453. };
  36454. }
  36455. // we set this to vm._watcher inside the watcher's constructor
  36456. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  36457. // component's mounted hook), which relies on vm._watcher being already defined
  36458. new Watcher(vm, updateComponent, noop, {
  36459. before: function before () {
  36460. if (vm._isMounted && !vm._isDestroyed) {
  36461. callHook(vm, 'beforeUpdate');
  36462. }
  36463. }
  36464. }, true /* isRenderWatcher */);
  36465. hydrating = false;
  36466. // manually mounted instance, call mounted on self
  36467. // mounted is called for render-created child components in its inserted hook
  36468. if (vm.$vnode == null) {
  36469. vm._isMounted = true;
  36470. callHook(vm, 'mounted');
  36471. }
  36472. return vm
  36473. }
  36474. function updateChildComponent (
  36475. vm,
  36476. propsData,
  36477. listeners,
  36478. parentVnode,
  36479. renderChildren
  36480. ) {
  36481. {
  36482. isUpdatingChildComponent = true;
  36483. }
  36484. // determine whether component has slot children
  36485. // we need to do this before overwriting $options._renderChildren.
  36486. // check if there are dynamic scopedSlots (hand-written or compiled but with
  36487. // dynamic slot names). Static scoped slots compiled from template has the
  36488. // "$stable" marker.
  36489. var newScopedSlots = parentVnode.data.scopedSlots;
  36490. var oldScopedSlots = vm.$scopedSlots;
  36491. var hasDynamicScopedSlot = !!(
  36492. (newScopedSlots && !newScopedSlots.$stable) ||
  36493. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  36494. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  36495. );
  36496. // Any static slot children from the parent may have changed during parent's
  36497. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  36498. // update is necessary to ensure correctness.
  36499. var needsForceUpdate = !!(
  36500. renderChildren || // has new static slots
  36501. vm.$options._renderChildren || // has old static slots
  36502. hasDynamicScopedSlot
  36503. );
  36504. vm.$options._parentVnode = parentVnode;
  36505. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  36506. if (vm._vnode) { // update child tree's parent
  36507. vm._vnode.parent = parentVnode;
  36508. }
  36509. vm.$options._renderChildren = renderChildren;
  36510. // update $attrs and $listeners hash
  36511. // these are also reactive so they may trigger child update if the child
  36512. // used them during render
  36513. vm.$attrs = parentVnode.data.attrs || emptyObject;
  36514. vm.$listeners = listeners || emptyObject;
  36515. // update props
  36516. if (propsData && vm.$options.props) {
  36517. toggleObserving(false);
  36518. var props = vm._props;
  36519. var propKeys = vm.$options._propKeys || [];
  36520. for (var i = 0; i < propKeys.length; i++) {
  36521. var key = propKeys[i];
  36522. var propOptions = vm.$options.props; // wtf flow?
  36523. props[key] = validateProp(key, propOptions, propsData, vm);
  36524. }
  36525. toggleObserving(true);
  36526. // keep a copy of raw propsData
  36527. vm.$options.propsData = propsData;
  36528. }
  36529. // update listeners
  36530. listeners = listeners || emptyObject;
  36531. var oldListeners = vm.$options._parentListeners;
  36532. vm.$options._parentListeners = listeners;
  36533. updateComponentListeners(vm, listeners, oldListeners);
  36534. // resolve slots + force update if has children
  36535. if (needsForceUpdate) {
  36536. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  36537. vm.$forceUpdate();
  36538. }
  36539. {
  36540. isUpdatingChildComponent = false;
  36541. }
  36542. }
  36543. function isInInactiveTree (vm) {
  36544. while (vm && (vm = vm.$parent)) {
  36545. if (vm._inactive) { return true }
  36546. }
  36547. return false
  36548. }
  36549. function activateChildComponent (vm, direct) {
  36550. if (direct) {
  36551. vm._directInactive = false;
  36552. if (isInInactiveTree(vm)) {
  36553. return
  36554. }
  36555. } else if (vm._directInactive) {
  36556. return
  36557. }
  36558. if (vm._inactive || vm._inactive === null) {
  36559. vm._inactive = false;
  36560. for (var i = 0; i < vm.$children.length; i++) {
  36561. activateChildComponent(vm.$children[i]);
  36562. }
  36563. callHook(vm, 'activated');
  36564. }
  36565. }
  36566. function deactivateChildComponent (vm, direct) {
  36567. if (direct) {
  36568. vm._directInactive = true;
  36569. if (isInInactiveTree(vm)) {
  36570. return
  36571. }
  36572. }
  36573. if (!vm._inactive) {
  36574. vm._inactive = true;
  36575. for (var i = 0; i < vm.$children.length; i++) {
  36576. deactivateChildComponent(vm.$children[i]);
  36577. }
  36578. callHook(vm, 'deactivated');
  36579. }
  36580. }
  36581. function callHook (vm, hook) {
  36582. // #7573 disable dep collection when invoking lifecycle hooks
  36583. pushTarget();
  36584. var handlers = vm.$options[hook];
  36585. var info = hook + " hook";
  36586. if (handlers) {
  36587. for (var i = 0, j = handlers.length; i < j; i++) {
  36588. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36589. }
  36590. }
  36591. if (vm._hasHookEvent) {
  36592. vm.$emit('hook:' + hook);
  36593. }
  36594. popTarget();
  36595. }
  36596. /* */
  36597. var MAX_UPDATE_COUNT = 100;
  36598. var queue = [];
  36599. var activatedChildren = [];
  36600. var has = {};
  36601. var circular = {};
  36602. var waiting = false;
  36603. var flushing = false;
  36604. var index = 0;
  36605. /**
  36606. * Reset the scheduler's state.
  36607. */
  36608. function resetSchedulerState () {
  36609. index = queue.length = activatedChildren.length = 0;
  36610. has = {};
  36611. {
  36612. circular = {};
  36613. }
  36614. waiting = flushing = false;
  36615. }
  36616. // Async edge case #6566 requires saving the timestamp when event listeners are
  36617. // attached. However, calling performance.now() has a perf overhead especially
  36618. // if the page has thousands of event listeners. Instead, we take a timestamp
  36619. // every time the scheduler flushes and use that for all event listeners
  36620. // attached during that flush.
  36621. var currentFlushTimestamp = 0;
  36622. // Async edge case fix requires storing an event listener's attach timestamp.
  36623. var getNow = Date.now;
  36624. // Determine what event timestamp the browser is using. Annoyingly, the
  36625. // timestamp can either be hi-res (relative to page load) or low-res
  36626. // (relative to UNIX epoch), so in order to compare time we have to use the
  36627. // same timestamp type when saving the flush timestamp.
  36628. // All IE versions use low-res event timestamps, and have problematic clock
  36629. // implementations (#9632)
  36630. if (inBrowser && !isIE) {
  36631. var performance = window.performance;
  36632. if (
  36633. performance &&
  36634. typeof performance.now === 'function' &&
  36635. getNow() > document.createEvent('Event').timeStamp
  36636. ) {
  36637. // if the event timestamp, although evaluated AFTER the Date.now(), is
  36638. // smaller than it, it means the event is using a hi-res timestamp,
  36639. // and we need to use the hi-res version for event listener timestamps as
  36640. // well.
  36641. getNow = function () { return performance.now(); };
  36642. }
  36643. }
  36644. /**
  36645. * Flush both queues and run the watchers.
  36646. */
  36647. function flushSchedulerQueue () {
  36648. currentFlushTimestamp = getNow();
  36649. flushing = true;
  36650. var watcher, id;
  36651. // Sort queue before flush.
  36652. // This ensures that:
  36653. // 1. Components are updated from parent to child. (because parent is always
  36654. // created before the child)
  36655. // 2. A component's user watchers are run before its render watcher (because
  36656. // user watchers are created before the render watcher)
  36657. // 3. If a component is destroyed during a parent component's watcher run,
  36658. // its watchers can be skipped.
  36659. queue.sort(function (a, b) { return a.id - b.id; });
  36660. // do not cache length because more watchers might be pushed
  36661. // as we run existing watchers
  36662. for (index = 0; index < queue.length; index++) {
  36663. watcher = queue[index];
  36664. if (watcher.before) {
  36665. watcher.before();
  36666. }
  36667. id = watcher.id;
  36668. has[id] = null;
  36669. watcher.run();
  36670. // in dev build, check and stop circular updates.
  36671. if (has[id] != null) {
  36672. circular[id] = (circular[id] || 0) + 1;
  36673. if (circular[id] > MAX_UPDATE_COUNT) {
  36674. warn(
  36675. 'You may have an infinite update loop ' + (
  36676. watcher.user
  36677. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36678. : "in a component render function."
  36679. ),
  36680. watcher.vm
  36681. );
  36682. break
  36683. }
  36684. }
  36685. }
  36686. // keep copies of post queues before resetting state
  36687. var activatedQueue = activatedChildren.slice();
  36688. var updatedQueue = queue.slice();
  36689. resetSchedulerState();
  36690. // call component updated and activated hooks
  36691. callActivatedHooks(activatedQueue);
  36692. callUpdatedHooks(updatedQueue);
  36693. // devtool hook
  36694. /* istanbul ignore if */
  36695. if (devtools && config.devtools) {
  36696. devtools.emit('flush');
  36697. }
  36698. }
  36699. function callUpdatedHooks (queue) {
  36700. var i = queue.length;
  36701. while (i--) {
  36702. var watcher = queue[i];
  36703. var vm = watcher.vm;
  36704. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36705. callHook(vm, 'updated');
  36706. }
  36707. }
  36708. }
  36709. /**
  36710. * Queue a kept-alive component that was activated during patch.
  36711. * The queue will be processed after the entire tree has been patched.
  36712. */
  36713. function queueActivatedComponent (vm) {
  36714. // setting _inactive to false here so that a render function can
  36715. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36716. vm._inactive = false;
  36717. activatedChildren.push(vm);
  36718. }
  36719. function callActivatedHooks (queue) {
  36720. for (var i = 0; i < queue.length; i++) {
  36721. queue[i]._inactive = true;
  36722. activateChildComponent(queue[i], true /* true */);
  36723. }
  36724. }
  36725. /**
  36726. * Push a watcher into the watcher queue.
  36727. * Jobs with duplicate IDs will be skipped unless it's
  36728. * pushed when the queue is being flushed.
  36729. */
  36730. function queueWatcher (watcher) {
  36731. var id = watcher.id;
  36732. if (has[id] == null) {
  36733. has[id] = true;
  36734. if (!flushing) {
  36735. queue.push(watcher);
  36736. } else {
  36737. // if already flushing, splice the watcher based on its id
  36738. // if already past its id, it will be run next immediately.
  36739. var i = queue.length - 1;
  36740. while (i > index && queue[i].id > watcher.id) {
  36741. i--;
  36742. }
  36743. queue.splice(i + 1, 0, watcher);
  36744. }
  36745. // queue the flush
  36746. if (!waiting) {
  36747. waiting = true;
  36748. if (!config.async) {
  36749. flushSchedulerQueue();
  36750. return
  36751. }
  36752. nextTick(flushSchedulerQueue);
  36753. }
  36754. }
  36755. }
  36756. /* */
  36757. var uid$2 = 0;
  36758. /**
  36759. * A watcher parses an expression, collects dependencies,
  36760. * and fires callback when the expression value changes.
  36761. * This is used for both the $watch() api and directives.
  36762. */
  36763. var Watcher = function Watcher (
  36764. vm,
  36765. expOrFn,
  36766. cb,
  36767. options,
  36768. isRenderWatcher
  36769. ) {
  36770. this.vm = vm;
  36771. if (isRenderWatcher) {
  36772. vm._watcher = this;
  36773. }
  36774. vm._watchers.push(this);
  36775. // options
  36776. if (options) {
  36777. this.deep = !!options.deep;
  36778. this.user = !!options.user;
  36779. this.lazy = !!options.lazy;
  36780. this.sync = !!options.sync;
  36781. this.before = options.before;
  36782. } else {
  36783. this.deep = this.user = this.lazy = this.sync = false;
  36784. }
  36785. this.cb = cb;
  36786. this.id = ++uid$2; // uid for batching
  36787. this.active = true;
  36788. this.dirty = this.lazy; // for lazy watchers
  36789. this.deps = [];
  36790. this.newDeps = [];
  36791. this.depIds = new _Set();
  36792. this.newDepIds = new _Set();
  36793. this.expression = expOrFn.toString();
  36794. // parse expression for getter
  36795. if (typeof expOrFn === 'function') {
  36796. this.getter = expOrFn;
  36797. } else {
  36798. this.getter = parsePath(expOrFn);
  36799. if (!this.getter) {
  36800. this.getter = noop;
  36801. warn(
  36802. "Failed watching path: \"" + expOrFn + "\" " +
  36803. 'Watcher only accepts simple dot-delimited paths. ' +
  36804. 'For full control, use a function instead.',
  36805. vm
  36806. );
  36807. }
  36808. }
  36809. this.value = this.lazy
  36810. ? undefined
  36811. : this.get();
  36812. };
  36813. /**
  36814. * Evaluate the getter, and re-collect dependencies.
  36815. */
  36816. Watcher.prototype.get = function get () {
  36817. pushTarget(this);
  36818. var value;
  36819. var vm = this.vm;
  36820. try {
  36821. value = this.getter.call(vm, vm);
  36822. } catch (e) {
  36823. if (this.user) {
  36824. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  36825. } else {
  36826. throw e
  36827. }
  36828. } finally {
  36829. // "touch" every property so they are all tracked as
  36830. // dependencies for deep watching
  36831. if (this.deep) {
  36832. traverse(value);
  36833. }
  36834. popTarget();
  36835. this.cleanupDeps();
  36836. }
  36837. return value
  36838. };
  36839. /**
  36840. * Add a dependency to this directive.
  36841. */
  36842. Watcher.prototype.addDep = function addDep (dep) {
  36843. var id = dep.id;
  36844. if (!this.newDepIds.has(id)) {
  36845. this.newDepIds.add(id);
  36846. this.newDeps.push(dep);
  36847. if (!this.depIds.has(id)) {
  36848. dep.addSub(this);
  36849. }
  36850. }
  36851. };
  36852. /**
  36853. * Clean up for dependency collection.
  36854. */
  36855. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  36856. var i = this.deps.length;
  36857. while (i--) {
  36858. var dep = this.deps[i];
  36859. if (!this.newDepIds.has(dep.id)) {
  36860. dep.removeSub(this);
  36861. }
  36862. }
  36863. var tmp = this.depIds;
  36864. this.depIds = this.newDepIds;
  36865. this.newDepIds = tmp;
  36866. this.newDepIds.clear();
  36867. tmp = this.deps;
  36868. this.deps = this.newDeps;
  36869. this.newDeps = tmp;
  36870. this.newDeps.length = 0;
  36871. };
  36872. /**
  36873. * Subscriber interface.
  36874. * Will be called when a dependency changes.
  36875. */
  36876. Watcher.prototype.update = function update () {
  36877. /* istanbul ignore else */
  36878. if (this.lazy) {
  36879. this.dirty = true;
  36880. } else if (this.sync) {
  36881. this.run();
  36882. } else {
  36883. queueWatcher(this);
  36884. }
  36885. };
  36886. /**
  36887. * Scheduler job interface.
  36888. * Will be called by the scheduler.
  36889. */
  36890. Watcher.prototype.run = function run () {
  36891. if (this.active) {
  36892. var value = this.get();
  36893. if (
  36894. value !== this.value ||
  36895. // Deep watchers and watchers on Object/Arrays should fire even
  36896. // when the value is the same, because the value may
  36897. // have mutated.
  36898. isObject(value) ||
  36899. this.deep
  36900. ) {
  36901. // set new value
  36902. var oldValue = this.value;
  36903. this.value = value;
  36904. if (this.user) {
  36905. try {
  36906. this.cb.call(this.vm, value, oldValue);
  36907. } catch (e) {
  36908. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  36909. }
  36910. } else {
  36911. this.cb.call(this.vm, value, oldValue);
  36912. }
  36913. }
  36914. }
  36915. };
  36916. /**
  36917. * Evaluate the value of the watcher.
  36918. * This only gets called for lazy watchers.
  36919. */
  36920. Watcher.prototype.evaluate = function evaluate () {
  36921. this.value = this.get();
  36922. this.dirty = false;
  36923. };
  36924. /**
  36925. * Depend on all deps collected by this watcher.
  36926. */
  36927. Watcher.prototype.depend = function depend () {
  36928. var i = this.deps.length;
  36929. while (i--) {
  36930. this.deps[i].depend();
  36931. }
  36932. };
  36933. /**
  36934. * Remove self from all dependencies' subscriber list.
  36935. */
  36936. Watcher.prototype.teardown = function teardown () {
  36937. if (this.active) {
  36938. // remove self from vm's watcher list
  36939. // this is a somewhat expensive operation so we skip it
  36940. // if the vm is being destroyed.
  36941. if (!this.vm._isBeingDestroyed) {
  36942. remove(this.vm._watchers, this);
  36943. }
  36944. var i = this.deps.length;
  36945. while (i--) {
  36946. this.deps[i].removeSub(this);
  36947. }
  36948. this.active = false;
  36949. }
  36950. };
  36951. /* */
  36952. var sharedPropertyDefinition = {
  36953. enumerable: true,
  36954. configurable: true,
  36955. get: noop,
  36956. set: noop
  36957. };
  36958. function proxy (target, sourceKey, key) {
  36959. sharedPropertyDefinition.get = function proxyGetter () {
  36960. return this[sourceKey][key]
  36961. };
  36962. sharedPropertyDefinition.set = function proxySetter (val) {
  36963. this[sourceKey][key] = val;
  36964. };
  36965. Object.defineProperty(target, key, sharedPropertyDefinition);
  36966. }
  36967. function initState (vm) {
  36968. vm._watchers = [];
  36969. var opts = vm.$options;
  36970. if (opts.props) { initProps(vm, opts.props); }
  36971. if (opts.methods) { initMethods(vm, opts.methods); }
  36972. if (opts.data) {
  36973. initData(vm);
  36974. } else {
  36975. observe(vm._data = {}, true /* asRootData */);
  36976. }
  36977. if (opts.computed) { initComputed(vm, opts.computed); }
  36978. if (opts.watch && opts.watch !== nativeWatch) {
  36979. initWatch(vm, opts.watch);
  36980. }
  36981. }
  36982. function initProps (vm, propsOptions) {
  36983. var propsData = vm.$options.propsData || {};
  36984. var props = vm._props = {};
  36985. // cache prop keys so that future props updates can iterate using Array
  36986. // instead of dynamic object key enumeration.
  36987. var keys = vm.$options._propKeys = [];
  36988. var isRoot = !vm.$parent;
  36989. // root instance props should be converted
  36990. if (!isRoot) {
  36991. toggleObserving(false);
  36992. }
  36993. var loop = function ( key ) {
  36994. keys.push(key);
  36995. var value = validateProp(key, propsOptions, propsData, vm);
  36996. /* istanbul ignore else */
  36997. {
  36998. var hyphenatedKey = hyphenate(key);
  36999. if (isReservedAttribute(hyphenatedKey) ||
  37000. config.isReservedAttr(hyphenatedKey)) {
  37001. warn(
  37002. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  37003. vm
  37004. );
  37005. }
  37006. defineReactive$$1(props, key, value, function () {
  37007. if (!isRoot && !isUpdatingChildComponent) {
  37008. warn(
  37009. "Avoid mutating a prop directly since the value will be " +
  37010. "overwritten whenever the parent component re-renders. " +
  37011. "Instead, use a data or computed property based on the prop's " +
  37012. "value. Prop being mutated: \"" + key + "\"",
  37013. vm
  37014. );
  37015. }
  37016. });
  37017. }
  37018. // static props are already proxied on the component's prototype
  37019. // during Vue.extend(). We only need to proxy props defined at
  37020. // instantiation here.
  37021. if (!(key in vm)) {
  37022. proxy(vm, "_props", key);
  37023. }
  37024. };
  37025. for (var key in propsOptions) loop( key );
  37026. toggleObserving(true);
  37027. }
  37028. function initData (vm) {
  37029. var data = vm.$options.data;
  37030. data = vm._data = typeof data === 'function'
  37031. ? getData(data, vm)
  37032. : data || {};
  37033. if (!isPlainObject(data)) {
  37034. data = {};
  37035. warn(
  37036. 'data functions should return an object:\n' +
  37037. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  37038. vm
  37039. );
  37040. }
  37041. // proxy data on instance
  37042. var keys = Object.keys(data);
  37043. var props = vm.$options.props;
  37044. var methods = vm.$options.methods;
  37045. var i = keys.length;
  37046. while (i--) {
  37047. var key = keys[i];
  37048. {
  37049. if (methods && hasOwn(methods, key)) {
  37050. warn(
  37051. ("Method \"" + key + "\" has already been defined as a data property."),
  37052. vm
  37053. );
  37054. }
  37055. }
  37056. if (props && hasOwn(props, key)) {
  37057. warn(
  37058. "The data property \"" + key + "\" is already declared as a prop. " +
  37059. "Use prop default value instead.",
  37060. vm
  37061. );
  37062. } else if (!isReserved(key)) {
  37063. proxy(vm, "_data", key);
  37064. }
  37065. }
  37066. // observe data
  37067. observe(data, true /* asRootData */);
  37068. }
  37069. function getData (data, vm) {
  37070. // #7573 disable dep collection when invoking data getters
  37071. pushTarget();
  37072. try {
  37073. return data.call(vm, vm)
  37074. } catch (e) {
  37075. handleError(e, vm, "data()");
  37076. return {}
  37077. } finally {
  37078. popTarget();
  37079. }
  37080. }
  37081. var computedWatcherOptions = { lazy: true };
  37082. function initComputed (vm, computed) {
  37083. // $flow-disable-line
  37084. var watchers = vm._computedWatchers = Object.create(null);
  37085. // computed properties are just getters during SSR
  37086. var isSSR = isServerRendering();
  37087. for (var key in computed) {
  37088. var userDef = computed[key];
  37089. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  37090. if (getter == null) {
  37091. warn(
  37092. ("Getter is missing for computed property \"" + key + "\"."),
  37093. vm
  37094. );
  37095. }
  37096. if (!isSSR) {
  37097. // create internal watcher for the computed property.
  37098. watchers[key] = new Watcher(
  37099. vm,
  37100. getter || noop,
  37101. noop,
  37102. computedWatcherOptions
  37103. );
  37104. }
  37105. // component-defined computed properties are already defined on the
  37106. // component prototype. We only need to define computed properties defined
  37107. // at instantiation here.
  37108. if (!(key in vm)) {
  37109. defineComputed(vm, key, userDef);
  37110. } else {
  37111. if (key in vm.$data) {
  37112. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  37113. } else if (vm.$options.props && key in vm.$options.props) {
  37114. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  37115. }
  37116. }
  37117. }
  37118. }
  37119. function defineComputed (
  37120. target,
  37121. key,
  37122. userDef
  37123. ) {
  37124. var shouldCache = !isServerRendering();
  37125. if (typeof userDef === 'function') {
  37126. sharedPropertyDefinition.get = shouldCache
  37127. ? createComputedGetter(key)
  37128. : createGetterInvoker(userDef);
  37129. sharedPropertyDefinition.set = noop;
  37130. } else {
  37131. sharedPropertyDefinition.get = userDef.get
  37132. ? shouldCache && userDef.cache !== false
  37133. ? createComputedGetter(key)
  37134. : createGetterInvoker(userDef.get)
  37135. : noop;
  37136. sharedPropertyDefinition.set = userDef.set || noop;
  37137. }
  37138. if (sharedPropertyDefinition.set === noop) {
  37139. sharedPropertyDefinition.set = function () {
  37140. warn(
  37141. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  37142. this
  37143. );
  37144. };
  37145. }
  37146. Object.defineProperty(target, key, sharedPropertyDefinition);
  37147. }
  37148. function createComputedGetter (key) {
  37149. return function computedGetter () {
  37150. var watcher = this._computedWatchers && this._computedWatchers[key];
  37151. if (watcher) {
  37152. if (watcher.dirty) {
  37153. watcher.evaluate();
  37154. }
  37155. if (Dep.target) {
  37156. watcher.depend();
  37157. }
  37158. return watcher.value
  37159. }
  37160. }
  37161. }
  37162. function createGetterInvoker(fn) {
  37163. return function computedGetter () {
  37164. return fn.call(this, this)
  37165. }
  37166. }
  37167. function initMethods (vm, methods) {
  37168. var props = vm.$options.props;
  37169. for (var key in methods) {
  37170. {
  37171. if (typeof methods[key] !== 'function') {
  37172. warn(
  37173. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  37174. "Did you reference the function correctly?",
  37175. vm
  37176. );
  37177. }
  37178. if (props && hasOwn(props, key)) {
  37179. warn(
  37180. ("Method \"" + key + "\" has already been defined as a prop."),
  37181. vm
  37182. );
  37183. }
  37184. if ((key in vm) && isReserved(key)) {
  37185. warn(
  37186. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  37187. "Avoid defining component methods that start with _ or $."
  37188. );
  37189. }
  37190. }
  37191. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  37192. }
  37193. }
  37194. function initWatch (vm, watch) {
  37195. for (var key in watch) {
  37196. var handler = watch[key];
  37197. if (Array.isArray(handler)) {
  37198. for (var i = 0; i < handler.length; i++) {
  37199. createWatcher(vm, key, handler[i]);
  37200. }
  37201. } else {
  37202. createWatcher(vm, key, handler);
  37203. }
  37204. }
  37205. }
  37206. function createWatcher (
  37207. vm,
  37208. expOrFn,
  37209. handler,
  37210. options
  37211. ) {
  37212. if (isPlainObject(handler)) {
  37213. options = handler;
  37214. handler = handler.handler;
  37215. }
  37216. if (typeof handler === 'string') {
  37217. handler = vm[handler];
  37218. }
  37219. return vm.$watch(expOrFn, handler, options)
  37220. }
  37221. function stateMixin (Vue) {
  37222. // flow somehow has problems with directly declared definition object
  37223. // when using Object.defineProperty, so we have to procedurally build up
  37224. // the object here.
  37225. var dataDef = {};
  37226. dataDef.get = function () { return this._data };
  37227. var propsDef = {};
  37228. propsDef.get = function () { return this._props };
  37229. {
  37230. dataDef.set = function () {
  37231. warn(
  37232. 'Avoid replacing instance root $data. ' +
  37233. 'Use nested data properties instead.',
  37234. this
  37235. );
  37236. };
  37237. propsDef.set = function () {
  37238. warn("$props is readonly.", this);
  37239. };
  37240. }
  37241. Object.defineProperty(Vue.prototype, '$data', dataDef);
  37242. Object.defineProperty(Vue.prototype, '$props', propsDef);
  37243. Vue.prototype.$set = set;
  37244. Vue.prototype.$delete = del;
  37245. Vue.prototype.$watch = function (
  37246. expOrFn,
  37247. cb,
  37248. options
  37249. ) {
  37250. var vm = this;
  37251. if (isPlainObject(cb)) {
  37252. return createWatcher(vm, expOrFn, cb, options)
  37253. }
  37254. options = options || {};
  37255. options.user = true;
  37256. var watcher = new Watcher(vm, expOrFn, cb, options);
  37257. if (options.immediate) {
  37258. try {
  37259. cb.call(vm, watcher.value);
  37260. } catch (error) {
  37261. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  37262. }
  37263. }
  37264. return function unwatchFn () {
  37265. watcher.teardown();
  37266. }
  37267. };
  37268. }
  37269. /* */
  37270. var uid$3 = 0;
  37271. function initMixin (Vue) {
  37272. Vue.prototype._init = function (options) {
  37273. var vm = this;
  37274. // a uid
  37275. vm._uid = uid$3++;
  37276. var startTag, endTag;
  37277. /* istanbul ignore if */
  37278. if (config.performance && mark) {
  37279. startTag = "vue-perf-start:" + (vm._uid);
  37280. endTag = "vue-perf-end:" + (vm._uid);
  37281. mark(startTag);
  37282. }
  37283. // a flag to avoid this being observed
  37284. vm._isVue = true;
  37285. // merge options
  37286. if (options && options._isComponent) {
  37287. // optimize internal component instantiation
  37288. // since dynamic options merging is pretty slow, and none of the
  37289. // internal component options needs special treatment.
  37290. initInternalComponent(vm, options);
  37291. } else {
  37292. vm.$options = mergeOptions(
  37293. resolveConstructorOptions(vm.constructor),
  37294. options || {},
  37295. vm
  37296. );
  37297. }
  37298. /* istanbul ignore else */
  37299. {
  37300. initProxy(vm);
  37301. }
  37302. // expose real self
  37303. vm._self = vm;
  37304. initLifecycle(vm);
  37305. initEvents(vm);
  37306. initRender(vm);
  37307. callHook(vm, 'beforeCreate');
  37308. initInjections(vm); // resolve injections before data/props
  37309. initState(vm);
  37310. initProvide(vm); // resolve provide after data/props
  37311. callHook(vm, 'created');
  37312. /* istanbul ignore if */
  37313. if (config.performance && mark) {
  37314. vm._name = formatComponentName(vm, false);
  37315. mark(endTag);
  37316. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  37317. }
  37318. if (vm.$options.el) {
  37319. vm.$mount(vm.$options.el);
  37320. }
  37321. };
  37322. }
  37323. function initInternalComponent (vm, options) {
  37324. var opts = vm.$options = Object.create(vm.constructor.options);
  37325. // doing this because it's faster than dynamic enumeration.
  37326. var parentVnode = options._parentVnode;
  37327. opts.parent = options.parent;
  37328. opts._parentVnode = parentVnode;
  37329. var vnodeComponentOptions = parentVnode.componentOptions;
  37330. opts.propsData = vnodeComponentOptions.propsData;
  37331. opts._parentListeners = vnodeComponentOptions.listeners;
  37332. opts._renderChildren = vnodeComponentOptions.children;
  37333. opts._componentTag = vnodeComponentOptions.tag;
  37334. if (options.render) {
  37335. opts.render = options.render;
  37336. opts.staticRenderFns = options.staticRenderFns;
  37337. }
  37338. }
  37339. function resolveConstructorOptions (Ctor) {
  37340. var options = Ctor.options;
  37341. if (Ctor.super) {
  37342. var superOptions = resolveConstructorOptions(Ctor.super);
  37343. var cachedSuperOptions = Ctor.superOptions;
  37344. if (superOptions !== cachedSuperOptions) {
  37345. // super option changed,
  37346. // need to resolve new options.
  37347. Ctor.superOptions = superOptions;
  37348. // check if there are any late-modified/attached options (#4976)
  37349. var modifiedOptions = resolveModifiedOptions(Ctor);
  37350. // update base extend options
  37351. if (modifiedOptions) {
  37352. extend(Ctor.extendOptions, modifiedOptions);
  37353. }
  37354. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  37355. if (options.name) {
  37356. options.components[options.name] = Ctor;
  37357. }
  37358. }
  37359. }
  37360. return options
  37361. }
  37362. function resolveModifiedOptions (Ctor) {
  37363. var modified;
  37364. var latest = Ctor.options;
  37365. var sealed = Ctor.sealedOptions;
  37366. for (var key in latest) {
  37367. if (latest[key] !== sealed[key]) {
  37368. if (!modified) { modified = {}; }
  37369. modified[key] = latest[key];
  37370. }
  37371. }
  37372. return modified
  37373. }
  37374. function Vue (options) {
  37375. if (!(this instanceof Vue)
  37376. ) {
  37377. warn('Vue is a constructor and should be called with the `new` keyword');
  37378. }
  37379. this._init(options);
  37380. }
  37381. initMixin(Vue);
  37382. stateMixin(Vue);
  37383. eventsMixin(Vue);
  37384. lifecycleMixin(Vue);
  37385. renderMixin(Vue);
  37386. /* */
  37387. function initUse (Vue) {
  37388. Vue.use = function (plugin) {
  37389. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  37390. if (installedPlugins.indexOf(plugin) > -1) {
  37391. return this
  37392. }
  37393. // additional parameters
  37394. var args = toArray(arguments, 1);
  37395. args.unshift(this);
  37396. if (typeof plugin.install === 'function') {
  37397. plugin.install.apply(plugin, args);
  37398. } else if (typeof plugin === 'function') {
  37399. plugin.apply(null, args);
  37400. }
  37401. installedPlugins.push(plugin);
  37402. return this
  37403. };
  37404. }
  37405. /* */
  37406. function initMixin$1 (Vue) {
  37407. Vue.mixin = function (mixin) {
  37408. this.options = mergeOptions(this.options, mixin);
  37409. return this
  37410. };
  37411. }
  37412. /* */
  37413. function initExtend (Vue) {
  37414. /**
  37415. * Each instance constructor, including Vue, has a unique
  37416. * cid. This enables us to create wrapped "child
  37417. * constructors" for prototypal inheritance and cache them.
  37418. */
  37419. Vue.cid = 0;
  37420. var cid = 1;
  37421. /**
  37422. * Class inheritance
  37423. */
  37424. Vue.extend = function (extendOptions) {
  37425. extendOptions = extendOptions || {};
  37426. var Super = this;
  37427. var SuperId = Super.cid;
  37428. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  37429. if (cachedCtors[SuperId]) {
  37430. return cachedCtors[SuperId]
  37431. }
  37432. var name = extendOptions.name || Super.options.name;
  37433. if (name) {
  37434. validateComponentName(name);
  37435. }
  37436. var Sub = function VueComponent (options) {
  37437. this._init(options);
  37438. };
  37439. Sub.prototype = Object.create(Super.prototype);
  37440. Sub.prototype.constructor = Sub;
  37441. Sub.cid = cid++;
  37442. Sub.options = mergeOptions(
  37443. Super.options,
  37444. extendOptions
  37445. );
  37446. Sub['super'] = Super;
  37447. // For props and computed properties, we define the proxy getters on
  37448. // the Vue instances at extension time, on the extended prototype. This
  37449. // avoids Object.defineProperty calls for each instance created.
  37450. if (Sub.options.props) {
  37451. initProps$1(Sub);
  37452. }
  37453. if (Sub.options.computed) {
  37454. initComputed$1(Sub);
  37455. }
  37456. // allow further extension/mixin/plugin usage
  37457. Sub.extend = Super.extend;
  37458. Sub.mixin = Super.mixin;
  37459. Sub.use = Super.use;
  37460. // create asset registers, so extended classes
  37461. // can have their private assets too.
  37462. ASSET_TYPES.forEach(function (type) {
  37463. Sub[type] = Super[type];
  37464. });
  37465. // enable recursive self-lookup
  37466. if (name) {
  37467. Sub.options.components[name] = Sub;
  37468. }
  37469. // keep a reference to the super options at extension time.
  37470. // later at instantiation we can check if Super's options have
  37471. // been updated.
  37472. Sub.superOptions = Super.options;
  37473. Sub.extendOptions = extendOptions;
  37474. Sub.sealedOptions = extend({}, Sub.options);
  37475. // cache constructor
  37476. cachedCtors[SuperId] = Sub;
  37477. return Sub
  37478. };
  37479. }
  37480. function initProps$1 (Comp) {
  37481. var props = Comp.options.props;
  37482. for (var key in props) {
  37483. proxy(Comp.prototype, "_props", key);
  37484. }
  37485. }
  37486. function initComputed$1 (Comp) {
  37487. var computed = Comp.options.computed;
  37488. for (var key in computed) {
  37489. defineComputed(Comp.prototype, key, computed[key]);
  37490. }
  37491. }
  37492. /* */
  37493. function initAssetRegisters (Vue) {
  37494. /**
  37495. * Create asset registration methods.
  37496. */
  37497. ASSET_TYPES.forEach(function (type) {
  37498. Vue[type] = function (
  37499. id,
  37500. definition
  37501. ) {
  37502. if (!definition) {
  37503. return this.options[type + 's'][id]
  37504. } else {
  37505. /* istanbul ignore if */
  37506. if (type === 'component') {
  37507. validateComponentName(id);
  37508. }
  37509. if (type === 'component' && isPlainObject(definition)) {
  37510. definition.name = definition.name || id;
  37511. definition = this.options._base.extend(definition);
  37512. }
  37513. if (type === 'directive' && typeof definition === 'function') {
  37514. definition = { bind: definition, update: definition };
  37515. }
  37516. this.options[type + 's'][id] = definition;
  37517. return definition
  37518. }
  37519. };
  37520. });
  37521. }
  37522. /* */
  37523. function getComponentName (opts) {
  37524. return opts && (opts.Ctor.options.name || opts.tag)
  37525. }
  37526. function matches (pattern, name) {
  37527. if (Array.isArray(pattern)) {
  37528. return pattern.indexOf(name) > -1
  37529. } else if (typeof pattern === 'string') {
  37530. return pattern.split(',').indexOf(name) > -1
  37531. } else if (isRegExp(pattern)) {
  37532. return pattern.test(name)
  37533. }
  37534. /* istanbul ignore next */
  37535. return false
  37536. }
  37537. function pruneCache (keepAliveInstance, filter) {
  37538. var cache = keepAliveInstance.cache;
  37539. var keys = keepAliveInstance.keys;
  37540. var _vnode = keepAliveInstance._vnode;
  37541. for (var key in cache) {
  37542. var cachedNode = cache[key];
  37543. if (cachedNode) {
  37544. var name = getComponentName(cachedNode.componentOptions);
  37545. if (name && !filter(name)) {
  37546. pruneCacheEntry(cache, key, keys, _vnode);
  37547. }
  37548. }
  37549. }
  37550. }
  37551. function pruneCacheEntry (
  37552. cache,
  37553. key,
  37554. keys,
  37555. current
  37556. ) {
  37557. var cached$$1 = cache[key];
  37558. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37559. cached$$1.componentInstance.$destroy();
  37560. }
  37561. cache[key] = null;
  37562. remove(keys, key);
  37563. }
  37564. var patternTypes = [String, RegExp, Array];
  37565. var KeepAlive = {
  37566. name: 'keep-alive',
  37567. abstract: true,
  37568. props: {
  37569. include: patternTypes,
  37570. exclude: patternTypes,
  37571. max: [String, Number]
  37572. },
  37573. created: function created () {
  37574. this.cache = Object.create(null);
  37575. this.keys = [];
  37576. },
  37577. destroyed: function destroyed () {
  37578. for (var key in this.cache) {
  37579. pruneCacheEntry(this.cache, key, this.keys);
  37580. }
  37581. },
  37582. mounted: function mounted () {
  37583. var this$1 = this;
  37584. this.$watch('include', function (val) {
  37585. pruneCache(this$1, function (name) { return matches(val, name); });
  37586. });
  37587. this.$watch('exclude', function (val) {
  37588. pruneCache(this$1, function (name) { return !matches(val, name); });
  37589. });
  37590. },
  37591. render: function render () {
  37592. var slot = this.$slots.default;
  37593. var vnode = getFirstComponentChild(slot);
  37594. var componentOptions = vnode && vnode.componentOptions;
  37595. if (componentOptions) {
  37596. // check pattern
  37597. var name = getComponentName(componentOptions);
  37598. var ref = this;
  37599. var include = ref.include;
  37600. var exclude = ref.exclude;
  37601. if (
  37602. // not included
  37603. (include && (!name || !matches(include, name))) ||
  37604. // excluded
  37605. (exclude && name && matches(exclude, name))
  37606. ) {
  37607. return vnode
  37608. }
  37609. var ref$1 = this;
  37610. var cache = ref$1.cache;
  37611. var keys = ref$1.keys;
  37612. var key = vnode.key == null
  37613. // same constructor may get registered as different local components
  37614. // so cid alone is not enough (#3269)
  37615. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37616. : vnode.key;
  37617. if (cache[key]) {
  37618. vnode.componentInstance = cache[key].componentInstance;
  37619. // make current key freshest
  37620. remove(keys, key);
  37621. keys.push(key);
  37622. } else {
  37623. cache[key] = vnode;
  37624. keys.push(key);
  37625. // prune oldest entry
  37626. if (this.max && keys.length > parseInt(this.max)) {
  37627. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37628. }
  37629. }
  37630. vnode.data.keepAlive = true;
  37631. }
  37632. return vnode || (slot && slot[0])
  37633. }
  37634. };
  37635. var builtInComponents = {
  37636. KeepAlive: KeepAlive
  37637. };
  37638. /* */
  37639. function initGlobalAPI (Vue) {
  37640. // config
  37641. var configDef = {};
  37642. configDef.get = function () { return config; };
  37643. {
  37644. configDef.set = function () {
  37645. warn(
  37646. 'Do not replace the Vue.config object, set individual fields instead.'
  37647. );
  37648. };
  37649. }
  37650. Object.defineProperty(Vue, 'config', configDef);
  37651. // exposed util methods.
  37652. // NOTE: these are not considered part of the public API - avoid relying on
  37653. // them unless you are aware of the risk.
  37654. Vue.util = {
  37655. warn: warn,
  37656. extend: extend,
  37657. mergeOptions: mergeOptions,
  37658. defineReactive: defineReactive$$1
  37659. };
  37660. Vue.set = set;
  37661. Vue.delete = del;
  37662. Vue.nextTick = nextTick;
  37663. // 2.6 explicit observable API
  37664. Vue.observable = function (obj) {
  37665. observe(obj);
  37666. return obj
  37667. };
  37668. Vue.options = Object.create(null);
  37669. ASSET_TYPES.forEach(function (type) {
  37670. Vue.options[type + 's'] = Object.create(null);
  37671. });
  37672. // this is used to identify the "base" constructor to extend all plain-object
  37673. // components with in Weex's multi-instance scenarios.
  37674. Vue.options._base = Vue;
  37675. extend(Vue.options.components, builtInComponents);
  37676. initUse(Vue);
  37677. initMixin$1(Vue);
  37678. initExtend(Vue);
  37679. initAssetRegisters(Vue);
  37680. }
  37681. initGlobalAPI(Vue);
  37682. Object.defineProperty(Vue.prototype, '$isServer', {
  37683. get: isServerRendering
  37684. });
  37685. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37686. get: function get () {
  37687. /* istanbul ignore next */
  37688. return this.$vnode && this.$vnode.ssrContext
  37689. }
  37690. });
  37691. // expose FunctionalRenderContext for ssr runtime helper installation
  37692. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37693. value: FunctionalRenderContext
  37694. });
  37695. Vue.version = '2.6.10';
  37696. /* */
  37697. // these are reserved for web because they are directly compiled away
  37698. // during template compilation
  37699. var isReservedAttr = makeMap('style,class');
  37700. // attributes that should be using props for binding
  37701. var acceptValue = makeMap('input,textarea,option,select,progress');
  37702. var mustUseProp = function (tag, type, attr) {
  37703. return (
  37704. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37705. (attr === 'selected' && tag === 'option') ||
  37706. (attr === 'checked' && tag === 'input') ||
  37707. (attr === 'muted' && tag === 'video')
  37708. )
  37709. };
  37710. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37711. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37712. var convertEnumeratedValue = function (key, value) {
  37713. return isFalsyAttrValue(value) || value === 'false'
  37714. ? 'false'
  37715. // allow arbitrary string value for contenteditable
  37716. : key === 'contenteditable' && isValidContentEditableValue(value)
  37717. ? value
  37718. : 'true'
  37719. };
  37720. var isBooleanAttr = makeMap(
  37721. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37722. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37723. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37724. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37725. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37726. 'truespeed,typemustmatch,visible'
  37727. );
  37728. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37729. var isXlink = function (name) {
  37730. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37731. };
  37732. var getXlinkProp = function (name) {
  37733. return isXlink(name) ? name.slice(6, name.length) : ''
  37734. };
  37735. var isFalsyAttrValue = function (val) {
  37736. return val == null || val === false
  37737. };
  37738. /* */
  37739. function genClassForVnode (vnode) {
  37740. var data = vnode.data;
  37741. var parentNode = vnode;
  37742. var childNode = vnode;
  37743. while (isDef(childNode.componentInstance)) {
  37744. childNode = childNode.componentInstance._vnode;
  37745. if (childNode && childNode.data) {
  37746. data = mergeClassData(childNode.data, data);
  37747. }
  37748. }
  37749. while (isDef(parentNode = parentNode.parent)) {
  37750. if (parentNode && parentNode.data) {
  37751. data = mergeClassData(data, parentNode.data);
  37752. }
  37753. }
  37754. return renderClass(data.staticClass, data.class)
  37755. }
  37756. function mergeClassData (child, parent) {
  37757. return {
  37758. staticClass: concat(child.staticClass, parent.staticClass),
  37759. class: isDef(child.class)
  37760. ? [child.class, parent.class]
  37761. : parent.class
  37762. }
  37763. }
  37764. function renderClass (
  37765. staticClass,
  37766. dynamicClass
  37767. ) {
  37768. if (isDef(staticClass) || isDef(dynamicClass)) {
  37769. return concat(staticClass, stringifyClass(dynamicClass))
  37770. }
  37771. /* istanbul ignore next */
  37772. return ''
  37773. }
  37774. function concat (a, b) {
  37775. return a ? b ? (a + ' ' + b) : a : (b || '')
  37776. }
  37777. function stringifyClass (value) {
  37778. if (Array.isArray(value)) {
  37779. return stringifyArray(value)
  37780. }
  37781. if (isObject(value)) {
  37782. return stringifyObject(value)
  37783. }
  37784. if (typeof value === 'string') {
  37785. return value
  37786. }
  37787. /* istanbul ignore next */
  37788. return ''
  37789. }
  37790. function stringifyArray (value) {
  37791. var res = '';
  37792. var stringified;
  37793. for (var i = 0, l = value.length; i < l; i++) {
  37794. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37795. if (res) { res += ' '; }
  37796. res += stringified;
  37797. }
  37798. }
  37799. return res
  37800. }
  37801. function stringifyObject (value) {
  37802. var res = '';
  37803. for (var key in value) {
  37804. if (value[key]) {
  37805. if (res) { res += ' '; }
  37806. res += key;
  37807. }
  37808. }
  37809. return res
  37810. }
  37811. /* */
  37812. var namespaceMap = {
  37813. svg: 'http://www.w3.org/2000/svg',
  37814. math: 'http://www.w3.org/1998/Math/MathML'
  37815. };
  37816. var isHTMLTag = makeMap(
  37817. 'html,body,base,head,link,meta,style,title,' +
  37818. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37819. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37820. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37821. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37822. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37823. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37824. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  37825. 'output,progress,select,textarea,' +
  37826. 'details,dialog,menu,menuitem,summary,' +
  37827. 'content,element,shadow,template,blockquote,iframe,tfoot'
  37828. );
  37829. // this map is intentionally selective, only covering SVG elements that may
  37830. // contain child elements.
  37831. var isSVG = makeMap(
  37832. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  37833. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  37834. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  37835. true
  37836. );
  37837. var isPreTag = function (tag) { return tag === 'pre'; };
  37838. var isReservedTag = function (tag) {
  37839. return isHTMLTag(tag) || isSVG(tag)
  37840. };
  37841. function getTagNamespace (tag) {
  37842. if (isSVG(tag)) {
  37843. return 'svg'
  37844. }
  37845. // basic support for MathML
  37846. // note it doesn't support other MathML elements being component roots
  37847. if (tag === 'math') {
  37848. return 'math'
  37849. }
  37850. }
  37851. var unknownElementCache = Object.create(null);
  37852. function isUnknownElement (tag) {
  37853. /* istanbul ignore if */
  37854. if (!inBrowser) {
  37855. return true
  37856. }
  37857. if (isReservedTag(tag)) {
  37858. return false
  37859. }
  37860. tag = tag.toLowerCase();
  37861. /* istanbul ignore if */
  37862. if (unknownElementCache[tag] != null) {
  37863. return unknownElementCache[tag]
  37864. }
  37865. var el = document.createElement(tag);
  37866. if (tag.indexOf('-') > -1) {
  37867. // http://stackoverflow.com/a/28210364/1070244
  37868. return (unknownElementCache[tag] = (
  37869. el.constructor === window.HTMLUnknownElement ||
  37870. el.constructor === window.HTMLElement
  37871. ))
  37872. } else {
  37873. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  37874. }
  37875. }
  37876. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  37877. /* */
  37878. /**
  37879. * Query an element selector if it's not an element already.
  37880. */
  37881. function query (el) {
  37882. if (typeof el === 'string') {
  37883. var selected = document.querySelector(el);
  37884. if (!selected) {
  37885. warn(
  37886. 'Cannot find element: ' + el
  37887. );
  37888. return document.createElement('div')
  37889. }
  37890. return selected
  37891. } else {
  37892. return el
  37893. }
  37894. }
  37895. /* */
  37896. function createElement$1 (tagName, vnode) {
  37897. var elm = document.createElement(tagName);
  37898. if (tagName !== 'select') {
  37899. return elm
  37900. }
  37901. // false or null will remove the attribute but undefined will not
  37902. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  37903. elm.setAttribute('multiple', 'multiple');
  37904. }
  37905. return elm
  37906. }
  37907. function createElementNS (namespace, tagName) {
  37908. return document.createElementNS(namespaceMap[namespace], tagName)
  37909. }
  37910. function createTextNode (text) {
  37911. return document.createTextNode(text)
  37912. }
  37913. function createComment (text) {
  37914. return document.createComment(text)
  37915. }
  37916. function insertBefore (parentNode, newNode, referenceNode) {
  37917. parentNode.insertBefore(newNode, referenceNode);
  37918. }
  37919. function removeChild (node, child) {
  37920. node.removeChild(child);
  37921. }
  37922. function appendChild (node, child) {
  37923. node.appendChild(child);
  37924. }
  37925. function parentNode (node) {
  37926. return node.parentNode
  37927. }
  37928. function nextSibling (node) {
  37929. return node.nextSibling
  37930. }
  37931. function tagName (node) {
  37932. return node.tagName
  37933. }
  37934. function setTextContent (node, text) {
  37935. node.textContent = text;
  37936. }
  37937. function setStyleScope (node, scopeId) {
  37938. node.setAttribute(scopeId, '');
  37939. }
  37940. var nodeOps = /*#__PURE__*/Object.freeze({
  37941. createElement: createElement$1,
  37942. createElementNS: createElementNS,
  37943. createTextNode: createTextNode,
  37944. createComment: createComment,
  37945. insertBefore: insertBefore,
  37946. removeChild: removeChild,
  37947. appendChild: appendChild,
  37948. parentNode: parentNode,
  37949. nextSibling: nextSibling,
  37950. tagName: tagName,
  37951. setTextContent: setTextContent,
  37952. setStyleScope: setStyleScope
  37953. });
  37954. /* */
  37955. var ref = {
  37956. create: function create (_, vnode) {
  37957. registerRef(vnode);
  37958. },
  37959. update: function update (oldVnode, vnode) {
  37960. if (oldVnode.data.ref !== vnode.data.ref) {
  37961. registerRef(oldVnode, true);
  37962. registerRef(vnode);
  37963. }
  37964. },
  37965. destroy: function destroy (vnode) {
  37966. registerRef(vnode, true);
  37967. }
  37968. };
  37969. function registerRef (vnode, isRemoval) {
  37970. var key = vnode.data.ref;
  37971. if (!isDef(key)) { return }
  37972. var vm = vnode.context;
  37973. var ref = vnode.componentInstance || vnode.elm;
  37974. var refs = vm.$refs;
  37975. if (isRemoval) {
  37976. if (Array.isArray(refs[key])) {
  37977. remove(refs[key], ref);
  37978. } else if (refs[key] === ref) {
  37979. refs[key] = undefined;
  37980. }
  37981. } else {
  37982. if (vnode.data.refInFor) {
  37983. if (!Array.isArray(refs[key])) {
  37984. refs[key] = [ref];
  37985. } else if (refs[key].indexOf(ref) < 0) {
  37986. // $flow-disable-line
  37987. refs[key].push(ref);
  37988. }
  37989. } else {
  37990. refs[key] = ref;
  37991. }
  37992. }
  37993. }
  37994. /**
  37995. * Virtual DOM patching algorithm based on Snabbdom by
  37996. * Simon Friis Vindum (@paldepind)
  37997. * Licensed under the MIT License
  37998. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  37999. *
  38000. * modified by Evan You (@yyx990803)
  38001. *
  38002. * Not type-checking this because this file is perf-critical and the cost
  38003. * of making flow understand it is not worth it.
  38004. */
  38005. var emptyNode = new VNode('', {}, []);
  38006. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  38007. function sameVnode (a, b) {
  38008. return (
  38009. a.key === b.key && (
  38010. (
  38011. a.tag === b.tag &&
  38012. a.isComment === b.isComment &&
  38013. isDef(a.data) === isDef(b.data) &&
  38014. sameInputType(a, b)
  38015. ) || (
  38016. isTrue(a.isAsyncPlaceholder) &&
  38017. a.asyncFactory === b.asyncFactory &&
  38018. isUndef(b.asyncFactory.error)
  38019. )
  38020. )
  38021. )
  38022. }
  38023. function sameInputType (a, b) {
  38024. if (a.tag !== 'input') { return true }
  38025. var i;
  38026. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  38027. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  38028. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  38029. }
  38030. function createKeyToOldIdx (children, beginIdx, endIdx) {
  38031. var i, key;
  38032. var map = {};
  38033. for (i = beginIdx; i <= endIdx; ++i) {
  38034. key = children[i].key;
  38035. if (isDef(key)) { map[key] = i; }
  38036. }
  38037. return map
  38038. }
  38039. function createPatchFunction (backend) {
  38040. var i, j;
  38041. var cbs = {};
  38042. var modules = backend.modules;
  38043. var nodeOps = backend.nodeOps;
  38044. for (i = 0; i < hooks.length; ++i) {
  38045. cbs[hooks[i]] = [];
  38046. for (j = 0; j < modules.length; ++j) {
  38047. if (isDef(modules[j][hooks[i]])) {
  38048. cbs[hooks[i]].push(modules[j][hooks[i]]);
  38049. }
  38050. }
  38051. }
  38052. function emptyNodeAt (elm) {
  38053. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  38054. }
  38055. function createRmCb (childElm, listeners) {
  38056. function remove$$1 () {
  38057. if (--remove$$1.listeners === 0) {
  38058. removeNode(childElm);
  38059. }
  38060. }
  38061. remove$$1.listeners = listeners;
  38062. return remove$$1
  38063. }
  38064. function removeNode (el) {
  38065. var parent = nodeOps.parentNode(el);
  38066. // element may have already been removed due to v-html / v-text
  38067. if (isDef(parent)) {
  38068. nodeOps.removeChild(parent, el);
  38069. }
  38070. }
  38071. function isUnknownElement$$1 (vnode, inVPre) {
  38072. return (
  38073. !inVPre &&
  38074. !vnode.ns &&
  38075. !(
  38076. config.ignoredElements.length &&
  38077. config.ignoredElements.some(function (ignore) {
  38078. return isRegExp(ignore)
  38079. ? ignore.test(vnode.tag)
  38080. : ignore === vnode.tag
  38081. })
  38082. ) &&
  38083. config.isUnknownElement(vnode.tag)
  38084. )
  38085. }
  38086. var creatingElmInVPre = 0;
  38087. function createElm (
  38088. vnode,
  38089. insertedVnodeQueue,
  38090. parentElm,
  38091. refElm,
  38092. nested,
  38093. ownerArray,
  38094. index
  38095. ) {
  38096. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38097. // This vnode was used in a previous render!
  38098. // now it's used as a new node, overwriting its elm would cause
  38099. // potential patch errors down the road when it's used as an insertion
  38100. // reference node. Instead, we clone the node on-demand before creating
  38101. // associated DOM element for it.
  38102. vnode = ownerArray[index] = cloneVNode(vnode);
  38103. }
  38104. vnode.isRootInsert = !nested; // for transition enter check
  38105. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  38106. return
  38107. }
  38108. var data = vnode.data;
  38109. var children = vnode.children;
  38110. var tag = vnode.tag;
  38111. if (isDef(tag)) {
  38112. {
  38113. if (data && data.pre) {
  38114. creatingElmInVPre++;
  38115. }
  38116. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  38117. warn(
  38118. 'Unknown custom element: <' + tag + '> - did you ' +
  38119. 'register the component correctly? For recursive components, ' +
  38120. 'make sure to provide the "name" option.',
  38121. vnode.context
  38122. );
  38123. }
  38124. }
  38125. vnode.elm = vnode.ns
  38126. ? nodeOps.createElementNS(vnode.ns, tag)
  38127. : nodeOps.createElement(tag, vnode);
  38128. setScope(vnode);
  38129. /* istanbul ignore if */
  38130. {
  38131. createChildren(vnode, children, insertedVnodeQueue);
  38132. if (isDef(data)) {
  38133. invokeCreateHooks(vnode, insertedVnodeQueue);
  38134. }
  38135. insert(parentElm, vnode.elm, refElm);
  38136. }
  38137. if (data && data.pre) {
  38138. creatingElmInVPre--;
  38139. }
  38140. } else if (isTrue(vnode.isComment)) {
  38141. vnode.elm = nodeOps.createComment(vnode.text);
  38142. insert(parentElm, vnode.elm, refElm);
  38143. } else {
  38144. vnode.elm = nodeOps.createTextNode(vnode.text);
  38145. insert(parentElm, vnode.elm, refElm);
  38146. }
  38147. }
  38148. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38149. var i = vnode.data;
  38150. if (isDef(i)) {
  38151. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  38152. if (isDef(i = i.hook) && isDef(i = i.init)) {
  38153. i(vnode, false /* hydrating */);
  38154. }
  38155. // after calling the init hook, if the vnode is a child component
  38156. // it should've created a child instance and mounted it. the child
  38157. // component also has set the placeholder vnode's elm.
  38158. // in that case we can just return the element and be done.
  38159. if (isDef(vnode.componentInstance)) {
  38160. initComponent(vnode, insertedVnodeQueue);
  38161. insert(parentElm, vnode.elm, refElm);
  38162. if (isTrue(isReactivated)) {
  38163. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  38164. }
  38165. return true
  38166. }
  38167. }
  38168. }
  38169. function initComponent (vnode, insertedVnodeQueue) {
  38170. if (isDef(vnode.data.pendingInsert)) {
  38171. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  38172. vnode.data.pendingInsert = null;
  38173. }
  38174. vnode.elm = vnode.componentInstance.$el;
  38175. if (isPatchable(vnode)) {
  38176. invokeCreateHooks(vnode, insertedVnodeQueue);
  38177. setScope(vnode);
  38178. } else {
  38179. // empty component root.
  38180. // skip all element-related modules except for ref (#3455)
  38181. registerRef(vnode);
  38182. // make sure to invoke the insert hook
  38183. insertedVnodeQueue.push(vnode);
  38184. }
  38185. }
  38186. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38187. var i;
  38188. // hack for #4339: a reactivated component with inner transition
  38189. // does not trigger because the inner node's created hooks are not called
  38190. // again. It's not ideal to involve module-specific logic in here but
  38191. // there doesn't seem to be a better way to do it.
  38192. var innerNode = vnode;
  38193. while (innerNode.componentInstance) {
  38194. innerNode = innerNode.componentInstance._vnode;
  38195. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  38196. for (i = 0; i < cbs.activate.length; ++i) {
  38197. cbs.activate[i](emptyNode, innerNode);
  38198. }
  38199. insertedVnodeQueue.push(innerNode);
  38200. break
  38201. }
  38202. }
  38203. // unlike a newly created component,
  38204. // a reactivated keep-alive component doesn't insert itself
  38205. insert(parentElm, vnode.elm, refElm);
  38206. }
  38207. function insert (parent, elm, ref$$1) {
  38208. if (isDef(parent)) {
  38209. if (isDef(ref$$1)) {
  38210. if (nodeOps.parentNode(ref$$1) === parent) {
  38211. nodeOps.insertBefore(parent, elm, ref$$1);
  38212. }
  38213. } else {
  38214. nodeOps.appendChild(parent, elm);
  38215. }
  38216. }
  38217. }
  38218. function createChildren (vnode, children, insertedVnodeQueue) {
  38219. if (Array.isArray(children)) {
  38220. {
  38221. checkDuplicateKeys(children);
  38222. }
  38223. for (var i = 0; i < children.length; ++i) {
  38224. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  38225. }
  38226. } else if (isPrimitive(vnode.text)) {
  38227. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  38228. }
  38229. }
  38230. function isPatchable (vnode) {
  38231. while (vnode.componentInstance) {
  38232. vnode = vnode.componentInstance._vnode;
  38233. }
  38234. return isDef(vnode.tag)
  38235. }
  38236. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  38237. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38238. cbs.create[i$1](emptyNode, vnode);
  38239. }
  38240. i = vnode.data.hook; // Reuse variable
  38241. if (isDef(i)) {
  38242. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  38243. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  38244. }
  38245. }
  38246. // set scope id attribute for scoped CSS.
  38247. // this is implemented as a special case to avoid the overhead
  38248. // of going through the normal attribute patching process.
  38249. function setScope (vnode) {
  38250. var i;
  38251. if (isDef(i = vnode.fnScopeId)) {
  38252. nodeOps.setStyleScope(vnode.elm, i);
  38253. } else {
  38254. var ancestor = vnode;
  38255. while (ancestor) {
  38256. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  38257. nodeOps.setStyleScope(vnode.elm, i);
  38258. }
  38259. ancestor = ancestor.parent;
  38260. }
  38261. }
  38262. // for slot content they should also get the scopeId from the host instance.
  38263. if (isDef(i = activeInstance) &&
  38264. i !== vnode.context &&
  38265. i !== vnode.fnContext &&
  38266. isDef(i = i.$options._scopeId)
  38267. ) {
  38268. nodeOps.setStyleScope(vnode.elm, i);
  38269. }
  38270. }
  38271. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  38272. for (; startIdx <= endIdx; ++startIdx) {
  38273. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  38274. }
  38275. }
  38276. function invokeDestroyHook (vnode) {
  38277. var i, j;
  38278. var data = vnode.data;
  38279. if (isDef(data)) {
  38280. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  38281. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  38282. }
  38283. if (isDef(i = vnode.children)) {
  38284. for (j = 0; j < vnode.children.length; ++j) {
  38285. invokeDestroyHook(vnode.children[j]);
  38286. }
  38287. }
  38288. }
  38289. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  38290. for (; startIdx <= endIdx; ++startIdx) {
  38291. var ch = vnodes[startIdx];
  38292. if (isDef(ch)) {
  38293. if (isDef(ch.tag)) {
  38294. removeAndInvokeRemoveHook(ch);
  38295. invokeDestroyHook(ch);
  38296. } else { // Text node
  38297. removeNode(ch.elm);
  38298. }
  38299. }
  38300. }
  38301. }
  38302. function removeAndInvokeRemoveHook (vnode, rm) {
  38303. if (isDef(rm) || isDef(vnode.data)) {
  38304. var i;
  38305. var listeners = cbs.remove.length + 1;
  38306. if (isDef(rm)) {
  38307. // we have a recursively passed down rm callback
  38308. // increase the listeners count
  38309. rm.listeners += listeners;
  38310. } else {
  38311. // directly removing
  38312. rm = createRmCb(vnode.elm, listeners);
  38313. }
  38314. // recursively invoke hooks on child component root node
  38315. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  38316. removeAndInvokeRemoveHook(i, rm);
  38317. }
  38318. for (i = 0; i < cbs.remove.length; ++i) {
  38319. cbs.remove[i](vnode, rm);
  38320. }
  38321. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  38322. i(vnode, rm);
  38323. } else {
  38324. rm();
  38325. }
  38326. } else {
  38327. removeNode(vnode.elm);
  38328. }
  38329. }
  38330. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  38331. var oldStartIdx = 0;
  38332. var newStartIdx = 0;
  38333. var oldEndIdx = oldCh.length - 1;
  38334. var oldStartVnode = oldCh[0];
  38335. var oldEndVnode = oldCh[oldEndIdx];
  38336. var newEndIdx = newCh.length - 1;
  38337. var newStartVnode = newCh[0];
  38338. var newEndVnode = newCh[newEndIdx];
  38339. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  38340. // removeOnly is a special flag used only by <transition-group>
  38341. // to ensure removed elements stay in correct relative positions
  38342. // during leaving transitions
  38343. var canMove = !removeOnly;
  38344. {
  38345. checkDuplicateKeys(newCh);
  38346. }
  38347. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  38348. if (isUndef(oldStartVnode)) {
  38349. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  38350. } else if (isUndef(oldEndVnode)) {
  38351. oldEndVnode = oldCh[--oldEndIdx];
  38352. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  38353. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38354. oldStartVnode = oldCh[++oldStartIdx];
  38355. newStartVnode = newCh[++newStartIdx];
  38356. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  38357. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38358. oldEndVnode = oldCh[--oldEndIdx];
  38359. newEndVnode = newCh[--newEndIdx];
  38360. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  38361. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38362. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  38363. oldStartVnode = oldCh[++oldStartIdx];
  38364. newEndVnode = newCh[--newEndIdx];
  38365. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  38366. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38367. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  38368. oldEndVnode = oldCh[--oldEndIdx];
  38369. newStartVnode = newCh[++newStartIdx];
  38370. } else {
  38371. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  38372. idxInOld = isDef(newStartVnode.key)
  38373. ? oldKeyToIdx[newStartVnode.key]
  38374. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  38375. if (isUndef(idxInOld)) { // New element
  38376. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38377. } else {
  38378. vnodeToMove = oldCh[idxInOld];
  38379. if (sameVnode(vnodeToMove, newStartVnode)) {
  38380. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38381. oldCh[idxInOld] = undefined;
  38382. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  38383. } else {
  38384. // same key but different element. treat as new element
  38385. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38386. }
  38387. }
  38388. newStartVnode = newCh[++newStartIdx];
  38389. }
  38390. }
  38391. if (oldStartIdx > oldEndIdx) {
  38392. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  38393. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  38394. } else if (newStartIdx > newEndIdx) {
  38395. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  38396. }
  38397. }
  38398. function checkDuplicateKeys (children) {
  38399. var seenKeys = {};
  38400. for (var i = 0; i < children.length; i++) {
  38401. var vnode = children[i];
  38402. var key = vnode.key;
  38403. if (isDef(key)) {
  38404. if (seenKeys[key]) {
  38405. warn(
  38406. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  38407. vnode.context
  38408. );
  38409. } else {
  38410. seenKeys[key] = true;
  38411. }
  38412. }
  38413. }
  38414. }
  38415. function findIdxInOld (node, oldCh, start, end) {
  38416. for (var i = start; i < end; i++) {
  38417. var c = oldCh[i];
  38418. if (isDef(c) && sameVnode(node, c)) { return i }
  38419. }
  38420. }
  38421. function patchVnode (
  38422. oldVnode,
  38423. vnode,
  38424. insertedVnodeQueue,
  38425. ownerArray,
  38426. index,
  38427. removeOnly
  38428. ) {
  38429. if (oldVnode === vnode) {
  38430. return
  38431. }
  38432. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38433. // clone reused vnode
  38434. vnode = ownerArray[index] = cloneVNode(vnode);
  38435. }
  38436. var elm = vnode.elm = oldVnode.elm;
  38437. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  38438. if (isDef(vnode.asyncFactory.resolved)) {
  38439. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  38440. } else {
  38441. vnode.isAsyncPlaceholder = true;
  38442. }
  38443. return
  38444. }
  38445. // reuse element for static trees.
  38446. // note we only do this if the vnode is cloned -
  38447. // if the new node is not cloned it means the render functions have been
  38448. // reset by the hot-reload-api and we need to do a proper re-render.
  38449. if (isTrue(vnode.isStatic) &&
  38450. isTrue(oldVnode.isStatic) &&
  38451. vnode.key === oldVnode.key &&
  38452. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  38453. ) {
  38454. vnode.componentInstance = oldVnode.componentInstance;
  38455. return
  38456. }
  38457. var i;
  38458. var data = vnode.data;
  38459. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  38460. i(oldVnode, vnode);
  38461. }
  38462. var oldCh = oldVnode.children;
  38463. var ch = vnode.children;
  38464. if (isDef(data) && isPatchable(vnode)) {
  38465. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  38466. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  38467. }
  38468. if (isUndef(vnode.text)) {
  38469. if (isDef(oldCh) && isDef(ch)) {
  38470. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  38471. } else if (isDef(ch)) {
  38472. {
  38473. checkDuplicateKeys(ch);
  38474. }
  38475. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  38476. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  38477. } else if (isDef(oldCh)) {
  38478. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  38479. } else if (isDef(oldVnode.text)) {
  38480. nodeOps.setTextContent(elm, '');
  38481. }
  38482. } else if (oldVnode.text !== vnode.text) {
  38483. nodeOps.setTextContent(elm, vnode.text);
  38484. }
  38485. if (isDef(data)) {
  38486. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  38487. }
  38488. }
  38489. function invokeInsertHook (vnode, queue, initial) {
  38490. // delay insert hooks for component root nodes, invoke them after the
  38491. // element is really inserted
  38492. if (isTrue(initial) && isDef(vnode.parent)) {
  38493. vnode.parent.data.pendingInsert = queue;
  38494. } else {
  38495. for (var i = 0; i < queue.length; ++i) {
  38496. queue[i].data.hook.insert(queue[i]);
  38497. }
  38498. }
  38499. }
  38500. var hydrationBailed = false;
  38501. // list of modules that can skip create hook during hydration because they
  38502. // are already rendered on the client or has no need for initialization
  38503. // Note: style is excluded because it relies on initial clone for future
  38504. // deep updates (#7063).
  38505. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  38506. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  38507. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  38508. var i;
  38509. var tag = vnode.tag;
  38510. var data = vnode.data;
  38511. var children = vnode.children;
  38512. inVPre = inVPre || (data && data.pre);
  38513. vnode.elm = elm;
  38514. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  38515. vnode.isAsyncPlaceholder = true;
  38516. return true
  38517. }
  38518. // assert node match
  38519. {
  38520. if (!assertNodeMatch(elm, vnode, inVPre)) {
  38521. return false
  38522. }
  38523. }
  38524. if (isDef(data)) {
  38525. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  38526. if (isDef(i = vnode.componentInstance)) {
  38527. // child component. it should have hydrated its own tree.
  38528. initComponent(vnode, insertedVnodeQueue);
  38529. return true
  38530. }
  38531. }
  38532. if (isDef(tag)) {
  38533. if (isDef(children)) {
  38534. // empty element, allow client to pick up and populate children
  38535. if (!elm.hasChildNodes()) {
  38536. createChildren(vnode, children, insertedVnodeQueue);
  38537. } else {
  38538. // v-html and domProps: innerHTML
  38539. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  38540. if (i !== elm.innerHTML) {
  38541. /* istanbul ignore if */
  38542. if (typeof console !== 'undefined' &&
  38543. !hydrationBailed
  38544. ) {
  38545. hydrationBailed = true;
  38546. console.warn('Parent: ', elm);
  38547. console.warn('server innerHTML: ', i);
  38548. console.warn('client innerHTML: ', elm.innerHTML);
  38549. }
  38550. return false
  38551. }
  38552. } else {
  38553. // iterate and compare children lists
  38554. var childrenMatch = true;
  38555. var childNode = elm.firstChild;
  38556. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38557. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38558. childrenMatch = false;
  38559. break
  38560. }
  38561. childNode = childNode.nextSibling;
  38562. }
  38563. // if childNode is not null, it means the actual childNodes list is
  38564. // longer than the virtual children list.
  38565. if (!childrenMatch || childNode) {
  38566. /* istanbul ignore if */
  38567. if (typeof console !== 'undefined' &&
  38568. !hydrationBailed
  38569. ) {
  38570. hydrationBailed = true;
  38571. console.warn('Parent: ', elm);
  38572. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38573. }
  38574. return false
  38575. }
  38576. }
  38577. }
  38578. }
  38579. if (isDef(data)) {
  38580. var fullInvoke = false;
  38581. for (var key in data) {
  38582. if (!isRenderedModule(key)) {
  38583. fullInvoke = true;
  38584. invokeCreateHooks(vnode, insertedVnodeQueue);
  38585. break
  38586. }
  38587. }
  38588. if (!fullInvoke && data['class']) {
  38589. // ensure collecting deps for deep class bindings for future updates
  38590. traverse(data['class']);
  38591. }
  38592. }
  38593. } else if (elm.data !== vnode.text) {
  38594. elm.data = vnode.text;
  38595. }
  38596. return true
  38597. }
  38598. function assertNodeMatch (node, vnode, inVPre) {
  38599. if (isDef(vnode.tag)) {
  38600. return vnode.tag.indexOf('vue-component') === 0 || (
  38601. !isUnknownElement$$1(vnode, inVPre) &&
  38602. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38603. )
  38604. } else {
  38605. return node.nodeType === (vnode.isComment ? 8 : 3)
  38606. }
  38607. }
  38608. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38609. if (isUndef(vnode)) {
  38610. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38611. return
  38612. }
  38613. var isInitialPatch = false;
  38614. var insertedVnodeQueue = [];
  38615. if (isUndef(oldVnode)) {
  38616. // empty mount (likely as component), create new root element
  38617. isInitialPatch = true;
  38618. createElm(vnode, insertedVnodeQueue);
  38619. } else {
  38620. var isRealElement = isDef(oldVnode.nodeType);
  38621. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38622. // patch existing root node
  38623. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38624. } else {
  38625. if (isRealElement) {
  38626. // mounting to a real element
  38627. // check if this is server-rendered content and if we can perform
  38628. // a successful hydration.
  38629. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38630. oldVnode.removeAttribute(SSR_ATTR);
  38631. hydrating = true;
  38632. }
  38633. if (isTrue(hydrating)) {
  38634. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38635. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38636. return oldVnode
  38637. } else {
  38638. warn(
  38639. 'The client-side rendered virtual DOM tree is not matching ' +
  38640. 'server-rendered content. This is likely caused by incorrect ' +
  38641. 'HTML markup, for example nesting block-level elements inside ' +
  38642. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38643. 'full client-side render.'
  38644. );
  38645. }
  38646. }
  38647. // either not server-rendered, or hydration failed.
  38648. // create an empty node and replace it
  38649. oldVnode = emptyNodeAt(oldVnode);
  38650. }
  38651. // replacing existing element
  38652. var oldElm = oldVnode.elm;
  38653. var parentElm = nodeOps.parentNode(oldElm);
  38654. // create new node
  38655. createElm(
  38656. vnode,
  38657. insertedVnodeQueue,
  38658. // extremely rare edge case: do not insert if old element is in a
  38659. // leaving transition. Only happens when combining transition +
  38660. // keep-alive + HOCs. (#4590)
  38661. oldElm._leaveCb ? null : parentElm,
  38662. nodeOps.nextSibling(oldElm)
  38663. );
  38664. // update parent placeholder node element, recursively
  38665. if (isDef(vnode.parent)) {
  38666. var ancestor = vnode.parent;
  38667. var patchable = isPatchable(vnode);
  38668. while (ancestor) {
  38669. for (var i = 0; i < cbs.destroy.length; ++i) {
  38670. cbs.destroy[i](ancestor);
  38671. }
  38672. ancestor.elm = vnode.elm;
  38673. if (patchable) {
  38674. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38675. cbs.create[i$1](emptyNode, ancestor);
  38676. }
  38677. // #6513
  38678. // invoke insert hooks that may have been merged by create hooks.
  38679. // e.g. for directives that uses the "inserted" hook.
  38680. var insert = ancestor.data.hook.insert;
  38681. if (insert.merged) {
  38682. // start at index 1 to avoid re-invoking component mounted hook
  38683. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38684. insert.fns[i$2]();
  38685. }
  38686. }
  38687. } else {
  38688. registerRef(ancestor);
  38689. }
  38690. ancestor = ancestor.parent;
  38691. }
  38692. }
  38693. // destroy old node
  38694. if (isDef(parentElm)) {
  38695. removeVnodes(parentElm, [oldVnode], 0, 0);
  38696. } else if (isDef(oldVnode.tag)) {
  38697. invokeDestroyHook(oldVnode);
  38698. }
  38699. }
  38700. }
  38701. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38702. return vnode.elm
  38703. }
  38704. }
  38705. /* */
  38706. var directives = {
  38707. create: updateDirectives,
  38708. update: updateDirectives,
  38709. destroy: function unbindDirectives (vnode) {
  38710. updateDirectives(vnode, emptyNode);
  38711. }
  38712. };
  38713. function updateDirectives (oldVnode, vnode) {
  38714. if (oldVnode.data.directives || vnode.data.directives) {
  38715. _update(oldVnode, vnode);
  38716. }
  38717. }
  38718. function _update (oldVnode, vnode) {
  38719. var isCreate = oldVnode === emptyNode;
  38720. var isDestroy = vnode === emptyNode;
  38721. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38722. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38723. var dirsWithInsert = [];
  38724. var dirsWithPostpatch = [];
  38725. var key, oldDir, dir;
  38726. for (key in newDirs) {
  38727. oldDir = oldDirs[key];
  38728. dir = newDirs[key];
  38729. if (!oldDir) {
  38730. // new directive, bind
  38731. callHook$1(dir, 'bind', vnode, oldVnode);
  38732. if (dir.def && dir.def.inserted) {
  38733. dirsWithInsert.push(dir);
  38734. }
  38735. } else {
  38736. // existing directive, update
  38737. dir.oldValue = oldDir.value;
  38738. dir.oldArg = oldDir.arg;
  38739. callHook$1(dir, 'update', vnode, oldVnode);
  38740. if (dir.def && dir.def.componentUpdated) {
  38741. dirsWithPostpatch.push(dir);
  38742. }
  38743. }
  38744. }
  38745. if (dirsWithInsert.length) {
  38746. var callInsert = function () {
  38747. for (var i = 0; i < dirsWithInsert.length; i++) {
  38748. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38749. }
  38750. };
  38751. if (isCreate) {
  38752. mergeVNodeHook(vnode, 'insert', callInsert);
  38753. } else {
  38754. callInsert();
  38755. }
  38756. }
  38757. if (dirsWithPostpatch.length) {
  38758. mergeVNodeHook(vnode, 'postpatch', function () {
  38759. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38760. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38761. }
  38762. });
  38763. }
  38764. if (!isCreate) {
  38765. for (key in oldDirs) {
  38766. if (!newDirs[key]) {
  38767. // no longer present, unbind
  38768. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38769. }
  38770. }
  38771. }
  38772. }
  38773. var emptyModifiers = Object.create(null);
  38774. function normalizeDirectives$1 (
  38775. dirs,
  38776. vm
  38777. ) {
  38778. var res = Object.create(null);
  38779. if (!dirs) {
  38780. // $flow-disable-line
  38781. return res
  38782. }
  38783. var i, dir;
  38784. for (i = 0; i < dirs.length; i++) {
  38785. dir = dirs[i];
  38786. if (!dir.modifiers) {
  38787. // $flow-disable-line
  38788. dir.modifiers = emptyModifiers;
  38789. }
  38790. res[getRawDirName(dir)] = dir;
  38791. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38792. }
  38793. // $flow-disable-line
  38794. return res
  38795. }
  38796. function getRawDirName (dir) {
  38797. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38798. }
  38799. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38800. var fn = dir.def && dir.def[hook];
  38801. if (fn) {
  38802. try {
  38803. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38804. } catch (e) {
  38805. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38806. }
  38807. }
  38808. }
  38809. var baseModules = [
  38810. ref,
  38811. directives
  38812. ];
  38813. /* */
  38814. function updateAttrs (oldVnode, vnode) {
  38815. var opts = vnode.componentOptions;
  38816. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38817. return
  38818. }
  38819. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38820. return
  38821. }
  38822. var key, cur, old;
  38823. var elm = vnode.elm;
  38824. var oldAttrs = oldVnode.data.attrs || {};
  38825. var attrs = vnode.data.attrs || {};
  38826. // clone observed objects, as the user probably wants to mutate it
  38827. if (isDef(attrs.__ob__)) {
  38828. attrs = vnode.data.attrs = extend({}, attrs);
  38829. }
  38830. for (key in attrs) {
  38831. cur = attrs[key];
  38832. old = oldAttrs[key];
  38833. if (old !== cur) {
  38834. setAttr(elm, key, cur);
  38835. }
  38836. }
  38837. // #4391: in IE9, setting type can reset value for input[type=radio]
  38838. // #6666: IE/Edge forces progress value down to 1 before setting a max
  38839. /* istanbul ignore if */
  38840. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  38841. setAttr(elm, 'value', attrs.value);
  38842. }
  38843. for (key in oldAttrs) {
  38844. if (isUndef(attrs[key])) {
  38845. if (isXlink(key)) {
  38846. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38847. } else if (!isEnumeratedAttr(key)) {
  38848. elm.removeAttribute(key);
  38849. }
  38850. }
  38851. }
  38852. }
  38853. function setAttr (el, key, value) {
  38854. if (el.tagName.indexOf('-') > -1) {
  38855. baseSetAttr(el, key, value);
  38856. } else if (isBooleanAttr(key)) {
  38857. // set attribute for blank value
  38858. // e.g. <option disabled>Select one</option>
  38859. if (isFalsyAttrValue(value)) {
  38860. el.removeAttribute(key);
  38861. } else {
  38862. // technically allowfullscreen is a boolean attribute for <iframe>,
  38863. // but Flash expects a value of "true" when used on <embed> tag
  38864. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  38865. ? 'true'
  38866. : key;
  38867. el.setAttribute(key, value);
  38868. }
  38869. } else if (isEnumeratedAttr(key)) {
  38870. el.setAttribute(key, convertEnumeratedValue(key, value));
  38871. } else if (isXlink(key)) {
  38872. if (isFalsyAttrValue(value)) {
  38873. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38874. } else {
  38875. el.setAttributeNS(xlinkNS, key, value);
  38876. }
  38877. } else {
  38878. baseSetAttr(el, key, value);
  38879. }
  38880. }
  38881. function baseSetAttr (el, key, value) {
  38882. if (isFalsyAttrValue(value)) {
  38883. el.removeAttribute(key);
  38884. } else {
  38885. // #7138: IE10 & 11 fires input event when setting placeholder on
  38886. // <textarea>... block the first input event and remove the blocker
  38887. // immediately.
  38888. /* istanbul ignore if */
  38889. if (
  38890. isIE && !isIE9 &&
  38891. el.tagName === 'TEXTAREA' &&
  38892. key === 'placeholder' && value !== '' && !el.__ieph
  38893. ) {
  38894. var blocker = function (e) {
  38895. e.stopImmediatePropagation();
  38896. el.removeEventListener('input', blocker);
  38897. };
  38898. el.addEventListener('input', blocker);
  38899. // $flow-disable-line
  38900. el.__ieph = true; /* IE placeholder patched */
  38901. }
  38902. el.setAttribute(key, value);
  38903. }
  38904. }
  38905. var attrs = {
  38906. create: updateAttrs,
  38907. update: updateAttrs
  38908. };
  38909. /* */
  38910. function updateClass (oldVnode, vnode) {
  38911. var el = vnode.elm;
  38912. var data = vnode.data;
  38913. var oldData = oldVnode.data;
  38914. if (
  38915. isUndef(data.staticClass) &&
  38916. isUndef(data.class) && (
  38917. isUndef(oldData) || (
  38918. isUndef(oldData.staticClass) &&
  38919. isUndef(oldData.class)
  38920. )
  38921. )
  38922. ) {
  38923. return
  38924. }
  38925. var cls = genClassForVnode(vnode);
  38926. // handle transition classes
  38927. var transitionClass = el._transitionClasses;
  38928. if (isDef(transitionClass)) {
  38929. cls = concat(cls, stringifyClass(transitionClass));
  38930. }
  38931. // set the class
  38932. if (cls !== el._prevClass) {
  38933. el.setAttribute('class', cls);
  38934. el._prevClass = cls;
  38935. }
  38936. }
  38937. var klass = {
  38938. create: updateClass,
  38939. update: updateClass
  38940. };
  38941. /* */
  38942. var validDivisionCharRE = /[\w).+\-_$\]]/;
  38943. function parseFilters (exp) {
  38944. var inSingle = false;
  38945. var inDouble = false;
  38946. var inTemplateString = false;
  38947. var inRegex = false;
  38948. var curly = 0;
  38949. var square = 0;
  38950. var paren = 0;
  38951. var lastFilterIndex = 0;
  38952. var c, prev, i, expression, filters;
  38953. for (i = 0; i < exp.length; i++) {
  38954. prev = c;
  38955. c = exp.charCodeAt(i);
  38956. if (inSingle) {
  38957. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  38958. } else if (inDouble) {
  38959. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  38960. } else if (inTemplateString) {
  38961. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  38962. } else if (inRegex) {
  38963. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  38964. } else if (
  38965. c === 0x7C && // pipe
  38966. exp.charCodeAt(i + 1) !== 0x7C &&
  38967. exp.charCodeAt(i - 1) !== 0x7C &&
  38968. !curly && !square && !paren
  38969. ) {
  38970. if (expression === undefined) {
  38971. // first filter, end of expression
  38972. lastFilterIndex = i + 1;
  38973. expression = exp.slice(0, i).trim();
  38974. } else {
  38975. pushFilter();
  38976. }
  38977. } else {
  38978. switch (c) {
  38979. case 0x22: inDouble = true; break // "
  38980. case 0x27: inSingle = true; break // '
  38981. case 0x60: inTemplateString = true; break // `
  38982. case 0x28: paren++; break // (
  38983. case 0x29: paren--; break // )
  38984. case 0x5B: square++; break // [
  38985. case 0x5D: square--; break // ]
  38986. case 0x7B: curly++; break // {
  38987. case 0x7D: curly--; break // }
  38988. }
  38989. if (c === 0x2f) { // /
  38990. var j = i - 1;
  38991. var p = (void 0);
  38992. // find first non-whitespace prev char
  38993. for (; j >= 0; j--) {
  38994. p = exp.charAt(j);
  38995. if (p !== ' ') { break }
  38996. }
  38997. if (!p || !validDivisionCharRE.test(p)) {
  38998. inRegex = true;
  38999. }
  39000. }
  39001. }
  39002. }
  39003. if (expression === undefined) {
  39004. expression = exp.slice(0, i).trim();
  39005. } else if (lastFilterIndex !== 0) {
  39006. pushFilter();
  39007. }
  39008. function pushFilter () {
  39009. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  39010. lastFilterIndex = i + 1;
  39011. }
  39012. if (filters) {
  39013. for (i = 0; i < filters.length; i++) {
  39014. expression = wrapFilter(expression, filters[i]);
  39015. }
  39016. }
  39017. return expression
  39018. }
  39019. function wrapFilter (exp, filter) {
  39020. var i = filter.indexOf('(');
  39021. if (i < 0) {
  39022. // _f: resolveFilter
  39023. return ("_f(\"" + filter + "\")(" + exp + ")")
  39024. } else {
  39025. var name = filter.slice(0, i);
  39026. var args = filter.slice(i + 1);
  39027. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  39028. }
  39029. }
  39030. /* */
  39031. /* eslint-disable no-unused-vars */
  39032. function baseWarn (msg, range) {
  39033. console.error(("[Vue compiler]: " + msg));
  39034. }
  39035. /* eslint-enable no-unused-vars */
  39036. function pluckModuleFunction (
  39037. modules,
  39038. key
  39039. ) {
  39040. return modules
  39041. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  39042. : []
  39043. }
  39044. function addProp (el, name, value, range, dynamic) {
  39045. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39046. el.plain = false;
  39047. }
  39048. function addAttr (el, name, value, range, dynamic) {
  39049. var attrs = dynamic
  39050. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  39051. : (el.attrs || (el.attrs = []));
  39052. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39053. el.plain = false;
  39054. }
  39055. // add a raw attr (use this in preTransforms)
  39056. function addRawAttr (el, name, value, range) {
  39057. el.attrsMap[name] = value;
  39058. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  39059. }
  39060. function addDirective (
  39061. el,
  39062. name,
  39063. rawName,
  39064. value,
  39065. arg,
  39066. isDynamicArg,
  39067. modifiers,
  39068. range
  39069. ) {
  39070. (el.directives || (el.directives = [])).push(rangeSetItem({
  39071. name: name,
  39072. rawName: rawName,
  39073. value: value,
  39074. arg: arg,
  39075. isDynamicArg: isDynamicArg,
  39076. modifiers: modifiers
  39077. }, range));
  39078. el.plain = false;
  39079. }
  39080. function prependModifierMarker (symbol, name, dynamic) {
  39081. return dynamic
  39082. ? ("_p(" + name + ",\"" + symbol + "\")")
  39083. : symbol + name // mark the event as captured
  39084. }
  39085. function addHandler (
  39086. el,
  39087. name,
  39088. value,
  39089. modifiers,
  39090. important,
  39091. warn,
  39092. range,
  39093. dynamic
  39094. ) {
  39095. modifiers = modifiers || emptyObject;
  39096. // warn prevent and passive modifier
  39097. /* istanbul ignore if */
  39098. if (
  39099. warn &&
  39100. modifiers.prevent && modifiers.passive
  39101. ) {
  39102. warn(
  39103. 'passive and prevent can\'t be used together. ' +
  39104. 'Passive handler can\'t prevent default event.',
  39105. range
  39106. );
  39107. }
  39108. // normalize click.right and click.middle since they don't actually fire
  39109. // this is technically browser-specific, but at least for now browsers are
  39110. // the only target envs that have right/middle clicks.
  39111. if (modifiers.right) {
  39112. if (dynamic) {
  39113. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  39114. } else if (name === 'click') {
  39115. name = 'contextmenu';
  39116. delete modifiers.right;
  39117. }
  39118. } else if (modifiers.middle) {
  39119. if (dynamic) {
  39120. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  39121. } else if (name === 'click') {
  39122. name = 'mouseup';
  39123. }
  39124. }
  39125. // check capture modifier
  39126. if (modifiers.capture) {
  39127. delete modifiers.capture;
  39128. name = prependModifierMarker('!', name, dynamic);
  39129. }
  39130. if (modifiers.once) {
  39131. delete modifiers.once;
  39132. name = prependModifierMarker('~', name, dynamic);
  39133. }
  39134. /* istanbul ignore if */
  39135. if (modifiers.passive) {
  39136. delete modifiers.passive;
  39137. name = prependModifierMarker('&', name, dynamic);
  39138. }
  39139. var events;
  39140. if (modifiers.native) {
  39141. delete modifiers.native;
  39142. events = el.nativeEvents || (el.nativeEvents = {});
  39143. } else {
  39144. events = el.events || (el.events = {});
  39145. }
  39146. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  39147. if (modifiers !== emptyObject) {
  39148. newHandler.modifiers = modifiers;
  39149. }
  39150. var handlers = events[name];
  39151. /* istanbul ignore if */
  39152. if (Array.isArray(handlers)) {
  39153. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  39154. } else if (handlers) {
  39155. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  39156. } else {
  39157. events[name] = newHandler;
  39158. }
  39159. el.plain = false;
  39160. }
  39161. function getRawBindingAttr (
  39162. el,
  39163. name
  39164. ) {
  39165. return el.rawAttrsMap[':' + name] ||
  39166. el.rawAttrsMap['v-bind:' + name] ||
  39167. el.rawAttrsMap[name]
  39168. }
  39169. function getBindingAttr (
  39170. el,
  39171. name,
  39172. getStatic
  39173. ) {
  39174. var dynamicValue =
  39175. getAndRemoveAttr(el, ':' + name) ||
  39176. getAndRemoveAttr(el, 'v-bind:' + name);
  39177. if (dynamicValue != null) {
  39178. return parseFilters(dynamicValue)
  39179. } else if (getStatic !== false) {
  39180. var staticValue = getAndRemoveAttr(el, name);
  39181. if (staticValue != null) {
  39182. return JSON.stringify(staticValue)
  39183. }
  39184. }
  39185. }
  39186. // note: this only removes the attr from the Array (attrsList) so that it
  39187. // doesn't get processed by processAttrs.
  39188. // By default it does NOT remove it from the map (attrsMap) because the map is
  39189. // needed during codegen.
  39190. function getAndRemoveAttr (
  39191. el,
  39192. name,
  39193. removeFromMap
  39194. ) {
  39195. var val;
  39196. if ((val = el.attrsMap[name]) != null) {
  39197. var list = el.attrsList;
  39198. for (var i = 0, l = list.length; i < l; i++) {
  39199. if (list[i].name === name) {
  39200. list.splice(i, 1);
  39201. break
  39202. }
  39203. }
  39204. }
  39205. if (removeFromMap) {
  39206. delete el.attrsMap[name];
  39207. }
  39208. return val
  39209. }
  39210. function getAndRemoveAttrByRegex (
  39211. el,
  39212. name
  39213. ) {
  39214. var list = el.attrsList;
  39215. for (var i = 0, l = list.length; i < l; i++) {
  39216. var attr = list[i];
  39217. if (name.test(attr.name)) {
  39218. list.splice(i, 1);
  39219. return attr
  39220. }
  39221. }
  39222. }
  39223. function rangeSetItem (
  39224. item,
  39225. range
  39226. ) {
  39227. if (range) {
  39228. if (range.start != null) {
  39229. item.start = range.start;
  39230. }
  39231. if (range.end != null) {
  39232. item.end = range.end;
  39233. }
  39234. }
  39235. return item
  39236. }
  39237. /* */
  39238. /**
  39239. * Cross-platform code generation for component v-model
  39240. */
  39241. function genComponentModel (
  39242. el,
  39243. value,
  39244. modifiers
  39245. ) {
  39246. var ref = modifiers || {};
  39247. var number = ref.number;
  39248. var trim = ref.trim;
  39249. var baseValueExpression = '$$v';
  39250. var valueExpression = baseValueExpression;
  39251. if (trim) {
  39252. valueExpression =
  39253. "(typeof " + baseValueExpression + " === 'string'" +
  39254. "? " + baseValueExpression + ".trim()" +
  39255. ": " + baseValueExpression + ")";
  39256. }
  39257. if (number) {
  39258. valueExpression = "_n(" + valueExpression + ")";
  39259. }
  39260. var assignment = genAssignmentCode(value, valueExpression);
  39261. el.model = {
  39262. value: ("(" + value + ")"),
  39263. expression: JSON.stringify(value),
  39264. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  39265. };
  39266. }
  39267. /**
  39268. * Cross-platform codegen helper for generating v-model value assignment code.
  39269. */
  39270. function genAssignmentCode (
  39271. value,
  39272. assignment
  39273. ) {
  39274. var res = parseModel(value);
  39275. if (res.key === null) {
  39276. return (value + "=" + assignment)
  39277. } else {
  39278. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  39279. }
  39280. }
  39281. /**
  39282. * Parse a v-model expression into a base path and a final key segment.
  39283. * Handles both dot-path and possible square brackets.
  39284. *
  39285. * Possible cases:
  39286. *
  39287. * - test
  39288. * - test[key]
  39289. * - test[test1[key]]
  39290. * - test["a"][key]
  39291. * - xxx.test[a[a].test1[key]]
  39292. * - test.xxx.a["asa"][test1[key]]
  39293. *
  39294. */
  39295. var len, str, chr, index$1, expressionPos, expressionEndPos;
  39296. function parseModel (val) {
  39297. // Fix https://github.com/vuejs/vue/pull/7730
  39298. // allow v-model="obj.val " (trailing whitespace)
  39299. val = val.trim();
  39300. len = val.length;
  39301. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  39302. index$1 = val.lastIndexOf('.');
  39303. if (index$1 > -1) {
  39304. return {
  39305. exp: val.slice(0, index$1),
  39306. key: '"' + val.slice(index$1 + 1) + '"'
  39307. }
  39308. } else {
  39309. return {
  39310. exp: val,
  39311. key: null
  39312. }
  39313. }
  39314. }
  39315. str = val;
  39316. index$1 = expressionPos = expressionEndPos = 0;
  39317. while (!eof()) {
  39318. chr = next();
  39319. /* istanbul ignore if */
  39320. if (isStringStart(chr)) {
  39321. parseString(chr);
  39322. } else if (chr === 0x5B) {
  39323. parseBracket(chr);
  39324. }
  39325. }
  39326. return {
  39327. exp: val.slice(0, expressionPos),
  39328. key: val.slice(expressionPos + 1, expressionEndPos)
  39329. }
  39330. }
  39331. function next () {
  39332. return str.charCodeAt(++index$1)
  39333. }
  39334. function eof () {
  39335. return index$1 >= len
  39336. }
  39337. function isStringStart (chr) {
  39338. return chr === 0x22 || chr === 0x27
  39339. }
  39340. function parseBracket (chr) {
  39341. var inBracket = 1;
  39342. expressionPos = index$1;
  39343. while (!eof()) {
  39344. chr = next();
  39345. if (isStringStart(chr)) {
  39346. parseString(chr);
  39347. continue
  39348. }
  39349. if (chr === 0x5B) { inBracket++; }
  39350. if (chr === 0x5D) { inBracket--; }
  39351. if (inBracket === 0) {
  39352. expressionEndPos = index$1;
  39353. break
  39354. }
  39355. }
  39356. }
  39357. function parseString (chr) {
  39358. var stringQuote = chr;
  39359. while (!eof()) {
  39360. chr = next();
  39361. if (chr === stringQuote) {
  39362. break
  39363. }
  39364. }
  39365. }
  39366. /* */
  39367. var warn$1;
  39368. // in some cases, the event used has to be determined at runtime
  39369. // so we used some reserved tokens during compile.
  39370. var RANGE_TOKEN = '__r';
  39371. var CHECKBOX_RADIO_TOKEN = '__c';
  39372. function model (
  39373. el,
  39374. dir,
  39375. _warn
  39376. ) {
  39377. warn$1 = _warn;
  39378. var value = dir.value;
  39379. var modifiers = dir.modifiers;
  39380. var tag = el.tag;
  39381. var type = el.attrsMap.type;
  39382. {
  39383. // inputs with type="file" are read only and setting the input's
  39384. // value will throw an error.
  39385. if (tag === 'input' && type === 'file') {
  39386. warn$1(
  39387. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  39388. "File inputs are read only. Use a v-on:change listener instead.",
  39389. el.rawAttrsMap['v-model']
  39390. );
  39391. }
  39392. }
  39393. if (el.component) {
  39394. genComponentModel(el, value, modifiers);
  39395. // component v-model doesn't need extra runtime
  39396. return false
  39397. } else if (tag === 'select') {
  39398. genSelect(el, value, modifiers);
  39399. } else if (tag === 'input' && type === 'checkbox') {
  39400. genCheckboxModel(el, value, modifiers);
  39401. } else if (tag === 'input' && type === 'radio') {
  39402. genRadioModel(el, value, modifiers);
  39403. } else if (tag === 'input' || tag === 'textarea') {
  39404. genDefaultModel(el, value, modifiers);
  39405. } else if (!config.isReservedTag(tag)) {
  39406. genComponentModel(el, value, modifiers);
  39407. // component v-model doesn't need extra runtime
  39408. return false
  39409. } else {
  39410. warn$1(
  39411. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  39412. "v-model is not supported on this element type. " +
  39413. 'If you are working with contenteditable, it\'s recommended to ' +
  39414. 'wrap a library dedicated for that purpose inside a custom component.',
  39415. el.rawAttrsMap['v-model']
  39416. );
  39417. }
  39418. // ensure runtime directive metadata
  39419. return true
  39420. }
  39421. function genCheckboxModel (
  39422. el,
  39423. value,
  39424. modifiers
  39425. ) {
  39426. var number = modifiers && modifiers.number;
  39427. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39428. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  39429. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  39430. addProp(el, 'checked',
  39431. "Array.isArray(" + value + ")" +
  39432. "?_i(" + value + "," + valueBinding + ")>-1" + (
  39433. trueValueBinding === 'true'
  39434. ? (":(" + value + ")")
  39435. : (":_q(" + value + "," + trueValueBinding + ")")
  39436. )
  39437. );
  39438. addHandler(el, 'change',
  39439. "var $$a=" + value + "," +
  39440. '$$el=$event.target,' +
  39441. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  39442. 'if(Array.isArray($$a)){' +
  39443. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  39444. '$$i=_i($$a,$$v);' +
  39445. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  39446. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  39447. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  39448. null, true
  39449. );
  39450. }
  39451. function genRadioModel (
  39452. el,
  39453. value,
  39454. modifiers
  39455. ) {
  39456. var number = modifiers && modifiers.number;
  39457. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39458. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  39459. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  39460. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  39461. }
  39462. function genSelect (
  39463. el,
  39464. value,
  39465. modifiers
  39466. ) {
  39467. var number = modifiers && modifiers.number;
  39468. var selectedVal = "Array.prototype.filter" +
  39469. ".call($event.target.options,function(o){return o.selected})" +
  39470. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  39471. "return " + (number ? '_n(val)' : 'val') + "})";
  39472. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  39473. var code = "var $$selectedVal = " + selectedVal + ";";
  39474. code = code + " " + (genAssignmentCode(value, assignment));
  39475. addHandler(el, 'change', code, null, true);
  39476. }
  39477. function genDefaultModel (
  39478. el,
  39479. value,
  39480. modifiers
  39481. ) {
  39482. var type = el.attrsMap.type;
  39483. // warn if v-bind:value conflicts with v-model
  39484. // except for inputs with v-bind:type
  39485. {
  39486. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  39487. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  39488. if (value$1 && !typeBinding) {
  39489. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  39490. warn$1(
  39491. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  39492. 'because the latter already expands to a value binding internally',
  39493. el.rawAttrsMap[binding]
  39494. );
  39495. }
  39496. }
  39497. var ref = modifiers || {};
  39498. var lazy = ref.lazy;
  39499. var number = ref.number;
  39500. var trim = ref.trim;
  39501. var needCompositionGuard = !lazy && type !== 'range';
  39502. var event = lazy
  39503. ? 'change'
  39504. : type === 'range'
  39505. ? RANGE_TOKEN
  39506. : 'input';
  39507. var valueExpression = '$event.target.value';
  39508. if (trim) {
  39509. valueExpression = "$event.target.value.trim()";
  39510. }
  39511. if (number) {
  39512. valueExpression = "_n(" + valueExpression + ")";
  39513. }
  39514. var code = genAssignmentCode(value, valueExpression);
  39515. if (needCompositionGuard) {
  39516. code = "if($event.target.composing)return;" + code;
  39517. }
  39518. addProp(el, 'value', ("(" + value + ")"));
  39519. addHandler(el, event, code, null, true);
  39520. if (trim || number) {
  39521. addHandler(el, 'blur', '$forceUpdate()');
  39522. }
  39523. }
  39524. /* */
  39525. // normalize v-model event tokens that can only be determined at runtime.
  39526. // it's important to place the event as the first in the array because
  39527. // the whole point is ensuring the v-model callback gets called before
  39528. // user-attached handlers.
  39529. function normalizeEvents (on) {
  39530. /* istanbul ignore if */
  39531. if (isDef(on[RANGE_TOKEN])) {
  39532. // IE input[type=range] only supports `change` event
  39533. var event = isIE ? 'change' : 'input';
  39534. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  39535. delete on[RANGE_TOKEN];
  39536. }
  39537. // This was originally intended to fix #4521 but no longer necessary
  39538. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  39539. /* istanbul ignore if */
  39540. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  39541. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  39542. delete on[CHECKBOX_RADIO_TOKEN];
  39543. }
  39544. }
  39545. var target$1;
  39546. function createOnceHandler$1 (event, handler, capture) {
  39547. var _target = target$1; // save current target element in closure
  39548. return function onceHandler () {
  39549. var res = handler.apply(null, arguments);
  39550. if (res !== null) {
  39551. remove$2(event, onceHandler, capture, _target);
  39552. }
  39553. }
  39554. }
  39555. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39556. // implementation and does not fire microtasks in between event propagation, so
  39557. // safe to exclude.
  39558. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39559. function add$1 (
  39560. name,
  39561. handler,
  39562. capture,
  39563. passive
  39564. ) {
  39565. // async edge case #6566: inner click event triggers patch, event handler
  39566. // attached to outer element during patch, and triggered again. This
  39567. // happens because browsers fire microtask ticks between event propagation.
  39568. // the solution is simple: we save the timestamp when a handler is attached,
  39569. // and the handler would only fire if the event passed to it was fired
  39570. // AFTER it was attached.
  39571. if (useMicrotaskFix) {
  39572. var attachedTimestamp = currentFlushTimestamp;
  39573. var original = handler;
  39574. handler = original._wrapper = function (e) {
  39575. if (
  39576. // no bubbling, should always fire.
  39577. // this is just a safety net in case event.timeStamp is unreliable in
  39578. // certain weird environments...
  39579. e.target === e.currentTarget ||
  39580. // event is fired after handler attachment
  39581. e.timeStamp >= attachedTimestamp ||
  39582. // bail for environments that have buggy event.timeStamp implementations
  39583. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  39584. // #9681 QtWebEngine event.timeStamp is negative value
  39585. e.timeStamp <= 0 ||
  39586. // #9448 bail if event is fired in another document in a multi-page
  39587. // electron/nw.js app, since event.timeStamp will be using a different
  39588. // starting reference
  39589. e.target.ownerDocument !== document
  39590. ) {
  39591. return original.apply(this, arguments)
  39592. }
  39593. };
  39594. }
  39595. target$1.addEventListener(
  39596. name,
  39597. handler,
  39598. supportsPassive
  39599. ? { capture: capture, passive: passive }
  39600. : capture
  39601. );
  39602. }
  39603. function remove$2 (
  39604. name,
  39605. handler,
  39606. capture,
  39607. _target
  39608. ) {
  39609. (_target || target$1).removeEventListener(
  39610. name,
  39611. handler._wrapper || handler,
  39612. capture
  39613. );
  39614. }
  39615. function updateDOMListeners (oldVnode, vnode) {
  39616. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39617. return
  39618. }
  39619. var on = vnode.data.on || {};
  39620. var oldOn = oldVnode.data.on || {};
  39621. target$1 = vnode.elm;
  39622. normalizeEvents(on);
  39623. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39624. target$1 = undefined;
  39625. }
  39626. var events = {
  39627. create: updateDOMListeners,
  39628. update: updateDOMListeners
  39629. };
  39630. /* */
  39631. var svgContainer;
  39632. function updateDOMProps (oldVnode, vnode) {
  39633. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39634. return
  39635. }
  39636. var key, cur;
  39637. var elm = vnode.elm;
  39638. var oldProps = oldVnode.data.domProps || {};
  39639. var props = vnode.data.domProps || {};
  39640. // clone observed objects, as the user probably wants to mutate it
  39641. if (isDef(props.__ob__)) {
  39642. props = vnode.data.domProps = extend({}, props);
  39643. }
  39644. for (key in oldProps) {
  39645. if (!(key in props)) {
  39646. elm[key] = '';
  39647. }
  39648. }
  39649. for (key in props) {
  39650. cur = props[key];
  39651. // ignore children if the node has textContent or innerHTML,
  39652. // as these will throw away existing DOM nodes and cause removal errors
  39653. // on subsequent patches (#3360)
  39654. if (key === 'textContent' || key === 'innerHTML') {
  39655. if (vnode.children) { vnode.children.length = 0; }
  39656. if (cur === oldProps[key]) { continue }
  39657. // #6601 work around Chrome version <= 55 bug where single textNode
  39658. // replaced by innerHTML/textContent retains its parentNode property
  39659. if (elm.childNodes.length === 1) {
  39660. elm.removeChild(elm.childNodes[0]);
  39661. }
  39662. }
  39663. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39664. // store value as _value as well since
  39665. // non-string values will be stringified
  39666. elm._value = cur;
  39667. // avoid resetting cursor position when value is the same
  39668. var strCur = isUndef(cur) ? '' : String(cur);
  39669. if (shouldUpdateValue(elm, strCur)) {
  39670. elm.value = strCur;
  39671. }
  39672. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39673. // IE doesn't support innerHTML for SVG elements
  39674. svgContainer = svgContainer || document.createElement('div');
  39675. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39676. var svg = svgContainer.firstChild;
  39677. while (elm.firstChild) {
  39678. elm.removeChild(elm.firstChild);
  39679. }
  39680. while (svg.firstChild) {
  39681. elm.appendChild(svg.firstChild);
  39682. }
  39683. } else if (
  39684. // skip the update if old and new VDOM state is the same.
  39685. // `value` is handled separately because the DOM value may be temporarily
  39686. // out of sync with VDOM state due to focus, composition and modifiers.
  39687. // This #4521 by skipping the unnecesarry `checked` update.
  39688. cur !== oldProps[key]
  39689. ) {
  39690. // some property updates can throw
  39691. // e.g. `value` on <progress> w/ non-finite value
  39692. try {
  39693. elm[key] = cur;
  39694. } catch (e) {}
  39695. }
  39696. }
  39697. }
  39698. // check platforms/web/util/attrs.js acceptValue
  39699. function shouldUpdateValue (elm, checkVal) {
  39700. return (!elm.composing && (
  39701. elm.tagName === 'OPTION' ||
  39702. isNotInFocusAndDirty(elm, checkVal) ||
  39703. isDirtyWithModifiers(elm, checkVal)
  39704. ))
  39705. }
  39706. function isNotInFocusAndDirty (elm, checkVal) {
  39707. // return true when textbox (.number and .trim) loses focus and its value is
  39708. // not equal to the updated value
  39709. var notInFocus = true;
  39710. // #6157
  39711. // work around IE bug when accessing document.activeElement in an iframe
  39712. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39713. return notInFocus && elm.value !== checkVal
  39714. }
  39715. function isDirtyWithModifiers (elm, newVal) {
  39716. var value = elm.value;
  39717. var modifiers = elm._vModifiers; // injected by v-model runtime
  39718. if (isDef(modifiers)) {
  39719. if (modifiers.number) {
  39720. return toNumber(value) !== toNumber(newVal)
  39721. }
  39722. if (modifiers.trim) {
  39723. return value.trim() !== newVal.trim()
  39724. }
  39725. }
  39726. return value !== newVal
  39727. }
  39728. var domProps = {
  39729. create: updateDOMProps,
  39730. update: updateDOMProps
  39731. };
  39732. /* */
  39733. var parseStyleText = cached(function (cssText) {
  39734. var res = {};
  39735. var listDelimiter = /;(?![^(]*\))/g;
  39736. var propertyDelimiter = /:(.+)/;
  39737. cssText.split(listDelimiter).forEach(function (item) {
  39738. if (item) {
  39739. var tmp = item.split(propertyDelimiter);
  39740. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39741. }
  39742. });
  39743. return res
  39744. });
  39745. // merge static and dynamic style data on the same vnode
  39746. function normalizeStyleData (data) {
  39747. var style = normalizeStyleBinding(data.style);
  39748. // static style is pre-processed into an object during compilation
  39749. // and is always a fresh object, so it's safe to merge into it
  39750. return data.staticStyle
  39751. ? extend(data.staticStyle, style)
  39752. : style
  39753. }
  39754. // normalize possible array / string values into Object
  39755. function normalizeStyleBinding (bindingStyle) {
  39756. if (Array.isArray(bindingStyle)) {
  39757. return toObject(bindingStyle)
  39758. }
  39759. if (typeof bindingStyle === 'string') {
  39760. return parseStyleText(bindingStyle)
  39761. }
  39762. return bindingStyle
  39763. }
  39764. /**
  39765. * parent component style should be after child's
  39766. * so that parent component's style could override it
  39767. */
  39768. function getStyle (vnode, checkChild) {
  39769. var res = {};
  39770. var styleData;
  39771. if (checkChild) {
  39772. var childNode = vnode;
  39773. while (childNode.componentInstance) {
  39774. childNode = childNode.componentInstance._vnode;
  39775. if (
  39776. childNode && childNode.data &&
  39777. (styleData = normalizeStyleData(childNode.data))
  39778. ) {
  39779. extend(res, styleData);
  39780. }
  39781. }
  39782. }
  39783. if ((styleData = normalizeStyleData(vnode.data))) {
  39784. extend(res, styleData);
  39785. }
  39786. var parentNode = vnode;
  39787. while ((parentNode = parentNode.parent)) {
  39788. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39789. extend(res, styleData);
  39790. }
  39791. }
  39792. return res
  39793. }
  39794. /* */
  39795. var cssVarRE = /^--/;
  39796. var importantRE = /\s*!important$/;
  39797. var setProp = function (el, name, val) {
  39798. /* istanbul ignore if */
  39799. if (cssVarRE.test(name)) {
  39800. el.style.setProperty(name, val);
  39801. } else if (importantRE.test(val)) {
  39802. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39803. } else {
  39804. var normalizedName = normalize(name);
  39805. if (Array.isArray(val)) {
  39806. // Support values array created by autoprefixer, e.g.
  39807. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39808. // Set them one by one, and the browser will only set those it can recognize
  39809. for (var i = 0, len = val.length; i < len; i++) {
  39810. el.style[normalizedName] = val[i];
  39811. }
  39812. } else {
  39813. el.style[normalizedName] = val;
  39814. }
  39815. }
  39816. };
  39817. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39818. var emptyStyle;
  39819. var normalize = cached(function (prop) {
  39820. emptyStyle = emptyStyle || document.createElement('div').style;
  39821. prop = camelize(prop);
  39822. if (prop !== 'filter' && (prop in emptyStyle)) {
  39823. return prop
  39824. }
  39825. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  39826. for (var i = 0; i < vendorNames.length; i++) {
  39827. var name = vendorNames[i] + capName;
  39828. if (name in emptyStyle) {
  39829. return name
  39830. }
  39831. }
  39832. });
  39833. function updateStyle (oldVnode, vnode) {
  39834. var data = vnode.data;
  39835. var oldData = oldVnode.data;
  39836. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  39837. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  39838. ) {
  39839. return
  39840. }
  39841. var cur, name;
  39842. var el = vnode.elm;
  39843. var oldStaticStyle = oldData.staticStyle;
  39844. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  39845. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  39846. var oldStyle = oldStaticStyle || oldStyleBinding;
  39847. var style = normalizeStyleBinding(vnode.data.style) || {};
  39848. // store normalized style under a different key for next diff
  39849. // make sure to clone it if it's reactive, since the user likely wants
  39850. // to mutate it.
  39851. vnode.data.normalizedStyle = isDef(style.__ob__)
  39852. ? extend({}, style)
  39853. : style;
  39854. var newStyle = getStyle(vnode, true);
  39855. for (name in oldStyle) {
  39856. if (isUndef(newStyle[name])) {
  39857. setProp(el, name, '');
  39858. }
  39859. }
  39860. for (name in newStyle) {
  39861. cur = newStyle[name];
  39862. if (cur !== oldStyle[name]) {
  39863. // ie9 setting to null has no effect, must use empty string
  39864. setProp(el, name, cur == null ? '' : cur);
  39865. }
  39866. }
  39867. }
  39868. var style = {
  39869. create: updateStyle,
  39870. update: updateStyle
  39871. };
  39872. /* */
  39873. var whitespaceRE = /\s+/;
  39874. /**
  39875. * Add class with compatibility for SVG since classList is not supported on
  39876. * SVG elements in IE
  39877. */
  39878. function addClass (el, cls) {
  39879. /* istanbul ignore if */
  39880. if (!cls || !(cls = cls.trim())) {
  39881. return
  39882. }
  39883. /* istanbul ignore else */
  39884. if (el.classList) {
  39885. if (cls.indexOf(' ') > -1) {
  39886. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  39887. } else {
  39888. el.classList.add(cls);
  39889. }
  39890. } else {
  39891. var cur = " " + (el.getAttribute('class') || '') + " ";
  39892. if (cur.indexOf(' ' + cls + ' ') < 0) {
  39893. el.setAttribute('class', (cur + cls).trim());
  39894. }
  39895. }
  39896. }
  39897. /**
  39898. * Remove class with compatibility for SVG since classList is not supported on
  39899. * SVG elements in IE
  39900. */
  39901. function removeClass (el, cls) {
  39902. /* istanbul ignore if */
  39903. if (!cls || !(cls = cls.trim())) {
  39904. return
  39905. }
  39906. /* istanbul ignore else */
  39907. if (el.classList) {
  39908. if (cls.indexOf(' ') > -1) {
  39909. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  39910. } else {
  39911. el.classList.remove(cls);
  39912. }
  39913. if (!el.classList.length) {
  39914. el.removeAttribute('class');
  39915. }
  39916. } else {
  39917. var cur = " " + (el.getAttribute('class') || '') + " ";
  39918. var tar = ' ' + cls + ' ';
  39919. while (cur.indexOf(tar) >= 0) {
  39920. cur = cur.replace(tar, ' ');
  39921. }
  39922. cur = cur.trim();
  39923. if (cur) {
  39924. el.setAttribute('class', cur);
  39925. } else {
  39926. el.removeAttribute('class');
  39927. }
  39928. }
  39929. }
  39930. /* */
  39931. function resolveTransition (def$$1) {
  39932. if (!def$$1) {
  39933. return
  39934. }
  39935. /* istanbul ignore else */
  39936. if (typeof def$$1 === 'object') {
  39937. var res = {};
  39938. if (def$$1.css !== false) {
  39939. extend(res, autoCssTransition(def$$1.name || 'v'));
  39940. }
  39941. extend(res, def$$1);
  39942. return res
  39943. } else if (typeof def$$1 === 'string') {
  39944. return autoCssTransition(def$$1)
  39945. }
  39946. }
  39947. var autoCssTransition = cached(function (name) {
  39948. return {
  39949. enterClass: (name + "-enter"),
  39950. enterToClass: (name + "-enter-to"),
  39951. enterActiveClass: (name + "-enter-active"),
  39952. leaveClass: (name + "-leave"),
  39953. leaveToClass: (name + "-leave-to"),
  39954. leaveActiveClass: (name + "-leave-active")
  39955. }
  39956. });
  39957. var hasTransition = inBrowser && !isIE9;
  39958. var TRANSITION = 'transition';
  39959. var ANIMATION = 'animation';
  39960. // Transition property/event sniffing
  39961. var transitionProp = 'transition';
  39962. var transitionEndEvent = 'transitionend';
  39963. var animationProp = 'animation';
  39964. var animationEndEvent = 'animationend';
  39965. if (hasTransition) {
  39966. /* istanbul ignore if */
  39967. if (window.ontransitionend === undefined &&
  39968. window.onwebkittransitionend !== undefined
  39969. ) {
  39970. transitionProp = 'WebkitTransition';
  39971. transitionEndEvent = 'webkitTransitionEnd';
  39972. }
  39973. if (window.onanimationend === undefined &&
  39974. window.onwebkitanimationend !== undefined
  39975. ) {
  39976. animationProp = 'WebkitAnimation';
  39977. animationEndEvent = 'webkitAnimationEnd';
  39978. }
  39979. }
  39980. // binding to window is necessary to make hot reload work in IE in strict mode
  39981. var raf = inBrowser
  39982. ? window.requestAnimationFrame
  39983. ? window.requestAnimationFrame.bind(window)
  39984. : setTimeout
  39985. : /* istanbul ignore next */ function (fn) { return fn(); };
  39986. function nextFrame (fn) {
  39987. raf(function () {
  39988. raf(fn);
  39989. });
  39990. }
  39991. function addTransitionClass (el, cls) {
  39992. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  39993. if (transitionClasses.indexOf(cls) < 0) {
  39994. transitionClasses.push(cls);
  39995. addClass(el, cls);
  39996. }
  39997. }
  39998. function removeTransitionClass (el, cls) {
  39999. if (el._transitionClasses) {
  40000. remove(el._transitionClasses, cls);
  40001. }
  40002. removeClass(el, cls);
  40003. }
  40004. function whenTransitionEnds (
  40005. el,
  40006. expectedType,
  40007. cb
  40008. ) {
  40009. var ref = getTransitionInfo(el, expectedType);
  40010. var type = ref.type;
  40011. var timeout = ref.timeout;
  40012. var propCount = ref.propCount;
  40013. if (!type) { return cb() }
  40014. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  40015. var ended = 0;
  40016. var end = function () {
  40017. el.removeEventListener(event, onEnd);
  40018. cb();
  40019. };
  40020. var onEnd = function (e) {
  40021. if (e.target === el) {
  40022. if (++ended >= propCount) {
  40023. end();
  40024. }
  40025. }
  40026. };
  40027. setTimeout(function () {
  40028. if (ended < propCount) {
  40029. end();
  40030. }
  40031. }, timeout + 1);
  40032. el.addEventListener(event, onEnd);
  40033. }
  40034. var transformRE = /\b(transform|all)(,|$)/;
  40035. function getTransitionInfo (el, expectedType) {
  40036. var styles = window.getComputedStyle(el);
  40037. // JSDOM may return undefined for transition properties
  40038. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  40039. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  40040. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  40041. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  40042. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  40043. var animationTimeout = getTimeout(animationDelays, animationDurations);
  40044. var type;
  40045. var timeout = 0;
  40046. var propCount = 0;
  40047. /* istanbul ignore if */
  40048. if (expectedType === TRANSITION) {
  40049. if (transitionTimeout > 0) {
  40050. type = TRANSITION;
  40051. timeout = transitionTimeout;
  40052. propCount = transitionDurations.length;
  40053. }
  40054. } else if (expectedType === ANIMATION) {
  40055. if (animationTimeout > 0) {
  40056. type = ANIMATION;
  40057. timeout = animationTimeout;
  40058. propCount = animationDurations.length;
  40059. }
  40060. } else {
  40061. timeout = Math.max(transitionTimeout, animationTimeout);
  40062. type = timeout > 0
  40063. ? transitionTimeout > animationTimeout
  40064. ? TRANSITION
  40065. : ANIMATION
  40066. : null;
  40067. propCount = type
  40068. ? type === TRANSITION
  40069. ? transitionDurations.length
  40070. : animationDurations.length
  40071. : 0;
  40072. }
  40073. var hasTransform =
  40074. type === TRANSITION &&
  40075. transformRE.test(styles[transitionProp + 'Property']);
  40076. return {
  40077. type: type,
  40078. timeout: timeout,
  40079. propCount: propCount,
  40080. hasTransform: hasTransform
  40081. }
  40082. }
  40083. function getTimeout (delays, durations) {
  40084. /* istanbul ignore next */
  40085. while (delays.length < durations.length) {
  40086. delays = delays.concat(delays);
  40087. }
  40088. return Math.max.apply(null, durations.map(function (d, i) {
  40089. return toMs(d) + toMs(delays[i])
  40090. }))
  40091. }
  40092. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  40093. // in a locale-dependent way, using a comma instead of a dot.
  40094. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  40095. // as a floor function) causing unexpected behaviors
  40096. function toMs (s) {
  40097. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  40098. }
  40099. /* */
  40100. function enter (vnode, toggleDisplay) {
  40101. var el = vnode.elm;
  40102. // call leave callback now
  40103. if (isDef(el._leaveCb)) {
  40104. el._leaveCb.cancelled = true;
  40105. el._leaveCb();
  40106. }
  40107. var data = resolveTransition(vnode.data.transition);
  40108. if (isUndef(data)) {
  40109. return
  40110. }
  40111. /* istanbul ignore if */
  40112. if (isDef(el._enterCb) || el.nodeType !== 1) {
  40113. return
  40114. }
  40115. var css = data.css;
  40116. var type = data.type;
  40117. var enterClass = data.enterClass;
  40118. var enterToClass = data.enterToClass;
  40119. var enterActiveClass = data.enterActiveClass;
  40120. var appearClass = data.appearClass;
  40121. var appearToClass = data.appearToClass;
  40122. var appearActiveClass = data.appearActiveClass;
  40123. var beforeEnter = data.beforeEnter;
  40124. var enter = data.enter;
  40125. var afterEnter = data.afterEnter;
  40126. var enterCancelled = data.enterCancelled;
  40127. var beforeAppear = data.beforeAppear;
  40128. var appear = data.appear;
  40129. var afterAppear = data.afterAppear;
  40130. var appearCancelled = data.appearCancelled;
  40131. var duration = data.duration;
  40132. // activeInstance will always be the <transition> component managing this
  40133. // transition. One edge case to check is when the <transition> is placed
  40134. // as the root node of a child component. In that case we need to check
  40135. // <transition>'s parent for appear check.
  40136. var context = activeInstance;
  40137. var transitionNode = activeInstance.$vnode;
  40138. while (transitionNode && transitionNode.parent) {
  40139. context = transitionNode.context;
  40140. transitionNode = transitionNode.parent;
  40141. }
  40142. var isAppear = !context._isMounted || !vnode.isRootInsert;
  40143. if (isAppear && !appear && appear !== '') {
  40144. return
  40145. }
  40146. var startClass = isAppear && appearClass
  40147. ? appearClass
  40148. : enterClass;
  40149. var activeClass = isAppear && appearActiveClass
  40150. ? appearActiveClass
  40151. : enterActiveClass;
  40152. var toClass = isAppear && appearToClass
  40153. ? appearToClass
  40154. : enterToClass;
  40155. var beforeEnterHook = isAppear
  40156. ? (beforeAppear || beforeEnter)
  40157. : beforeEnter;
  40158. var enterHook = isAppear
  40159. ? (typeof appear === 'function' ? appear : enter)
  40160. : enter;
  40161. var afterEnterHook = isAppear
  40162. ? (afterAppear || afterEnter)
  40163. : afterEnter;
  40164. var enterCancelledHook = isAppear
  40165. ? (appearCancelled || enterCancelled)
  40166. : enterCancelled;
  40167. var explicitEnterDuration = toNumber(
  40168. isObject(duration)
  40169. ? duration.enter
  40170. : duration
  40171. );
  40172. if (explicitEnterDuration != null) {
  40173. checkDuration(explicitEnterDuration, 'enter', vnode);
  40174. }
  40175. var expectsCSS = css !== false && !isIE9;
  40176. var userWantsControl = getHookArgumentsLength(enterHook);
  40177. var cb = el._enterCb = once(function () {
  40178. if (expectsCSS) {
  40179. removeTransitionClass(el, toClass);
  40180. removeTransitionClass(el, activeClass);
  40181. }
  40182. if (cb.cancelled) {
  40183. if (expectsCSS) {
  40184. removeTransitionClass(el, startClass);
  40185. }
  40186. enterCancelledHook && enterCancelledHook(el);
  40187. } else {
  40188. afterEnterHook && afterEnterHook(el);
  40189. }
  40190. el._enterCb = null;
  40191. });
  40192. if (!vnode.data.show) {
  40193. // remove pending leave element on enter by injecting an insert hook
  40194. mergeVNodeHook(vnode, 'insert', function () {
  40195. var parent = el.parentNode;
  40196. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  40197. if (pendingNode &&
  40198. pendingNode.tag === vnode.tag &&
  40199. pendingNode.elm._leaveCb
  40200. ) {
  40201. pendingNode.elm._leaveCb();
  40202. }
  40203. enterHook && enterHook(el, cb);
  40204. });
  40205. }
  40206. // start enter transition
  40207. beforeEnterHook && beforeEnterHook(el);
  40208. if (expectsCSS) {
  40209. addTransitionClass(el, startClass);
  40210. addTransitionClass(el, activeClass);
  40211. nextFrame(function () {
  40212. removeTransitionClass(el, startClass);
  40213. if (!cb.cancelled) {
  40214. addTransitionClass(el, toClass);
  40215. if (!userWantsControl) {
  40216. if (isValidDuration(explicitEnterDuration)) {
  40217. setTimeout(cb, explicitEnterDuration);
  40218. } else {
  40219. whenTransitionEnds(el, type, cb);
  40220. }
  40221. }
  40222. }
  40223. });
  40224. }
  40225. if (vnode.data.show) {
  40226. toggleDisplay && toggleDisplay();
  40227. enterHook && enterHook(el, cb);
  40228. }
  40229. if (!expectsCSS && !userWantsControl) {
  40230. cb();
  40231. }
  40232. }
  40233. function leave (vnode, rm) {
  40234. var el = vnode.elm;
  40235. // call enter callback now
  40236. if (isDef(el._enterCb)) {
  40237. el._enterCb.cancelled = true;
  40238. el._enterCb();
  40239. }
  40240. var data = resolveTransition(vnode.data.transition);
  40241. if (isUndef(data) || el.nodeType !== 1) {
  40242. return rm()
  40243. }
  40244. /* istanbul ignore if */
  40245. if (isDef(el._leaveCb)) {
  40246. return
  40247. }
  40248. var css = data.css;
  40249. var type = data.type;
  40250. var leaveClass = data.leaveClass;
  40251. var leaveToClass = data.leaveToClass;
  40252. var leaveActiveClass = data.leaveActiveClass;
  40253. var beforeLeave = data.beforeLeave;
  40254. var leave = data.leave;
  40255. var afterLeave = data.afterLeave;
  40256. var leaveCancelled = data.leaveCancelled;
  40257. var delayLeave = data.delayLeave;
  40258. var duration = data.duration;
  40259. var expectsCSS = css !== false && !isIE9;
  40260. var userWantsControl = getHookArgumentsLength(leave);
  40261. var explicitLeaveDuration = toNumber(
  40262. isObject(duration)
  40263. ? duration.leave
  40264. : duration
  40265. );
  40266. if (isDef(explicitLeaveDuration)) {
  40267. checkDuration(explicitLeaveDuration, 'leave', vnode);
  40268. }
  40269. var cb = el._leaveCb = once(function () {
  40270. if (el.parentNode && el.parentNode._pending) {
  40271. el.parentNode._pending[vnode.key] = null;
  40272. }
  40273. if (expectsCSS) {
  40274. removeTransitionClass(el, leaveToClass);
  40275. removeTransitionClass(el, leaveActiveClass);
  40276. }
  40277. if (cb.cancelled) {
  40278. if (expectsCSS) {
  40279. removeTransitionClass(el, leaveClass);
  40280. }
  40281. leaveCancelled && leaveCancelled(el);
  40282. } else {
  40283. rm();
  40284. afterLeave && afterLeave(el);
  40285. }
  40286. el._leaveCb = null;
  40287. });
  40288. if (delayLeave) {
  40289. delayLeave(performLeave);
  40290. } else {
  40291. performLeave();
  40292. }
  40293. function performLeave () {
  40294. // the delayed leave may have already been cancelled
  40295. if (cb.cancelled) {
  40296. return
  40297. }
  40298. // record leaving element
  40299. if (!vnode.data.show && el.parentNode) {
  40300. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  40301. }
  40302. beforeLeave && beforeLeave(el);
  40303. if (expectsCSS) {
  40304. addTransitionClass(el, leaveClass);
  40305. addTransitionClass(el, leaveActiveClass);
  40306. nextFrame(function () {
  40307. removeTransitionClass(el, leaveClass);
  40308. if (!cb.cancelled) {
  40309. addTransitionClass(el, leaveToClass);
  40310. if (!userWantsControl) {
  40311. if (isValidDuration(explicitLeaveDuration)) {
  40312. setTimeout(cb, explicitLeaveDuration);
  40313. } else {
  40314. whenTransitionEnds(el, type, cb);
  40315. }
  40316. }
  40317. }
  40318. });
  40319. }
  40320. leave && leave(el, cb);
  40321. if (!expectsCSS && !userWantsControl) {
  40322. cb();
  40323. }
  40324. }
  40325. }
  40326. // only used in dev mode
  40327. function checkDuration (val, name, vnode) {
  40328. if (typeof val !== 'number') {
  40329. warn(
  40330. "<transition> explicit " + name + " duration is not a valid number - " +
  40331. "got " + (JSON.stringify(val)) + ".",
  40332. vnode.context
  40333. );
  40334. } else if (isNaN(val)) {
  40335. warn(
  40336. "<transition> explicit " + name + " duration is NaN - " +
  40337. 'the duration expression might be incorrect.',
  40338. vnode.context
  40339. );
  40340. }
  40341. }
  40342. function isValidDuration (val) {
  40343. return typeof val === 'number' && !isNaN(val)
  40344. }
  40345. /**
  40346. * Normalize a transition hook's argument length. The hook may be:
  40347. * - a merged hook (invoker) with the original in .fns
  40348. * - a wrapped component method (check ._length)
  40349. * - a plain function (.length)
  40350. */
  40351. function getHookArgumentsLength (fn) {
  40352. if (isUndef(fn)) {
  40353. return false
  40354. }
  40355. var invokerFns = fn.fns;
  40356. if (isDef(invokerFns)) {
  40357. // invoker
  40358. return getHookArgumentsLength(
  40359. Array.isArray(invokerFns)
  40360. ? invokerFns[0]
  40361. : invokerFns
  40362. )
  40363. } else {
  40364. return (fn._length || fn.length) > 1
  40365. }
  40366. }
  40367. function _enter (_, vnode) {
  40368. if (vnode.data.show !== true) {
  40369. enter(vnode);
  40370. }
  40371. }
  40372. var transition = inBrowser ? {
  40373. create: _enter,
  40374. activate: _enter,
  40375. remove: function remove$$1 (vnode, rm) {
  40376. /* istanbul ignore else */
  40377. if (vnode.data.show !== true) {
  40378. leave(vnode, rm);
  40379. } else {
  40380. rm();
  40381. }
  40382. }
  40383. } : {};
  40384. var platformModules = [
  40385. attrs,
  40386. klass,
  40387. events,
  40388. domProps,
  40389. style,
  40390. transition
  40391. ];
  40392. /* */
  40393. // the directive module should be applied last, after all
  40394. // built-in modules have been applied.
  40395. var modules = platformModules.concat(baseModules);
  40396. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  40397. /**
  40398. * Not type checking this file because flow doesn't like attaching
  40399. * properties to Elements.
  40400. */
  40401. /* istanbul ignore if */
  40402. if (isIE9) {
  40403. // http://www.matts411.com/post/internet-explorer-9-oninput/
  40404. document.addEventListener('selectionchange', function () {
  40405. var el = document.activeElement;
  40406. if (el && el.vmodel) {
  40407. trigger(el, 'input');
  40408. }
  40409. });
  40410. }
  40411. var directive = {
  40412. inserted: function inserted (el, binding, vnode, oldVnode) {
  40413. if (vnode.tag === 'select') {
  40414. // #6903
  40415. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  40416. mergeVNodeHook(vnode, 'postpatch', function () {
  40417. directive.componentUpdated(el, binding, vnode);
  40418. });
  40419. } else {
  40420. setSelected(el, binding, vnode.context);
  40421. }
  40422. el._vOptions = [].map.call(el.options, getValue);
  40423. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  40424. el._vModifiers = binding.modifiers;
  40425. if (!binding.modifiers.lazy) {
  40426. el.addEventListener('compositionstart', onCompositionStart);
  40427. el.addEventListener('compositionend', onCompositionEnd);
  40428. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  40429. // switching focus before confirming composition choice
  40430. // this also fixes the issue where some browsers e.g. iOS Chrome
  40431. // fires "change" instead of "input" on autocomplete.
  40432. el.addEventListener('change', onCompositionEnd);
  40433. /* istanbul ignore if */
  40434. if (isIE9) {
  40435. el.vmodel = true;
  40436. }
  40437. }
  40438. }
  40439. },
  40440. componentUpdated: function componentUpdated (el, binding, vnode) {
  40441. if (vnode.tag === 'select') {
  40442. setSelected(el, binding, vnode.context);
  40443. // in case the options rendered by v-for have changed,
  40444. // it's possible that the value is out-of-sync with the rendered options.
  40445. // detect such cases and filter out values that no longer has a matching
  40446. // option in the DOM.
  40447. var prevOptions = el._vOptions;
  40448. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  40449. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  40450. // trigger change event if
  40451. // no matching option found for at least one value
  40452. var needReset = el.multiple
  40453. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  40454. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  40455. if (needReset) {
  40456. trigger(el, 'change');
  40457. }
  40458. }
  40459. }
  40460. }
  40461. };
  40462. function setSelected (el, binding, vm) {
  40463. actuallySetSelected(el, binding, vm);
  40464. /* istanbul ignore if */
  40465. if (isIE || isEdge) {
  40466. setTimeout(function () {
  40467. actuallySetSelected(el, binding, vm);
  40468. }, 0);
  40469. }
  40470. }
  40471. function actuallySetSelected (el, binding, vm) {
  40472. var value = binding.value;
  40473. var isMultiple = el.multiple;
  40474. if (isMultiple && !Array.isArray(value)) {
  40475. warn(
  40476. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  40477. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  40478. vm
  40479. );
  40480. return
  40481. }
  40482. var selected, option;
  40483. for (var i = 0, l = el.options.length; i < l; i++) {
  40484. option = el.options[i];
  40485. if (isMultiple) {
  40486. selected = looseIndexOf(value, getValue(option)) > -1;
  40487. if (option.selected !== selected) {
  40488. option.selected = selected;
  40489. }
  40490. } else {
  40491. if (looseEqual(getValue(option), value)) {
  40492. if (el.selectedIndex !== i) {
  40493. el.selectedIndex = i;
  40494. }
  40495. return
  40496. }
  40497. }
  40498. }
  40499. if (!isMultiple) {
  40500. el.selectedIndex = -1;
  40501. }
  40502. }
  40503. function hasNoMatchingOption (value, options) {
  40504. return options.every(function (o) { return !looseEqual(o, value); })
  40505. }
  40506. function getValue (option) {
  40507. return '_value' in option
  40508. ? option._value
  40509. : option.value
  40510. }
  40511. function onCompositionStart (e) {
  40512. e.target.composing = true;
  40513. }
  40514. function onCompositionEnd (e) {
  40515. // prevent triggering an input event for no reason
  40516. if (!e.target.composing) { return }
  40517. e.target.composing = false;
  40518. trigger(e.target, 'input');
  40519. }
  40520. function trigger (el, type) {
  40521. var e = document.createEvent('HTMLEvents');
  40522. e.initEvent(type, true, true);
  40523. el.dispatchEvent(e);
  40524. }
  40525. /* */
  40526. // recursively search for possible transition defined inside the component root
  40527. function locateNode (vnode) {
  40528. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  40529. ? locateNode(vnode.componentInstance._vnode)
  40530. : vnode
  40531. }
  40532. var show = {
  40533. bind: function bind (el, ref, vnode) {
  40534. var value = ref.value;
  40535. vnode = locateNode(vnode);
  40536. var transition$$1 = vnode.data && vnode.data.transition;
  40537. var originalDisplay = el.__vOriginalDisplay =
  40538. el.style.display === 'none' ? '' : el.style.display;
  40539. if (value && transition$$1) {
  40540. vnode.data.show = true;
  40541. enter(vnode, function () {
  40542. el.style.display = originalDisplay;
  40543. });
  40544. } else {
  40545. el.style.display = value ? originalDisplay : 'none';
  40546. }
  40547. },
  40548. update: function update (el, ref, vnode) {
  40549. var value = ref.value;
  40550. var oldValue = ref.oldValue;
  40551. /* istanbul ignore if */
  40552. if (!value === !oldValue) { return }
  40553. vnode = locateNode(vnode);
  40554. var transition$$1 = vnode.data && vnode.data.transition;
  40555. if (transition$$1) {
  40556. vnode.data.show = true;
  40557. if (value) {
  40558. enter(vnode, function () {
  40559. el.style.display = el.__vOriginalDisplay;
  40560. });
  40561. } else {
  40562. leave(vnode, function () {
  40563. el.style.display = 'none';
  40564. });
  40565. }
  40566. } else {
  40567. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40568. }
  40569. },
  40570. unbind: function unbind (
  40571. el,
  40572. binding,
  40573. vnode,
  40574. oldVnode,
  40575. isDestroy
  40576. ) {
  40577. if (!isDestroy) {
  40578. el.style.display = el.__vOriginalDisplay;
  40579. }
  40580. }
  40581. };
  40582. var platformDirectives = {
  40583. model: directive,
  40584. show: show
  40585. };
  40586. /* */
  40587. var transitionProps = {
  40588. name: String,
  40589. appear: Boolean,
  40590. css: Boolean,
  40591. mode: String,
  40592. type: String,
  40593. enterClass: String,
  40594. leaveClass: String,
  40595. enterToClass: String,
  40596. leaveToClass: String,
  40597. enterActiveClass: String,
  40598. leaveActiveClass: String,
  40599. appearClass: String,
  40600. appearActiveClass: String,
  40601. appearToClass: String,
  40602. duration: [Number, String, Object]
  40603. };
  40604. // in case the child is also an abstract component, e.g. <keep-alive>
  40605. // we want to recursively retrieve the real component to be rendered
  40606. function getRealChild (vnode) {
  40607. var compOptions = vnode && vnode.componentOptions;
  40608. if (compOptions && compOptions.Ctor.options.abstract) {
  40609. return getRealChild(getFirstComponentChild(compOptions.children))
  40610. } else {
  40611. return vnode
  40612. }
  40613. }
  40614. function extractTransitionData (comp) {
  40615. var data = {};
  40616. var options = comp.$options;
  40617. // props
  40618. for (var key in options.propsData) {
  40619. data[key] = comp[key];
  40620. }
  40621. // events.
  40622. // extract listeners and pass them directly to the transition methods
  40623. var listeners = options._parentListeners;
  40624. for (var key$1 in listeners) {
  40625. data[camelize(key$1)] = listeners[key$1];
  40626. }
  40627. return data
  40628. }
  40629. function placeholder (h, rawChild) {
  40630. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40631. return h('keep-alive', {
  40632. props: rawChild.componentOptions.propsData
  40633. })
  40634. }
  40635. }
  40636. function hasParentTransition (vnode) {
  40637. while ((vnode = vnode.parent)) {
  40638. if (vnode.data.transition) {
  40639. return true
  40640. }
  40641. }
  40642. }
  40643. function isSameChild (child, oldChild) {
  40644. return oldChild.key === child.key && oldChild.tag === child.tag
  40645. }
  40646. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40647. var isVShowDirective = function (d) { return d.name === 'show'; };
  40648. var Transition = {
  40649. name: 'transition',
  40650. props: transitionProps,
  40651. abstract: true,
  40652. render: function render (h) {
  40653. var this$1 = this;
  40654. var children = this.$slots.default;
  40655. if (!children) {
  40656. return
  40657. }
  40658. // filter out text nodes (possible whitespaces)
  40659. children = children.filter(isNotTextNode);
  40660. /* istanbul ignore if */
  40661. if (!children.length) {
  40662. return
  40663. }
  40664. // warn multiple elements
  40665. if (children.length > 1) {
  40666. warn(
  40667. '<transition> can only be used on a single element. Use ' +
  40668. '<transition-group> for lists.',
  40669. this.$parent
  40670. );
  40671. }
  40672. var mode = this.mode;
  40673. // warn invalid mode
  40674. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40675. ) {
  40676. warn(
  40677. 'invalid <transition> mode: ' + mode,
  40678. this.$parent
  40679. );
  40680. }
  40681. var rawChild = children[0];
  40682. // if this is a component root node and the component's
  40683. // parent container node also has transition, skip.
  40684. if (hasParentTransition(this.$vnode)) {
  40685. return rawChild
  40686. }
  40687. // apply transition data to child
  40688. // use getRealChild() to ignore abstract components e.g. keep-alive
  40689. var child = getRealChild(rawChild);
  40690. /* istanbul ignore if */
  40691. if (!child) {
  40692. return rawChild
  40693. }
  40694. if (this._leaving) {
  40695. return placeholder(h, rawChild)
  40696. }
  40697. // ensure a key that is unique to the vnode type and to this transition
  40698. // component instance. This key will be used to remove pending leaving nodes
  40699. // during entering.
  40700. var id = "__transition-" + (this._uid) + "-";
  40701. child.key = child.key == null
  40702. ? child.isComment
  40703. ? id + 'comment'
  40704. : id + child.tag
  40705. : isPrimitive(child.key)
  40706. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40707. : child.key;
  40708. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40709. var oldRawChild = this._vnode;
  40710. var oldChild = getRealChild(oldRawChild);
  40711. // mark v-show
  40712. // so that the transition module can hand over the control to the directive
  40713. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40714. child.data.show = true;
  40715. }
  40716. if (
  40717. oldChild &&
  40718. oldChild.data &&
  40719. !isSameChild(child, oldChild) &&
  40720. !isAsyncPlaceholder(oldChild) &&
  40721. // #6687 component root is a comment node
  40722. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40723. ) {
  40724. // replace old child transition data with fresh one
  40725. // important for dynamic transitions!
  40726. var oldData = oldChild.data.transition = extend({}, data);
  40727. // handle transition mode
  40728. if (mode === 'out-in') {
  40729. // return placeholder node and queue update when leave finishes
  40730. this._leaving = true;
  40731. mergeVNodeHook(oldData, 'afterLeave', function () {
  40732. this$1._leaving = false;
  40733. this$1.$forceUpdate();
  40734. });
  40735. return placeholder(h, rawChild)
  40736. } else if (mode === 'in-out') {
  40737. if (isAsyncPlaceholder(child)) {
  40738. return oldRawChild
  40739. }
  40740. var delayedLeave;
  40741. var performLeave = function () { delayedLeave(); };
  40742. mergeVNodeHook(data, 'afterEnter', performLeave);
  40743. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40744. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40745. }
  40746. }
  40747. return rawChild
  40748. }
  40749. };
  40750. /* */
  40751. var props = extend({
  40752. tag: String,
  40753. moveClass: String
  40754. }, transitionProps);
  40755. delete props.mode;
  40756. var TransitionGroup = {
  40757. props: props,
  40758. beforeMount: function beforeMount () {
  40759. var this$1 = this;
  40760. var update = this._update;
  40761. this._update = function (vnode, hydrating) {
  40762. var restoreActiveInstance = setActiveInstance(this$1);
  40763. // force removing pass
  40764. this$1.__patch__(
  40765. this$1._vnode,
  40766. this$1.kept,
  40767. false, // hydrating
  40768. true // removeOnly (!important, avoids unnecessary moves)
  40769. );
  40770. this$1._vnode = this$1.kept;
  40771. restoreActiveInstance();
  40772. update.call(this$1, vnode, hydrating);
  40773. };
  40774. },
  40775. render: function render (h) {
  40776. var tag = this.tag || this.$vnode.data.tag || 'span';
  40777. var map = Object.create(null);
  40778. var prevChildren = this.prevChildren = this.children;
  40779. var rawChildren = this.$slots.default || [];
  40780. var children = this.children = [];
  40781. var transitionData = extractTransitionData(this);
  40782. for (var i = 0; i < rawChildren.length; i++) {
  40783. var c = rawChildren[i];
  40784. if (c.tag) {
  40785. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40786. children.push(c);
  40787. map[c.key] = c
  40788. ;(c.data || (c.data = {})).transition = transitionData;
  40789. } else {
  40790. var opts = c.componentOptions;
  40791. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40792. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40793. }
  40794. }
  40795. }
  40796. if (prevChildren) {
  40797. var kept = [];
  40798. var removed = [];
  40799. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40800. var c$1 = prevChildren[i$1];
  40801. c$1.data.transition = transitionData;
  40802. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40803. if (map[c$1.key]) {
  40804. kept.push(c$1);
  40805. } else {
  40806. removed.push(c$1);
  40807. }
  40808. }
  40809. this.kept = h(tag, null, kept);
  40810. this.removed = removed;
  40811. }
  40812. return h(tag, null, children)
  40813. },
  40814. updated: function updated () {
  40815. var children = this.prevChildren;
  40816. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40817. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40818. return
  40819. }
  40820. // we divide the work into three loops to avoid mixing DOM reads and writes
  40821. // in each iteration - which helps prevent layout thrashing.
  40822. children.forEach(callPendingCbs);
  40823. children.forEach(recordPosition);
  40824. children.forEach(applyTranslation);
  40825. // force reflow to put everything in position
  40826. // assign to this to avoid being removed in tree-shaking
  40827. // $flow-disable-line
  40828. this._reflow = document.body.offsetHeight;
  40829. children.forEach(function (c) {
  40830. if (c.data.moved) {
  40831. var el = c.elm;
  40832. var s = el.style;
  40833. addTransitionClass(el, moveClass);
  40834. s.transform = s.WebkitTransform = s.transitionDuration = '';
  40835. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  40836. if (e && e.target !== el) {
  40837. return
  40838. }
  40839. if (!e || /transform$/.test(e.propertyName)) {
  40840. el.removeEventListener(transitionEndEvent, cb);
  40841. el._moveCb = null;
  40842. removeTransitionClass(el, moveClass);
  40843. }
  40844. });
  40845. }
  40846. });
  40847. },
  40848. methods: {
  40849. hasMove: function hasMove (el, moveClass) {
  40850. /* istanbul ignore if */
  40851. if (!hasTransition) {
  40852. return false
  40853. }
  40854. /* istanbul ignore if */
  40855. if (this._hasMove) {
  40856. return this._hasMove
  40857. }
  40858. // Detect whether an element with the move class applied has
  40859. // CSS transitions. Since the element may be inside an entering
  40860. // transition at this very moment, we make a clone of it and remove
  40861. // all other transition classes applied to ensure only the move class
  40862. // is applied.
  40863. var clone = el.cloneNode();
  40864. if (el._transitionClasses) {
  40865. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  40866. }
  40867. addClass(clone, moveClass);
  40868. clone.style.display = 'none';
  40869. this.$el.appendChild(clone);
  40870. var info = getTransitionInfo(clone);
  40871. this.$el.removeChild(clone);
  40872. return (this._hasMove = info.hasTransform)
  40873. }
  40874. }
  40875. };
  40876. function callPendingCbs (c) {
  40877. /* istanbul ignore if */
  40878. if (c.elm._moveCb) {
  40879. c.elm._moveCb();
  40880. }
  40881. /* istanbul ignore if */
  40882. if (c.elm._enterCb) {
  40883. c.elm._enterCb();
  40884. }
  40885. }
  40886. function recordPosition (c) {
  40887. c.data.newPos = c.elm.getBoundingClientRect();
  40888. }
  40889. function applyTranslation (c) {
  40890. var oldPos = c.data.pos;
  40891. var newPos = c.data.newPos;
  40892. var dx = oldPos.left - newPos.left;
  40893. var dy = oldPos.top - newPos.top;
  40894. if (dx || dy) {
  40895. c.data.moved = true;
  40896. var s = c.elm.style;
  40897. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  40898. s.transitionDuration = '0s';
  40899. }
  40900. }
  40901. var platformComponents = {
  40902. Transition: Transition,
  40903. TransitionGroup: TransitionGroup
  40904. };
  40905. /* */
  40906. // install platform specific utils
  40907. Vue.config.mustUseProp = mustUseProp;
  40908. Vue.config.isReservedTag = isReservedTag;
  40909. Vue.config.isReservedAttr = isReservedAttr;
  40910. Vue.config.getTagNamespace = getTagNamespace;
  40911. Vue.config.isUnknownElement = isUnknownElement;
  40912. // install platform runtime directives & components
  40913. extend(Vue.options.directives, platformDirectives);
  40914. extend(Vue.options.components, platformComponents);
  40915. // install platform patch function
  40916. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  40917. // public mount method
  40918. Vue.prototype.$mount = function (
  40919. el,
  40920. hydrating
  40921. ) {
  40922. el = el && inBrowser ? query(el) : undefined;
  40923. return mountComponent(this, el, hydrating)
  40924. };
  40925. // devtools global hook
  40926. /* istanbul ignore next */
  40927. if (inBrowser) {
  40928. setTimeout(function () {
  40929. if (config.devtools) {
  40930. if (devtools) {
  40931. devtools.emit('init', Vue);
  40932. } else {
  40933. console[console.info ? 'info' : 'log'](
  40934. 'Download the Vue Devtools extension for a better development experience:\n' +
  40935. 'https://github.com/vuejs/vue-devtools'
  40936. );
  40937. }
  40938. }
  40939. if (config.productionTip !== false &&
  40940. typeof console !== 'undefined'
  40941. ) {
  40942. console[console.info ? 'info' : 'log'](
  40943. "You are running Vue in development mode.\n" +
  40944. "Make sure to turn on production mode when deploying for production.\n" +
  40945. "See more tips at https://vuejs.org/guide/deployment.html"
  40946. );
  40947. }
  40948. }, 0);
  40949. }
  40950. /* */
  40951. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  40952. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  40953. var buildRegex = cached(function (delimiters) {
  40954. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  40955. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  40956. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  40957. });
  40958. function parseText (
  40959. text,
  40960. delimiters
  40961. ) {
  40962. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  40963. if (!tagRE.test(text)) {
  40964. return
  40965. }
  40966. var tokens = [];
  40967. var rawTokens = [];
  40968. var lastIndex = tagRE.lastIndex = 0;
  40969. var match, index, tokenValue;
  40970. while ((match = tagRE.exec(text))) {
  40971. index = match.index;
  40972. // push text token
  40973. if (index > lastIndex) {
  40974. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  40975. tokens.push(JSON.stringify(tokenValue));
  40976. }
  40977. // tag token
  40978. var exp = parseFilters(match[1].trim());
  40979. tokens.push(("_s(" + exp + ")"));
  40980. rawTokens.push({ '@binding': exp });
  40981. lastIndex = index + match[0].length;
  40982. }
  40983. if (lastIndex < text.length) {
  40984. rawTokens.push(tokenValue = text.slice(lastIndex));
  40985. tokens.push(JSON.stringify(tokenValue));
  40986. }
  40987. return {
  40988. expression: tokens.join('+'),
  40989. tokens: rawTokens
  40990. }
  40991. }
  40992. /* */
  40993. function transformNode (el, options) {
  40994. var warn = options.warn || baseWarn;
  40995. var staticClass = getAndRemoveAttr(el, 'class');
  40996. if (staticClass) {
  40997. var res = parseText(staticClass, options.delimiters);
  40998. if (res) {
  40999. warn(
  41000. "class=\"" + staticClass + "\": " +
  41001. 'Interpolation inside attributes has been removed. ' +
  41002. 'Use v-bind or the colon shorthand instead. For example, ' +
  41003. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  41004. el.rawAttrsMap['class']
  41005. );
  41006. }
  41007. }
  41008. if (staticClass) {
  41009. el.staticClass = JSON.stringify(staticClass);
  41010. }
  41011. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  41012. if (classBinding) {
  41013. el.classBinding = classBinding;
  41014. }
  41015. }
  41016. function genData (el) {
  41017. var data = '';
  41018. if (el.staticClass) {
  41019. data += "staticClass:" + (el.staticClass) + ",";
  41020. }
  41021. if (el.classBinding) {
  41022. data += "class:" + (el.classBinding) + ",";
  41023. }
  41024. return data
  41025. }
  41026. var klass$1 = {
  41027. staticKeys: ['staticClass'],
  41028. transformNode: transformNode,
  41029. genData: genData
  41030. };
  41031. /* */
  41032. function transformNode$1 (el, options) {
  41033. var warn = options.warn || baseWarn;
  41034. var staticStyle = getAndRemoveAttr(el, 'style');
  41035. if (staticStyle) {
  41036. /* istanbul ignore if */
  41037. {
  41038. var res = parseText(staticStyle, options.delimiters);
  41039. if (res) {
  41040. warn(
  41041. "style=\"" + staticStyle + "\": " +
  41042. 'Interpolation inside attributes has been removed. ' +
  41043. 'Use v-bind or the colon shorthand instead. For example, ' +
  41044. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  41045. el.rawAttrsMap['style']
  41046. );
  41047. }
  41048. }
  41049. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  41050. }
  41051. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  41052. if (styleBinding) {
  41053. el.styleBinding = styleBinding;
  41054. }
  41055. }
  41056. function genData$1 (el) {
  41057. var data = '';
  41058. if (el.staticStyle) {
  41059. data += "staticStyle:" + (el.staticStyle) + ",";
  41060. }
  41061. if (el.styleBinding) {
  41062. data += "style:(" + (el.styleBinding) + "),";
  41063. }
  41064. return data
  41065. }
  41066. var style$1 = {
  41067. staticKeys: ['staticStyle'],
  41068. transformNode: transformNode$1,
  41069. genData: genData$1
  41070. };
  41071. /* */
  41072. var decoder;
  41073. var he = {
  41074. decode: function decode (html) {
  41075. decoder = decoder || document.createElement('div');
  41076. decoder.innerHTML = html;
  41077. return decoder.textContent
  41078. }
  41079. };
  41080. /* */
  41081. var isUnaryTag = makeMap(
  41082. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  41083. 'link,meta,param,source,track,wbr'
  41084. );
  41085. // Elements that you can, intentionally, leave open
  41086. // (and which close themselves)
  41087. var canBeLeftOpenTag = makeMap(
  41088. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  41089. );
  41090. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  41091. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  41092. var isNonPhrasingTag = makeMap(
  41093. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  41094. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  41095. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  41096. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  41097. 'title,tr,track'
  41098. );
  41099. /**
  41100. * Not type-checking this file because it's mostly vendor code.
  41101. */
  41102. // Regular Expressions for parsing tags and attributes
  41103. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41104. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41105. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  41106. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  41107. var startTagOpen = new RegExp(("^<" + qnameCapture));
  41108. var startTagClose = /^\s*(\/?)>/;
  41109. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  41110. var doctype = /^<!DOCTYPE [^>]+>/i;
  41111. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  41112. var comment = /^<!\--/;
  41113. var conditionalComment = /^<!\[/;
  41114. // Special Elements (can contain anything)
  41115. var isPlainTextElement = makeMap('script,style,textarea', true);
  41116. var reCache = {};
  41117. var decodingMap = {
  41118. '&lt;': '<',
  41119. '&gt;': '>',
  41120. '&quot;': '"',
  41121. '&amp;': '&',
  41122. '&#10;': '\n',
  41123. '&#9;': '\t',
  41124. '&#39;': "'"
  41125. };
  41126. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  41127. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  41128. // #5992
  41129. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  41130. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  41131. function decodeAttr (value, shouldDecodeNewlines) {
  41132. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  41133. return value.replace(re, function (match) { return decodingMap[match]; })
  41134. }
  41135. function parseHTML (html, options) {
  41136. var stack = [];
  41137. var expectHTML = options.expectHTML;
  41138. var isUnaryTag$$1 = options.isUnaryTag || no;
  41139. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  41140. var index = 0;
  41141. var last, lastTag;
  41142. while (html) {
  41143. last = html;
  41144. // Make sure we're not in a plaintext content element like script/style
  41145. if (!lastTag || !isPlainTextElement(lastTag)) {
  41146. var textEnd = html.indexOf('<');
  41147. if (textEnd === 0) {
  41148. // Comment:
  41149. if (comment.test(html)) {
  41150. var commentEnd = html.indexOf('-->');
  41151. if (commentEnd >= 0) {
  41152. if (options.shouldKeepComment) {
  41153. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  41154. }
  41155. advance(commentEnd + 3);
  41156. continue
  41157. }
  41158. }
  41159. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  41160. if (conditionalComment.test(html)) {
  41161. var conditionalEnd = html.indexOf(']>');
  41162. if (conditionalEnd >= 0) {
  41163. advance(conditionalEnd + 2);
  41164. continue
  41165. }
  41166. }
  41167. // Doctype:
  41168. var doctypeMatch = html.match(doctype);
  41169. if (doctypeMatch) {
  41170. advance(doctypeMatch[0].length);
  41171. continue
  41172. }
  41173. // End tag:
  41174. var endTagMatch = html.match(endTag);
  41175. if (endTagMatch) {
  41176. var curIndex = index;
  41177. advance(endTagMatch[0].length);
  41178. parseEndTag(endTagMatch[1], curIndex, index);
  41179. continue
  41180. }
  41181. // Start tag:
  41182. var startTagMatch = parseStartTag();
  41183. if (startTagMatch) {
  41184. handleStartTag(startTagMatch);
  41185. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  41186. advance(1);
  41187. }
  41188. continue
  41189. }
  41190. }
  41191. var text = (void 0), rest = (void 0), next = (void 0);
  41192. if (textEnd >= 0) {
  41193. rest = html.slice(textEnd);
  41194. while (
  41195. !endTag.test(rest) &&
  41196. !startTagOpen.test(rest) &&
  41197. !comment.test(rest) &&
  41198. !conditionalComment.test(rest)
  41199. ) {
  41200. // < in plain text, be forgiving and treat it as text
  41201. next = rest.indexOf('<', 1);
  41202. if (next < 0) { break }
  41203. textEnd += next;
  41204. rest = html.slice(textEnd);
  41205. }
  41206. text = html.substring(0, textEnd);
  41207. }
  41208. if (textEnd < 0) {
  41209. text = html;
  41210. }
  41211. if (text) {
  41212. advance(text.length);
  41213. }
  41214. if (options.chars && text) {
  41215. options.chars(text, index - text.length, index);
  41216. }
  41217. } else {
  41218. var endTagLength = 0;
  41219. var stackedTag = lastTag.toLowerCase();
  41220. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  41221. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  41222. endTagLength = endTag.length;
  41223. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  41224. text = text
  41225. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  41226. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  41227. }
  41228. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  41229. text = text.slice(1);
  41230. }
  41231. if (options.chars) {
  41232. options.chars(text);
  41233. }
  41234. return ''
  41235. });
  41236. index += html.length - rest$1.length;
  41237. html = rest$1;
  41238. parseEndTag(stackedTag, index - endTagLength, index);
  41239. }
  41240. if (html === last) {
  41241. options.chars && options.chars(html);
  41242. if (!stack.length && options.warn) {
  41243. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  41244. }
  41245. break
  41246. }
  41247. }
  41248. // Clean up any remaining tags
  41249. parseEndTag();
  41250. function advance (n) {
  41251. index += n;
  41252. html = html.substring(n);
  41253. }
  41254. function parseStartTag () {
  41255. var start = html.match(startTagOpen);
  41256. if (start) {
  41257. var match = {
  41258. tagName: start[1],
  41259. attrs: [],
  41260. start: index
  41261. };
  41262. advance(start[0].length);
  41263. var end, attr;
  41264. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  41265. attr.start = index;
  41266. advance(attr[0].length);
  41267. attr.end = index;
  41268. match.attrs.push(attr);
  41269. }
  41270. if (end) {
  41271. match.unarySlash = end[1];
  41272. advance(end[0].length);
  41273. match.end = index;
  41274. return match
  41275. }
  41276. }
  41277. }
  41278. function handleStartTag (match) {
  41279. var tagName = match.tagName;
  41280. var unarySlash = match.unarySlash;
  41281. if (expectHTML) {
  41282. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  41283. parseEndTag(lastTag);
  41284. }
  41285. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  41286. parseEndTag(tagName);
  41287. }
  41288. }
  41289. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  41290. var l = match.attrs.length;
  41291. var attrs = new Array(l);
  41292. for (var i = 0; i < l; i++) {
  41293. var args = match.attrs[i];
  41294. var value = args[3] || args[4] || args[5] || '';
  41295. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  41296. ? options.shouldDecodeNewlinesForHref
  41297. : options.shouldDecodeNewlines;
  41298. attrs[i] = {
  41299. name: args[1],
  41300. value: decodeAttr(value, shouldDecodeNewlines)
  41301. };
  41302. if (options.outputSourceRange) {
  41303. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  41304. attrs[i].end = args.end;
  41305. }
  41306. }
  41307. if (!unary) {
  41308. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  41309. lastTag = tagName;
  41310. }
  41311. if (options.start) {
  41312. options.start(tagName, attrs, unary, match.start, match.end);
  41313. }
  41314. }
  41315. function parseEndTag (tagName, start, end) {
  41316. var pos, lowerCasedTagName;
  41317. if (start == null) { start = index; }
  41318. if (end == null) { end = index; }
  41319. // Find the closest opened tag of the same type
  41320. if (tagName) {
  41321. lowerCasedTagName = tagName.toLowerCase();
  41322. for (pos = stack.length - 1; pos >= 0; pos--) {
  41323. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  41324. break
  41325. }
  41326. }
  41327. } else {
  41328. // If no tag name is provided, clean shop
  41329. pos = 0;
  41330. }
  41331. if (pos >= 0) {
  41332. // Close all the open elements, up the stack
  41333. for (var i = stack.length - 1; i >= pos; i--) {
  41334. if (i > pos || !tagName &&
  41335. options.warn
  41336. ) {
  41337. options.warn(
  41338. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  41339. { start: stack[i].start, end: stack[i].end }
  41340. );
  41341. }
  41342. if (options.end) {
  41343. options.end(stack[i].tag, start, end);
  41344. }
  41345. }
  41346. // Remove the open elements from the stack
  41347. stack.length = pos;
  41348. lastTag = pos && stack[pos - 1].tag;
  41349. } else if (lowerCasedTagName === 'br') {
  41350. if (options.start) {
  41351. options.start(tagName, [], true, start, end);
  41352. }
  41353. } else if (lowerCasedTagName === 'p') {
  41354. if (options.start) {
  41355. options.start(tagName, [], false, start, end);
  41356. }
  41357. if (options.end) {
  41358. options.end(tagName, start, end);
  41359. }
  41360. }
  41361. }
  41362. }
  41363. /* */
  41364. var onRE = /^@|^v-on:/;
  41365. var dirRE = /^v-|^@|^:/;
  41366. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  41367. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  41368. var stripParensRE = /^\(|\)$/g;
  41369. var dynamicArgRE = /^\[.*\]$/;
  41370. var argRE = /:(.*)$/;
  41371. var bindRE = /^:|^\.|^v-bind:/;
  41372. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  41373. var slotRE = /^v-slot(:|$)|^#/;
  41374. var lineBreakRE = /[\r\n]/;
  41375. var whitespaceRE$1 = /\s+/g;
  41376. var invalidAttributeRE = /[\s"'<>\/=]/;
  41377. var decodeHTMLCached = cached(he.decode);
  41378. var emptySlotScopeToken = "_empty_";
  41379. // configurable state
  41380. var warn$2;
  41381. var delimiters;
  41382. var transforms;
  41383. var preTransforms;
  41384. var postTransforms;
  41385. var platformIsPreTag;
  41386. var platformMustUseProp;
  41387. var platformGetTagNamespace;
  41388. var maybeComponent;
  41389. function createASTElement (
  41390. tag,
  41391. attrs,
  41392. parent
  41393. ) {
  41394. return {
  41395. type: 1,
  41396. tag: tag,
  41397. attrsList: attrs,
  41398. attrsMap: makeAttrsMap(attrs),
  41399. rawAttrsMap: {},
  41400. parent: parent,
  41401. children: []
  41402. }
  41403. }
  41404. /**
  41405. * Convert HTML string to AST.
  41406. */
  41407. function parse (
  41408. template,
  41409. options
  41410. ) {
  41411. warn$2 = options.warn || baseWarn;
  41412. platformIsPreTag = options.isPreTag || no;
  41413. platformMustUseProp = options.mustUseProp || no;
  41414. platformGetTagNamespace = options.getTagNamespace || no;
  41415. var isReservedTag = options.isReservedTag || no;
  41416. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  41417. transforms = pluckModuleFunction(options.modules, 'transformNode');
  41418. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  41419. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  41420. delimiters = options.delimiters;
  41421. var stack = [];
  41422. var preserveWhitespace = options.preserveWhitespace !== false;
  41423. var whitespaceOption = options.whitespace;
  41424. var root;
  41425. var currentParent;
  41426. var inVPre = false;
  41427. var inPre = false;
  41428. var warned = false;
  41429. function warnOnce (msg, range) {
  41430. if (!warned) {
  41431. warned = true;
  41432. warn$2(msg, range);
  41433. }
  41434. }
  41435. function closeElement (element) {
  41436. trimEndingWhitespace(element);
  41437. if (!inVPre && !element.processed) {
  41438. element = processElement(element, options);
  41439. }
  41440. // tree management
  41441. if (!stack.length && element !== root) {
  41442. // allow root elements with v-if, v-else-if and v-else
  41443. if (root.if && (element.elseif || element.else)) {
  41444. {
  41445. checkRootConstraints(element);
  41446. }
  41447. addIfCondition(root, {
  41448. exp: element.elseif,
  41449. block: element
  41450. });
  41451. } else {
  41452. warnOnce(
  41453. "Component template should contain exactly one root element. " +
  41454. "If you are using v-if on multiple elements, " +
  41455. "use v-else-if to chain them instead.",
  41456. { start: element.start }
  41457. );
  41458. }
  41459. }
  41460. if (currentParent && !element.forbidden) {
  41461. if (element.elseif || element.else) {
  41462. processIfConditions(element, currentParent);
  41463. } else {
  41464. if (element.slotScope) {
  41465. // scoped slot
  41466. // keep it in the children list so that v-else(-if) conditions can
  41467. // find it as the prev node.
  41468. var name = element.slotTarget || '"default"'
  41469. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  41470. }
  41471. currentParent.children.push(element);
  41472. element.parent = currentParent;
  41473. }
  41474. }
  41475. // final children cleanup
  41476. // filter out scoped slots
  41477. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  41478. // remove trailing whitespace node again
  41479. trimEndingWhitespace(element);
  41480. // check pre state
  41481. if (element.pre) {
  41482. inVPre = false;
  41483. }
  41484. if (platformIsPreTag(element.tag)) {
  41485. inPre = false;
  41486. }
  41487. // apply post-transforms
  41488. for (var i = 0; i < postTransforms.length; i++) {
  41489. postTransforms[i](element, options);
  41490. }
  41491. }
  41492. function trimEndingWhitespace (el) {
  41493. // remove trailing whitespace node
  41494. if (!inPre) {
  41495. var lastNode;
  41496. while (
  41497. (lastNode = el.children[el.children.length - 1]) &&
  41498. lastNode.type === 3 &&
  41499. lastNode.text === ' '
  41500. ) {
  41501. el.children.pop();
  41502. }
  41503. }
  41504. }
  41505. function checkRootConstraints (el) {
  41506. if (el.tag === 'slot' || el.tag === 'template') {
  41507. warnOnce(
  41508. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  41509. 'contain multiple nodes.',
  41510. { start: el.start }
  41511. );
  41512. }
  41513. if (el.attrsMap.hasOwnProperty('v-for')) {
  41514. warnOnce(
  41515. 'Cannot use v-for on stateful component root element because ' +
  41516. 'it renders multiple elements.',
  41517. el.rawAttrsMap['v-for']
  41518. );
  41519. }
  41520. }
  41521. parseHTML(template, {
  41522. warn: warn$2,
  41523. expectHTML: options.expectHTML,
  41524. isUnaryTag: options.isUnaryTag,
  41525. canBeLeftOpenTag: options.canBeLeftOpenTag,
  41526. shouldDecodeNewlines: options.shouldDecodeNewlines,
  41527. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  41528. shouldKeepComment: options.comments,
  41529. outputSourceRange: options.outputSourceRange,
  41530. start: function start (tag, attrs, unary, start$1, end) {
  41531. // check namespace.
  41532. // inherit parent ns if there is one
  41533. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  41534. // handle IE svg bug
  41535. /* istanbul ignore if */
  41536. if (isIE && ns === 'svg') {
  41537. attrs = guardIESVGBug(attrs);
  41538. }
  41539. var element = createASTElement(tag, attrs, currentParent);
  41540. if (ns) {
  41541. element.ns = ns;
  41542. }
  41543. {
  41544. if (options.outputSourceRange) {
  41545. element.start = start$1;
  41546. element.end = end;
  41547. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  41548. cumulated[attr.name] = attr;
  41549. return cumulated
  41550. }, {});
  41551. }
  41552. attrs.forEach(function (attr) {
  41553. if (invalidAttributeRE.test(attr.name)) {
  41554. warn$2(
  41555. "Invalid dynamic argument expression: attribute names cannot contain " +
  41556. "spaces, quotes, <, >, / or =.",
  41557. {
  41558. start: attr.start + attr.name.indexOf("["),
  41559. end: attr.start + attr.name.length
  41560. }
  41561. );
  41562. }
  41563. });
  41564. }
  41565. if (isForbiddenTag(element) && !isServerRendering()) {
  41566. element.forbidden = true;
  41567. warn$2(
  41568. 'Templates should only be responsible for mapping the state to the ' +
  41569. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41570. "<" + tag + ">" + ', as they will not be parsed.',
  41571. { start: element.start }
  41572. );
  41573. }
  41574. // apply pre-transforms
  41575. for (var i = 0; i < preTransforms.length; i++) {
  41576. element = preTransforms[i](element, options) || element;
  41577. }
  41578. if (!inVPre) {
  41579. processPre(element);
  41580. if (element.pre) {
  41581. inVPre = true;
  41582. }
  41583. }
  41584. if (platformIsPreTag(element.tag)) {
  41585. inPre = true;
  41586. }
  41587. if (inVPre) {
  41588. processRawAttrs(element);
  41589. } else if (!element.processed) {
  41590. // structural directives
  41591. processFor(element);
  41592. processIf(element);
  41593. processOnce(element);
  41594. }
  41595. if (!root) {
  41596. root = element;
  41597. {
  41598. checkRootConstraints(root);
  41599. }
  41600. }
  41601. if (!unary) {
  41602. currentParent = element;
  41603. stack.push(element);
  41604. } else {
  41605. closeElement(element);
  41606. }
  41607. },
  41608. end: function end (tag, start, end$1) {
  41609. var element = stack[stack.length - 1];
  41610. // pop stack
  41611. stack.length -= 1;
  41612. currentParent = stack[stack.length - 1];
  41613. if (options.outputSourceRange) {
  41614. element.end = end$1;
  41615. }
  41616. closeElement(element);
  41617. },
  41618. chars: function chars (text, start, end) {
  41619. if (!currentParent) {
  41620. {
  41621. if (text === template) {
  41622. warnOnce(
  41623. 'Component template requires a root element, rather than just text.',
  41624. { start: start }
  41625. );
  41626. } else if ((text = text.trim())) {
  41627. warnOnce(
  41628. ("text \"" + text + "\" outside root element will be ignored."),
  41629. { start: start }
  41630. );
  41631. }
  41632. }
  41633. return
  41634. }
  41635. // IE textarea placeholder bug
  41636. /* istanbul ignore if */
  41637. if (isIE &&
  41638. currentParent.tag === 'textarea' &&
  41639. currentParent.attrsMap.placeholder === text
  41640. ) {
  41641. return
  41642. }
  41643. var children = currentParent.children;
  41644. if (inPre || text.trim()) {
  41645. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41646. } else if (!children.length) {
  41647. // remove the whitespace-only node right after an opening tag
  41648. text = '';
  41649. } else if (whitespaceOption) {
  41650. if (whitespaceOption === 'condense') {
  41651. // in condense mode, remove the whitespace node if it contains
  41652. // line break, otherwise condense to a single space
  41653. text = lineBreakRE.test(text) ? '' : ' ';
  41654. } else {
  41655. text = ' ';
  41656. }
  41657. } else {
  41658. text = preserveWhitespace ? ' ' : '';
  41659. }
  41660. if (text) {
  41661. if (!inPre && whitespaceOption === 'condense') {
  41662. // condense consecutive whitespaces into single space
  41663. text = text.replace(whitespaceRE$1, ' ');
  41664. }
  41665. var res;
  41666. var child;
  41667. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41668. child = {
  41669. type: 2,
  41670. expression: res.expression,
  41671. tokens: res.tokens,
  41672. text: text
  41673. };
  41674. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41675. child = {
  41676. type: 3,
  41677. text: text
  41678. };
  41679. }
  41680. if (child) {
  41681. if (options.outputSourceRange) {
  41682. child.start = start;
  41683. child.end = end;
  41684. }
  41685. children.push(child);
  41686. }
  41687. }
  41688. },
  41689. comment: function comment (text, start, end) {
  41690. // adding anyting as a sibling to the root node is forbidden
  41691. // comments should still be allowed, but ignored
  41692. if (currentParent) {
  41693. var child = {
  41694. type: 3,
  41695. text: text,
  41696. isComment: true
  41697. };
  41698. if (options.outputSourceRange) {
  41699. child.start = start;
  41700. child.end = end;
  41701. }
  41702. currentParent.children.push(child);
  41703. }
  41704. }
  41705. });
  41706. return root
  41707. }
  41708. function processPre (el) {
  41709. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41710. el.pre = true;
  41711. }
  41712. }
  41713. function processRawAttrs (el) {
  41714. var list = el.attrsList;
  41715. var len = list.length;
  41716. if (len) {
  41717. var attrs = el.attrs = new Array(len);
  41718. for (var i = 0; i < len; i++) {
  41719. attrs[i] = {
  41720. name: list[i].name,
  41721. value: JSON.stringify(list[i].value)
  41722. };
  41723. if (list[i].start != null) {
  41724. attrs[i].start = list[i].start;
  41725. attrs[i].end = list[i].end;
  41726. }
  41727. }
  41728. } else if (!el.pre) {
  41729. // non root node in pre blocks with no attributes
  41730. el.plain = true;
  41731. }
  41732. }
  41733. function processElement (
  41734. element,
  41735. options
  41736. ) {
  41737. processKey(element);
  41738. // determine whether this is a plain element after
  41739. // removing structural attributes
  41740. element.plain = (
  41741. !element.key &&
  41742. !element.scopedSlots &&
  41743. !element.attrsList.length
  41744. );
  41745. processRef(element);
  41746. processSlotContent(element);
  41747. processSlotOutlet(element);
  41748. processComponent(element);
  41749. for (var i = 0; i < transforms.length; i++) {
  41750. element = transforms[i](element, options) || element;
  41751. }
  41752. processAttrs(element);
  41753. return element
  41754. }
  41755. function processKey (el) {
  41756. var exp = getBindingAttr(el, 'key');
  41757. if (exp) {
  41758. {
  41759. if (el.tag === 'template') {
  41760. warn$2(
  41761. "<template> cannot be keyed. Place the key on real elements instead.",
  41762. getRawBindingAttr(el, 'key')
  41763. );
  41764. }
  41765. if (el.for) {
  41766. var iterator = el.iterator2 || el.iterator1;
  41767. var parent = el.parent;
  41768. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41769. warn$2(
  41770. "Do not use v-for index as key on <transition-group> children, " +
  41771. "this is the same as not using keys.",
  41772. getRawBindingAttr(el, 'key'),
  41773. true /* tip */
  41774. );
  41775. }
  41776. }
  41777. }
  41778. el.key = exp;
  41779. }
  41780. }
  41781. function processRef (el) {
  41782. var ref = getBindingAttr(el, 'ref');
  41783. if (ref) {
  41784. el.ref = ref;
  41785. el.refInFor = checkInFor(el);
  41786. }
  41787. }
  41788. function processFor (el) {
  41789. var exp;
  41790. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41791. var res = parseFor(exp);
  41792. if (res) {
  41793. extend(el, res);
  41794. } else {
  41795. warn$2(
  41796. ("Invalid v-for expression: " + exp),
  41797. el.rawAttrsMap['v-for']
  41798. );
  41799. }
  41800. }
  41801. }
  41802. function parseFor (exp) {
  41803. var inMatch = exp.match(forAliasRE);
  41804. if (!inMatch) { return }
  41805. var res = {};
  41806. res.for = inMatch[2].trim();
  41807. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41808. var iteratorMatch = alias.match(forIteratorRE);
  41809. if (iteratorMatch) {
  41810. res.alias = alias.replace(forIteratorRE, '').trim();
  41811. res.iterator1 = iteratorMatch[1].trim();
  41812. if (iteratorMatch[2]) {
  41813. res.iterator2 = iteratorMatch[2].trim();
  41814. }
  41815. } else {
  41816. res.alias = alias;
  41817. }
  41818. return res
  41819. }
  41820. function processIf (el) {
  41821. var exp = getAndRemoveAttr(el, 'v-if');
  41822. if (exp) {
  41823. el.if = exp;
  41824. addIfCondition(el, {
  41825. exp: exp,
  41826. block: el
  41827. });
  41828. } else {
  41829. if (getAndRemoveAttr(el, 'v-else') != null) {
  41830. el.else = true;
  41831. }
  41832. var elseif = getAndRemoveAttr(el, 'v-else-if');
  41833. if (elseif) {
  41834. el.elseif = elseif;
  41835. }
  41836. }
  41837. }
  41838. function processIfConditions (el, parent) {
  41839. var prev = findPrevElement(parent.children);
  41840. if (prev && prev.if) {
  41841. addIfCondition(prev, {
  41842. exp: el.elseif,
  41843. block: el
  41844. });
  41845. } else {
  41846. warn$2(
  41847. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  41848. "used on element <" + (el.tag) + "> without corresponding v-if.",
  41849. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  41850. );
  41851. }
  41852. }
  41853. function findPrevElement (children) {
  41854. var i = children.length;
  41855. while (i--) {
  41856. if (children[i].type === 1) {
  41857. return children[i]
  41858. } else {
  41859. if (children[i].text !== ' ') {
  41860. warn$2(
  41861. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  41862. "will be ignored.",
  41863. children[i]
  41864. );
  41865. }
  41866. children.pop();
  41867. }
  41868. }
  41869. }
  41870. function addIfCondition (el, condition) {
  41871. if (!el.ifConditions) {
  41872. el.ifConditions = [];
  41873. }
  41874. el.ifConditions.push(condition);
  41875. }
  41876. function processOnce (el) {
  41877. var once$$1 = getAndRemoveAttr(el, 'v-once');
  41878. if (once$$1 != null) {
  41879. el.once = true;
  41880. }
  41881. }
  41882. // handle content being passed to a component as slot,
  41883. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  41884. function processSlotContent (el) {
  41885. var slotScope;
  41886. if (el.tag === 'template') {
  41887. slotScope = getAndRemoveAttr(el, 'scope');
  41888. /* istanbul ignore if */
  41889. if (slotScope) {
  41890. warn$2(
  41891. "the \"scope\" attribute for scoped slots have been deprecated and " +
  41892. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  41893. "can also be used on plain elements in addition to <template> to " +
  41894. "denote scoped slots.",
  41895. el.rawAttrsMap['scope'],
  41896. true
  41897. );
  41898. }
  41899. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  41900. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  41901. /* istanbul ignore if */
  41902. if (el.attrsMap['v-for']) {
  41903. warn$2(
  41904. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  41905. "(v-for takes higher priority). Use a wrapper <template> for the " +
  41906. "scoped slot to make it clearer.",
  41907. el.rawAttrsMap['slot-scope'],
  41908. true
  41909. );
  41910. }
  41911. el.slotScope = slotScope;
  41912. }
  41913. // slot="xxx"
  41914. var slotTarget = getBindingAttr(el, 'slot');
  41915. if (slotTarget) {
  41916. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  41917. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  41918. // preserve slot as an attribute for native shadow DOM compat
  41919. // only for non-scoped slots.
  41920. if (el.tag !== 'template' && !el.slotScope) {
  41921. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  41922. }
  41923. }
  41924. // 2.6 v-slot syntax
  41925. {
  41926. if (el.tag === 'template') {
  41927. // v-slot on <template>
  41928. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  41929. if (slotBinding) {
  41930. {
  41931. if (el.slotTarget || el.slotScope) {
  41932. warn$2(
  41933. "Unexpected mixed usage of different slot syntaxes.",
  41934. el
  41935. );
  41936. }
  41937. if (el.parent && !maybeComponent(el.parent)) {
  41938. warn$2(
  41939. "<template v-slot> can only appear at the root level inside " +
  41940. "the receiving the component",
  41941. el
  41942. );
  41943. }
  41944. }
  41945. var ref = getSlotName(slotBinding);
  41946. var name = ref.name;
  41947. var dynamic = ref.dynamic;
  41948. el.slotTarget = name;
  41949. el.slotTargetDynamic = dynamic;
  41950. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  41951. }
  41952. } else {
  41953. // v-slot on component, denotes default slot
  41954. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  41955. if (slotBinding$1) {
  41956. {
  41957. if (!maybeComponent(el)) {
  41958. warn$2(
  41959. "v-slot can only be used on components or <template>.",
  41960. slotBinding$1
  41961. );
  41962. }
  41963. if (el.slotScope || el.slotTarget) {
  41964. warn$2(
  41965. "Unexpected mixed usage of different slot syntaxes.",
  41966. el
  41967. );
  41968. }
  41969. if (el.scopedSlots) {
  41970. warn$2(
  41971. "To avoid scope ambiguity, the default slot should also use " +
  41972. "<template> syntax when there are other named slots.",
  41973. slotBinding$1
  41974. );
  41975. }
  41976. }
  41977. // add the component's children to its default slot
  41978. var slots = el.scopedSlots || (el.scopedSlots = {});
  41979. var ref$1 = getSlotName(slotBinding$1);
  41980. var name$1 = ref$1.name;
  41981. var dynamic$1 = ref$1.dynamic;
  41982. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  41983. slotContainer.slotTarget = name$1;
  41984. slotContainer.slotTargetDynamic = dynamic$1;
  41985. slotContainer.children = el.children.filter(function (c) {
  41986. if (!c.slotScope) {
  41987. c.parent = slotContainer;
  41988. return true
  41989. }
  41990. });
  41991. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  41992. // remove children as they are returned from scopedSlots now
  41993. el.children = [];
  41994. // mark el non-plain so data gets generated
  41995. el.plain = false;
  41996. }
  41997. }
  41998. }
  41999. }
  42000. function getSlotName (binding) {
  42001. var name = binding.name.replace(slotRE, '');
  42002. if (!name) {
  42003. if (binding.name[0] !== '#') {
  42004. name = 'default';
  42005. } else {
  42006. warn$2(
  42007. "v-slot shorthand syntax requires a slot name.",
  42008. binding
  42009. );
  42010. }
  42011. }
  42012. return dynamicArgRE.test(name)
  42013. // dynamic [name]
  42014. ? { name: name.slice(1, -1), dynamic: true }
  42015. // static name
  42016. : { name: ("\"" + name + "\""), dynamic: false }
  42017. }
  42018. // handle <slot/> outlets
  42019. function processSlotOutlet (el) {
  42020. if (el.tag === 'slot') {
  42021. el.slotName = getBindingAttr(el, 'name');
  42022. if (el.key) {
  42023. warn$2(
  42024. "`key` does not work on <slot> because slots are abstract outlets " +
  42025. "and can possibly expand into multiple elements. " +
  42026. "Use the key on a wrapping element instead.",
  42027. getRawBindingAttr(el, 'key')
  42028. );
  42029. }
  42030. }
  42031. }
  42032. function processComponent (el) {
  42033. var binding;
  42034. if ((binding = getBindingAttr(el, 'is'))) {
  42035. el.component = binding;
  42036. }
  42037. if (getAndRemoveAttr(el, 'inline-template') != null) {
  42038. el.inlineTemplate = true;
  42039. }
  42040. }
  42041. function processAttrs (el) {
  42042. var list = el.attrsList;
  42043. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  42044. for (i = 0, l = list.length; i < l; i++) {
  42045. name = rawName = list[i].name;
  42046. value = list[i].value;
  42047. if (dirRE.test(name)) {
  42048. // mark element as dynamic
  42049. el.hasBindings = true;
  42050. // modifiers
  42051. modifiers = parseModifiers(name.replace(dirRE, ''));
  42052. // support .foo shorthand syntax for the .prop modifier
  42053. if (modifiers) {
  42054. name = name.replace(modifierRE, '');
  42055. }
  42056. if (bindRE.test(name)) { // v-bind
  42057. name = name.replace(bindRE, '');
  42058. value = parseFilters(value);
  42059. isDynamic = dynamicArgRE.test(name);
  42060. if (isDynamic) {
  42061. name = name.slice(1, -1);
  42062. }
  42063. if (
  42064. value.trim().length === 0
  42065. ) {
  42066. warn$2(
  42067. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  42068. );
  42069. }
  42070. if (modifiers) {
  42071. if (modifiers.prop && !isDynamic) {
  42072. name = camelize(name);
  42073. if (name === 'innerHtml') { name = 'innerHTML'; }
  42074. }
  42075. if (modifiers.camel && !isDynamic) {
  42076. name = camelize(name);
  42077. }
  42078. if (modifiers.sync) {
  42079. syncGen = genAssignmentCode(value, "$event");
  42080. if (!isDynamic) {
  42081. addHandler(
  42082. el,
  42083. ("update:" + (camelize(name))),
  42084. syncGen,
  42085. null,
  42086. false,
  42087. warn$2,
  42088. list[i]
  42089. );
  42090. if (hyphenate(name) !== camelize(name)) {
  42091. addHandler(
  42092. el,
  42093. ("update:" + (hyphenate(name))),
  42094. syncGen,
  42095. null,
  42096. false,
  42097. warn$2,
  42098. list[i]
  42099. );
  42100. }
  42101. } else {
  42102. // handler w/ dynamic event name
  42103. addHandler(
  42104. el,
  42105. ("\"update:\"+(" + name + ")"),
  42106. syncGen,
  42107. null,
  42108. false,
  42109. warn$2,
  42110. list[i],
  42111. true // dynamic
  42112. );
  42113. }
  42114. }
  42115. }
  42116. if ((modifiers && modifiers.prop) || (
  42117. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  42118. )) {
  42119. addProp(el, name, value, list[i], isDynamic);
  42120. } else {
  42121. addAttr(el, name, value, list[i], isDynamic);
  42122. }
  42123. } else if (onRE.test(name)) { // v-on
  42124. name = name.replace(onRE, '');
  42125. isDynamic = dynamicArgRE.test(name);
  42126. if (isDynamic) {
  42127. name = name.slice(1, -1);
  42128. }
  42129. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  42130. } else { // normal directives
  42131. name = name.replace(dirRE, '');
  42132. // parse arg
  42133. var argMatch = name.match(argRE);
  42134. var arg = argMatch && argMatch[1];
  42135. isDynamic = false;
  42136. if (arg) {
  42137. name = name.slice(0, -(arg.length + 1));
  42138. if (dynamicArgRE.test(arg)) {
  42139. arg = arg.slice(1, -1);
  42140. isDynamic = true;
  42141. }
  42142. }
  42143. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  42144. if (name === 'model') {
  42145. checkForAliasModel(el, value);
  42146. }
  42147. }
  42148. } else {
  42149. // literal attribute
  42150. {
  42151. var res = parseText(value, delimiters);
  42152. if (res) {
  42153. warn$2(
  42154. name + "=\"" + value + "\": " +
  42155. 'Interpolation inside attributes has been removed. ' +
  42156. 'Use v-bind or the colon shorthand instead. For example, ' +
  42157. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  42158. list[i]
  42159. );
  42160. }
  42161. }
  42162. addAttr(el, name, JSON.stringify(value), list[i]);
  42163. // #6887 firefox doesn't update muted state if set via attribute
  42164. // even immediately after element creation
  42165. if (!el.component &&
  42166. name === 'muted' &&
  42167. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  42168. addProp(el, name, 'true', list[i]);
  42169. }
  42170. }
  42171. }
  42172. }
  42173. function checkInFor (el) {
  42174. var parent = el;
  42175. while (parent) {
  42176. if (parent.for !== undefined) {
  42177. return true
  42178. }
  42179. parent = parent.parent;
  42180. }
  42181. return false
  42182. }
  42183. function parseModifiers (name) {
  42184. var match = name.match(modifierRE);
  42185. if (match) {
  42186. var ret = {};
  42187. match.forEach(function (m) { ret[m.slice(1)] = true; });
  42188. return ret
  42189. }
  42190. }
  42191. function makeAttrsMap (attrs) {
  42192. var map = {};
  42193. for (var i = 0, l = attrs.length; i < l; i++) {
  42194. if (
  42195. map[attrs[i].name] && !isIE && !isEdge
  42196. ) {
  42197. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  42198. }
  42199. map[attrs[i].name] = attrs[i].value;
  42200. }
  42201. return map
  42202. }
  42203. // for script (e.g. type="x/template") or style, do not decode content
  42204. function isTextTag (el) {
  42205. return el.tag === 'script' || el.tag === 'style'
  42206. }
  42207. function isForbiddenTag (el) {
  42208. return (
  42209. el.tag === 'style' ||
  42210. (el.tag === 'script' && (
  42211. !el.attrsMap.type ||
  42212. el.attrsMap.type === 'text/javascript'
  42213. ))
  42214. )
  42215. }
  42216. var ieNSBug = /^xmlns:NS\d+/;
  42217. var ieNSPrefix = /^NS\d+:/;
  42218. /* istanbul ignore next */
  42219. function guardIESVGBug (attrs) {
  42220. var res = [];
  42221. for (var i = 0; i < attrs.length; i++) {
  42222. var attr = attrs[i];
  42223. if (!ieNSBug.test(attr.name)) {
  42224. attr.name = attr.name.replace(ieNSPrefix, '');
  42225. res.push(attr);
  42226. }
  42227. }
  42228. return res
  42229. }
  42230. function checkForAliasModel (el, value) {
  42231. var _el = el;
  42232. while (_el) {
  42233. if (_el.for && _el.alias === value) {
  42234. warn$2(
  42235. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  42236. "You are binding v-model directly to a v-for iteration alias. " +
  42237. "This will not be able to modify the v-for source array because " +
  42238. "writing to the alias is like modifying a function local variable. " +
  42239. "Consider using an array of objects and use v-model on an object property instead.",
  42240. el.rawAttrsMap['v-model']
  42241. );
  42242. }
  42243. _el = _el.parent;
  42244. }
  42245. }
  42246. /* */
  42247. function preTransformNode (el, options) {
  42248. if (el.tag === 'input') {
  42249. var map = el.attrsMap;
  42250. if (!map['v-model']) {
  42251. return
  42252. }
  42253. var typeBinding;
  42254. if (map[':type'] || map['v-bind:type']) {
  42255. typeBinding = getBindingAttr(el, 'type');
  42256. }
  42257. if (!map.type && !typeBinding && map['v-bind']) {
  42258. typeBinding = "(" + (map['v-bind']) + ").type";
  42259. }
  42260. if (typeBinding) {
  42261. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  42262. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  42263. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  42264. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  42265. // 1. checkbox
  42266. var branch0 = cloneASTElement(el);
  42267. // process for on the main node
  42268. processFor(branch0);
  42269. addRawAttr(branch0, 'type', 'checkbox');
  42270. processElement(branch0, options);
  42271. branch0.processed = true; // prevent it from double-processed
  42272. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  42273. addIfCondition(branch0, {
  42274. exp: branch0.if,
  42275. block: branch0
  42276. });
  42277. // 2. add radio else-if condition
  42278. var branch1 = cloneASTElement(el);
  42279. getAndRemoveAttr(branch1, 'v-for', true);
  42280. addRawAttr(branch1, 'type', 'radio');
  42281. processElement(branch1, options);
  42282. addIfCondition(branch0, {
  42283. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  42284. block: branch1
  42285. });
  42286. // 3. other
  42287. var branch2 = cloneASTElement(el);
  42288. getAndRemoveAttr(branch2, 'v-for', true);
  42289. addRawAttr(branch2, ':type', typeBinding);
  42290. processElement(branch2, options);
  42291. addIfCondition(branch0, {
  42292. exp: ifCondition,
  42293. block: branch2
  42294. });
  42295. if (hasElse) {
  42296. branch0.else = true;
  42297. } else if (elseIfCondition) {
  42298. branch0.elseif = elseIfCondition;
  42299. }
  42300. return branch0
  42301. }
  42302. }
  42303. }
  42304. function cloneASTElement (el) {
  42305. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  42306. }
  42307. var model$1 = {
  42308. preTransformNode: preTransformNode
  42309. };
  42310. var modules$1 = [
  42311. klass$1,
  42312. style$1,
  42313. model$1
  42314. ];
  42315. /* */
  42316. function text (el, dir) {
  42317. if (dir.value) {
  42318. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  42319. }
  42320. }
  42321. /* */
  42322. function html (el, dir) {
  42323. if (dir.value) {
  42324. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  42325. }
  42326. }
  42327. var directives$1 = {
  42328. model: model,
  42329. text: text,
  42330. html: html
  42331. };
  42332. /* */
  42333. var baseOptions = {
  42334. expectHTML: true,
  42335. modules: modules$1,
  42336. directives: directives$1,
  42337. isPreTag: isPreTag,
  42338. isUnaryTag: isUnaryTag,
  42339. mustUseProp: mustUseProp,
  42340. canBeLeftOpenTag: canBeLeftOpenTag,
  42341. isReservedTag: isReservedTag,
  42342. getTagNamespace: getTagNamespace,
  42343. staticKeys: genStaticKeys(modules$1)
  42344. };
  42345. /* */
  42346. var isStaticKey;
  42347. var isPlatformReservedTag;
  42348. var genStaticKeysCached = cached(genStaticKeys$1);
  42349. /**
  42350. * Goal of the optimizer: walk the generated template AST tree
  42351. * and detect sub-trees that are purely static, i.e. parts of
  42352. * the DOM that never needs to change.
  42353. *
  42354. * Once we detect these sub-trees, we can:
  42355. *
  42356. * 1. Hoist them into constants, so that we no longer need to
  42357. * create fresh nodes for them on each re-render;
  42358. * 2. Completely skip them in the patching process.
  42359. */
  42360. function optimize (root, options) {
  42361. if (!root) { return }
  42362. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  42363. isPlatformReservedTag = options.isReservedTag || no;
  42364. // first pass: mark all non-static nodes.
  42365. markStatic$1(root);
  42366. // second pass: mark static roots.
  42367. markStaticRoots(root, false);
  42368. }
  42369. function genStaticKeys$1 (keys) {
  42370. return makeMap(
  42371. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  42372. (keys ? ',' + keys : '')
  42373. )
  42374. }
  42375. function markStatic$1 (node) {
  42376. node.static = isStatic(node);
  42377. if (node.type === 1) {
  42378. // do not make component slot content static. this avoids
  42379. // 1. components not able to mutate slot nodes
  42380. // 2. static slot content fails for hot-reloading
  42381. if (
  42382. !isPlatformReservedTag(node.tag) &&
  42383. node.tag !== 'slot' &&
  42384. node.attrsMap['inline-template'] == null
  42385. ) {
  42386. return
  42387. }
  42388. for (var i = 0, l = node.children.length; i < l; i++) {
  42389. var child = node.children[i];
  42390. markStatic$1(child);
  42391. if (!child.static) {
  42392. node.static = false;
  42393. }
  42394. }
  42395. if (node.ifConditions) {
  42396. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42397. var block = node.ifConditions[i$1].block;
  42398. markStatic$1(block);
  42399. if (!block.static) {
  42400. node.static = false;
  42401. }
  42402. }
  42403. }
  42404. }
  42405. }
  42406. function markStaticRoots (node, isInFor) {
  42407. if (node.type === 1) {
  42408. if (node.static || node.once) {
  42409. node.staticInFor = isInFor;
  42410. }
  42411. // For a node to qualify as a static root, it should have children that
  42412. // are not just static text. Otherwise the cost of hoisting out will
  42413. // outweigh the benefits and it's better off to just always render it fresh.
  42414. if (node.static && node.children.length && !(
  42415. node.children.length === 1 &&
  42416. node.children[0].type === 3
  42417. )) {
  42418. node.staticRoot = true;
  42419. return
  42420. } else {
  42421. node.staticRoot = false;
  42422. }
  42423. if (node.children) {
  42424. for (var i = 0, l = node.children.length; i < l; i++) {
  42425. markStaticRoots(node.children[i], isInFor || !!node.for);
  42426. }
  42427. }
  42428. if (node.ifConditions) {
  42429. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42430. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  42431. }
  42432. }
  42433. }
  42434. }
  42435. function isStatic (node) {
  42436. if (node.type === 2) { // expression
  42437. return false
  42438. }
  42439. if (node.type === 3) { // text
  42440. return true
  42441. }
  42442. return !!(node.pre || (
  42443. !node.hasBindings && // no dynamic bindings
  42444. !node.if && !node.for && // not v-if or v-for or v-else
  42445. !isBuiltInTag(node.tag) && // not a built-in
  42446. isPlatformReservedTag(node.tag) && // not a component
  42447. !isDirectChildOfTemplateFor(node) &&
  42448. Object.keys(node).every(isStaticKey)
  42449. ))
  42450. }
  42451. function isDirectChildOfTemplateFor (node) {
  42452. while (node.parent) {
  42453. node = node.parent;
  42454. if (node.tag !== 'template') {
  42455. return false
  42456. }
  42457. if (node.for) {
  42458. return true
  42459. }
  42460. }
  42461. return false
  42462. }
  42463. /* */
  42464. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  42465. var fnInvokeRE = /\([^)]*?\);*$/;
  42466. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  42467. // KeyboardEvent.keyCode aliases
  42468. var keyCodes = {
  42469. esc: 27,
  42470. tab: 9,
  42471. enter: 13,
  42472. space: 32,
  42473. up: 38,
  42474. left: 37,
  42475. right: 39,
  42476. down: 40,
  42477. 'delete': [8, 46]
  42478. };
  42479. // KeyboardEvent.key aliases
  42480. var keyNames = {
  42481. // #7880: IE11 and Edge use `Esc` for Escape key name.
  42482. esc: ['Esc', 'Escape'],
  42483. tab: 'Tab',
  42484. enter: 'Enter',
  42485. // #9112: IE11 uses `Spacebar` for Space key name.
  42486. space: [' ', 'Spacebar'],
  42487. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  42488. up: ['Up', 'ArrowUp'],
  42489. left: ['Left', 'ArrowLeft'],
  42490. right: ['Right', 'ArrowRight'],
  42491. down: ['Down', 'ArrowDown'],
  42492. // #9112: IE11 uses `Del` for Delete key name.
  42493. 'delete': ['Backspace', 'Delete', 'Del']
  42494. };
  42495. // #4868: modifiers that prevent the execution of the listener
  42496. // need to explicitly return null so that we can determine whether to remove
  42497. // the listener for .once
  42498. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  42499. var modifierCode = {
  42500. stop: '$event.stopPropagation();',
  42501. prevent: '$event.preventDefault();',
  42502. self: genGuard("$event.target !== $event.currentTarget"),
  42503. ctrl: genGuard("!$event.ctrlKey"),
  42504. shift: genGuard("!$event.shiftKey"),
  42505. alt: genGuard("!$event.altKey"),
  42506. meta: genGuard("!$event.metaKey"),
  42507. left: genGuard("'button' in $event && $event.button !== 0"),
  42508. middle: genGuard("'button' in $event && $event.button !== 1"),
  42509. right: genGuard("'button' in $event && $event.button !== 2")
  42510. };
  42511. function genHandlers (
  42512. events,
  42513. isNative
  42514. ) {
  42515. var prefix = isNative ? 'nativeOn:' : 'on:';
  42516. var staticHandlers = "";
  42517. var dynamicHandlers = "";
  42518. for (var name in events) {
  42519. var handlerCode = genHandler(events[name]);
  42520. if (events[name] && events[name].dynamic) {
  42521. dynamicHandlers += name + "," + handlerCode + ",";
  42522. } else {
  42523. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  42524. }
  42525. }
  42526. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  42527. if (dynamicHandlers) {
  42528. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  42529. } else {
  42530. return prefix + staticHandlers
  42531. }
  42532. }
  42533. function genHandler (handler) {
  42534. if (!handler) {
  42535. return 'function(){}'
  42536. }
  42537. if (Array.isArray(handler)) {
  42538. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  42539. }
  42540. var isMethodPath = simplePathRE.test(handler.value);
  42541. var isFunctionExpression = fnExpRE.test(handler.value);
  42542. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  42543. if (!handler.modifiers) {
  42544. if (isMethodPath || isFunctionExpression) {
  42545. return handler.value
  42546. }
  42547. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  42548. } else {
  42549. var code = '';
  42550. var genModifierCode = '';
  42551. var keys = [];
  42552. for (var key in handler.modifiers) {
  42553. if (modifierCode[key]) {
  42554. genModifierCode += modifierCode[key];
  42555. // left/right
  42556. if (keyCodes[key]) {
  42557. keys.push(key);
  42558. }
  42559. } else if (key === 'exact') {
  42560. var modifiers = (handler.modifiers);
  42561. genModifierCode += genGuard(
  42562. ['ctrl', 'shift', 'alt', 'meta']
  42563. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42564. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42565. .join('||')
  42566. );
  42567. } else {
  42568. keys.push(key);
  42569. }
  42570. }
  42571. if (keys.length) {
  42572. code += genKeyFilter(keys);
  42573. }
  42574. // Make sure modifiers like prevent and stop get executed after key filtering
  42575. if (genModifierCode) {
  42576. code += genModifierCode;
  42577. }
  42578. var handlerCode = isMethodPath
  42579. ? ("return " + (handler.value) + "($event)")
  42580. : isFunctionExpression
  42581. ? ("return (" + (handler.value) + ")($event)")
  42582. : isFunctionInvocation
  42583. ? ("return " + (handler.value))
  42584. : handler.value;
  42585. return ("function($event){" + code + handlerCode + "}")
  42586. }
  42587. }
  42588. function genKeyFilter (keys) {
  42589. return (
  42590. // make sure the key filters only apply to KeyboardEvents
  42591. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42592. // key events that do not have keyCode property...
  42593. "if(!$event.type.indexOf('key')&&" +
  42594. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42595. )
  42596. }
  42597. function genFilterCode (key) {
  42598. var keyVal = parseInt(key, 10);
  42599. if (keyVal) {
  42600. return ("$event.keyCode!==" + keyVal)
  42601. }
  42602. var keyCode = keyCodes[key];
  42603. var keyName = keyNames[key];
  42604. return (
  42605. "_k($event.keyCode," +
  42606. (JSON.stringify(key)) + "," +
  42607. (JSON.stringify(keyCode)) + "," +
  42608. "$event.key," +
  42609. "" + (JSON.stringify(keyName)) +
  42610. ")"
  42611. )
  42612. }
  42613. /* */
  42614. function on (el, dir) {
  42615. if (dir.modifiers) {
  42616. warn("v-on without argument does not support modifiers.");
  42617. }
  42618. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42619. }
  42620. /* */
  42621. function bind$1 (el, dir) {
  42622. el.wrapData = function (code) {
  42623. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42624. };
  42625. }
  42626. /* */
  42627. var baseDirectives = {
  42628. on: on,
  42629. bind: bind$1,
  42630. cloak: noop
  42631. };
  42632. /* */
  42633. var CodegenState = function CodegenState (options) {
  42634. this.options = options;
  42635. this.warn = options.warn || baseWarn;
  42636. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42637. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42638. this.directives = extend(extend({}, baseDirectives), options.directives);
  42639. var isReservedTag = options.isReservedTag || no;
  42640. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42641. this.onceId = 0;
  42642. this.staticRenderFns = [];
  42643. this.pre = false;
  42644. };
  42645. function generate (
  42646. ast,
  42647. options
  42648. ) {
  42649. var state = new CodegenState(options);
  42650. var code = ast ? genElement(ast, state) : '_c("div")';
  42651. return {
  42652. render: ("with(this){return " + code + "}"),
  42653. staticRenderFns: state.staticRenderFns
  42654. }
  42655. }
  42656. function genElement (el, state) {
  42657. if (el.parent) {
  42658. el.pre = el.pre || el.parent.pre;
  42659. }
  42660. if (el.staticRoot && !el.staticProcessed) {
  42661. return genStatic(el, state)
  42662. } else if (el.once && !el.onceProcessed) {
  42663. return genOnce(el, state)
  42664. } else if (el.for && !el.forProcessed) {
  42665. return genFor(el, state)
  42666. } else if (el.if && !el.ifProcessed) {
  42667. return genIf(el, state)
  42668. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42669. return genChildren(el, state) || 'void 0'
  42670. } else if (el.tag === 'slot') {
  42671. return genSlot(el, state)
  42672. } else {
  42673. // component or element
  42674. var code;
  42675. if (el.component) {
  42676. code = genComponent(el.component, el, state);
  42677. } else {
  42678. var data;
  42679. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42680. data = genData$2(el, state);
  42681. }
  42682. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42683. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42684. }
  42685. // module transforms
  42686. for (var i = 0; i < state.transforms.length; i++) {
  42687. code = state.transforms[i](el, code);
  42688. }
  42689. return code
  42690. }
  42691. }
  42692. // hoist static sub-trees out
  42693. function genStatic (el, state) {
  42694. el.staticProcessed = true;
  42695. // Some elements (templates) need to behave differently inside of a v-pre
  42696. // node. All pre nodes are static roots, so we can use this as a location to
  42697. // wrap a state change and reset it upon exiting the pre node.
  42698. var originalPreState = state.pre;
  42699. if (el.pre) {
  42700. state.pre = el.pre;
  42701. }
  42702. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42703. state.pre = originalPreState;
  42704. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42705. }
  42706. // v-once
  42707. function genOnce (el, state) {
  42708. el.onceProcessed = true;
  42709. if (el.if && !el.ifProcessed) {
  42710. return genIf(el, state)
  42711. } else if (el.staticInFor) {
  42712. var key = '';
  42713. var parent = el.parent;
  42714. while (parent) {
  42715. if (parent.for) {
  42716. key = parent.key;
  42717. break
  42718. }
  42719. parent = parent.parent;
  42720. }
  42721. if (!key) {
  42722. state.warn(
  42723. "v-once can only be used inside v-for that is keyed. ",
  42724. el.rawAttrsMap['v-once']
  42725. );
  42726. return genElement(el, state)
  42727. }
  42728. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42729. } else {
  42730. return genStatic(el, state)
  42731. }
  42732. }
  42733. function genIf (
  42734. el,
  42735. state,
  42736. altGen,
  42737. altEmpty
  42738. ) {
  42739. el.ifProcessed = true; // avoid recursion
  42740. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42741. }
  42742. function genIfConditions (
  42743. conditions,
  42744. state,
  42745. altGen,
  42746. altEmpty
  42747. ) {
  42748. if (!conditions.length) {
  42749. return altEmpty || '_e()'
  42750. }
  42751. var condition = conditions.shift();
  42752. if (condition.exp) {
  42753. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42754. } else {
  42755. return ("" + (genTernaryExp(condition.block)))
  42756. }
  42757. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42758. function genTernaryExp (el) {
  42759. return altGen
  42760. ? altGen(el, state)
  42761. : el.once
  42762. ? genOnce(el, state)
  42763. : genElement(el, state)
  42764. }
  42765. }
  42766. function genFor (
  42767. el,
  42768. state,
  42769. altGen,
  42770. altHelper
  42771. ) {
  42772. var exp = el.for;
  42773. var alias = el.alias;
  42774. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42775. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42776. if (state.maybeComponent(el) &&
  42777. el.tag !== 'slot' &&
  42778. el.tag !== 'template' &&
  42779. !el.key
  42780. ) {
  42781. state.warn(
  42782. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42783. "v-for should have explicit keys. " +
  42784. "See https://vuejs.org/guide/list.html#key for more info.",
  42785. el.rawAttrsMap['v-for'],
  42786. true /* tip */
  42787. );
  42788. }
  42789. el.forProcessed = true; // avoid recursion
  42790. return (altHelper || '_l') + "((" + exp + ")," +
  42791. "function(" + alias + iterator1 + iterator2 + "){" +
  42792. "return " + ((altGen || genElement)(el, state)) +
  42793. '})'
  42794. }
  42795. function genData$2 (el, state) {
  42796. var data = '{';
  42797. // directives first.
  42798. // directives may mutate the el's other properties before they are generated.
  42799. var dirs = genDirectives(el, state);
  42800. if (dirs) { data += dirs + ','; }
  42801. // key
  42802. if (el.key) {
  42803. data += "key:" + (el.key) + ",";
  42804. }
  42805. // ref
  42806. if (el.ref) {
  42807. data += "ref:" + (el.ref) + ",";
  42808. }
  42809. if (el.refInFor) {
  42810. data += "refInFor:true,";
  42811. }
  42812. // pre
  42813. if (el.pre) {
  42814. data += "pre:true,";
  42815. }
  42816. // record original tag name for components using "is" attribute
  42817. if (el.component) {
  42818. data += "tag:\"" + (el.tag) + "\",";
  42819. }
  42820. // module data generation functions
  42821. for (var i = 0; i < state.dataGenFns.length; i++) {
  42822. data += state.dataGenFns[i](el);
  42823. }
  42824. // attributes
  42825. if (el.attrs) {
  42826. data += "attrs:" + (genProps(el.attrs)) + ",";
  42827. }
  42828. // DOM props
  42829. if (el.props) {
  42830. data += "domProps:" + (genProps(el.props)) + ",";
  42831. }
  42832. // event handlers
  42833. if (el.events) {
  42834. data += (genHandlers(el.events, false)) + ",";
  42835. }
  42836. if (el.nativeEvents) {
  42837. data += (genHandlers(el.nativeEvents, true)) + ",";
  42838. }
  42839. // slot target
  42840. // only for non-scoped slots
  42841. if (el.slotTarget && !el.slotScope) {
  42842. data += "slot:" + (el.slotTarget) + ",";
  42843. }
  42844. // scoped slots
  42845. if (el.scopedSlots) {
  42846. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  42847. }
  42848. // component v-model
  42849. if (el.model) {
  42850. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  42851. }
  42852. // inline-template
  42853. if (el.inlineTemplate) {
  42854. var inlineTemplate = genInlineTemplate(el, state);
  42855. if (inlineTemplate) {
  42856. data += inlineTemplate + ",";
  42857. }
  42858. }
  42859. data = data.replace(/,$/, '') + '}';
  42860. // v-bind dynamic argument wrap
  42861. // v-bind with dynamic arguments must be applied using the same v-bind object
  42862. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  42863. if (el.dynamicAttrs) {
  42864. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  42865. }
  42866. // v-bind data wrap
  42867. if (el.wrapData) {
  42868. data = el.wrapData(data);
  42869. }
  42870. // v-on data wrap
  42871. if (el.wrapListeners) {
  42872. data = el.wrapListeners(data);
  42873. }
  42874. return data
  42875. }
  42876. function genDirectives (el, state) {
  42877. var dirs = el.directives;
  42878. if (!dirs) { return }
  42879. var res = 'directives:[';
  42880. var hasRuntime = false;
  42881. var i, l, dir, needRuntime;
  42882. for (i = 0, l = dirs.length; i < l; i++) {
  42883. dir = dirs[i];
  42884. needRuntime = true;
  42885. var gen = state.directives[dir.name];
  42886. if (gen) {
  42887. // compile-time directive that manipulates AST.
  42888. // returns true if it also needs a runtime counterpart.
  42889. needRuntime = !!gen(el, dir, state.warn);
  42890. }
  42891. if (needRuntime) {
  42892. hasRuntime = true;
  42893. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  42894. }
  42895. }
  42896. if (hasRuntime) {
  42897. return res.slice(0, -1) + ']'
  42898. }
  42899. }
  42900. function genInlineTemplate (el, state) {
  42901. var ast = el.children[0];
  42902. if (el.children.length !== 1 || ast.type !== 1) {
  42903. state.warn(
  42904. 'Inline-template components must have exactly one child element.',
  42905. { start: el.start }
  42906. );
  42907. }
  42908. if (ast && ast.type === 1) {
  42909. var inlineRenderFns = generate(ast, state.options);
  42910. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  42911. }
  42912. }
  42913. function genScopedSlots (
  42914. el,
  42915. slots,
  42916. state
  42917. ) {
  42918. // by default scoped slots are considered "stable", this allows child
  42919. // components with only scoped slots to skip forced updates from parent.
  42920. // but in some cases we have to bail-out of this optimization
  42921. // for example if the slot contains dynamic names, has v-if or v-for on them...
  42922. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  42923. var slot = slots[key];
  42924. return (
  42925. slot.slotTargetDynamic ||
  42926. slot.if ||
  42927. slot.for ||
  42928. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  42929. )
  42930. });
  42931. // #9534: if a component with scoped slots is inside a conditional branch,
  42932. // it's possible for the same component to be reused but with different
  42933. // compiled slot content. To avoid that, we generate a unique key based on
  42934. // the generated code of all the slot contents.
  42935. var needsKey = !!el.if;
  42936. // OR when it is inside another scoped slot or v-for (the reactivity may be
  42937. // disconnected due to the intermediate scope variable)
  42938. // #9438, #9506
  42939. // TODO: this can be further optimized by properly analyzing in-scope bindings
  42940. // and skip force updating ones that do not actually use scope variables.
  42941. if (!needsForceUpdate) {
  42942. var parent = el.parent;
  42943. while (parent) {
  42944. if (
  42945. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  42946. parent.for
  42947. ) {
  42948. needsForceUpdate = true;
  42949. break
  42950. }
  42951. if (parent.if) {
  42952. needsKey = true;
  42953. }
  42954. parent = parent.parent;
  42955. }
  42956. }
  42957. var generatedSlots = Object.keys(slots)
  42958. .map(function (key) { return genScopedSlot(slots[key], state); })
  42959. .join(',');
  42960. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  42961. }
  42962. function hash(str) {
  42963. var hash = 5381;
  42964. var i = str.length;
  42965. while(i) {
  42966. hash = (hash * 33) ^ str.charCodeAt(--i);
  42967. }
  42968. return hash >>> 0
  42969. }
  42970. function containsSlotChild (el) {
  42971. if (el.type === 1) {
  42972. if (el.tag === 'slot') {
  42973. return true
  42974. }
  42975. return el.children.some(containsSlotChild)
  42976. }
  42977. return false
  42978. }
  42979. function genScopedSlot (
  42980. el,
  42981. state
  42982. ) {
  42983. var isLegacySyntax = el.attrsMap['slot-scope'];
  42984. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  42985. return genIf(el, state, genScopedSlot, "null")
  42986. }
  42987. if (el.for && !el.forProcessed) {
  42988. return genFor(el, state, genScopedSlot)
  42989. }
  42990. var slotScope = el.slotScope === emptySlotScopeToken
  42991. ? ""
  42992. : String(el.slotScope);
  42993. var fn = "function(" + slotScope + "){" +
  42994. "return " + (el.tag === 'template'
  42995. ? el.if && isLegacySyntax
  42996. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  42997. : genChildren(el, state) || 'undefined'
  42998. : genElement(el, state)) + "}";
  42999. // reverse proxy v-slot without scope on this.$slots
  43000. var reverseProxy = slotScope ? "" : ",proxy:true";
  43001. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  43002. }
  43003. function genChildren (
  43004. el,
  43005. state,
  43006. checkSkip,
  43007. altGenElement,
  43008. altGenNode
  43009. ) {
  43010. var children = el.children;
  43011. if (children.length) {
  43012. var el$1 = children[0];
  43013. // optimize single v-for
  43014. if (children.length === 1 &&
  43015. el$1.for &&
  43016. el$1.tag !== 'template' &&
  43017. el$1.tag !== 'slot'
  43018. ) {
  43019. var normalizationType = checkSkip
  43020. ? state.maybeComponent(el$1) ? ",1" : ",0"
  43021. : "";
  43022. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  43023. }
  43024. var normalizationType$1 = checkSkip
  43025. ? getNormalizationType(children, state.maybeComponent)
  43026. : 0;
  43027. var gen = altGenNode || genNode;
  43028. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  43029. }
  43030. }
  43031. // determine the normalization needed for the children array.
  43032. // 0: no normalization needed
  43033. // 1: simple normalization needed (possible 1-level deep nested array)
  43034. // 2: full normalization needed
  43035. function getNormalizationType (
  43036. children,
  43037. maybeComponent
  43038. ) {
  43039. var res = 0;
  43040. for (var i = 0; i < children.length; i++) {
  43041. var el = children[i];
  43042. if (el.type !== 1) {
  43043. continue
  43044. }
  43045. if (needsNormalization(el) ||
  43046. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  43047. res = 2;
  43048. break
  43049. }
  43050. if (maybeComponent(el) ||
  43051. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  43052. res = 1;
  43053. }
  43054. }
  43055. return res
  43056. }
  43057. function needsNormalization (el) {
  43058. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  43059. }
  43060. function genNode (node, state) {
  43061. if (node.type === 1) {
  43062. return genElement(node, state)
  43063. } else if (node.type === 3 && node.isComment) {
  43064. return genComment(node)
  43065. } else {
  43066. return genText(node)
  43067. }
  43068. }
  43069. function genText (text) {
  43070. return ("_v(" + (text.type === 2
  43071. ? text.expression // no need for () because already wrapped in _s()
  43072. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  43073. }
  43074. function genComment (comment) {
  43075. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  43076. }
  43077. function genSlot (el, state) {
  43078. var slotName = el.slotName || '"default"';
  43079. var children = genChildren(el, state);
  43080. var res = "_t(" + slotName + (children ? ("," + children) : '');
  43081. var attrs = el.attrs || el.dynamicAttrs
  43082. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  43083. // slot props are camelized
  43084. name: camelize(attr.name),
  43085. value: attr.value,
  43086. dynamic: attr.dynamic
  43087. }); }))
  43088. : null;
  43089. var bind$$1 = el.attrsMap['v-bind'];
  43090. if ((attrs || bind$$1) && !children) {
  43091. res += ",null";
  43092. }
  43093. if (attrs) {
  43094. res += "," + attrs;
  43095. }
  43096. if (bind$$1) {
  43097. res += (attrs ? '' : ',null') + "," + bind$$1;
  43098. }
  43099. return res + ')'
  43100. }
  43101. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  43102. function genComponent (
  43103. componentName,
  43104. el,
  43105. state
  43106. ) {
  43107. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  43108. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  43109. }
  43110. function genProps (props) {
  43111. var staticProps = "";
  43112. var dynamicProps = "";
  43113. for (var i = 0; i < props.length; i++) {
  43114. var prop = props[i];
  43115. var value = transformSpecialNewlines(prop.value);
  43116. if (prop.dynamic) {
  43117. dynamicProps += (prop.name) + "," + value + ",";
  43118. } else {
  43119. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  43120. }
  43121. }
  43122. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  43123. if (dynamicProps) {
  43124. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  43125. } else {
  43126. return staticProps
  43127. }
  43128. }
  43129. // #3895, #4268
  43130. function transformSpecialNewlines (text) {
  43131. return text
  43132. .replace(/\u2028/g, '\\u2028')
  43133. .replace(/\u2029/g, '\\u2029')
  43134. }
  43135. /* */
  43136. // these keywords should not appear inside expressions, but operators like
  43137. // typeof, instanceof and in are allowed
  43138. var prohibitedKeywordRE = new RegExp('\\b' + (
  43139. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  43140. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  43141. 'extends,finally,continue,debugger,function,arguments'
  43142. ).split(',').join('\\b|\\b') + '\\b');
  43143. // these unary operators should not be used as property/method names
  43144. var unaryOperatorsRE = new RegExp('\\b' + (
  43145. 'delete,typeof,void'
  43146. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  43147. // strip strings in expressions
  43148. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  43149. // detect problematic expressions in a template
  43150. function detectErrors (ast, warn) {
  43151. if (ast) {
  43152. checkNode(ast, warn);
  43153. }
  43154. }
  43155. function checkNode (node, warn) {
  43156. if (node.type === 1) {
  43157. for (var name in node.attrsMap) {
  43158. if (dirRE.test(name)) {
  43159. var value = node.attrsMap[name];
  43160. if (value) {
  43161. var range = node.rawAttrsMap[name];
  43162. if (name === 'v-for') {
  43163. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  43164. } else if (onRE.test(name)) {
  43165. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  43166. } else {
  43167. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  43168. }
  43169. }
  43170. }
  43171. }
  43172. if (node.children) {
  43173. for (var i = 0; i < node.children.length; i++) {
  43174. checkNode(node.children[i], warn);
  43175. }
  43176. }
  43177. } else if (node.type === 2) {
  43178. checkExpression(node.expression, node.text, warn, node);
  43179. }
  43180. }
  43181. function checkEvent (exp, text, warn, range) {
  43182. var stipped = exp.replace(stripStringRE, '');
  43183. var keywordMatch = stipped.match(unaryOperatorsRE);
  43184. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  43185. warn(
  43186. "avoid using JavaScript unary operator as property name: " +
  43187. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  43188. range
  43189. );
  43190. }
  43191. checkExpression(exp, text, warn, range);
  43192. }
  43193. function checkFor (node, text, warn, range) {
  43194. checkExpression(node.for || '', text, warn, range);
  43195. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  43196. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  43197. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  43198. }
  43199. function checkIdentifier (
  43200. ident,
  43201. type,
  43202. text,
  43203. warn,
  43204. range
  43205. ) {
  43206. if (typeof ident === 'string') {
  43207. try {
  43208. new Function(("var " + ident + "=_"));
  43209. } catch (e) {
  43210. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  43211. }
  43212. }
  43213. }
  43214. function checkExpression (exp, text, warn, range) {
  43215. try {
  43216. new Function(("return " + exp));
  43217. } catch (e) {
  43218. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  43219. if (keywordMatch) {
  43220. warn(
  43221. "avoid using JavaScript keyword as property name: " +
  43222. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  43223. range
  43224. );
  43225. } else {
  43226. warn(
  43227. "invalid expression: " + (e.message) + " in\n\n" +
  43228. " " + exp + "\n\n" +
  43229. " Raw expression: " + (text.trim()) + "\n",
  43230. range
  43231. );
  43232. }
  43233. }
  43234. }
  43235. /* */
  43236. var range = 2;
  43237. function generateCodeFrame (
  43238. source,
  43239. start,
  43240. end
  43241. ) {
  43242. if ( start === void 0 ) start = 0;
  43243. if ( end === void 0 ) end = source.length;
  43244. var lines = source.split(/\r?\n/);
  43245. var count = 0;
  43246. var res = [];
  43247. for (var i = 0; i < lines.length; i++) {
  43248. count += lines[i].length + 1;
  43249. if (count >= start) {
  43250. for (var j = i - range; j <= i + range || end > count; j++) {
  43251. if (j < 0 || j >= lines.length) { continue }
  43252. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  43253. var lineLength = lines[j].length;
  43254. if (j === i) {
  43255. // push underline
  43256. var pad = start - (count - lineLength) + 1;
  43257. var length = end > count ? lineLength - pad : end - start;
  43258. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  43259. } else if (j > i) {
  43260. if (end > count) {
  43261. var length$1 = Math.min(end - count, lineLength);
  43262. res.push(" | " + repeat$1("^", length$1));
  43263. }
  43264. count += lineLength + 1;
  43265. }
  43266. }
  43267. break
  43268. }
  43269. }
  43270. return res.join('\n')
  43271. }
  43272. function repeat$1 (str, n) {
  43273. var result = '';
  43274. if (n > 0) {
  43275. while (true) { // eslint-disable-line
  43276. if (n & 1) { result += str; }
  43277. n >>>= 1;
  43278. if (n <= 0) { break }
  43279. str += str;
  43280. }
  43281. }
  43282. return result
  43283. }
  43284. /* */
  43285. function createFunction (code, errors) {
  43286. try {
  43287. return new Function(code)
  43288. } catch (err) {
  43289. errors.push({ err: err, code: code });
  43290. return noop
  43291. }
  43292. }
  43293. function createCompileToFunctionFn (compile) {
  43294. var cache = Object.create(null);
  43295. return function compileToFunctions (
  43296. template,
  43297. options,
  43298. vm
  43299. ) {
  43300. options = extend({}, options);
  43301. var warn$$1 = options.warn || warn;
  43302. delete options.warn;
  43303. /* istanbul ignore if */
  43304. {
  43305. // detect possible CSP restriction
  43306. try {
  43307. new Function('return 1');
  43308. } catch (e) {
  43309. if (e.toString().match(/unsafe-eval|CSP/)) {
  43310. warn$$1(
  43311. 'It seems you are using the standalone build of Vue.js in an ' +
  43312. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  43313. 'The template compiler cannot work in this environment. Consider ' +
  43314. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  43315. 'templates into render functions.'
  43316. );
  43317. }
  43318. }
  43319. }
  43320. // check cache
  43321. var key = options.delimiters
  43322. ? String(options.delimiters) + template
  43323. : template;
  43324. if (cache[key]) {
  43325. return cache[key]
  43326. }
  43327. // compile
  43328. var compiled = compile(template, options);
  43329. // check compilation errors/tips
  43330. {
  43331. if (compiled.errors && compiled.errors.length) {
  43332. if (options.outputSourceRange) {
  43333. compiled.errors.forEach(function (e) {
  43334. warn$$1(
  43335. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  43336. generateCodeFrame(template, e.start, e.end),
  43337. vm
  43338. );
  43339. });
  43340. } else {
  43341. warn$$1(
  43342. "Error compiling template:\n\n" + template + "\n\n" +
  43343. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  43344. vm
  43345. );
  43346. }
  43347. }
  43348. if (compiled.tips && compiled.tips.length) {
  43349. if (options.outputSourceRange) {
  43350. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  43351. } else {
  43352. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  43353. }
  43354. }
  43355. }
  43356. // turn code into functions
  43357. var res = {};
  43358. var fnGenErrors = [];
  43359. res.render = createFunction(compiled.render, fnGenErrors);
  43360. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  43361. return createFunction(code, fnGenErrors)
  43362. });
  43363. // check function generation errors.
  43364. // this should only happen if there is a bug in the compiler itself.
  43365. // mostly for codegen development use
  43366. /* istanbul ignore if */
  43367. {
  43368. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  43369. warn$$1(
  43370. "Failed to generate render function:\n\n" +
  43371. fnGenErrors.map(function (ref) {
  43372. var err = ref.err;
  43373. var code = ref.code;
  43374. return ((err.toString()) + " in\n\n" + code + "\n");
  43375. }).join('\n'),
  43376. vm
  43377. );
  43378. }
  43379. }
  43380. return (cache[key] = res)
  43381. }
  43382. }
  43383. /* */
  43384. function createCompilerCreator (baseCompile) {
  43385. return function createCompiler (baseOptions) {
  43386. function compile (
  43387. template,
  43388. options
  43389. ) {
  43390. var finalOptions = Object.create(baseOptions);
  43391. var errors = [];
  43392. var tips = [];
  43393. var warn = function (msg, range, tip) {
  43394. (tip ? tips : errors).push(msg);
  43395. };
  43396. if (options) {
  43397. if (options.outputSourceRange) {
  43398. // $flow-disable-line
  43399. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  43400. warn = function (msg, range, tip) {
  43401. var data = { msg: msg };
  43402. if (range) {
  43403. if (range.start != null) {
  43404. data.start = range.start + leadingSpaceLength;
  43405. }
  43406. if (range.end != null) {
  43407. data.end = range.end + leadingSpaceLength;
  43408. }
  43409. }
  43410. (tip ? tips : errors).push(data);
  43411. };
  43412. }
  43413. // merge custom modules
  43414. if (options.modules) {
  43415. finalOptions.modules =
  43416. (baseOptions.modules || []).concat(options.modules);
  43417. }
  43418. // merge custom directives
  43419. if (options.directives) {
  43420. finalOptions.directives = extend(
  43421. Object.create(baseOptions.directives || null),
  43422. options.directives
  43423. );
  43424. }
  43425. // copy other options
  43426. for (var key in options) {
  43427. if (key !== 'modules' && key !== 'directives') {
  43428. finalOptions[key] = options[key];
  43429. }
  43430. }
  43431. }
  43432. finalOptions.warn = warn;
  43433. var compiled = baseCompile(template.trim(), finalOptions);
  43434. {
  43435. detectErrors(compiled.ast, warn);
  43436. }
  43437. compiled.errors = errors;
  43438. compiled.tips = tips;
  43439. return compiled
  43440. }
  43441. return {
  43442. compile: compile,
  43443. compileToFunctions: createCompileToFunctionFn(compile)
  43444. }
  43445. }
  43446. }
  43447. /* */
  43448. // `createCompilerCreator` allows creating compilers that use alternative
  43449. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  43450. // Here we just export a default compiler using the default parts.
  43451. var createCompiler = createCompilerCreator(function baseCompile (
  43452. template,
  43453. options
  43454. ) {
  43455. var ast = parse(template.trim(), options);
  43456. if (options.optimize !== false) {
  43457. optimize(ast, options);
  43458. }
  43459. var code = generate(ast, options);
  43460. return {
  43461. ast: ast,
  43462. render: code.render,
  43463. staticRenderFns: code.staticRenderFns
  43464. }
  43465. });
  43466. /* */
  43467. var ref$1 = createCompiler(baseOptions);
  43468. var compile = ref$1.compile;
  43469. var compileToFunctions = ref$1.compileToFunctions;
  43470. /* */
  43471. // check whether current browser encodes a char inside attribute values
  43472. var div;
  43473. function getShouldDecode (href) {
  43474. div = div || document.createElement('div');
  43475. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  43476. return div.innerHTML.indexOf('&#10;') > 0
  43477. }
  43478. // #3663: IE encodes newlines inside attribute values while other browsers don't
  43479. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  43480. // #6828: chrome encodes content in a[href]
  43481. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  43482. /* */
  43483. var idToTemplate = cached(function (id) {
  43484. var el = query(id);
  43485. return el && el.innerHTML
  43486. });
  43487. var mount = Vue.prototype.$mount;
  43488. Vue.prototype.$mount = function (
  43489. el,
  43490. hydrating
  43491. ) {
  43492. el = el && query(el);
  43493. /* istanbul ignore if */
  43494. if (el === document.body || el === document.documentElement) {
  43495. warn(
  43496. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  43497. );
  43498. return this
  43499. }
  43500. var options = this.$options;
  43501. // resolve template/el and convert to render function
  43502. if (!options.render) {
  43503. var template = options.template;
  43504. if (template) {
  43505. if (typeof template === 'string') {
  43506. if (template.charAt(0) === '#') {
  43507. template = idToTemplate(template);
  43508. /* istanbul ignore if */
  43509. if (!template) {
  43510. warn(
  43511. ("Template element not found or is empty: " + (options.template)),
  43512. this
  43513. );
  43514. }
  43515. }
  43516. } else if (template.nodeType) {
  43517. template = template.innerHTML;
  43518. } else {
  43519. {
  43520. warn('invalid template option:' + template, this);
  43521. }
  43522. return this
  43523. }
  43524. } else if (el) {
  43525. template = getOuterHTML(el);
  43526. }
  43527. if (template) {
  43528. /* istanbul ignore if */
  43529. if (config.performance && mark) {
  43530. mark('compile');
  43531. }
  43532. var ref = compileToFunctions(template, {
  43533. outputSourceRange: "development" !== 'production',
  43534. shouldDecodeNewlines: shouldDecodeNewlines,
  43535. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  43536. delimiters: options.delimiters,
  43537. comments: options.comments
  43538. }, this);
  43539. var render = ref.render;
  43540. var staticRenderFns = ref.staticRenderFns;
  43541. options.render = render;
  43542. options.staticRenderFns = staticRenderFns;
  43543. /* istanbul ignore if */
  43544. if (config.performance && mark) {
  43545. mark('compile end');
  43546. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  43547. }
  43548. }
  43549. }
  43550. return mount.call(this, el, hydrating)
  43551. };
  43552. /**
  43553. * Get outerHTML of elements, taking care
  43554. * of SVG elements in IE as well.
  43555. */
  43556. function getOuterHTML (el) {
  43557. if (el.outerHTML) {
  43558. return el.outerHTML
  43559. } else {
  43560. var container = document.createElement('div');
  43561. container.appendChild(el.cloneNode(true));
  43562. return container.innerHTML
  43563. }
  43564. }
  43565. Vue.compile = compileToFunctions;
  43566. module.exports = Vue;
  43567. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
  43568. /***/ }),
  43569. /***/ "./node_modules/vue/dist/vue.common.js":
  43570. /*!*********************************************!*\
  43571. !*** ./node_modules/vue/dist/vue.common.js ***!
  43572. \*********************************************/
  43573. /*! no static exports found */
  43574. /***/ (function(module, exports, __webpack_require__) {
  43575. if (false) {} else {
  43576. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  43577. }
  43578. /***/ }),
  43579. /***/ "./node_modules/webpack/buildin/global.js":
  43580. /*!***********************************!*\
  43581. !*** (webpack)/buildin/global.js ***!
  43582. \***********************************/
  43583. /*! no static exports found */
  43584. /***/ (function(module, exports) {
  43585. var g;
  43586. // This works in non-strict mode
  43587. g = (function() {
  43588. return this;
  43589. })();
  43590. try {
  43591. // This works if eval is allowed (see CSP)
  43592. g = g || new Function("return this")();
  43593. } catch (e) {
  43594. // This works if the window reference is available
  43595. if (typeof window === "object") g = window;
  43596. }
  43597. // g can still be undefined, but nothing to do about it...
  43598. // We return undefined, instead of nothing here, so it's
  43599. // easier to handle this case. if(!global) { ...}
  43600. module.exports = g;
  43601. /***/ }),
  43602. /***/ "./node_modules/webpack/buildin/module.js":
  43603. /*!***********************************!*\
  43604. !*** (webpack)/buildin/module.js ***!
  43605. \***********************************/
  43606. /*! no static exports found */
  43607. /***/ (function(module, exports) {
  43608. module.exports = function(module) {
  43609. if (!module.webpackPolyfill) {
  43610. module.deprecate = function() {};
  43611. module.paths = [];
  43612. // module.parent = undefined by default
  43613. if (!module.children) module.children = [];
  43614. Object.defineProperty(module, "loaded", {
  43615. enumerable: true,
  43616. get: function() {
  43617. return module.l;
  43618. }
  43619. });
  43620. Object.defineProperty(module, "id", {
  43621. enumerable: true,
  43622. get: function() {
  43623. return module.i;
  43624. }
  43625. });
  43626. module.webpackPolyfill = 1;
  43627. }
  43628. return module;
  43629. };
  43630. /***/ }),
  43631. /***/ "./resources/js/app.js":
  43632. /*!*****************************!*\
  43633. !*** ./resources/js/app.js ***!
  43634. \*****************************/
  43635. /*! no static exports found */
  43636. /***/ (function(module, exports, __webpack_require__) {
  43637. /**
  43638. * First we will load all of this project's JavaScript dependencies which
  43639. * includes Vue and other libraries. It is a great starting point when
  43640. * building robust, powerful web applications using Vue and Laravel.
  43641. */
  43642. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  43643. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  43644. /**
  43645. * The following block of code may be used to automatically register your
  43646. * Vue components. It will recursively scan this directory for the Vue
  43647. * components and automatically register them with their "basename".
  43648. *
  43649. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  43650. */
  43651. // const files = require.context('./', true, /\.vue$/i)
  43652. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  43653. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  43654. /**
  43655. * Next, we will create a fresh Vue application instance and attach it to
  43656. * the page. Then, you may begin adding components to this application
  43657. * or customize the JavaScript scaffolding to fit your unique needs.
  43658. */
  43659. var app = new Vue({
  43660. el: '#app'
  43661. });
  43662. /***/ }),
  43663. /***/ "./resources/js/bootstrap.js":
  43664. /*!***********************************!*\
  43665. !*** ./resources/js/bootstrap.js ***!
  43666. \***********************************/
  43667. /*! no static exports found */
  43668. /***/ (function(module, exports, __webpack_require__) {
  43669. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  43670. /**
  43671. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43672. * for JavaScript based Bootstrap features such as modals and tabs. This
  43673. * code may be modified to fit the specific needs of your application.
  43674. */
  43675. try {
  43676. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  43677. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  43678. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  43679. } catch (e) {}
  43680. /**
  43681. * We'll load the axios HTTP library which allows us to easily issue requests
  43682. * to our Laravel back-end. This library automatically handles sending the
  43683. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43684. */
  43685. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  43686. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43687. /**
  43688. * Echo exposes an expressive API for subscribing to channels and listening
  43689. * for events that are broadcast by Laravel. Echo and event broadcasting
  43690. * allows your team to easily build robust real-time web applications.
  43691. */
  43692. // import Echo from 'laravel-echo';
  43693. // window.Pusher = require('pusher-js');
  43694. // window.Echo = new Echo({
  43695. // broadcaster: 'pusher',
  43696. // key: process.env.MIX_PUSHER_APP_KEY,
  43697. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43698. // encrypted: true
  43699. // });
  43700. /***/ }),
  43701. /***/ "./resources/js/components/ExampleComponent.vue":
  43702. /*!******************************************************!*\
  43703. !*** ./resources/js/components/ExampleComponent.vue ***!
  43704. \******************************************************/
  43705. /*! exports provided: default */
  43706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43707. "use strict";
  43708. __webpack_require__.r(__webpack_exports__);
  43709. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43710. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43711. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  43712. /* normalize component */
  43713. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  43714. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  43715. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  43716. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  43717. false,
  43718. null,
  43719. null,
  43720. null
  43721. )
  43722. /* hot reload */
  43723. if (false) { var api; }
  43724. component.options.__file = "resources/js/components/ExampleComponent.vue"
  43725. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  43726. /***/ }),
  43727. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  43728. /*!*******************************************************************************!*\
  43729. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  43730. \*******************************************************************************/
  43731. /*! exports provided: default */
  43732. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43733. "use strict";
  43734. __webpack_require__.r(__webpack_exports__);
  43735. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43736. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  43737. /***/ }),
  43738. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  43739. /*!*************************************************************************************!*\
  43740. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  43741. \*************************************************************************************/
  43742. /*! exports provided: render, staticRenderFns */
  43743. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43744. "use strict";
  43745. __webpack_require__.r(__webpack_exports__);
  43746. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43747. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  43748. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  43749. /***/ }),
  43750. /***/ "./resources/sass/app.scss":
  43751. /*!*********************************!*\
  43752. !*** ./resources/sass/app.scss ***!
  43753. \*********************************/
  43754. /*! no static exports found */
  43755. /***/ (function(module, exports) {
  43756. // removed by extract-text-webpack-plugin
  43757. /***/ }),
  43758. /***/ 0:
  43759. /*!*************************************************************!*\
  43760. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  43761. \*************************************************************/
  43762. /*! no static exports found */
  43763. /***/ (function(module, exports, __webpack_require__) {
  43764. __webpack_require__(/*! c:\xampp\htdocs\unitpelaporanterpadu\resources\js\app.js */"./resources/js/app.js");
  43765. module.exports = __webpack_require__(/*! c:\xampp\htdocs\unitpelaporanterpadu\resources\sass\app.scss */"./resources/sass/app.scss");
  43766. /***/ })
  43767. /******/ });