app.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895
  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 buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./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& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1604. /*!*****************************************************!*\
  1605. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1606. \*****************************************************/
  1607. /*! no static exports found */
  1608. /***/ (function(module, exports, __webpack_require__) {
  1609. /*!
  1610. * Bootstrap v4.5.3 (https://getbootstrap.com/)
  1611. * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1612. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1613. */
  1614. (function (global, factory) {
  1615. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1616. undefined;
  1617. }(this, (function (exports, $, Popper) { 'use strict';
  1618. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  1619. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  1620. var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
  1621. function _defineProperties(target, props) {
  1622. for (var i = 0; i < props.length; i++) {
  1623. var descriptor = props[i];
  1624. descriptor.enumerable = descriptor.enumerable || false;
  1625. descriptor.configurable = true;
  1626. if ("value" in descriptor) descriptor.writable = true;
  1627. Object.defineProperty(target, descriptor.key, descriptor);
  1628. }
  1629. }
  1630. function _createClass(Constructor, protoProps, staticProps) {
  1631. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1632. if (staticProps) _defineProperties(Constructor, staticProps);
  1633. return Constructor;
  1634. }
  1635. function _extends() {
  1636. _extends = Object.assign || function (target) {
  1637. for (var i = 1; i < arguments.length; i++) {
  1638. var source = arguments[i];
  1639. for (var key in source) {
  1640. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1641. target[key] = source[key];
  1642. }
  1643. }
  1644. }
  1645. return target;
  1646. };
  1647. return _extends.apply(this, arguments);
  1648. }
  1649. function _inheritsLoose(subClass, superClass) {
  1650. subClass.prototype = Object.create(superClass.prototype);
  1651. subClass.prototype.constructor = subClass;
  1652. subClass.__proto__ = superClass;
  1653. }
  1654. /**
  1655. * --------------------------------------------------------------------------
  1656. * Bootstrap (v4.5.3): util.js
  1657. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1658. * --------------------------------------------------------------------------
  1659. */
  1660. /**
  1661. * ------------------------------------------------------------------------
  1662. * Private TransitionEnd Helpers
  1663. * ------------------------------------------------------------------------
  1664. */
  1665. var TRANSITION_END = 'transitionend';
  1666. var MAX_UID = 1000000;
  1667. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1668. function toType(obj) {
  1669. if (obj === null || typeof obj === 'undefined') {
  1670. return "" + obj;
  1671. }
  1672. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1673. }
  1674. function getSpecialTransitionEndEvent() {
  1675. return {
  1676. bindType: TRANSITION_END,
  1677. delegateType: TRANSITION_END,
  1678. handle: function handle(event) {
  1679. if ($__default['default'](event.target).is(this)) {
  1680. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1681. }
  1682. return undefined;
  1683. }
  1684. };
  1685. }
  1686. function transitionEndEmulator(duration) {
  1687. var _this = this;
  1688. var called = false;
  1689. $__default['default'](this).one(Util.TRANSITION_END, function () {
  1690. called = true;
  1691. });
  1692. setTimeout(function () {
  1693. if (!called) {
  1694. Util.triggerTransitionEnd(_this);
  1695. }
  1696. }, duration);
  1697. return this;
  1698. }
  1699. function setTransitionEndSupport() {
  1700. $__default['default'].fn.emulateTransitionEnd = transitionEndEmulator;
  1701. $__default['default'].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1702. }
  1703. /**
  1704. * --------------------------------------------------------------------------
  1705. * Public Util Api
  1706. * --------------------------------------------------------------------------
  1707. */
  1708. var Util = {
  1709. TRANSITION_END: 'bsTransitionEnd',
  1710. getUID: function getUID(prefix) {
  1711. do {
  1712. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1713. } while (document.getElementById(prefix));
  1714. return prefix;
  1715. },
  1716. getSelectorFromElement: function getSelectorFromElement(element) {
  1717. var selector = element.getAttribute('data-target');
  1718. if (!selector || selector === '#') {
  1719. var hrefAttr = element.getAttribute('href');
  1720. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1721. }
  1722. try {
  1723. return document.querySelector(selector) ? selector : null;
  1724. } catch (_) {
  1725. return null;
  1726. }
  1727. },
  1728. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1729. if (!element) {
  1730. return 0;
  1731. } // Get transition-duration of the element
  1732. var transitionDuration = $__default['default'](element).css('transition-duration');
  1733. var transitionDelay = $__default['default'](element).css('transition-delay');
  1734. var floatTransitionDuration = parseFloat(transitionDuration);
  1735. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1736. if (!floatTransitionDuration && !floatTransitionDelay) {
  1737. return 0;
  1738. } // If multiple durations are defined, take the first
  1739. transitionDuration = transitionDuration.split(',')[0];
  1740. transitionDelay = transitionDelay.split(',')[0];
  1741. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1742. },
  1743. reflow: function reflow(element) {
  1744. return element.offsetHeight;
  1745. },
  1746. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1747. $__default['default'](element).trigger(TRANSITION_END);
  1748. },
  1749. supportsTransitionEnd: function supportsTransitionEnd() {
  1750. return Boolean(TRANSITION_END);
  1751. },
  1752. isElement: function isElement(obj) {
  1753. return (obj[0] || obj).nodeType;
  1754. },
  1755. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1756. for (var property in configTypes) {
  1757. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1758. var expectedTypes = configTypes[property];
  1759. var value = config[property];
  1760. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1761. if (!new RegExp(expectedTypes).test(valueType)) {
  1762. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1763. }
  1764. }
  1765. }
  1766. },
  1767. findShadowRoot: function findShadowRoot(element) {
  1768. if (!document.documentElement.attachShadow) {
  1769. return null;
  1770. } // Can find the shadow root otherwise it'll return the document
  1771. if (typeof element.getRootNode === 'function') {
  1772. var root = element.getRootNode();
  1773. return root instanceof ShadowRoot ? root : null;
  1774. }
  1775. if (element instanceof ShadowRoot) {
  1776. return element;
  1777. } // when we don't find a shadow root
  1778. if (!element.parentNode) {
  1779. return null;
  1780. }
  1781. return Util.findShadowRoot(element.parentNode);
  1782. },
  1783. jQueryDetection: function jQueryDetection() {
  1784. if (typeof $__default['default'] === 'undefined') {
  1785. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  1786. }
  1787. var version = $__default['default'].fn.jquery.split(' ')[0].split('.');
  1788. var minMajor = 1;
  1789. var ltMajor = 2;
  1790. var minMinor = 9;
  1791. var minPatch = 1;
  1792. var maxMajor = 4;
  1793. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  1794. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  1795. }
  1796. }
  1797. };
  1798. Util.jQueryDetection();
  1799. setTransitionEndSupport();
  1800. /**
  1801. * ------------------------------------------------------------------------
  1802. * Constants
  1803. * ------------------------------------------------------------------------
  1804. */
  1805. var NAME = 'alert';
  1806. var VERSION = '4.5.3';
  1807. var DATA_KEY = 'bs.alert';
  1808. var EVENT_KEY = "." + DATA_KEY;
  1809. var DATA_API_KEY = '.data-api';
  1810. var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
  1811. var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  1812. var EVENT_CLOSE = "close" + EVENT_KEY;
  1813. var EVENT_CLOSED = "closed" + EVENT_KEY;
  1814. var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  1815. var CLASS_NAME_ALERT = 'alert';
  1816. var CLASS_NAME_FADE = 'fade';
  1817. var CLASS_NAME_SHOW = 'show';
  1818. /**
  1819. * ------------------------------------------------------------------------
  1820. * Class Definition
  1821. * ------------------------------------------------------------------------
  1822. */
  1823. var Alert = /*#__PURE__*/function () {
  1824. function Alert(element) {
  1825. this._element = element;
  1826. } // Getters
  1827. var _proto = Alert.prototype;
  1828. // Public
  1829. _proto.close = function close(element) {
  1830. var rootElement = this._element;
  1831. if (element) {
  1832. rootElement = this._getRootElement(element);
  1833. }
  1834. var customEvent = this._triggerCloseEvent(rootElement);
  1835. if (customEvent.isDefaultPrevented()) {
  1836. return;
  1837. }
  1838. this._removeElement(rootElement);
  1839. };
  1840. _proto.dispose = function dispose() {
  1841. $__default['default'].removeData(this._element, DATA_KEY);
  1842. this._element = null;
  1843. } // Private
  1844. ;
  1845. _proto._getRootElement = function _getRootElement(element) {
  1846. var selector = Util.getSelectorFromElement(element);
  1847. var parent = false;
  1848. if (selector) {
  1849. parent = document.querySelector(selector);
  1850. }
  1851. if (!parent) {
  1852. parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0];
  1853. }
  1854. return parent;
  1855. };
  1856. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1857. var closeEvent = $__default['default'].Event(EVENT_CLOSE);
  1858. $__default['default'](element).trigger(closeEvent);
  1859. return closeEvent;
  1860. };
  1861. _proto._removeElement = function _removeElement(element) {
  1862. var _this = this;
  1863. $__default['default'](element).removeClass(CLASS_NAME_SHOW);
  1864. if (!$__default['default'](element).hasClass(CLASS_NAME_FADE)) {
  1865. this._destroyElement(element);
  1866. return;
  1867. }
  1868. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1869. $__default['default'](element).one(Util.TRANSITION_END, function (event) {
  1870. return _this._destroyElement(element, event);
  1871. }).emulateTransitionEnd(transitionDuration);
  1872. };
  1873. _proto._destroyElement = function _destroyElement(element) {
  1874. $__default['default'](element).detach().trigger(EVENT_CLOSED).remove();
  1875. } // Static
  1876. ;
  1877. Alert._jQueryInterface = function _jQueryInterface(config) {
  1878. return this.each(function () {
  1879. var $element = $__default['default'](this);
  1880. var data = $element.data(DATA_KEY);
  1881. if (!data) {
  1882. data = new Alert(this);
  1883. $element.data(DATA_KEY, data);
  1884. }
  1885. if (config === 'close') {
  1886. data[config](this);
  1887. }
  1888. });
  1889. };
  1890. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1891. return function (event) {
  1892. if (event) {
  1893. event.preventDefault();
  1894. }
  1895. alertInstance.close(this);
  1896. };
  1897. };
  1898. _createClass(Alert, null, [{
  1899. key: "VERSION",
  1900. get: function get() {
  1901. return VERSION;
  1902. }
  1903. }]);
  1904. return Alert;
  1905. }();
  1906. /**
  1907. * ------------------------------------------------------------------------
  1908. * Data Api implementation
  1909. * ------------------------------------------------------------------------
  1910. */
  1911. $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
  1912. /**
  1913. * ------------------------------------------------------------------------
  1914. * jQuery
  1915. * ------------------------------------------------------------------------
  1916. */
  1917. $__default['default'].fn[NAME] = Alert._jQueryInterface;
  1918. $__default['default'].fn[NAME].Constructor = Alert;
  1919. $__default['default'].fn[NAME].noConflict = function () {
  1920. $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
  1921. return Alert._jQueryInterface;
  1922. };
  1923. /**
  1924. * ------------------------------------------------------------------------
  1925. * Constants
  1926. * ------------------------------------------------------------------------
  1927. */
  1928. var NAME$1 = 'button';
  1929. var VERSION$1 = '4.5.3';
  1930. var DATA_KEY$1 = 'bs.button';
  1931. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1932. var DATA_API_KEY$1 = '.data-api';
  1933. var JQUERY_NO_CONFLICT$1 = $__default['default'].fn[NAME$1];
  1934. var CLASS_NAME_ACTIVE = 'active';
  1935. var CLASS_NAME_BUTTON = 'btn';
  1936. var CLASS_NAME_FOCUS = 'focus';
  1937. var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  1938. var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
  1939. var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
  1940. var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
  1941. var SELECTOR_INPUT = 'input:not([type="hidden"])';
  1942. var SELECTOR_ACTIVE = '.active';
  1943. var SELECTOR_BUTTON = '.btn';
  1944. var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  1945. var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
  1946. var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
  1947. /**
  1948. * ------------------------------------------------------------------------
  1949. * Class Definition
  1950. * ------------------------------------------------------------------------
  1951. */
  1952. var Button = /*#__PURE__*/function () {
  1953. function Button(element) {
  1954. this._element = element;
  1955. this.shouldAvoidTriggerChange = false;
  1956. } // Getters
  1957. var _proto = Button.prototype;
  1958. // Public
  1959. _proto.toggle = function toggle() {
  1960. var triggerChangeEvent = true;
  1961. var addAriaPressed = true;
  1962. var rootElement = $__default['default'](this._element).closest(SELECTOR_DATA_TOGGLES)[0];
  1963. if (rootElement) {
  1964. var input = this._element.querySelector(SELECTOR_INPUT);
  1965. if (input) {
  1966. if (input.type === 'radio') {
  1967. if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  1968. triggerChangeEvent = false;
  1969. } else {
  1970. var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
  1971. if (activeElement) {
  1972. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE);
  1973. }
  1974. }
  1975. }
  1976. if (triggerChangeEvent) {
  1977. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  1978. if (input.type === 'checkbox' || input.type === 'radio') {
  1979. input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
  1980. }
  1981. if (!this.shouldAvoidTriggerChange) {
  1982. $__default['default'](input).trigger('change');
  1983. }
  1984. }
  1985. input.focus();
  1986. addAriaPressed = false;
  1987. }
  1988. }
  1989. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  1990. if (addAriaPressed) {
  1991. this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
  1992. }
  1993. if (triggerChangeEvent) {
  1994. $__default['default'](this._element).toggleClass(CLASS_NAME_ACTIVE);
  1995. }
  1996. }
  1997. };
  1998. _proto.dispose = function dispose() {
  1999. $__default['default'].removeData(this._element, DATA_KEY$1);
  2000. this._element = null;
  2001. } // Static
  2002. ;
  2003. Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) {
  2004. return this.each(function () {
  2005. var $element = $__default['default'](this);
  2006. var data = $element.data(DATA_KEY$1);
  2007. if (!data) {
  2008. data = new Button(this);
  2009. $element.data(DATA_KEY$1, data);
  2010. }
  2011. data.shouldAvoidTriggerChange = avoidTriggerChange;
  2012. if (config === 'toggle') {
  2013. data[config]();
  2014. }
  2015. });
  2016. };
  2017. _createClass(Button, null, [{
  2018. key: "VERSION",
  2019. get: function get() {
  2020. return VERSION$1;
  2021. }
  2022. }]);
  2023. return Button;
  2024. }();
  2025. /**
  2026. * ------------------------------------------------------------------------
  2027. * Data Api implementation
  2028. * ------------------------------------------------------------------------
  2029. */
  2030. $__default['default'](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2031. var button = event.target;
  2032. var initialButton = button;
  2033. if (!$__default['default'](button).hasClass(CLASS_NAME_BUTTON)) {
  2034. button = $__default['default'](button).closest(SELECTOR_BUTTON)[0];
  2035. }
  2036. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2037. event.preventDefault(); // work around Firefox bug #1540995
  2038. } else {
  2039. var inputBtn = button.querySelector(SELECTOR_INPUT);
  2040. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2041. event.preventDefault(); // work around Firefox bug #1540995
  2042. return;
  2043. }
  2044. if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {
  2045. Button._jQueryInterface.call($__default['default'](button), 'toggle', initialButton.tagName === 'INPUT');
  2046. }
  2047. }
  2048. }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2049. var button = $__default['default'](event.target).closest(SELECTOR_BUTTON)[0];
  2050. $__default['default'](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
  2051. });
  2052. $__default['default'](window).on(EVENT_LOAD_DATA_API, function () {
  2053. // ensure correct active class is set to match the controls' actual values/states
  2054. // find all checkboxes/readio buttons inside data-toggle groups
  2055. var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
  2056. for (var i = 0, len = buttons.length; i < len; i++) {
  2057. var button = buttons[i];
  2058. var input = button.querySelector(SELECTOR_INPUT);
  2059. if (input.checked || input.hasAttribute('checked')) {
  2060. button.classList.add(CLASS_NAME_ACTIVE);
  2061. } else {
  2062. button.classList.remove(CLASS_NAME_ACTIVE);
  2063. }
  2064. } // find all button toggles
  2065. buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
  2066. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2067. var _button = buttons[_i];
  2068. if (_button.getAttribute('aria-pressed') === 'true') {
  2069. _button.classList.add(CLASS_NAME_ACTIVE);
  2070. } else {
  2071. _button.classList.remove(CLASS_NAME_ACTIVE);
  2072. }
  2073. }
  2074. });
  2075. /**
  2076. * ------------------------------------------------------------------------
  2077. * jQuery
  2078. * ------------------------------------------------------------------------
  2079. */
  2080. $__default['default'].fn[NAME$1] = Button._jQueryInterface;
  2081. $__default['default'].fn[NAME$1].Constructor = Button;
  2082. $__default['default'].fn[NAME$1].noConflict = function () {
  2083. $__default['default'].fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2084. return Button._jQueryInterface;
  2085. };
  2086. /**
  2087. * ------------------------------------------------------------------------
  2088. * Constants
  2089. * ------------------------------------------------------------------------
  2090. */
  2091. var NAME$2 = 'carousel';
  2092. var VERSION$2 = '4.5.3';
  2093. var DATA_KEY$2 = 'bs.carousel';
  2094. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2095. var DATA_API_KEY$2 = '.data-api';
  2096. var JQUERY_NO_CONFLICT$2 = $__default['default'].fn[NAME$2];
  2097. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2098. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2099. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2100. var SWIPE_THRESHOLD = 40;
  2101. var Default = {
  2102. interval: 5000,
  2103. keyboard: true,
  2104. slide: false,
  2105. pause: 'hover',
  2106. wrap: true,
  2107. touch: true
  2108. };
  2109. var DefaultType = {
  2110. interval: '(number|boolean)',
  2111. keyboard: 'boolean',
  2112. slide: '(boolean|string)',
  2113. pause: '(string|boolean)',
  2114. wrap: 'boolean',
  2115. touch: 'boolean'
  2116. };
  2117. var DIRECTION_NEXT = 'next';
  2118. var DIRECTION_PREV = 'prev';
  2119. var DIRECTION_LEFT = 'left';
  2120. var DIRECTION_RIGHT = 'right';
  2121. var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  2122. var EVENT_SLID = "slid" + EVENT_KEY$2;
  2123. var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  2124. var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  2125. var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  2126. var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  2127. var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  2128. var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  2129. var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  2130. var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  2131. var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  2132. var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  2133. var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  2134. var CLASS_NAME_CAROUSEL = 'carousel';
  2135. var CLASS_NAME_ACTIVE$1 = 'active';
  2136. var CLASS_NAME_SLIDE = 'slide';
  2137. var CLASS_NAME_RIGHT = 'carousel-item-right';
  2138. var CLASS_NAME_LEFT = 'carousel-item-left';
  2139. var CLASS_NAME_NEXT = 'carousel-item-next';
  2140. var CLASS_NAME_PREV = 'carousel-item-prev';
  2141. var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  2142. var SELECTOR_ACTIVE$1 = '.active';
  2143. var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  2144. var SELECTOR_ITEM = '.carousel-item';
  2145. var SELECTOR_ITEM_IMG = '.carousel-item img';
  2146. var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  2147. var SELECTOR_INDICATORS = '.carousel-indicators';
  2148. var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  2149. var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
  2150. var PointerType = {
  2151. TOUCH: 'touch',
  2152. PEN: 'pen'
  2153. };
  2154. /**
  2155. * ------------------------------------------------------------------------
  2156. * Class Definition
  2157. * ------------------------------------------------------------------------
  2158. */
  2159. var Carousel = /*#__PURE__*/function () {
  2160. function Carousel(element, config) {
  2161. this._items = null;
  2162. this._interval = null;
  2163. this._activeElement = null;
  2164. this._isPaused = false;
  2165. this._isSliding = false;
  2166. this.touchTimeout = null;
  2167. this.touchStartX = 0;
  2168. this.touchDeltaX = 0;
  2169. this._config = this._getConfig(config);
  2170. this._element = element;
  2171. this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
  2172. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2173. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2174. this._addEventListeners();
  2175. } // Getters
  2176. var _proto = Carousel.prototype;
  2177. // Public
  2178. _proto.next = function next() {
  2179. if (!this._isSliding) {
  2180. this._slide(DIRECTION_NEXT);
  2181. }
  2182. };
  2183. _proto.nextWhenVisible = function nextWhenVisible() {
  2184. var $element = $__default['default'](this._element); // Don't call next when the page isn't visible
  2185. // or the carousel or its parent isn't visible
  2186. if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
  2187. this.next();
  2188. }
  2189. };
  2190. _proto.prev = function prev() {
  2191. if (!this._isSliding) {
  2192. this._slide(DIRECTION_PREV);
  2193. }
  2194. };
  2195. _proto.pause = function pause(event) {
  2196. if (!event) {
  2197. this._isPaused = true;
  2198. }
  2199. if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
  2200. Util.triggerTransitionEnd(this._element);
  2201. this.cycle(true);
  2202. }
  2203. clearInterval(this._interval);
  2204. this._interval = null;
  2205. };
  2206. _proto.cycle = function cycle(event) {
  2207. if (!event) {
  2208. this._isPaused = false;
  2209. }
  2210. if (this._interval) {
  2211. clearInterval(this._interval);
  2212. this._interval = null;
  2213. }
  2214. if (this._config.interval && !this._isPaused) {
  2215. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2216. }
  2217. };
  2218. _proto.to = function to(index) {
  2219. var _this = this;
  2220. this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2221. var activeIndex = this._getItemIndex(this._activeElement);
  2222. if (index > this._items.length - 1 || index < 0) {
  2223. return;
  2224. }
  2225. if (this._isSliding) {
  2226. $__default['default'](this._element).one(EVENT_SLID, function () {
  2227. return _this.to(index);
  2228. });
  2229. return;
  2230. }
  2231. if (activeIndex === index) {
  2232. this.pause();
  2233. this.cycle();
  2234. return;
  2235. }
  2236. var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
  2237. this._slide(direction, this._items[index]);
  2238. };
  2239. _proto.dispose = function dispose() {
  2240. $__default['default'](this._element).off(EVENT_KEY$2);
  2241. $__default['default'].removeData(this._element, DATA_KEY$2);
  2242. this._items = null;
  2243. this._config = null;
  2244. this._element = null;
  2245. this._interval = null;
  2246. this._isPaused = null;
  2247. this._isSliding = null;
  2248. this._activeElement = null;
  2249. this._indicatorsElement = null;
  2250. } // Private
  2251. ;
  2252. _proto._getConfig = function _getConfig(config) {
  2253. config = _extends({}, Default, config);
  2254. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2255. return config;
  2256. };
  2257. _proto._handleSwipe = function _handleSwipe() {
  2258. var absDeltax = Math.abs(this.touchDeltaX);
  2259. if (absDeltax <= SWIPE_THRESHOLD) {
  2260. return;
  2261. }
  2262. var direction = absDeltax / this.touchDeltaX;
  2263. this.touchDeltaX = 0; // swipe left
  2264. if (direction > 0) {
  2265. this.prev();
  2266. } // swipe right
  2267. if (direction < 0) {
  2268. this.next();
  2269. }
  2270. };
  2271. _proto._addEventListeners = function _addEventListeners() {
  2272. var _this2 = this;
  2273. if (this._config.keyboard) {
  2274. $__default['default'](this._element).on(EVENT_KEYDOWN, function (event) {
  2275. return _this2._keydown(event);
  2276. });
  2277. }
  2278. if (this._config.pause === 'hover') {
  2279. $__default['default'](this._element).on(EVENT_MOUSEENTER, function (event) {
  2280. return _this2.pause(event);
  2281. }).on(EVENT_MOUSELEAVE, function (event) {
  2282. return _this2.cycle(event);
  2283. });
  2284. }
  2285. if (this._config.touch) {
  2286. this._addTouchEventListeners();
  2287. }
  2288. };
  2289. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2290. var _this3 = this;
  2291. if (!this._touchSupported) {
  2292. return;
  2293. }
  2294. var start = function start(event) {
  2295. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2296. _this3.touchStartX = event.originalEvent.clientX;
  2297. } else if (!_this3._pointerEvent) {
  2298. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2299. }
  2300. };
  2301. var move = function move(event) {
  2302. // ensure swiping with one touch and not pinching
  2303. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2304. _this3.touchDeltaX = 0;
  2305. } else {
  2306. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2307. }
  2308. };
  2309. var end = function end(event) {
  2310. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2311. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2312. }
  2313. _this3._handleSwipe();
  2314. if (_this3._config.pause === 'hover') {
  2315. // If it's a touch-enabled device, mouseenter/leave are fired as
  2316. // part of the mouse compatibility events on first tap - the carousel
  2317. // would stop cycling until user tapped out of it;
  2318. // here, we listen for touchend, explicitly pause the carousel
  2319. // (as if it's the second time we tap on it, mouseenter compat event
  2320. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2321. // events to fire) we explicitly restart cycling
  2322. _this3.pause();
  2323. if (_this3.touchTimeout) {
  2324. clearTimeout(_this3.touchTimeout);
  2325. }
  2326. _this3.touchTimeout = setTimeout(function (event) {
  2327. return _this3.cycle(event);
  2328. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2329. }
  2330. };
  2331. $__default['default'](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
  2332. return e.preventDefault();
  2333. });
  2334. if (this._pointerEvent) {
  2335. $__default['default'](this._element).on(EVENT_POINTERDOWN, function (event) {
  2336. return start(event);
  2337. });
  2338. $__default['default'](this._element).on(EVENT_POINTERUP, function (event) {
  2339. return end(event);
  2340. });
  2341. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  2342. } else {
  2343. $__default['default'](this._element).on(EVENT_TOUCHSTART, function (event) {
  2344. return start(event);
  2345. });
  2346. $__default['default'](this._element).on(EVENT_TOUCHMOVE, function (event) {
  2347. return move(event);
  2348. });
  2349. $__default['default'](this._element).on(EVENT_TOUCHEND, function (event) {
  2350. return end(event);
  2351. });
  2352. }
  2353. };
  2354. _proto._keydown = function _keydown(event) {
  2355. if (/input|textarea/i.test(event.target.tagName)) {
  2356. return;
  2357. }
  2358. switch (event.which) {
  2359. case ARROW_LEFT_KEYCODE:
  2360. event.preventDefault();
  2361. this.prev();
  2362. break;
  2363. case ARROW_RIGHT_KEYCODE:
  2364. event.preventDefault();
  2365. this.next();
  2366. break;
  2367. }
  2368. };
  2369. _proto._getItemIndex = function _getItemIndex(element) {
  2370. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
  2371. return this._items.indexOf(element);
  2372. };
  2373. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2374. var isNextDirection = direction === DIRECTION_NEXT;
  2375. var isPrevDirection = direction === DIRECTION_PREV;
  2376. var activeIndex = this._getItemIndex(activeElement);
  2377. var lastItemIndex = this._items.length - 1;
  2378. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2379. if (isGoingToWrap && !this._config.wrap) {
  2380. return activeElement;
  2381. }
  2382. var delta = direction === DIRECTION_PREV ? -1 : 1;
  2383. var itemIndex = (activeIndex + delta) % this._items.length;
  2384. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2385. };
  2386. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2387. var targetIndex = this._getItemIndex(relatedTarget);
  2388. var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
  2389. var slideEvent = $__default['default'].Event(EVENT_SLIDE, {
  2390. relatedTarget: relatedTarget,
  2391. direction: eventDirectionName,
  2392. from: fromIndex,
  2393. to: targetIndex
  2394. });
  2395. $__default['default'](this._element).trigger(slideEvent);
  2396. return slideEvent;
  2397. };
  2398. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2399. if (this._indicatorsElement) {
  2400. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
  2401. $__default['default'](indicators).removeClass(CLASS_NAME_ACTIVE$1);
  2402. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2403. if (nextIndicator) {
  2404. $__default['default'](nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
  2405. }
  2406. }
  2407. };
  2408. _proto._slide = function _slide(direction, element) {
  2409. var _this4 = this;
  2410. var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2411. var activeElementIndex = this._getItemIndex(activeElement);
  2412. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2413. var nextElementIndex = this._getItemIndex(nextElement);
  2414. var isCycling = Boolean(this._interval);
  2415. var directionalClassName;
  2416. var orderClassName;
  2417. var eventDirectionName;
  2418. if (direction === DIRECTION_NEXT) {
  2419. directionalClassName = CLASS_NAME_LEFT;
  2420. orderClassName = CLASS_NAME_NEXT;
  2421. eventDirectionName = DIRECTION_LEFT;
  2422. } else {
  2423. directionalClassName = CLASS_NAME_RIGHT;
  2424. orderClassName = CLASS_NAME_PREV;
  2425. eventDirectionName = DIRECTION_RIGHT;
  2426. }
  2427. if (nextElement && $__default['default'](nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
  2428. this._isSliding = false;
  2429. return;
  2430. }
  2431. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2432. if (slideEvent.isDefaultPrevented()) {
  2433. return;
  2434. }
  2435. if (!activeElement || !nextElement) {
  2436. // Some weirdness is happening, so we bail
  2437. return;
  2438. }
  2439. this._isSliding = true;
  2440. if (isCycling) {
  2441. this.pause();
  2442. }
  2443. this._setActiveIndicatorElement(nextElement);
  2444. var slidEvent = $__default['default'].Event(EVENT_SLID, {
  2445. relatedTarget: nextElement,
  2446. direction: eventDirectionName,
  2447. from: activeElementIndex,
  2448. to: nextElementIndex
  2449. });
  2450. if ($__default['default'](this._element).hasClass(CLASS_NAME_SLIDE)) {
  2451. $__default['default'](nextElement).addClass(orderClassName);
  2452. Util.reflow(nextElement);
  2453. $__default['default'](activeElement).addClass(directionalClassName);
  2454. $__default['default'](nextElement).addClass(directionalClassName);
  2455. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2456. if (nextElementInterval) {
  2457. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2458. this._config.interval = nextElementInterval;
  2459. } else {
  2460. this._config.interval = this._config.defaultInterval || this._config.interval;
  2461. }
  2462. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2463. $__default['default'](activeElement).one(Util.TRANSITION_END, function () {
  2464. $__default['default'](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
  2465. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
  2466. _this4._isSliding = false;
  2467. setTimeout(function () {
  2468. return $__default['default'](_this4._element).trigger(slidEvent);
  2469. }, 0);
  2470. }).emulateTransitionEnd(transitionDuration);
  2471. } else {
  2472. $__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1);
  2473. $__default['default'](nextElement).addClass(CLASS_NAME_ACTIVE$1);
  2474. this._isSliding = false;
  2475. $__default['default'](this._element).trigger(slidEvent);
  2476. }
  2477. if (isCycling) {
  2478. this.cycle();
  2479. }
  2480. } // Static
  2481. ;
  2482. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2483. return this.each(function () {
  2484. var data = $__default['default'](this).data(DATA_KEY$2);
  2485. var _config = _extends({}, Default, $__default['default'](this).data());
  2486. if (typeof config === 'object') {
  2487. _config = _extends({}, _config, config);
  2488. }
  2489. var action = typeof config === 'string' ? config : _config.slide;
  2490. if (!data) {
  2491. data = new Carousel(this, _config);
  2492. $__default['default'](this).data(DATA_KEY$2, data);
  2493. }
  2494. if (typeof config === 'number') {
  2495. data.to(config);
  2496. } else if (typeof action === 'string') {
  2497. if (typeof data[action] === 'undefined') {
  2498. throw new TypeError("No method named \"" + action + "\"");
  2499. }
  2500. data[action]();
  2501. } else if (_config.interval && _config.ride) {
  2502. data.pause();
  2503. data.cycle();
  2504. }
  2505. });
  2506. };
  2507. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2508. var selector = Util.getSelectorFromElement(this);
  2509. if (!selector) {
  2510. return;
  2511. }
  2512. var target = $__default['default'](selector)[0];
  2513. if (!target || !$__default['default'](target).hasClass(CLASS_NAME_CAROUSEL)) {
  2514. return;
  2515. }
  2516. var config = _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
  2517. var slideIndex = this.getAttribute('data-slide-to');
  2518. if (slideIndex) {
  2519. config.interval = false;
  2520. }
  2521. Carousel._jQueryInterface.call($__default['default'](target), config);
  2522. if (slideIndex) {
  2523. $__default['default'](target).data(DATA_KEY$2).to(slideIndex);
  2524. }
  2525. event.preventDefault();
  2526. };
  2527. _createClass(Carousel, null, [{
  2528. key: "VERSION",
  2529. get: function get() {
  2530. return VERSION$2;
  2531. }
  2532. }, {
  2533. key: "Default",
  2534. get: function get() {
  2535. return Default;
  2536. }
  2537. }]);
  2538. return Carousel;
  2539. }();
  2540. /**
  2541. * ------------------------------------------------------------------------
  2542. * Data Api implementation
  2543. * ------------------------------------------------------------------------
  2544. */
  2545. $__default['default'](document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
  2546. $__default['default'](window).on(EVENT_LOAD_DATA_API$1, function () {
  2547. var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
  2548. for (var i = 0, len = carousels.length; i < len; i++) {
  2549. var $carousel = $__default['default'](carousels[i]);
  2550. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2551. }
  2552. });
  2553. /**
  2554. * ------------------------------------------------------------------------
  2555. * jQuery
  2556. * ------------------------------------------------------------------------
  2557. */
  2558. $__default['default'].fn[NAME$2] = Carousel._jQueryInterface;
  2559. $__default['default'].fn[NAME$2].Constructor = Carousel;
  2560. $__default['default'].fn[NAME$2].noConflict = function () {
  2561. $__default['default'].fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2562. return Carousel._jQueryInterface;
  2563. };
  2564. /**
  2565. * ------------------------------------------------------------------------
  2566. * Constants
  2567. * ------------------------------------------------------------------------
  2568. */
  2569. var NAME$3 = 'collapse';
  2570. var VERSION$3 = '4.5.3';
  2571. var DATA_KEY$3 = 'bs.collapse';
  2572. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2573. var DATA_API_KEY$3 = '.data-api';
  2574. var JQUERY_NO_CONFLICT$3 = $__default['default'].fn[NAME$3];
  2575. var Default$1 = {
  2576. toggle: true,
  2577. parent: ''
  2578. };
  2579. var DefaultType$1 = {
  2580. toggle: 'boolean',
  2581. parent: '(string|element)'
  2582. };
  2583. var EVENT_SHOW = "show" + EVENT_KEY$3;
  2584. var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  2585. var EVENT_HIDE = "hide" + EVENT_KEY$3;
  2586. var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  2587. var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  2588. var CLASS_NAME_SHOW$1 = 'show';
  2589. var CLASS_NAME_COLLAPSE = 'collapse';
  2590. var CLASS_NAME_COLLAPSING = 'collapsing';
  2591. var CLASS_NAME_COLLAPSED = 'collapsed';
  2592. var DIMENSION_WIDTH = 'width';
  2593. var DIMENSION_HEIGHT = 'height';
  2594. var SELECTOR_ACTIVES = '.show, .collapsing';
  2595. var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
  2596. /**
  2597. * ------------------------------------------------------------------------
  2598. * Class Definition
  2599. * ------------------------------------------------------------------------
  2600. */
  2601. var Collapse = /*#__PURE__*/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_DATA_TOGGLE$1));
  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 ($__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2631. this.hide();
  2632. } else {
  2633. this.show();
  2634. }
  2635. };
  2636. _proto.show = function show() {
  2637. var _this = this;
  2638. if (this._isTransitioning || $__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2639. return;
  2640. }
  2641. var actives;
  2642. var activesData;
  2643. if (this._parent) {
  2644. actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_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(CLASS_NAME_COLLAPSE);
  2649. });
  2650. if (actives.length === 0) {
  2651. actives = null;
  2652. }
  2653. }
  2654. if (actives) {
  2655. activesData = $__default['default'](actives).not(this._selector).data(DATA_KEY$3);
  2656. if (activesData && activesData._isTransitioning) {
  2657. return;
  2658. }
  2659. }
  2660. var startEvent = $__default['default'].Event(EVENT_SHOW);
  2661. $__default['default'](this._element).trigger(startEvent);
  2662. if (startEvent.isDefaultPrevented()) {
  2663. return;
  2664. }
  2665. if (actives) {
  2666. Collapse._jQueryInterface.call($__default['default'](actives).not(this._selector), 'hide');
  2667. if (!activesData) {
  2668. $__default['default'](actives).data(DATA_KEY$3, null);
  2669. }
  2670. }
  2671. var dimension = this._getDimension();
  2672. $__default['default'](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
  2673. this._element.style[dimension] = 0;
  2674. if (this._triggerArray.length) {
  2675. $__default['default'](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
  2676. }
  2677. this.setTransitioning(true);
  2678. var complete = function complete() {
  2679. $__default['default'](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  2680. _this._element.style[dimension] = '';
  2681. _this.setTransitioning(false);
  2682. $__default['default'](_this._element).trigger(EVENT_SHOWN);
  2683. };
  2684. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2685. var scrollSize = "scroll" + capitalizedDimension;
  2686. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2687. $__default['default'](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 || !$__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
  2693. return;
  2694. }
  2695. var startEvent = $__default['default'].Event(EVENT_HIDE);
  2696. $__default['default'](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. $__default['default'](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  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 = $__default['default']([].slice.call(document.querySelectorAll(selector)));
  2711. if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
  2712. $__default['default'](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
  2713. }
  2714. }
  2715. }
  2716. }
  2717. this.setTransitioning(true);
  2718. var complete = function complete() {
  2719. _this2.setTransitioning(false);
  2720. $__default['default'](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
  2721. };
  2722. this._element.style[dimension] = '';
  2723. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2724. $__default['default'](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. $__default['default'].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 = _extends({}, 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 = $__default['default'](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. $__default['default'](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 = $__default['default'](element).hasClass(CLASS_NAME_SHOW$1);
  2768. if (triggerArray.length) {
  2769. $__default['default'](triggerArray).toggleClass(CLASS_NAME_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 $element = $__default['default'](this);
  2780. var data = $element.data(DATA_KEY$3);
  2781. var _config = _extends({}, Default$1, $element.data(), typeof config === 'object' && config ? config : {});
  2782. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  2783. _config.toggle = false;
  2784. }
  2785. if (!data) {
  2786. data = new Collapse(this, _config);
  2787. $element.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. $__default['default'](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, 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 = $__default['default'](this);
  2821. var selector = Util.getSelectorFromElement(this);
  2822. var selectors = [].slice.call(document.querySelectorAll(selector));
  2823. $__default['default'](selectors).each(function () {
  2824. var $target = $__default['default'](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. $__default['default'].fn[NAME$3] = Collapse._jQueryInterface;
  2836. $__default['default'].fn[NAME$3].Constructor = Collapse;
  2837. $__default['default'].fn[NAME$3].noConflict = function () {
  2838. $__default['default'].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.5.3';
  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 = $__default['default'].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_HIDE$1 = "hide" + EVENT_KEY$4;
  2860. var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  2861. var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  2862. var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  2863. var EVENT_CLICK = "click" + EVENT_KEY$4;
  2864. var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  2865. var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  2866. var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  2867. var CLASS_NAME_DISABLED = 'disabled';
  2868. var CLASS_NAME_SHOW$2 = 'show';
  2869. var CLASS_NAME_DROPUP = 'dropup';
  2870. var CLASS_NAME_DROPRIGHT = 'dropright';
  2871. var CLASS_NAME_DROPLEFT = 'dropleft';
  2872. var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  2873. var CLASS_NAME_POSITION_STATIC = 'position-static';
  2874. var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  2875. var SELECTOR_FORM_CHILD = '.dropdown form';
  2876. var SELECTOR_MENU = '.dropdown-menu';
  2877. var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  2878. var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  2879. var PLACEMENT_TOP = 'top-start';
  2880. var PLACEMENT_TOPEND = 'top-end';
  2881. var PLACEMENT_BOTTOM = 'bottom-start';
  2882. var PLACEMENT_BOTTOMEND = 'bottom-end';
  2883. var PLACEMENT_RIGHT = 'right-start';
  2884. var PLACEMENT_LEFT = 'left-start';
  2885. var Default$2 = {
  2886. offset: 0,
  2887. flip: true,
  2888. boundary: 'scrollParent',
  2889. reference: 'toggle',
  2890. display: 'dynamic',
  2891. popperConfig: null
  2892. };
  2893. var DefaultType$2 = {
  2894. offset: '(number|string|function)',
  2895. flip: 'boolean',
  2896. boundary: '(string|element)',
  2897. reference: '(string|element)',
  2898. display: 'string',
  2899. popperConfig: '(null|object)'
  2900. };
  2901. /**
  2902. * ------------------------------------------------------------------------
  2903. * Class Definition
  2904. * ------------------------------------------------------------------------
  2905. */
  2906. var Dropdown = /*#__PURE__*/function () {
  2907. function Dropdown(element, config) {
  2908. this._element = element;
  2909. this._popper = null;
  2910. this._config = this._getConfig(config);
  2911. this._menu = this._getMenuElement();
  2912. this._inNavbar = this._detectNavbar();
  2913. this._addEventListeners();
  2914. } // Getters
  2915. var _proto = Dropdown.prototype;
  2916. // Public
  2917. _proto.toggle = function toggle() {
  2918. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED)) {
  2919. return;
  2920. }
  2921. var isActive = $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2);
  2922. Dropdown._clearMenus();
  2923. if (isActive) {
  2924. return;
  2925. }
  2926. this.show(true);
  2927. };
  2928. _proto.show = function show(usePopper) {
  2929. if (usePopper === void 0) {
  2930. usePopper = false;
  2931. }
  2932. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2933. return;
  2934. }
  2935. var relatedTarget = {
  2936. relatedTarget: this._element
  2937. };
  2938. var showEvent = $__default['default'].Event(EVENT_SHOW$1, relatedTarget);
  2939. var parent = Dropdown._getParentFromElement(this._element);
  2940. $__default['default'](parent).trigger(showEvent);
  2941. if (showEvent.isDefaultPrevented()) {
  2942. return;
  2943. } // Disable totally Popper.js for Dropdown in Navbar
  2944. if (!this._inNavbar && usePopper) {
  2945. /**
  2946. * Check for Popper dependency
  2947. * Popper - https://popper.js.org
  2948. */
  2949. if (typeof Popper__default['default'] === 'undefined') {
  2950. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  2951. }
  2952. var referenceElement = this._element;
  2953. if (this._config.reference === 'parent') {
  2954. referenceElement = parent;
  2955. } else if (Util.isElement(this._config.reference)) {
  2956. referenceElement = this._config.reference; // Check if it's jQuery element
  2957. if (typeof this._config.reference.jquery !== 'undefined') {
  2958. referenceElement = this._config.reference[0];
  2959. }
  2960. } // If boundary is not `scrollParent`, then set position to `static`
  2961. // to allow the menu to "escape" the scroll parent's boundaries
  2962. // https://github.com/twbs/bootstrap/issues/24251
  2963. if (this._config.boundary !== 'scrollParent') {
  2964. $__default['default'](parent).addClass(CLASS_NAME_POSITION_STATIC);
  2965. }
  2966. this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
  2967. } // If this is a touch-enabled device we add extra
  2968. // empty mouseover listeners to the body's immediate children;
  2969. // only needed because of broken event delegation on iOS
  2970. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2971. if ('ontouchstart' in document.documentElement && $__default['default'](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
  2972. $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
  2973. }
  2974. this._element.focus();
  2975. this._element.setAttribute('aria-expanded', true);
  2976. $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
  2977. $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_SHOWN$1, relatedTarget));
  2978. };
  2979. _proto.hide = function hide() {
  2980. if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || !$__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  2981. return;
  2982. }
  2983. var relatedTarget = {
  2984. relatedTarget: this._element
  2985. };
  2986. var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
  2987. var parent = Dropdown._getParentFromElement(this._element);
  2988. $__default['default'](parent).trigger(hideEvent);
  2989. if (hideEvent.isDefaultPrevented()) {
  2990. return;
  2991. }
  2992. if (this._popper) {
  2993. this._popper.destroy();
  2994. }
  2995. $__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
  2996. $__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
  2997. };
  2998. _proto.dispose = function dispose() {
  2999. $__default['default'].removeData(this._element, DATA_KEY$4);
  3000. $__default['default'](this._element).off(EVENT_KEY$4);
  3001. this._element = null;
  3002. this._menu = null;
  3003. if (this._popper !== null) {
  3004. this._popper.destroy();
  3005. this._popper = null;
  3006. }
  3007. };
  3008. _proto.update = function update() {
  3009. this._inNavbar = this._detectNavbar();
  3010. if (this._popper !== null) {
  3011. this._popper.scheduleUpdate();
  3012. }
  3013. } // Private
  3014. ;
  3015. _proto._addEventListeners = function _addEventListeners() {
  3016. var _this = this;
  3017. $__default['default'](this._element).on(EVENT_CLICK, function (event) {
  3018. event.preventDefault();
  3019. event.stopPropagation();
  3020. _this.toggle();
  3021. });
  3022. };
  3023. _proto._getConfig = function _getConfig(config) {
  3024. config = _extends({}, this.constructor.Default, $__default['default'](this._element).data(), config);
  3025. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3026. return config;
  3027. };
  3028. _proto._getMenuElement = function _getMenuElement() {
  3029. if (!this._menu) {
  3030. var parent = Dropdown._getParentFromElement(this._element);
  3031. if (parent) {
  3032. this._menu = parent.querySelector(SELECTOR_MENU);
  3033. }
  3034. }
  3035. return this._menu;
  3036. };
  3037. _proto._getPlacement = function _getPlacement() {
  3038. var $parentDropdown = $__default['default'](this._element.parentNode);
  3039. var placement = PLACEMENT_BOTTOM; // Handle dropup
  3040. if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
  3041. placement = $__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3042. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
  3043. placement = PLACEMENT_RIGHT;
  3044. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
  3045. placement = PLACEMENT_LEFT;
  3046. } else if ($__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
  3047. placement = PLACEMENT_BOTTOMEND;
  3048. }
  3049. return placement;
  3050. };
  3051. _proto._detectNavbar = function _detectNavbar() {
  3052. return $__default['default'](this._element).closest('.navbar').length > 0;
  3053. };
  3054. _proto._getOffset = function _getOffset() {
  3055. var _this2 = this;
  3056. var offset = {};
  3057. if (typeof this._config.offset === 'function') {
  3058. offset.fn = function (data) {
  3059. data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  3060. return data;
  3061. };
  3062. } else {
  3063. offset.offset = this._config.offset;
  3064. }
  3065. return offset;
  3066. };
  3067. _proto._getPopperConfig = function _getPopperConfig() {
  3068. var popperConfig = {
  3069. placement: this._getPlacement(),
  3070. modifiers: {
  3071. offset: this._getOffset(),
  3072. flip: {
  3073. enabled: this._config.flip
  3074. },
  3075. preventOverflow: {
  3076. boundariesElement: this._config.boundary
  3077. }
  3078. }
  3079. }; // Disable Popper.js if we have a static display
  3080. if (this._config.display === 'static') {
  3081. popperConfig.modifiers.applyStyle = {
  3082. enabled: false
  3083. };
  3084. }
  3085. return _extends({}, popperConfig, this._config.popperConfig);
  3086. } // Static
  3087. ;
  3088. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3089. return this.each(function () {
  3090. var data = $__default['default'](this).data(DATA_KEY$4);
  3091. var _config = typeof config === 'object' ? config : null;
  3092. if (!data) {
  3093. data = new Dropdown(this, _config);
  3094. $__default['default'](this).data(DATA_KEY$4, data);
  3095. }
  3096. if (typeof config === 'string') {
  3097. if (typeof data[config] === 'undefined') {
  3098. throw new TypeError("No method named \"" + config + "\"");
  3099. }
  3100. data[config]();
  3101. }
  3102. });
  3103. };
  3104. Dropdown._clearMenus = function _clearMenus(event) {
  3105. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3106. return;
  3107. }
  3108. var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
  3109. for (var i = 0, len = toggles.length; i < len; i++) {
  3110. var parent = Dropdown._getParentFromElement(toggles[i]);
  3111. var context = $__default['default'](toggles[i]).data(DATA_KEY$4);
  3112. var relatedTarget = {
  3113. relatedTarget: toggles[i]
  3114. };
  3115. if (event && event.type === 'click') {
  3116. relatedTarget.clickEvent = event;
  3117. }
  3118. if (!context) {
  3119. continue;
  3120. }
  3121. var dropdownMenu = context._menu;
  3122. if (!$__default['default'](parent).hasClass(CLASS_NAME_SHOW$2)) {
  3123. continue;
  3124. }
  3125. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default['default'].contains(parent, event.target)) {
  3126. continue;
  3127. }
  3128. var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
  3129. $__default['default'](parent).trigger(hideEvent);
  3130. if (hideEvent.isDefaultPrevented()) {
  3131. continue;
  3132. } // If this is a touch-enabled device we remove the extra
  3133. // empty mouseover listeners we added for iOS support
  3134. if ('ontouchstart' in document.documentElement) {
  3135. $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
  3136. }
  3137. toggles[i].setAttribute('aria-expanded', 'false');
  3138. if (context._popper) {
  3139. context._popper.destroy();
  3140. }
  3141. $__default['default'](dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
  3142. $__default['default'](parent).removeClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
  3143. }
  3144. };
  3145. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3146. var parent;
  3147. var selector = Util.getSelectorFromElement(element);
  3148. if (selector) {
  3149. parent = document.querySelector(selector);
  3150. }
  3151. return parent || element.parentNode;
  3152. } // eslint-disable-next-line complexity
  3153. ;
  3154. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3155. // If not input/textarea:
  3156. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3157. // If input/textarea:
  3158. // - If space key => not a dropdown command
  3159. // - If key is other than escape
  3160. // - If key is not up or down => not a dropdown command
  3161. // - If trigger inside the menu => not a dropdown command
  3162. 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 || $__default['default'](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3163. return;
  3164. }
  3165. if (this.disabled || $__default['default'](this).hasClass(CLASS_NAME_DISABLED)) {
  3166. return;
  3167. }
  3168. var parent = Dropdown._getParentFromElement(this);
  3169. var isActive = $__default['default'](parent).hasClass(CLASS_NAME_SHOW$2);
  3170. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3171. return;
  3172. }
  3173. event.preventDefault();
  3174. event.stopPropagation();
  3175. if (!isActive || event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE) {
  3176. if (event.which === ESCAPE_KEYCODE) {
  3177. $__default['default'](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
  3178. }
  3179. $__default['default'](this).trigger('click');
  3180. return;
  3181. }
  3182. var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
  3183. return $__default['default'](item).is(':visible');
  3184. });
  3185. if (items.length === 0) {
  3186. return;
  3187. }
  3188. var index = items.indexOf(event.target);
  3189. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3190. // Up
  3191. index--;
  3192. }
  3193. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3194. // Down
  3195. index++;
  3196. }
  3197. if (index < 0) {
  3198. index = 0;
  3199. }
  3200. items[index].focus();
  3201. };
  3202. _createClass(Dropdown, null, [{
  3203. key: "VERSION",
  3204. get: function get() {
  3205. return VERSION$4;
  3206. }
  3207. }, {
  3208. key: "Default",
  3209. get: function get() {
  3210. return Default$2;
  3211. }
  3212. }, {
  3213. key: "DefaultType",
  3214. get: function get() {
  3215. return DefaultType$2;
  3216. }
  3217. }]);
  3218. return Dropdown;
  3219. }();
  3220. /**
  3221. * ------------------------------------------------------------------------
  3222. * Data Api implementation
  3223. * ------------------------------------------------------------------------
  3224. */
  3225. $__default['default'](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
  3226. event.preventDefault();
  3227. event.stopPropagation();
  3228. Dropdown._jQueryInterface.call($__default['default'](this), 'toggle');
  3229. }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
  3230. e.stopPropagation();
  3231. });
  3232. /**
  3233. * ------------------------------------------------------------------------
  3234. * jQuery
  3235. * ------------------------------------------------------------------------
  3236. */
  3237. $__default['default'].fn[NAME$4] = Dropdown._jQueryInterface;
  3238. $__default['default'].fn[NAME$4].Constructor = Dropdown;
  3239. $__default['default'].fn[NAME$4].noConflict = function () {
  3240. $__default['default'].fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3241. return Dropdown._jQueryInterface;
  3242. };
  3243. /**
  3244. * ------------------------------------------------------------------------
  3245. * Constants
  3246. * ------------------------------------------------------------------------
  3247. */
  3248. var NAME$5 = 'modal';
  3249. var VERSION$5 = '4.5.3';
  3250. var DATA_KEY$5 = 'bs.modal';
  3251. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3252. var DATA_API_KEY$5 = '.data-api';
  3253. var JQUERY_NO_CONFLICT$5 = $__default['default'].fn[NAME$5];
  3254. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3255. var Default$3 = {
  3256. backdrop: true,
  3257. keyboard: true,
  3258. focus: true,
  3259. show: true
  3260. };
  3261. var DefaultType$3 = {
  3262. backdrop: '(boolean|string)',
  3263. keyboard: 'boolean',
  3264. focus: 'boolean',
  3265. show: 'boolean'
  3266. };
  3267. var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  3268. var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  3269. var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  3270. var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  3271. var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  3272. var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  3273. var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  3274. var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  3275. var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  3276. var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  3277. var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  3278. var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  3279. var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
  3280. var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  3281. var CLASS_NAME_BACKDROP = 'modal-backdrop';
  3282. var CLASS_NAME_OPEN = 'modal-open';
  3283. var CLASS_NAME_FADE$1 = 'fade';
  3284. var CLASS_NAME_SHOW$3 = 'show';
  3285. var CLASS_NAME_STATIC = 'modal-static';
  3286. var SELECTOR_DIALOG = '.modal-dialog';
  3287. var SELECTOR_MODAL_BODY = '.modal-body';
  3288. var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  3289. var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  3290. var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3291. var SELECTOR_STICKY_CONTENT = '.sticky-top';
  3292. /**
  3293. * ------------------------------------------------------------------------
  3294. * Class Definition
  3295. * ------------------------------------------------------------------------
  3296. */
  3297. var Modal = /*#__PURE__*/function () {
  3298. function Modal(element, config) {
  3299. this._config = this._getConfig(config);
  3300. this._element = element;
  3301. this._dialog = element.querySelector(SELECTOR_DIALOG);
  3302. this._backdrop = null;
  3303. this._isShown = false;
  3304. this._isBodyOverflowing = false;
  3305. this._ignoreBackdropClick = false;
  3306. this._isTransitioning = false;
  3307. this._scrollbarWidth = 0;
  3308. } // Getters
  3309. var _proto = Modal.prototype;
  3310. // Public
  3311. _proto.toggle = function toggle(relatedTarget) {
  3312. return this._isShown ? this.hide() : this.show(relatedTarget);
  3313. };
  3314. _proto.show = function show(relatedTarget) {
  3315. var _this = this;
  3316. if (this._isShown || this._isTransitioning) {
  3317. return;
  3318. }
  3319. if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
  3320. this._isTransitioning = true;
  3321. }
  3322. var showEvent = $__default['default'].Event(EVENT_SHOW$2, {
  3323. relatedTarget: relatedTarget
  3324. });
  3325. $__default['default'](this._element).trigger(showEvent);
  3326. if (this._isShown || showEvent.isDefaultPrevented()) {
  3327. return;
  3328. }
  3329. this._isShown = true;
  3330. this._checkScrollbar();
  3331. this._setScrollbar();
  3332. this._adjustDialog();
  3333. this._setEscapeEvent();
  3334. this._setResizeEvent();
  3335. $__default['default'](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
  3336. return _this.hide(event);
  3337. });
  3338. $__default['default'](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
  3339. $__default['default'](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
  3340. if ($__default['default'](event.target).is(_this._element)) {
  3341. _this._ignoreBackdropClick = true;
  3342. }
  3343. });
  3344. });
  3345. this._showBackdrop(function () {
  3346. return _this._showElement(relatedTarget);
  3347. });
  3348. };
  3349. _proto.hide = function hide(event) {
  3350. var _this2 = this;
  3351. if (event) {
  3352. event.preventDefault();
  3353. }
  3354. if (!this._isShown || this._isTransitioning) {
  3355. return;
  3356. }
  3357. var hideEvent = $__default['default'].Event(EVENT_HIDE$2);
  3358. $__default['default'](this._element).trigger(hideEvent);
  3359. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3360. return;
  3361. }
  3362. this._isShown = false;
  3363. var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
  3364. if (transition) {
  3365. this._isTransitioning = true;
  3366. }
  3367. this._setEscapeEvent();
  3368. this._setResizeEvent();
  3369. $__default['default'](document).off(EVENT_FOCUSIN);
  3370. $__default['default'](this._element).removeClass(CLASS_NAME_SHOW$3);
  3371. $__default['default'](this._element).off(EVENT_CLICK_DISMISS);
  3372. $__default['default'](this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
  3373. if (transition) {
  3374. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3375. $__default['default'](this._element).one(Util.TRANSITION_END, function (event) {
  3376. return _this2._hideModal(event);
  3377. }).emulateTransitionEnd(transitionDuration);
  3378. } else {
  3379. this._hideModal();
  3380. }
  3381. };
  3382. _proto.dispose = function dispose() {
  3383. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3384. return $__default['default'](htmlElement).off(EVENT_KEY$5);
  3385. });
  3386. /**
  3387. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  3388. * Do not move `document` in `htmlElements` array
  3389. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  3390. */
  3391. $__default['default'](document).off(EVENT_FOCUSIN);
  3392. $__default['default'].removeData(this._element, DATA_KEY$5);
  3393. this._config = null;
  3394. this._element = null;
  3395. this._dialog = null;
  3396. this._backdrop = null;
  3397. this._isShown = null;
  3398. this._isBodyOverflowing = null;
  3399. this._ignoreBackdropClick = null;
  3400. this._isTransitioning = null;
  3401. this._scrollbarWidth = null;
  3402. };
  3403. _proto.handleUpdate = function handleUpdate() {
  3404. this._adjustDialog();
  3405. } // Private
  3406. ;
  3407. _proto._getConfig = function _getConfig(config) {
  3408. config = _extends({}, Default$3, config);
  3409. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3410. return config;
  3411. };
  3412. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3413. var _this3 = this;
  3414. if (this._config.backdrop === 'static') {
  3415. var hideEventPrevented = $__default['default'].Event(EVENT_HIDE_PREVENTED);
  3416. $__default['default'](this._element).trigger(hideEventPrevented);
  3417. if (hideEventPrevented.isDefaultPrevented()) {
  3418. return;
  3419. }
  3420. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3421. if (!isModalOverflowing) {
  3422. this._element.style.overflowY = 'hidden';
  3423. }
  3424. this._element.classList.add(CLASS_NAME_STATIC);
  3425. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3426. $__default['default'](this._element).off(Util.TRANSITION_END);
  3427. $__default['default'](this._element).one(Util.TRANSITION_END, function () {
  3428. _this3._element.classList.remove(CLASS_NAME_STATIC);
  3429. if (!isModalOverflowing) {
  3430. $__default['default'](_this3._element).one(Util.TRANSITION_END, function () {
  3431. _this3._element.style.overflowY = '';
  3432. }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
  3433. }
  3434. }).emulateTransitionEnd(modalTransitionDuration);
  3435. this._element.focus();
  3436. } else {
  3437. this.hide();
  3438. }
  3439. };
  3440. _proto._showElement = function _showElement(relatedTarget) {
  3441. var _this4 = this;
  3442. var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
  3443. var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
  3444. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3445. // Don't move modal's DOM position
  3446. document.body.appendChild(this._element);
  3447. }
  3448. this._element.style.display = 'block';
  3449. this._element.removeAttribute('aria-hidden');
  3450. this._element.setAttribute('aria-modal', true);
  3451. this._element.setAttribute('role', 'dialog');
  3452. if ($__default['default'](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
  3453. modalBody.scrollTop = 0;
  3454. } else {
  3455. this._element.scrollTop = 0;
  3456. }
  3457. if (transition) {
  3458. Util.reflow(this._element);
  3459. }
  3460. $__default['default'](this._element).addClass(CLASS_NAME_SHOW$3);
  3461. if (this._config.focus) {
  3462. this._enforceFocus();
  3463. }
  3464. var shownEvent = $__default['default'].Event(EVENT_SHOWN$2, {
  3465. relatedTarget: relatedTarget
  3466. });
  3467. var transitionComplete = function transitionComplete() {
  3468. if (_this4._config.focus) {
  3469. _this4._element.focus();
  3470. }
  3471. _this4._isTransitioning = false;
  3472. $__default['default'](_this4._element).trigger(shownEvent);
  3473. };
  3474. if (transition) {
  3475. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3476. $__default['default'](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3477. } else {
  3478. transitionComplete();
  3479. }
  3480. };
  3481. _proto._enforceFocus = function _enforceFocus() {
  3482. var _this5 = this;
  3483. $__default['default'](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
  3484. .on(EVENT_FOCUSIN, function (event) {
  3485. if (document !== event.target && _this5._element !== event.target && $__default['default'](_this5._element).has(event.target).length === 0) {
  3486. _this5._element.focus();
  3487. }
  3488. });
  3489. };
  3490. _proto._setEscapeEvent = function _setEscapeEvent() {
  3491. var _this6 = this;
  3492. if (this._isShown) {
  3493. $__default['default'](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
  3494. if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3495. event.preventDefault();
  3496. _this6.hide();
  3497. } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3498. _this6._triggerBackdropTransition();
  3499. }
  3500. });
  3501. } else if (!this._isShown) {
  3502. $__default['default'](this._element).off(EVENT_KEYDOWN_DISMISS);
  3503. }
  3504. };
  3505. _proto._setResizeEvent = function _setResizeEvent() {
  3506. var _this7 = this;
  3507. if (this._isShown) {
  3508. $__default['default'](window).on(EVENT_RESIZE, function (event) {
  3509. return _this7.handleUpdate(event);
  3510. });
  3511. } else {
  3512. $__default['default'](window).off(EVENT_RESIZE);
  3513. }
  3514. };
  3515. _proto._hideModal = function _hideModal() {
  3516. var _this8 = this;
  3517. this._element.style.display = 'none';
  3518. this._element.setAttribute('aria-hidden', true);
  3519. this._element.removeAttribute('aria-modal');
  3520. this._element.removeAttribute('role');
  3521. this._isTransitioning = false;
  3522. this._showBackdrop(function () {
  3523. $__default['default'](document.body).removeClass(CLASS_NAME_OPEN);
  3524. _this8._resetAdjustments();
  3525. _this8._resetScrollbar();
  3526. $__default['default'](_this8._element).trigger(EVENT_HIDDEN$2);
  3527. });
  3528. };
  3529. _proto._removeBackdrop = function _removeBackdrop() {
  3530. if (this._backdrop) {
  3531. $__default['default'](this._backdrop).remove();
  3532. this._backdrop = null;
  3533. }
  3534. };
  3535. _proto._showBackdrop = function _showBackdrop(callback) {
  3536. var _this9 = this;
  3537. var animate = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
  3538. if (this._isShown && this._config.backdrop) {
  3539. this._backdrop = document.createElement('div');
  3540. this._backdrop.className = CLASS_NAME_BACKDROP;
  3541. if (animate) {
  3542. this._backdrop.classList.add(animate);
  3543. }
  3544. $__default['default'](this._backdrop).appendTo(document.body);
  3545. $__default['default'](this._element).on(EVENT_CLICK_DISMISS, function (event) {
  3546. if (_this9._ignoreBackdropClick) {
  3547. _this9._ignoreBackdropClick = false;
  3548. return;
  3549. }
  3550. if (event.target !== event.currentTarget) {
  3551. return;
  3552. }
  3553. _this9._triggerBackdropTransition();
  3554. });
  3555. if (animate) {
  3556. Util.reflow(this._backdrop);
  3557. }
  3558. $__default['default'](this._backdrop).addClass(CLASS_NAME_SHOW$3);
  3559. if (!callback) {
  3560. return;
  3561. }
  3562. if (!animate) {
  3563. callback();
  3564. return;
  3565. }
  3566. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3567. $__default['default'](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3568. } else if (!this._isShown && this._backdrop) {
  3569. $__default['default'](this._backdrop).removeClass(CLASS_NAME_SHOW$3);
  3570. var callbackRemove = function callbackRemove() {
  3571. _this9._removeBackdrop();
  3572. if (callback) {
  3573. callback();
  3574. }
  3575. };
  3576. if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
  3577. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3578. $__default['default'](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3579. } else {
  3580. callbackRemove();
  3581. }
  3582. } else if (callback) {
  3583. callback();
  3584. }
  3585. } // ----------------------------------------------------------------------
  3586. // the following methods are used to handle overflowing modals
  3587. // todo (fat): these should probably be refactored out of modal.js
  3588. // ----------------------------------------------------------------------
  3589. ;
  3590. _proto._adjustDialog = function _adjustDialog() {
  3591. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3592. if (!this._isBodyOverflowing && isModalOverflowing) {
  3593. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3594. }
  3595. if (this._isBodyOverflowing && !isModalOverflowing) {
  3596. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3597. }
  3598. };
  3599. _proto._resetAdjustments = function _resetAdjustments() {
  3600. this._element.style.paddingLeft = '';
  3601. this._element.style.paddingRight = '';
  3602. };
  3603. _proto._checkScrollbar = function _checkScrollbar() {
  3604. var rect = document.body.getBoundingClientRect();
  3605. this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
  3606. this._scrollbarWidth = this._getScrollbarWidth();
  3607. };
  3608. _proto._setScrollbar = function _setScrollbar() {
  3609. var _this10 = this;
  3610. if (this._isBodyOverflowing) {
  3611. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3612. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3613. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3614. var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
  3615. $__default['default'](fixedContent).each(function (index, element) {
  3616. var actualPadding = element.style.paddingRight;
  3617. var calculatedPadding = $__default['default'](element).css('padding-right');
  3618. $__default['default'](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3619. }); // Adjust sticky content margin
  3620. $__default['default'](stickyContent).each(function (index, element) {
  3621. var actualMargin = element.style.marginRight;
  3622. var calculatedMargin = $__default['default'](element).css('margin-right');
  3623. $__default['default'](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3624. }); // Adjust body padding
  3625. var actualPadding = document.body.style.paddingRight;
  3626. var calculatedPadding = $__default['default'](document.body).css('padding-right');
  3627. $__default['default'](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3628. }
  3629. $__default['default'](document.body).addClass(CLASS_NAME_OPEN);
  3630. };
  3631. _proto._resetScrollbar = function _resetScrollbar() {
  3632. // Restore fixed content padding
  3633. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  3634. $__default['default'](fixedContent).each(function (index, element) {
  3635. var padding = $__default['default'](element).data('padding-right');
  3636. $__default['default'](element).removeData('padding-right');
  3637. element.style.paddingRight = padding ? padding : '';
  3638. }); // Restore sticky content
  3639. var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
  3640. $__default['default'](elements).each(function (index, element) {
  3641. var margin = $__default['default'](element).data('margin-right');
  3642. if (typeof margin !== 'undefined') {
  3643. $__default['default'](element).css('margin-right', margin).removeData('margin-right');
  3644. }
  3645. }); // Restore body padding
  3646. var padding = $__default['default'](document.body).data('padding-right');
  3647. $__default['default'](document.body).removeData('padding-right');
  3648. document.body.style.paddingRight = padding ? padding : '';
  3649. };
  3650. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3651. // thx d.walsh
  3652. var scrollDiv = document.createElement('div');
  3653. scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
  3654. document.body.appendChild(scrollDiv);
  3655. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3656. document.body.removeChild(scrollDiv);
  3657. return scrollbarWidth;
  3658. } // Static
  3659. ;
  3660. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3661. return this.each(function () {
  3662. var data = $__default['default'](this).data(DATA_KEY$5);
  3663. var _config = _extends({}, Default$3, $__default['default'](this).data(), typeof config === 'object' && config ? config : {});
  3664. if (!data) {
  3665. data = new Modal(this, _config);
  3666. $__default['default'](this).data(DATA_KEY$5, data);
  3667. }
  3668. if (typeof config === 'string') {
  3669. if (typeof data[config] === 'undefined') {
  3670. throw new TypeError("No method named \"" + config + "\"");
  3671. }
  3672. data[config](relatedTarget);
  3673. } else if (_config.show) {
  3674. data.show(relatedTarget);
  3675. }
  3676. });
  3677. };
  3678. _createClass(Modal, null, [{
  3679. key: "VERSION",
  3680. get: function get() {
  3681. return VERSION$5;
  3682. }
  3683. }, {
  3684. key: "Default",
  3685. get: function get() {
  3686. return Default$3;
  3687. }
  3688. }]);
  3689. return Modal;
  3690. }();
  3691. /**
  3692. * ------------------------------------------------------------------------
  3693. * Data Api implementation
  3694. * ------------------------------------------------------------------------
  3695. */
  3696. $__default['default'](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
  3697. var _this11 = this;
  3698. var target;
  3699. var selector = Util.getSelectorFromElement(this);
  3700. if (selector) {
  3701. target = document.querySelector(selector);
  3702. }
  3703. var config = $__default['default'](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
  3704. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3705. event.preventDefault();
  3706. }
  3707. var $target = $__default['default'](target).one(EVENT_SHOW$2, function (showEvent) {
  3708. if (showEvent.isDefaultPrevented()) {
  3709. // Only register focus restorer if modal will actually get shown
  3710. return;
  3711. }
  3712. $target.one(EVENT_HIDDEN$2, function () {
  3713. if ($__default['default'](_this11).is(':visible')) {
  3714. _this11.focus();
  3715. }
  3716. });
  3717. });
  3718. Modal._jQueryInterface.call($__default['default'](target), config, this);
  3719. });
  3720. /**
  3721. * ------------------------------------------------------------------------
  3722. * jQuery
  3723. * ------------------------------------------------------------------------
  3724. */
  3725. $__default['default'].fn[NAME$5] = Modal._jQueryInterface;
  3726. $__default['default'].fn[NAME$5].Constructor = Modal;
  3727. $__default['default'].fn[NAME$5].noConflict = function () {
  3728. $__default['default'].fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3729. return Modal._jQueryInterface;
  3730. };
  3731. /**
  3732. * --------------------------------------------------------------------------
  3733. * Bootstrap (v4.5.3): tools/sanitizer.js
  3734. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3735. * --------------------------------------------------------------------------
  3736. */
  3737. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3738. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3739. var DefaultWhitelist = {
  3740. // Global attributes allowed on any supplied element below.
  3741. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3742. a: ['target', 'href', 'title', 'rel'],
  3743. area: [],
  3744. b: [],
  3745. br: [],
  3746. col: [],
  3747. code: [],
  3748. div: [],
  3749. em: [],
  3750. hr: [],
  3751. h1: [],
  3752. h2: [],
  3753. h3: [],
  3754. h4: [],
  3755. h5: [],
  3756. h6: [],
  3757. i: [],
  3758. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  3759. li: [],
  3760. ol: [],
  3761. p: [],
  3762. pre: [],
  3763. s: [],
  3764. small: [],
  3765. span: [],
  3766. sub: [],
  3767. sup: [],
  3768. strong: [],
  3769. u: [],
  3770. ul: []
  3771. };
  3772. /**
  3773. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3774. *
  3775. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3776. */
  3777. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
  3778. /**
  3779. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3780. *
  3781. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3782. */
  3783. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
  3784. function allowedAttribute(attr, allowedAttributeList) {
  3785. var attrName = attr.nodeName.toLowerCase();
  3786. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3787. if (uriAttrs.indexOf(attrName) !== -1) {
  3788. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3789. }
  3790. return true;
  3791. }
  3792. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3793. return attrRegex instanceof RegExp;
  3794. }); // Check if a regular expression validates the attribute.
  3795. for (var i = 0, len = regExp.length; i < len; i++) {
  3796. if (attrName.match(regExp[i])) {
  3797. return true;
  3798. }
  3799. }
  3800. return false;
  3801. }
  3802. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3803. if (unsafeHtml.length === 0) {
  3804. return unsafeHtml;
  3805. }
  3806. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3807. return sanitizeFn(unsafeHtml);
  3808. }
  3809. var domParser = new window.DOMParser();
  3810. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3811. var whitelistKeys = Object.keys(whiteList);
  3812. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3813. var _loop = function _loop(i, len) {
  3814. var el = elements[i];
  3815. var elName = el.nodeName.toLowerCase();
  3816. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3817. el.parentNode.removeChild(el);
  3818. return "continue";
  3819. }
  3820. var attributeList = [].slice.call(el.attributes);
  3821. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3822. attributeList.forEach(function (attr) {
  3823. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3824. el.removeAttribute(attr.nodeName);
  3825. }
  3826. });
  3827. };
  3828. for (var i = 0, len = elements.length; i < len; i++) {
  3829. var _ret = _loop(i);
  3830. if (_ret === "continue") continue;
  3831. }
  3832. return createdDocument.body.innerHTML;
  3833. }
  3834. /**
  3835. * ------------------------------------------------------------------------
  3836. * Constants
  3837. * ------------------------------------------------------------------------
  3838. */
  3839. var NAME$6 = 'tooltip';
  3840. var VERSION$6 = '4.5.3';
  3841. var DATA_KEY$6 = 'bs.tooltip';
  3842. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3843. var JQUERY_NO_CONFLICT$6 = $__default['default'].fn[NAME$6];
  3844. var CLASS_PREFIX = 'bs-tooltip';
  3845. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3846. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3847. var DefaultType$4 = {
  3848. animation: 'boolean',
  3849. template: 'string',
  3850. title: '(string|element|function)',
  3851. trigger: 'string',
  3852. delay: '(number|object)',
  3853. html: 'boolean',
  3854. selector: '(string|boolean)',
  3855. placement: '(string|function)',
  3856. offset: '(number|string|function)',
  3857. container: '(string|element|boolean)',
  3858. fallbackPlacement: '(string|array)',
  3859. boundary: '(string|element)',
  3860. sanitize: 'boolean',
  3861. sanitizeFn: '(null|function)',
  3862. whiteList: 'object',
  3863. popperConfig: '(null|object)'
  3864. };
  3865. var AttachmentMap = {
  3866. AUTO: 'auto',
  3867. TOP: 'top',
  3868. RIGHT: 'right',
  3869. BOTTOM: 'bottom',
  3870. LEFT: 'left'
  3871. };
  3872. var Default$4 = {
  3873. animation: true,
  3874. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3875. trigger: 'hover focus',
  3876. title: '',
  3877. delay: 0,
  3878. html: false,
  3879. selector: false,
  3880. placement: 'top',
  3881. offset: 0,
  3882. container: false,
  3883. fallbackPlacement: 'flip',
  3884. boundary: 'scrollParent',
  3885. sanitize: true,
  3886. sanitizeFn: null,
  3887. whiteList: DefaultWhitelist,
  3888. popperConfig: null
  3889. };
  3890. var HOVER_STATE_SHOW = 'show';
  3891. var HOVER_STATE_OUT = 'out';
  3892. var Event = {
  3893. HIDE: "hide" + EVENT_KEY$6,
  3894. HIDDEN: "hidden" + EVENT_KEY$6,
  3895. SHOW: "show" + EVENT_KEY$6,
  3896. SHOWN: "shown" + EVENT_KEY$6,
  3897. INSERTED: "inserted" + EVENT_KEY$6,
  3898. CLICK: "click" + EVENT_KEY$6,
  3899. FOCUSIN: "focusin" + EVENT_KEY$6,
  3900. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3901. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3902. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3903. };
  3904. var CLASS_NAME_FADE$2 = 'fade';
  3905. var CLASS_NAME_SHOW$4 = 'show';
  3906. var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  3907. var SELECTOR_ARROW = '.arrow';
  3908. var TRIGGER_HOVER = 'hover';
  3909. var TRIGGER_FOCUS = 'focus';
  3910. var TRIGGER_CLICK = 'click';
  3911. var TRIGGER_MANUAL = 'manual';
  3912. /**
  3913. * ------------------------------------------------------------------------
  3914. * Class Definition
  3915. * ------------------------------------------------------------------------
  3916. */
  3917. var Tooltip = /*#__PURE__*/function () {
  3918. function Tooltip(element, config) {
  3919. if (typeof Popper__default['default'] === 'undefined') {
  3920. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  3921. } // private
  3922. this._isEnabled = true;
  3923. this._timeout = 0;
  3924. this._hoverState = '';
  3925. this._activeTrigger = {};
  3926. this._popper = null; // Protected
  3927. this.element = element;
  3928. this.config = this._getConfig(config);
  3929. this.tip = null;
  3930. this._setListeners();
  3931. } // Getters
  3932. var _proto = Tooltip.prototype;
  3933. // Public
  3934. _proto.enable = function enable() {
  3935. this._isEnabled = true;
  3936. };
  3937. _proto.disable = function disable() {
  3938. this._isEnabled = false;
  3939. };
  3940. _proto.toggleEnabled = function toggleEnabled() {
  3941. this._isEnabled = !this._isEnabled;
  3942. };
  3943. _proto.toggle = function toggle(event) {
  3944. if (!this._isEnabled) {
  3945. return;
  3946. }
  3947. if (event) {
  3948. var dataKey = this.constructor.DATA_KEY;
  3949. var context = $__default['default'](event.currentTarget).data(dataKey);
  3950. if (!context) {
  3951. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3952. $__default['default'](event.currentTarget).data(dataKey, context);
  3953. }
  3954. context._activeTrigger.click = !context._activeTrigger.click;
  3955. if (context._isWithActiveTrigger()) {
  3956. context._enter(null, context);
  3957. } else {
  3958. context._leave(null, context);
  3959. }
  3960. } else {
  3961. if ($__default['default'](this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
  3962. this._leave(null, this);
  3963. return;
  3964. }
  3965. this._enter(null, this);
  3966. }
  3967. };
  3968. _proto.dispose = function dispose() {
  3969. clearTimeout(this._timeout);
  3970. $__default['default'].removeData(this.element, this.constructor.DATA_KEY);
  3971. $__default['default'](this.element).off(this.constructor.EVENT_KEY);
  3972. $__default['default'](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  3973. if (this.tip) {
  3974. $__default['default'](this.tip).remove();
  3975. }
  3976. this._isEnabled = null;
  3977. this._timeout = null;
  3978. this._hoverState = null;
  3979. this._activeTrigger = null;
  3980. if (this._popper) {
  3981. this._popper.destroy();
  3982. }
  3983. this._popper = null;
  3984. this.element = null;
  3985. this.config = null;
  3986. this.tip = null;
  3987. };
  3988. _proto.show = function show() {
  3989. var _this = this;
  3990. if ($__default['default'](this.element).css('display') === 'none') {
  3991. throw new Error('Please use show on visible elements');
  3992. }
  3993. var showEvent = $__default['default'].Event(this.constructor.Event.SHOW);
  3994. if (this.isWithContent() && this._isEnabled) {
  3995. $__default['default'](this.element).trigger(showEvent);
  3996. var shadowRoot = Util.findShadowRoot(this.element);
  3997. var isInTheDom = $__default['default'].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  3998. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  3999. return;
  4000. }
  4001. var tip = this.getTipElement();
  4002. var tipId = Util.getUID(this.constructor.NAME);
  4003. tip.setAttribute('id', tipId);
  4004. this.element.setAttribute('aria-describedby', tipId);
  4005. this.setContent();
  4006. if (this.config.animation) {
  4007. $__default['default'](tip).addClass(CLASS_NAME_FADE$2);
  4008. }
  4009. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4010. var attachment = this._getAttachment(placement);
  4011. this.addAttachmentClass(attachment);
  4012. var container = this._getContainer();
  4013. $__default['default'](tip).data(this.constructor.DATA_KEY, this);
  4014. if (!$__default['default'].contains(this.element.ownerDocument.documentElement, this.tip)) {
  4015. $__default['default'](tip).appendTo(container);
  4016. }
  4017. $__default['default'](this.element).trigger(this.constructor.Event.INSERTED);
  4018. this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
  4019. $__default['default'](tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
  4020. // empty mouseover listeners to the body's immediate children;
  4021. // only needed because of broken event delegation on iOS
  4022. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4023. if ('ontouchstart' in document.documentElement) {
  4024. $__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
  4025. }
  4026. var complete = function complete() {
  4027. if (_this.config.animation) {
  4028. _this._fixTransition();
  4029. }
  4030. var prevHoverState = _this._hoverState;
  4031. _this._hoverState = null;
  4032. $__default['default'](_this.element).trigger(_this.constructor.Event.SHOWN);
  4033. if (prevHoverState === HOVER_STATE_OUT) {
  4034. _this._leave(null, _this);
  4035. }
  4036. };
  4037. if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4038. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4039. $__default['default'](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4040. } else {
  4041. complete();
  4042. }
  4043. }
  4044. };
  4045. _proto.hide = function hide(callback) {
  4046. var _this2 = this;
  4047. var tip = this.getTipElement();
  4048. var hideEvent = $__default['default'].Event(this.constructor.Event.HIDE);
  4049. var complete = function complete() {
  4050. if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
  4051. tip.parentNode.removeChild(tip);
  4052. }
  4053. _this2._cleanTipClass();
  4054. _this2.element.removeAttribute('aria-describedby');
  4055. $__default['default'](_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4056. if (_this2._popper !== null) {
  4057. _this2._popper.destroy();
  4058. }
  4059. if (callback) {
  4060. callback();
  4061. }
  4062. };
  4063. $__default['default'](this.element).trigger(hideEvent);
  4064. if (hideEvent.isDefaultPrevented()) {
  4065. return;
  4066. }
  4067. $__default['default'](tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
  4068. // empty mouseover listeners we added for iOS support
  4069. if ('ontouchstart' in document.documentElement) {
  4070. $__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
  4071. }
  4072. this._activeTrigger[TRIGGER_CLICK] = false;
  4073. this._activeTrigger[TRIGGER_FOCUS] = false;
  4074. this._activeTrigger[TRIGGER_HOVER] = false;
  4075. if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4076. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4077. $__default['default'](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4078. } else {
  4079. complete();
  4080. }
  4081. this._hoverState = '';
  4082. };
  4083. _proto.update = function update() {
  4084. if (this._popper !== null) {
  4085. this._popper.scheduleUpdate();
  4086. }
  4087. } // Protected
  4088. ;
  4089. _proto.isWithContent = function isWithContent() {
  4090. return Boolean(this.getTitle());
  4091. };
  4092. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4093. $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4094. };
  4095. _proto.getTipElement = function getTipElement() {
  4096. this.tip = this.tip || $__default['default'](this.config.template)[0];
  4097. return this.tip;
  4098. };
  4099. _proto.setContent = function setContent() {
  4100. var tip = this.getTipElement();
  4101. this.setElementContent($__default['default'](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
  4102. $__default['default'](tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
  4103. };
  4104. _proto.setElementContent = function setElementContent($element, content) {
  4105. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4106. // Content is a DOM node or a jQuery
  4107. if (this.config.html) {
  4108. if (!$__default['default'](content).parent().is($element)) {
  4109. $element.empty().append(content);
  4110. }
  4111. } else {
  4112. $element.text($__default['default'](content).text());
  4113. }
  4114. return;
  4115. }
  4116. if (this.config.html) {
  4117. if (this.config.sanitize) {
  4118. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4119. }
  4120. $element.html(content);
  4121. } else {
  4122. $element.text(content);
  4123. }
  4124. };
  4125. _proto.getTitle = function getTitle() {
  4126. var title = this.element.getAttribute('data-original-title');
  4127. if (!title) {
  4128. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4129. }
  4130. return title;
  4131. } // Private
  4132. ;
  4133. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4134. var _this3 = this;
  4135. var defaultBsConfig = {
  4136. placement: attachment,
  4137. modifiers: {
  4138. offset: this._getOffset(),
  4139. flip: {
  4140. behavior: this.config.fallbackPlacement
  4141. },
  4142. arrow: {
  4143. element: SELECTOR_ARROW
  4144. },
  4145. preventOverflow: {
  4146. boundariesElement: this.config.boundary
  4147. }
  4148. },
  4149. onCreate: function onCreate(data) {
  4150. if (data.originalPlacement !== data.placement) {
  4151. _this3._handlePopperPlacementChange(data);
  4152. }
  4153. },
  4154. onUpdate: function onUpdate(data) {
  4155. return _this3._handlePopperPlacementChange(data);
  4156. }
  4157. };
  4158. return _extends({}, defaultBsConfig, this.config.popperConfig);
  4159. };
  4160. _proto._getOffset = function _getOffset() {
  4161. var _this4 = this;
  4162. var offset = {};
  4163. if (typeof this.config.offset === 'function') {
  4164. offset.fn = function (data) {
  4165. data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
  4166. return data;
  4167. };
  4168. } else {
  4169. offset.offset = this.config.offset;
  4170. }
  4171. return offset;
  4172. };
  4173. _proto._getContainer = function _getContainer() {
  4174. if (this.config.container === false) {
  4175. return document.body;
  4176. }
  4177. if (Util.isElement(this.config.container)) {
  4178. return $__default['default'](this.config.container);
  4179. }
  4180. return $__default['default'](document).find(this.config.container);
  4181. };
  4182. _proto._getAttachment = function _getAttachment(placement) {
  4183. return AttachmentMap[placement.toUpperCase()];
  4184. };
  4185. _proto._setListeners = function _setListeners() {
  4186. var _this5 = this;
  4187. var triggers = this.config.trigger.split(' ');
  4188. triggers.forEach(function (trigger) {
  4189. if (trigger === 'click') {
  4190. $__default['default'](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4191. return _this5.toggle(event);
  4192. });
  4193. } else if (trigger !== TRIGGER_MANUAL) {
  4194. var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4195. var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4196. $__default['default'](_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4197. return _this5._enter(event);
  4198. }).on(eventOut, _this5.config.selector, function (event) {
  4199. return _this5._leave(event);
  4200. });
  4201. }
  4202. });
  4203. this._hideModalHandler = function () {
  4204. if (_this5.element) {
  4205. _this5.hide();
  4206. }
  4207. };
  4208. $__default['default'](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4209. if (this.config.selector) {
  4210. this.config = _extends({}, this.config, {
  4211. trigger: 'manual',
  4212. selector: ''
  4213. });
  4214. } else {
  4215. this._fixTitle();
  4216. }
  4217. };
  4218. _proto._fixTitle = function _fixTitle() {
  4219. var titleType = typeof this.element.getAttribute('data-original-title');
  4220. if (this.element.getAttribute('title') || titleType !== 'string') {
  4221. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4222. this.element.setAttribute('title', '');
  4223. }
  4224. };
  4225. _proto._enter = function _enter(event, context) {
  4226. var dataKey = this.constructor.DATA_KEY;
  4227. context = context || $__default['default'](event.currentTarget).data(dataKey);
  4228. if (!context) {
  4229. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4230. $__default['default'](event.currentTarget).data(dataKey, context);
  4231. }
  4232. if (event) {
  4233. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4234. }
  4235. if ($__default['default'](context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
  4236. context._hoverState = HOVER_STATE_SHOW;
  4237. return;
  4238. }
  4239. clearTimeout(context._timeout);
  4240. context._hoverState = HOVER_STATE_SHOW;
  4241. if (!context.config.delay || !context.config.delay.show) {
  4242. context.show();
  4243. return;
  4244. }
  4245. context._timeout = setTimeout(function () {
  4246. if (context._hoverState === HOVER_STATE_SHOW) {
  4247. context.show();
  4248. }
  4249. }, context.config.delay.show);
  4250. };
  4251. _proto._leave = function _leave(event, context) {
  4252. var dataKey = this.constructor.DATA_KEY;
  4253. context = context || $__default['default'](event.currentTarget).data(dataKey);
  4254. if (!context) {
  4255. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4256. $__default['default'](event.currentTarget).data(dataKey, context);
  4257. }
  4258. if (event) {
  4259. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
  4260. }
  4261. if (context._isWithActiveTrigger()) {
  4262. return;
  4263. }
  4264. clearTimeout(context._timeout);
  4265. context._hoverState = HOVER_STATE_OUT;
  4266. if (!context.config.delay || !context.config.delay.hide) {
  4267. context.hide();
  4268. return;
  4269. }
  4270. context._timeout = setTimeout(function () {
  4271. if (context._hoverState === HOVER_STATE_OUT) {
  4272. context.hide();
  4273. }
  4274. }, context.config.delay.hide);
  4275. };
  4276. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4277. for (var trigger in this._activeTrigger) {
  4278. if (this._activeTrigger[trigger]) {
  4279. return true;
  4280. }
  4281. }
  4282. return false;
  4283. };
  4284. _proto._getConfig = function _getConfig(config) {
  4285. var dataAttributes = $__default['default'](this.element).data();
  4286. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4287. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4288. delete dataAttributes[dataAttr];
  4289. }
  4290. });
  4291. config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  4292. if (typeof config.delay === 'number') {
  4293. config.delay = {
  4294. show: config.delay,
  4295. hide: config.delay
  4296. };
  4297. }
  4298. if (typeof config.title === 'number') {
  4299. config.title = config.title.toString();
  4300. }
  4301. if (typeof config.content === 'number') {
  4302. config.content = config.content.toString();
  4303. }
  4304. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4305. if (config.sanitize) {
  4306. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4307. }
  4308. return config;
  4309. };
  4310. _proto._getDelegateConfig = function _getDelegateConfig() {
  4311. var config = {};
  4312. if (this.config) {
  4313. for (var key in this.config) {
  4314. if (this.constructor.Default[key] !== this.config[key]) {
  4315. config[key] = this.config[key];
  4316. }
  4317. }
  4318. }
  4319. return config;
  4320. };
  4321. _proto._cleanTipClass = function _cleanTipClass() {
  4322. var $tip = $__default['default'](this.getTipElement());
  4323. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4324. if (tabClass !== null && tabClass.length) {
  4325. $tip.removeClass(tabClass.join(''));
  4326. }
  4327. };
  4328. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4329. this.tip = popperData.instance.popper;
  4330. this._cleanTipClass();
  4331. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4332. };
  4333. _proto._fixTransition = function _fixTransition() {
  4334. var tip = this.getTipElement();
  4335. var initConfigAnimation = this.config.animation;
  4336. if (tip.getAttribute('x-placement') !== null) {
  4337. return;
  4338. }
  4339. $__default['default'](tip).removeClass(CLASS_NAME_FADE$2);
  4340. this.config.animation = false;
  4341. this.hide();
  4342. this.show();
  4343. this.config.animation = initConfigAnimation;
  4344. } // Static
  4345. ;
  4346. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4347. return this.each(function () {
  4348. var $element = $__default['default'](this);
  4349. var data = $element.data(DATA_KEY$6);
  4350. var _config = typeof config === 'object' && config;
  4351. if (!data && /dispose|hide/.test(config)) {
  4352. return;
  4353. }
  4354. if (!data) {
  4355. data = new Tooltip(this, _config);
  4356. $element.data(DATA_KEY$6, data);
  4357. }
  4358. if (typeof config === 'string') {
  4359. if (typeof data[config] === 'undefined') {
  4360. throw new TypeError("No method named \"" + config + "\"");
  4361. }
  4362. data[config]();
  4363. }
  4364. });
  4365. };
  4366. _createClass(Tooltip, null, [{
  4367. key: "VERSION",
  4368. get: function get() {
  4369. return VERSION$6;
  4370. }
  4371. }, {
  4372. key: "Default",
  4373. get: function get() {
  4374. return Default$4;
  4375. }
  4376. }, {
  4377. key: "NAME",
  4378. get: function get() {
  4379. return NAME$6;
  4380. }
  4381. }, {
  4382. key: "DATA_KEY",
  4383. get: function get() {
  4384. return DATA_KEY$6;
  4385. }
  4386. }, {
  4387. key: "Event",
  4388. get: function get() {
  4389. return Event;
  4390. }
  4391. }, {
  4392. key: "EVENT_KEY",
  4393. get: function get() {
  4394. return EVENT_KEY$6;
  4395. }
  4396. }, {
  4397. key: "DefaultType",
  4398. get: function get() {
  4399. return DefaultType$4;
  4400. }
  4401. }]);
  4402. return Tooltip;
  4403. }();
  4404. /**
  4405. * ------------------------------------------------------------------------
  4406. * jQuery
  4407. * ------------------------------------------------------------------------
  4408. */
  4409. $__default['default'].fn[NAME$6] = Tooltip._jQueryInterface;
  4410. $__default['default'].fn[NAME$6].Constructor = Tooltip;
  4411. $__default['default'].fn[NAME$6].noConflict = function () {
  4412. $__default['default'].fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4413. return Tooltip._jQueryInterface;
  4414. };
  4415. /**
  4416. * ------------------------------------------------------------------------
  4417. * Constants
  4418. * ------------------------------------------------------------------------
  4419. */
  4420. var NAME$7 = 'popover';
  4421. var VERSION$7 = '4.5.3';
  4422. var DATA_KEY$7 = 'bs.popover';
  4423. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4424. var JQUERY_NO_CONFLICT$7 = $__default['default'].fn[NAME$7];
  4425. var CLASS_PREFIX$1 = 'bs-popover';
  4426. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4427. var Default$5 = _extends({}, Tooltip.Default, {
  4428. placement: 'right',
  4429. trigger: 'click',
  4430. content: '',
  4431. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4432. });
  4433. var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
  4434. content: '(string|element|function)'
  4435. });
  4436. var CLASS_NAME_FADE$3 = 'fade';
  4437. var CLASS_NAME_SHOW$5 = 'show';
  4438. var SELECTOR_TITLE = '.popover-header';
  4439. var SELECTOR_CONTENT = '.popover-body';
  4440. var Event$1 = {
  4441. HIDE: "hide" + EVENT_KEY$7,
  4442. HIDDEN: "hidden" + EVENT_KEY$7,
  4443. SHOW: "show" + EVENT_KEY$7,
  4444. SHOWN: "shown" + EVENT_KEY$7,
  4445. INSERTED: "inserted" + EVENT_KEY$7,
  4446. CLICK: "click" + EVENT_KEY$7,
  4447. FOCUSIN: "focusin" + EVENT_KEY$7,
  4448. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4449. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4450. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4451. };
  4452. /**
  4453. * ------------------------------------------------------------------------
  4454. * Class Definition
  4455. * ------------------------------------------------------------------------
  4456. */
  4457. var Popover = /*#__PURE__*/function (_Tooltip) {
  4458. _inheritsLoose(Popover, _Tooltip);
  4459. function Popover() {
  4460. return _Tooltip.apply(this, arguments) || this;
  4461. }
  4462. var _proto = Popover.prototype;
  4463. // Overrides
  4464. _proto.isWithContent = function isWithContent() {
  4465. return this.getTitle() || this._getContent();
  4466. };
  4467. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4468. $__default['default'](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4469. };
  4470. _proto.getTipElement = function getTipElement() {
  4471. this.tip = this.tip || $__default['default'](this.config.template)[0];
  4472. return this.tip;
  4473. };
  4474. _proto.setContent = function setContent() {
  4475. var $tip = $__default['default'](this.getTipElement()); // We use append for html objects to maintain js events
  4476. this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
  4477. var content = this._getContent();
  4478. if (typeof content === 'function') {
  4479. content = content.call(this.element);
  4480. }
  4481. this.setElementContent($tip.find(SELECTOR_CONTENT), content);
  4482. $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
  4483. } // Private
  4484. ;
  4485. _proto._getContent = function _getContent() {
  4486. return this.element.getAttribute('data-content') || this.config.content;
  4487. };
  4488. _proto._cleanTipClass = function _cleanTipClass() {
  4489. var $tip = $__default['default'](this.getTipElement());
  4490. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4491. if (tabClass !== null && tabClass.length > 0) {
  4492. $tip.removeClass(tabClass.join(''));
  4493. }
  4494. } // Static
  4495. ;
  4496. Popover._jQueryInterface = function _jQueryInterface(config) {
  4497. return this.each(function () {
  4498. var data = $__default['default'](this).data(DATA_KEY$7);
  4499. var _config = typeof config === 'object' ? config : null;
  4500. if (!data && /dispose|hide/.test(config)) {
  4501. return;
  4502. }
  4503. if (!data) {
  4504. data = new Popover(this, _config);
  4505. $__default['default'](this).data(DATA_KEY$7, data);
  4506. }
  4507. if (typeof config === 'string') {
  4508. if (typeof data[config] === 'undefined') {
  4509. throw new TypeError("No method named \"" + config + "\"");
  4510. }
  4511. data[config]();
  4512. }
  4513. });
  4514. };
  4515. _createClass(Popover, null, [{
  4516. key: "VERSION",
  4517. // Getters
  4518. get: function get() {
  4519. return VERSION$7;
  4520. }
  4521. }, {
  4522. key: "Default",
  4523. get: function get() {
  4524. return Default$5;
  4525. }
  4526. }, {
  4527. key: "NAME",
  4528. get: function get() {
  4529. return NAME$7;
  4530. }
  4531. }, {
  4532. key: "DATA_KEY",
  4533. get: function get() {
  4534. return DATA_KEY$7;
  4535. }
  4536. }, {
  4537. key: "Event",
  4538. get: function get() {
  4539. return Event$1;
  4540. }
  4541. }, {
  4542. key: "EVENT_KEY",
  4543. get: function get() {
  4544. return EVENT_KEY$7;
  4545. }
  4546. }, {
  4547. key: "DefaultType",
  4548. get: function get() {
  4549. return DefaultType$5;
  4550. }
  4551. }]);
  4552. return Popover;
  4553. }(Tooltip);
  4554. /**
  4555. * ------------------------------------------------------------------------
  4556. * jQuery
  4557. * ------------------------------------------------------------------------
  4558. */
  4559. $__default['default'].fn[NAME$7] = Popover._jQueryInterface;
  4560. $__default['default'].fn[NAME$7].Constructor = Popover;
  4561. $__default['default'].fn[NAME$7].noConflict = function () {
  4562. $__default['default'].fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4563. return Popover._jQueryInterface;
  4564. };
  4565. /**
  4566. * ------------------------------------------------------------------------
  4567. * Constants
  4568. * ------------------------------------------------------------------------
  4569. */
  4570. var NAME$8 = 'scrollspy';
  4571. var VERSION$8 = '4.5.3';
  4572. var DATA_KEY$8 = 'bs.scrollspy';
  4573. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4574. var DATA_API_KEY$6 = '.data-api';
  4575. var JQUERY_NO_CONFLICT$8 = $__default['default'].fn[NAME$8];
  4576. var Default$6 = {
  4577. offset: 10,
  4578. method: 'auto',
  4579. target: ''
  4580. };
  4581. var DefaultType$6 = {
  4582. offset: 'number',
  4583. method: 'string',
  4584. target: '(string|element)'
  4585. };
  4586. var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  4587. var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  4588. var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  4589. var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  4590. var CLASS_NAME_ACTIVE$2 = 'active';
  4591. var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  4592. var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  4593. var SELECTOR_NAV_LINKS = '.nav-link';
  4594. var SELECTOR_NAV_ITEMS = '.nav-item';
  4595. var SELECTOR_LIST_ITEMS = '.list-group-item';
  4596. var SELECTOR_DROPDOWN = '.dropdown';
  4597. var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
  4598. var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  4599. var METHOD_OFFSET = 'offset';
  4600. var METHOD_POSITION = 'position';
  4601. /**
  4602. * ------------------------------------------------------------------------
  4603. * Class Definition
  4604. * ------------------------------------------------------------------------
  4605. */
  4606. var ScrollSpy = /*#__PURE__*/function () {
  4607. function ScrollSpy(element, config) {
  4608. var _this = this;
  4609. this._element = element;
  4610. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4611. this._config = this._getConfig(config);
  4612. this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
  4613. this._offsets = [];
  4614. this._targets = [];
  4615. this._activeTarget = null;
  4616. this._scrollHeight = 0;
  4617. $__default['default'](this._scrollElement).on(EVENT_SCROLL, function (event) {
  4618. return _this._process(event);
  4619. });
  4620. this.refresh();
  4621. this._process();
  4622. } // Getters
  4623. var _proto = ScrollSpy.prototype;
  4624. // Public
  4625. _proto.refresh = function refresh() {
  4626. var _this2 = this;
  4627. var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  4628. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4629. var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  4630. this._offsets = [];
  4631. this._targets = [];
  4632. this._scrollHeight = this._getScrollHeight();
  4633. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4634. targets.map(function (element) {
  4635. var target;
  4636. var targetSelector = Util.getSelectorFromElement(element);
  4637. if (targetSelector) {
  4638. target = document.querySelector(targetSelector);
  4639. }
  4640. if (target) {
  4641. var targetBCR = target.getBoundingClientRect();
  4642. if (targetBCR.width || targetBCR.height) {
  4643. // TODO (fat): remove sketch reliance on jQuery position/offset
  4644. return [$__default['default'](target)[offsetMethod]().top + offsetBase, targetSelector];
  4645. }
  4646. }
  4647. return null;
  4648. }).filter(function (item) {
  4649. return item;
  4650. }).sort(function (a, b) {
  4651. return a[0] - b[0];
  4652. }).forEach(function (item) {
  4653. _this2._offsets.push(item[0]);
  4654. _this2._targets.push(item[1]);
  4655. });
  4656. };
  4657. _proto.dispose = function dispose() {
  4658. $__default['default'].removeData(this._element, DATA_KEY$8);
  4659. $__default['default'](this._scrollElement).off(EVENT_KEY$8);
  4660. this._element = null;
  4661. this._scrollElement = null;
  4662. this._config = null;
  4663. this._selector = null;
  4664. this._offsets = null;
  4665. this._targets = null;
  4666. this._activeTarget = null;
  4667. this._scrollHeight = null;
  4668. } // Private
  4669. ;
  4670. _proto._getConfig = function _getConfig(config) {
  4671. config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
  4672. if (typeof config.target !== 'string' && Util.isElement(config.target)) {
  4673. var id = $__default['default'](config.target).attr('id');
  4674. if (!id) {
  4675. id = Util.getUID(NAME$8);
  4676. $__default['default'](config.target).attr('id', id);
  4677. }
  4678. config.target = "#" + id;
  4679. }
  4680. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4681. return config;
  4682. };
  4683. _proto._getScrollTop = function _getScrollTop() {
  4684. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4685. };
  4686. _proto._getScrollHeight = function _getScrollHeight() {
  4687. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4688. };
  4689. _proto._getOffsetHeight = function _getOffsetHeight() {
  4690. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4691. };
  4692. _proto._process = function _process() {
  4693. var scrollTop = this._getScrollTop() + this._config.offset;
  4694. var scrollHeight = this._getScrollHeight();
  4695. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4696. if (this._scrollHeight !== scrollHeight) {
  4697. this.refresh();
  4698. }
  4699. if (scrollTop >= maxScroll) {
  4700. var target = this._targets[this._targets.length - 1];
  4701. if (this._activeTarget !== target) {
  4702. this._activate(target);
  4703. }
  4704. return;
  4705. }
  4706. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4707. this._activeTarget = null;
  4708. this._clear();
  4709. return;
  4710. }
  4711. for (var i = this._offsets.length; i--;) {
  4712. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4713. if (isActiveTarget) {
  4714. this._activate(this._targets[i]);
  4715. }
  4716. }
  4717. };
  4718. _proto._activate = function _activate(target) {
  4719. this._activeTarget = target;
  4720. this._clear();
  4721. var queries = this._selector.split(',').map(function (selector) {
  4722. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4723. });
  4724. var $link = $__default['default']([].slice.call(document.querySelectorAll(queries.join(','))));
  4725. if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
  4726. $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
  4727. $link.addClass(CLASS_NAME_ACTIVE$2);
  4728. } else {
  4729. // Set triggered link as active
  4730. $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
  4731. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4732. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
  4733. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
  4734. }
  4735. $__default['default'](this._scrollElement).trigger(EVENT_ACTIVATE, {
  4736. relatedTarget: target
  4737. });
  4738. };
  4739. _proto._clear = function _clear() {
  4740. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4741. return node.classList.contains(CLASS_NAME_ACTIVE$2);
  4742. }).forEach(function (node) {
  4743. return node.classList.remove(CLASS_NAME_ACTIVE$2);
  4744. });
  4745. } // Static
  4746. ;
  4747. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4748. return this.each(function () {
  4749. var data = $__default['default'](this).data(DATA_KEY$8);
  4750. var _config = typeof config === 'object' && config;
  4751. if (!data) {
  4752. data = new ScrollSpy(this, _config);
  4753. $__default['default'](this).data(DATA_KEY$8, data);
  4754. }
  4755. if (typeof config === 'string') {
  4756. if (typeof data[config] === 'undefined') {
  4757. throw new TypeError("No method named \"" + config + "\"");
  4758. }
  4759. data[config]();
  4760. }
  4761. });
  4762. };
  4763. _createClass(ScrollSpy, null, [{
  4764. key: "VERSION",
  4765. get: function get() {
  4766. return VERSION$8;
  4767. }
  4768. }, {
  4769. key: "Default",
  4770. get: function get() {
  4771. return Default$6;
  4772. }
  4773. }]);
  4774. return ScrollSpy;
  4775. }();
  4776. /**
  4777. * ------------------------------------------------------------------------
  4778. * Data Api implementation
  4779. * ------------------------------------------------------------------------
  4780. */
  4781. $__default['default'](window).on(EVENT_LOAD_DATA_API$2, function () {
  4782. var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
  4783. var scrollSpysLength = scrollSpys.length;
  4784. for (var i = scrollSpysLength; i--;) {
  4785. var $spy = $__default['default'](scrollSpys[i]);
  4786. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4787. }
  4788. });
  4789. /**
  4790. * ------------------------------------------------------------------------
  4791. * jQuery
  4792. * ------------------------------------------------------------------------
  4793. */
  4794. $__default['default'].fn[NAME$8] = ScrollSpy._jQueryInterface;
  4795. $__default['default'].fn[NAME$8].Constructor = ScrollSpy;
  4796. $__default['default'].fn[NAME$8].noConflict = function () {
  4797. $__default['default'].fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4798. return ScrollSpy._jQueryInterface;
  4799. };
  4800. /**
  4801. * ------------------------------------------------------------------------
  4802. * Constants
  4803. * ------------------------------------------------------------------------
  4804. */
  4805. var NAME$9 = 'tab';
  4806. var VERSION$9 = '4.5.3';
  4807. var DATA_KEY$9 = 'bs.tab';
  4808. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4809. var DATA_API_KEY$7 = '.data-api';
  4810. var JQUERY_NO_CONFLICT$9 = $__default['default'].fn[NAME$9];
  4811. var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  4812. var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  4813. var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  4814. var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  4815. var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  4816. var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  4817. var CLASS_NAME_ACTIVE$3 = 'active';
  4818. var CLASS_NAME_DISABLED$1 = 'disabled';
  4819. var CLASS_NAME_FADE$4 = 'fade';
  4820. var CLASS_NAME_SHOW$6 = 'show';
  4821. var SELECTOR_DROPDOWN$1 = '.dropdown';
  4822. var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  4823. var SELECTOR_ACTIVE$2 = '.active';
  4824. var SELECTOR_ACTIVE_UL = '> li > .active';
  4825. var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  4826. var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  4827. var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
  4828. /**
  4829. * ------------------------------------------------------------------------
  4830. * Class Definition
  4831. * ------------------------------------------------------------------------
  4832. */
  4833. var Tab = /*#__PURE__*/function () {
  4834. function Tab(element) {
  4835. this._element = element;
  4836. } // Getters
  4837. var _proto = Tab.prototype;
  4838. // Public
  4839. _proto.show = function show() {
  4840. var _this = this;
  4841. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default['default'](this._element).hasClass(CLASS_NAME_ACTIVE$3) || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED$1)) {
  4842. return;
  4843. }
  4844. var target;
  4845. var previous;
  4846. var listElement = $__default['default'](this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
  4847. var selector = Util.getSelectorFromElement(this._element);
  4848. if (listElement) {
  4849. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
  4850. previous = $__default['default'].makeArray($__default['default'](listElement).find(itemSelector));
  4851. previous = previous[previous.length - 1];
  4852. }
  4853. var hideEvent = $__default['default'].Event(EVENT_HIDE$3, {
  4854. relatedTarget: this._element
  4855. });
  4856. var showEvent = $__default['default'].Event(EVENT_SHOW$3, {
  4857. relatedTarget: previous
  4858. });
  4859. if (previous) {
  4860. $__default['default'](previous).trigger(hideEvent);
  4861. }
  4862. $__default['default'](this._element).trigger(showEvent);
  4863. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4864. return;
  4865. }
  4866. if (selector) {
  4867. target = document.querySelector(selector);
  4868. }
  4869. this._activate(this._element, listElement);
  4870. var complete = function complete() {
  4871. var hiddenEvent = $__default['default'].Event(EVENT_HIDDEN$3, {
  4872. relatedTarget: _this._element
  4873. });
  4874. var shownEvent = $__default['default'].Event(EVENT_SHOWN$3, {
  4875. relatedTarget: previous
  4876. });
  4877. $__default['default'](previous).trigger(hiddenEvent);
  4878. $__default['default'](_this._element).trigger(shownEvent);
  4879. };
  4880. if (target) {
  4881. this._activate(target, target.parentNode, complete);
  4882. } else {
  4883. complete();
  4884. }
  4885. };
  4886. _proto.dispose = function dispose() {
  4887. $__default['default'].removeData(this._element, DATA_KEY$9);
  4888. this._element = null;
  4889. } // Private
  4890. ;
  4891. _proto._activate = function _activate(element, container, callback) {
  4892. var _this2 = this;
  4893. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default['default'](container).find(SELECTOR_ACTIVE_UL) : $__default['default'](container).children(SELECTOR_ACTIVE$2);
  4894. var active = activeElements[0];
  4895. var isTransitioning = callback && active && $__default['default'](active).hasClass(CLASS_NAME_FADE$4);
  4896. var complete = function complete() {
  4897. return _this2._transitionComplete(element, active, callback);
  4898. };
  4899. if (active && isTransitioning) {
  4900. var transitionDuration = Util.getTransitionDurationFromElement(active);
  4901. $__default['default'](active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4902. } else {
  4903. complete();
  4904. }
  4905. };
  4906. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  4907. if (active) {
  4908. $__default['default'](active).removeClass(CLASS_NAME_ACTIVE$3);
  4909. var dropdownChild = $__default['default'](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
  4910. if (dropdownChild) {
  4911. $__default['default'](dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
  4912. }
  4913. if (active.getAttribute('role') === 'tab') {
  4914. active.setAttribute('aria-selected', false);
  4915. }
  4916. }
  4917. $__default['default'](element).addClass(CLASS_NAME_ACTIVE$3);
  4918. if (element.getAttribute('role') === 'tab') {
  4919. element.setAttribute('aria-selected', true);
  4920. }
  4921. Util.reflow(element);
  4922. if (element.classList.contains(CLASS_NAME_FADE$4)) {
  4923. element.classList.add(CLASS_NAME_SHOW$6);
  4924. }
  4925. if (element.parentNode && $__default['default'](element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
  4926. var dropdownElement = $__default['default'](element).closest(SELECTOR_DROPDOWN$1)[0];
  4927. if (dropdownElement) {
  4928. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
  4929. $__default['default'](dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
  4930. }
  4931. element.setAttribute('aria-expanded', true);
  4932. }
  4933. if (callback) {
  4934. callback();
  4935. }
  4936. } // Static
  4937. ;
  4938. Tab._jQueryInterface = function _jQueryInterface(config) {
  4939. return this.each(function () {
  4940. var $this = $__default['default'](this);
  4941. var data = $this.data(DATA_KEY$9);
  4942. if (!data) {
  4943. data = new Tab(this);
  4944. $this.data(DATA_KEY$9, data);
  4945. }
  4946. if (typeof config === 'string') {
  4947. if (typeof data[config] === 'undefined') {
  4948. throw new TypeError("No method named \"" + config + "\"");
  4949. }
  4950. data[config]();
  4951. }
  4952. });
  4953. };
  4954. _createClass(Tab, null, [{
  4955. key: "VERSION",
  4956. get: function get() {
  4957. return VERSION$9;
  4958. }
  4959. }]);
  4960. return Tab;
  4961. }();
  4962. /**
  4963. * ------------------------------------------------------------------------
  4964. * Data Api implementation
  4965. * ------------------------------------------------------------------------
  4966. */
  4967. $__default['default'](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
  4968. event.preventDefault();
  4969. Tab._jQueryInterface.call($__default['default'](this), 'show');
  4970. });
  4971. /**
  4972. * ------------------------------------------------------------------------
  4973. * jQuery
  4974. * ------------------------------------------------------------------------
  4975. */
  4976. $__default['default'].fn[NAME$9] = Tab._jQueryInterface;
  4977. $__default['default'].fn[NAME$9].Constructor = Tab;
  4978. $__default['default'].fn[NAME$9].noConflict = function () {
  4979. $__default['default'].fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  4980. return Tab._jQueryInterface;
  4981. };
  4982. /**
  4983. * ------------------------------------------------------------------------
  4984. * Constants
  4985. * ------------------------------------------------------------------------
  4986. */
  4987. var NAME$a = 'toast';
  4988. var VERSION$a = '4.5.3';
  4989. var DATA_KEY$a = 'bs.toast';
  4990. var EVENT_KEY$a = "." + DATA_KEY$a;
  4991. var JQUERY_NO_CONFLICT$a = $__default['default'].fn[NAME$a];
  4992. var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  4993. var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  4994. var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  4995. var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  4996. var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  4997. var CLASS_NAME_FADE$5 = 'fade';
  4998. var CLASS_NAME_HIDE = 'hide';
  4999. var CLASS_NAME_SHOW$7 = 'show';
  5000. var CLASS_NAME_SHOWING = 'showing';
  5001. var DefaultType$7 = {
  5002. animation: 'boolean',
  5003. autohide: 'boolean',
  5004. delay: 'number'
  5005. };
  5006. var Default$7 = {
  5007. animation: true,
  5008. autohide: true,
  5009. delay: 500
  5010. };
  5011. var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
  5012. /**
  5013. * ------------------------------------------------------------------------
  5014. * Class Definition
  5015. * ------------------------------------------------------------------------
  5016. */
  5017. var Toast = /*#__PURE__*/function () {
  5018. function Toast(element, config) {
  5019. this._element = element;
  5020. this._config = this._getConfig(config);
  5021. this._timeout = null;
  5022. this._setListeners();
  5023. } // Getters
  5024. var _proto = Toast.prototype;
  5025. // Public
  5026. _proto.show = function show() {
  5027. var _this = this;
  5028. var showEvent = $__default['default'].Event(EVENT_SHOW$4);
  5029. $__default['default'](this._element).trigger(showEvent);
  5030. if (showEvent.isDefaultPrevented()) {
  5031. return;
  5032. }
  5033. this._clearTimeout();
  5034. if (this._config.animation) {
  5035. this._element.classList.add(CLASS_NAME_FADE$5);
  5036. }
  5037. var complete = function complete() {
  5038. _this._element.classList.remove(CLASS_NAME_SHOWING);
  5039. _this._element.classList.add(CLASS_NAME_SHOW$7);
  5040. $__default['default'](_this._element).trigger(EVENT_SHOWN$4);
  5041. if (_this._config.autohide) {
  5042. _this._timeout = setTimeout(function () {
  5043. _this.hide();
  5044. }, _this._config.delay);
  5045. }
  5046. };
  5047. this._element.classList.remove(CLASS_NAME_HIDE);
  5048. Util.reflow(this._element);
  5049. this._element.classList.add(CLASS_NAME_SHOWING);
  5050. if (this._config.animation) {
  5051. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5052. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5053. } else {
  5054. complete();
  5055. }
  5056. };
  5057. _proto.hide = function hide() {
  5058. if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5059. return;
  5060. }
  5061. var hideEvent = $__default['default'].Event(EVENT_HIDE$4);
  5062. $__default['default'](this._element).trigger(hideEvent);
  5063. if (hideEvent.isDefaultPrevented()) {
  5064. return;
  5065. }
  5066. this._close();
  5067. };
  5068. _proto.dispose = function dispose() {
  5069. this._clearTimeout();
  5070. if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5071. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5072. }
  5073. $__default['default'](this._element).off(EVENT_CLICK_DISMISS$1);
  5074. $__default['default'].removeData(this._element, DATA_KEY$a);
  5075. this._element = null;
  5076. this._config = null;
  5077. } // Private
  5078. ;
  5079. _proto._getConfig = function _getConfig(config) {
  5080. config = _extends({}, Default$7, $__default['default'](this._element).data(), typeof config === 'object' && config ? config : {});
  5081. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5082. return config;
  5083. };
  5084. _proto._setListeners = function _setListeners() {
  5085. var _this2 = this;
  5086. $__default['default'](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
  5087. return _this2.hide();
  5088. });
  5089. };
  5090. _proto._close = function _close() {
  5091. var _this3 = this;
  5092. var complete = function complete() {
  5093. _this3._element.classList.add(CLASS_NAME_HIDE);
  5094. $__default['default'](_this3._element).trigger(EVENT_HIDDEN$4);
  5095. };
  5096. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5097. if (this._config.animation) {
  5098. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5099. $__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5100. } else {
  5101. complete();
  5102. }
  5103. };
  5104. _proto._clearTimeout = function _clearTimeout() {
  5105. clearTimeout(this._timeout);
  5106. this._timeout = null;
  5107. } // Static
  5108. ;
  5109. Toast._jQueryInterface = function _jQueryInterface(config) {
  5110. return this.each(function () {
  5111. var $element = $__default['default'](this);
  5112. var data = $element.data(DATA_KEY$a);
  5113. var _config = typeof config === 'object' && config;
  5114. if (!data) {
  5115. data = new Toast(this, _config);
  5116. $element.data(DATA_KEY$a, data);
  5117. }
  5118. if (typeof config === 'string') {
  5119. if (typeof data[config] === 'undefined') {
  5120. throw new TypeError("No method named \"" + config + "\"");
  5121. }
  5122. data[config](this);
  5123. }
  5124. });
  5125. };
  5126. _createClass(Toast, null, [{
  5127. key: "VERSION",
  5128. get: function get() {
  5129. return VERSION$a;
  5130. }
  5131. }, {
  5132. key: "DefaultType",
  5133. get: function get() {
  5134. return DefaultType$7;
  5135. }
  5136. }, {
  5137. key: "Default",
  5138. get: function get() {
  5139. return Default$7;
  5140. }
  5141. }]);
  5142. return Toast;
  5143. }();
  5144. /**
  5145. * ------------------------------------------------------------------------
  5146. * jQuery
  5147. * ------------------------------------------------------------------------
  5148. */
  5149. $__default['default'].fn[NAME$a] = Toast._jQueryInterface;
  5150. $__default['default'].fn[NAME$a].Constructor = Toast;
  5151. $__default['default'].fn[NAME$a].noConflict = function () {
  5152. $__default['default'].fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5153. return Toast._jQueryInterface;
  5154. };
  5155. exports.Alert = Alert;
  5156. exports.Button = Button;
  5157. exports.Carousel = Carousel;
  5158. exports.Collapse = Collapse;
  5159. exports.Dropdown = Dropdown;
  5160. exports.Modal = Modal;
  5161. exports.Popover = Popover;
  5162. exports.Scrollspy = ScrollSpy;
  5163. exports.Tab = Tab;
  5164. exports.Toast = Toast;
  5165. exports.Tooltip = Tooltip;
  5166. exports.Util = Util;
  5167. Object.defineProperty(exports, '__esModule', { value: true });
  5168. })));
  5169. //# sourceMappingURL=bootstrap.js.map
  5170. /***/ }),
  5171. /***/ "./node_modules/jquery/dist/jquery.js":
  5172. /*!********************************************!*\
  5173. !*** ./node_modules/jquery/dist/jquery.js ***!
  5174. \********************************************/
  5175. /*! no static exports found */
  5176. /***/ (function(module, exports, __webpack_require__) {
  5177. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  5178. * jQuery JavaScript Library v3.5.1
  5179. * https://jquery.com/
  5180. *
  5181. * Includes Sizzle.js
  5182. * https://sizzlejs.com/
  5183. *
  5184. * Copyright JS Foundation and other contributors
  5185. * Released under the MIT license
  5186. * https://jquery.org/license
  5187. *
  5188. * Date: 2020-05-04T22:49Z
  5189. */
  5190. ( function( global, factory ) {
  5191. "use strict";
  5192. if ( true && typeof module.exports === "object" ) {
  5193. // For CommonJS and CommonJS-like environments where a proper `window`
  5194. // is present, execute the factory and get jQuery.
  5195. // For environments that do not have a `window` with a `document`
  5196. // (such as Node.js), expose a factory as module.exports.
  5197. // This accentuates the need for the creation of a real `window`.
  5198. // e.g. var jQuery = require("jquery")(window);
  5199. // See ticket #14549 for more info.
  5200. module.exports = global.document ?
  5201. factory( global, true ) :
  5202. function( w ) {
  5203. if ( !w.document ) {
  5204. throw new Error( "jQuery requires a window with a document" );
  5205. }
  5206. return factory( w );
  5207. };
  5208. } else {
  5209. factory( global );
  5210. }
  5211. // Pass this if window is not defined yet
  5212. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5213. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5214. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5215. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5216. // enough that all such attempts are guarded in a try block.
  5217. "use strict";
  5218. var arr = [];
  5219. var getProto = Object.getPrototypeOf;
  5220. var slice = arr.slice;
  5221. var flat = arr.flat ? function( array ) {
  5222. return arr.flat.call( array );
  5223. } : function( array ) {
  5224. return arr.concat.apply( [], array );
  5225. };
  5226. var push = arr.push;
  5227. var indexOf = arr.indexOf;
  5228. var class2type = {};
  5229. var toString = class2type.toString;
  5230. var hasOwn = class2type.hasOwnProperty;
  5231. var fnToString = hasOwn.toString;
  5232. var ObjectFunctionString = fnToString.call( Object );
  5233. var support = {};
  5234. var isFunction = function isFunction( obj ) {
  5235. // Support: Chrome <=57, Firefox <=52
  5236. // In some browsers, typeof returns "function" for HTML <object> elements
  5237. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5238. // We don't want to classify *any* DOM node as a function.
  5239. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5240. };
  5241. var isWindow = function isWindow( obj ) {
  5242. return obj != null && obj === obj.window;
  5243. };
  5244. var document = window.document;
  5245. var preservedScriptAttributes = {
  5246. type: true,
  5247. src: true,
  5248. nonce: true,
  5249. noModule: true
  5250. };
  5251. function DOMEval( code, node, doc ) {
  5252. doc = doc || document;
  5253. var i, val,
  5254. script = doc.createElement( "script" );
  5255. script.text = code;
  5256. if ( node ) {
  5257. for ( i in preservedScriptAttributes ) {
  5258. // Support: Firefox 64+, Edge 18+
  5259. // Some browsers don't support the "nonce" property on scripts.
  5260. // On the other hand, just using `getAttribute` is not enough as
  5261. // the `nonce` attribute is reset to an empty string whenever it
  5262. // becomes browsing-context connected.
  5263. // See https://github.com/whatwg/html/issues/2369
  5264. // See https://html.spec.whatwg.org/#nonce-attributes
  5265. // The `node.getAttribute` check was added for the sake of
  5266. // `jQuery.globalEval` so that it can fake a nonce-containing node
  5267. // via an object.
  5268. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  5269. if ( val ) {
  5270. script.setAttribute( i, val );
  5271. }
  5272. }
  5273. }
  5274. doc.head.appendChild( script ).parentNode.removeChild( script );
  5275. }
  5276. function toType( obj ) {
  5277. if ( obj == null ) {
  5278. return obj + "";
  5279. }
  5280. // Support: Android <=2.3 only (functionish RegExp)
  5281. return typeof obj === "object" || typeof obj === "function" ?
  5282. class2type[ toString.call( obj ) ] || "object" :
  5283. typeof obj;
  5284. }
  5285. /* global Symbol */
  5286. // Defining this global in .eslintrc.json would create a danger of using the global
  5287. // unguarded in another place, it seems safer to define global only for this module
  5288. var
  5289. version = "3.5.1",
  5290. // Define a local copy of jQuery
  5291. jQuery = function( selector, context ) {
  5292. // The jQuery object is actually just the init constructor 'enhanced'
  5293. // Need init if jQuery is called (just allow error to be thrown if not included)
  5294. return new jQuery.fn.init( selector, context );
  5295. };
  5296. jQuery.fn = jQuery.prototype = {
  5297. // The current version of jQuery being used
  5298. jquery: version,
  5299. constructor: jQuery,
  5300. // The default length of a jQuery object is 0
  5301. length: 0,
  5302. toArray: function() {
  5303. return slice.call( this );
  5304. },
  5305. // Get the Nth element in the matched element set OR
  5306. // Get the whole matched element set as a clean array
  5307. get: function( num ) {
  5308. // Return all the elements in a clean array
  5309. if ( num == null ) {
  5310. return slice.call( this );
  5311. }
  5312. // Return just the one element from the set
  5313. return num < 0 ? this[ num + this.length ] : this[ num ];
  5314. },
  5315. // Take an array of elements and push it onto the stack
  5316. // (returning the new matched element set)
  5317. pushStack: function( elems ) {
  5318. // Build a new jQuery matched element set
  5319. var ret = jQuery.merge( this.constructor(), elems );
  5320. // Add the old object onto the stack (as a reference)
  5321. ret.prevObject = this;
  5322. // Return the newly-formed element set
  5323. return ret;
  5324. },
  5325. // Execute a callback for every element in the matched set.
  5326. each: function( callback ) {
  5327. return jQuery.each( this, callback );
  5328. },
  5329. map: function( callback ) {
  5330. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5331. return callback.call( elem, i, elem );
  5332. } ) );
  5333. },
  5334. slice: function() {
  5335. return this.pushStack( slice.apply( this, arguments ) );
  5336. },
  5337. first: function() {
  5338. return this.eq( 0 );
  5339. },
  5340. last: function() {
  5341. return this.eq( -1 );
  5342. },
  5343. even: function() {
  5344. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5345. return ( i + 1 ) % 2;
  5346. } ) );
  5347. },
  5348. odd: function() {
  5349. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  5350. return i % 2;
  5351. } ) );
  5352. },
  5353. eq: function( i ) {
  5354. var len = this.length,
  5355. j = +i + ( i < 0 ? len : 0 );
  5356. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5357. },
  5358. end: function() {
  5359. return this.prevObject || this.constructor();
  5360. },
  5361. // For internal use only.
  5362. // Behaves like an Array's method, not like a jQuery method.
  5363. push: push,
  5364. sort: arr.sort,
  5365. splice: arr.splice
  5366. };
  5367. jQuery.extend = jQuery.fn.extend = function() {
  5368. var options, name, src, copy, copyIsArray, clone,
  5369. target = arguments[ 0 ] || {},
  5370. i = 1,
  5371. length = arguments.length,
  5372. deep = false;
  5373. // Handle a deep copy situation
  5374. if ( typeof target === "boolean" ) {
  5375. deep = target;
  5376. // Skip the boolean and the target
  5377. target = arguments[ i ] || {};
  5378. i++;
  5379. }
  5380. // Handle case when target is a string or something (possible in deep copy)
  5381. if ( typeof target !== "object" && !isFunction( target ) ) {
  5382. target = {};
  5383. }
  5384. // Extend jQuery itself if only one argument is passed
  5385. if ( i === length ) {
  5386. target = this;
  5387. i--;
  5388. }
  5389. for ( ; i < length; i++ ) {
  5390. // Only deal with non-null/undefined values
  5391. if ( ( options = arguments[ i ] ) != null ) {
  5392. // Extend the base object
  5393. for ( name in options ) {
  5394. copy = options[ name ];
  5395. // Prevent Object.prototype pollution
  5396. // Prevent never-ending loop
  5397. if ( name === "__proto__" || target === copy ) {
  5398. continue;
  5399. }
  5400. // Recurse if we're merging plain objects or arrays
  5401. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5402. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5403. src = target[ name ];
  5404. // Ensure proper type for the source value
  5405. if ( copyIsArray && !Array.isArray( src ) ) {
  5406. clone = [];
  5407. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  5408. clone = {};
  5409. } else {
  5410. clone = src;
  5411. }
  5412. copyIsArray = false;
  5413. // Never move original objects, clone them
  5414. target[ name ] = jQuery.extend( deep, clone, copy );
  5415. // Don't bring in undefined values
  5416. } else if ( copy !== undefined ) {
  5417. target[ name ] = copy;
  5418. }
  5419. }
  5420. }
  5421. }
  5422. // Return the modified object
  5423. return target;
  5424. };
  5425. jQuery.extend( {
  5426. // Unique for each copy of jQuery on the page
  5427. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5428. // Assume jQuery is ready without the ready module
  5429. isReady: true,
  5430. error: function( msg ) {
  5431. throw new Error( msg );
  5432. },
  5433. noop: function() {},
  5434. isPlainObject: function( obj ) {
  5435. var proto, Ctor;
  5436. // Detect obvious negatives
  5437. // Use toString instead of jQuery.type to catch host objects
  5438. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5439. return false;
  5440. }
  5441. proto = getProto( obj );
  5442. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5443. if ( !proto ) {
  5444. return true;
  5445. }
  5446. // Objects with prototype are plain iff they were constructed by a global Object function
  5447. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5448. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5449. },
  5450. isEmptyObject: function( obj ) {
  5451. var name;
  5452. for ( name in obj ) {
  5453. return false;
  5454. }
  5455. return true;
  5456. },
  5457. // Evaluates a script in a provided context; falls back to the global one
  5458. // if not specified.
  5459. globalEval: function( code, options, doc ) {
  5460. DOMEval( code, { nonce: options && options.nonce }, doc );
  5461. },
  5462. each: function( obj, callback ) {
  5463. var length, i = 0;
  5464. if ( isArrayLike( obj ) ) {
  5465. length = obj.length;
  5466. for ( ; i < length; i++ ) {
  5467. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5468. break;
  5469. }
  5470. }
  5471. } else {
  5472. for ( i in obj ) {
  5473. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5474. break;
  5475. }
  5476. }
  5477. }
  5478. return obj;
  5479. },
  5480. // results is for internal usage only
  5481. makeArray: function( arr, results ) {
  5482. var ret = results || [];
  5483. if ( arr != null ) {
  5484. if ( isArrayLike( Object( arr ) ) ) {
  5485. jQuery.merge( ret,
  5486. typeof arr === "string" ?
  5487. [ arr ] : arr
  5488. );
  5489. } else {
  5490. push.call( ret, arr );
  5491. }
  5492. }
  5493. return ret;
  5494. },
  5495. inArray: function( elem, arr, i ) {
  5496. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5497. },
  5498. // Support: Android <=4.0 only, PhantomJS 1 only
  5499. // push.apply(_, arraylike) throws on ancient WebKit
  5500. merge: function( first, second ) {
  5501. var len = +second.length,
  5502. j = 0,
  5503. i = first.length;
  5504. for ( ; j < len; j++ ) {
  5505. first[ i++ ] = second[ j ];
  5506. }
  5507. first.length = i;
  5508. return first;
  5509. },
  5510. grep: function( elems, callback, invert ) {
  5511. var callbackInverse,
  5512. matches = [],
  5513. i = 0,
  5514. length = elems.length,
  5515. callbackExpect = !invert;
  5516. // Go through the array, only saving the items
  5517. // that pass the validator function
  5518. for ( ; i < length; i++ ) {
  5519. callbackInverse = !callback( elems[ i ], i );
  5520. if ( callbackInverse !== callbackExpect ) {
  5521. matches.push( elems[ i ] );
  5522. }
  5523. }
  5524. return matches;
  5525. },
  5526. // arg is for internal usage only
  5527. map: function( elems, callback, arg ) {
  5528. var length, value,
  5529. i = 0,
  5530. ret = [];
  5531. // Go through the array, translating each of the items to their new values
  5532. if ( isArrayLike( elems ) ) {
  5533. length = elems.length;
  5534. for ( ; i < length; i++ ) {
  5535. value = callback( elems[ i ], i, arg );
  5536. if ( value != null ) {
  5537. ret.push( value );
  5538. }
  5539. }
  5540. // Go through every key on the object,
  5541. } else {
  5542. for ( i in elems ) {
  5543. value = callback( elems[ i ], i, arg );
  5544. if ( value != null ) {
  5545. ret.push( value );
  5546. }
  5547. }
  5548. }
  5549. // Flatten any nested arrays
  5550. return flat( ret );
  5551. },
  5552. // A global GUID counter for objects
  5553. guid: 1,
  5554. // jQuery.support is not used in Core but other projects attach their
  5555. // properties to it so it needs to exist.
  5556. support: support
  5557. } );
  5558. if ( typeof Symbol === "function" ) {
  5559. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5560. }
  5561. // Populate the class2type map
  5562. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5563. function( _i, name ) {
  5564. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5565. } );
  5566. function isArrayLike( obj ) {
  5567. // Support: real iOS 8.2 only (not reproducible in simulator)
  5568. // `in` check used to prevent JIT error (gh-2145)
  5569. // hasOwn isn't used here due to false negatives
  5570. // regarding Nodelist length in IE
  5571. var length = !!obj && "length" in obj && obj.length,
  5572. type = toType( obj );
  5573. if ( isFunction( obj ) || isWindow( obj ) ) {
  5574. return false;
  5575. }
  5576. return type === "array" || length === 0 ||
  5577. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5578. }
  5579. var Sizzle =
  5580. /*!
  5581. * Sizzle CSS Selector Engine v2.3.5
  5582. * https://sizzlejs.com/
  5583. *
  5584. * Copyright JS Foundation and other contributors
  5585. * Released under the MIT license
  5586. * https://js.foundation/
  5587. *
  5588. * Date: 2020-03-14
  5589. */
  5590. ( function( window ) {
  5591. var i,
  5592. support,
  5593. Expr,
  5594. getText,
  5595. isXML,
  5596. tokenize,
  5597. compile,
  5598. select,
  5599. outermostContext,
  5600. sortInput,
  5601. hasDuplicate,
  5602. // Local document vars
  5603. setDocument,
  5604. document,
  5605. docElem,
  5606. documentIsHTML,
  5607. rbuggyQSA,
  5608. rbuggyMatches,
  5609. matches,
  5610. contains,
  5611. // Instance-specific data
  5612. expando = "sizzle" + 1 * new Date(),
  5613. preferredDoc = window.document,
  5614. dirruns = 0,
  5615. done = 0,
  5616. classCache = createCache(),
  5617. tokenCache = createCache(),
  5618. compilerCache = createCache(),
  5619. nonnativeSelectorCache = createCache(),
  5620. sortOrder = function( a, b ) {
  5621. if ( a === b ) {
  5622. hasDuplicate = true;
  5623. }
  5624. return 0;
  5625. },
  5626. // Instance methods
  5627. hasOwn = ( {} ).hasOwnProperty,
  5628. arr = [],
  5629. pop = arr.pop,
  5630. pushNative = arr.push,
  5631. push = arr.push,
  5632. slice = arr.slice,
  5633. // Use a stripped-down indexOf as it's faster than native
  5634. // https://jsperf.com/thor-indexof-vs-for/5
  5635. indexOf = function( list, elem ) {
  5636. var i = 0,
  5637. len = list.length;
  5638. for ( ; i < len; i++ ) {
  5639. if ( list[ i ] === elem ) {
  5640. return i;
  5641. }
  5642. }
  5643. return -1;
  5644. },
  5645. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  5646. "ismap|loop|multiple|open|readonly|required|scoped",
  5647. // Regular expressions
  5648. // http://www.w3.org/TR/css3-selectors/#whitespace
  5649. whitespace = "[\\x20\\t\\r\\n\\f]",
  5650. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  5651. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  5652. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  5653. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5654. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5655. // Operator (capture 2)
  5656. "*([*^$|!~]?=)" + whitespace +
  5657. // "Attribute values must be CSS identifiers [capture 5]
  5658. // or strings [capture 3 or capture 4]"
  5659. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  5660. whitespace + "*\\]",
  5661. pseudos = ":(" + identifier + ")(?:\\((" +
  5662. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5663. // 1. quoted (capture 3; capture 4 or capture 5)
  5664. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5665. // 2. simple (capture 6)
  5666. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5667. // 3. anything else (capture 2)
  5668. ".*" +
  5669. ")\\)|)",
  5670. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5671. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5672. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  5673. whitespace + "+$", "g" ),
  5674. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5675. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  5676. "*" ),
  5677. rdescend = new RegExp( whitespace + "|>" ),
  5678. rpseudo = new RegExp( pseudos ),
  5679. ridentifier = new RegExp( "^" + identifier + "$" ),
  5680. matchExpr = {
  5681. "ID": new RegExp( "^#(" + identifier + ")" ),
  5682. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5683. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5684. "ATTR": new RegExp( "^" + attributes ),
  5685. "PSEUDO": new RegExp( "^" + pseudos ),
  5686. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  5687. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  5688. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5689. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5690. // For use in libraries implementing .is()
  5691. // We use this for POS matching in `select`
  5692. "needsContext": new RegExp( "^" + whitespace +
  5693. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  5694. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5695. },
  5696. rhtml = /HTML$/i,
  5697. rinputs = /^(?:input|select|textarea|button)$/i,
  5698. rheader = /^h\d$/i,
  5699. rnative = /^[^{]+\{\s*\[native \w/,
  5700. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5701. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5702. rsibling = /[+~]/,
  5703. // CSS escapes
  5704. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5705. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  5706. funescape = function( escape, nonHex ) {
  5707. var high = "0x" + escape.slice( 1 ) - 0x10000;
  5708. return nonHex ?
  5709. // Strip the backslash prefix from a non-hex escape sequence
  5710. nonHex :
  5711. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  5712. // Support: IE <=11+
  5713. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  5714. // surrogate pair
  5715. high < 0 ?
  5716. String.fromCharCode( high + 0x10000 ) :
  5717. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5718. },
  5719. // CSS string/identifier serialization
  5720. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5721. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5722. fcssescape = function( ch, asCodePoint ) {
  5723. if ( asCodePoint ) {
  5724. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5725. if ( ch === "\0" ) {
  5726. return "\uFFFD";
  5727. }
  5728. // Control characters and (dependent upon position) numbers get escaped as code points
  5729. return ch.slice( 0, -1 ) + "\\" +
  5730. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5731. }
  5732. // Other potentially-special ASCII characters get backslash-escaped
  5733. return "\\" + ch;
  5734. },
  5735. // Used for iframes
  5736. // See setDocument()
  5737. // Removing the function wrapper causes a "Permission Denied"
  5738. // error in IE
  5739. unloadHandler = function() {
  5740. setDocument();
  5741. },
  5742. inDisabledFieldset = addCombinator(
  5743. function( elem ) {
  5744. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  5745. },
  5746. { dir: "parentNode", next: "legend" }
  5747. );
  5748. // Optimize for push.apply( _, NodeList )
  5749. try {
  5750. push.apply(
  5751. ( arr = slice.call( preferredDoc.childNodes ) ),
  5752. preferredDoc.childNodes
  5753. );
  5754. // Support: Android<4.0
  5755. // Detect silently failing push.apply
  5756. // eslint-disable-next-line no-unused-expressions
  5757. arr[ preferredDoc.childNodes.length ].nodeType;
  5758. } catch ( e ) {
  5759. push = { apply: arr.length ?
  5760. // Leverage slice if possible
  5761. function( target, els ) {
  5762. pushNative.apply( target, slice.call( els ) );
  5763. } :
  5764. // Support: IE<9
  5765. // Otherwise append directly
  5766. function( target, els ) {
  5767. var j = target.length,
  5768. i = 0;
  5769. // Can't trust NodeList.length
  5770. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  5771. target.length = j - 1;
  5772. }
  5773. };
  5774. }
  5775. function Sizzle( selector, context, results, seed ) {
  5776. var m, i, elem, nid, match, groups, newSelector,
  5777. newContext = context && context.ownerDocument,
  5778. // nodeType defaults to 9, since context defaults to document
  5779. nodeType = context ? context.nodeType : 9;
  5780. results = results || [];
  5781. // Return early from calls with invalid selector or context
  5782. if ( typeof selector !== "string" || !selector ||
  5783. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5784. return results;
  5785. }
  5786. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5787. if ( !seed ) {
  5788. setDocument( context );
  5789. context = context || document;
  5790. if ( documentIsHTML ) {
  5791. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5792. // (excepting DocumentFragment context, where the methods don't exist)
  5793. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  5794. // ID selector
  5795. if ( ( m = match[ 1 ] ) ) {
  5796. // Document context
  5797. if ( nodeType === 9 ) {
  5798. if ( ( elem = context.getElementById( m ) ) ) {
  5799. // Support: IE, Opera, Webkit
  5800. // TODO: identify versions
  5801. // getElementById can match elements by name instead of ID
  5802. if ( elem.id === m ) {
  5803. results.push( elem );
  5804. return results;
  5805. }
  5806. } else {
  5807. return results;
  5808. }
  5809. // Element context
  5810. } else {
  5811. // Support: IE, Opera, Webkit
  5812. // TODO: identify versions
  5813. // getElementById can match elements by name instead of ID
  5814. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  5815. contains( context, elem ) &&
  5816. elem.id === m ) {
  5817. results.push( elem );
  5818. return results;
  5819. }
  5820. }
  5821. // Type selector
  5822. } else if ( match[ 2 ] ) {
  5823. push.apply( results, context.getElementsByTagName( selector ) );
  5824. return results;
  5825. // Class selector
  5826. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  5827. context.getElementsByClassName ) {
  5828. push.apply( results, context.getElementsByClassName( m ) );
  5829. return results;
  5830. }
  5831. }
  5832. // Take advantage of querySelectorAll
  5833. if ( support.qsa &&
  5834. !nonnativeSelectorCache[ selector + " " ] &&
  5835. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  5836. // Support: IE 8 only
  5837. // Exclude object elements
  5838. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  5839. newSelector = selector;
  5840. newContext = context;
  5841. // qSA considers elements outside a scoping root when evaluating child or
  5842. // descendant combinators, which is not what we want.
  5843. // In such cases, we work around the behavior by prefixing every selector in the
  5844. // list with an ID selector referencing the scope context.
  5845. // The technique has to be used as well when a leading combinator is used
  5846. // as such selectors are not recognized by querySelectorAll.
  5847. // Thanks to Andrew Dupont for this technique.
  5848. if ( nodeType === 1 &&
  5849. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  5850. // Expand context for sibling selectors
  5851. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5852. context;
  5853. // We can use :scope instead of the ID hack if the browser
  5854. // supports it & if we're not changing the context.
  5855. if ( newContext !== context || !support.scope ) {
  5856. // Capture the context ID, setting it first if necessary
  5857. if ( ( nid = context.getAttribute( "id" ) ) ) {
  5858. nid = nid.replace( rcssescape, fcssescape );
  5859. } else {
  5860. context.setAttribute( "id", ( nid = expando ) );
  5861. }
  5862. }
  5863. // Prefix every selector in the list
  5864. groups = tokenize( selector );
  5865. i = groups.length;
  5866. while ( i-- ) {
  5867. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  5868. toSelector( groups[ i ] );
  5869. }
  5870. newSelector = groups.join( "," );
  5871. }
  5872. try {
  5873. push.apply( results,
  5874. newContext.querySelectorAll( newSelector )
  5875. );
  5876. return results;
  5877. } catch ( qsaError ) {
  5878. nonnativeSelectorCache( selector, true );
  5879. } finally {
  5880. if ( nid === expando ) {
  5881. context.removeAttribute( "id" );
  5882. }
  5883. }
  5884. }
  5885. }
  5886. }
  5887. // All others
  5888. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5889. }
  5890. /**
  5891. * Create key-value caches of limited size
  5892. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5893. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5894. * deleting the oldest entry
  5895. */
  5896. function createCache() {
  5897. var keys = [];
  5898. function cache( key, value ) {
  5899. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5900. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5901. // Only keep the most recent entries
  5902. delete cache[ keys.shift() ];
  5903. }
  5904. return ( cache[ key + " " ] = value );
  5905. }
  5906. return cache;
  5907. }
  5908. /**
  5909. * Mark a function for special use by Sizzle
  5910. * @param {Function} fn The function to mark
  5911. */
  5912. function markFunction( fn ) {
  5913. fn[ expando ] = true;
  5914. return fn;
  5915. }
  5916. /**
  5917. * Support testing using an element
  5918. * @param {Function} fn Passed the created element and returns a boolean result
  5919. */
  5920. function assert( fn ) {
  5921. var el = document.createElement( "fieldset" );
  5922. try {
  5923. return !!fn( el );
  5924. } catch ( e ) {
  5925. return false;
  5926. } finally {
  5927. // Remove from its parent by default
  5928. if ( el.parentNode ) {
  5929. el.parentNode.removeChild( el );
  5930. }
  5931. // release memory in IE
  5932. el = null;
  5933. }
  5934. }
  5935. /**
  5936. * Adds the same handler for all of the specified attrs
  5937. * @param {String} attrs Pipe-separated list of attributes
  5938. * @param {Function} handler The method that will be applied
  5939. */
  5940. function addHandle( attrs, handler ) {
  5941. var arr = attrs.split( "|" ),
  5942. i = arr.length;
  5943. while ( i-- ) {
  5944. Expr.attrHandle[ arr[ i ] ] = handler;
  5945. }
  5946. }
  5947. /**
  5948. * Checks document order of two siblings
  5949. * @param {Element} a
  5950. * @param {Element} b
  5951. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  5952. */
  5953. function siblingCheck( a, b ) {
  5954. var cur = b && a,
  5955. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  5956. a.sourceIndex - b.sourceIndex;
  5957. // Use IE sourceIndex if available on both nodes
  5958. if ( diff ) {
  5959. return diff;
  5960. }
  5961. // Check if b follows a
  5962. if ( cur ) {
  5963. while ( ( cur = cur.nextSibling ) ) {
  5964. if ( cur === b ) {
  5965. return -1;
  5966. }
  5967. }
  5968. }
  5969. return a ? 1 : -1;
  5970. }
  5971. /**
  5972. * Returns a function to use in pseudos for input types
  5973. * @param {String} type
  5974. */
  5975. function createInputPseudo( type ) {
  5976. return function( elem ) {
  5977. var name = elem.nodeName.toLowerCase();
  5978. return name === "input" && elem.type === type;
  5979. };
  5980. }
  5981. /**
  5982. * Returns a function to use in pseudos for buttons
  5983. * @param {String} type
  5984. */
  5985. function createButtonPseudo( type ) {
  5986. return function( elem ) {
  5987. var name = elem.nodeName.toLowerCase();
  5988. return ( name === "input" || name === "button" ) && elem.type === type;
  5989. };
  5990. }
  5991. /**
  5992. * Returns a function to use in pseudos for :enabled/:disabled
  5993. * @param {Boolean} disabled true for :disabled; false for :enabled
  5994. */
  5995. function createDisabledPseudo( disabled ) {
  5996. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  5997. return function( elem ) {
  5998. // Only certain elements can match :enabled or :disabled
  5999. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  6000. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  6001. if ( "form" in elem ) {
  6002. // Check for inherited disabledness on relevant non-disabled elements:
  6003. // * listed form-associated elements in a disabled fieldset
  6004. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  6005. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  6006. // * option elements in a disabled optgroup
  6007. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  6008. // All such elements have a "form" property.
  6009. if ( elem.parentNode && elem.disabled === false ) {
  6010. // Option elements defer to a parent optgroup if present
  6011. if ( "label" in elem ) {
  6012. if ( "label" in elem.parentNode ) {
  6013. return elem.parentNode.disabled === disabled;
  6014. } else {
  6015. return elem.disabled === disabled;
  6016. }
  6017. }
  6018. // Support: IE 6 - 11
  6019. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  6020. return elem.isDisabled === disabled ||
  6021. // Where there is no isDisabled, check manually
  6022. /* jshint -W018 */
  6023. elem.isDisabled !== !disabled &&
  6024. inDisabledFieldset( elem ) === disabled;
  6025. }
  6026. return elem.disabled === disabled;
  6027. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  6028. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  6029. // even exist on them, let alone have a boolean value.
  6030. } else if ( "label" in elem ) {
  6031. return elem.disabled === disabled;
  6032. }
  6033. // Remaining elements are neither :enabled nor :disabled
  6034. return false;
  6035. };
  6036. }
  6037. /**
  6038. * Returns a function to use in pseudos for positionals
  6039. * @param {Function} fn
  6040. */
  6041. function createPositionalPseudo( fn ) {
  6042. return markFunction( function( argument ) {
  6043. argument = +argument;
  6044. return markFunction( function( seed, matches ) {
  6045. var j,
  6046. matchIndexes = fn( [], seed.length, argument ),
  6047. i = matchIndexes.length;
  6048. // Match elements found at the specified indexes
  6049. while ( i-- ) {
  6050. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  6051. seed[ j ] = !( matches[ j ] = seed[ j ] );
  6052. }
  6053. }
  6054. } );
  6055. } );
  6056. }
  6057. /**
  6058. * Checks a node for validity as a Sizzle context
  6059. * @param {Element|Object=} context
  6060. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  6061. */
  6062. function testContext( context ) {
  6063. return context && typeof context.getElementsByTagName !== "undefined" && context;
  6064. }
  6065. // Expose support vars for convenience
  6066. support = Sizzle.support = {};
  6067. /**
  6068. * Detects XML nodes
  6069. * @param {Element|Object} elem An element or a document
  6070. * @returns {Boolean} True iff elem is a non-HTML XML node
  6071. */
  6072. isXML = Sizzle.isXML = function( elem ) {
  6073. var namespace = elem.namespaceURI,
  6074. docElem = ( elem.ownerDocument || elem ).documentElement;
  6075. // Support: IE <=8
  6076. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  6077. // https://bugs.jquery.com/ticket/4833
  6078. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  6079. };
  6080. /**
  6081. * Sets document-related variables once based on the current document
  6082. * @param {Element|Object} [doc] An element or document object to use to set the document
  6083. * @returns {Object} Returns the current document
  6084. */
  6085. setDocument = Sizzle.setDocument = function( node ) {
  6086. var hasCompare, subWindow,
  6087. doc = node ? node.ownerDocument || node : preferredDoc;
  6088. // Return early if doc is invalid or already selected
  6089. // Support: IE 11+, Edge 17 - 18+
  6090. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6091. // two documents; shallow comparisons work.
  6092. // eslint-disable-next-line eqeqeq
  6093. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  6094. return document;
  6095. }
  6096. // Update global variables
  6097. document = doc;
  6098. docElem = document.documentElement;
  6099. documentIsHTML = !isXML( document );
  6100. // Support: IE 9 - 11+, Edge 12 - 18+
  6101. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  6102. // Support: IE 11+, Edge 17 - 18+
  6103. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6104. // two documents; shallow comparisons work.
  6105. // eslint-disable-next-line eqeqeq
  6106. if ( preferredDoc != document &&
  6107. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  6108. // Support: IE 11, Edge
  6109. if ( subWindow.addEventListener ) {
  6110. subWindow.addEventListener( "unload", unloadHandler, false );
  6111. // Support: IE 9 - 10 only
  6112. } else if ( subWindow.attachEvent ) {
  6113. subWindow.attachEvent( "onunload", unloadHandler );
  6114. }
  6115. }
  6116. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  6117. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  6118. // IE/Edge & older browsers don't support the :scope pseudo-class.
  6119. // Support: Safari 6.0 only
  6120. // Safari 6.0 supports :scope but it's an alias of :root there.
  6121. support.scope = assert( function( el ) {
  6122. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  6123. return typeof el.querySelectorAll !== "undefined" &&
  6124. !el.querySelectorAll( ":scope fieldset div" ).length;
  6125. } );
  6126. /* Attributes
  6127. ---------------------------------------------------------------------- */
  6128. // Support: IE<8
  6129. // Verify that getAttribute really returns attributes and not properties
  6130. // (excepting IE8 booleans)
  6131. support.attributes = assert( function( el ) {
  6132. el.className = "i";
  6133. return !el.getAttribute( "className" );
  6134. } );
  6135. /* getElement(s)By*
  6136. ---------------------------------------------------------------------- */
  6137. // Check if getElementsByTagName("*") returns only elements
  6138. support.getElementsByTagName = assert( function( el ) {
  6139. el.appendChild( document.createComment( "" ) );
  6140. return !el.getElementsByTagName( "*" ).length;
  6141. } );
  6142. // Support: IE<9
  6143. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  6144. // Support: IE<10
  6145. // Check if getElementById returns elements by name
  6146. // The broken getElementById methods don't pick up programmatically-set names,
  6147. // so use a roundabout getElementsByName test
  6148. support.getById = assert( function( el ) {
  6149. docElem.appendChild( el ).id = expando;
  6150. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  6151. } );
  6152. // ID filter and find
  6153. if ( support.getById ) {
  6154. Expr.filter[ "ID" ] = function( id ) {
  6155. var attrId = id.replace( runescape, funescape );
  6156. return function( elem ) {
  6157. return elem.getAttribute( "id" ) === attrId;
  6158. };
  6159. };
  6160. Expr.find[ "ID" ] = function( id, context ) {
  6161. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6162. var elem = context.getElementById( id );
  6163. return elem ? [ elem ] : [];
  6164. }
  6165. };
  6166. } else {
  6167. Expr.filter[ "ID" ] = function( id ) {
  6168. var attrId = id.replace( runescape, funescape );
  6169. return function( elem ) {
  6170. var node = typeof elem.getAttributeNode !== "undefined" &&
  6171. elem.getAttributeNode( "id" );
  6172. return node && node.value === attrId;
  6173. };
  6174. };
  6175. // Support: IE 6 - 7 only
  6176. // getElementById is not reliable as a find shortcut
  6177. Expr.find[ "ID" ] = function( id, context ) {
  6178. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6179. var node, i, elems,
  6180. elem = context.getElementById( id );
  6181. if ( elem ) {
  6182. // Verify the id attribute
  6183. node = elem.getAttributeNode( "id" );
  6184. if ( node && node.value === id ) {
  6185. return [ elem ];
  6186. }
  6187. // Fall back on getElementsByName
  6188. elems = context.getElementsByName( id );
  6189. i = 0;
  6190. while ( ( elem = elems[ i++ ] ) ) {
  6191. node = elem.getAttributeNode( "id" );
  6192. if ( node && node.value === id ) {
  6193. return [ elem ];
  6194. }
  6195. }
  6196. }
  6197. return [];
  6198. }
  6199. };
  6200. }
  6201. // Tag
  6202. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  6203. function( tag, context ) {
  6204. if ( typeof context.getElementsByTagName !== "undefined" ) {
  6205. return context.getElementsByTagName( tag );
  6206. // DocumentFragment nodes don't have gEBTN
  6207. } else if ( support.qsa ) {
  6208. return context.querySelectorAll( tag );
  6209. }
  6210. } :
  6211. function( tag, context ) {
  6212. var elem,
  6213. tmp = [],
  6214. i = 0,
  6215. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  6216. results = context.getElementsByTagName( tag );
  6217. // Filter out possible comments
  6218. if ( tag === "*" ) {
  6219. while ( ( elem = results[ i++ ] ) ) {
  6220. if ( elem.nodeType === 1 ) {
  6221. tmp.push( elem );
  6222. }
  6223. }
  6224. return tmp;
  6225. }
  6226. return results;
  6227. };
  6228. // Class
  6229. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  6230. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  6231. return context.getElementsByClassName( className );
  6232. }
  6233. };
  6234. /* QSA/matchesSelector
  6235. ---------------------------------------------------------------------- */
  6236. // QSA and matchesSelector support
  6237. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  6238. rbuggyMatches = [];
  6239. // qSa(:focus) reports false when true (Chrome 21)
  6240. // We allow this because of a bug in IE8/9 that throws an error
  6241. // whenever `document.activeElement` is accessed on an iframe
  6242. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  6243. // See https://bugs.jquery.com/ticket/13378
  6244. rbuggyQSA = [];
  6245. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  6246. // Build QSA regex
  6247. // Regex strategy adopted from Diego Perini
  6248. assert( function( el ) {
  6249. var input;
  6250. // Select is set to empty string on purpose
  6251. // This is to test IE's treatment of not explicitly
  6252. // setting a boolean content attribute,
  6253. // since its presence should be enough
  6254. // https://bugs.jquery.com/ticket/12359
  6255. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  6256. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  6257. "<option selected=''></option></select>";
  6258. // Support: IE8, Opera 11-12.16
  6259. // Nothing should be selected when empty strings follow ^= or $= or *=
  6260. // The test attribute must be unknown in Opera but "safe" for WinRT
  6261. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6262. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  6263. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6264. }
  6265. // Support: IE8
  6266. // Boolean attributes and "value" are not treated correctly
  6267. if ( !el.querySelectorAll( "[selected]" ).length ) {
  6268. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6269. }
  6270. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6271. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6272. rbuggyQSA.push( "~=" );
  6273. }
  6274. // Support: IE 11+, Edge 15 - 18+
  6275. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  6276. // Adding a temporary attribute to the document before the selection works
  6277. // around the issue.
  6278. // Interestingly, IE 10 & older don't seem to have the issue.
  6279. input = document.createElement( "input" );
  6280. input.setAttribute( "name", "" );
  6281. el.appendChild( input );
  6282. if ( !el.querySelectorAll( "[name='']" ).length ) {
  6283. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  6284. whitespace + "*(?:''|\"\")" );
  6285. }
  6286. // Webkit/Opera - :checked should return selected option elements
  6287. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6288. // IE8 throws error here and will not see later tests
  6289. if ( !el.querySelectorAll( ":checked" ).length ) {
  6290. rbuggyQSA.push( ":checked" );
  6291. }
  6292. // Support: Safari 8+, iOS 8+
  6293. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6294. // In-page `selector#id sibling-combinator selector` fails
  6295. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6296. rbuggyQSA.push( ".#.+[+~]" );
  6297. }
  6298. // Support: Firefox <=3.6 - 5 only
  6299. // Old Firefox doesn't throw on a badly-escaped identifier.
  6300. el.querySelectorAll( "\\\f" );
  6301. rbuggyQSA.push( "[\\r\\n\\f]" );
  6302. } );
  6303. assert( function( el ) {
  6304. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6305. "<select disabled='disabled'><option/></select>";
  6306. // Support: Windows 8 Native Apps
  6307. // The type and name attributes are restricted during .innerHTML assignment
  6308. var input = document.createElement( "input" );
  6309. input.setAttribute( "type", "hidden" );
  6310. el.appendChild( input ).setAttribute( "name", "D" );
  6311. // Support: IE8
  6312. // Enforce case-sensitivity of name attribute
  6313. if ( el.querySelectorAll( "[name=d]" ).length ) {
  6314. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6315. }
  6316. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6317. // IE8 throws error here and will not see later tests
  6318. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  6319. rbuggyQSA.push( ":enabled", ":disabled" );
  6320. }
  6321. // Support: IE9-11+
  6322. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6323. docElem.appendChild( el ).disabled = true;
  6324. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  6325. rbuggyQSA.push( ":enabled", ":disabled" );
  6326. }
  6327. // Support: Opera 10 - 11 only
  6328. // Opera 10-11 does not throw on post-comma invalid pseudos
  6329. el.querySelectorAll( "*,:x" );
  6330. rbuggyQSA.push( ",.*:" );
  6331. } );
  6332. }
  6333. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  6334. docElem.webkitMatchesSelector ||
  6335. docElem.mozMatchesSelector ||
  6336. docElem.oMatchesSelector ||
  6337. docElem.msMatchesSelector ) ) ) ) {
  6338. assert( function( el ) {
  6339. // Check to see if it's possible to do matchesSelector
  6340. // on a disconnected node (IE 9)
  6341. support.disconnectedMatch = matches.call( el, "*" );
  6342. // This should fail with an exception
  6343. // Gecko does not error, returns false instead
  6344. matches.call( el, "[s!='']:x" );
  6345. rbuggyMatches.push( "!=", pseudos );
  6346. } );
  6347. }
  6348. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  6349. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  6350. /* Contains
  6351. ---------------------------------------------------------------------- */
  6352. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6353. // Element contains another
  6354. // Purposefully self-exclusive
  6355. // As in, an element does not contain itself
  6356. contains = hasCompare || rnative.test( docElem.contains ) ?
  6357. function( a, b ) {
  6358. var adown = a.nodeType === 9 ? a.documentElement : a,
  6359. bup = b && b.parentNode;
  6360. return a === bup || !!( bup && bup.nodeType === 1 && (
  6361. adown.contains ?
  6362. adown.contains( bup ) :
  6363. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6364. ) );
  6365. } :
  6366. function( a, b ) {
  6367. if ( b ) {
  6368. while ( ( b = b.parentNode ) ) {
  6369. if ( b === a ) {
  6370. return true;
  6371. }
  6372. }
  6373. }
  6374. return false;
  6375. };
  6376. /* Sorting
  6377. ---------------------------------------------------------------------- */
  6378. // Document order sorting
  6379. sortOrder = hasCompare ?
  6380. function( a, b ) {
  6381. // Flag for duplicate removal
  6382. if ( a === b ) {
  6383. hasDuplicate = true;
  6384. return 0;
  6385. }
  6386. // Sort on method existence if only one input has compareDocumentPosition
  6387. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6388. if ( compare ) {
  6389. return compare;
  6390. }
  6391. // Calculate position if both inputs belong to the same document
  6392. // Support: IE 11+, Edge 17 - 18+
  6393. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6394. // two documents; shallow comparisons work.
  6395. // eslint-disable-next-line eqeqeq
  6396. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  6397. a.compareDocumentPosition( b ) :
  6398. // Otherwise we know they are disconnected
  6399. 1;
  6400. // Disconnected nodes
  6401. if ( compare & 1 ||
  6402. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  6403. // Choose the first element that is related to our preferred document
  6404. // Support: IE 11+, Edge 17 - 18+
  6405. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6406. // two documents; shallow comparisons work.
  6407. // eslint-disable-next-line eqeqeq
  6408. if ( a == document || a.ownerDocument == preferredDoc &&
  6409. contains( preferredDoc, a ) ) {
  6410. return -1;
  6411. }
  6412. // Support: IE 11+, Edge 17 - 18+
  6413. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6414. // two documents; shallow comparisons work.
  6415. // eslint-disable-next-line eqeqeq
  6416. if ( b == document || b.ownerDocument == preferredDoc &&
  6417. contains( preferredDoc, b ) ) {
  6418. return 1;
  6419. }
  6420. // Maintain original order
  6421. return sortInput ?
  6422. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6423. 0;
  6424. }
  6425. return compare & 4 ? -1 : 1;
  6426. } :
  6427. function( a, b ) {
  6428. // Exit early if the nodes are identical
  6429. if ( a === b ) {
  6430. hasDuplicate = true;
  6431. return 0;
  6432. }
  6433. var cur,
  6434. i = 0,
  6435. aup = a.parentNode,
  6436. bup = b.parentNode,
  6437. ap = [ a ],
  6438. bp = [ b ];
  6439. // Parentless nodes are either documents or disconnected
  6440. if ( !aup || !bup ) {
  6441. // Support: IE 11+, Edge 17 - 18+
  6442. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6443. // two documents; shallow comparisons work.
  6444. /* eslint-disable eqeqeq */
  6445. return a == document ? -1 :
  6446. b == document ? 1 :
  6447. /* eslint-enable eqeqeq */
  6448. aup ? -1 :
  6449. bup ? 1 :
  6450. sortInput ?
  6451. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6452. 0;
  6453. // If the nodes are siblings, we can do a quick check
  6454. } else if ( aup === bup ) {
  6455. return siblingCheck( a, b );
  6456. }
  6457. // Otherwise we need full lists of their ancestors for comparison
  6458. cur = a;
  6459. while ( ( cur = cur.parentNode ) ) {
  6460. ap.unshift( cur );
  6461. }
  6462. cur = b;
  6463. while ( ( cur = cur.parentNode ) ) {
  6464. bp.unshift( cur );
  6465. }
  6466. // Walk down the tree looking for a discrepancy
  6467. while ( ap[ i ] === bp[ i ] ) {
  6468. i++;
  6469. }
  6470. return i ?
  6471. // Do a sibling check if the nodes have a common ancestor
  6472. siblingCheck( ap[ i ], bp[ i ] ) :
  6473. // Otherwise nodes in our document sort first
  6474. // Support: IE 11+, Edge 17 - 18+
  6475. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6476. // two documents; shallow comparisons work.
  6477. /* eslint-disable eqeqeq */
  6478. ap[ i ] == preferredDoc ? -1 :
  6479. bp[ i ] == preferredDoc ? 1 :
  6480. /* eslint-enable eqeqeq */
  6481. 0;
  6482. };
  6483. return document;
  6484. };
  6485. Sizzle.matches = function( expr, elements ) {
  6486. return Sizzle( expr, null, null, elements );
  6487. };
  6488. Sizzle.matchesSelector = function( elem, expr ) {
  6489. setDocument( elem );
  6490. if ( support.matchesSelector && documentIsHTML &&
  6491. !nonnativeSelectorCache[ expr + " " ] &&
  6492. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6493. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6494. try {
  6495. var ret = matches.call( elem, expr );
  6496. // IE 9's matchesSelector returns false on disconnected nodes
  6497. if ( ret || support.disconnectedMatch ||
  6498. // As well, disconnected nodes are said to be in a document
  6499. // fragment in IE 9
  6500. elem.document && elem.document.nodeType !== 11 ) {
  6501. return ret;
  6502. }
  6503. } catch ( e ) {
  6504. nonnativeSelectorCache( expr, true );
  6505. }
  6506. }
  6507. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6508. };
  6509. Sizzle.contains = function( context, elem ) {
  6510. // Set document vars if needed
  6511. // Support: IE 11+, Edge 17 - 18+
  6512. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6513. // two documents; shallow comparisons work.
  6514. // eslint-disable-next-line eqeqeq
  6515. if ( ( context.ownerDocument || context ) != document ) {
  6516. setDocument( context );
  6517. }
  6518. return contains( context, elem );
  6519. };
  6520. Sizzle.attr = function( elem, name ) {
  6521. // Set document vars if needed
  6522. // Support: IE 11+, Edge 17 - 18+
  6523. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  6524. // two documents; shallow comparisons work.
  6525. // eslint-disable-next-line eqeqeq
  6526. if ( ( elem.ownerDocument || elem ) != document ) {
  6527. setDocument( elem );
  6528. }
  6529. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6530. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6531. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6532. fn( elem, name, !documentIsHTML ) :
  6533. undefined;
  6534. return val !== undefined ?
  6535. val :
  6536. support.attributes || !documentIsHTML ?
  6537. elem.getAttribute( name ) :
  6538. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  6539. val.value :
  6540. null;
  6541. };
  6542. Sizzle.escape = function( sel ) {
  6543. return ( sel + "" ).replace( rcssescape, fcssescape );
  6544. };
  6545. Sizzle.error = function( msg ) {
  6546. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6547. };
  6548. /**
  6549. * Document sorting and removing duplicates
  6550. * @param {ArrayLike} results
  6551. */
  6552. Sizzle.uniqueSort = function( results ) {
  6553. var elem,
  6554. duplicates = [],
  6555. j = 0,
  6556. i = 0;
  6557. // Unless we *know* we can detect duplicates, assume their presence
  6558. hasDuplicate = !support.detectDuplicates;
  6559. sortInput = !support.sortStable && results.slice( 0 );
  6560. results.sort( sortOrder );
  6561. if ( hasDuplicate ) {
  6562. while ( ( elem = results[ i++ ] ) ) {
  6563. if ( elem === results[ i ] ) {
  6564. j = duplicates.push( i );
  6565. }
  6566. }
  6567. while ( j-- ) {
  6568. results.splice( duplicates[ j ], 1 );
  6569. }
  6570. }
  6571. // Clear input after sorting to release objects
  6572. // See https://github.com/jquery/sizzle/pull/225
  6573. sortInput = null;
  6574. return results;
  6575. };
  6576. /**
  6577. * Utility function for retrieving the text value of an array of DOM nodes
  6578. * @param {Array|Element} elem
  6579. */
  6580. getText = Sizzle.getText = function( elem ) {
  6581. var node,
  6582. ret = "",
  6583. i = 0,
  6584. nodeType = elem.nodeType;
  6585. if ( !nodeType ) {
  6586. // If no nodeType, this is expected to be an array
  6587. while ( ( node = elem[ i++ ] ) ) {
  6588. // Do not traverse comment nodes
  6589. ret += getText( node );
  6590. }
  6591. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6592. // Use textContent for elements
  6593. // innerText usage removed for consistency of new lines (jQuery #11153)
  6594. if ( typeof elem.textContent === "string" ) {
  6595. return elem.textContent;
  6596. } else {
  6597. // Traverse its children
  6598. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6599. ret += getText( elem );
  6600. }
  6601. }
  6602. } else if ( nodeType === 3 || nodeType === 4 ) {
  6603. return elem.nodeValue;
  6604. }
  6605. // Do not include comment or processing instruction nodes
  6606. return ret;
  6607. };
  6608. Expr = Sizzle.selectors = {
  6609. // Can be adjusted by the user
  6610. cacheLength: 50,
  6611. createPseudo: markFunction,
  6612. match: matchExpr,
  6613. attrHandle: {},
  6614. find: {},
  6615. relative: {
  6616. ">": { dir: "parentNode", first: true },
  6617. " ": { dir: "parentNode" },
  6618. "+": { dir: "previousSibling", first: true },
  6619. "~": { dir: "previousSibling" }
  6620. },
  6621. preFilter: {
  6622. "ATTR": function( match ) {
  6623. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  6624. // Move the given value to match[3] whether quoted or unquoted
  6625. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  6626. match[ 5 ] || "" ).replace( runescape, funescape );
  6627. if ( match[ 2 ] === "~=" ) {
  6628. match[ 3 ] = " " + match[ 3 ] + " ";
  6629. }
  6630. return match.slice( 0, 4 );
  6631. },
  6632. "CHILD": function( match ) {
  6633. /* matches from matchExpr["CHILD"]
  6634. 1 type (only|nth|...)
  6635. 2 what (child|of-type)
  6636. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6637. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6638. 5 sign of xn-component
  6639. 6 x of xn-component
  6640. 7 sign of y-component
  6641. 8 y of y-component
  6642. */
  6643. match[ 1 ] = match[ 1 ].toLowerCase();
  6644. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  6645. // nth-* requires argument
  6646. if ( !match[ 3 ] ) {
  6647. Sizzle.error( match[ 0 ] );
  6648. }
  6649. // numeric x and y parameters for Expr.filter.CHILD
  6650. // remember that false/true cast respectively to 0/1
  6651. match[ 4 ] = +( match[ 4 ] ?
  6652. match[ 5 ] + ( match[ 6 ] || 1 ) :
  6653. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  6654. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  6655. // other types prohibit arguments
  6656. } else if ( match[ 3 ] ) {
  6657. Sizzle.error( match[ 0 ] );
  6658. }
  6659. return match;
  6660. },
  6661. "PSEUDO": function( match ) {
  6662. var excess,
  6663. unquoted = !match[ 6 ] && match[ 2 ];
  6664. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  6665. return null;
  6666. }
  6667. // Accept quoted arguments as-is
  6668. if ( match[ 3 ] ) {
  6669. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  6670. // Strip excess characters from unquoted arguments
  6671. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6672. // Get excess from tokenize (recursively)
  6673. ( excess = tokenize( unquoted, true ) ) &&
  6674. // advance to the next closing parenthesis
  6675. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  6676. // excess is a negative index
  6677. match[ 0 ] = match[ 0 ].slice( 0, excess );
  6678. match[ 2 ] = unquoted.slice( 0, excess );
  6679. }
  6680. // Return only captures needed by the pseudo filter method (type and argument)
  6681. return match.slice( 0, 3 );
  6682. }
  6683. },
  6684. filter: {
  6685. "TAG": function( nodeNameSelector ) {
  6686. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6687. return nodeNameSelector === "*" ?
  6688. function() {
  6689. return true;
  6690. } :
  6691. function( elem ) {
  6692. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6693. };
  6694. },
  6695. "CLASS": function( className ) {
  6696. var pattern = classCache[ className + " " ];
  6697. return pattern ||
  6698. ( pattern = new RegExp( "(^|" + whitespace +
  6699. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  6700. className, function( elem ) {
  6701. return pattern.test(
  6702. typeof elem.className === "string" && elem.className ||
  6703. typeof elem.getAttribute !== "undefined" &&
  6704. elem.getAttribute( "class" ) ||
  6705. ""
  6706. );
  6707. } );
  6708. },
  6709. "ATTR": function( name, operator, check ) {
  6710. return function( elem ) {
  6711. var result = Sizzle.attr( elem, name );
  6712. if ( result == null ) {
  6713. return operator === "!=";
  6714. }
  6715. if ( !operator ) {
  6716. return true;
  6717. }
  6718. result += "";
  6719. /* eslint-disable max-len */
  6720. return operator === "=" ? result === check :
  6721. operator === "!=" ? result !== check :
  6722. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6723. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6724. operator === "$=" ? check && result.slice( -check.length ) === check :
  6725. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6726. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6727. false;
  6728. /* eslint-enable max-len */
  6729. };
  6730. },
  6731. "CHILD": function( type, what, _argument, first, last ) {
  6732. var simple = type.slice( 0, 3 ) !== "nth",
  6733. forward = type.slice( -4 ) !== "last",
  6734. ofType = what === "of-type";
  6735. return first === 1 && last === 0 ?
  6736. // Shortcut for :nth-*(n)
  6737. function( elem ) {
  6738. return !!elem.parentNode;
  6739. } :
  6740. function( elem, _context, xml ) {
  6741. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6742. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6743. parent = elem.parentNode,
  6744. name = ofType && elem.nodeName.toLowerCase(),
  6745. useCache = !xml && !ofType,
  6746. diff = false;
  6747. if ( parent ) {
  6748. // :(first|last|only)-(child|of-type)
  6749. if ( simple ) {
  6750. while ( dir ) {
  6751. node = elem;
  6752. while ( ( node = node[ dir ] ) ) {
  6753. if ( ofType ?
  6754. node.nodeName.toLowerCase() === name :
  6755. node.nodeType === 1 ) {
  6756. return false;
  6757. }
  6758. }
  6759. // Reverse direction for :only-* (if we haven't yet done so)
  6760. start = dir = type === "only" && !start && "nextSibling";
  6761. }
  6762. return true;
  6763. }
  6764. start = [ forward ? parent.firstChild : parent.lastChild ];
  6765. // non-xml :nth-child(...) stores cache data on `parent`
  6766. if ( forward && useCache ) {
  6767. // Seek `elem` from a previously-cached index
  6768. // ...in a gzip-friendly way
  6769. node = parent;
  6770. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6771. // Support: IE <9 only
  6772. // Defend against cloned attroperties (jQuery gh-1709)
  6773. uniqueCache = outerCache[ node.uniqueID ] ||
  6774. ( outerCache[ node.uniqueID ] = {} );
  6775. cache = uniqueCache[ type ] || [];
  6776. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6777. diff = nodeIndex && cache[ 2 ];
  6778. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6779. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6780. // Fallback to seeking `elem` from the start
  6781. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6782. // When found, cache indexes on `parent` and break
  6783. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6784. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6785. break;
  6786. }
  6787. }
  6788. } else {
  6789. // Use previously-cached element index if available
  6790. if ( useCache ) {
  6791. // ...in a gzip-friendly way
  6792. node = elem;
  6793. outerCache = node[ expando ] || ( node[ expando ] = {} );
  6794. // Support: IE <9 only
  6795. // Defend against cloned attroperties (jQuery gh-1709)
  6796. uniqueCache = outerCache[ node.uniqueID ] ||
  6797. ( outerCache[ node.uniqueID ] = {} );
  6798. cache = uniqueCache[ type ] || [];
  6799. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6800. diff = nodeIndex;
  6801. }
  6802. // xml :nth-child(...)
  6803. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6804. if ( diff === false ) {
  6805. // Use the same loop as above to seek `elem` from the start
  6806. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  6807. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  6808. if ( ( ofType ?
  6809. node.nodeName.toLowerCase() === name :
  6810. node.nodeType === 1 ) &&
  6811. ++diff ) {
  6812. // Cache the index of each encountered element
  6813. if ( useCache ) {
  6814. outerCache = node[ expando ] ||
  6815. ( node[ expando ] = {} );
  6816. // Support: IE <9 only
  6817. // Defend against cloned attroperties (jQuery gh-1709)
  6818. uniqueCache = outerCache[ node.uniqueID ] ||
  6819. ( outerCache[ node.uniqueID ] = {} );
  6820. uniqueCache[ type ] = [ dirruns, diff ];
  6821. }
  6822. if ( node === elem ) {
  6823. break;
  6824. }
  6825. }
  6826. }
  6827. }
  6828. }
  6829. // Incorporate the offset, then check against cycle size
  6830. diff -= last;
  6831. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6832. }
  6833. };
  6834. },
  6835. "PSEUDO": function( pseudo, argument ) {
  6836. // pseudo-class names are case-insensitive
  6837. // http://www.w3.org/TR/selectors/#pseudo-classes
  6838. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6839. // Remember that setFilters inherits from pseudos
  6840. var args,
  6841. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6842. Sizzle.error( "unsupported pseudo: " + pseudo );
  6843. // The user may use createPseudo to indicate that
  6844. // arguments are needed to create the filter function
  6845. // just as Sizzle does
  6846. if ( fn[ expando ] ) {
  6847. return fn( argument );
  6848. }
  6849. // But maintain support for old signatures
  6850. if ( fn.length > 1 ) {
  6851. args = [ pseudo, pseudo, "", argument ];
  6852. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6853. markFunction( function( seed, matches ) {
  6854. var idx,
  6855. matched = fn( seed, argument ),
  6856. i = matched.length;
  6857. while ( i-- ) {
  6858. idx = indexOf( seed, matched[ i ] );
  6859. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  6860. }
  6861. } ) :
  6862. function( elem ) {
  6863. return fn( elem, 0, args );
  6864. };
  6865. }
  6866. return fn;
  6867. }
  6868. },
  6869. pseudos: {
  6870. // Potentially complex pseudos
  6871. "not": markFunction( function( selector ) {
  6872. // Trim the selector passed to compile
  6873. // to avoid treating leading and trailing
  6874. // spaces as combinators
  6875. var input = [],
  6876. results = [],
  6877. matcher = compile( selector.replace( rtrim, "$1" ) );
  6878. return matcher[ expando ] ?
  6879. markFunction( function( seed, matches, _context, xml ) {
  6880. var elem,
  6881. unmatched = matcher( seed, null, xml, [] ),
  6882. i = seed.length;
  6883. // Match elements unmatched by `matcher`
  6884. while ( i-- ) {
  6885. if ( ( elem = unmatched[ i ] ) ) {
  6886. seed[ i ] = !( matches[ i ] = elem );
  6887. }
  6888. }
  6889. } ) :
  6890. function( elem, _context, xml ) {
  6891. input[ 0 ] = elem;
  6892. matcher( input, null, xml, results );
  6893. // Don't keep the element (issue #299)
  6894. input[ 0 ] = null;
  6895. return !results.pop();
  6896. };
  6897. } ),
  6898. "has": markFunction( function( selector ) {
  6899. return function( elem ) {
  6900. return Sizzle( selector, elem ).length > 0;
  6901. };
  6902. } ),
  6903. "contains": markFunction( function( text ) {
  6904. text = text.replace( runescape, funescape );
  6905. return function( elem ) {
  6906. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  6907. };
  6908. } ),
  6909. // "Whether an element is represented by a :lang() selector
  6910. // is based solely on the element's language value
  6911. // being equal to the identifier C,
  6912. // or beginning with the identifier C immediately followed by "-".
  6913. // The matching of C against the element's language value is performed case-insensitively.
  6914. // The identifier C does not have to be a valid language name."
  6915. // http://www.w3.org/TR/selectors/#lang-pseudo
  6916. "lang": markFunction( function( lang ) {
  6917. // lang value must be a valid identifier
  6918. if ( !ridentifier.test( lang || "" ) ) {
  6919. Sizzle.error( "unsupported lang: " + lang );
  6920. }
  6921. lang = lang.replace( runescape, funescape ).toLowerCase();
  6922. return function( elem ) {
  6923. var elemLang;
  6924. do {
  6925. if ( ( elemLang = documentIsHTML ?
  6926. elem.lang :
  6927. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  6928. elemLang = elemLang.toLowerCase();
  6929. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6930. }
  6931. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  6932. return false;
  6933. };
  6934. } ),
  6935. // Miscellaneous
  6936. "target": function( elem ) {
  6937. var hash = window.location && window.location.hash;
  6938. return hash && hash.slice( 1 ) === elem.id;
  6939. },
  6940. "root": function( elem ) {
  6941. return elem === docElem;
  6942. },
  6943. "focus": function( elem ) {
  6944. return elem === document.activeElement &&
  6945. ( !document.hasFocus || document.hasFocus() ) &&
  6946. !!( elem.type || elem.href || ~elem.tabIndex );
  6947. },
  6948. // Boolean properties
  6949. "enabled": createDisabledPseudo( false ),
  6950. "disabled": createDisabledPseudo( true ),
  6951. "checked": function( elem ) {
  6952. // In CSS3, :checked should return both checked and selected elements
  6953. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6954. var nodeName = elem.nodeName.toLowerCase();
  6955. return ( nodeName === "input" && !!elem.checked ) ||
  6956. ( nodeName === "option" && !!elem.selected );
  6957. },
  6958. "selected": function( elem ) {
  6959. // Accessing this property makes selected-by-default
  6960. // options in Safari work properly
  6961. if ( elem.parentNode ) {
  6962. // eslint-disable-next-line no-unused-expressions
  6963. elem.parentNode.selectedIndex;
  6964. }
  6965. return elem.selected === true;
  6966. },
  6967. // Contents
  6968. "empty": function( elem ) {
  6969. // http://www.w3.org/TR/selectors/#empty-pseudo
  6970. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6971. // but not by others (comment: 8; processing instruction: 7; etc.)
  6972. // nodeType < 6 works because attributes (2) do not appear as children
  6973. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6974. if ( elem.nodeType < 6 ) {
  6975. return false;
  6976. }
  6977. }
  6978. return true;
  6979. },
  6980. "parent": function( elem ) {
  6981. return !Expr.pseudos[ "empty" ]( elem );
  6982. },
  6983. // Element/input types
  6984. "header": function( elem ) {
  6985. return rheader.test( elem.nodeName );
  6986. },
  6987. "input": function( elem ) {
  6988. return rinputs.test( elem.nodeName );
  6989. },
  6990. "button": function( elem ) {
  6991. var name = elem.nodeName.toLowerCase();
  6992. return name === "input" && elem.type === "button" || name === "button";
  6993. },
  6994. "text": function( elem ) {
  6995. var attr;
  6996. return elem.nodeName.toLowerCase() === "input" &&
  6997. elem.type === "text" &&
  6998. // Support: IE<8
  6999. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  7000. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  7001. attr.toLowerCase() === "text" );
  7002. },
  7003. // Position-in-collection
  7004. "first": createPositionalPseudo( function() {
  7005. return [ 0 ];
  7006. } ),
  7007. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  7008. return [ length - 1 ];
  7009. } ),
  7010. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  7011. return [ argument < 0 ? argument + length : argument ];
  7012. } ),
  7013. "even": createPositionalPseudo( function( matchIndexes, length ) {
  7014. var i = 0;
  7015. for ( ; i < length; i += 2 ) {
  7016. matchIndexes.push( i );
  7017. }
  7018. return matchIndexes;
  7019. } ),
  7020. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  7021. var i = 1;
  7022. for ( ; i < length; i += 2 ) {
  7023. matchIndexes.push( i );
  7024. }
  7025. return matchIndexes;
  7026. } ),
  7027. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7028. var i = argument < 0 ?
  7029. argument + length :
  7030. argument > length ?
  7031. length :
  7032. argument;
  7033. for ( ; --i >= 0; ) {
  7034. matchIndexes.push( i );
  7035. }
  7036. return matchIndexes;
  7037. } ),
  7038. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  7039. var i = argument < 0 ? argument + length : argument;
  7040. for ( ; ++i < length; ) {
  7041. matchIndexes.push( i );
  7042. }
  7043. return matchIndexes;
  7044. } )
  7045. }
  7046. };
  7047. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  7048. // Add button/input type pseudos
  7049. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  7050. Expr.pseudos[ i ] = createInputPseudo( i );
  7051. }
  7052. for ( i in { submit: true, reset: true } ) {
  7053. Expr.pseudos[ i ] = createButtonPseudo( i );
  7054. }
  7055. // Easy API for creating new setFilters
  7056. function setFilters() {}
  7057. setFilters.prototype = Expr.filters = Expr.pseudos;
  7058. Expr.setFilters = new setFilters();
  7059. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  7060. var matched, match, tokens, type,
  7061. soFar, groups, preFilters,
  7062. cached = tokenCache[ selector + " " ];
  7063. if ( cached ) {
  7064. return parseOnly ? 0 : cached.slice( 0 );
  7065. }
  7066. soFar = selector;
  7067. groups = [];
  7068. preFilters = Expr.preFilter;
  7069. while ( soFar ) {
  7070. // Comma and first run
  7071. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  7072. if ( match ) {
  7073. // Don't consume trailing commas as valid
  7074. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  7075. }
  7076. groups.push( ( tokens = [] ) );
  7077. }
  7078. matched = false;
  7079. // Combinators
  7080. if ( ( match = rcombinators.exec( soFar ) ) ) {
  7081. matched = match.shift();
  7082. tokens.push( {
  7083. value: matched,
  7084. // Cast descendant combinators to space
  7085. type: match[ 0 ].replace( rtrim, " " )
  7086. } );
  7087. soFar = soFar.slice( matched.length );
  7088. }
  7089. // Filters
  7090. for ( type in Expr.filter ) {
  7091. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  7092. ( match = preFilters[ type ]( match ) ) ) ) {
  7093. matched = match.shift();
  7094. tokens.push( {
  7095. value: matched,
  7096. type: type,
  7097. matches: match
  7098. } );
  7099. soFar = soFar.slice( matched.length );
  7100. }
  7101. }
  7102. if ( !matched ) {
  7103. break;
  7104. }
  7105. }
  7106. // Return the length of the invalid excess
  7107. // if we're just parsing
  7108. // Otherwise, throw an error or return tokens
  7109. return parseOnly ?
  7110. soFar.length :
  7111. soFar ?
  7112. Sizzle.error( selector ) :
  7113. // Cache the tokens
  7114. tokenCache( selector, groups ).slice( 0 );
  7115. };
  7116. function toSelector( tokens ) {
  7117. var i = 0,
  7118. len = tokens.length,
  7119. selector = "";
  7120. for ( ; i < len; i++ ) {
  7121. selector += tokens[ i ].value;
  7122. }
  7123. return selector;
  7124. }
  7125. function addCombinator( matcher, combinator, base ) {
  7126. var dir = combinator.dir,
  7127. skip = combinator.next,
  7128. key = skip || dir,
  7129. checkNonElements = base && key === "parentNode",
  7130. doneName = done++;
  7131. return combinator.first ?
  7132. // Check against closest ancestor/preceding element
  7133. function( elem, context, xml ) {
  7134. while ( ( elem = elem[ dir ] ) ) {
  7135. if ( elem.nodeType === 1 || checkNonElements ) {
  7136. return matcher( elem, context, xml );
  7137. }
  7138. }
  7139. return false;
  7140. } :
  7141. // Check against all ancestor/preceding elements
  7142. function( elem, context, xml ) {
  7143. var oldCache, uniqueCache, outerCache,
  7144. newCache = [ dirruns, doneName ];
  7145. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  7146. if ( xml ) {
  7147. while ( ( elem = elem[ dir ] ) ) {
  7148. if ( elem.nodeType === 1 || checkNonElements ) {
  7149. if ( matcher( elem, context, xml ) ) {
  7150. return true;
  7151. }
  7152. }
  7153. }
  7154. } else {
  7155. while ( ( elem = elem[ dir ] ) ) {
  7156. if ( elem.nodeType === 1 || checkNonElements ) {
  7157. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  7158. // Support: IE <9 only
  7159. // Defend against cloned attroperties (jQuery gh-1709)
  7160. uniqueCache = outerCache[ elem.uniqueID ] ||
  7161. ( outerCache[ elem.uniqueID ] = {} );
  7162. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  7163. elem = elem[ dir ] || elem;
  7164. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  7165. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  7166. // Assign to newCache so results back-propagate to previous elements
  7167. return ( newCache[ 2 ] = oldCache[ 2 ] );
  7168. } else {
  7169. // Reuse newcache so results back-propagate to previous elements
  7170. uniqueCache[ key ] = newCache;
  7171. // A match means we're done; a fail means we have to keep checking
  7172. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  7173. return true;
  7174. }
  7175. }
  7176. }
  7177. }
  7178. }
  7179. return false;
  7180. };
  7181. }
  7182. function elementMatcher( matchers ) {
  7183. return matchers.length > 1 ?
  7184. function( elem, context, xml ) {
  7185. var i = matchers.length;
  7186. while ( i-- ) {
  7187. if ( !matchers[ i ]( elem, context, xml ) ) {
  7188. return false;
  7189. }
  7190. }
  7191. return true;
  7192. } :
  7193. matchers[ 0 ];
  7194. }
  7195. function multipleContexts( selector, contexts, results ) {
  7196. var i = 0,
  7197. len = contexts.length;
  7198. for ( ; i < len; i++ ) {
  7199. Sizzle( selector, contexts[ i ], results );
  7200. }
  7201. return results;
  7202. }
  7203. function condense( unmatched, map, filter, context, xml ) {
  7204. var elem,
  7205. newUnmatched = [],
  7206. i = 0,
  7207. len = unmatched.length,
  7208. mapped = map != null;
  7209. for ( ; i < len; i++ ) {
  7210. if ( ( elem = unmatched[ i ] ) ) {
  7211. if ( !filter || filter( elem, context, xml ) ) {
  7212. newUnmatched.push( elem );
  7213. if ( mapped ) {
  7214. map.push( i );
  7215. }
  7216. }
  7217. }
  7218. }
  7219. return newUnmatched;
  7220. }
  7221. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  7222. if ( postFilter && !postFilter[ expando ] ) {
  7223. postFilter = setMatcher( postFilter );
  7224. }
  7225. if ( postFinder && !postFinder[ expando ] ) {
  7226. postFinder = setMatcher( postFinder, postSelector );
  7227. }
  7228. return markFunction( function( seed, results, context, xml ) {
  7229. var temp, i, elem,
  7230. preMap = [],
  7231. postMap = [],
  7232. preexisting = results.length,
  7233. // Get initial elements from seed or context
  7234. elems = seed || multipleContexts(
  7235. selector || "*",
  7236. context.nodeType ? [ context ] : context,
  7237. []
  7238. ),
  7239. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  7240. matcherIn = preFilter && ( seed || !selector ) ?
  7241. condense( elems, preMap, preFilter, context, xml ) :
  7242. elems,
  7243. matcherOut = matcher ?
  7244. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  7245. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  7246. // ...intermediate processing is necessary
  7247. [] :
  7248. // ...otherwise use results directly
  7249. results :
  7250. matcherIn;
  7251. // Find primary matches
  7252. if ( matcher ) {
  7253. matcher( matcherIn, matcherOut, context, xml );
  7254. }
  7255. // Apply postFilter
  7256. if ( postFilter ) {
  7257. temp = condense( matcherOut, postMap );
  7258. postFilter( temp, [], context, xml );
  7259. // Un-match failing elements by moving them back to matcherIn
  7260. i = temp.length;
  7261. while ( i-- ) {
  7262. if ( ( elem = temp[ i ] ) ) {
  7263. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  7264. }
  7265. }
  7266. }
  7267. if ( seed ) {
  7268. if ( postFinder || preFilter ) {
  7269. if ( postFinder ) {
  7270. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  7271. temp = [];
  7272. i = matcherOut.length;
  7273. while ( i-- ) {
  7274. if ( ( elem = matcherOut[ i ] ) ) {
  7275. // Restore matcherIn since elem is not yet a final match
  7276. temp.push( ( matcherIn[ i ] = elem ) );
  7277. }
  7278. }
  7279. postFinder( null, ( matcherOut = [] ), temp, xml );
  7280. }
  7281. // Move matched elements from seed to results to keep them synchronized
  7282. i = matcherOut.length;
  7283. while ( i-- ) {
  7284. if ( ( elem = matcherOut[ i ] ) &&
  7285. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  7286. seed[ temp ] = !( results[ temp ] = elem );
  7287. }
  7288. }
  7289. }
  7290. // Add elements to results, through postFinder if defined
  7291. } else {
  7292. matcherOut = condense(
  7293. matcherOut === results ?
  7294. matcherOut.splice( preexisting, matcherOut.length ) :
  7295. matcherOut
  7296. );
  7297. if ( postFinder ) {
  7298. postFinder( null, results, matcherOut, xml );
  7299. } else {
  7300. push.apply( results, matcherOut );
  7301. }
  7302. }
  7303. } );
  7304. }
  7305. function matcherFromTokens( tokens ) {
  7306. var checkContext, matcher, j,
  7307. len = tokens.length,
  7308. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  7309. implicitRelative = leadingRelative || Expr.relative[ " " ],
  7310. i = leadingRelative ? 1 : 0,
  7311. // The foundational matcher ensures that elements are reachable from top-level context(s)
  7312. matchContext = addCombinator( function( elem ) {
  7313. return elem === checkContext;
  7314. }, implicitRelative, true ),
  7315. matchAnyContext = addCombinator( function( elem ) {
  7316. return indexOf( checkContext, elem ) > -1;
  7317. }, implicitRelative, true ),
  7318. matchers = [ function( elem, context, xml ) {
  7319. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  7320. ( checkContext = context ).nodeType ?
  7321. matchContext( elem, context, xml ) :
  7322. matchAnyContext( elem, context, xml ) );
  7323. // Avoid hanging onto element (issue #299)
  7324. checkContext = null;
  7325. return ret;
  7326. } ];
  7327. for ( ; i < len; i++ ) {
  7328. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  7329. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  7330. } else {
  7331. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  7332. // Return special upon seeing a positional matcher
  7333. if ( matcher[ expando ] ) {
  7334. // Find the next relative operator (if any) for proper handling
  7335. j = ++i;
  7336. for ( ; j < len; j++ ) {
  7337. if ( Expr.relative[ tokens[ j ].type ] ) {
  7338. break;
  7339. }
  7340. }
  7341. return setMatcher(
  7342. i > 1 && elementMatcher( matchers ),
  7343. i > 1 && toSelector(
  7344. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7345. tokens
  7346. .slice( 0, i - 1 )
  7347. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  7348. ).replace( rtrim, "$1" ),
  7349. matcher,
  7350. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7351. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  7352. j < len && toSelector( tokens )
  7353. );
  7354. }
  7355. matchers.push( matcher );
  7356. }
  7357. }
  7358. return elementMatcher( matchers );
  7359. }
  7360. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7361. var bySet = setMatchers.length > 0,
  7362. byElement = elementMatchers.length > 0,
  7363. superMatcher = function( seed, context, xml, results, outermost ) {
  7364. var elem, j, matcher,
  7365. matchedCount = 0,
  7366. i = "0",
  7367. unmatched = seed && [],
  7368. setMatched = [],
  7369. contextBackup = outermostContext,
  7370. // We must always have either seed elements or outermost context
  7371. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  7372. // Use integer dirruns iff this is the outermost matcher
  7373. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  7374. len = elems.length;
  7375. if ( outermost ) {
  7376. // Support: IE 11+, Edge 17 - 18+
  7377. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7378. // two documents; shallow comparisons work.
  7379. // eslint-disable-next-line eqeqeq
  7380. outermostContext = context == document || context || outermost;
  7381. }
  7382. // Add elements passing elementMatchers directly to results
  7383. // Support: IE<9, Safari
  7384. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7385. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  7386. if ( byElement && elem ) {
  7387. j = 0;
  7388. // Support: IE 11+, Edge 17 - 18+
  7389. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  7390. // two documents; shallow comparisons work.
  7391. // eslint-disable-next-line eqeqeq
  7392. if ( !context && elem.ownerDocument != document ) {
  7393. setDocument( elem );
  7394. xml = !documentIsHTML;
  7395. }
  7396. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  7397. if ( matcher( elem, context || document, xml ) ) {
  7398. results.push( elem );
  7399. break;
  7400. }
  7401. }
  7402. if ( outermost ) {
  7403. dirruns = dirrunsUnique;
  7404. }
  7405. }
  7406. // Track unmatched elements for set filters
  7407. if ( bySet ) {
  7408. // They will have gone through all possible matchers
  7409. if ( ( elem = !matcher && elem ) ) {
  7410. matchedCount--;
  7411. }
  7412. // Lengthen the array for every element, matched or not
  7413. if ( seed ) {
  7414. unmatched.push( elem );
  7415. }
  7416. }
  7417. }
  7418. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7419. // makes the latter nonnegative.
  7420. matchedCount += i;
  7421. // Apply set filters to unmatched elements
  7422. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7423. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7424. // no element matchers and no seed.
  7425. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7426. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7427. // numerically zero.
  7428. if ( bySet && i !== matchedCount ) {
  7429. j = 0;
  7430. while ( ( matcher = setMatchers[ j++ ] ) ) {
  7431. matcher( unmatched, setMatched, context, xml );
  7432. }
  7433. if ( seed ) {
  7434. // Reintegrate element matches to eliminate the need for sorting
  7435. if ( matchedCount > 0 ) {
  7436. while ( i-- ) {
  7437. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  7438. setMatched[ i ] = pop.call( results );
  7439. }
  7440. }
  7441. }
  7442. // Discard index placeholder values to get only actual matches
  7443. setMatched = condense( setMatched );
  7444. }
  7445. // Add matches to results
  7446. push.apply( results, setMatched );
  7447. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7448. if ( outermost && !seed && setMatched.length > 0 &&
  7449. ( matchedCount + setMatchers.length ) > 1 ) {
  7450. Sizzle.uniqueSort( results );
  7451. }
  7452. }
  7453. // Override manipulation of globals by nested matchers
  7454. if ( outermost ) {
  7455. dirruns = dirrunsUnique;
  7456. outermostContext = contextBackup;
  7457. }
  7458. return unmatched;
  7459. };
  7460. return bySet ?
  7461. markFunction( superMatcher ) :
  7462. superMatcher;
  7463. }
  7464. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7465. var i,
  7466. setMatchers = [],
  7467. elementMatchers = [],
  7468. cached = compilerCache[ selector + " " ];
  7469. if ( !cached ) {
  7470. // Generate a function of recursive functions that can be used to check each element
  7471. if ( !match ) {
  7472. match = tokenize( selector );
  7473. }
  7474. i = match.length;
  7475. while ( i-- ) {
  7476. cached = matcherFromTokens( match[ i ] );
  7477. if ( cached[ expando ] ) {
  7478. setMatchers.push( cached );
  7479. } else {
  7480. elementMatchers.push( cached );
  7481. }
  7482. }
  7483. // Cache the compiled function
  7484. cached = compilerCache(
  7485. selector,
  7486. matcherFromGroupMatchers( elementMatchers, setMatchers )
  7487. );
  7488. // Save selector and tokenization
  7489. cached.selector = selector;
  7490. }
  7491. return cached;
  7492. };
  7493. /**
  7494. * A low-level selection function that works with Sizzle's compiled
  7495. * selector functions
  7496. * @param {String|Function} selector A selector or a pre-compiled
  7497. * selector function built with Sizzle.compile
  7498. * @param {Element} context
  7499. * @param {Array} [results]
  7500. * @param {Array} [seed] A set of elements to match against
  7501. */
  7502. select = Sizzle.select = function( selector, context, results, seed ) {
  7503. var i, tokens, token, type, find,
  7504. compiled = typeof selector === "function" && selector,
  7505. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  7506. results = results || [];
  7507. // Try to minimize operations if there is only one selector in the list and no seed
  7508. // (the latter of which guarantees us context)
  7509. if ( match.length === 1 ) {
  7510. // Reduce context if the leading compound selector is an ID
  7511. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  7512. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  7513. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  7514. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  7515. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  7516. if ( !context ) {
  7517. return results;
  7518. // Precompiled matchers will still verify ancestry, so step up a level
  7519. } else if ( compiled ) {
  7520. context = context.parentNode;
  7521. }
  7522. selector = selector.slice( tokens.shift().value.length );
  7523. }
  7524. // Fetch a seed set for right-to-left matching
  7525. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  7526. while ( i-- ) {
  7527. token = tokens[ i ];
  7528. // Abort if we hit a combinator
  7529. if ( Expr.relative[ ( type = token.type ) ] ) {
  7530. break;
  7531. }
  7532. if ( ( find = Expr.find[ type ] ) ) {
  7533. // Search, expanding context for leading sibling combinators
  7534. if ( ( seed = find(
  7535. token.matches[ 0 ].replace( runescape, funescape ),
  7536. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  7537. context
  7538. ) ) ) {
  7539. // If seed is empty or no tokens remain, we can return early
  7540. tokens.splice( i, 1 );
  7541. selector = seed.length && toSelector( tokens );
  7542. if ( !selector ) {
  7543. push.apply( results, seed );
  7544. return results;
  7545. }
  7546. break;
  7547. }
  7548. }
  7549. }
  7550. }
  7551. // Compile and execute a filtering function if one is not provided
  7552. // Provide `match` to avoid retokenization if we modified the selector above
  7553. ( compiled || compile( selector, match ) )(
  7554. seed,
  7555. context,
  7556. !documentIsHTML,
  7557. results,
  7558. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7559. );
  7560. return results;
  7561. };
  7562. // One-time assignments
  7563. // Sort stability
  7564. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  7565. // Support: Chrome 14-35+
  7566. // Always assume duplicates if they aren't passed to the comparison function
  7567. support.detectDuplicates = !!hasDuplicate;
  7568. // Initialize against the default document
  7569. setDocument();
  7570. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7571. // Detached nodes confoundingly follow *each other*
  7572. support.sortDetached = assert( function( el ) {
  7573. // Should return 1, but returns 4 (following)
  7574. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  7575. } );
  7576. // Support: IE<8
  7577. // Prevent attribute/property "interpolation"
  7578. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7579. if ( !assert( function( el ) {
  7580. el.innerHTML = "<a href='#'></a>";
  7581. return el.firstChild.getAttribute( "href" ) === "#";
  7582. } ) ) {
  7583. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7584. if ( !isXML ) {
  7585. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7586. }
  7587. } );
  7588. }
  7589. // Support: IE<9
  7590. // Use defaultValue in place of getAttribute("value")
  7591. if ( !support.attributes || !assert( function( el ) {
  7592. el.innerHTML = "<input/>";
  7593. el.firstChild.setAttribute( "value", "" );
  7594. return el.firstChild.getAttribute( "value" ) === "";
  7595. } ) ) {
  7596. addHandle( "value", function( elem, _name, isXML ) {
  7597. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7598. return elem.defaultValue;
  7599. }
  7600. } );
  7601. }
  7602. // Support: IE<9
  7603. // Use getAttributeNode to fetch booleans when getAttribute lies
  7604. if ( !assert( function( el ) {
  7605. return el.getAttribute( "disabled" ) == null;
  7606. } ) ) {
  7607. addHandle( booleans, function( elem, name, isXML ) {
  7608. var val;
  7609. if ( !isXML ) {
  7610. return elem[ name ] === true ? name.toLowerCase() :
  7611. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  7612. val.value :
  7613. null;
  7614. }
  7615. } );
  7616. }
  7617. return Sizzle;
  7618. } )( window );
  7619. jQuery.find = Sizzle;
  7620. jQuery.expr = Sizzle.selectors;
  7621. // Deprecated
  7622. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7623. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7624. jQuery.text = Sizzle.getText;
  7625. jQuery.isXMLDoc = Sizzle.isXML;
  7626. jQuery.contains = Sizzle.contains;
  7627. jQuery.escapeSelector = Sizzle.escape;
  7628. var dir = function( elem, dir, until ) {
  7629. var matched = [],
  7630. truncate = until !== undefined;
  7631. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7632. if ( elem.nodeType === 1 ) {
  7633. if ( truncate && jQuery( elem ).is( until ) ) {
  7634. break;
  7635. }
  7636. matched.push( elem );
  7637. }
  7638. }
  7639. return matched;
  7640. };
  7641. var siblings = function( n, elem ) {
  7642. var matched = [];
  7643. for ( ; n; n = n.nextSibling ) {
  7644. if ( n.nodeType === 1 && n !== elem ) {
  7645. matched.push( n );
  7646. }
  7647. }
  7648. return matched;
  7649. };
  7650. var rneedsContext = jQuery.expr.match.needsContext;
  7651. function nodeName( elem, name ) {
  7652. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7653. };
  7654. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7655. // Implement the identical functionality for filter and not
  7656. function winnow( elements, qualifier, not ) {
  7657. if ( isFunction( qualifier ) ) {
  7658. return jQuery.grep( elements, function( elem, i ) {
  7659. return !!qualifier.call( elem, i, elem ) !== not;
  7660. } );
  7661. }
  7662. // Single element
  7663. if ( qualifier.nodeType ) {
  7664. return jQuery.grep( elements, function( elem ) {
  7665. return ( elem === qualifier ) !== not;
  7666. } );
  7667. }
  7668. // Arraylike of elements (jQuery, arguments, Array)
  7669. if ( typeof qualifier !== "string" ) {
  7670. return jQuery.grep( elements, function( elem ) {
  7671. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7672. } );
  7673. }
  7674. // Filtered directly for both simple and complex selectors
  7675. return jQuery.filter( qualifier, elements, not );
  7676. }
  7677. jQuery.filter = function( expr, elems, not ) {
  7678. var elem = elems[ 0 ];
  7679. if ( not ) {
  7680. expr = ":not(" + expr + ")";
  7681. }
  7682. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7683. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7684. }
  7685. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7686. return elem.nodeType === 1;
  7687. } ) );
  7688. };
  7689. jQuery.fn.extend( {
  7690. find: function( selector ) {
  7691. var i, ret,
  7692. len = this.length,
  7693. self = this;
  7694. if ( typeof selector !== "string" ) {
  7695. return this.pushStack( jQuery( selector ).filter( function() {
  7696. for ( i = 0; i < len; i++ ) {
  7697. if ( jQuery.contains( self[ i ], this ) ) {
  7698. return true;
  7699. }
  7700. }
  7701. } ) );
  7702. }
  7703. ret = this.pushStack( [] );
  7704. for ( i = 0; i < len; i++ ) {
  7705. jQuery.find( selector, self[ i ], ret );
  7706. }
  7707. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7708. },
  7709. filter: function( selector ) {
  7710. return this.pushStack( winnow( this, selector || [], false ) );
  7711. },
  7712. not: function( selector ) {
  7713. return this.pushStack( winnow( this, selector || [], true ) );
  7714. },
  7715. is: function( selector ) {
  7716. return !!winnow(
  7717. this,
  7718. // If this is a positional/relative selector, check membership in the returned set
  7719. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7720. typeof selector === "string" && rneedsContext.test( selector ) ?
  7721. jQuery( selector ) :
  7722. selector || [],
  7723. false
  7724. ).length;
  7725. }
  7726. } );
  7727. // Initialize a jQuery object
  7728. // A central reference to the root jQuery(document)
  7729. var rootjQuery,
  7730. // A simple way to check for HTML strings
  7731. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7732. // Strict HTML recognition (#11290: must start with <)
  7733. // Shortcut simple #id case for speed
  7734. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7735. init = jQuery.fn.init = function( selector, context, root ) {
  7736. var match, elem;
  7737. // HANDLE: $(""), $(null), $(undefined), $(false)
  7738. if ( !selector ) {
  7739. return this;
  7740. }
  7741. // Method init() accepts an alternate rootjQuery
  7742. // so migrate can support jQuery.sub (gh-2101)
  7743. root = root || rootjQuery;
  7744. // Handle HTML strings
  7745. if ( typeof selector === "string" ) {
  7746. if ( selector[ 0 ] === "<" &&
  7747. selector[ selector.length - 1 ] === ">" &&
  7748. selector.length >= 3 ) {
  7749. // Assume that strings that start and end with <> are HTML and skip the regex check
  7750. match = [ null, selector, null ];
  7751. } else {
  7752. match = rquickExpr.exec( selector );
  7753. }
  7754. // Match html or make sure no context is specified for #id
  7755. if ( match && ( match[ 1 ] || !context ) ) {
  7756. // HANDLE: $(html) -> $(array)
  7757. if ( match[ 1 ] ) {
  7758. context = context instanceof jQuery ? context[ 0 ] : context;
  7759. // Option to run scripts is true for back-compat
  7760. // Intentionally let the error be thrown if parseHTML is not present
  7761. jQuery.merge( this, jQuery.parseHTML(
  7762. match[ 1 ],
  7763. context && context.nodeType ? context.ownerDocument || context : document,
  7764. true
  7765. ) );
  7766. // HANDLE: $(html, props)
  7767. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7768. for ( match in context ) {
  7769. // Properties of context are called as methods if possible
  7770. if ( isFunction( this[ match ] ) ) {
  7771. this[ match ]( context[ match ] );
  7772. // ...and otherwise set as attributes
  7773. } else {
  7774. this.attr( match, context[ match ] );
  7775. }
  7776. }
  7777. }
  7778. return this;
  7779. // HANDLE: $(#id)
  7780. } else {
  7781. elem = document.getElementById( match[ 2 ] );
  7782. if ( elem ) {
  7783. // Inject the element directly into the jQuery object
  7784. this[ 0 ] = elem;
  7785. this.length = 1;
  7786. }
  7787. return this;
  7788. }
  7789. // HANDLE: $(expr, $(...))
  7790. } else if ( !context || context.jquery ) {
  7791. return ( context || root ).find( selector );
  7792. // HANDLE: $(expr, context)
  7793. // (which is just equivalent to: $(context).find(expr)
  7794. } else {
  7795. return this.constructor( context ).find( selector );
  7796. }
  7797. // HANDLE: $(DOMElement)
  7798. } else if ( selector.nodeType ) {
  7799. this[ 0 ] = selector;
  7800. this.length = 1;
  7801. return this;
  7802. // HANDLE: $(function)
  7803. // Shortcut for document ready
  7804. } else if ( isFunction( selector ) ) {
  7805. return root.ready !== undefined ?
  7806. root.ready( selector ) :
  7807. // Execute immediately if ready is not present
  7808. selector( jQuery );
  7809. }
  7810. return jQuery.makeArray( selector, this );
  7811. };
  7812. // Give the init function the jQuery prototype for later instantiation
  7813. init.prototype = jQuery.fn;
  7814. // Initialize central reference
  7815. rootjQuery = jQuery( document );
  7816. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7817. // Methods guaranteed to produce a unique set when starting from a unique set
  7818. guaranteedUnique = {
  7819. children: true,
  7820. contents: true,
  7821. next: true,
  7822. prev: true
  7823. };
  7824. jQuery.fn.extend( {
  7825. has: function( target ) {
  7826. var targets = jQuery( target, this ),
  7827. l = targets.length;
  7828. return this.filter( function() {
  7829. var i = 0;
  7830. for ( ; i < l; i++ ) {
  7831. if ( jQuery.contains( this, targets[ i ] ) ) {
  7832. return true;
  7833. }
  7834. }
  7835. } );
  7836. },
  7837. closest: function( selectors, context ) {
  7838. var cur,
  7839. i = 0,
  7840. l = this.length,
  7841. matched = [],
  7842. targets = typeof selectors !== "string" && jQuery( selectors );
  7843. // Positional selectors never match, since there's no _selection_ context
  7844. if ( !rneedsContext.test( selectors ) ) {
  7845. for ( ; i < l; i++ ) {
  7846. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7847. // Always skip document fragments
  7848. if ( cur.nodeType < 11 && ( targets ?
  7849. targets.index( cur ) > -1 :
  7850. // Don't pass non-elements to Sizzle
  7851. cur.nodeType === 1 &&
  7852. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7853. matched.push( cur );
  7854. break;
  7855. }
  7856. }
  7857. }
  7858. }
  7859. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7860. },
  7861. // Determine the position of an element within the set
  7862. index: function( elem ) {
  7863. // No argument, return index in parent
  7864. if ( !elem ) {
  7865. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7866. }
  7867. // Index in selector
  7868. if ( typeof elem === "string" ) {
  7869. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7870. }
  7871. // Locate the position of the desired element
  7872. return indexOf.call( this,
  7873. // If it receives a jQuery object, the first element is used
  7874. elem.jquery ? elem[ 0 ] : elem
  7875. );
  7876. },
  7877. add: function( selector, context ) {
  7878. return this.pushStack(
  7879. jQuery.uniqueSort(
  7880. jQuery.merge( this.get(), jQuery( selector, context ) )
  7881. )
  7882. );
  7883. },
  7884. addBack: function( selector ) {
  7885. return this.add( selector == null ?
  7886. this.prevObject : this.prevObject.filter( selector )
  7887. );
  7888. }
  7889. } );
  7890. function sibling( cur, dir ) {
  7891. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7892. return cur;
  7893. }
  7894. jQuery.each( {
  7895. parent: function( elem ) {
  7896. var parent = elem.parentNode;
  7897. return parent && parent.nodeType !== 11 ? parent : null;
  7898. },
  7899. parents: function( elem ) {
  7900. return dir( elem, "parentNode" );
  7901. },
  7902. parentsUntil: function( elem, _i, until ) {
  7903. return dir( elem, "parentNode", until );
  7904. },
  7905. next: function( elem ) {
  7906. return sibling( elem, "nextSibling" );
  7907. },
  7908. prev: function( elem ) {
  7909. return sibling( elem, "previousSibling" );
  7910. },
  7911. nextAll: function( elem ) {
  7912. return dir( elem, "nextSibling" );
  7913. },
  7914. prevAll: function( elem ) {
  7915. return dir( elem, "previousSibling" );
  7916. },
  7917. nextUntil: function( elem, _i, until ) {
  7918. return dir( elem, "nextSibling", until );
  7919. },
  7920. prevUntil: function( elem, _i, until ) {
  7921. return dir( elem, "previousSibling", until );
  7922. },
  7923. siblings: function( elem ) {
  7924. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7925. },
  7926. children: function( elem ) {
  7927. return siblings( elem.firstChild );
  7928. },
  7929. contents: function( elem ) {
  7930. if ( elem.contentDocument != null &&
  7931. // Support: IE 11+
  7932. // <object> elements with no `data` attribute has an object
  7933. // `contentDocument` with a `null` prototype.
  7934. getProto( elem.contentDocument ) ) {
  7935. return elem.contentDocument;
  7936. }
  7937. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7938. // Treat the template element as a regular one in browsers that
  7939. // don't support it.
  7940. if ( nodeName( elem, "template" ) ) {
  7941. elem = elem.content || elem;
  7942. }
  7943. return jQuery.merge( [], elem.childNodes );
  7944. }
  7945. }, function( name, fn ) {
  7946. jQuery.fn[ name ] = function( until, selector ) {
  7947. var matched = jQuery.map( this, fn, until );
  7948. if ( name.slice( -5 ) !== "Until" ) {
  7949. selector = until;
  7950. }
  7951. if ( selector && typeof selector === "string" ) {
  7952. matched = jQuery.filter( selector, matched );
  7953. }
  7954. if ( this.length > 1 ) {
  7955. // Remove duplicates
  7956. if ( !guaranteedUnique[ name ] ) {
  7957. jQuery.uniqueSort( matched );
  7958. }
  7959. // Reverse order for parents* and prev-derivatives
  7960. if ( rparentsprev.test( name ) ) {
  7961. matched.reverse();
  7962. }
  7963. }
  7964. return this.pushStack( matched );
  7965. };
  7966. } );
  7967. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7968. // Convert String-formatted options into Object-formatted ones
  7969. function createOptions( options ) {
  7970. var object = {};
  7971. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7972. object[ flag ] = true;
  7973. } );
  7974. return object;
  7975. }
  7976. /*
  7977. * Create a callback list using the following parameters:
  7978. *
  7979. * options: an optional list of space-separated options that will change how
  7980. * the callback list behaves or a more traditional option object
  7981. *
  7982. * By default a callback list will act like an event callback list and can be
  7983. * "fired" multiple times.
  7984. *
  7985. * Possible options:
  7986. *
  7987. * once: will ensure the callback list can only be fired once (like a Deferred)
  7988. *
  7989. * memory: will keep track of previous values and will call any callback added
  7990. * after the list has been fired right away with the latest "memorized"
  7991. * values (like a Deferred)
  7992. *
  7993. * unique: will ensure a callback can only be added once (no duplicate in the list)
  7994. *
  7995. * stopOnFalse: interrupt callings when a callback returns false
  7996. *
  7997. */
  7998. jQuery.Callbacks = function( options ) {
  7999. // Convert options from String-formatted to Object-formatted if needed
  8000. // (we check in cache first)
  8001. options = typeof options === "string" ?
  8002. createOptions( options ) :
  8003. jQuery.extend( {}, options );
  8004. var // Flag to know if list is currently firing
  8005. firing,
  8006. // Last fire value for non-forgettable lists
  8007. memory,
  8008. // Flag to know if list was already fired
  8009. fired,
  8010. // Flag to prevent firing
  8011. locked,
  8012. // Actual callback list
  8013. list = [],
  8014. // Queue of execution data for repeatable lists
  8015. queue = [],
  8016. // Index of currently firing callback (modified by add/remove as needed)
  8017. firingIndex = -1,
  8018. // Fire callbacks
  8019. fire = function() {
  8020. // Enforce single-firing
  8021. locked = locked || options.once;
  8022. // Execute callbacks for all pending executions,
  8023. // respecting firingIndex overrides and runtime changes
  8024. fired = firing = true;
  8025. for ( ; queue.length; firingIndex = -1 ) {
  8026. memory = queue.shift();
  8027. while ( ++firingIndex < list.length ) {
  8028. // Run callback and check for early termination
  8029. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  8030. options.stopOnFalse ) {
  8031. // Jump to end and forget the data so .add doesn't re-fire
  8032. firingIndex = list.length;
  8033. memory = false;
  8034. }
  8035. }
  8036. }
  8037. // Forget the data if we're done with it
  8038. if ( !options.memory ) {
  8039. memory = false;
  8040. }
  8041. firing = false;
  8042. // Clean up if we're done firing for good
  8043. if ( locked ) {
  8044. // Keep an empty list if we have data for future add calls
  8045. if ( memory ) {
  8046. list = [];
  8047. // Otherwise, this object is spent
  8048. } else {
  8049. list = "";
  8050. }
  8051. }
  8052. },
  8053. // Actual Callbacks object
  8054. self = {
  8055. // Add a callback or a collection of callbacks to the list
  8056. add: function() {
  8057. if ( list ) {
  8058. // If we have memory from a past run, we should fire after adding
  8059. if ( memory && !firing ) {
  8060. firingIndex = list.length - 1;
  8061. queue.push( memory );
  8062. }
  8063. ( function add( args ) {
  8064. jQuery.each( args, function( _, arg ) {
  8065. if ( isFunction( arg ) ) {
  8066. if ( !options.unique || !self.has( arg ) ) {
  8067. list.push( arg );
  8068. }
  8069. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  8070. // Inspect recursively
  8071. add( arg );
  8072. }
  8073. } );
  8074. } )( arguments );
  8075. if ( memory && !firing ) {
  8076. fire();
  8077. }
  8078. }
  8079. return this;
  8080. },
  8081. // Remove a callback from the list
  8082. remove: function() {
  8083. jQuery.each( arguments, function( _, arg ) {
  8084. var index;
  8085. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  8086. list.splice( index, 1 );
  8087. // Handle firing indexes
  8088. if ( index <= firingIndex ) {
  8089. firingIndex--;
  8090. }
  8091. }
  8092. } );
  8093. return this;
  8094. },
  8095. // Check if a given callback is in the list.
  8096. // If no argument is given, return whether or not list has callbacks attached.
  8097. has: function( fn ) {
  8098. return fn ?
  8099. jQuery.inArray( fn, list ) > -1 :
  8100. list.length > 0;
  8101. },
  8102. // Remove all callbacks from the list
  8103. empty: function() {
  8104. if ( list ) {
  8105. list = [];
  8106. }
  8107. return this;
  8108. },
  8109. // Disable .fire and .add
  8110. // Abort any current/pending executions
  8111. // Clear all callbacks and values
  8112. disable: function() {
  8113. locked = queue = [];
  8114. list = memory = "";
  8115. return this;
  8116. },
  8117. disabled: function() {
  8118. return !list;
  8119. },
  8120. // Disable .fire
  8121. // Also disable .add unless we have memory (since it would have no effect)
  8122. // Abort any pending executions
  8123. lock: function() {
  8124. locked = queue = [];
  8125. if ( !memory && !firing ) {
  8126. list = memory = "";
  8127. }
  8128. return this;
  8129. },
  8130. locked: function() {
  8131. return !!locked;
  8132. },
  8133. // Call all callbacks with the given context and arguments
  8134. fireWith: function( context, args ) {
  8135. if ( !locked ) {
  8136. args = args || [];
  8137. args = [ context, args.slice ? args.slice() : args ];
  8138. queue.push( args );
  8139. if ( !firing ) {
  8140. fire();
  8141. }
  8142. }
  8143. return this;
  8144. },
  8145. // Call all the callbacks with the given arguments
  8146. fire: function() {
  8147. self.fireWith( this, arguments );
  8148. return this;
  8149. },
  8150. // To know if the callbacks have already been called at least once
  8151. fired: function() {
  8152. return !!fired;
  8153. }
  8154. };
  8155. return self;
  8156. };
  8157. function Identity( v ) {
  8158. return v;
  8159. }
  8160. function Thrower( ex ) {
  8161. throw ex;
  8162. }
  8163. function adoptValue( value, resolve, reject, noValue ) {
  8164. var method;
  8165. try {
  8166. // Check for promise aspect first to privilege synchronous behavior
  8167. if ( value && isFunction( ( method = value.promise ) ) ) {
  8168. method.call( value ).done( resolve ).fail( reject );
  8169. // Other thenables
  8170. } else if ( value && isFunction( ( method = value.then ) ) ) {
  8171. method.call( value, resolve, reject );
  8172. // Other non-thenables
  8173. } else {
  8174. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  8175. // * false: [ value ].slice( 0 ) => resolve( value )
  8176. // * true: [ value ].slice( 1 ) => resolve()
  8177. resolve.apply( undefined, [ value ].slice( noValue ) );
  8178. }
  8179. // For Promises/A+, convert exceptions into rejections
  8180. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  8181. // Deferred#then to conditionally suppress rejection.
  8182. } catch ( value ) {
  8183. // Support: Android 4.0 only
  8184. // Strict mode functions invoked without .call/.apply get global-object context
  8185. reject.apply( undefined, [ value ] );
  8186. }
  8187. }
  8188. jQuery.extend( {
  8189. Deferred: function( func ) {
  8190. var tuples = [
  8191. // action, add listener, callbacks,
  8192. // ... .then handlers, argument index, [final state]
  8193. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  8194. jQuery.Callbacks( "memory" ), 2 ],
  8195. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  8196. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  8197. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  8198. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  8199. ],
  8200. state = "pending",
  8201. promise = {
  8202. state: function() {
  8203. return state;
  8204. },
  8205. always: function() {
  8206. deferred.done( arguments ).fail( arguments );
  8207. return this;
  8208. },
  8209. "catch": function( fn ) {
  8210. return promise.then( null, fn );
  8211. },
  8212. // Keep pipe for back-compat
  8213. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  8214. var fns = arguments;
  8215. return jQuery.Deferred( function( newDefer ) {
  8216. jQuery.each( tuples, function( _i, tuple ) {
  8217. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  8218. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  8219. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  8220. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  8221. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  8222. deferred[ tuple[ 1 ] ]( function() {
  8223. var returned = fn && fn.apply( this, arguments );
  8224. if ( returned && isFunction( returned.promise ) ) {
  8225. returned.promise()
  8226. .progress( newDefer.notify )
  8227. .done( newDefer.resolve )
  8228. .fail( newDefer.reject );
  8229. } else {
  8230. newDefer[ tuple[ 0 ] + "With" ](
  8231. this,
  8232. fn ? [ returned ] : arguments
  8233. );
  8234. }
  8235. } );
  8236. } );
  8237. fns = null;
  8238. } ).promise();
  8239. },
  8240. then: function( onFulfilled, onRejected, onProgress ) {
  8241. var maxDepth = 0;
  8242. function resolve( depth, deferred, handler, special ) {
  8243. return function() {
  8244. var that = this,
  8245. args = arguments,
  8246. mightThrow = function() {
  8247. var returned, then;
  8248. // Support: Promises/A+ section 2.3.3.3.3
  8249. // https://promisesaplus.com/#point-59
  8250. // Ignore double-resolution attempts
  8251. if ( depth < maxDepth ) {
  8252. return;
  8253. }
  8254. returned = handler.apply( that, args );
  8255. // Support: Promises/A+ section 2.3.1
  8256. // https://promisesaplus.com/#point-48
  8257. if ( returned === deferred.promise() ) {
  8258. throw new TypeError( "Thenable self-resolution" );
  8259. }
  8260. // Support: Promises/A+ sections 2.3.3.1, 3.5
  8261. // https://promisesaplus.com/#point-54
  8262. // https://promisesaplus.com/#point-75
  8263. // Retrieve `then` only once
  8264. then = returned &&
  8265. // Support: Promises/A+ section 2.3.4
  8266. // https://promisesaplus.com/#point-64
  8267. // Only check objects and functions for thenability
  8268. ( typeof returned === "object" ||
  8269. typeof returned === "function" ) &&
  8270. returned.then;
  8271. // Handle a returned thenable
  8272. if ( isFunction( then ) ) {
  8273. // Special processors (notify) just wait for resolution
  8274. if ( special ) {
  8275. then.call(
  8276. returned,
  8277. resolve( maxDepth, deferred, Identity, special ),
  8278. resolve( maxDepth, deferred, Thrower, special )
  8279. );
  8280. // Normal processors (resolve) also hook into progress
  8281. } else {
  8282. // ...and disregard older resolution values
  8283. maxDepth++;
  8284. then.call(
  8285. returned,
  8286. resolve( maxDepth, deferred, Identity, special ),
  8287. resolve( maxDepth, deferred, Thrower, special ),
  8288. resolve( maxDepth, deferred, Identity,
  8289. deferred.notifyWith )
  8290. );
  8291. }
  8292. // Handle all other returned values
  8293. } else {
  8294. // Only substitute handlers pass on context
  8295. // and multiple values (non-spec behavior)
  8296. if ( handler !== Identity ) {
  8297. that = undefined;
  8298. args = [ returned ];
  8299. }
  8300. // Process the value(s)
  8301. // Default process is resolve
  8302. ( special || deferred.resolveWith )( that, args );
  8303. }
  8304. },
  8305. // Only normal processors (resolve) catch and reject exceptions
  8306. process = special ?
  8307. mightThrow :
  8308. function() {
  8309. try {
  8310. mightThrow();
  8311. } catch ( e ) {
  8312. if ( jQuery.Deferred.exceptionHook ) {
  8313. jQuery.Deferred.exceptionHook( e,
  8314. process.stackTrace );
  8315. }
  8316. // Support: Promises/A+ section 2.3.3.3.4.1
  8317. // https://promisesaplus.com/#point-61
  8318. // Ignore post-resolution exceptions
  8319. if ( depth + 1 >= maxDepth ) {
  8320. // Only substitute handlers pass on context
  8321. // and multiple values (non-spec behavior)
  8322. if ( handler !== Thrower ) {
  8323. that = undefined;
  8324. args = [ e ];
  8325. }
  8326. deferred.rejectWith( that, args );
  8327. }
  8328. }
  8329. };
  8330. // Support: Promises/A+ section 2.3.3.3.1
  8331. // https://promisesaplus.com/#point-57
  8332. // Re-resolve promises immediately to dodge false rejection from
  8333. // subsequent errors
  8334. if ( depth ) {
  8335. process();
  8336. } else {
  8337. // Call an optional hook to record the stack, in case of exception
  8338. // since it's otherwise lost when execution goes async
  8339. if ( jQuery.Deferred.getStackHook ) {
  8340. process.stackTrace = jQuery.Deferred.getStackHook();
  8341. }
  8342. window.setTimeout( process );
  8343. }
  8344. };
  8345. }
  8346. return jQuery.Deferred( function( newDefer ) {
  8347. // progress_handlers.add( ... )
  8348. tuples[ 0 ][ 3 ].add(
  8349. resolve(
  8350. 0,
  8351. newDefer,
  8352. isFunction( onProgress ) ?
  8353. onProgress :
  8354. Identity,
  8355. newDefer.notifyWith
  8356. )
  8357. );
  8358. // fulfilled_handlers.add( ... )
  8359. tuples[ 1 ][ 3 ].add(
  8360. resolve(
  8361. 0,
  8362. newDefer,
  8363. isFunction( onFulfilled ) ?
  8364. onFulfilled :
  8365. Identity
  8366. )
  8367. );
  8368. // rejected_handlers.add( ... )
  8369. tuples[ 2 ][ 3 ].add(
  8370. resolve(
  8371. 0,
  8372. newDefer,
  8373. isFunction( onRejected ) ?
  8374. onRejected :
  8375. Thrower
  8376. )
  8377. );
  8378. } ).promise();
  8379. },
  8380. // Get a promise for this deferred
  8381. // If obj is provided, the promise aspect is added to the object
  8382. promise: function( obj ) {
  8383. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8384. }
  8385. },
  8386. deferred = {};
  8387. // Add list-specific methods
  8388. jQuery.each( tuples, function( i, tuple ) {
  8389. var list = tuple[ 2 ],
  8390. stateString = tuple[ 5 ];
  8391. // promise.progress = list.add
  8392. // promise.done = list.add
  8393. // promise.fail = list.add
  8394. promise[ tuple[ 1 ] ] = list.add;
  8395. // Handle state
  8396. if ( stateString ) {
  8397. list.add(
  8398. function() {
  8399. // state = "resolved" (i.e., fulfilled)
  8400. // state = "rejected"
  8401. state = stateString;
  8402. },
  8403. // rejected_callbacks.disable
  8404. // fulfilled_callbacks.disable
  8405. tuples[ 3 - i ][ 2 ].disable,
  8406. // rejected_handlers.disable
  8407. // fulfilled_handlers.disable
  8408. tuples[ 3 - i ][ 3 ].disable,
  8409. // progress_callbacks.lock
  8410. tuples[ 0 ][ 2 ].lock,
  8411. // progress_handlers.lock
  8412. tuples[ 0 ][ 3 ].lock
  8413. );
  8414. }
  8415. // progress_handlers.fire
  8416. // fulfilled_handlers.fire
  8417. // rejected_handlers.fire
  8418. list.add( tuple[ 3 ].fire );
  8419. // deferred.notify = function() { deferred.notifyWith(...) }
  8420. // deferred.resolve = function() { deferred.resolveWith(...) }
  8421. // deferred.reject = function() { deferred.rejectWith(...) }
  8422. deferred[ tuple[ 0 ] ] = function() {
  8423. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8424. return this;
  8425. };
  8426. // deferred.notifyWith = list.fireWith
  8427. // deferred.resolveWith = list.fireWith
  8428. // deferred.rejectWith = list.fireWith
  8429. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8430. } );
  8431. // Make the deferred a promise
  8432. promise.promise( deferred );
  8433. // Call given func if any
  8434. if ( func ) {
  8435. func.call( deferred, deferred );
  8436. }
  8437. // All done!
  8438. return deferred;
  8439. },
  8440. // Deferred helper
  8441. when: function( singleValue ) {
  8442. var
  8443. // count of uncompleted subordinates
  8444. remaining = arguments.length,
  8445. // count of unprocessed arguments
  8446. i = remaining,
  8447. // subordinate fulfillment data
  8448. resolveContexts = Array( i ),
  8449. resolveValues = slice.call( arguments ),
  8450. // the master Deferred
  8451. master = jQuery.Deferred(),
  8452. // subordinate callback factory
  8453. updateFunc = function( i ) {
  8454. return function( value ) {
  8455. resolveContexts[ i ] = this;
  8456. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8457. if ( !( --remaining ) ) {
  8458. master.resolveWith( resolveContexts, resolveValues );
  8459. }
  8460. };
  8461. };
  8462. // Single- and empty arguments are adopted like Promise.resolve
  8463. if ( remaining <= 1 ) {
  8464. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8465. !remaining );
  8466. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8467. if ( master.state() === "pending" ||
  8468. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8469. return master.then();
  8470. }
  8471. }
  8472. // Multiple arguments are aggregated like Promise.all array elements
  8473. while ( i-- ) {
  8474. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8475. }
  8476. return master.promise();
  8477. }
  8478. } );
  8479. // These usually indicate a programmer mistake during development,
  8480. // warn about them ASAP rather than swallowing them by default.
  8481. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8482. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8483. // Support: IE 8 - 9 only
  8484. // Console exists when dev tools are open, which can happen at any time
  8485. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8486. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8487. }
  8488. };
  8489. jQuery.readyException = function( error ) {
  8490. window.setTimeout( function() {
  8491. throw error;
  8492. } );
  8493. };
  8494. // The deferred used on DOM ready
  8495. var readyList = jQuery.Deferred();
  8496. jQuery.fn.ready = function( fn ) {
  8497. readyList
  8498. .then( fn )
  8499. // Wrap jQuery.readyException in a function so that the lookup
  8500. // happens at the time of error handling instead of callback
  8501. // registration.
  8502. .catch( function( error ) {
  8503. jQuery.readyException( error );
  8504. } );
  8505. return this;
  8506. };
  8507. jQuery.extend( {
  8508. // Is the DOM ready to be used? Set to true once it occurs.
  8509. isReady: false,
  8510. // A counter to track how many items to wait for before
  8511. // the ready event fires. See #6781
  8512. readyWait: 1,
  8513. // Handle when the DOM is ready
  8514. ready: function( wait ) {
  8515. // Abort if there are pending holds or we're already ready
  8516. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8517. return;
  8518. }
  8519. // Remember that the DOM is ready
  8520. jQuery.isReady = true;
  8521. // If a normal DOM Ready event fired, decrement, and wait if need be
  8522. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8523. return;
  8524. }
  8525. // If there are functions bound, to execute
  8526. readyList.resolveWith( document, [ jQuery ] );
  8527. }
  8528. } );
  8529. jQuery.ready.then = readyList.then;
  8530. // The ready event handler and self cleanup method
  8531. function completed() {
  8532. document.removeEventListener( "DOMContentLoaded", completed );
  8533. window.removeEventListener( "load", completed );
  8534. jQuery.ready();
  8535. }
  8536. // Catch cases where $(document).ready() is called
  8537. // after the browser event has already occurred.
  8538. // Support: IE <=9 - 10 only
  8539. // Older IE sometimes signals "interactive" too soon
  8540. if ( document.readyState === "complete" ||
  8541. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8542. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8543. window.setTimeout( jQuery.ready );
  8544. } else {
  8545. // Use the handy event callback
  8546. document.addEventListener( "DOMContentLoaded", completed );
  8547. // A fallback to window.onload, that will always work
  8548. window.addEventListener( "load", completed );
  8549. }
  8550. // Multifunctional method to get and set values of a collection
  8551. // The value/s can optionally be executed if it's a function
  8552. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8553. var i = 0,
  8554. len = elems.length,
  8555. bulk = key == null;
  8556. // Sets many values
  8557. if ( toType( key ) === "object" ) {
  8558. chainable = true;
  8559. for ( i in key ) {
  8560. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8561. }
  8562. // Sets one value
  8563. } else if ( value !== undefined ) {
  8564. chainable = true;
  8565. if ( !isFunction( value ) ) {
  8566. raw = true;
  8567. }
  8568. if ( bulk ) {
  8569. // Bulk operations run against the entire set
  8570. if ( raw ) {
  8571. fn.call( elems, value );
  8572. fn = null;
  8573. // ...except when executing function values
  8574. } else {
  8575. bulk = fn;
  8576. fn = function( elem, _key, value ) {
  8577. return bulk.call( jQuery( elem ), value );
  8578. };
  8579. }
  8580. }
  8581. if ( fn ) {
  8582. for ( ; i < len; i++ ) {
  8583. fn(
  8584. elems[ i ], key, raw ?
  8585. value :
  8586. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8587. );
  8588. }
  8589. }
  8590. }
  8591. if ( chainable ) {
  8592. return elems;
  8593. }
  8594. // Gets
  8595. if ( bulk ) {
  8596. return fn.call( elems );
  8597. }
  8598. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8599. };
  8600. // Matches dashed string for camelizing
  8601. var rmsPrefix = /^-ms-/,
  8602. rdashAlpha = /-([a-z])/g;
  8603. // Used by camelCase as callback to replace()
  8604. function fcamelCase( _all, letter ) {
  8605. return letter.toUpperCase();
  8606. }
  8607. // Convert dashed to camelCase; used by the css and data modules
  8608. // Support: IE <=9 - 11, Edge 12 - 15
  8609. // Microsoft forgot to hump their vendor prefix (#9572)
  8610. function camelCase( string ) {
  8611. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8612. }
  8613. var acceptData = function( owner ) {
  8614. // Accepts only:
  8615. // - Node
  8616. // - Node.ELEMENT_NODE
  8617. // - Node.DOCUMENT_NODE
  8618. // - Object
  8619. // - Any
  8620. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8621. };
  8622. function Data() {
  8623. this.expando = jQuery.expando + Data.uid++;
  8624. }
  8625. Data.uid = 1;
  8626. Data.prototype = {
  8627. cache: function( owner ) {
  8628. // Check if the owner object already has a cache
  8629. var value = owner[ this.expando ];
  8630. // If not, create one
  8631. if ( !value ) {
  8632. value = {};
  8633. // We can accept data for non-element nodes in modern browsers,
  8634. // but we should not, see #8335.
  8635. // Always return an empty object.
  8636. if ( acceptData( owner ) ) {
  8637. // If it is a node unlikely to be stringify-ed or looped over
  8638. // use plain assignment
  8639. if ( owner.nodeType ) {
  8640. owner[ this.expando ] = value;
  8641. // Otherwise secure it in a non-enumerable property
  8642. // configurable must be true to allow the property to be
  8643. // deleted when data is removed
  8644. } else {
  8645. Object.defineProperty( owner, this.expando, {
  8646. value: value,
  8647. configurable: true
  8648. } );
  8649. }
  8650. }
  8651. }
  8652. return value;
  8653. },
  8654. set: function( owner, data, value ) {
  8655. var prop,
  8656. cache = this.cache( owner );
  8657. // Handle: [ owner, key, value ] args
  8658. // Always use camelCase key (gh-2257)
  8659. if ( typeof data === "string" ) {
  8660. cache[ camelCase( data ) ] = value;
  8661. // Handle: [ owner, { properties } ] args
  8662. } else {
  8663. // Copy the properties one-by-one to the cache object
  8664. for ( prop in data ) {
  8665. cache[ camelCase( prop ) ] = data[ prop ];
  8666. }
  8667. }
  8668. return cache;
  8669. },
  8670. get: function( owner, key ) {
  8671. return key === undefined ?
  8672. this.cache( owner ) :
  8673. // Always use camelCase key (gh-2257)
  8674. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8675. },
  8676. access: function( owner, key, value ) {
  8677. // In cases where either:
  8678. //
  8679. // 1. No key was specified
  8680. // 2. A string key was specified, but no value provided
  8681. //
  8682. // Take the "read" path and allow the get method to determine
  8683. // which value to return, respectively either:
  8684. //
  8685. // 1. The entire cache object
  8686. // 2. The data stored at the key
  8687. //
  8688. if ( key === undefined ||
  8689. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8690. return this.get( owner, key );
  8691. }
  8692. // When the key is not a string, or both a key and value
  8693. // are specified, set or extend (existing objects) with either:
  8694. //
  8695. // 1. An object of properties
  8696. // 2. A key and value
  8697. //
  8698. this.set( owner, key, value );
  8699. // Since the "set" path can have two possible entry points
  8700. // return the expected data based on which path was taken[*]
  8701. return value !== undefined ? value : key;
  8702. },
  8703. remove: function( owner, key ) {
  8704. var i,
  8705. cache = owner[ this.expando ];
  8706. if ( cache === undefined ) {
  8707. return;
  8708. }
  8709. if ( key !== undefined ) {
  8710. // Support array or space separated string of keys
  8711. if ( Array.isArray( key ) ) {
  8712. // If key is an array of keys...
  8713. // We always set camelCase keys, so remove that.
  8714. key = key.map( camelCase );
  8715. } else {
  8716. key = camelCase( key );
  8717. // If a key with the spaces exists, use it.
  8718. // Otherwise, create an array by matching non-whitespace
  8719. key = key in cache ?
  8720. [ key ] :
  8721. ( key.match( rnothtmlwhite ) || [] );
  8722. }
  8723. i = key.length;
  8724. while ( i-- ) {
  8725. delete cache[ key[ i ] ];
  8726. }
  8727. }
  8728. // Remove the expando if there's no more data
  8729. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8730. // Support: Chrome <=35 - 45
  8731. // Webkit & Blink performance suffers when deleting properties
  8732. // from DOM nodes, so set to undefined instead
  8733. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8734. if ( owner.nodeType ) {
  8735. owner[ this.expando ] = undefined;
  8736. } else {
  8737. delete owner[ this.expando ];
  8738. }
  8739. }
  8740. },
  8741. hasData: function( owner ) {
  8742. var cache = owner[ this.expando ];
  8743. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8744. }
  8745. };
  8746. var dataPriv = new Data();
  8747. var dataUser = new Data();
  8748. // Implementation Summary
  8749. //
  8750. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8751. // 2. Improve the module's maintainability by reducing the storage
  8752. // paths to a single mechanism.
  8753. // 3. Use the same single mechanism to support "private" and "user" data.
  8754. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8755. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8756. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8757. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8758. rmultiDash = /[A-Z]/g;
  8759. function getData( data ) {
  8760. if ( data === "true" ) {
  8761. return true;
  8762. }
  8763. if ( data === "false" ) {
  8764. return false;
  8765. }
  8766. if ( data === "null" ) {
  8767. return null;
  8768. }
  8769. // Only convert to a number if it doesn't change the string
  8770. if ( data === +data + "" ) {
  8771. return +data;
  8772. }
  8773. if ( rbrace.test( data ) ) {
  8774. return JSON.parse( data );
  8775. }
  8776. return data;
  8777. }
  8778. function dataAttr( elem, key, data ) {
  8779. var name;
  8780. // If nothing was found internally, try to fetch any
  8781. // data from the HTML5 data-* attribute
  8782. if ( data === undefined && elem.nodeType === 1 ) {
  8783. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8784. data = elem.getAttribute( name );
  8785. if ( typeof data === "string" ) {
  8786. try {
  8787. data = getData( data );
  8788. } catch ( e ) {}
  8789. // Make sure we set the data so it isn't changed later
  8790. dataUser.set( elem, key, data );
  8791. } else {
  8792. data = undefined;
  8793. }
  8794. }
  8795. return data;
  8796. }
  8797. jQuery.extend( {
  8798. hasData: function( elem ) {
  8799. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8800. },
  8801. data: function( elem, name, data ) {
  8802. return dataUser.access( elem, name, data );
  8803. },
  8804. removeData: function( elem, name ) {
  8805. dataUser.remove( elem, name );
  8806. },
  8807. // TODO: Now that all calls to _data and _removeData have been replaced
  8808. // with direct calls to dataPriv methods, these can be deprecated.
  8809. _data: function( elem, name, data ) {
  8810. return dataPriv.access( elem, name, data );
  8811. },
  8812. _removeData: function( elem, name ) {
  8813. dataPriv.remove( elem, name );
  8814. }
  8815. } );
  8816. jQuery.fn.extend( {
  8817. data: function( key, value ) {
  8818. var i, name, data,
  8819. elem = this[ 0 ],
  8820. attrs = elem && elem.attributes;
  8821. // Gets all values
  8822. if ( key === undefined ) {
  8823. if ( this.length ) {
  8824. data = dataUser.get( elem );
  8825. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8826. i = attrs.length;
  8827. while ( i-- ) {
  8828. // Support: IE 11 only
  8829. // The attrs elements can be null (#14894)
  8830. if ( attrs[ i ] ) {
  8831. name = attrs[ i ].name;
  8832. if ( name.indexOf( "data-" ) === 0 ) {
  8833. name = camelCase( name.slice( 5 ) );
  8834. dataAttr( elem, name, data[ name ] );
  8835. }
  8836. }
  8837. }
  8838. dataPriv.set( elem, "hasDataAttrs", true );
  8839. }
  8840. }
  8841. return data;
  8842. }
  8843. // Sets multiple values
  8844. if ( typeof key === "object" ) {
  8845. return this.each( function() {
  8846. dataUser.set( this, key );
  8847. } );
  8848. }
  8849. return access( this, function( value ) {
  8850. var data;
  8851. // The calling jQuery object (element matches) is not empty
  8852. // (and therefore has an element appears at this[ 0 ]) and the
  8853. // `value` parameter was not undefined. An empty jQuery object
  8854. // will result in `undefined` for elem = this[ 0 ] which will
  8855. // throw an exception if an attempt to read a data cache is made.
  8856. if ( elem && value === undefined ) {
  8857. // Attempt to get data from the cache
  8858. // The key will always be camelCased in Data
  8859. data = dataUser.get( elem, key );
  8860. if ( data !== undefined ) {
  8861. return data;
  8862. }
  8863. // Attempt to "discover" the data in
  8864. // HTML5 custom data-* attrs
  8865. data = dataAttr( elem, key );
  8866. if ( data !== undefined ) {
  8867. return data;
  8868. }
  8869. // We tried really hard, but the data doesn't exist.
  8870. return;
  8871. }
  8872. // Set the data...
  8873. this.each( function() {
  8874. // We always store the camelCased key
  8875. dataUser.set( this, key, value );
  8876. } );
  8877. }, null, value, arguments.length > 1, null, true );
  8878. },
  8879. removeData: function( key ) {
  8880. return this.each( function() {
  8881. dataUser.remove( this, key );
  8882. } );
  8883. }
  8884. } );
  8885. jQuery.extend( {
  8886. queue: function( elem, type, data ) {
  8887. var queue;
  8888. if ( elem ) {
  8889. type = ( type || "fx" ) + "queue";
  8890. queue = dataPriv.get( elem, type );
  8891. // Speed up dequeue by getting out quickly if this is just a lookup
  8892. if ( data ) {
  8893. if ( !queue || Array.isArray( data ) ) {
  8894. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8895. } else {
  8896. queue.push( data );
  8897. }
  8898. }
  8899. return queue || [];
  8900. }
  8901. },
  8902. dequeue: function( elem, type ) {
  8903. type = type || "fx";
  8904. var queue = jQuery.queue( elem, type ),
  8905. startLength = queue.length,
  8906. fn = queue.shift(),
  8907. hooks = jQuery._queueHooks( elem, type ),
  8908. next = function() {
  8909. jQuery.dequeue( elem, type );
  8910. };
  8911. // If the fx queue is dequeued, always remove the progress sentinel
  8912. if ( fn === "inprogress" ) {
  8913. fn = queue.shift();
  8914. startLength--;
  8915. }
  8916. if ( fn ) {
  8917. // Add a progress sentinel to prevent the fx queue from being
  8918. // automatically dequeued
  8919. if ( type === "fx" ) {
  8920. queue.unshift( "inprogress" );
  8921. }
  8922. // Clear up the last queue stop function
  8923. delete hooks.stop;
  8924. fn.call( elem, next, hooks );
  8925. }
  8926. if ( !startLength && hooks ) {
  8927. hooks.empty.fire();
  8928. }
  8929. },
  8930. // Not public - generate a queueHooks object, or return the current one
  8931. _queueHooks: function( elem, type ) {
  8932. var key = type + "queueHooks";
  8933. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8934. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8935. dataPriv.remove( elem, [ type + "queue", key ] );
  8936. } )
  8937. } );
  8938. }
  8939. } );
  8940. jQuery.fn.extend( {
  8941. queue: function( type, data ) {
  8942. var setter = 2;
  8943. if ( typeof type !== "string" ) {
  8944. data = type;
  8945. type = "fx";
  8946. setter--;
  8947. }
  8948. if ( arguments.length < setter ) {
  8949. return jQuery.queue( this[ 0 ], type );
  8950. }
  8951. return data === undefined ?
  8952. this :
  8953. this.each( function() {
  8954. var queue = jQuery.queue( this, type, data );
  8955. // Ensure a hooks for this queue
  8956. jQuery._queueHooks( this, type );
  8957. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8958. jQuery.dequeue( this, type );
  8959. }
  8960. } );
  8961. },
  8962. dequeue: function( type ) {
  8963. return this.each( function() {
  8964. jQuery.dequeue( this, type );
  8965. } );
  8966. },
  8967. clearQueue: function( type ) {
  8968. return this.queue( type || "fx", [] );
  8969. },
  8970. // Get a promise resolved when queues of a certain type
  8971. // are emptied (fx is the type by default)
  8972. promise: function( type, obj ) {
  8973. var tmp,
  8974. count = 1,
  8975. defer = jQuery.Deferred(),
  8976. elements = this,
  8977. i = this.length,
  8978. resolve = function() {
  8979. if ( !( --count ) ) {
  8980. defer.resolveWith( elements, [ elements ] );
  8981. }
  8982. };
  8983. if ( typeof type !== "string" ) {
  8984. obj = type;
  8985. type = undefined;
  8986. }
  8987. type = type || "fx";
  8988. while ( i-- ) {
  8989. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  8990. if ( tmp && tmp.empty ) {
  8991. count++;
  8992. tmp.empty.add( resolve );
  8993. }
  8994. }
  8995. resolve();
  8996. return defer.promise( obj );
  8997. }
  8998. } );
  8999. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  9000. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  9001. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  9002. var documentElement = document.documentElement;
  9003. var isAttached = function( elem ) {
  9004. return jQuery.contains( elem.ownerDocument, elem );
  9005. },
  9006. composed = { composed: true };
  9007. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  9008. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  9009. // Support: iOS 10.0-10.2 only
  9010. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  9011. // leading to errors. We need to check for `getRootNode`.
  9012. if ( documentElement.getRootNode ) {
  9013. isAttached = function( elem ) {
  9014. return jQuery.contains( elem.ownerDocument, elem ) ||
  9015. elem.getRootNode( composed ) === elem.ownerDocument;
  9016. };
  9017. }
  9018. var isHiddenWithinTree = function( elem, el ) {
  9019. // isHiddenWithinTree might be called from jQuery#filter function;
  9020. // in that case, element will be second argument
  9021. elem = el || elem;
  9022. // Inline style trumps all
  9023. return elem.style.display === "none" ||
  9024. elem.style.display === "" &&
  9025. // Otherwise, check computed style
  9026. // Support: Firefox <=43 - 45
  9027. // Disconnected elements can have computed display: none, so first confirm that elem is
  9028. // in the document.
  9029. isAttached( elem ) &&
  9030. jQuery.css( elem, "display" ) === "none";
  9031. };
  9032. function adjustCSS( elem, prop, valueParts, tween ) {
  9033. var adjusted, scale,
  9034. maxIterations = 20,
  9035. currentValue = tween ?
  9036. function() {
  9037. return tween.cur();
  9038. } :
  9039. function() {
  9040. return jQuery.css( elem, prop, "" );
  9041. },
  9042. initial = currentValue(),
  9043. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  9044. // Starting value computation is required for potential unit mismatches
  9045. initialInUnit = elem.nodeType &&
  9046. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  9047. rcssNum.exec( jQuery.css( elem, prop ) );
  9048. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  9049. // Support: Firefox <=54
  9050. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  9051. initial = initial / 2;
  9052. // Trust units reported by jQuery.css
  9053. unit = unit || initialInUnit[ 3 ];
  9054. // Iteratively approximate from a nonzero starting point
  9055. initialInUnit = +initial || 1;
  9056. while ( maxIterations-- ) {
  9057. // Evaluate and update our best guess (doubling guesses that zero out).
  9058. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  9059. jQuery.style( elem, prop, initialInUnit + unit );
  9060. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  9061. maxIterations = 0;
  9062. }
  9063. initialInUnit = initialInUnit / scale;
  9064. }
  9065. initialInUnit = initialInUnit * 2;
  9066. jQuery.style( elem, prop, initialInUnit + unit );
  9067. // Make sure we update the tween properties later on
  9068. valueParts = valueParts || [];
  9069. }
  9070. if ( valueParts ) {
  9071. initialInUnit = +initialInUnit || +initial || 0;
  9072. // Apply relative offset (+=/-=) if specified
  9073. adjusted = valueParts[ 1 ] ?
  9074. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  9075. +valueParts[ 2 ];
  9076. if ( tween ) {
  9077. tween.unit = unit;
  9078. tween.start = initialInUnit;
  9079. tween.end = adjusted;
  9080. }
  9081. }
  9082. return adjusted;
  9083. }
  9084. var defaultDisplayMap = {};
  9085. function getDefaultDisplay( elem ) {
  9086. var temp,
  9087. doc = elem.ownerDocument,
  9088. nodeName = elem.nodeName,
  9089. display = defaultDisplayMap[ nodeName ];
  9090. if ( display ) {
  9091. return display;
  9092. }
  9093. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  9094. display = jQuery.css( temp, "display" );
  9095. temp.parentNode.removeChild( temp );
  9096. if ( display === "none" ) {
  9097. display = "block";
  9098. }
  9099. defaultDisplayMap[ nodeName ] = display;
  9100. return display;
  9101. }
  9102. function showHide( elements, show ) {
  9103. var display, elem,
  9104. values = [],
  9105. index = 0,
  9106. length = elements.length;
  9107. // Determine new display value for elements that need to change
  9108. for ( ; index < length; index++ ) {
  9109. elem = elements[ index ];
  9110. if ( !elem.style ) {
  9111. continue;
  9112. }
  9113. display = elem.style.display;
  9114. if ( show ) {
  9115. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  9116. // check is required in this first loop unless we have a nonempty display value (either
  9117. // inline or about-to-be-restored)
  9118. if ( display === "none" ) {
  9119. values[ index ] = dataPriv.get( elem, "display" ) || null;
  9120. if ( !values[ index ] ) {
  9121. elem.style.display = "";
  9122. }
  9123. }
  9124. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  9125. values[ index ] = getDefaultDisplay( elem );
  9126. }
  9127. } else {
  9128. if ( display !== "none" ) {
  9129. values[ index ] = "none";
  9130. // Remember what we're overwriting
  9131. dataPriv.set( elem, "display", display );
  9132. }
  9133. }
  9134. }
  9135. // Set the display of the elements in a second loop to avoid constant reflow
  9136. for ( index = 0; index < length; index++ ) {
  9137. if ( values[ index ] != null ) {
  9138. elements[ index ].style.display = values[ index ];
  9139. }
  9140. }
  9141. return elements;
  9142. }
  9143. jQuery.fn.extend( {
  9144. show: function() {
  9145. return showHide( this, true );
  9146. },
  9147. hide: function() {
  9148. return showHide( this );
  9149. },
  9150. toggle: function( state ) {
  9151. if ( typeof state === "boolean" ) {
  9152. return state ? this.show() : this.hide();
  9153. }
  9154. return this.each( function() {
  9155. if ( isHiddenWithinTree( this ) ) {
  9156. jQuery( this ).show();
  9157. } else {
  9158. jQuery( this ).hide();
  9159. }
  9160. } );
  9161. }
  9162. } );
  9163. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  9164. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  9165. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  9166. ( function() {
  9167. var fragment = document.createDocumentFragment(),
  9168. div = fragment.appendChild( document.createElement( "div" ) ),
  9169. input = document.createElement( "input" );
  9170. // Support: Android 4.0 - 4.3 only
  9171. // Check state lost if the name is set (#11217)
  9172. // Support: Windows Web Apps (WWA)
  9173. // `name` and `type` must use .setAttribute for WWA (#14901)
  9174. input.setAttribute( "type", "radio" );
  9175. input.setAttribute( "checked", "checked" );
  9176. input.setAttribute( "name", "t" );
  9177. div.appendChild( input );
  9178. // Support: Android <=4.1 only
  9179. // Older WebKit doesn't clone checked state correctly in fragments
  9180. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  9181. // Support: IE <=11 only
  9182. // Make sure textarea (and checkbox) defaultValue is properly cloned
  9183. div.innerHTML = "<textarea>x</textarea>";
  9184. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  9185. // Support: IE <=9 only
  9186. // IE <=9 replaces <option> tags with their contents when inserted outside of
  9187. // the select element.
  9188. div.innerHTML = "<option></option>";
  9189. support.option = !!div.lastChild;
  9190. } )();
  9191. // We have to close these tags to support XHTML (#13200)
  9192. var wrapMap = {
  9193. // XHTML parsers do not magically insert elements in the
  9194. // same way that tag soup parsers do. So we cannot shorten
  9195. // this by omitting <tbody> or other required elements.
  9196. thead: [ 1, "<table>", "</table>" ],
  9197. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  9198. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  9199. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  9200. _default: [ 0, "", "" ]
  9201. };
  9202. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  9203. wrapMap.th = wrapMap.td;
  9204. // Support: IE <=9 only
  9205. if ( !support.option ) {
  9206. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  9207. }
  9208. function getAll( context, tag ) {
  9209. // Support: IE <=9 - 11 only
  9210. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  9211. var ret;
  9212. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9213. ret = context.getElementsByTagName( tag || "*" );
  9214. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  9215. ret = context.querySelectorAll( tag || "*" );
  9216. } else {
  9217. ret = [];
  9218. }
  9219. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  9220. return jQuery.merge( [ context ], ret );
  9221. }
  9222. return ret;
  9223. }
  9224. // Mark scripts as having already been evaluated
  9225. function setGlobalEval( elems, refElements ) {
  9226. var i = 0,
  9227. l = elems.length;
  9228. for ( ; i < l; i++ ) {
  9229. dataPriv.set(
  9230. elems[ i ],
  9231. "globalEval",
  9232. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  9233. );
  9234. }
  9235. }
  9236. var rhtml = /<|&#?\w+;/;
  9237. function buildFragment( elems, context, scripts, selection, ignored ) {
  9238. var elem, tmp, tag, wrap, attached, j,
  9239. fragment = context.createDocumentFragment(),
  9240. nodes = [],
  9241. i = 0,
  9242. l = elems.length;
  9243. for ( ; i < l; i++ ) {
  9244. elem = elems[ i ];
  9245. if ( elem || elem === 0 ) {
  9246. // Add nodes directly
  9247. if ( toType( elem ) === "object" ) {
  9248. // Support: Android <=4.0 only, PhantomJS 1 only
  9249. // push.apply(_, arraylike) throws on ancient WebKit
  9250. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  9251. // Convert non-html into a text node
  9252. } else if ( !rhtml.test( elem ) ) {
  9253. nodes.push( context.createTextNode( elem ) );
  9254. // Convert html into DOM nodes
  9255. } else {
  9256. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  9257. // Deserialize a standard representation
  9258. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  9259. wrap = wrapMap[ tag ] || wrapMap._default;
  9260. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  9261. // Descend through wrappers to the right content
  9262. j = wrap[ 0 ];
  9263. while ( j-- ) {
  9264. tmp = tmp.lastChild;
  9265. }
  9266. // Support: Android <=4.0 only, PhantomJS 1 only
  9267. // push.apply(_, arraylike) throws on ancient WebKit
  9268. jQuery.merge( nodes, tmp.childNodes );
  9269. // Remember the top-level container
  9270. tmp = fragment.firstChild;
  9271. // Ensure the created nodes are orphaned (#12392)
  9272. tmp.textContent = "";
  9273. }
  9274. }
  9275. }
  9276. // Remove wrapper from fragment
  9277. fragment.textContent = "";
  9278. i = 0;
  9279. while ( ( elem = nodes[ i++ ] ) ) {
  9280. // Skip elements already in the context collection (trac-4087)
  9281. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  9282. if ( ignored ) {
  9283. ignored.push( elem );
  9284. }
  9285. continue;
  9286. }
  9287. attached = isAttached( elem );
  9288. // Append to fragment
  9289. tmp = getAll( fragment.appendChild( elem ), "script" );
  9290. // Preserve script evaluation history
  9291. if ( attached ) {
  9292. setGlobalEval( tmp );
  9293. }
  9294. // Capture executables
  9295. if ( scripts ) {
  9296. j = 0;
  9297. while ( ( elem = tmp[ j++ ] ) ) {
  9298. if ( rscriptType.test( elem.type || "" ) ) {
  9299. scripts.push( elem );
  9300. }
  9301. }
  9302. }
  9303. }
  9304. return fragment;
  9305. }
  9306. var
  9307. rkeyEvent = /^key/,
  9308. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  9309. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  9310. function returnTrue() {
  9311. return true;
  9312. }
  9313. function returnFalse() {
  9314. return false;
  9315. }
  9316. // Support: IE <=9 - 11+
  9317. // focus() and blur() are asynchronous, except when they are no-op.
  9318. // So expect focus to be synchronous when the element is already active,
  9319. // and blur to be synchronous when the element is not already active.
  9320. // (focus and blur are always synchronous in other supported browsers,
  9321. // this just defines when we can count on it).
  9322. function expectSync( elem, type ) {
  9323. return ( elem === safeActiveElement() ) === ( type === "focus" );
  9324. }
  9325. // Support: IE <=9 only
  9326. // Accessing document.activeElement can throw unexpectedly
  9327. // https://bugs.jquery.com/ticket/13393
  9328. function safeActiveElement() {
  9329. try {
  9330. return document.activeElement;
  9331. } catch ( err ) { }
  9332. }
  9333. function on( elem, types, selector, data, fn, one ) {
  9334. var origFn, type;
  9335. // Types can be a map of types/handlers
  9336. if ( typeof types === "object" ) {
  9337. // ( types-Object, selector, data )
  9338. if ( typeof selector !== "string" ) {
  9339. // ( types-Object, data )
  9340. data = data || selector;
  9341. selector = undefined;
  9342. }
  9343. for ( type in types ) {
  9344. on( elem, type, selector, data, types[ type ], one );
  9345. }
  9346. return elem;
  9347. }
  9348. if ( data == null && fn == null ) {
  9349. // ( types, fn )
  9350. fn = selector;
  9351. data = selector = undefined;
  9352. } else if ( fn == null ) {
  9353. if ( typeof selector === "string" ) {
  9354. // ( types, selector, fn )
  9355. fn = data;
  9356. data = undefined;
  9357. } else {
  9358. // ( types, data, fn )
  9359. fn = data;
  9360. data = selector;
  9361. selector = undefined;
  9362. }
  9363. }
  9364. if ( fn === false ) {
  9365. fn = returnFalse;
  9366. } else if ( !fn ) {
  9367. return elem;
  9368. }
  9369. if ( one === 1 ) {
  9370. origFn = fn;
  9371. fn = function( event ) {
  9372. // Can use an empty set, since event contains the info
  9373. jQuery().off( event );
  9374. return origFn.apply( this, arguments );
  9375. };
  9376. // Use same guid so caller can remove using origFn
  9377. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9378. }
  9379. return elem.each( function() {
  9380. jQuery.event.add( this, types, fn, data, selector );
  9381. } );
  9382. }
  9383. /*
  9384. * Helper functions for managing events -- not part of the public interface.
  9385. * Props to Dean Edwards' addEvent library for many of the ideas.
  9386. */
  9387. jQuery.event = {
  9388. global: {},
  9389. add: function( elem, types, handler, data, selector ) {
  9390. var handleObjIn, eventHandle, tmp,
  9391. events, t, handleObj,
  9392. special, handlers, type, namespaces, origType,
  9393. elemData = dataPriv.get( elem );
  9394. // Only attach events to objects that accept data
  9395. if ( !acceptData( elem ) ) {
  9396. return;
  9397. }
  9398. // Caller can pass in an object of custom data in lieu of the handler
  9399. if ( handler.handler ) {
  9400. handleObjIn = handler;
  9401. handler = handleObjIn.handler;
  9402. selector = handleObjIn.selector;
  9403. }
  9404. // Ensure that invalid selectors throw exceptions at attach time
  9405. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9406. if ( selector ) {
  9407. jQuery.find.matchesSelector( documentElement, selector );
  9408. }
  9409. // Make sure that the handler has a unique ID, used to find/remove it later
  9410. if ( !handler.guid ) {
  9411. handler.guid = jQuery.guid++;
  9412. }
  9413. // Init the element's event structure and main handler, if this is the first
  9414. if ( !( events = elemData.events ) ) {
  9415. events = elemData.events = Object.create( null );
  9416. }
  9417. if ( !( eventHandle = elemData.handle ) ) {
  9418. eventHandle = elemData.handle = function( e ) {
  9419. // Discard the second event of a jQuery.event.trigger() and
  9420. // when an event is called after a page has unloaded
  9421. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9422. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9423. };
  9424. }
  9425. // Handle multiple events separated by a space
  9426. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9427. t = types.length;
  9428. while ( t-- ) {
  9429. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9430. type = origType = tmp[ 1 ];
  9431. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9432. // There *must* be a type, no attaching namespace-only handlers
  9433. if ( !type ) {
  9434. continue;
  9435. }
  9436. // If event changes its type, use the special event handlers for the changed type
  9437. special = jQuery.event.special[ type ] || {};
  9438. // If selector defined, determine special event api type, otherwise given type
  9439. type = ( selector ? special.delegateType : special.bindType ) || type;
  9440. // Update special based on newly reset type
  9441. special = jQuery.event.special[ type ] || {};
  9442. // handleObj is passed to all event handlers
  9443. handleObj = jQuery.extend( {
  9444. type: type,
  9445. origType: origType,
  9446. data: data,
  9447. handler: handler,
  9448. guid: handler.guid,
  9449. selector: selector,
  9450. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9451. namespace: namespaces.join( "." )
  9452. }, handleObjIn );
  9453. // Init the event handler queue if we're the first
  9454. if ( !( handlers = events[ type ] ) ) {
  9455. handlers = events[ type ] = [];
  9456. handlers.delegateCount = 0;
  9457. // Only use addEventListener if the special events handler returns false
  9458. if ( !special.setup ||
  9459. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9460. if ( elem.addEventListener ) {
  9461. elem.addEventListener( type, eventHandle );
  9462. }
  9463. }
  9464. }
  9465. if ( special.add ) {
  9466. special.add.call( elem, handleObj );
  9467. if ( !handleObj.handler.guid ) {
  9468. handleObj.handler.guid = handler.guid;
  9469. }
  9470. }
  9471. // Add to the element's handler list, delegates in front
  9472. if ( selector ) {
  9473. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9474. } else {
  9475. handlers.push( handleObj );
  9476. }
  9477. // Keep track of which events have ever been used, for event optimization
  9478. jQuery.event.global[ type ] = true;
  9479. }
  9480. },
  9481. // Detach an event or set of events from an element
  9482. remove: function( elem, types, handler, selector, mappedTypes ) {
  9483. var j, origCount, tmp,
  9484. events, t, handleObj,
  9485. special, handlers, type, namespaces, origType,
  9486. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9487. if ( !elemData || !( events = elemData.events ) ) {
  9488. return;
  9489. }
  9490. // Once for each type.namespace in types; type may be omitted
  9491. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9492. t = types.length;
  9493. while ( t-- ) {
  9494. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9495. type = origType = tmp[ 1 ];
  9496. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9497. // Unbind all events (on this namespace, if provided) for the element
  9498. if ( !type ) {
  9499. for ( type in events ) {
  9500. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9501. }
  9502. continue;
  9503. }
  9504. special = jQuery.event.special[ type ] || {};
  9505. type = ( selector ? special.delegateType : special.bindType ) || type;
  9506. handlers = events[ type ] || [];
  9507. tmp = tmp[ 2 ] &&
  9508. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9509. // Remove matching events
  9510. origCount = j = handlers.length;
  9511. while ( j-- ) {
  9512. handleObj = handlers[ j ];
  9513. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9514. ( !handler || handler.guid === handleObj.guid ) &&
  9515. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9516. ( !selector || selector === handleObj.selector ||
  9517. selector === "**" && handleObj.selector ) ) {
  9518. handlers.splice( j, 1 );
  9519. if ( handleObj.selector ) {
  9520. handlers.delegateCount--;
  9521. }
  9522. if ( special.remove ) {
  9523. special.remove.call( elem, handleObj );
  9524. }
  9525. }
  9526. }
  9527. // Remove generic event handler if we removed something and no more handlers exist
  9528. // (avoids potential for endless recursion during removal of special event handlers)
  9529. if ( origCount && !handlers.length ) {
  9530. if ( !special.teardown ||
  9531. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9532. jQuery.removeEvent( elem, type, elemData.handle );
  9533. }
  9534. delete events[ type ];
  9535. }
  9536. }
  9537. // Remove data and the expando if it's no longer used
  9538. if ( jQuery.isEmptyObject( events ) ) {
  9539. dataPriv.remove( elem, "handle events" );
  9540. }
  9541. },
  9542. dispatch: function( nativeEvent ) {
  9543. var i, j, ret, matched, handleObj, handlerQueue,
  9544. args = new Array( arguments.length ),
  9545. // Make a writable jQuery.Event from the native event object
  9546. event = jQuery.event.fix( nativeEvent ),
  9547. handlers = (
  9548. dataPriv.get( this, "events" ) || Object.create( null )
  9549. )[ event.type ] || [],
  9550. special = jQuery.event.special[ event.type ] || {};
  9551. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9552. args[ 0 ] = event;
  9553. for ( i = 1; i < arguments.length; i++ ) {
  9554. args[ i ] = arguments[ i ];
  9555. }
  9556. event.delegateTarget = this;
  9557. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9558. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9559. return;
  9560. }
  9561. // Determine handlers
  9562. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9563. // Run delegates first; they may want to stop propagation beneath us
  9564. i = 0;
  9565. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9566. event.currentTarget = matched.elem;
  9567. j = 0;
  9568. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9569. !event.isImmediatePropagationStopped() ) {
  9570. // If the event is namespaced, then each handler is only invoked if it is
  9571. // specially universal or its namespaces are a superset of the event's.
  9572. if ( !event.rnamespace || handleObj.namespace === false ||
  9573. event.rnamespace.test( handleObj.namespace ) ) {
  9574. event.handleObj = handleObj;
  9575. event.data = handleObj.data;
  9576. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9577. handleObj.handler ).apply( matched.elem, args );
  9578. if ( ret !== undefined ) {
  9579. if ( ( event.result = ret ) === false ) {
  9580. event.preventDefault();
  9581. event.stopPropagation();
  9582. }
  9583. }
  9584. }
  9585. }
  9586. }
  9587. // Call the postDispatch hook for the mapped type
  9588. if ( special.postDispatch ) {
  9589. special.postDispatch.call( this, event );
  9590. }
  9591. return event.result;
  9592. },
  9593. handlers: function( event, handlers ) {
  9594. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9595. handlerQueue = [],
  9596. delegateCount = handlers.delegateCount,
  9597. cur = event.target;
  9598. // Find delegate handlers
  9599. if ( delegateCount &&
  9600. // Support: IE <=9
  9601. // Black-hole SVG <use> instance trees (trac-13180)
  9602. cur.nodeType &&
  9603. // Support: Firefox <=42
  9604. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9605. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9606. // Support: IE 11 only
  9607. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9608. !( event.type === "click" && event.button >= 1 ) ) {
  9609. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9610. // Don't check non-elements (#13208)
  9611. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9612. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9613. matchedHandlers = [];
  9614. matchedSelectors = {};
  9615. for ( i = 0; i < delegateCount; i++ ) {
  9616. handleObj = handlers[ i ];
  9617. // Don't conflict with Object.prototype properties (#13203)
  9618. sel = handleObj.selector + " ";
  9619. if ( matchedSelectors[ sel ] === undefined ) {
  9620. matchedSelectors[ sel ] = handleObj.needsContext ?
  9621. jQuery( sel, this ).index( cur ) > -1 :
  9622. jQuery.find( sel, this, null, [ cur ] ).length;
  9623. }
  9624. if ( matchedSelectors[ sel ] ) {
  9625. matchedHandlers.push( handleObj );
  9626. }
  9627. }
  9628. if ( matchedHandlers.length ) {
  9629. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9630. }
  9631. }
  9632. }
  9633. }
  9634. // Add the remaining (directly-bound) handlers
  9635. cur = this;
  9636. if ( delegateCount < handlers.length ) {
  9637. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9638. }
  9639. return handlerQueue;
  9640. },
  9641. addProp: function( name, hook ) {
  9642. Object.defineProperty( jQuery.Event.prototype, name, {
  9643. enumerable: true,
  9644. configurable: true,
  9645. get: isFunction( hook ) ?
  9646. function() {
  9647. if ( this.originalEvent ) {
  9648. return hook( this.originalEvent );
  9649. }
  9650. } :
  9651. function() {
  9652. if ( this.originalEvent ) {
  9653. return this.originalEvent[ name ];
  9654. }
  9655. },
  9656. set: function( value ) {
  9657. Object.defineProperty( this, name, {
  9658. enumerable: true,
  9659. configurable: true,
  9660. writable: true,
  9661. value: value
  9662. } );
  9663. }
  9664. } );
  9665. },
  9666. fix: function( originalEvent ) {
  9667. return originalEvent[ jQuery.expando ] ?
  9668. originalEvent :
  9669. new jQuery.Event( originalEvent );
  9670. },
  9671. special: {
  9672. load: {
  9673. // Prevent triggered image.load events from bubbling to window.load
  9674. noBubble: true
  9675. },
  9676. click: {
  9677. // Utilize native event to ensure correct state for checkable inputs
  9678. setup: function( data ) {
  9679. // For mutual compressibility with _default, replace `this` access with a local var.
  9680. // `|| data` is dead code meant only to preserve the variable through minification.
  9681. var el = this || data;
  9682. // Claim the first handler
  9683. if ( rcheckableType.test( el.type ) &&
  9684. el.click && nodeName( el, "input" ) ) {
  9685. // dataPriv.set( el, "click", ... )
  9686. leverageNative( el, "click", returnTrue );
  9687. }
  9688. // Return false to allow normal processing in the caller
  9689. return false;
  9690. },
  9691. trigger: function( data ) {
  9692. // For mutual compressibility with _default, replace `this` access with a local var.
  9693. // `|| data` is dead code meant only to preserve the variable through minification.
  9694. var el = this || data;
  9695. // Force setup before triggering a click
  9696. if ( rcheckableType.test( el.type ) &&
  9697. el.click && nodeName( el, "input" ) ) {
  9698. leverageNative( el, "click" );
  9699. }
  9700. // Return non-false to allow normal event-path propagation
  9701. return true;
  9702. },
  9703. // For cross-browser consistency, suppress native .click() on links
  9704. // Also prevent it if we're currently inside a leveraged native-event stack
  9705. _default: function( event ) {
  9706. var target = event.target;
  9707. return rcheckableType.test( target.type ) &&
  9708. target.click && nodeName( target, "input" ) &&
  9709. dataPriv.get( target, "click" ) ||
  9710. nodeName( target, "a" );
  9711. }
  9712. },
  9713. beforeunload: {
  9714. postDispatch: function( event ) {
  9715. // Support: Firefox 20+
  9716. // Firefox doesn't alert if the returnValue field is not set.
  9717. if ( event.result !== undefined && event.originalEvent ) {
  9718. event.originalEvent.returnValue = event.result;
  9719. }
  9720. }
  9721. }
  9722. }
  9723. };
  9724. // Ensure the presence of an event listener that handles manually-triggered
  9725. // synthetic events by interrupting progress until reinvoked in response to
  9726. // *native* events that it fires directly, ensuring that state changes have
  9727. // already occurred before other listeners are invoked.
  9728. function leverageNative( el, type, expectSync ) {
  9729. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  9730. if ( !expectSync ) {
  9731. if ( dataPriv.get( el, type ) === undefined ) {
  9732. jQuery.event.add( el, type, returnTrue );
  9733. }
  9734. return;
  9735. }
  9736. // Register the controller as a special universal handler for all event namespaces
  9737. dataPriv.set( el, type, false );
  9738. jQuery.event.add( el, type, {
  9739. namespace: false,
  9740. handler: function( event ) {
  9741. var notAsync, result,
  9742. saved = dataPriv.get( this, type );
  9743. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  9744. // Interrupt processing of the outer synthetic .trigger()ed event
  9745. // Saved data should be false in such cases, but might be a leftover capture object
  9746. // from an async native handler (gh-4350)
  9747. if ( !saved.length ) {
  9748. // Store arguments for use when handling the inner native event
  9749. // There will always be at least one argument (an event object), so this array
  9750. // will not be confused with a leftover capture object.
  9751. saved = slice.call( arguments );
  9752. dataPriv.set( this, type, saved );
  9753. // Trigger the native event and capture its result
  9754. // Support: IE <=9 - 11+
  9755. // focus() and blur() are asynchronous
  9756. notAsync = expectSync( this, type );
  9757. this[ type ]();
  9758. result = dataPriv.get( this, type );
  9759. if ( saved !== result || notAsync ) {
  9760. dataPriv.set( this, type, false );
  9761. } else {
  9762. result = {};
  9763. }
  9764. if ( saved !== result ) {
  9765. // Cancel the outer synthetic event
  9766. event.stopImmediatePropagation();
  9767. event.preventDefault();
  9768. return result.value;
  9769. }
  9770. // If this is an inner synthetic event for an event with a bubbling surrogate
  9771. // (focus or blur), assume that the surrogate already propagated from triggering the
  9772. // native event and prevent that from happening again here.
  9773. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  9774. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  9775. // less bad than duplication.
  9776. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  9777. event.stopPropagation();
  9778. }
  9779. // If this is a native event triggered above, everything is now in order
  9780. // Fire an inner synthetic event with the original arguments
  9781. } else if ( saved.length ) {
  9782. // ...and capture the result
  9783. dataPriv.set( this, type, {
  9784. value: jQuery.event.trigger(
  9785. // Support: IE <=9 - 11+
  9786. // Extend with the prototype to reset the above stopImmediatePropagation()
  9787. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  9788. saved.slice( 1 ),
  9789. this
  9790. )
  9791. } );
  9792. // Abort handling of the native event
  9793. event.stopImmediatePropagation();
  9794. }
  9795. }
  9796. } );
  9797. }
  9798. jQuery.removeEvent = function( elem, type, handle ) {
  9799. // This "if" is needed for plain objects
  9800. if ( elem.removeEventListener ) {
  9801. elem.removeEventListener( type, handle );
  9802. }
  9803. };
  9804. jQuery.Event = function( src, props ) {
  9805. // Allow instantiation without the 'new' keyword
  9806. if ( !( this instanceof jQuery.Event ) ) {
  9807. return new jQuery.Event( src, props );
  9808. }
  9809. // Event object
  9810. if ( src && src.type ) {
  9811. this.originalEvent = src;
  9812. this.type = src.type;
  9813. // Events bubbling up the document may have been marked as prevented
  9814. // by a handler lower down the tree; reflect the correct value.
  9815. this.isDefaultPrevented = src.defaultPrevented ||
  9816. src.defaultPrevented === undefined &&
  9817. // Support: Android <=2.3 only
  9818. src.returnValue === false ?
  9819. returnTrue :
  9820. returnFalse;
  9821. // Create target properties
  9822. // Support: Safari <=6 - 7 only
  9823. // Target should not be a text node (#504, #13143)
  9824. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9825. src.target.parentNode :
  9826. src.target;
  9827. this.currentTarget = src.currentTarget;
  9828. this.relatedTarget = src.relatedTarget;
  9829. // Event type
  9830. } else {
  9831. this.type = src;
  9832. }
  9833. // Put explicitly provided properties onto the event object
  9834. if ( props ) {
  9835. jQuery.extend( this, props );
  9836. }
  9837. // Create a timestamp if incoming event doesn't have one
  9838. this.timeStamp = src && src.timeStamp || Date.now();
  9839. // Mark it as fixed
  9840. this[ jQuery.expando ] = true;
  9841. };
  9842. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9843. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9844. jQuery.Event.prototype = {
  9845. constructor: jQuery.Event,
  9846. isDefaultPrevented: returnFalse,
  9847. isPropagationStopped: returnFalse,
  9848. isImmediatePropagationStopped: returnFalse,
  9849. isSimulated: false,
  9850. preventDefault: function() {
  9851. var e = this.originalEvent;
  9852. this.isDefaultPrevented = returnTrue;
  9853. if ( e && !this.isSimulated ) {
  9854. e.preventDefault();
  9855. }
  9856. },
  9857. stopPropagation: function() {
  9858. var e = this.originalEvent;
  9859. this.isPropagationStopped = returnTrue;
  9860. if ( e && !this.isSimulated ) {
  9861. e.stopPropagation();
  9862. }
  9863. },
  9864. stopImmediatePropagation: function() {
  9865. var e = this.originalEvent;
  9866. this.isImmediatePropagationStopped = returnTrue;
  9867. if ( e && !this.isSimulated ) {
  9868. e.stopImmediatePropagation();
  9869. }
  9870. this.stopPropagation();
  9871. }
  9872. };
  9873. // Includes all common event props including KeyEvent and MouseEvent specific props
  9874. jQuery.each( {
  9875. altKey: true,
  9876. bubbles: true,
  9877. cancelable: true,
  9878. changedTouches: true,
  9879. ctrlKey: true,
  9880. detail: true,
  9881. eventPhase: true,
  9882. metaKey: true,
  9883. pageX: true,
  9884. pageY: true,
  9885. shiftKey: true,
  9886. view: true,
  9887. "char": true,
  9888. code: true,
  9889. charCode: true,
  9890. key: true,
  9891. keyCode: true,
  9892. button: true,
  9893. buttons: true,
  9894. clientX: true,
  9895. clientY: true,
  9896. offsetX: true,
  9897. offsetY: true,
  9898. pointerId: true,
  9899. pointerType: true,
  9900. screenX: true,
  9901. screenY: true,
  9902. targetTouches: true,
  9903. toElement: true,
  9904. touches: true,
  9905. which: function( event ) {
  9906. var button = event.button;
  9907. // Add which for key events
  9908. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9909. return event.charCode != null ? event.charCode : event.keyCode;
  9910. }
  9911. // Add which for click: 1 === left; 2 === middle; 3 === right
  9912. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9913. if ( button & 1 ) {
  9914. return 1;
  9915. }
  9916. if ( button & 2 ) {
  9917. return 3;
  9918. }
  9919. if ( button & 4 ) {
  9920. return 2;
  9921. }
  9922. return 0;
  9923. }
  9924. return event.which;
  9925. }
  9926. }, jQuery.event.addProp );
  9927. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  9928. jQuery.event.special[ type ] = {
  9929. // Utilize native event if possible so blur/focus sequence is correct
  9930. setup: function() {
  9931. // Claim the first handler
  9932. // dataPriv.set( this, "focus", ... )
  9933. // dataPriv.set( this, "blur", ... )
  9934. leverageNative( this, type, expectSync );
  9935. // Return false to allow normal processing in the caller
  9936. return false;
  9937. },
  9938. trigger: function() {
  9939. // Force setup before trigger
  9940. leverageNative( this, type );
  9941. // Return non-false to allow normal event-path propagation
  9942. return true;
  9943. },
  9944. delegateType: delegateType
  9945. };
  9946. } );
  9947. // Create mouseenter/leave events using mouseover/out and event-time checks
  9948. // so that event delegation works in jQuery.
  9949. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9950. //
  9951. // Support: Safari 7 only
  9952. // Safari sends mouseenter too often; see:
  9953. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9954. // for the description of the bug (it existed in older Chrome versions as well).
  9955. jQuery.each( {
  9956. mouseenter: "mouseover",
  9957. mouseleave: "mouseout",
  9958. pointerenter: "pointerover",
  9959. pointerleave: "pointerout"
  9960. }, function( orig, fix ) {
  9961. jQuery.event.special[ orig ] = {
  9962. delegateType: fix,
  9963. bindType: fix,
  9964. handle: function( event ) {
  9965. var ret,
  9966. target = this,
  9967. related = event.relatedTarget,
  9968. handleObj = event.handleObj;
  9969. // For mouseenter/leave call the handler if related is outside the target.
  9970. // NB: No relatedTarget if the mouse left/entered the browser window
  9971. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9972. event.type = handleObj.origType;
  9973. ret = handleObj.handler.apply( this, arguments );
  9974. event.type = fix;
  9975. }
  9976. return ret;
  9977. }
  9978. };
  9979. } );
  9980. jQuery.fn.extend( {
  9981. on: function( types, selector, data, fn ) {
  9982. return on( this, types, selector, data, fn );
  9983. },
  9984. one: function( types, selector, data, fn ) {
  9985. return on( this, types, selector, data, fn, 1 );
  9986. },
  9987. off: function( types, selector, fn ) {
  9988. var handleObj, type;
  9989. if ( types && types.preventDefault && types.handleObj ) {
  9990. // ( event ) dispatched jQuery.Event
  9991. handleObj = types.handleObj;
  9992. jQuery( types.delegateTarget ).off(
  9993. handleObj.namespace ?
  9994. handleObj.origType + "." + handleObj.namespace :
  9995. handleObj.origType,
  9996. handleObj.selector,
  9997. handleObj.handler
  9998. );
  9999. return this;
  10000. }
  10001. if ( typeof types === "object" ) {
  10002. // ( types-object [, selector] )
  10003. for ( type in types ) {
  10004. this.off( type, selector, types[ type ] );
  10005. }
  10006. return this;
  10007. }
  10008. if ( selector === false || typeof selector === "function" ) {
  10009. // ( types [, fn] )
  10010. fn = selector;
  10011. selector = undefined;
  10012. }
  10013. if ( fn === false ) {
  10014. fn = returnFalse;
  10015. }
  10016. return this.each( function() {
  10017. jQuery.event.remove( this, types, fn, selector );
  10018. } );
  10019. }
  10020. } );
  10021. var
  10022. // Support: IE <=10 - 11, Edge 12 - 13 only
  10023. // In IE/Edge using regex groups here causes severe slowdowns.
  10024. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  10025. rnoInnerhtml = /<script|<style|<link/i,
  10026. // checked="checked" or checked
  10027. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  10028. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  10029. // Prefer a tbody over its parent table for containing new rows
  10030. function manipulationTarget( elem, content ) {
  10031. if ( nodeName( elem, "table" ) &&
  10032. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  10033. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  10034. }
  10035. return elem;
  10036. }
  10037. // Replace/restore the type attribute of script elements for safe DOM manipulation
  10038. function disableScript( elem ) {
  10039. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  10040. return elem;
  10041. }
  10042. function restoreScript( elem ) {
  10043. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  10044. elem.type = elem.type.slice( 5 );
  10045. } else {
  10046. elem.removeAttribute( "type" );
  10047. }
  10048. return elem;
  10049. }
  10050. function cloneCopyEvent( src, dest ) {
  10051. var i, l, type, pdataOld, udataOld, udataCur, events;
  10052. if ( dest.nodeType !== 1 ) {
  10053. return;
  10054. }
  10055. // 1. Copy private data: events, handlers, etc.
  10056. if ( dataPriv.hasData( src ) ) {
  10057. pdataOld = dataPriv.get( src );
  10058. events = pdataOld.events;
  10059. if ( events ) {
  10060. dataPriv.remove( dest, "handle events" );
  10061. for ( type in events ) {
  10062. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  10063. jQuery.event.add( dest, type, events[ type ][ i ] );
  10064. }
  10065. }
  10066. }
  10067. }
  10068. // 2. Copy user data
  10069. if ( dataUser.hasData( src ) ) {
  10070. udataOld = dataUser.access( src );
  10071. udataCur = jQuery.extend( {}, udataOld );
  10072. dataUser.set( dest, udataCur );
  10073. }
  10074. }
  10075. // Fix IE bugs, see support tests
  10076. function fixInput( src, dest ) {
  10077. var nodeName = dest.nodeName.toLowerCase();
  10078. // Fails to persist the checked state of a cloned checkbox or radio button.
  10079. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  10080. dest.checked = src.checked;
  10081. // Fails to return the selected option to the default selected state when cloning options
  10082. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  10083. dest.defaultValue = src.defaultValue;
  10084. }
  10085. }
  10086. function domManip( collection, args, callback, ignored ) {
  10087. // Flatten any nested arrays
  10088. args = flat( args );
  10089. var fragment, first, scripts, hasScripts, node, doc,
  10090. i = 0,
  10091. l = collection.length,
  10092. iNoClone = l - 1,
  10093. value = args[ 0 ],
  10094. valueIsFunction = isFunction( value );
  10095. // We can't cloneNode fragments that contain checked, in WebKit
  10096. if ( valueIsFunction ||
  10097. ( l > 1 && typeof value === "string" &&
  10098. !support.checkClone && rchecked.test( value ) ) ) {
  10099. return collection.each( function( index ) {
  10100. var self = collection.eq( index );
  10101. if ( valueIsFunction ) {
  10102. args[ 0 ] = value.call( this, index, self.html() );
  10103. }
  10104. domManip( self, args, callback, ignored );
  10105. } );
  10106. }
  10107. if ( l ) {
  10108. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  10109. first = fragment.firstChild;
  10110. if ( fragment.childNodes.length === 1 ) {
  10111. fragment = first;
  10112. }
  10113. // Require either new content or an interest in ignored elements to invoke the callback
  10114. if ( first || ignored ) {
  10115. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  10116. hasScripts = scripts.length;
  10117. // Use the original fragment for the last item
  10118. // instead of the first because it can end up
  10119. // being emptied incorrectly in certain situations (#8070).
  10120. for ( ; i < l; i++ ) {
  10121. node = fragment;
  10122. if ( i !== iNoClone ) {
  10123. node = jQuery.clone( node, true, true );
  10124. // Keep references to cloned scripts for later restoration
  10125. if ( hasScripts ) {
  10126. // Support: Android <=4.0 only, PhantomJS 1 only
  10127. // push.apply(_, arraylike) throws on ancient WebKit
  10128. jQuery.merge( scripts, getAll( node, "script" ) );
  10129. }
  10130. }
  10131. callback.call( collection[ i ], node, i );
  10132. }
  10133. if ( hasScripts ) {
  10134. doc = scripts[ scripts.length - 1 ].ownerDocument;
  10135. // Reenable scripts
  10136. jQuery.map( scripts, restoreScript );
  10137. // Evaluate executable scripts on first document insertion
  10138. for ( i = 0; i < hasScripts; i++ ) {
  10139. node = scripts[ i ];
  10140. if ( rscriptType.test( node.type || "" ) &&
  10141. !dataPriv.access( node, "globalEval" ) &&
  10142. jQuery.contains( doc, node ) ) {
  10143. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  10144. // Optional AJAX dependency, but won't run scripts if not present
  10145. if ( jQuery._evalUrl && !node.noModule ) {
  10146. jQuery._evalUrl( node.src, {
  10147. nonce: node.nonce || node.getAttribute( "nonce" )
  10148. }, doc );
  10149. }
  10150. } else {
  10151. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  10152. }
  10153. }
  10154. }
  10155. }
  10156. }
  10157. }
  10158. return collection;
  10159. }
  10160. function remove( elem, selector, keepData ) {
  10161. var node,
  10162. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  10163. i = 0;
  10164. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  10165. if ( !keepData && node.nodeType === 1 ) {
  10166. jQuery.cleanData( getAll( node ) );
  10167. }
  10168. if ( node.parentNode ) {
  10169. if ( keepData && isAttached( node ) ) {
  10170. setGlobalEval( getAll( node, "script" ) );
  10171. }
  10172. node.parentNode.removeChild( node );
  10173. }
  10174. }
  10175. return elem;
  10176. }
  10177. jQuery.extend( {
  10178. htmlPrefilter: function( html ) {
  10179. return html;
  10180. },
  10181. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  10182. var i, l, srcElements, destElements,
  10183. clone = elem.cloneNode( true ),
  10184. inPage = isAttached( elem );
  10185. // Fix IE cloning issues
  10186. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  10187. !jQuery.isXMLDoc( elem ) ) {
  10188. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  10189. destElements = getAll( clone );
  10190. srcElements = getAll( elem );
  10191. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10192. fixInput( srcElements[ i ], destElements[ i ] );
  10193. }
  10194. }
  10195. // Copy the events from the original to the clone
  10196. if ( dataAndEvents ) {
  10197. if ( deepDataAndEvents ) {
  10198. srcElements = srcElements || getAll( elem );
  10199. destElements = destElements || getAll( clone );
  10200. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10201. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  10202. }
  10203. } else {
  10204. cloneCopyEvent( elem, clone );
  10205. }
  10206. }
  10207. // Preserve script evaluation history
  10208. destElements = getAll( clone, "script" );
  10209. if ( destElements.length > 0 ) {
  10210. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  10211. }
  10212. // Return the cloned set
  10213. return clone;
  10214. },
  10215. cleanData: function( elems ) {
  10216. var data, elem, type,
  10217. special = jQuery.event.special,
  10218. i = 0;
  10219. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  10220. if ( acceptData( elem ) ) {
  10221. if ( ( data = elem[ dataPriv.expando ] ) ) {
  10222. if ( data.events ) {
  10223. for ( type in data.events ) {
  10224. if ( special[ type ] ) {
  10225. jQuery.event.remove( elem, type );
  10226. // This is a shortcut to avoid jQuery.event.remove's overhead
  10227. } else {
  10228. jQuery.removeEvent( elem, type, data.handle );
  10229. }
  10230. }
  10231. }
  10232. // Support: Chrome <=35 - 45+
  10233. // Assign undefined instead of using delete, see Data#remove
  10234. elem[ dataPriv.expando ] = undefined;
  10235. }
  10236. if ( elem[ dataUser.expando ] ) {
  10237. // Support: Chrome <=35 - 45+
  10238. // Assign undefined instead of using delete, see Data#remove
  10239. elem[ dataUser.expando ] = undefined;
  10240. }
  10241. }
  10242. }
  10243. }
  10244. } );
  10245. jQuery.fn.extend( {
  10246. detach: function( selector ) {
  10247. return remove( this, selector, true );
  10248. },
  10249. remove: function( selector ) {
  10250. return remove( this, selector );
  10251. },
  10252. text: function( value ) {
  10253. return access( this, function( value ) {
  10254. return value === undefined ?
  10255. jQuery.text( this ) :
  10256. this.empty().each( function() {
  10257. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10258. this.textContent = value;
  10259. }
  10260. } );
  10261. }, null, value, arguments.length );
  10262. },
  10263. append: function() {
  10264. return domManip( this, arguments, function( elem ) {
  10265. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10266. var target = manipulationTarget( this, elem );
  10267. target.appendChild( elem );
  10268. }
  10269. } );
  10270. },
  10271. prepend: function() {
  10272. return domManip( this, arguments, function( elem ) {
  10273. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10274. var target = manipulationTarget( this, elem );
  10275. target.insertBefore( elem, target.firstChild );
  10276. }
  10277. } );
  10278. },
  10279. before: function() {
  10280. return domManip( this, arguments, function( elem ) {
  10281. if ( this.parentNode ) {
  10282. this.parentNode.insertBefore( elem, this );
  10283. }
  10284. } );
  10285. },
  10286. after: function() {
  10287. return domManip( this, arguments, function( elem ) {
  10288. if ( this.parentNode ) {
  10289. this.parentNode.insertBefore( elem, this.nextSibling );
  10290. }
  10291. } );
  10292. },
  10293. empty: function() {
  10294. var elem,
  10295. i = 0;
  10296. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  10297. if ( elem.nodeType === 1 ) {
  10298. // Prevent memory leaks
  10299. jQuery.cleanData( getAll( elem, false ) );
  10300. // Remove any remaining nodes
  10301. elem.textContent = "";
  10302. }
  10303. }
  10304. return this;
  10305. },
  10306. clone: function( dataAndEvents, deepDataAndEvents ) {
  10307. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  10308. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  10309. return this.map( function() {
  10310. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  10311. } );
  10312. },
  10313. html: function( value ) {
  10314. return access( this, function( value ) {
  10315. var elem = this[ 0 ] || {},
  10316. i = 0,
  10317. l = this.length;
  10318. if ( value === undefined && elem.nodeType === 1 ) {
  10319. return elem.innerHTML;
  10320. }
  10321. // See if we can take a shortcut and just use innerHTML
  10322. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  10323. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  10324. value = jQuery.htmlPrefilter( value );
  10325. try {
  10326. for ( ; i < l; i++ ) {
  10327. elem = this[ i ] || {};
  10328. // Remove element nodes and prevent memory leaks
  10329. if ( elem.nodeType === 1 ) {
  10330. jQuery.cleanData( getAll( elem, false ) );
  10331. elem.innerHTML = value;
  10332. }
  10333. }
  10334. elem = 0;
  10335. // If using innerHTML throws an exception, use the fallback method
  10336. } catch ( e ) {}
  10337. }
  10338. if ( elem ) {
  10339. this.empty().append( value );
  10340. }
  10341. }, null, value, arguments.length );
  10342. },
  10343. replaceWith: function() {
  10344. var ignored = [];
  10345. // Make the changes, replacing each non-ignored context element with the new content
  10346. return domManip( this, arguments, function( elem ) {
  10347. var parent = this.parentNode;
  10348. if ( jQuery.inArray( this, ignored ) < 0 ) {
  10349. jQuery.cleanData( getAll( this ) );
  10350. if ( parent ) {
  10351. parent.replaceChild( elem, this );
  10352. }
  10353. }
  10354. // Force callback invocation
  10355. }, ignored );
  10356. }
  10357. } );
  10358. jQuery.each( {
  10359. appendTo: "append",
  10360. prependTo: "prepend",
  10361. insertBefore: "before",
  10362. insertAfter: "after",
  10363. replaceAll: "replaceWith"
  10364. }, function( name, original ) {
  10365. jQuery.fn[ name ] = function( selector ) {
  10366. var elems,
  10367. ret = [],
  10368. insert = jQuery( selector ),
  10369. last = insert.length - 1,
  10370. i = 0;
  10371. for ( ; i <= last; i++ ) {
  10372. elems = i === last ? this : this.clone( true );
  10373. jQuery( insert[ i ] )[ original ]( elems );
  10374. // Support: Android <=4.0 only, PhantomJS 1 only
  10375. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  10376. push.apply( ret, elems.get() );
  10377. }
  10378. return this.pushStack( ret );
  10379. };
  10380. } );
  10381. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  10382. var getStyles = function( elem ) {
  10383. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  10384. // IE throws on elements created in popups
  10385. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  10386. var view = elem.ownerDocument.defaultView;
  10387. if ( !view || !view.opener ) {
  10388. view = window;
  10389. }
  10390. return view.getComputedStyle( elem );
  10391. };
  10392. var swap = function( elem, options, callback ) {
  10393. var ret, name,
  10394. old = {};
  10395. // Remember the old values, and insert the new ones
  10396. for ( name in options ) {
  10397. old[ name ] = elem.style[ name ];
  10398. elem.style[ name ] = options[ name ];
  10399. }
  10400. ret = callback.call( elem );
  10401. // Revert the old values
  10402. for ( name in options ) {
  10403. elem.style[ name ] = old[ name ];
  10404. }
  10405. return ret;
  10406. };
  10407. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  10408. ( function() {
  10409. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  10410. // so they're executed at the same time to save the second computation.
  10411. function computeStyleTests() {
  10412. // This is a singleton, we need to execute it only once
  10413. if ( !div ) {
  10414. return;
  10415. }
  10416. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  10417. "margin-top:1px;padding:0;border:0";
  10418. div.style.cssText =
  10419. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  10420. "margin:auto;border:1px;padding:1px;" +
  10421. "width:60%;top:1%";
  10422. documentElement.appendChild( container ).appendChild( div );
  10423. var divStyle = window.getComputedStyle( div );
  10424. pixelPositionVal = divStyle.top !== "1%";
  10425. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  10426. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  10427. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  10428. // Some styles come back with percentage values, even though they shouldn't
  10429. div.style.right = "60%";
  10430. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  10431. // Support: IE 9 - 11 only
  10432. // Detect misreporting of content dimensions for box-sizing:border-box elements
  10433. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  10434. // Support: IE 9 only
  10435. // Detect overflow:scroll screwiness (gh-3699)
  10436. // Support: Chrome <=64
  10437. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  10438. div.style.position = "absolute";
  10439. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  10440. documentElement.removeChild( container );
  10441. // Nullify the div so it wouldn't be stored in the memory and
  10442. // it will also be a sign that checks already performed
  10443. div = null;
  10444. }
  10445. function roundPixelMeasures( measure ) {
  10446. return Math.round( parseFloat( measure ) );
  10447. }
  10448. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  10449. reliableTrDimensionsVal, reliableMarginLeftVal,
  10450. container = document.createElement( "div" ),
  10451. div = document.createElement( "div" );
  10452. // Finish early in limited (non-browser) environments
  10453. if ( !div.style ) {
  10454. return;
  10455. }
  10456. // Support: IE <=9 - 11 only
  10457. // Style of cloned element affects source element cloned (#8908)
  10458. div.style.backgroundClip = "content-box";
  10459. div.cloneNode( true ).style.backgroundClip = "";
  10460. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  10461. jQuery.extend( support, {
  10462. boxSizingReliable: function() {
  10463. computeStyleTests();
  10464. return boxSizingReliableVal;
  10465. },
  10466. pixelBoxStyles: function() {
  10467. computeStyleTests();
  10468. return pixelBoxStylesVal;
  10469. },
  10470. pixelPosition: function() {
  10471. computeStyleTests();
  10472. return pixelPositionVal;
  10473. },
  10474. reliableMarginLeft: function() {
  10475. computeStyleTests();
  10476. return reliableMarginLeftVal;
  10477. },
  10478. scrollboxSize: function() {
  10479. computeStyleTests();
  10480. return scrollboxSizeVal;
  10481. },
  10482. // Support: IE 9 - 11+, Edge 15 - 18+
  10483. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10484. // set in CSS while `offset*` properties report correct values.
  10485. // Behavior in IE 9 is more subtle than in newer versions & it passes
  10486. // some versions of this test; make sure not to make it pass there!
  10487. reliableTrDimensions: function() {
  10488. var table, tr, trChild, trStyle;
  10489. if ( reliableTrDimensionsVal == null ) {
  10490. table = document.createElement( "table" );
  10491. tr = document.createElement( "tr" );
  10492. trChild = document.createElement( "div" );
  10493. table.style.cssText = "position:absolute;left:-11111px";
  10494. tr.style.height = "1px";
  10495. trChild.style.height = "9px";
  10496. documentElement
  10497. .appendChild( table )
  10498. .appendChild( tr )
  10499. .appendChild( trChild );
  10500. trStyle = window.getComputedStyle( tr );
  10501. reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
  10502. documentElement.removeChild( table );
  10503. }
  10504. return reliableTrDimensionsVal;
  10505. }
  10506. } );
  10507. } )();
  10508. function curCSS( elem, name, computed ) {
  10509. var width, minWidth, maxWidth, ret,
  10510. // Support: Firefox 51+
  10511. // Retrieving style before computed somehow
  10512. // fixes an issue with getting wrong values
  10513. // on detached elements
  10514. style = elem.style;
  10515. computed = computed || getStyles( elem );
  10516. // getPropertyValue is needed for:
  10517. // .css('filter') (IE 9 only, #12537)
  10518. // .css('--customProperty) (#3144)
  10519. if ( computed ) {
  10520. ret = computed.getPropertyValue( name ) || computed[ name ];
  10521. if ( ret === "" && !isAttached( elem ) ) {
  10522. ret = jQuery.style( elem, name );
  10523. }
  10524. // A tribute to the "awesome hack by Dean Edwards"
  10525. // Android Browser returns percentage for some values,
  10526. // but width seems to be reliably pixels.
  10527. // This is against the CSSOM draft spec:
  10528. // https://drafts.csswg.org/cssom/#resolved-values
  10529. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10530. // Remember the original values
  10531. width = style.width;
  10532. minWidth = style.minWidth;
  10533. maxWidth = style.maxWidth;
  10534. // Put in the new values to get a computed value out
  10535. style.minWidth = style.maxWidth = style.width = ret;
  10536. ret = computed.width;
  10537. // Revert the changed values
  10538. style.width = width;
  10539. style.minWidth = minWidth;
  10540. style.maxWidth = maxWidth;
  10541. }
  10542. }
  10543. return ret !== undefined ?
  10544. // Support: IE <=9 - 11 only
  10545. // IE returns zIndex value as an integer.
  10546. ret + "" :
  10547. ret;
  10548. }
  10549. function addGetHookIf( conditionFn, hookFn ) {
  10550. // Define the hook, we'll check on the first run if it's really needed.
  10551. return {
  10552. get: function() {
  10553. if ( conditionFn() ) {
  10554. // Hook not needed (or it's not possible to use it due
  10555. // to missing dependency), remove it.
  10556. delete this.get;
  10557. return;
  10558. }
  10559. // Hook needed; redefine it so that the support test is not executed again.
  10560. return ( this.get = hookFn ).apply( this, arguments );
  10561. }
  10562. };
  10563. }
  10564. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10565. emptyStyle = document.createElement( "div" ).style,
  10566. vendorProps = {};
  10567. // Return a vendor-prefixed property or undefined
  10568. function vendorPropName( name ) {
  10569. // Check for vendor prefixed names
  10570. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10571. i = cssPrefixes.length;
  10572. while ( i-- ) {
  10573. name = cssPrefixes[ i ] + capName;
  10574. if ( name in emptyStyle ) {
  10575. return name;
  10576. }
  10577. }
  10578. }
  10579. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  10580. function finalPropName( name ) {
  10581. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  10582. if ( final ) {
  10583. return final;
  10584. }
  10585. if ( name in emptyStyle ) {
  10586. return name;
  10587. }
  10588. return vendorProps[ name ] = vendorPropName( name ) || name;
  10589. }
  10590. var
  10591. // Swappable if display is none or starts with table
  10592. // except "table", "table-cell", or "table-caption"
  10593. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10594. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10595. rcustomProp = /^--/,
  10596. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10597. cssNormalTransform = {
  10598. letterSpacing: "0",
  10599. fontWeight: "400"
  10600. };
  10601. function setPositiveNumber( _elem, value, subtract ) {
  10602. // Any relative (+/-) values have already been
  10603. // normalized at this point
  10604. var matches = rcssNum.exec( value );
  10605. return matches ?
  10606. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10607. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10608. value;
  10609. }
  10610. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10611. var i = dimension === "width" ? 1 : 0,
  10612. extra = 0,
  10613. delta = 0;
  10614. // Adjustment may not be necessary
  10615. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10616. return 0;
  10617. }
  10618. for ( ; i < 4; i += 2 ) {
  10619. // Both box models exclude margin
  10620. if ( box === "margin" ) {
  10621. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10622. }
  10623. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10624. if ( !isBorderBox ) {
  10625. // Add padding
  10626. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10627. // For "border" or "margin", add border
  10628. if ( box !== "padding" ) {
  10629. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10630. // But still keep track of it otherwise
  10631. } else {
  10632. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10633. }
  10634. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10635. // "padding" or "margin"
  10636. } else {
  10637. // For "content", subtract padding
  10638. if ( box === "content" ) {
  10639. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10640. }
  10641. // For "content" or "padding", subtract border
  10642. if ( box !== "margin" ) {
  10643. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10644. }
  10645. }
  10646. }
  10647. // Account for positive content-box scroll gutter when requested by providing computedVal
  10648. if ( !isBorderBox && computedVal >= 0 ) {
  10649. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10650. // Assuming integer scroll gutter, subtract the rest and round down
  10651. delta += Math.max( 0, Math.ceil(
  10652. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10653. computedVal -
  10654. delta -
  10655. extra -
  10656. 0.5
  10657. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  10658. // Use an explicit zero to avoid NaN (gh-3964)
  10659. ) ) || 0;
  10660. }
  10661. return delta;
  10662. }
  10663. function getWidthOrHeight( elem, dimension, extra ) {
  10664. // Start with computed style
  10665. var styles = getStyles( elem ),
  10666. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  10667. // Fake content-box until we know it's needed to know the true value.
  10668. boxSizingNeeded = !support.boxSizingReliable() || extra,
  10669. isBorderBox = boxSizingNeeded &&
  10670. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10671. valueIsBorderBox = isBorderBox,
  10672. val = curCSS( elem, dimension, styles ),
  10673. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  10674. // Support: Firefox <=54
  10675. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10676. if ( rnumnonpx.test( val ) ) {
  10677. if ( !extra ) {
  10678. return val;
  10679. }
  10680. val = "auto";
  10681. }
  10682. // Support: IE 9 - 11 only
  10683. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  10684. // In those cases, the computed value can be trusted to be border-box.
  10685. if ( ( !support.boxSizingReliable() && isBorderBox ||
  10686. // Support: IE 10 - 11+, Edge 15 - 18+
  10687. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  10688. // set in CSS while `offset*` properties report correct values.
  10689. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  10690. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  10691. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10692. // This happens for inline elements with no explicit setting (gh-3571)
  10693. val === "auto" ||
  10694. // Support: Android <=4.1 - 4.3 only
  10695. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10696. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  10697. // Make sure the element is visible & connected
  10698. elem.getClientRects().length ) {
  10699. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  10700. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  10701. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  10702. // retrieved value as a content box dimension.
  10703. valueIsBorderBox = offsetProp in elem;
  10704. if ( valueIsBorderBox ) {
  10705. val = elem[ offsetProp ];
  10706. }
  10707. }
  10708. // Normalize "" and auto
  10709. val = parseFloat( val ) || 0;
  10710. // Adjust for the element's box model
  10711. return ( val +
  10712. boxModelAdjustment(
  10713. elem,
  10714. dimension,
  10715. extra || ( isBorderBox ? "border" : "content" ),
  10716. valueIsBorderBox,
  10717. styles,
  10718. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10719. val
  10720. )
  10721. ) + "px";
  10722. }
  10723. jQuery.extend( {
  10724. // Add in style property hooks for overriding the default
  10725. // behavior of getting and setting a style property
  10726. cssHooks: {
  10727. opacity: {
  10728. get: function( elem, computed ) {
  10729. if ( computed ) {
  10730. // We should always get a number back from opacity
  10731. var ret = curCSS( elem, "opacity" );
  10732. return ret === "" ? "1" : ret;
  10733. }
  10734. }
  10735. }
  10736. },
  10737. // Don't automatically add "px" to these possibly-unitless properties
  10738. cssNumber: {
  10739. "animationIterationCount": true,
  10740. "columnCount": true,
  10741. "fillOpacity": true,
  10742. "flexGrow": true,
  10743. "flexShrink": true,
  10744. "fontWeight": true,
  10745. "gridArea": true,
  10746. "gridColumn": true,
  10747. "gridColumnEnd": true,
  10748. "gridColumnStart": true,
  10749. "gridRow": true,
  10750. "gridRowEnd": true,
  10751. "gridRowStart": true,
  10752. "lineHeight": true,
  10753. "opacity": true,
  10754. "order": true,
  10755. "orphans": true,
  10756. "widows": true,
  10757. "zIndex": true,
  10758. "zoom": true
  10759. },
  10760. // Add in properties whose names you wish to fix before
  10761. // setting or getting the value
  10762. cssProps: {},
  10763. // Get and set the style property on a DOM Node
  10764. style: function( elem, name, value, extra ) {
  10765. // Don't set styles on text and comment nodes
  10766. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10767. return;
  10768. }
  10769. // Make sure that we're working with the right name
  10770. var ret, type, hooks,
  10771. origName = camelCase( name ),
  10772. isCustomProp = rcustomProp.test( name ),
  10773. style = elem.style;
  10774. // Make sure that we're working with the right name. We don't
  10775. // want to query the value if it is a CSS custom property
  10776. // since they are user-defined.
  10777. if ( !isCustomProp ) {
  10778. name = finalPropName( origName );
  10779. }
  10780. // Gets hook for the prefixed version, then unprefixed version
  10781. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10782. // Check if we're setting a value
  10783. if ( value !== undefined ) {
  10784. type = typeof value;
  10785. // Convert "+=" or "-=" to relative numbers (#7345)
  10786. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10787. value = adjustCSS( elem, name, ret );
  10788. // Fixes bug #9237
  10789. type = "number";
  10790. }
  10791. // Make sure that null and NaN values aren't set (#7116)
  10792. if ( value == null || value !== value ) {
  10793. return;
  10794. }
  10795. // If a number was passed in, add the unit (except for certain CSS properties)
  10796. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  10797. // "px" to a few hardcoded values.
  10798. if ( type === "number" && !isCustomProp ) {
  10799. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10800. }
  10801. // background-* props affect original clone's values
  10802. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10803. style[ name ] = "inherit";
  10804. }
  10805. // If a hook was provided, use that value, otherwise just set the specified value
  10806. if ( !hooks || !( "set" in hooks ) ||
  10807. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10808. if ( isCustomProp ) {
  10809. style.setProperty( name, value );
  10810. } else {
  10811. style[ name ] = value;
  10812. }
  10813. }
  10814. } else {
  10815. // If a hook was provided get the non-computed value from there
  10816. if ( hooks && "get" in hooks &&
  10817. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10818. return ret;
  10819. }
  10820. // Otherwise just get the value from the style object
  10821. return style[ name ];
  10822. }
  10823. },
  10824. css: function( elem, name, extra, styles ) {
  10825. var val, num, hooks,
  10826. origName = camelCase( name ),
  10827. isCustomProp = rcustomProp.test( name );
  10828. // Make sure that we're working with the right name. We don't
  10829. // want to modify the value if it is a CSS custom property
  10830. // since they are user-defined.
  10831. if ( !isCustomProp ) {
  10832. name = finalPropName( origName );
  10833. }
  10834. // Try prefixed name followed by the unprefixed name
  10835. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10836. // If a hook was provided get the computed value from there
  10837. if ( hooks && "get" in hooks ) {
  10838. val = hooks.get( elem, true, extra );
  10839. }
  10840. // Otherwise, if a way to get the computed value exists, use that
  10841. if ( val === undefined ) {
  10842. val = curCSS( elem, name, styles );
  10843. }
  10844. // Convert "normal" to computed value
  10845. if ( val === "normal" && name in cssNormalTransform ) {
  10846. val = cssNormalTransform[ name ];
  10847. }
  10848. // Make numeric if forced or a qualifier was provided and val looks numeric
  10849. if ( extra === "" || extra ) {
  10850. num = parseFloat( val );
  10851. return extra === true || isFinite( num ) ? num || 0 : val;
  10852. }
  10853. return val;
  10854. }
  10855. } );
  10856. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  10857. jQuery.cssHooks[ dimension ] = {
  10858. get: function( elem, computed, extra ) {
  10859. if ( computed ) {
  10860. // Certain elements can have dimension info if we invisibly show them
  10861. // but it must have a current display style that would benefit
  10862. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10863. // Support: Safari 8+
  10864. // Table columns in Safari have non-zero offsetWidth & zero
  10865. // getBoundingClientRect().width unless display is changed.
  10866. // Support: IE <=11 only
  10867. // Running getBoundingClientRect on a disconnected node
  10868. // in IE throws an error.
  10869. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10870. swap( elem, cssShow, function() {
  10871. return getWidthOrHeight( elem, dimension, extra );
  10872. } ) :
  10873. getWidthOrHeight( elem, dimension, extra );
  10874. }
  10875. },
  10876. set: function( elem, value, extra ) {
  10877. var matches,
  10878. styles = getStyles( elem ),
  10879. // Only read styles.position if the test has a chance to fail
  10880. // to avoid forcing a reflow.
  10881. scrollboxSizeBuggy = !support.scrollboxSize() &&
  10882. styles.position === "absolute",
  10883. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  10884. boxSizingNeeded = scrollboxSizeBuggy || extra,
  10885. isBorderBox = boxSizingNeeded &&
  10886. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10887. subtract = extra ?
  10888. boxModelAdjustment(
  10889. elem,
  10890. dimension,
  10891. extra,
  10892. isBorderBox,
  10893. styles
  10894. ) :
  10895. 0;
  10896. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10897. // faking a content-box to get border and padding (gh-3699)
  10898. if ( isBorderBox && scrollboxSizeBuggy ) {
  10899. subtract -= Math.ceil(
  10900. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10901. parseFloat( styles[ dimension ] ) -
  10902. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10903. 0.5
  10904. );
  10905. }
  10906. // Convert to pixels if value adjustment is needed
  10907. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10908. ( matches[ 3 ] || "px" ) !== "px" ) {
  10909. elem.style[ dimension ] = value;
  10910. value = jQuery.css( elem, dimension );
  10911. }
  10912. return setPositiveNumber( elem, value, subtract );
  10913. }
  10914. };
  10915. } );
  10916. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10917. function( elem, computed ) {
  10918. if ( computed ) {
  10919. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10920. elem.getBoundingClientRect().left -
  10921. swap( elem, { marginLeft: 0 }, function() {
  10922. return elem.getBoundingClientRect().left;
  10923. } )
  10924. ) + "px";
  10925. }
  10926. }
  10927. );
  10928. // These hooks are used by animate to expand properties
  10929. jQuery.each( {
  10930. margin: "",
  10931. padding: "",
  10932. border: "Width"
  10933. }, function( prefix, suffix ) {
  10934. jQuery.cssHooks[ prefix + suffix ] = {
  10935. expand: function( value ) {
  10936. var i = 0,
  10937. expanded = {},
  10938. // Assumes a single number if not a string
  10939. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10940. for ( ; i < 4; i++ ) {
  10941. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10942. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10943. }
  10944. return expanded;
  10945. }
  10946. };
  10947. if ( prefix !== "margin" ) {
  10948. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10949. }
  10950. } );
  10951. jQuery.fn.extend( {
  10952. css: function( name, value ) {
  10953. return access( this, function( elem, name, value ) {
  10954. var styles, len,
  10955. map = {},
  10956. i = 0;
  10957. if ( Array.isArray( name ) ) {
  10958. styles = getStyles( elem );
  10959. len = name.length;
  10960. for ( ; i < len; i++ ) {
  10961. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10962. }
  10963. return map;
  10964. }
  10965. return value !== undefined ?
  10966. jQuery.style( elem, name, value ) :
  10967. jQuery.css( elem, name );
  10968. }, name, value, arguments.length > 1 );
  10969. }
  10970. } );
  10971. function Tween( elem, options, prop, end, easing ) {
  10972. return new Tween.prototype.init( elem, options, prop, end, easing );
  10973. }
  10974. jQuery.Tween = Tween;
  10975. Tween.prototype = {
  10976. constructor: Tween,
  10977. init: function( elem, options, prop, end, easing, unit ) {
  10978. this.elem = elem;
  10979. this.prop = prop;
  10980. this.easing = easing || jQuery.easing._default;
  10981. this.options = options;
  10982. this.start = this.now = this.cur();
  10983. this.end = end;
  10984. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10985. },
  10986. cur: function() {
  10987. var hooks = Tween.propHooks[ this.prop ];
  10988. return hooks && hooks.get ?
  10989. hooks.get( this ) :
  10990. Tween.propHooks._default.get( this );
  10991. },
  10992. run: function( percent ) {
  10993. var eased,
  10994. hooks = Tween.propHooks[ this.prop ];
  10995. if ( this.options.duration ) {
  10996. this.pos = eased = jQuery.easing[ this.easing ](
  10997. percent, this.options.duration * percent, 0, 1, this.options.duration
  10998. );
  10999. } else {
  11000. this.pos = eased = percent;
  11001. }
  11002. this.now = ( this.end - this.start ) * eased + this.start;
  11003. if ( this.options.step ) {
  11004. this.options.step.call( this.elem, this.now, this );
  11005. }
  11006. if ( hooks && hooks.set ) {
  11007. hooks.set( this );
  11008. } else {
  11009. Tween.propHooks._default.set( this );
  11010. }
  11011. return this;
  11012. }
  11013. };
  11014. Tween.prototype.init.prototype = Tween.prototype;
  11015. Tween.propHooks = {
  11016. _default: {
  11017. get: function( tween ) {
  11018. var result;
  11019. // Use a property on the element directly when it is not a DOM element,
  11020. // or when there is no matching style property that exists.
  11021. if ( tween.elem.nodeType !== 1 ||
  11022. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  11023. return tween.elem[ tween.prop ];
  11024. }
  11025. // Passing an empty string as a 3rd parameter to .css will automatically
  11026. // attempt a parseFloat and fallback to a string if the parse fails.
  11027. // Simple values such as "10px" are parsed to Float;
  11028. // complex values such as "rotate(1rad)" are returned as-is.
  11029. result = jQuery.css( tween.elem, tween.prop, "" );
  11030. // Empty strings, null, undefined and "auto" are converted to 0.
  11031. return !result || result === "auto" ? 0 : result;
  11032. },
  11033. set: function( tween ) {
  11034. // Use step hook for back compat.
  11035. // Use cssHook if its there.
  11036. // Use .style if available and use plain properties where available.
  11037. if ( jQuery.fx.step[ tween.prop ] ) {
  11038. jQuery.fx.step[ tween.prop ]( tween );
  11039. } else if ( tween.elem.nodeType === 1 && (
  11040. jQuery.cssHooks[ tween.prop ] ||
  11041. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  11042. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  11043. } else {
  11044. tween.elem[ tween.prop ] = tween.now;
  11045. }
  11046. }
  11047. }
  11048. };
  11049. // Support: IE <=9 only
  11050. // Panic based approach to setting things on disconnected nodes
  11051. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  11052. set: function( tween ) {
  11053. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  11054. tween.elem[ tween.prop ] = tween.now;
  11055. }
  11056. }
  11057. };
  11058. jQuery.easing = {
  11059. linear: function( p ) {
  11060. return p;
  11061. },
  11062. swing: function( p ) {
  11063. return 0.5 - Math.cos( p * Math.PI ) / 2;
  11064. },
  11065. _default: "swing"
  11066. };
  11067. jQuery.fx = Tween.prototype.init;
  11068. // Back compat <1.8 extension point
  11069. jQuery.fx.step = {};
  11070. var
  11071. fxNow, inProgress,
  11072. rfxtypes = /^(?:toggle|show|hide)$/,
  11073. rrun = /queueHooks$/;
  11074. function schedule() {
  11075. if ( inProgress ) {
  11076. if ( document.hidden === false && window.requestAnimationFrame ) {
  11077. window.requestAnimationFrame( schedule );
  11078. } else {
  11079. window.setTimeout( schedule, jQuery.fx.interval );
  11080. }
  11081. jQuery.fx.tick();
  11082. }
  11083. }
  11084. // Animations created synchronously will run synchronously
  11085. function createFxNow() {
  11086. window.setTimeout( function() {
  11087. fxNow = undefined;
  11088. } );
  11089. return ( fxNow = Date.now() );
  11090. }
  11091. // Generate parameters to create a standard animation
  11092. function genFx( type, includeWidth ) {
  11093. var which,
  11094. i = 0,
  11095. attrs = { height: type };
  11096. // If we include width, step value is 1 to do all cssExpand values,
  11097. // otherwise step value is 2 to skip over Left and Right
  11098. includeWidth = includeWidth ? 1 : 0;
  11099. for ( ; i < 4; i += 2 - includeWidth ) {
  11100. which = cssExpand[ i ];
  11101. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  11102. }
  11103. if ( includeWidth ) {
  11104. attrs.opacity = attrs.width = type;
  11105. }
  11106. return attrs;
  11107. }
  11108. function createTween( value, prop, animation ) {
  11109. var tween,
  11110. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  11111. index = 0,
  11112. length = collection.length;
  11113. for ( ; index < length; index++ ) {
  11114. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  11115. // We're done with this property
  11116. return tween;
  11117. }
  11118. }
  11119. }
  11120. function defaultPrefilter( elem, props, opts ) {
  11121. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  11122. isBox = "width" in props || "height" in props,
  11123. anim = this,
  11124. orig = {},
  11125. style = elem.style,
  11126. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  11127. dataShow = dataPriv.get( elem, "fxshow" );
  11128. // Queue-skipping animations hijack the fx hooks
  11129. if ( !opts.queue ) {
  11130. hooks = jQuery._queueHooks( elem, "fx" );
  11131. if ( hooks.unqueued == null ) {
  11132. hooks.unqueued = 0;
  11133. oldfire = hooks.empty.fire;
  11134. hooks.empty.fire = function() {
  11135. if ( !hooks.unqueued ) {
  11136. oldfire();
  11137. }
  11138. };
  11139. }
  11140. hooks.unqueued++;
  11141. anim.always( function() {
  11142. // Ensure the complete handler is called before this completes
  11143. anim.always( function() {
  11144. hooks.unqueued--;
  11145. if ( !jQuery.queue( elem, "fx" ).length ) {
  11146. hooks.empty.fire();
  11147. }
  11148. } );
  11149. } );
  11150. }
  11151. // Detect show/hide animations
  11152. for ( prop in props ) {
  11153. value = props[ prop ];
  11154. if ( rfxtypes.test( value ) ) {
  11155. delete props[ prop ];
  11156. toggle = toggle || value === "toggle";
  11157. if ( value === ( hidden ? "hide" : "show" ) ) {
  11158. // Pretend to be hidden if this is a "show" and
  11159. // there is still data from a stopped show/hide
  11160. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  11161. hidden = true;
  11162. // Ignore all other no-op show/hide data
  11163. } else {
  11164. continue;
  11165. }
  11166. }
  11167. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  11168. }
  11169. }
  11170. // Bail out if this is a no-op like .hide().hide()
  11171. propTween = !jQuery.isEmptyObject( props );
  11172. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  11173. return;
  11174. }
  11175. // Restrict "overflow" and "display" styles during box animations
  11176. if ( isBox && elem.nodeType === 1 ) {
  11177. // Support: IE <=9 - 11, Edge 12 - 15
  11178. // Record all 3 overflow attributes because IE does not infer the shorthand
  11179. // from identically-valued overflowX and overflowY and Edge just mirrors
  11180. // the overflowX value there.
  11181. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  11182. // Identify a display type, preferring old show/hide data over the CSS cascade
  11183. restoreDisplay = dataShow && dataShow.display;
  11184. if ( restoreDisplay == null ) {
  11185. restoreDisplay = dataPriv.get( elem, "display" );
  11186. }
  11187. display = jQuery.css( elem, "display" );
  11188. if ( display === "none" ) {
  11189. if ( restoreDisplay ) {
  11190. display = restoreDisplay;
  11191. } else {
  11192. // Get nonempty value(s) by temporarily forcing visibility
  11193. showHide( [ elem ], true );
  11194. restoreDisplay = elem.style.display || restoreDisplay;
  11195. display = jQuery.css( elem, "display" );
  11196. showHide( [ elem ] );
  11197. }
  11198. }
  11199. // Animate inline elements as inline-block
  11200. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  11201. if ( jQuery.css( elem, "float" ) === "none" ) {
  11202. // Restore the original display value at the end of pure show/hide animations
  11203. if ( !propTween ) {
  11204. anim.done( function() {
  11205. style.display = restoreDisplay;
  11206. } );
  11207. if ( restoreDisplay == null ) {
  11208. display = style.display;
  11209. restoreDisplay = display === "none" ? "" : display;
  11210. }
  11211. }
  11212. style.display = "inline-block";
  11213. }
  11214. }
  11215. }
  11216. if ( opts.overflow ) {
  11217. style.overflow = "hidden";
  11218. anim.always( function() {
  11219. style.overflow = opts.overflow[ 0 ];
  11220. style.overflowX = opts.overflow[ 1 ];
  11221. style.overflowY = opts.overflow[ 2 ];
  11222. } );
  11223. }
  11224. // Implement show/hide animations
  11225. propTween = false;
  11226. for ( prop in orig ) {
  11227. // General show/hide setup for this element animation
  11228. if ( !propTween ) {
  11229. if ( dataShow ) {
  11230. if ( "hidden" in dataShow ) {
  11231. hidden = dataShow.hidden;
  11232. }
  11233. } else {
  11234. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  11235. }
  11236. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  11237. if ( toggle ) {
  11238. dataShow.hidden = !hidden;
  11239. }
  11240. // Show elements before animating them
  11241. if ( hidden ) {
  11242. showHide( [ elem ], true );
  11243. }
  11244. /* eslint-disable no-loop-func */
  11245. anim.done( function() {
  11246. /* eslint-enable no-loop-func */
  11247. // The final step of a "hide" animation is actually hiding the element
  11248. if ( !hidden ) {
  11249. showHide( [ elem ] );
  11250. }
  11251. dataPriv.remove( elem, "fxshow" );
  11252. for ( prop in orig ) {
  11253. jQuery.style( elem, prop, orig[ prop ] );
  11254. }
  11255. } );
  11256. }
  11257. // Per-property setup
  11258. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  11259. if ( !( prop in dataShow ) ) {
  11260. dataShow[ prop ] = propTween.start;
  11261. if ( hidden ) {
  11262. propTween.end = propTween.start;
  11263. propTween.start = 0;
  11264. }
  11265. }
  11266. }
  11267. }
  11268. function propFilter( props, specialEasing ) {
  11269. var index, name, easing, value, hooks;
  11270. // camelCase, specialEasing and expand cssHook pass
  11271. for ( index in props ) {
  11272. name = camelCase( index );
  11273. easing = specialEasing[ name ];
  11274. value = props[ index ];
  11275. if ( Array.isArray( value ) ) {
  11276. easing = value[ 1 ];
  11277. value = props[ index ] = value[ 0 ];
  11278. }
  11279. if ( index !== name ) {
  11280. props[ name ] = value;
  11281. delete props[ index ];
  11282. }
  11283. hooks = jQuery.cssHooks[ name ];
  11284. if ( hooks && "expand" in hooks ) {
  11285. value = hooks.expand( value );
  11286. delete props[ name ];
  11287. // Not quite $.extend, this won't overwrite existing keys.
  11288. // Reusing 'index' because we have the correct "name"
  11289. for ( index in value ) {
  11290. if ( !( index in props ) ) {
  11291. props[ index ] = value[ index ];
  11292. specialEasing[ index ] = easing;
  11293. }
  11294. }
  11295. } else {
  11296. specialEasing[ name ] = easing;
  11297. }
  11298. }
  11299. }
  11300. function Animation( elem, properties, options ) {
  11301. var result,
  11302. stopped,
  11303. index = 0,
  11304. length = Animation.prefilters.length,
  11305. deferred = jQuery.Deferred().always( function() {
  11306. // Don't match elem in the :animated selector
  11307. delete tick.elem;
  11308. } ),
  11309. tick = function() {
  11310. if ( stopped ) {
  11311. return false;
  11312. }
  11313. var currentTime = fxNow || createFxNow(),
  11314. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  11315. // Support: Android 2.3 only
  11316. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  11317. temp = remaining / animation.duration || 0,
  11318. percent = 1 - temp,
  11319. index = 0,
  11320. length = animation.tweens.length;
  11321. for ( ; index < length; index++ ) {
  11322. animation.tweens[ index ].run( percent );
  11323. }
  11324. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  11325. // If there's more to do, yield
  11326. if ( percent < 1 && length ) {
  11327. return remaining;
  11328. }
  11329. // If this was an empty animation, synthesize a final progress notification
  11330. if ( !length ) {
  11331. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11332. }
  11333. // Resolve the animation and report its conclusion
  11334. deferred.resolveWith( elem, [ animation ] );
  11335. return false;
  11336. },
  11337. animation = deferred.promise( {
  11338. elem: elem,
  11339. props: jQuery.extend( {}, properties ),
  11340. opts: jQuery.extend( true, {
  11341. specialEasing: {},
  11342. easing: jQuery.easing._default
  11343. }, options ),
  11344. originalProperties: properties,
  11345. originalOptions: options,
  11346. startTime: fxNow || createFxNow(),
  11347. duration: options.duration,
  11348. tweens: [],
  11349. createTween: function( prop, end ) {
  11350. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  11351. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  11352. animation.tweens.push( tween );
  11353. return tween;
  11354. },
  11355. stop: function( gotoEnd ) {
  11356. var index = 0,
  11357. // If we are going to the end, we want to run all the tweens
  11358. // otherwise we skip this part
  11359. length = gotoEnd ? animation.tweens.length : 0;
  11360. if ( stopped ) {
  11361. return this;
  11362. }
  11363. stopped = true;
  11364. for ( ; index < length; index++ ) {
  11365. animation.tweens[ index ].run( 1 );
  11366. }
  11367. // Resolve when we played the last frame; otherwise, reject
  11368. if ( gotoEnd ) {
  11369. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11370. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  11371. } else {
  11372. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  11373. }
  11374. return this;
  11375. }
  11376. } ),
  11377. props = animation.props;
  11378. propFilter( props, animation.opts.specialEasing );
  11379. for ( ; index < length; index++ ) {
  11380. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  11381. if ( result ) {
  11382. if ( isFunction( result.stop ) ) {
  11383. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  11384. result.stop.bind( result );
  11385. }
  11386. return result;
  11387. }
  11388. }
  11389. jQuery.map( props, createTween, animation );
  11390. if ( isFunction( animation.opts.start ) ) {
  11391. animation.opts.start.call( elem, animation );
  11392. }
  11393. // Attach callbacks from options
  11394. animation
  11395. .progress( animation.opts.progress )
  11396. .done( animation.opts.done, animation.opts.complete )
  11397. .fail( animation.opts.fail )
  11398. .always( animation.opts.always );
  11399. jQuery.fx.timer(
  11400. jQuery.extend( tick, {
  11401. elem: elem,
  11402. anim: animation,
  11403. queue: animation.opts.queue
  11404. } )
  11405. );
  11406. return animation;
  11407. }
  11408. jQuery.Animation = jQuery.extend( Animation, {
  11409. tweeners: {
  11410. "*": [ function( prop, value ) {
  11411. var tween = this.createTween( prop, value );
  11412. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  11413. return tween;
  11414. } ]
  11415. },
  11416. tweener: function( props, callback ) {
  11417. if ( isFunction( props ) ) {
  11418. callback = props;
  11419. props = [ "*" ];
  11420. } else {
  11421. props = props.match( rnothtmlwhite );
  11422. }
  11423. var prop,
  11424. index = 0,
  11425. length = props.length;
  11426. for ( ; index < length; index++ ) {
  11427. prop = props[ index ];
  11428. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  11429. Animation.tweeners[ prop ].unshift( callback );
  11430. }
  11431. },
  11432. prefilters: [ defaultPrefilter ],
  11433. prefilter: function( callback, prepend ) {
  11434. if ( prepend ) {
  11435. Animation.prefilters.unshift( callback );
  11436. } else {
  11437. Animation.prefilters.push( callback );
  11438. }
  11439. }
  11440. } );
  11441. jQuery.speed = function( speed, easing, fn ) {
  11442. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  11443. complete: fn || !fn && easing ||
  11444. isFunction( speed ) && speed,
  11445. duration: speed,
  11446. easing: fn && easing || easing && !isFunction( easing ) && easing
  11447. };
  11448. // Go to the end state if fx are off
  11449. if ( jQuery.fx.off ) {
  11450. opt.duration = 0;
  11451. } else {
  11452. if ( typeof opt.duration !== "number" ) {
  11453. if ( opt.duration in jQuery.fx.speeds ) {
  11454. opt.duration = jQuery.fx.speeds[ opt.duration ];
  11455. } else {
  11456. opt.duration = jQuery.fx.speeds._default;
  11457. }
  11458. }
  11459. }
  11460. // Normalize opt.queue - true/undefined/null -> "fx"
  11461. if ( opt.queue == null || opt.queue === true ) {
  11462. opt.queue = "fx";
  11463. }
  11464. // Queueing
  11465. opt.old = opt.complete;
  11466. opt.complete = function() {
  11467. if ( isFunction( opt.old ) ) {
  11468. opt.old.call( this );
  11469. }
  11470. if ( opt.queue ) {
  11471. jQuery.dequeue( this, opt.queue );
  11472. }
  11473. };
  11474. return opt;
  11475. };
  11476. jQuery.fn.extend( {
  11477. fadeTo: function( speed, to, easing, callback ) {
  11478. // Show any hidden elements after setting opacity to 0
  11479. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  11480. // Animate to the value specified
  11481. .end().animate( { opacity: to }, speed, easing, callback );
  11482. },
  11483. animate: function( prop, speed, easing, callback ) {
  11484. var empty = jQuery.isEmptyObject( prop ),
  11485. optall = jQuery.speed( speed, easing, callback ),
  11486. doAnimation = function() {
  11487. // Operate on a copy of prop so per-property easing won't be lost
  11488. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  11489. // Empty animations, or finishing resolves immediately
  11490. if ( empty || dataPriv.get( this, "finish" ) ) {
  11491. anim.stop( true );
  11492. }
  11493. };
  11494. doAnimation.finish = doAnimation;
  11495. return empty || optall.queue === false ?
  11496. this.each( doAnimation ) :
  11497. this.queue( optall.queue, doAnimation );
  11498. },
  11499. stop: function( type, clearQueue, gotoEnd ) {
  11500. var stopQueue = function( hooks ) {
  11501. var stop = hooks.stop;
  11502. delete hooks.stop;
  11503. stop( gotoEnd );
  11504. };
  11505. if ( typeof type !== "string" ) {
  11506. gotoEnd = clearQueue;
  11507. clearQueue = type;
  11508. type = undefined;
  11509. }
  11510. if ( clearQueue ) {
  11511. this.queue( type || "fx", [] );
  11512. }
  11513. return this.each( function() {
  11514. var dequeue = true,
  11515. index = type != null && type + "queueHooks",
  11516. timers = jQuery.timers,
  11517. data = dataPriv.get( this );
  11518. if ( index ) {
  11519. if ( data[ index ] && data[ index ].stop ) {
  11520. stopQueue( data[ index ] );
  11521. }
  11522. } else {
  11523. for ( index in data ) {
  11524. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  11525. stopQueue( data[ index ] );
  11526. }
  11527. }
  11528. }
  11529. for ( index = timers.length; index--; ) {
  11530. if ( timers[ index ].elem === this &&
  11531. ( type == null || timers[ index ].queue === type ) ) {
  11532. timers[ index ].anim.stop( gotoEnd );
  11533. dequeue = false;
  11534. timers.splice( index, 1 );
  11535. }
  11536. }
  11537. // Start the next in the queue if the last step wasn't forced.
  11538. // Timers currently will call their complete callbacks, which
  11539. // will dequeue but only if they were gotoEnd.
  11540. if ( dequeue || !gotoEnd ) {
  11541. jQuery.dequeue( this, type );
  11542. }
  11543. } );
  11544. },
  11545. finish: function( type ) {
  11546. if ( type !== false ) {
  11547. type = type || "fx";
  11548. }
  11549. return this.each( function() {
  11550. var index,
  11551. data = dataPriv.get( this ),
  11552. queue = data[ type + "queue" ],
  11553. hooks = data[ type + "queueHooks" ],
  11554. timers = jQuery.timers,
  11555. length = queue ? queue.length : 0;
  11556. // Enable finishing flag on private data
  11557. data.finish = true;
  11558. // Empty the queue first
  11559. jQuery.queue( this, type, [] );
  11560. if ( hooks && hooks.stop ) {
  11561. hooks.stop.call( this, true );
  11562. }
  11563. // Look for any active animations, and finish them
  11564. for ( index = timers.length; index--; ) {
  11565. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11566. timers[ index ].anim.stop( true );
  11567. timers.splice( index, 1 );
  11568. }
  11569. }
  11570. // Look for any animations in the old queue and finish them
  11571. for ( index = 0; index < length; index++ ) {
  11572. if ( queue[ index ] && queue[ index ].finish ) {
  11573. queue[ index ].finish.call( this );
  11574. }
  11575. }
  11576. // Turn off finishing flag
  11577. delete data.finish;
  11578. } );
  11579. }
  11580. } );
  11581. jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
  11582. var cssFn = jQuery.fn[ name ];
  11583. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11584. return speed == null || typeof speed === "boolean" ?
  11585. cssFn.apply( this, arguments ) :
  11586. this.animate( genFx( name, true ), speed, easing, callback );
  11587. };
  11588. } );
  11589. // Generate shortcuts for custom animations
  11590. jQuery.each( {
  11591. slideDown: genFx( "show" ),
  11592. slideUp: genFx( "hide" ),
  11593. slideToggle: genFx( "toggle" ),
  11594. fadeIn: { opacity: "show" },
  11595. fadeOut: { opacity: "hide" },
  11596. fadeToggle: { opacity: "toggle" }
  11597. }, function( name, props ) {
  11598. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11599. return this.animate( props, speed, easing, callback );
  11600. };
  11601. } );
  11602. jQuery.timers = [];
  11603. jQuery.fx.tick = function() {
  11604. var timer,
  11605. i = 0,
  11606. timers = jQuery.timers;
  11607. fxNow = Date.now();
  11608. for ( ; i < timers.length; i++ ) {
  11609. timer = timers[ i ];
  11610. // Run the timer and safely remove it when done (allowing for external removal)
  11611. if ( !timer() && timers[ i ] === timer ) {
  11612. timers.splice( i--, 1 );
  11613. }
  11614. }
  11615. if ( !timers.length ) {
  11616. jQuery.fx.stop();
  11617. }
  11618. fxNow = undefined;
  11619. };
  11620. jQuery.fx.timer = function( timer ) {
  11621. jQuery.timers.push( timer );
  11622. jQuery.fx.start();
  11623. };
  11624. jQuery.fx.interval = 13;
  11625. jQuery.fx.start = function() {
  11626. if ( inProgress ) {
  11627. return;
  11628. }
  11629. inProgress = true;
  11630. schedule();
  11631. };
  11632. jQuery.fx.stop = function() {
  11633. inProgress = null;
  11634. };
  11635. jQuery.fx.speeds = {
  11636. slow: 600,
  11637. fast: 200,
  11638. // Default speed
  11639. _default: 400
  11640. };
  11641. // Based off of the plugin by Clint Helfers, with permission.
  11642. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11643. jQuery.fn.delay = function( time, type ) {
  11644. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11645. type = type || "fx";
  11646. return this.queue( type, function( next, hooks ) {
  11647. var timeout = window.setTimeout( next, time );
  11648. hooks.stop = function() {
  11649. window.clearTimeout( timeout );
  11650. };
  11651. } );
  11652. };
  11653. ( function() {
  11654. var input = document.createElement( "input" ),
  11655. select = document.createElement( "select" ),
  11656. opt = select.appendChild( document.createElement( "option" ) );
  11657. input.type = "checkbox";
  11658. // Support: Android <=4.3 only
  11659. // Default value for a checkbox should be "on"
  11660. support.checkOn = input.value !== "";
  11661. // Support: IE <=11 only
  11662. // Must access selectedIndex to make default options select
  11663. support.optSelected = opt.selected;
  11664. // Support: IE <=11 only
  11665. // An input loses its value after becoming a radio
  11666. input = document.createElement( "input" );
  11667. input.value = "t";
  11668. input.type = "radio";
  11669. support.radioValue = input.value === "t";
  11670. } )();
  11671. var boolHook,
  11672. attrHandle = jQuery.expr.attrHandle;
  11673. jQuery.fn.extend( {
  11674. attr: function( name, value ) {
  11675. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11676. },
  11677. removeAttr: function( name ) {
  11678. return this.each( function() {
  11679. jQuery.removeAttr( this, name );
  11680. } );
  11681. }
  11682. } );
  11683. jQuery.extend( {
  11684. attr: function( elem, name, value ) {
  11685. var ret, hooks,
  11686. nType = elem.nodeType;
  11687. // Don't get/set attributes on text, comment and attribute nodes
  11688. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11689. return;
  11690. }
  11691. // Fallback to prop when attributes are not supported
  11692. if ( typeof elem.getAttribute === "undefined" ) {
  11693. return jQuery.prop( elem, name, value );
  11694. }
  11695. // Attribute hooks are determined by the lowercase version
  11696. // Grab necessary hook if one is defined
  11697. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11698. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11699. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11700. }
  11701. if ( value !== undefined ) {
  11702. if ( value === null ) {
  11703. jQuery.removeAttr( elem, name );
  11704. return;
  11705. }
  11706. if ( hooks && "set" in hooks &&
  11707. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11708. return ret;
  11709. }
  11710. elem.setAttribute( name, value + "" );
  11711. return value;
  11712. }
  11713. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11714. return ret;
  11715. }
  11716. ret = jQuery.find.attr( elem, name );
  11717. // Non-existent attributes return null, we normalize to undefined
  11718. return ret == null ? undefined : ret;
  11719. },
  11720. attrHooks: {
  11721. type: {
  11722. set: function( elem, value ) {
  11723. if ( !support.radioValue && value === "radio" &&
  11724. nodeName( elem, "input" ) ) {
  11725. var val = elem.value;
  11726. elem.setAttribute( "type", value );
  11727. if ( val ) {
  11728. elem.value = val;
  11729. }
  11730. return value;
  11731. }
  11732. }
  11733. }
  11734. },
  11735. removeAttr: function( elem, value ) {
  11736. var name,
  11737. i = 0,
  11738. // Attribute names can contain non-HTML whitespace characters
  11739. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11740. attrNames = value && value.match( rnothtmlwhite );
  11741. if ( attrNames && elem.nodeType === 1 ) {
  11742. while ( ( name = attrNames[ i++ ] ) ) {
  11743. elem.removeAttribute( name );
  11744. }
  11745. }
  11746. }
  11747. } );
  11748. // Hooks for boolean attributes
  11749. boolHook = {
  11750. set: function( elem, value, name ) {
  11751. if ( value === false ) {
  11752. // Remove boolean attributes when set to false
  11753. jQuery.removeAttr( elem, name );
  11754. } else {
  11755. elem.setAttribute( name, name );
  11756. }
  11757. return name;
  11758. }
  11759. };
  11760. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  11761. var getter = attrHandle[ name ] || jQuery.find.attr;
  11762. attrHandle[ name ] = function( elem, name, isXML ) {
  11763. var ret, handle,
  11764. lowercaseName = name.toLowerCase();
  11765. if ( !isXML ) {
  11766. // Avoid an infinite loop by temporarily removing this function from the getter
  11767. handle = attrHandle[ lowercaseName ];
  11768. attrHandle[ lowercaseName ] = ret;
  11769. ret = getter( elem, name, isXML ) != null ?
  11770. lowercaseName :
  11771. null;
  11772. attrHandle[ lowercaseName ] = handle;
  11773. }
  11774. return ret;
  11775. };
  11776. } );
  11777. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11778. rclickable = /^(?:a|area)$/i;
  11779. jQuery.fn.extend( {
  11780. prop: function( name, value ) {
  11781. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11782. },
  11783. removeProp: function( name ) {
  11784. return this.each( function() {
  11785. delete this[ jQuery.propFix[ name ] || name ];
  11786. } );
  11787. }
  11788. } );
  11789. jQuery.extend( {
  11790. prop: function( elem, name, value ) {
  11791. var ret, hooks,
  11792. nType = elem.nodeType;
  11793. // Don't get/set properties on text, comment and attribute nodes
  11794. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11795. return;
  11796. }
  11797. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11798. // Fix name and attach hooks
  11799. name = jQuery.propFix[ name ] || name;
  11800. hooks = jQuery.propHooks[ name ];
  11801. }
  11802. if ( value !== undefined ) {
  11803. if ( hooks && "set" in hooks &&
  11804. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11805. return ret;
  11806. }
  11807. return ( elem[ name ] = value );
  11808. }
  11809. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11810. return ret;
  11811. }
  11812. return elem[ name ];
  11813. },
  11814. propHooks: {
  11815. tabIndex: {
  11816. get: function( elem ) {
  11817. // Support: IE <=9 - 11 only
  11818. // elem.tabIndex doesn't always return the
  11819. // correct value when it hasn't been explicitly set
  11820. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11821. // Use proper attribute retrieval(#12072)
  11822. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11823. if ( tabindex ) {
  11824. return parseInt( tabindex, 10 );
  11825. }
  11826. if (
  11827. rfocusable.test( elem.nodeName ) ||
  11828. rclickable.test( elem.nodeName ) &&
  11829. elem.href
  11830. ) {
  11831. return 0;
  11832. }
  11833. return -1;
  11834. }
  11835. }
  11836. },
  11837. propFix: {
  11838. "for": "htmlFor",
  11839. "class": "className"
  11840. }
  11841. } );
  11842. // Support: IE <=11 only
  11843. // Accessing the selectedIndex property
  11844. // forces the browser to respect setting selected
  11845. // on the option
  11846. // The getter ensures a default option is selected
  11847. // when in an optgroup
  11848. // eslint rule "no-unused-expressions" is disabled for this code
  11849. // since it considers such accessions noop
  11850. if ( !support.optSelected ) {
  11851. jQuery.propHooks.selected = {
  11852. get: function( elem ) {
  11853. /* eslint no-unused-expressions: "off" */
  11854. var parent = elem.parentNode;
  11855. if ( parent && parent.parentNode ) {
  11856. parent.parentNode.selectedIndex;
  11857. }
  11858. return null;
  11859. },
  11860. set: function( elem ) {
  11861. /* eslint no-unused-expressions: "off" */
  11862. var parent = elem.parentNode;
  11863. if ( parent ) {
  11864. parent.selectedIndex;
  11865. if ( parent.parentNode ) {
  11866. parent.parentNode.selectedIndex;
  11867. }
  11868. }
  11869. }
  11870. };
  11871. }
  11872. jQuery.each( [
  11873. "tabIndex",
  11874. "readOnly",
  11875. "maxLength",
  11876. "cellSpacing",
  11877. "cellPadding",
  11878. "rowSpan",
  11879. "colSpan",
  11880. "useMap",
  11881. "frameBorder",
  11882. "contentEditable"
  11883. ], function() {
  11884. jQuery.propFix[ this.toLowerCase() ] = this;
  11885. } );
  11886. // Strip and collapse whitespace according to HTML spec
  11887. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11888. function stripAndCollapse( value ) {
  11889. var tokens = value.match( rnothtmlwhite ) || [];
  11890. return tokens.join( " " );
  11891. }
  11892. function getClass( elem ) {
  11893. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11894. }
  11895. function classesToArray( value ) {
  11896. if ( Array.isArray( value ) ) {
  11897. return value;
  11898. }
  11899. if ( typeof value === "string" ) {
  11900. return value.match( rnothtmlwhite ) || [];
  11901. }
  11902. return [];
  11903. }
  11904. jQuery.fn.extend( {
  11905. addClass: function( value ) {
  11906. var classes, elem, cur, curValue, clazz, j, finalValue,
  11907. i = 0;
  11908. if ( isFunction( value ) ) {
  11909. return this.each( function( j ) {
  11910. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11911. } );
  11912. }
  11913. classes = classesToArray( value );
  11914. if ( classes.length ) {
  11915. while ( ( elem = this[ i++ ] ) ) {
  11916. curValue = getClass( elem );
  11917. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11918. if ( cur ) {
  11919. j = 0;
  11920. while ( ( clazz = classes[ j++ ] ) ) {
  11921. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11922. cur += clazz + " ";
  11923. }
  11924. }
  11925. // Only assign if different to avoid unneeded rendering.
  11926. finalValue = stripAndCollapse( cur );
  11927. if ( curValue !== finalValue ) {
  11928. elem.setAttribute( "class", finalValue );
  11929. }
  11930. }
  11931. }
  11932. }
  11933. return this;
  11934. },
  11935. removeClass: function( value ) {
  11936. var classes, elem, cur, curValue, clazz, j, finalValue,
  11937. i = 0;
  11938. if ( isFunction( value ) ) {
  11939. return this.each( function( j ) {
  11940. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11941. } );
  11942. }
  11943. if ( !arguments.length ) {
  11944. return this.attr( "class", "" );
  11945. }
  11946. classes = classesToArray( value );
  11947. if ( classes.length ) {
  11948. while ( ( elem = this[ i++ ] ) ) {
  11949. curValue = getClass( elem );
  11950. // This expression is here for better compressibility (see addClass)
  11951. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11952. if ( cur ) {
  11953. j = 0;
  11954. while ( ( clazz = classes[ j++ ] ) ) {
  11955. // Remove *all* instances
  11956. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11957. cur = cur.replace( " " + clazz + " ", " " );
  11958. }
  11959. }
  11960. // Only assign if different to avoid unneeded rendering.
  11961. finalValue = stripAndCollapse( cur );
  11962. if ( curValue !== finalValue ) {
  11963. elem.setAttribute( "class", finalValue );
  11964. }
  11965. }
  11966. }
  11967. }
  11968. return this;
  11969. },
  11970. toggleClass: function( value, stateVal ) {
  11971. var type = typeof value,
  11972. isValidValue = type === "string" || Array.isArray( value );
  11973. if ( typeof stateVal === "boolean" && isValidValue ) {
  11974. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11975. }
  11976. if ( isFunction( value ) ) {
  11977. return this.each( function( i ) {
  11978. jQuery( this ).toggleClass(
  11979. value.call( this, i, getClass( this ), stateVal ),
  11980. stateVal
  11981. );
  11982. } );
  11983. }
  11984. return this.each( function() {
  11985. var className, i, self, classNames;
  11986. if ( isValidValue ) {
  11987. // Toggle individual class names
  11988. i = 0;
  11989. self = jQuery( this );
  11990. classNames = classesToArray( value );
  11991. while ( ( className = classNames[ i++ ] ) ) {
  11992. // Check each className given, space separated list
  11993. if ( self.hasClass( className ) ) {
  11994. self.removeClass( className );
  11995. } else {
  11996. self.addClass( className );
  11997. }
  11998. }
  11999. // Toggle whole class name
  12000. } else if ( value === undefined || type === "boolean" ) {
  12001. className = getClass( this );
  12002. if ( className ) {
  12003. // Store className if set
  12004. dataPriv.set( this, "__className__", className );
  12005. }
  12006. // If the element has a class name or if we're passed `false`,
  12007. // then remove the whole classname (if there was one, the above saved it).
  12008. // Otherwise bring back whatever was previously saved (if anything),
  12009. // falling back to the empty string if nothing was stored.
  12010. if ( this.setAttribute ) {
  12011. this.setAttribute( "class",
  12012. className || value === false ?
  12013. "" :
  12014. dataPriv.get( this, "__className__" ) || ""
  12015. );
  12016. }
  12017. }
  12018. } );
  12019. },
  12020. hasClass: function( selector ) {
  12021. var className, elem,
  12022. i = 0;
  12023. className = " " + selector + " ";
  12024. while ( ( elem = this[ i++ ] ) ) {
  12025. if ( elem.nodeType === 1 &&
  12026. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  12027. return true;
  12028. }
  12029. }
  12030. return false;
  12031. }
  12032. } );
  12033. var rreturn = /\r/g;
  12034. jQuery.fn.extend( {
  12035. val: function( value ) {
  12036. var hooks, ret, valueIsFunction,
  12037. elem = this[ 0 ];
  12038. if ( !arguments.length ) {
  12039. if ( elem ) {
  12040. hooks = jQuery.valHooks[ elem.type ] ||
  12041. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  12042. if ( hooks &&
  12043. "get" in hooks &&
  12044. ( ret = hooks.get( elem, "value" ) ) !== undefined
  12045. ) {
  12046. return ret;
  12047. }
  12048. ret = elem.value;
  12049. // Handle most common string cases
  12050. if ( typeof ret === "string" ) {
  12051. return ret.replace( rreturn, "" );
  12052. }
  12053. // Handle cases where value is null/undef or number
  12054. return ret == null ? "" : ret;
  12055. }
  12056. return;
  12057. }
  12058. valueIsFunction = isFunction( value );
  12059. return this.each( function( i ) {
  12060. var val;
  12061. if ( this.nodeType !== 1 ) {
  12062. return;
  12063. }
  12064. if ( valueIsFunction ) {
  12065. val = value.call( this, i, jQuery( this ).val() );
  12066. } else {
  12067. val = value;
  12068. }
  12069. // Treat null/undefined as ""; convert numbers to string
  12070. if ( val == null ) {
  12071. val = "";
  12072. } else if ( typeof val === "number" ) {
  12073. val += "";
  12074. } else if ( Array.isArray( val ) ) {
  12075. val = jQuery.map( val, function( value ) {
  12076. return value == null ? "" : value + "";
  12077. } );
  12078. }
  12079. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  12080. // If set returns undefined, fall back to normal setting
  12081. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  12082. this.value = val;
  12083. }
  12084. } );
  12085. }
  12086. } );
  12087. jQuery.extend( {
  12088. valHooks: {
  12089. option: {
  12090. get: function( elem ) {
  12091. var val = jQuery.find.attr( elem, "value" );
  12092. return val != null ?
  12093. val :
  12094. // Support: IE <=10 - 11 only
  12095. // option.text throws exceptions (#14686, #14858)
  12096. // Strip and collapse whitespace
  12097. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  12098. stripAndCollapse( jQuery.text( elem ) );
  12099. }
  12100. },
  12101. select: {
  12102. get: function( elem ) {
  12103. var value, option, i,
  12104. options = elem.options,
  12105. index = elem.selectedIndex,
  12106. one = elem.type === "select-one",
  12107. values = one ? null : [],
  12108. max = one ? index + 1 : options.length;
  12109. if ( index < 0 ) {
  12110. i = max;
  12111. } else {
  12112. i = one ? index : 0;
  12113. }
  12114. // Loop through all the selected options
  12115. for ( ; i < max; i++ ) {
  12116. option = options[ i ];
  12117. // Support: IE <=9 only
  12118. // IE8-9 doesn't update selected after form reset (#2551)
  12119. if ( ( option.selected || i === index ) &&
  12120. // Don't return options that are disabled or in a disabled optgroup
  12121. !option.disabled &&
  12122. ( !option.parentNode.disabled ||
  12123. !nodeName( option.parentNode, "optgroup" ) ) ) {
  12124. // Get the specific value for the option
  12125. value = jQuery( option ).val();
  12126. // We don't need an array for one selects
  12127. if ( one ) {
  12128. return value;
  12129. }
  12130. // Multi-Selects return an array
  12131. values.push( value );
  12132. }
  12133. }
  12134. return values;
  12135. },
  12136. set: function( elem, value ) {
  12137. var optionSet, option,
  12138. options = elem.options,
  12139. values = jQuery.makeArray( value ),
  12140. i = options.length;
  12141. while ( i-- ) {
  12142. option = options[ i ];
  12143. /* eslint-disable no-cond-assign */
  12144. if ( option.selected =
  12145. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  12146. ) {
  12147. optionSet = true;
  12148. }
  12149. /* eslint-enable no-cond-assign */
  12150. }
  12151. // Force browsers to behave consistently when non-matching value is set
  12152. if ( !optionSet ) {
  12153. elem.selectedIndex = -1;
  12154. }
  12155. return values;
  12156. }
  12157. }
  12158. }
  12159. } );
  12160. // Radios and checkboxes getter/setter
  12161. jQuery.each( [ "radio", "checkbox" ], function() {
  12162. jQuery.valHooks[ this ] = {
  12163. set: function( elem, value ) {
  12164. if ( Array.isArray( value ) ) {
  12165. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  12166. }
  12167. }
  12168. };
  12169. if ( !support.checkOn ) {
  12170. jQuery.valHooks[ this ].get = function( elem ) {
  12171. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  12172. };
  12173. }
  12174. } );
  12175. // Return jQuery for attributes-only inclusion
  12176. support.focusin = "onfocusin" in window;
  12177. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  12178. stopPropagationCallback = function( e ) {
  12179. e.stopPropagation();
  12180. };
  12181. jQuery.extend( jQuery.event, {
  12182. trigger: function( event, data, elem, onlyHandlers ) {
  12183. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  12184. eventPath = [ elem || document ],
  12185. type = hasOwn.call( event, "type" ) ? event.type : event,
  12186. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  12187. cur = lastElement = tmp = elem = elem || document;
  12188. // Don't do events on text and comment nodes
  12189. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  12190. return;
  12191. }
  12192. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  12193. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  12194. return;
  12195. }
  12196. if ( type.indexOf( "." ) > -1 ) {
  12197. // Namespaced trigger; create a regexp to match event type in handle()
  12198. namespaces = type.split( "." );
  12199. type = namespaces.shift();
  12200. namespaces.sort();
  12201. }
  12202. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  12203. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  12204. event = event[ jQuery.expando ] ?
  12205. event :
  12206. new jQuery.Event( type, typeof event === "object" && event );
  12207. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  12208. event.isTrigger = onlyHandlers ? 2 : 3;
  12209. event.namespace = namespaces.join( "." );
  12210. event.rnamespace = event.namespace ?
  12211. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  12212. null;
  12213. // Clean up the event in case it is being reused
  12214. event.result = undefined;
  12215. if ( !event.target ) {
  12216. event.target = elem;
  12217. }
  12218. // Clone any incoming data and prepend the event, creating the handler arg list
  12219. data = data == null ?
  12220. [ event ] :
  12221. jQuery.makeArray( data, [ event ] );
  12222. // Allow special events to draw outside the lines
  12223. special = jQuery.event.special[ type ] || {};
  12224. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  12225. return;
  12226. }
  12227. // Determine event propagation path in advance, per W3C events spec (#9951)
  12228. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  12229. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  12230. bubbleType = special.delegateType || type;
  12231. if ( !rfocusMorph.test( bubbleType + type ) ) {
  12232. cur = cur.parentNode;
  12233. }
  12234. for ( ; cur; cur = cur.parentNode ) {
  12235. eventPath.push( cur );
  12236. tmp = cur;
  12237. }
  12238. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  12239. if ( tmp === ( elem.ownerDocument || document ) ) {
  12240. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  12241. }
  12242. }
  12243. // Fire handlers on the event path
  12244. i = 0;
  12245. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  12246. lastElement = cur;
  12247. event.type = i > 1 ?
  12248. bubbleType :
  12249. special.bindType || type;
  12250. // jQuery handler
  12251. handle = (
  12252. dataPriv.get( cur, "events" ) || Object.create( null )
  12253. )[ event.type ] &&
  12254. dataPriv.get( cur, "handle" );
  12255. if ( handle ) {
  12256. handle.apply( cur, data );
  12257. }
  12258. // Native handler
  12259. handle = ontype && cur[ ontype ];
  12260. if ( handle && handle.apply && acceptData( cur ) ) {
  12261. event.result = handle.apply( cur, data );
  12262. if ( event.result === false ) {
  12263. event.preventDefault();
  12264. }
  12265. }
  12266. }
  12267. event.type = type;
  12268. // If nobody prevented the default action, do it now
  12269. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  12270. if ( ( !special._default ||
  12271. special._default.apply( eventPath.pop(), data ) === false ) &&
  12272. acceptData( elem ) ) {
  12273. // Call a native DOM method on the target with the same name as the event.
  12274. // Don't do default actions on window, that's where global variables be (#6170)
  12275. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  12276. // Don't re-trigger an onFOO event when we call its FOO() method
  12277. tmp = elem[ ontype ];
  12278. if ( tmp ) {
  12279. elem[ ontype ] = null;
  12280. }
  12281. // Prevent re-triggering of the same event, since we already bubbled it above
  12282. jQuery.event.triggered = type;
  12283. if ( event.isPropagationStopped() ) {
  12284. lastElement.addEventListener( type, stopPropagationCallback );
  12285. }
  12286. elem[ type ]();
  12287. if ( event.isPropagationStopped() ) {
  12288. lastElement.removeEventListener( type, stopPropagationCallback );
  12289. }
  12290. jQuery.event.triggered = undefined;
  12291. if ( tmp ) {
  12292. elem[ ontype ] = tmp;
  12293. }
  12294. }
  12295. }
  12296. }
  12297. return event.result;
  12298. },
  12299. // Piggyback on a donor event to simulate a different one
  12300. // Used only for `focus(in | out)` events
  12301. simulate: function( type, elem, event ) {
  12302. var e = jQuery.extend(
  12303. new jQuery.Event(),
  12304. event,
  12305. {
  12306. type: type,
  12307. isSimulated: true
  12308. }
  12309. );
  12310. jQuery.event.trigger( e, null, elem );
  12311. }
  12312. } );
  12313. jQuery.fn.extend( {
  12314. trigger: function( type, data ) {
  12315. return this.each( function() {
  12316. jQuery.event.trigger( type, data, this );
  12317. } );
  12318. },
  12319. triggerHandler: function( type, data ) {
  12320. var elem = this[ 0 ];
  12321. if ( elem ) {
  12322. return jQuery.event.trigger( type, data, elem, true );
  12323. }
  12324. }
  12325. } );
  12326. // Support: Firefox <=44
  12327. // Firefox doesn't have focus(in | out) events
  12328. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  12329. //
  12330. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  12331. // focus(in | out) events fire after focus & blur events,
  12332. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  12333. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  12334. if ( !support.focusin ) {
  12335. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  12336. // Attach a single capturing handler on the document while someone wants focusin/focusout
  12337. var handler = function( event ) {
  12338. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  12339. };
  12340. jQuery.event.special[ fix ] = {
  12341. setup: function() {
  12342. // Handle: regular nodes (via `this.ownerDocument`), window
  12343. // (via `this.document`) & document (via `this`).
  12344. var doc = this.ownerDocument || this.document || this,
  12345. attaches = dataPriv.access( doc, fix );
  12346. if ( !attaches ) {
  12347. doc.addEventListener( orig, handler, true );
  12348. }
  12349. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  12350. },
  12351. teardown: function() {
  12352. var doc = this.ownerDocument || this.document || this,
  12353. attaches = dataPriv.access( doc, fix ) - 1;
  12354. if ( !attaches ) {
  12355. doc.removeEventListener( orig, handler, true );
  12356. dataPriv.remove( doc, fix );
  12357. } else {
  12358. dataPriv.access( doc, fix, attaches );
  12359. }
  12360. }
  12361. };
  12362. } );
  12363. }
  12364. var location = window.location;
  12365. var nonce = { guid: Date.now() };
  12366. var rquery = ( /\?/ );
  12367. // Cross-browser xml parsing
  12368. jQuery.parseXML = function( data ) {
  12369. var xml;
  12370. if ( !data || typeof data !== "string" ) {
  12371. return null;
  12372. }
  12373. // Support: IE 9 - 11 only
  12374. // IE throws on parseFromString with invalid input.
  12375. try {
  12376. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  12377. } catch ( e ) {
  12378. xml = undefined;
  12379. }
  12380. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  12381. jQuery.error( "Invalid XML: " + data );
  12382. }
  12383. return xml;
  12384. };
  12385. var
  12386. rbracket = /\[\]$/,
  12387. rCRLF = /\r?\n/g,
  12388. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  12389. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  12390. function buildParams( prefix, obj, traditional, add ) {
  12391. var name;
  12392. if ( Array.isArray( obj ) ) {
  12393. // Serialize array item.
  12394. jQuery.each( obj, function( i, v ) {
  12395. if ( traditional || rbracket.test( prefix ) ) {
  12396. // Treat each array item as a scalar.
  12397. add( prefix, v );
  12398. } else {
  12399. // Item is non-scalar (array or object), encode its numeric index.
  12400. buildParams(
  12401. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  12402. v,
  12403. traditional,
  12404. add
  12405. );
  12406. }
  12407. } );
  12408. } else if ( !traditional && toType( obj ) === "object" ) {
  12409. // Serialize object item.
  12410. for ( name in obj ) {
  12411. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  12412. }
  12413. } else {
  12414. // Serialize scalar item.
  12415. add( prefix, obj );
  12416. }
  12417. }
  12418. // Serialize an array of form elements or a set of
  12419. // key/values into a query string
  12420. jQuery.param = function( a, traditional ) {
  12421. var prefix,
  12422. s = [],
  12423. add = function( key, valueOrFunction ) {
  12424. // If value is a function, invoke it and use its return value
  12425. var value = isFunction( valueOrFunction ) ?
  12426. valueOrFunction() :
  12427. valueOrFunction;
  12428. s[ s.length ] = encodeURIComponent( key ) + "=" +
  12429. encodeURIComponent( value == null ? "" : value );
  12430. };
  12431. if ( a == null ) {
  12432. return "";
  12433. }
  12434. // If an array was passed in, assume that it is an array of form elements.
  12435. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  12436. // Serialize the form elements
  12437. jQuery.each( a, function() {
  12438. add( this.name, this.value );
  12439. } );
  12440. } else {
  12441. // If traditional, encode the "old" way (the way 1.3.2 or older
  12442. // did it), otherwise encode params recursively.
  12443. for ( prefix in a ) {
  12444. buildParams( prefix, a[ prefix ], traditional, add );
  12445. }
  12446. }
  12447. // Return the resulting serialization
  12448. return s.join( "&" );
  12449. };
  12450. jQuery.fn.extend( {
  12451. serialize: function() {
  12452. return jQuery.param( this.serializeArray() );
  12453. },
  12454. serializeArray: function() {
  12455. return this.map( function() {
  12456. // Can add propHook for "elements" to filter or add form elements
  12457. var elements = jQuery.prop( this, "elements" );
  12458. return elements ? jQuery.makeArray( elements ) : this;
  12459. } )
  12460. .filter( function() {
  12461. var type = this.type;
  12462. // Use .is( ":disabled" ) so that fieldset[disabled] works
  12463. return this.name && !jQuery( this ).is( ":disabled" ) &&
  12464. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  12465. ( this.checked || !rcheckableType.test( type ) );
  12466. } )
  12467. .map( function( _i, elem ) {
  12468. var val = jQuery( this ).val();
  12469. if ( val == null ) {
  12470. return null;
  12471. }
  12472. if ( Array.isArray( val ) ) {
  12473. return jQuery.map( val, function( val ) {
  12474. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12475. } );
  12476. }
  12477. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12478. } ).get();
  12479. }
  12480. } );
  12481. var
  12482. r20 = /%20/g,
  12483. rhash = /#.*$/,
  12484. rantiCache = /([?&])_=[^&]*/,
  12485. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  12486. // #7653, #8125, #8152: local protocol detection
  12487. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  12488. rnoContent = /^(?:GET|HEAD)$/,
  12489. rprotocol = /^\/\//,
  12490. /* Prefilters
  12491. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  12492. * 2) These are called:
  12493. * - BEFORE asking for a transport
  12494. * - AFTER param serialization (s.data is a string if s.processData is true)
  12495. * 3) key is the dataType
  12496. * 4) the catchall symbol "*" can be used
  12497. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  12498. */
  12499. prefilters = {},
  12500. /* Transports bindings
  12501. * 1) key is the dataType
  12502. * 2) the catchall symbol "*" can be used
  12503. * 3) selection will start with transport dataType and THEN go to "*" if needed
  12504. */
  12505. transports = {},
  12506. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  12507. allTypes = "*/".concat( "*" ),
  12508. // Anchor tag for parsing the document origin
  12509. originAnchor = document.createElement( "a" );
  12510. originAnchor.href = location.href;
  12511. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  12512. function addToPrefiltersOrTransports( structure ) {
  12513. // dataTypeExpression is optional and defaults to "*"
  12514. return function( dataTypeExpression, func ) {
  12515. if ( typeof dataTypeExpression !== "string" ) {
  12516. func = dataTypeExpression;
  12517. dataTypeExpression = "*";
  12518. }
  12519. var dataType,
  12520. i = 0,
  12521. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  12522. if ( isFunction( func ) ) {
  12523. // For each dataType in the dataTypeExpression
  12524. while ( ( dataType = dataTypes[ i++ ] ) ) {
  12525. // Prepend if requested
  12526. if ( dataType[ 0 ] === "+" ) {
  12527. dataType = dataType.slice( 1 ) || "*";
  12528. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  12529. // Otherwise append
  12530. } else {
  12531. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  12532. }
  12533. }
  12534. }
  12535. };
  12536. }
  12537. // Base inspection function for prefilters and transports
  12538. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  12539. var inspected = {},
  12540. seekingTransport = ( structure === transports );
  12541. function inspect( dataType ) {
  12542. var selected;
  12543. inspected[ dataType ] = true;
  12544. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  12545. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  12546. if ( typeof dataTypeOrTransport === "string" &&
  12547. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  12548. options.dataTypes.unshift( dataTypeOrTransport );
  12549. inspect( dataTypeOrTransport );
  12550. return false;
  12551. } else if ( seekingTransport ) {
  12552. return !( selected = dataTypeOrTransport );
  12553. }
  12554. } );
  12555. return selected;
  12556. }
  12557. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12558. }
  12559. // A special extend for ajax options
  12560. // that takes "flat" options (not to be deep extended)
  12561. // Fixes #9887
  12562. function ajaxExtend( target, src ) {
  12563. var key, deep,
  12564. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12565. for ( key in src ) {
  12566. if ( src[ key ] !== undefined ) {
  12567. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12568. }
  12569. }
  12570. if ( deep ) {
  12571. jQuery.extend( true, target, deep );
  12572. }
  12573. return target;
  12574. }
  12575. /* Handles responses to an ajax request:
  12576. * - finds the right dataType (mediates between content-type and expected dataType)
  12577. * - returns the corresponding response
  12578. */
  12579. function ajaxHandleResponses( s, jqXHR, responses ) {
  12580. var ct, type, finalDataType, firstDataType,
  12581. contents = s.contents,
  12582. dataTypes = s.dataTypes;
  12583. // Remove auto dataType and get content-type in the process
  12584. while ( dataTypes[ 0 ] === "*" ) {
  12585. dataTypes.shift();
  12586. if ( ct === undefined ) {
  12587. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12588. }
  12589. }
  12590. // Check if we're dealing with a known content-type
  12591. if ( ct ) {
  12592. for ( type in contents ) {
  12593. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12594. dataTypes.unshift( type );
  12595. break;
  12596. }
  12597. }
  12598. }
  12599. // Check to see if we have a response for the expected dataType
  12600. if ( dataTypes[ 0 ] in responses ) {
  12601. finalDataType = dataTypes[ 0 ];
  12602. } else {
  12603. // Try convertible dataTypes
  12604. for ( type in responses ) {
  12605. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12606. finalDataType = type;
  12607. break;
  12608. }
  12609. if ( !firstDataType ) {
  12610. firstDataType = type;
  12611. }
  12612. }
  12613. // Or just use first one
  12614. finalDataType = finalDataType || firstDataType;
  12615. }
  12616. // If we found a dataType
  12617. // We add the dataType to the list if needed
  12618. // and return the corresponding response
  12619. if ( finalDataType ) {
  12620. if ( finalDataType !== dataTypes[ 0 ] ) {
  12621. dataTypes.unshift( finalDataType );
  12622. }
  12623. return responses[ finalDataType ];
  12624. }
  12625. }
  12626. /* Chain conversions given the request and the original response
  12627. * Also sets the responseXXX fields on the jqXHR instance
  12628. */
  12629. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12630. var conv2, current, conv, tmp, prev,
  12631. converters = {},
  12632. // Work with a copy of dataTypes in case we need to modify it for conversion
  12633. dataTypes = s.dataTypes.slice();
  12634. // Create converters map with lowercased keys
  12635. if ( dataTypes[ 1 ] ) {
  12636. for ( conv in s.converters ) {
  12637. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12638. }
  12639. }
  12640. current = dataTypes.shift();
  12641. // Convert to each sequential dataType
  12642. while ( current ) {
  12643. if ( s.responseFields[ current ] ) {
  12644. jqXHR[ s.responseFields[ current ] ] = response;
  12645. }
  12646. // Apply the dataFilter if provided
  12647. if ( !prev && isSuccess && s.dataFilter ) {
  12648. response = s.dataFilter( response, s.dataType );
  12649. }
  12650. prev = current;
  12651. current = dataTypes.shift();
  12652. if ( current ) {
  12653. // There's only work to do if current dataType is non-auto
  12654. if ( current === "*" ) {
  12655. current = prev;
  12656. // Convert response if prev dataType is non-auto and differs from current
  12657. } else if ( prev !== "*" && prev !== current ) {
  12658. // Seek a direct converter
  12659. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12660. // If none found, seek a pair
  12661. if ( !conv ) {
  12662. for ( conv2 in converters ) {
  12663. // If conv2 outputs current
  12664. tmp = conv2.split( " " );
  12665. if ( tmp[ 1 ] === current ) {
  12666. // If prev can be converted to accepted input
  12667. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12668. converters[ "* " + tmp[ 0 ] ];
  12669. if ( conv ) {
  12670. // Condense equivalence converters
  12671. if ( conv === true ) {
  12672. conv = converters[ conv2 ];
  12673. // Otherwise, insert the intermediate dataType
  12674. } else if ( converters[ conv2 ] !== true ) {
  12675. current = tmp[ 0 ];
  12676. dataTypes.unshift( tmp[ 1 ] );
  12677. }
  12678. break;
  12679. }
  12680. }
  12681. }
  12682. }
  12683. // Apply converter (if not an equivalence)
  12684. if ( conv !== true ) {
  12685. // Unless errors are allowed to bubble, catch and return them
  12686. if ( conv && s.throws ) {
  12687. response = conv( response );
  12688. } else {
  12689. try {
  12690. response = conv( response );
  12691. } catch ( e ) {
  12692. return {
  12693. state: "parsererror",
  12694. error: conv ? e : "No conversion from " + prev + " to " + current
  12695. };
  12696. }
  12697. }
  12698. }
  12699. }
  12700. }
  12701. }
  12702. return { state: "success", data: response };
  12703. }
  12704. jQuery.extend( {
  12705. // Counter for holding the number of active queries
  12706. active: 0,
  12707. // Last-Modified header cache for next request
  12708. lastModified: {},
  12709. etag: {},
  12710. ajaxSettings: {
  12711. url: location.href,
  12712. type: "GET",
  12713. isLocal: rlocalProtocol.test( location.protocol ),
  12714. global: true,
  12715. processData: true,
  12716. async: true,
  12717. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12718. /*
  12719. timeout: 0,
  12720. data: null,
  12721. dataType: null,
  12722. username: null,
  12723. password: null,
  12724. cache: null,
  12725. throws: false,
  12726. traditional: false,
  12727. headers: {},
  12728. */
  12729. accepts: {
  12730. "*": allTypes,
  12731. text: "text/plain",
  12732. html: "text/html",
  12733. xml: "application/xml, text/xml",
  12734. json: "application/json, text/javascript"
  12735. },
  12736. contents: {
  12737. xml: /\bxml\b/,
  12738. html: /\bhtml/,
  12739. json: /\bjson\b/
  12740. },
  12741. responseFields: {
  12742. xml: "responseXML",
  12743. text: "responseText",
  12744. json: "responseJSON"
  12745. },
  12746. // Data converters
  12747. // Keys separate source (or catchall "*") and destination types with a single space
  12748. converters: {
  12749. // Convert anything to text
  12750. "* text": String,
  12751. // Text to html (true = no transformation)
  12752. "text html": true,
  12753. // Evaluate text as a json expression
  12754. "text json": JSON.parse,
  12755. // Parse text as xml
  12756. "text xml": jQuery.parseXML
  12757. },
  12758. // For options that shouldn't be deep extended:
  12759. // you can add your own custom options here if
  12760. // and when you create one that shouldn't be
  12761. // deep extended (see ajaxExtend)
  12762. flatOptions: {
  12763. url: true,
  12764. context: true
  12765. }
  12766. },
  12767. // Creates a full fledged settings object into target
  12768. // with both ajaxSettings and settings fields.
  12769. // If target is omitted, writes into ajaxSettings.
  12770. ajaxSetup: function( target, settings ) {
  12771. return settings ?
  12772. // Building a settings object
  12773. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12774. // Extending ajaxSettings
  12775. ajaxExtend( jQuery.ajaxSettings, target );
  12776. },
  12777. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12778. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12779. // Main method
  12780. ajax: function( url, options ) {
  12781. // If url is an object, simulate pre-1.5 signature
  12782. if ( typeof url === "object" ) {
  12783. options = url;
  12784. url = undefined;
  12785. }
  12786. // Force options to be an object
  12787. options = options || {};
  12788. var transport,
  12789. // URL without anti-cache param
  12790. cacheURL,
  12791. // Response headers
  12792. responseHeadersString,
  12793. responseHeaders,
  12794. // timeout handle
  12795. timeoutTimer,
  12796. // Url cleanup var
  12797. urlAnchor,
  12798. // Request state (becomes false upon send and true upon completion)
  12799. completed,
  12800. // To know if global events are to be dispatched
  12801. fireGlobals,
  12802. // Loop variable
  12803. i,
  12804. // uncached part of the url
  12805. uncached,
  12806. // Create the final options object
  12807. s = jQuery.ajaxSetup( {}, options ),
  12808. // Callbacks context
  12809. callbackContext = s.context || s,
  12810. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12811. globalEventContext = s.context &&
  12812. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12813. jQuery( callbackContext ) :
  12814. jQuery.event,
  12815. // Deferreds
  12816. deferred = jQuery.Deferred(),
  12817. completeDeferred = jQuery.Callbacks( "once memory" ),
  12818. // Status-dependent callbacks
  12819. statusCode = s.statusCode || {},
  12820. // Headers (they are sent all at once)
  12821. requestHeaders = {},
  12822. requestHeadersNames = {},
  12823. // Default abort message
  12824. strAbort = "canceled",
  12825. // Fake xhr
  12826. jqXHR = {
  12827. readyState: 0,
  12828. // Builds headers hashtable if needed
  12829. getResponseHeader: function( key ) {
  12830. var match;
  12831. if ( completed ) {
  12832. if ( !responseHeaders ) {
  12833. responseHeaders = {};
  12834. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12835. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  12836. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  12837. .concat( match[ 2 ] );
  12838. }
  12839. }
  12840. match = responseHeaders[ key.toLowerCase() + " " ];
  12841. }
  12842. return match == null ? null : match.join( ", " );
  12843. },
  12844. // Raw string
  12845. getAllResponseHeaders: function() {
  12846. return completed ? responseHeadersString : null;
  12847. },
  12848. // Caches the header
  12849. setRequestHeader: function( name, value ) {
  12850. if ( completed == null ) {
  12851. name = requestHeadersNames[ name.toLowerCase() ] =
  12852. requestHeadersNames[ name.toLowerCase() ] || name;
  12853. requestHeaders[ name ] = value;
  12854. }
  12855. return this;
  12856. },
  12857. // Overrides response content-type header
  12858. overrideMimeType: function( type ) {
  12859. if ( completed == null ) {
  12860. s.mimeType = type;
  12861. }
  12862. return this;
  12863. },
  12864. // Status-dependent callbacks
  12865. statusCode: function( map ) {
  12866. var code;
  12867. if ( map ) {
  12868. if ( completed ) {
  12869. // Execute the appropriate callbacks
  12870. jqXHR.always( map[ jqXHR.status ] );
  12871. } else {
  12872. // Lazy-add the new callbacks in a way that preserves old ones
  12873. for ( code in map ) {
  12874. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12875. }
  12876. }
  12877. }
  12878. return this;
  12879. },
  12880. // Cancel the request
  12881. abort: function( statusText ) {
  12882. var finalText = statusText || strAbort;
  12883. if ( transport ) {
  12884. transport.abort( finalText );
  12885. }
  12886. done( 0, finalText );
  12887. return this;
  12888. }
  12889. };
  12890. // Attach deferreds
  12891. deferred.promise( jqXHR );
  12892. // Add protocol if not provided (prefilters might expect it)
  12893. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12894. // We also use the url parameter if available
  12895. s.url = ( ( url || s.url || location.href ) + "" )
  12896. .replace( rprotocol, location.protocol + "//" );
  12897. // Alias method option to type as per ticket #12004
  12898. s.type = options.method || options.type || s.method || s.type;
  12899. // Extract dataTypes list
  12900. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12901. // A cross-domain request is in order when the origin doesn't match the current origin.
  12902. if ( s.crossDomain == null ) {
  12903. urlAnchor = document.createElement( "a" );
  12904. // Support: IE <=8 - 11, Edge 12 - 15
  12905. // IE throws exception on accessing the href property if url is malformed,
  12906. // e.g. http://example.com:80x/
  12907. try {
  12908. urlAnchor.href = s.url;
  12909. // Support: IE <=8 - 11 only
  12910. // Anchor's host property isn't correctly set when s.url is relative
  12911. urlAnchor.href = urlAnchor.href;
  12912. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12913. urlAnchor.protocol + "//" + urlAnchor.host;
  12914. } catch ( e ) {
  12915. // If there is an error parsing the URL, assume it is crossDomain,
  12916. // it can be rejected by the transport if it is invalid
  12917. s.crossDomain = true;
  12918. }
  12919. }
  12920. // Convert data if not already a string
  12921. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12922. s.data = jQuery.param( s.data, s.traditional );
  12923. }
  12924. // Apply prefilters
  12925. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12926. // If request was aborted inside a prefilter, stop there
  12927. if ( completed ) {
  12928. return jqXHR;
  12929. }
  12930. // We can fire global events as of now if asked to
  12931. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12932. fireGlobals = jQuery.event && s.global;
  12933. // Watch for a new set of requests
  12934. if ( fireGlobals && jQuery.active++ === 0 ) {
  12935. jQuery.event.trigger( "ajaxStart" );
  12936. }
  12937. // Uppercase the type
  12938. s.type = s.type.toUpperCase();
  12939. // Determine if request has content
  12940. s.hasContent = !rnoContent.test( s.type );
  12941. // Save the URL in case we're toying with the If-Modified-Since
  12942. // and/or If-None-Match header later on
  12943. // Remove hash to simplify url manipulation
  12944. cacheURL = s.url.replace( rhash, "" );
  12945. // More options handling for requests with no content
  12946. if ( !s.hasContent ) {
  12947. // Remember the hash so we can put it back
  12948. uncached = s.url.slice( cacheURL.length );
  12949. // If data is available and should be processed, append data to url
  12950. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12951. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12952. // #9682: remove data so that it's not used in an eventual retry
  12953. delete s.data;
  12954. }
  12955. // Add or update anti-cache param if needed
  12956. if ( s.cache === false ) {
  12957. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12958. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
  12959. uncached;
  12960. }
  12961. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12962. s.url = cacheURL + uncached;
  12963. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12964. } else if ( s.data && s.processData &&
  12965. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12966. s.data = s.data.replace( r20, "+" );
  12967. }
  12968. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12969. if ( s.ifModified ) {
  12970. if ( jQuery.lastModified[ cacheURL ] ) {
  12971. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12972. }
  12973. if ( jQuery.etag[ cacheURL ] ) {
  12974. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12975. }
  12976. }
  12977. // Set the correct header, if data is being sent
  12978. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12979. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12980. }
  12981. // Set the Accepts header for the server, depending on the dataType
  12982. jqXHR.setRequestHeader(
  12983. "Accept",
  12984. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12985. s.accepts[ s.dataTypes[ 0 ] ] +
  12986. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  12987. s.accepts[ "*" ]
  12988. );
  12989. // Check for headers option
  12990. for ( i in s.headers ) {
  12991. jqXHR.setRequestHeader( i, s.headers[ i ] );
  12992. }
  12993. // Allow custom headers/mimetypes and early abort
  12994. if ( s.beforeSend &&
  12995. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  12996. // Abort if not done already and return
  12997. return jqXHR.abort();
  12998. }
  12999. // Aborting is no longer a cancellation
  13000. strAbort = "abort";
  13001. // Install callbacks on deferreds
  13002. completeDeferred.add( s.complete );
  13003. jqXHR.done( s.success );
  13004. jqXHR.fail( s.error );
  13005. // Get transport
  13006. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  13007. // If no transport, we auto-abort
  13008. if ( !transport ) {
  13009. done( -1, "No Transport" );
  13010. } else {
  13011. jqXHR.readyState = 1;
  13012. // Send global event
  13013. if ( fireGlobals ) {
  13014. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  13015. }
  13016. // If request was aborted inside ajaxSend, stop there
  13017. if ( completed ) {
  13018. return jqXHR;
  13019. }
  13020. // Timeout
  13021. if ( s.async && s.timeout > 0 ) {
  13022. timeoutTimer = window.setTimeout( function() {
  13023. jqXHR.abort( "timeout" );
  13024. }, s.timeout );
  13025. }
  13026. try {
  13027. completed = false;
  13028. transport.send( requestHeaders, done );
  13029. } catch ( e ) {
  13030. // Rethrow post-completion exceptions
  13031. if ( completed ) {
  13032. throw e;
  13033. }
  13034. // Propagate others as results
  13035. done( -1, e );
  13036. }
  13037. }
  13038. // Callback for when everything is done
  13039. function done( status, nativeStatusText, responses, headers ) {
  13040. var isSuccess, success, error, response, modified,
  13041. statusText = nativeStatusText;
  13042. // Ignore repeat invocations
  13043. if ( completed ) {
  13044. return;
  13045. }
  13046. completed = true;
  13047. // Clear timeout if it exists
  13048. if ( timeoutTimer ) {
  13049. window.clearTimeout( timeoutTimer );
  13050. }
  13051. // Dereference transport for early garbage collection
  13052. // (no matter how long the jqXHR object will be used)
  13053. transport = undefined;
  13054. // Cache response headers
  13055. responseHeadersString = headers || "";
  13056. // Set readyState
  13057. jqXHR.readyState = status > 0 ? 4 : 0;
  13058. // Determine if successful
  13059. isSuccess = status >= 200 && status < 300 || status === 304;
  13060. // Get response data
  13061. if ( responses ) {
  13062. response = ajaxHandleResponses( s, jqXHR, responses );
  13063. }
  13064. // Use a noop converter for missing script
  13065. if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
  13066. s.converters[ "text script" ] = function() {};
  13067. }
  13068. // Convert no matter what (that way responseXXX fields are always set)
  13069. response = ajaxConvert( s, response, jqXHR, isSuccess );
  13070. // If successful, handle type chaining
  13071. if ( isSuccess ) {
  13072. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  13073. if ( s.ifModified ) {
  13074. modified = jqXHR.getResponseHeader( "Last-Modified" );
  13075. if ( modified ) {
  13076. jQuery.lastModified[ cacheURL ] = modified;
  13077. }
  13078. modified = jqXHR.getResponseHeader( "etag" );
  13079. if ( modified ) {
  13080. jQuery.etag[ cacheURL ] = modified;
  13081. }
  13082. }
  13083. // if no content
  13084. if ( status === 204 || s.type === "HEAD" ) {
  13085. statusText = "nocontent";
  13086. // if not modified
  13087. } else if ( status === 304 ) {
  13088. statusText = "notmodified";
  13089. // If we have data, let's convert it
  13090. } else {
  13091. statusText = response.state;
  13092. success = response.data;
  13093. error = response.error;
  13094. isSuccess = !error;
  13095. }
  13096. } else {
  13097. // Extract error from statusText and normalize for non-aborts
  13098. error = statusText;
  13099. if ( status || !statusText ) {
  13100. statusText = "error";
  13101. if ( status < 0 ) {
  13102. status = 0;
  13103. }
  13104. }
  13105. }
  13106. // Set data for the fake xhr object
  13107. jqXHR.status = status;
  13108. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  13109. // Success/Error
  13110. if ( isSuccess ) {
  13111. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  13112. } else {
  13113. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  13114. }
  13115. // Status-dependent callbacks
  13116. jqXHR.statusCode( statusCode );
  13117. statusCode = undefined;
  13118. if ( fireGlobals ) {
  13119. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  13120. [ jqXHR, s, isSuccess ? success : error ] );
  13121. }
  13122. // Complete
  13123. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  13124. if ( fireGlobals ) {
  13125. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  13126. // Handle the global AJAX counter
  13127. if ( !( --jQuery.active ) ) {
  13128. jQuery.event.trigger( "ajaxStop" );
  13129. }
  13130. }
  13131. }
  13132. return jqXHR;
  13133. },
  13134. getJSON: function( url, data, callback ) {
  13135. return jQuery.get( url, data, callback, "json" );
  13136. },
  13137. getScript: function( url, callback ) {
  13138. return jQuery.get( url, undefined, callback, "script" );
  13139. }
  13140. } );
  13141. jQuery.each( [ "get", "post" ], function( _i, method ) {
  13142. jQuery[ method ] = function( url, data, callback, type ) {
  13143. // Shift arguments if data argument was omitted
  13144. if ( isFunction( data ) ) {
  13145. type = type || callback;
  13146. callback = data;
  13147. data = undefined;
  13148. }
  13149. // The url can be an options object (which then must have .url)
  13150. return jQuery.ajax( jQuery.extend( {
  13151. url: url,
  13152. type: method,
  13153. dataType: type,
  13154. data: data,
  13155. success: callback
  13156. }, jQuery.isPlainObject( url ) && url ) );
  13157. };
  13158. } );
  13159. jQuery.ajaxPrefilter( function( s ) {
  13160. var i;
  13161. for ( i in s.headers ) {
  13162. if ( i.toLowerCase() === "content-type" ) {
  13163. s.contentType = s.headers[ i ] || "";
  13164. }
  13165. }
  13166. } );
  13167. jQuery._evalUrl = function( url, options, doc ) {
  13168. return jQuery.ajax( {
  13169. url: url,
  13170. // Make this explicit, since user can override this through ajaxSetup (#11264)
  13171. type: "GET",
  13172. dataType: "script",
  13173. cache: true,
  13174. async: false,
  13175. global: false,
  13176. // Only evaluate the response if it is successful (gh-4126)
  13177. // dataFilter is not invoked for failure responses, so using it instead
  13178. // of the default converter is kludgy but it works.
  13179. converters: {
  13180. "text script": function() {}
  13181. },
  13182. dataFilter: function( response ) {
  13183. jQuery.globalEval( response, options, doc );
  13184. }
  13185. } );
  13186. };
  13187. jQuery.fn.extend( {
  13188. wrapAll: function( html ) {
  13189. var wrap;
  13190. if ( this[ 0 ] ) {
  13191. if ( isFunction( html ) ) {
  13192. html = html.call( this[ 0 ] );
  13193. }
  13194. // The elements to wrap the target around
  13195. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  13196. if ( this[ 0 ].parentNode ) {
  13197. wrap.insertBefore( this[ 0 ] );
  13198. }
  13199. wrap.map( function() {
  13200. var elem = this;
  13201. while ( elem.firstElementChild ) {
  13202. elem = elem.firstElementChild;
  13203. }
  13204. return elem;
  13205. } ).append( this );
  13206. }
  13207. return this;
  13208. },
  13209. wrapInner: function( html ) {
  13210. if ( isFunction( html ) ) {
  13211. return this.each( function( i ) {
  13212. jQuery( this ).wrapInner( html.call( this, i ) );
  13213. } );
  13214. }
  13215. return this.each( function() {
  13216. var self = jQuery( this ),
  13217. contents = self.contents();
  13218. if ( contents.length ) {
  13219. contents.wrapAll( html );
  13220. } else {
  13221. self.append( html );
  13222. }
  13223. } );
  13224. },
  13225. wrap: function( html ) {
  13226. var htmlIsFunction = isFunction( html );
  13227. return this.each( function( i ) {
  13228. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  13229. } );
  13230. },
  13231. unwrap: function( selector ) {
  13232. this.parent( selector ).not( "body" ).each( function() {
  13233. jQuery( this ).replaceWith( this.childNodes );
  13234. } );
  13235. return this;
  13236. }
  13237. } );
  13238. jQuery.expr.pseudos.hidden = function( elem ) {
  13239. return !jQuery.expr.pseudos.visible( elem );
  13240. };
  13241. jQuery.expr.pseudos.visible = function( elem ) {
  13242. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  13243. };
  13244. jQuery.ajaxSettings.xhr = function() {
  13245. try {
  13246. return new window.XMLHttpRequest();
  13247. } catch ( e ) {}
  13248. };
  13249. var xhrSuccessStatus = {
  13250. // File protocol always yields status code 0, assume 200
  13251. 0: 200,
  13252. // Support: IE <=9 only
  13253. // #1450: sometimes IE returns 1223 when it should be 204
  13254. 1223: 204
  13255. },
  13256. xhrSupported = jQuery.ajaxSettings.xhr();
  13257. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  13258. support.ajax = xhrSupported = !!xhrSupported;
  13259. jQuery.ajaxTransport( function( options ) {
  13260. var callback, errorCallback;
  13261. // Cross domain only allowed if supported through XMLHttpRequest
  13262. if ( support.cors || xhrSupported && !options.crossDomain ) {
  13263. return {
  13264. send: function( headers, complete ) {
  13265. var i,
  13266. xhr = options.xhr();
  13267. xhr.open(
  13268. options.type,
  13269. options.url,
  13270. options.async,
  13271. options.username,
  13272. options.password
  13273. );
  13274. // Apply custom fields if provided
  13275. if ( options.xhrFields ) {
  13276. for ( i in options.xhrFields ) {
  13277. xhr[ i ] = options.xhrFields[ i ];
  13278. }
  13279. }
  13280. // Override mime type if needed
  13281. if ( options.mimeType && xhr.overrideMimeType ) {
  13282. xhr.overrideMimeType( options.mimeType );
  13283. }
  13284. // X-Requested-With header
  13285. // For cross-domain requests, seeing as conditions for a preflight are
  13286. // akin to a jigsaw puzzle, we simply never set it to be sure.
  13287. // (it can always be set on a per-request basis or even using ajaxSetup)
  13288. // For same-domain requests, won't change header if already provided.
  13289. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  13290. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  13291. }
  13292. // Set headers
  13293. for ( i in headers ) {
  13294. xhr.setRequestHeader( i, headers[ i ] );
  13295. }
  13296. // Callback
  13297. callback = function( type ) {
  13298. return function() {
  13299. if ( callback ) {
  13300. callback = errorCallback = xhr.onload =
  13301. xhr.onerror = xhr.onabort = xhr.ontimeout =
  13302. xhr.onreadystatechange = null;
  13303. if ( type === "abort" ) {
  13304. xhr.abort();
  13305. } else if ( type === "error" ) {
  13306. // Support: IE <=9 only
  13307. // On a manual native abort, IE9 throws
  13308. // errors on any property access that is not readyState
  13309. if ( typeof xhr.status !== "number" ) {
  13310. complete( 0, "error" );
  13311. } else {
  13312. complete(
  13313. // File: protocol always yields status 0; see #8605, #14207
  13314. xhr.status,
  13315. xhr.statusText
  13316. );
  13317. }
  13318. } else {
  13319. complete(
  13320. xhrSuccessStatus[ xhr.status ] || xhr.status,
  13321. xhr.statusText,
  13322. // Support: IE <=9 only
  13323. // IE9 has no XHR2 but throws on binary (trac-11426)
  13324. // For XHR2 non-text, let the caller handle it (gh-2498)
  13325. ( xhr.responseType || "text" ) !== "text" ||
  13326. typeof xhr.responseText !== "string" ?
  13327. { binary: xhr.response } :
  13328. { text: xhr.responseText },
  13329. xhr.getAllResponseHeaders()
  13330. );
  13331. }
  13332. }
  13333. };
  13334. };
  13335. // Listen to events
  13336. xhr.onload = callback();
  13337. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  13338. // Support: IE 9 only
  13339. // Use onreadystatechange to replace onabort
  13340. // to handle uncaught aborts
  13341. if ( xhr.onabort !== undefined ) {
  13342. xhr.onabort = errorCallback;
  13343. } else {
  13344. xhr.onreadystatechange = function() {
  13345. // Check readyState before timeout as it changes
  13346. if ( xhr.readyState === 4 ) {
  13347. // Allow onerror to be called first,
  13348. // but that will not handle a native abort
  13349. // Also, save errorCallback to a variable
  13350. // as xhr.onerror cannot be accessed
  13351. window.setTimeout( function() {
  13352. if ( callback ) {
  13353. errorCallback();
  13354. }
  13355. } );
  13356. }
  13357. };
  13358. }
  13359. // Create the abort callback
  13360. callback = callback( "abort" );
  13361. try {
  13362. // Do send the request (this may raise an exception)
  13363. xhr.send( options.hasContent && options.data || null );
  13364. } catch ( e ) {
  13365. // #14683: Only rethrow if this hasn't been notified as an error yet
  13366. if ( callback ) {
  13367. throw e;
  13368. }
  13369. }
  13370. },
  13371. abort: function() {
  13372. if ( callback ) {
  13373. callback();
  13374. }
  13375. }
  13376. };
  13377. }
  13378. } );
  13379. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  13380. jQuery.ajaxPrefilter( function( s ) {
  13381. if ( s.crossDomain ) {
  13382. s.contents.script = false;
  13383. }
  13384. } );
  13385. // Install script dataType
  13386. jQuery.ajaxSetup( {
  13387. accepts: {
  13388. script: "text/javascript, application/javascript, " +
  13389. "application/ecmascript, application/x-ecmascript"
  13390. },
  13391. contents: {
  13392. script: /\b(?:java|ecma)script\b/
  13393. },
  13394. converters: {
  13395. "text script": function( text ) {
  13396. jQuery.globalEval( text );
  13397. return text;
  13398. }
  13399. }
  13400. } );
  13401. // Handle cache's special case and crossDomain
  13402. jQuery.ajaxPrefilter( "script", function( s ) {
  13403. if ( s.cache === undefined ) {
  13404. s.cache = false;
  13405. }
  13406. if ( s.crossDomain ) {
  13407. s.type = "GET";
  13408. }
  13409. } );
  13410. // Bind script tag hack transport
  13411. jQuery.ajaxTransport( "script", function( s ) {
  13412. // This transport only deals with cross domain or forced-by-attrs requests
  13413. if ( s.crossDomain || s.scriptAttrs ) {
  13414. var script, callback;
  13415. return {
  13416. send: function( _, complete ) {
  13417. script = jQuery( "<script>" )
  13418. .attr( s.scriptAttrs || {} )
  13419. .prop( { charset: s.scriptCharset, src: s.url } )
  13420. .on( "load error", callback = function( evt ) {
  13421. script.remove();
  13422. callback = null;
  13423. if ( evt ) {
  13424. complete( evt.type === "error" ? 404 : 200, evt.type );
  13425. }
  13426. } );
  13427. // Use native DOM manipulation to avoid our domManip AJAX trickery
  13428. document.head.appendChild( script[ 0 ] );
  13429. },
  13430. abort: function() {
  13431. if ( callback ) {
  13432. callback();
  13433. }
  13434. }
  13435. };
  13436. }
  13437. } );
  13438. var oldCallbacks = [],
  13439. rjsonp = /(=)\?(?=&|$)|\?\?/;
  13440. // Default jsonp settings
  13441. jQuery.ajaxSetup( {
  13442. jsonp: "callback",
  13443. jsonpCallback: function() {
  13444. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
  13445. this[ callback ] = true;
  13446. return callback;
  13447. }
  13448. } );
  13449. // Detect, normalize options and install callbacks for jsonp requests
  13450. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  13451. var callbackName, overwritten, responseContainer,
  13452. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  13453. "url" :
  13454. typeof s.data === "string" &&
  13455. ( s.contentType || "" )
  13456. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  13457. rjsonp.test( s.data ) && "data"
  13458. );
  13459. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  13460. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  13461. // Get callback name, remembering preexisting value associated with it
  13462. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  13463. s.jsonpCallback() :
  13464. s.jsonpCallback;
  13465. // Insert callback into url or form data
  13466. if ( jsonProp ) {
  13467. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  13468. } else if ( s.jsonp !== false ) {
  13469. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  13470. }
  13471. // Use data converter to retrieve json after script execution
  13472. s.converters[ "script json" ] = function() {
  13473. if ( !responseContainer ) {
  13474. jQuery.error( callbackName + " was not called" );
  13475. }
  13476. return responseContainer[ 0 ];
  13477. };
  13478. // Force json dataType
  13479. s.dataTypes[ 0 ] = "json";
  13480. // Install callback
  13481. overwritten = window[ callbackName ];
  13482. window[ callbackName ] = function() {
  13483. responseContainer = arguments;
  13484. };
  13485. // Clean-up function (fires after converters)
  13486. jqXHR.always( function() {
  13487. // If previous value didn't exist - remove it
  13488. if ( overwritten === undefined ) {
  13489. jQuery( window ).removeProp( callbackName );
  13490. // Otherwise restore preexisting value
  13491. } else {
  13492. window[ callbackName ] = overwritten;
  13493. }
  13494. // Save back as free
  13495. if ( s[ callbackName ] ) {
  13496. // Make sure that re-using the options doesn't screw things around
  13497. s.jsonpCallback = originalSettings.jsonpCallback;
  13498. // Save the callback name for future use
  13499. oldCallbacks.push( callbackName );
  13500. }
  13501. // Call if it was a function and we have a response
  13502. if ( responseContainer && isFunction( overwritten ) ) {
  13503. overwritten( responseContainer[ 0 ] );
  13504. }
  13505. responseContainer = overwritten = undefined;
  13506. } );
  13507. // Delegate to script
  13508. return "script";
  13509. }
  13510. } );
  13511. // Support: Safari 8 only
  13512. // In Safari 8 documents created via document.implementation.createHTMLDocument
  13513. // collapse sibling forms: the second one becomes a child of the first one.
  13514. // Because of that, this security measure has to be disabled in Safari 8.
  13515. // https://bugs.webkit.org/show_bug.cgi?id=137337
  13516. support.createHTMLDocument = ( function() {
  13517. var body = document.implementation.createHTMLDocument( "" ).body;
  13518. body.innerHTML = "<form></form><form></form>";
  13519. return body.childNodes.length === 2;
  13520. } )();
  13521. // Argument "data" should be string of html
  13522. // context (optional): If specified, the fragment will be created in this context,
  13523. // defaults to document
  13524. // keepScripts (optional): If true, will include scripts passed in the html string
  13525. jQuery.parseHTML = function( data, context, keepScripts ) {
  13526. if ( typeof data !== "string" ) {
  13527. return [];
  13528. }
  13529. if ( typeof context === "boolean" ) {
  13530. keepScripts = context;
  13531. context = false;
  13532. }
  13533. var base, parsed, scripts;
  13534. if ( !context ) {
  13535. // Stop scripts or inline event handlers from being executed immediately
  13536. // by using document.implementation
  13537. if ( support.createHTMLDocument ) {
  13538. context = document.implementation.createHTMLDocument( "" );
  13539. // Set the base href for the created document
  13540. // so any parsed elements with URLs
  13541. // are based on the document's URL (gh-2965)
  13542. base = context.createElement( "base" );
  13543. base.href = document.location.href;
  13544. context.head.appendChild( base );
  13545. } else {
  13546. context = document;
  13547. }
  13548. }
  13549. parsed = rsingleTag.exec( data );
  13550. scripts = !keepScripts && [];
  13551. // Single tag
  13552. if ( parsed ) {
  13553. return [ context.createElement( parsed[ 1 ] ) ];
  13554. }
  13555. parsed = buildFragment( [ data ], context, scripts );
  13556. if ( scripts && scripts.length ) {
  13557. jQuery( scripts ).remove();
  13558. }
  13559. return jQuery.merge( [], parsed.childNodes );
  13560. };
  13561. /**
  13562. * Load a url into a page
  13563. */
  13564. jQuery.fn.load = function( url, params, callback ) {
  13565. var selector, type, response,
  13566. self = this,
  13567. off = url.indexOf( " " );
  13568. if ( off > -1 ) {
  13569. selector = stripAndCollapse( url.slice( off ) );
  13570. url = url.slice( 0, off );
  13571. }
  13572. // If it's a function
  13573. if ( isFunction( params ) ) {
  13574. // We assume that it's the callback
  13575. callback = params;
  13576. params = undefined;
  13577. // Otherwise, build a param string
  13578. } else if ( params && typeof params === "object" ) {
  13579. type = "POST";
  13580. }
  13581. // If we have elements to modify, make the request
  13582. if ( self.length > 0 ) {
  13583. jQuery.ajax( {
  13584. url: url,
  13585. // If "type" variable is undefined, then "GET" method will be used.
  13586. // Make value of this field explicit since
  13587. // user can override it through ajaxSetup method
  13588. type: type || "GET",
  13589. dataType: "html",
  13590. data: params
  13591. } ).done( function( responseText ) {
  13592. // Save response for use in complete callback
  13593. response = arguments;
  13594. self.html( selector ?
  13595. // If a selector was specified, locate the right elements in a dummy div
  13596. // Exclude scripts to avoid IE 'Permission Denied' errors
  13597. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13598. // Otherwise use the full result
  13599. responseText );
  13600. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13601. // but they are ignored because response was set above.
  13602. // If it fails, this function gets "jqXHR", "status", "error"
  13603. } ).always( callback && function( jqXHR, status ) {
  13604. self.each( function() {
  13605. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13606. } );
  13607. } );
  13608. }
  13609. return this;
  13610. };
  13611. jQuery.expr.pseudos.animated = function( elem ) {
  13612. return jQuery.grep( jQuery.timers, function( fn ) {
  13613. return elem === fn.elem;
  13614. } ).length;
  13615. };
  13616. jQuery.offset = {
  13617. setOffset: function( elem, options, i ) {
  13618. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13619. position = jQuery.css( elem, "position" ),
  13620. curElem = jQuery( elem ),
  13621. props = {};
  13622. // Set position first, in-case top/left are set even on static elem
  13623. if ( position === "static" ) {
  13624. elem.style.position = "relative";
  13625. }
  13626. curOffset = curElem.offset();
  13627. curCSSTop = jQuery.css( elem, "top" );
  13628. curCSSLeft = jQuery.css( elem, "left" );
  13629. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13630. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13631. // Need to be able to calculate position if either
  13632. // top or left is auto and position is either absolute or fixed
  13633. if ( calculatePosition ) {
  13634. curPosition = curElem.position();
  13635. curTop = curPosition.top;
  13636. curLeft = curPosition.left;
  13637. } else {
  13638. curTop = parseFloat( curCSSTop ) || 0;
  13639. curLeft = parseFloat( curCSSLeft ) || 0;
  13640. }
  13641. if ( isFunction( options ) ) {
  13642. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13643. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13644. }
  13645. if ( options.top != null ) {
  13646. props.top = ( options.top - curOffset.top ) + curTop;
  13647. }
  13648. if ( options.left != null ) {
  13649. props.left = ( options.left - curOffset.left ) + curLeft;
  13650. }
  13651. if ( "using" in options ) {
  13652. options.using.call( elem, props );
  13653. } else {
  13654. if ( typeof props.top === "number" ) {
  13655. props.top += "px";
  13656. }
  13657. if ( typeof props.left === "number" ) {
  13658. props.left += "px";
  13659. }
  13660. curElem.css( props );
  13661. }
  13662. }
  13663. };
  13664. jQuery.fn.extend( {
  13665. // offset() relates an element's border box to the document origin
  13666. offset: function( options ) {
  13667. // Preserve chaining for setter
  13668. if ( arguments.length ) {
  13669. return options === undefined ?
  13670. this :
  13671. this.each( function( i ) {
  13672. jQuery.offset.setOffset( this, options, i );
  13673. } );
  13674. }
  13675. var rect, win,
  13676. elem = this[ 0 ];
  13677. if ( !elem ) {
  13678. return;
  13679. }
  13680. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13681. // Support: IE <=11 only
  13682. // Running getBoundingClientRect on a
  13683. // disconnected node in IE throws an error
  13684. if ( !elem.getClientRects().length ) {
  13685. return { top: 0, left: 0 };
  13686. }
  13687. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13688. rect = elem.getBoundingClientRect();
  13689. win = elem.ownerDocument.defaultView;
  13690. return {
  13691. top: rect.top + win.pageYOffset,
  13692. left: rect.left + win.pageXOffset
  13693. };
  13694. },
  13695. // position() relates an element's margin box to its offset parent's padding box
  13696. // This corresponds to the behavior of CSS absolute positioning
  13697. position: function() {
  13698. if ( !this[ 0 ] ) {
  13699. return;
  13700. }
  13701. var offsetParent, offset, doc,
  13702. elem = this[ 0 ],
  13703. parentOffset = { top: 0, left: 0 };
  13704. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13705. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13706. // Assume position:fixed implies availability of getBoundingClientRect
  13707. offset = elem.getBoundingClientRect();
  13708. } else {
  13709. offset = this.offset();
  13710. // Account for the *real* offset parent, which can be the document or its root element
  13711. // when a statically positioned element is identified
  13712. doc = elem.ownerDocument;
  13713. offsetParent = elem.offsetParent || doc.documentElement;
  13714. while ( offsetParent &&
  13715. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13716. jQuery.css( offsetParent, "position" ) === "static" ) {
  13717. offsetParent = offsetParent.parentNode;
  13718. }
  13719. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13720. // Incorporate borders into its offset, since they are outside its content origin
  13721. parentOffset = jQuery( offsetParent ).offset();
  13722. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13723. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13724. }
  13725. }
  13726. // Subtract parent offsets and element margins
  13727. return {
  13728. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13729. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13730. };
  13731. },
  13732. // This method will return documentElement in the following cases:
  13733. // 1) For the element inside the iframe without offsetParent, this method will return
  13734. // documentElement of the parent window
  13735. // 2) For the hidden or detached element
  13736. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13737. //
  13738. // but those exceptions were never presented as a real life use-cases
  13739. // and might be considered as more preferable results.
  13740. //
  13741. // This logic, however, is not guaranteed and can change at any point in the future
  13742. offsetParent: function() {
  13743. return this.map( function() {
  13744. var offsetParent = this.offsetParent;
  13745. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13746. offsetParent = offsetParent.offsetParent;
  13747. }
  13748. return offsetParent || documentElement;
  13749. } );
  13750. }
  13751. } );
  13752. // Create scrollLeft and scrollTop methods
  13753. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13754. var top = "pageYOffset" === prop;
  13755. jQuery.fn[ method ] = function( val ) {
  13756. return access( this, function( elem, method, val ) {
  13757. // Coalesce documents and windows
  13758. var win;
  13759. if ( isWindow( elem ) ) {
  13760. win = elem;
  13761. } else if ( elem.nodeType === 9 ) {
  13762. win = elem.defaultView;
  13763. }
  13764. if ( val === undefined ) {
  13765. return win ? win[ prop ] : elem[ method ];
  13766. }
  13767. if ( win ) {
  13768. win.scrollTo(
  13769. !top ? val : win.pageXOffset,
  13770. top ? val : win.pageYOffset
  13771. );
  13772. } else {
  13773. elem[ method ] = val;
  13774. }
  13775. }, method, val, arguments.length );
  13776. };
  13777. } );
  13778. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13779. // Add the top/left cssHooks using jQuery.fn.position
  13780. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13781. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13782. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13783. // rather than make the css module depend on the offset module, just check for it here
  13784. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  13785. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13786. function( elem, computed ) {
  13787. if ( computed ) {
  13788. computed = curCSS( elem, prop );
  13789. // If curCSS returns percentage, fallback to offset
  13790. return rnumnonpx.test( computed ) ?
  13791. jQuery( elem ).position()[ prop ] + "px" :
  13792. computed;
  13793. }
  13794. }
  13795. );
  13796. } );
  13797. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13798. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13799. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13800. function( defaultExtra, funcName ) {
  13801. // Margin is only for outerHeight, outerWidth
  13802. jQuery.fn[ funcName ] = function( margin, value ) {
  13803. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13804. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13805. return access( this, function( elem, type, value ) {
  13806. var doc;
  13807. if ( isWindow( elem ) ) {
  13808. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13809. return funcName.indexOf( "outer" ) === 0 ?
  13810. elem[ "inner" + name ] :
  13811. elem.document.documentElement[ "client" + name ];
  13812. }
  13813. // Get document width or height
  13814. if ( elem.nodeType === 9 ) {
  13815. doc = elem.documentElement;
  13816. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13817. // whichever is greatest
  13818. return Math.max(
  13819. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13820. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13821. doc[ "client" + name ]
  13822. );
  13823. }
  13824. return value === undefined ?
  13825. // Get width or height on the element, requesting but not forcing parseFloat
  13826. jQuery.css( elem, type, extra ) :
  13827. // Set width or height on the element
  13828. jQuery.style( elem, type, value, extra );
  13829. }, type, chainable ? margin : undefined, chainable );
  13830. };
  13831. } );
  13832. } );
  13833. jQuery.each( [
  13834. "ajaxStart",
  13835. "ajaxStop",
  13836. "ajaxComplete",
  13837. "ajaxError",
  13838. "ajaxSuccess",
  13839. "ajaxSend"
  13840. ], function( _i, type ) {
  13841. jQuery.fn[ type ] = function( fn ) {
  13842. return this.on( type, fn );
  13843. };
  13844. } );
  13845. jQuery.fn.extend( {
  13846. bind: function( types, data, fn ) {
  13847. return this.on( types, null, data, fn );
  13848. },
  13849. unbind: function( types, fn ) {
  13850. return this.off( types, null, fn );
  13851. },
  13852. delegate: function( selector, types, data, fn ) {
  13853. return this.on( types, selector, data, fn );
  13854. },
  13855. undelegate: function( selector, types, fn ) {
  13856. // ( namespace ) or ( selector, types [, fn] )
  13857. return arguments.length === 1 ?
  13858. this.off( selector, "**" ) :
  13859. this.off( types, selector || "**", fn );
  13860. },
  13861. hover: function( fnOver, fnOut ) {
  13862. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13863. }
  13864. } );
  13865. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13866. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13867. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13868. function( _i, name ) {
  13869. // Handle event binding
  13870. jQuery.fn[ name ] = function( data, fn ) {
  13871. return arguments.length > 0 ?
  13872. this.on( name, null, data, fn ) :
  13873. this.trigger( name );
  13874. };
  13875. } );
  13876. // Support: Android <=4.0 only
  13877. // Make sure we trim BOM and NBSP
  13878. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  13879. // Bind a function to a context, optionally partially applying any
  13880. // arguments.
  13881. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13882. // However, it is not slated for removal any time soon
  13883. jQuery.proxy = function( fn, context ) {
  13884. var tmp, args, proxy;
  13885. if ( typeof context === "string" ) {
  13886. tmp = fn[ context ];
  13887. context = fn;
  13888. fn = tmp;
  13889. }
  13890. // Quick check to determine if target is callable, in the spec
  13891. // this throws a TypeError, but we will just return undefined.
  13892. if ( !isFunction( fn ) ) {
  13893. return undefined;
  13894. }
  13895. // Simulated bind
  13896. args = slice.call( arguments, 2 );
  13897. proxy = function() {
  13898. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13899. };
  13900. // Set the guid of unique handler to the same of original handler, so it can be removed
  13901. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13902. return proxy;
  13903. };
  13904. jQuery.holdReady = function( hold ) {
  13905. if ( hold ) {
  13906. jQuery.readyWait++;
  13907. } else {
  13908. jQuery.ready( true );
  13909. }
  13910. };
  13911. jQuery.isArray = Array.isArray;
  13912. jQuery.parseJSON = JSON.parse;
  13913. jQuery.nodeName = nodeName;
  13914. jQuery.isFunction = isFunction;
  13915. jQuery.isWindow = isWindow;
  13916. jQuery.camelCase = camelCase;
  13917. jQuery.type = toType;
  13918. jQuery.now = Date.now;
  13919. jQuery.isNumeric = function( obj ) {
  13920. // As of jQuery 3.0, isNumeric is limited to
  13921. // strings and numbers (primitives or objects)
  13922. // that can be coerced to finite numbers (gh-2662)
  13923. var type = jQuery.type( obj );
  13924. return ( type === "number" || type === "string" ) &&
  13925. // parseFloat NaNs numeric-cast false positives ("")
  13926. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13927. // subtraction forces infinities to NaN
  13928. !isNaN( obj - parseFloat( obj ) );
  13929. };
  13930. jQuery.trim = function( text ) {
  13931. return text == null ?
  13932. "" :
  13933. ( text + "" ).replace( rtrim, "" );
  13934. };
  13935. // Register as a named AMD module, since jQuery can be concatenated with other
  13936. // files that may use define, but not via a proper concatenation script that
  13937. // understands anonymous AMD modules. A named AMD is safest and most robust
  13938. // way to register. Lowercase jquery is used because AMD module names are
  13939. // derived from file names, and jQuery is normally delivered in a lowercase
  13940. // file name. Do this after creating the global so that if an AMD module wants
  13941. // to call noConflict to hide this version of jQuery, it will work.
  13942. // Note that for maximum portability, libraries that are not jQuery should
  13943. // declare themselves as anonymous modules, and avoid setting a global if an
  13944. // AMD loader is present. jQuery is a special case. For more information, see
  13945. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13946. if ( true ) {
  13947. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13948. return jQuery;
  13949. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13950. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13951. }
  13952. var
  13953. // Map over jQuery in case of overwrite
  13954. _jQuery = window.jQuery,
  13955. // Map over the $ in case of overwrite
  13956. _$ = window.$;
  13957. jQuery.noConflict = function( deep ) {
  13958. if ( window.$ === jQuery ) {
  13959. window.$ = _$;
  13960. }
  13961. if ( deep && window.jQuery === jQuery ) {
  13962. window.jQuery = _jQuery;
  13963. }
  13964. return jQuery;
  13965. };
  13966. // Expose jQuery and $ identifiers, even in AMD
  13967. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13968. // and CommonJS for browser emulators (#13566)
  13969. if ( typeof noGlobal === "undefined" ) {
  13970. window.jQuery = window.$ = jQuery;
  13971. }
  13972. return jQuery;
  13973. } );
  13974. /***/ }),
  13975. /***/ "./node_modules/lodash/lodash.js":
  13976. /*!***************************************!*\
  13977. !*** ./node_modules/lodash/lodash.js ***!
  13978. \***************************************/
  13979. /*! no static exports found */
  13980. /***/ (function(module, exports, __webpack_require__) {
  13981. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13982. * @license
  13983. * Lodash <https://lodash.com/>
  13984. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  13985. * Released under MIT license <https://lodash.com/license>
  13986. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13987. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13988. */
  13989. ;(function() {
  13990. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  13991. var undefined;
  13992. /** Used as the semantic version number. */
  13993. var VERSION = '4.17.20';
  13994. /** Used as the size to enable large array optimizations. */
  13995. var LARGE_ARRAY_SIZE = 200;
  13996. /** Error message constants. */
  13997. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  13998. FUNC_ERROR_TEXT = 'Expected a function';
  13999. /** Used to stand-in for `undefined` hash values. */
  14000. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  14001. /** Used as the maximum memoize cache size. */
  14002. var MAX_MEMOIZE_SIZE = 500;
  14003. /** Used as the internal argument placeholder. */
  14004. var PLACEHOLDER = '__lodash_placeholder__';
  14005. /** Used to compose bitmasks for cloning. */
  14006. var CLONE_DEEP_FLAG = 1,
  14007. CLONE_FLAT_FLAG = 2,
  14008. CLONE_SYMBOLS_FLAG = 4;
  14009. /** Used to compose bitmasks for value comparisons. */
  14010. var COMPARE_PARTIAL_FLAG = 1,
  14011. COMPARE_UNORDERED_FLAG = 2;
  14012. /** Used to compose bitmasks for function metadata. */
  14013. var WRAP_BIND_FLAG = 1,
  14014. WRAP_BIND_KEY_FLAG = 2,
  14015. WRAP_CURRY_BOUND_FLAG = 4,
  14016. WRAP_CURRY_FLAG = 8,
  14017. WRAP_CURRY_RIGHT_FLAG = 16,
  14018. WRAP_PARTIAL_FLAG = 32,
  14019. WRAP_PARTIAL_RIGHT_FLAG = 64,
  14020. WRAP_ARY_FLAG = 128,
  14021. WRAP_REARG_FLAG = 256,
  14022. WRAP_FLIP_FLAG = 512;
  14023. /** Used as default options for `_.truncate`. */
  14024. var DEFAULT_TRUNC_LENGTH = 30,
  14025. DEFAULT_TRUNC_OMISSION = '...';
  14026. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  14027. var HOT_COUNT = 800,
  14028. HOT_SPAN = 16;
  14029. /** Used to indicate the type of lazy iteratees. */
  14030. var LAZY_FILTER_FLAG = 1,
  14031. LAZY_MAP_FLAG = 2,
  14032. LAZY_WHILE_FLAG = 3;
  14033. /** Used as references for various `Number` constants. */
  14034. var INFINITY = 1 / 0,
  14035. MAX_SAFE_INTEGER = 9007199254740991,
  14036. MAX_INTEGER = 1.7976931348623157e+308,
  14037. NAN = 0 / 0;
  14038. /** Used as references for the maximum length and index of an array. */
  14039. var MAX_ARRAY_LENGTH = 4294967295,
  14040. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  14041. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  14042. /** Used to associate wrap methods with their bit flags. */
  14043. var wrapFlags = [
  14044. ['ary', WRAP_ARY_FLAG],
  14045. ['bind', WRAP_BIND_FLAG],
  14046. ['bindKey', WRAP_BIND_KEY_FLAG],
  14047. ['curry', WRAP_CURRY_FLAG],
  14048. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  14049. ['flip', WRAP_FLIP_FLAG],
  14050. ['partial', WRAP_PARTIAL_FLAG],
  14051. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  14052. ['rearg', WRAP_REARG_FLAG]
  14053. ];
  14054. /** `Object#toString` result references. */
  14055. var argsTag = '[object Arguments]',
  14056. arrayTag = '[object Array]',
  14057. asyncTag = '[object AsyncFunction]',
  14058. boolTag = '[object Boolean]',
  14059. dateTag = '[object Date]',
  14060. domExcTag = '[object DOMException]',
  14061. errorTag = '[object Error]',
  14062. funcTag = '[object Function]',
  14063. genTag = '[object GeneratorFunction]',
  14064. mapTag = '[object Map]',
  14065. numberTag = '[object Number]',
  14066. nullTag = '[object Null]',
  14067. objectTag = '[object Object]',
  14068. promiseTag = '[object Promise]',
  14069. proxyTag = '[object Proxy]',
  14070. regexpTag = '[object RegExp]',
  14071. setTag = '[object Set]',
  14072. stringTag = '[object String]',
  14073. symbolTag = '[object Symbol]',
  14074. undefinedTag = '[object Undefined]',
  14075. weakMapTag = '[object WeakMap]',
  14076. weakSetTag = '[object WeakSet]';
  14077. var arrayBufferTag = '[object ArrayBuffer]',
  14078. dataViewTag = '[object DataView]',
  14079. float32Tag = '[object Float32Array]',
  14080. float64Tag = '[object Float64Array]',
  14081. int8Tag = '[object Int8Array]',
  14082. int16Tag = '[object Int16Array]',
  14083. int32Tag = '[object Int32Array]',
  14084. uint8Tag = '[object Uint8Array]',
  14085. uint8ClampedTag = '[object Uint8ClampedArray]',
  14086. uint16Tag = '[object Uint16Array]',
  14087. uint32Tag = '[object Uint32Array]';
  14088. /** Used to match empty string literals in compiled template source. */
  14089. var reEmptyStringLeading = /\b__p \+= '';/g,
  14090. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  14091. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  14092. /** Used to match HTML entities and HTML characters. */
  14093. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  14094. reUnescapedHtml = /[&<>"']/g,
  14095. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  14096. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  14097. /** Used to match template delimiters. */
  14098. var reEscape = /<%-([\s\S]+?)%>/g,
  14099. reEvaluate = /<%([\s\S]+?)%>/g,
  14100. reInterpolate = /<%=([\s\S]+?)%>/g;
  14101. /** Used to match property names within property paths. */
  14102. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  14103. reIsPlainProp = /^\w*$/,
  14104. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  14105. /**
  14106. * Used to match `RegExp`
  14107. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  14108. */
  14109. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  14110. reHasRegExpChar = RegExp(reRegExpChar.source);
  14111. /** Used to match leading and trailing whitespace. */
  14112. var reTrim = /^\s+|\s+$/g,
  14113. reTrimStart = /^\s+/,
  14114. reTrimEnd = /\s+$/;
  14115. /** Used to match wrap detail comments. */
  14116. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  14117. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  14118. reSplitDetails = /,? & /;
  14119. /** Used to match words composed of alphanumeric characters. */
  14120. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  14121. /** Used to match backslashes in property paths. */
  14122. var reEscapeChar = /\\(\\)?/g;
  14123. /**
  14124. * Used to match
  14125. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  14126. */
  14127. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  14128. /** Used to match `RegExp` flags from their coerced string values. */
  14129. var reFlags = /\w*$/;
  14130. /** Used to detect bad signed hexadecimal string values. */
  14131. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14132. /** Used to detect binary string values. */
  14133. var reIsBinary = /^0b[01]+$/i;
  14134. /** Used to detect host constructors (Safari). */
  14135. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14136. /** Used to detect octal string values. */
  14137. var reIsOctal = /^0o[0-7]+$/i;
  14138. /** Used to detect unsigned integer values. */
  14139. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14140. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  14141. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  14142. /** Used to ensure capturing order of template delimiters. */
  14143. var reNoMatch = /($^)/;
  14144. /** Used to match unescaped characters in compiled string literals. */
  14145. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  14146. /** Used to compose unicode character classes. */
  14147. var rsAstralRange = '\\ud800-\\udfff',
  14148. rsComboMarksRange = '\\u0300-\\u036f',
  14149. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  14150. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  14151. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  14152. rsDingbatRange = '\\u2700-\\u27bf',
  14153. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  14154. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  14155. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  14156. rsPunctuationRange = '\\u2000-\\u206f',
  14157. 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',
  14158. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  14159. rsVarRange = '\\ufe0e\\ufe0f',
  14160. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  14161. /** Used to compose unicode capture groups. */
  14162. var rsApos = "['\u2019]",
  14163. rsAstral = '[' + rsAstralRange + ']',
  14164. rsBreak = '[' + rsBreakRange + ']',
  14165. rsCombo = '[' + rsComboRange + ']',
  14166. rsDigits = '\\d+',
  14167. rsDingbat = '[' + rsDingbatRange + ']',
  14168. rsLower = '[' + rsLowerRange + ']',
  14169. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  14170. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  14171. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  14172. rsNonAstral = '[^' + rsAstralRange + ']',
  14173. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  14174. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  14175. rsUpper = '[' + rsUpperRange + ']',
  14176. rsZWJ = '\\u200d';
  14177. /** Used to compose unicode regexes. */
  14178. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  14179. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  14180. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  14181. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  14182. reOptMod = rsModifier + '?',
  14183. rsOptVar = '[' + rsVarRange + ']?',
  14184. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  14185. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  14186. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  14187. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  14188. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  14189. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  14190. /** Used to match apostrophes. */
  14191. var reApos = RegExp(rsApos, 'g');
  14192. /**
  14193. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  14194. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  14195. */
  14196. var reComboMark = RegExp(rsCombo, 'g');
  14197. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  14198. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  14199. /** Used to match complex or compound words. */
  14200. var reUnicodeWord = RegExp([
  14201. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  14202. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  14203. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  14204. rsUpper + '+' + rsOptContrUpper,
  14205. rsOrdUpper,
  14206. rsOrdLower,
  14207. rsDigits,
  14208. rsEmoji
  14209. ].join('|'), 'g');
  14210. /** 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/). */
  14211. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  14212. /** Used to detect strings that need a more robust regexp to match words. */
  14213. 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 ]/;
  14214. /** Used to assign default `context` object properties. */
  14215. var contextProps = [
  14216. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  14217. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  14218. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  14219. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  14220. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  14221. ];
  14222. /** Used to make template sourceURLs easier to identify. */
  14223. var templateCounter = -1;
  14224. /** Used to identify `toStringTag` values of typed arrays. */
  14225. var typedArrayTags = {};
  14226. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  14227. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  14228. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  14229. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  14230. typedArrayTags[uint32Tag] = true;
  14231. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  14232. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  14233. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  14234. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  14235. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  14236. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  14237. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  14238. typedArrayTags[weakMapTag] = false;
  14239. /** Used to identify `toStringTag` values supported by `_.clone`. */
  14240. var cloneableTags = {};
  14241. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  14242. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  14243. cloneableTags[boolTag] = cloneableTags[dateTag] =
  14244. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  14245. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  14246. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  14247. cloneableTags[numberTag] = cloneableTags[objectTag] =
  14248. cloneableTags[regexpTag] = cloneableTags[setTag] =
  14249. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  14250. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  14251. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  14252. cloneableTags[errorTag] = cloneableTags[funcTag] =
  14253. cloneableTags[weakMapTag] = false;
  14254. /** Used to map Latin Unicode letters to basic Latin letters. */
  14255. var deburredLetters = {
  14256. // Latin-1 Supplement block.
  14257. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  14258. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  14259. '\xc7': 'C', '\xe7': 'c',
  14260. '\xd0': 'D', '\xf0': 'd',
  14261. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  14262. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  14263. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  14264. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  14265. '\xd1': 'N', '\xf1': 'n',
  14266. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  14267. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14268. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  14269. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  14270. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  14271. '\xc6': 'Ae', '\xe6': 'ae',
  14272. '\xde': 'Th', '\xfe': 'th',
  14273. '\xdf': 'ss',
  14274. // Latin Extended-A block.
  14275. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  14276. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  14277. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  14278. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  14279. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  14280. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  14281. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  14282. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  14283. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  14284. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  14285. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  14286. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  14287. '\u0134': 'J', '\u0135': 'j',
  14288. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  14289. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  14290. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  14291. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  14292. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  14293. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  14294. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  14295. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  14296. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  14297. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  14298. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  14299. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  14300. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  14301. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  14302. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  14303. '\u0174': 'W', '\u0175': 'w',
  14304. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  14305. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  14306. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  14307. '\u0132': 'IJ', '\u0133': 'ij',
  14308. '\u0152': 'Oe', '\u0153': 'oe',
  14309. '\u0149': "'n", '\u017f': 's'
  14310. };
  14311. /** Used to map characters to HTML entities. */
  14312. var htmlEscapes = {
  14313. '&': '&amp;',
  14314. '<': '&lt;',
  14315. '>': '&gt;',
  14316. '"': '&quot;',
  14317. "'": '&#39;'
  14318. };
  14319. /** Used to map HTML entities to characters. */
  14320. var htmlUnescapes = {
  14321. '&amp;': '&',
  14322. '&lt;': '<',
  14323. '&gt;': '>',
  14324. '&quot;': '"',
  14325. '&#39;': "'"
  14326. };
  14327. /** Used to escape characters for inclusion in compiled string literals. */
  14328. var stringEscapes = {
  14329. '\\': '\\',
  14330. "'": "'",
  14331. '\n': 'n',
  14332. '\r': 'r',
  14333. '\u2028': 'u2028',
  14334. '\u2029': 'u2029'
  14335. };
  14336. /** Built-in method references without a dependency on `root`. */
  14337. var freeParseFloat = parseFloat,
  14338. freeParseInt = parseInt;
  14339. /** Detect free variable `global` from Node.js. */
  14340. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  14341. /** Detect free variable `self`. */
  14342. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  14343. /** Used as a reference to the global object. */
  14344. var root = freeGlobal || freeSelf || Function('return this')();
  14345. /** Detect free variable `exports`. */
  14346. var freeExports = true && exports && !exports.nodeType && exports;
  14347. /** Detect free variable `module`. */
  14348. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  14349. /** Detect the popular CommonJS extension `module.exports`. */
  14350. var moduleExports = freeModule && freeModule.exports === freeExports;
  14351. /** Detect free variable `process` from Node.js. */
  14352. var freeProcess = moduleExports && freeGlobal.process;
  14353. /** Used to access faster Node.js helpers. */
  14354. var nodeUtil = (function() {
  14355. try {
  14356. // Use `util.types` for Node.js 10+.
  14357. var types = freeModule && freeModule.require && freeModule.require('util').types;
  14358. if (types) {
  14359. return types;
  14360. }
  14361. // Legacy `process.binding('util')` for Node.js < 10.
  14362. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  14363. } catch (e) {}
  14364. }());
  14365. /* Node.js helper references. */
  14366. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  14367. nodeIsDate = nodeUtil && nodeUtil.isDate,
  14368. nodeIsMap = nodeUtil && nodeUtil.isMap,
  14369. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  14370. nodeIsSet = nodeUtil && nodeUtil.isSet,
  14371. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  14372. /*--------------------------------------------------------------------------*/
  14373. /**
  14374. * A faster alternative to `Function#apply`, this function invokes `func`
  14375. * with the `this` binding of `thisArg` and the arguments of `args`.
  14376. *
  14377. * @private
  14378. * @param {Function} func The function to invoke.
  14379. * @param {*} thisArg The `this` binding of `func`.
  14380. * @param {Array} args The arguments to invoke `func` with.
  14381. * @returns {*} Returns the result of `func`.
  14382. */
  14383. function apply(func, thisArg, args) {
  14384. switch (args.length) {
  14385. case 0: return func.call(thisArg);
  14386. case 1: return func.call(thisArg, args[0]);
  14387. case 2: return func.call(thisArg, args[0], args[1]);
  14388. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  14389. }
  14390. return func.apply(thisArg, args);
  14391. }
  14392. /**
  14393. * A specialized version of `baseAggregator` for arrays.
  14394. *
  14395. * @private
  14396. * @param {Array} [array] The array to iterate over.
  14397. * @param {Function} setter The function to set `accumulator` values.
  14398. * @param {Function} iteratee The iteratee to transform keys.
  14399. * @param {Object} accumulator The initial aggregated object.
  14400. * @returns {Function} Returns `accumulator`.
  14401. */
  14402. function arrayAggregator(array, setter, iteratee, accumulator) {
  14403. var index = -1,
  14404. length = array == null ? 0 : array.length;
  14405. while (++index < length) {
  14406. var value = array[index];
  14407. setter(accumulator, value, iteratee(value), array);
  14408. }
  14409. return accumulator;
  14410. }
  14411. /**
  14412. * A specialized version of `_.forEach` for arrays without support for
  14413. * iteratee shorthands.
  14414. *
  14415. * @private
  14416. * @param {Array} [array] The array to iterate over.
  14417. * @param {Function} iteratee The function invoked per iteration.
  14418. * @returns {Array} Returns `array`.
  14419. */
  14420. function arrayEach(array, iteratee) {
  14421. var index = -1,
  14422. length = array == null ? 0 : array.length;
  14423. while (++index < length) {
  14424. if (iteratee(array[index], index, array) === false) {
  14425. break;
  14426. }
  14427. }
  14428. return array;
  14429. }
  14430. /**
  14431. * A specialized version of `_.forEachRight` for arrays without support for
  14432. * iteratee shorthands.
  14433. *
  14434. * @private
  14435. * @param {Array} [array] The array to iterate over.
  14436. * @param {Function} iteratee The function invoked per iteration.
  14437. * @returns {Array} Returns `array`.
  14438. */
  14439. function arrayEachRight(array, iteratee) {
  14440. var length = array == null ? 0 : array.length;
  14441. while (length--) {
  14442. if (iteratee(array[length], length, array) === false) {
  14443. break;
  14444. }
  14445. }
  14446. return array;
  14447. }
  14448. /**
  14449. * A specialized version of `_.every` for arrays without support for
  14450. * iteratee shorthands.
  14451. *
  14452. * @private
  14453. * @param {Array} [array] The array to iterate over.
  14454. * @param {Function} predicate The function invoked per iteration.
  14455. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14456. * else `false`.
  14457. */
  14458. function arrayEvery(array, predicate) {
  14459. var index = -1,
  14460. length = array == null ? 0 : array.length;
  14461. while (++index < length) {
  14462. if (!predicate(array[index], index, array)) {
  14463. return false;
  14464. }
  14465. }
  14466. return true;
  14467. }
  14468. /**
  14469. * A specialized version of `_.filter` for arrays without support for
  14470. * iteratee shorthands.
  14471. *
  14472. * @private
  14473. * @param {Array} [array] The array to iterate over.
  14474. * @param {Function} predicate The function invoked per iteration.
  14475. * @returns {Array} Returns the new filtered array.
  14476. */
  14477. function arrayFilter(array, predicate) {
  14478. var index = -1,
  14479. length = array == null ? 0 : array.length,
  14480. resIndex = 0,
  14481. result = [];
  14482. while (++index < length) {
  14483. var value = array[index];
  14484. if (predicate(value, index, array)) {
  14485. result[resIndex++] = value;
  14486. }
  14487. }
  14488. return result;
  14489. }
  14490. /**
  14491. * A specialized version of `_.includes` for arrays without support for
  14492. * specifying an index to search from.
  14493. *
  14494. * @private
  14495. * @param {Array} [array] The array to inspect.
  14496. * @param {*} target The value to search for.
  14497. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14498. */
  14499. function arrayIncludes(array, value) {
  14500. var length = array == null ? 0 : array.length;
  14501. return !!length && baseIndexOf(array, value, 0) > -1;
  14502. }
  14503. /**
  14504. * This function is like `arrayIncludes` except that it accepts a comparator.
  14505. *
  14506. * @private
  14507. * @param {Array} [array] The array to inspect.
  14508. * @param {*} target The value to search for.
  14509. * @param {Function} comparator The comparator invoked per element.
  14510. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14511. */
  14512. function arrayIncludesWith(array, value, comparator) {
  14513. var index = -1,
  14514. length = array == null ? 0 : array.length;
  14515. while (++index < length) {
  14516. if (comparator(value, array[index])) {
  14517. return true;
  14518. }
  14519. }
  14520. return false;
  14521. }
  14522. /**
  14523. * A specialized version of `_.map` for arrays without support for iteratee
  14524. * shorthands.
  14525. *
  14526. * @private
  14527. * @param {Array} [array] The array to iterate over.
  14528. * @param {Function} iteratee The function invoked per iteration.
  14529. * @returns {Array} Returns the new mapped array.
  14530. */
  14531. function arrayMap(array, iteratee) {
  14532. var index = -1,
  14533. length = array == null ? 0 : array.length,
  14534. result = Array(length);
  14535. while (++index < length) {
  14536. result[index] = iteratee(array[index], index, array);
  14537. }
  14538. return result;
  14539. }
  14540. /**
  14541. * Appends the elements of `values` to `array`.
  14542. *
  14543. * @private
  14544. * @param {Array} array The array to modify.
  14545. * @param {Array} values The values to append.
  14546. * @returns {Array} Returns `array`.
  14547. */
  14548. function arrayPush(array, values) {
  14549. var index = -1,
  14550. length = values.length,
  14551. offset = array.length;
  14552. while (++index < length) {
  14553. array[offset + index] = values[index];
  14554. }
  14555. return array;
  14556. }
  14557. /**
  14558. * A specialized version of `_.reduce` for arrays without support for
  14559. * iteratee shorthands.
  14560. *
  14561. * @private
  14562. * @param {Array} [array] The array to iterate over.
  14563. * @param {Function} iteratee The function invoked per iteration.
  14564. * @param {*} [accumulator] The initial value.
  14565. * @param {boolean} [initAccum] Specify using the first element of `array` as
  14566. * the initial value.
  14567. * @returns {*} Returns the accumulated value.
  14568. */
  14569. function arrayReduce(array, iteratee, accumulator, initAccum) {
  14570. var index = -1,
  14571. length = array == null ? 0 : array.length;
  14572. if (initAccum && length) {
  14573. accumulator = array[++index];
  14574. }
  14575. while (++index < length) {
  14576. accumulator = iteratee(accumulator, array[index], index, array);
  14577. }
  14578. return accumulator;
  14579. }
  14580. /**
  14581. * A specialized version of `_.reduceRight` for arrays without support for
  14582. * iteratee shorthands.
  14583. *
  14584. * @private
  14585. * @param {Array} [array] The array to iterate over.
  14586. * @param {Function} iteratee The function invoked per iteration.
  14587. * @param {*} [accumulator] The initial value.
  14588. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14589. * the initial value.
  14590. * @returns {*} Returns the accumulated value.
  14591. */
  14592. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14593. var length = array == null ? 0 : array.length;
  14594. if (initAccum && length) {
  14595. accumulator = array[--length];
  14596. }
  14597. while (length--) {
  14598. accumulator = iteratee(accumulator, array[length], length, array);
  14599. }
  14600. return accumulator;
  14601. }
  14602. /**
  14603. * A specialized version of `_.some` for arrays without support for iteratee
  14604. * shorthands.
  14605. *
  14606. * @private
  14607. * @param {Array} [array] The array to iterate over.
  14608. * @param {Function} predicate The function invoked per iteration.
  14609. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14610. * else `false`.
  14611. */
  14612. function arraySome(array, predicate) {
  14613. var index = -1,
  14614. length = array == null ? 0 : array.length;
  14615. while (++index < length) {
  14616. if (predicate(array[index], index, array)) {
  14617. return true;
  14618. }
  14619. }
  14620. return false;
  14621. }
  14622. /**
  14623. * Gets the size of an ASCII `string`.
  14624. *
  14625. * @private
  14626. * @param {string} string The string inspect.
  14627. * @returns {number} Returns the string size.
  14628. */
  14629. var asciiSize = baseProperty('length');
  14630. /**
  14631. * Converts an ASCII `string` to an array.
  14632. *
  14633. * @private
  14634. * @param {string} string The string to convert.
  14635. * @returns {Array} Returns the converted array.
  14636. */
  14637. function asciiToArray(string) {
  14638. return string.split('');
  14639. }
  14640. /**
  14641. * Splits an ASCII `string` into an array of its words.
  14642. *
  14643. * @private
  14644. * @param {string} The string to inspect.
  14645. * @returns {Array} Returns the words of `string`.
  14646. */
  14647. function asciiWords(string) {
  14648. return string.match(reAsciiWord) || [];
  14649. }
  14650. /**
  14651. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14652. * without support for iteratee shorthands, which iterates over `collection`
  14653. * using `eachFunc`.
  14654. *
  14655. * @private
  14656. * @param {Array|Object} collection The collection to inspect.
  14657. * @param {Function} predicate The function invoked per iteration.
  14658. * @param {Function} eachFunc The function to iterate over `collection`.
  14659. * @returns {*} Returns the found element or its key, else `undefined`.
  14660. */
  14661. function baseFindKey(collection, predicate, eachFunc) {
  14662. var result;
  14663. eachFunc(collection, function(value, key, collection) {
  14664. if (predicate(value, key, collection)) {
  14665. result = key;
  14666. return false;
  14667. }
  14668. });
  14669. return result;
  14670. }
  14671. /**
  14672. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14673. * support for iteratee shorthands.
  14674. *
  14675. * @private
  14676. * @param {Array} array The array to inspect.
  14677. * @param {Function} predicate The function invoked per iteration.
  14678. * @param {number} fromIndex The index to search from.
  14679. * @param {boolean} [fromRight] Specify iterating from right to left.
  14680. * @returns {number} Returns the index of the matched value, else `-1`.
  14681. */
  14682. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14683. var length = array.length,
  14684. index = fromIndex + (fromRight ? 1 : -1);
  14685. while ((fromRight ? index-- : ++index < length)) {
  14686. if (predicate(array[index], index, array)) {
  14687. return index;
  14688. }
  14689. }
  14690. return -1;
  14691. }
  14692. /**
  14693. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14694. *
  14695. * @private
  14696. * @param {Array} array The array to inspect.
  14697. * @param {*} value The value to search for.
  14698. * @param {number} fromIndex The index to search from.
  14699. * @returns {number} Returns the index of the matched value, else `-1`.
  14700. */
  14701. function baseIndexOf(array, value, fromIndex) {
  14702. return value === value
  14703. ? strictIndexOf(array, value, fromIndex)
  14704. : baseFindIndex(array, baseIsNaN, fromIndex);
  14705. }
  14706. /**
  14707. * This function is like `baseIndexOf` except that it accepts a comparator.
  14708. *
  14709. * @private
  14710. * @param {Array} array The array to inspect.
  14711. * @param {*} value The value to search for.
  14712. * @param {number} fromIndex The index to search from.
  14713. * @param {Function} comparator The comparator invoked per element.
  14714. * @returns {number} Returns the index of the matched value, else `-1`.
  14715. */
  14716. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14717. var index = fromIndex - 1,
  14718. length = array.length;
  14719. while (++index < length) {
  14720. if (comparator(array[index], value)) {
  14721. return index;
  14722. }
  14723. }
  14724. return -1;
  14725. }
  14726. /**
  14727. * The base implementation of `_.isNaN` without support for number objects.
  14728. *
  14729. * @private
  14730. * @param {*} value The value to check.
  14731. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14732. */
  14733. function baseIsNaN(value) {
  14734. return value !== value;
  14735. }
  14736. /**
  14737. * The base implementation of `_.mean` and `_.meanBy` without support for
  14738. * iteratee shorthands.
  14739. *
  14740. * @private
  14741. * @param {Array} array The array to iterate over.
  14742. * @param {Function} iteratee The function invoked per iteration.
  14743. * @returns {number} Returns the mean.
  14744. */
  14745. function baseMean(array, iteratee) {
  14746. var length = array == null ? 0 : array.length;
  14747. return length ? (baseSum(array, iteratee) / length) : NAN;
  14748. }
  14749. /**
  14750. * The base implementation of `_.property` without support for deep paths.
  14751. *
  14752. * @private
  14753. * @param {string} key The key of the property to get.
  14754. * @returns {Function} Returns the new accessor function.
  14755. */
  14756. function baseProperty(key) {
  14757. return function(object) {
  14758. return object == null ? undefined : object[key];
  14759. };
  14760. }
  14761. /**
  14762. * The base implementation of `_.propertyOf` without support for deep paths.
  14763. *
  14764. * @private
  14765. * @param {Object} object The object to query.
  14766. * @returns {Function} Returns the new accessor function.
  14767. */
  14768. function basePropertyOf(object) {
  14769. return function(key) {
  14770. return object == null ? undefined : object[key];
  14771. };
  14772. }
  14773. /**
  14774. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14775. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14776. *
  14777. * @private
  14778. * @param {Array|Object} collection The collection to iterate over.
  14779. * @param {Function} iteratee The function invoked per iteration.
  14780. * @param {*} accumulator The initial value.
  14781. * @param {boolean} initAccum Specify using the first or last element of
  14782. * `collection` as the initial value.
  14783. * @param {Function} eachFunc The function to iterate over `collection`.
  14784. * @returns {*} Returns the accumulated value.
  14785. */
  14786. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14787. eachFunc(collection, function(value, index, collection) {
  14788. accumulator = initAccum
  14789. ? (initAccum = false, value)
  14790. : iteratee(accumulator, value, index, collection);
  14791. });
  14792. return accumulator;
  14793. }
  14794. /**
  14795. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14796. * sort order of `array` and replaces criteria objects with their corresponding
  14797. * values.
  14798. *
  14799. * @private
  14800. * @param {Array} array The array to sort.
  14801. * @param {Function} comparer The function to define sort order.
  14802. * @returns {Array} Returns `array`.
  14803. */
  14804. function baseSortBy(array, comparer) {
  14805. var length = array.length;
  14806. array.sort(comparer);
  14807. while (length--) {
  14808. array[length] = array[length].value;
  14809. }
  14810. return array;
  14811. }
  14812. /**
  14813. * The base implementation of `_.sum` and `_.sumBy` without support for
  14814. * iteratee shorthands.
  14815. *
  14816. * @private
  14817. * @param {Array} array The array to iterate over.
  14818. * @param {Function} iteratee The function invoked per iteration.
  14819. * @returns {number} Returns the sum.
  14820. */
  14821. function baseSum(array, iteratee) {
  14822. var result,
  14823. index = -1,
  14824. length = array.length;
  14825. while (++index < length) {
  14826. var current = iteratee(array[index]);
  14827. if (current !== undefined) {
  14828. result = result === undefined ? current : (result + current);
  14829. }
  14830. }
  14831. return result;
  14832. }
  14833. /**
  14834. * The base implementation of `_.times` without support for iteratee shorthands
  14835. * or max array length checks.
  14836. *
  14837. * @private
  14838. * @param {number} n The number of times to invoke `iteratee`.
  14839. * @param {Function} iteratee The function invoked per iteration.
  14840. * @returns {Array} Returns the array of results.
  14841. */
  14842. function baseTimes(n, iteratee) {
  14843. var index = -1,
  14844. result = Array(n);
  14845. while (++index < n) {
  14846. result[index] = iteratee(index);
  14847. }
  14848. return result;
  14849. }
  14850. /**
  14851. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14852. * of key-value pairs for `object` corresponding to the property names of `props`.
  14853. *
  14854. * @private
  14855. * @param {Object} object The object to query.
  14856. * @param {Array} props The property names to get values for.
  14857. * @returns {Object} Returns the key-value pairs.
  14858. */
  14859. function baseToPairs(object, props) {
  14860. return arrayMap(props, function(key) {
  14861. return [key, object[key]];
  14862. });
  14863. }
  14864. /**
  14865. * The base implementation of `_.unary` without support for storing metadata.
  14866. *
  14867. * @private
  14868. * @param {Function} func The function to cap arguments for.
  14869. * @returns {Function} Returns the new capped function.
  14870. */
  14871. function baseUnary(func) {
  14872. return function(value) {
  14873. return func(value);
  14874. };
  14875. }
  14876. /**
  14877. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14878. * array of `object` property values corresponding to the property names
  14879. * of `props`.
  14880. *
  14881. * @private
  14882. * @param {Object} object The object to query.
  14883. * @param {Array} props The property names to get values for.
  14884. * @returns {Object} Returns the array of property values.
  14885. */
  14886. function baseValues(object, props) {
  14887. return arrayMap(props, function(key) {
  14888. return object[key];
  14889. });
  14890. }
  14891. /**
  14892. * Checks if a `cache` value for `key` exists.
  14893. *
  14894. * @private
  14895. * @param {Object} cache The cache to query.
  14896. * @param {string} key The key of the entry to check.
  14897. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14898. */
  14899. function cacheHas(cache, key) {
  14900. return cache.has(key);
  14901. }
  14902. /**
  14903. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14904. * that is not found in the character symbols.
  14905. *
  14906. * @private
  14907. * @param {Array} strSymbols The string symbols to inspect.
  14908. * @param {Array} chrSymbols The character symbols to find.
  14909. * @returns {number} Returns the index of the first unmatched string symbol.
  14910. */
  14911. function charsStartIndex(strSymbols, chrSymbols) {
  14912. var index = -1,
  14913. length = strSymbols.length;
  14914. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14915. return index;
  14916. }
  14917. /**
  14918. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14919. * that is not found in the character symbols.
  14920. *
  14921. * @private
  14922. * @param {Array} strSymbols The string symbols to inspect.
  14923. * @param {Array} chrSymbols The character symbols to find.
  14924. * @returns {number} Returns the index of the last unmatched string symbol.
  14925. */
  14926. function charsEndIndex(strSymbols, chrSymbols) {
  14927. var index = strSymbols.length;
  14928. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14929. return index;
  14930. }
  14931. /**
  14932. * Gets the number of `placeholder` occurrences in `array`.
  14933. *
  14934. * @private
  14935. * @param {Array} array The array to inspect.
  14936. * @param {*} placeholder The placeholder to search for.
  14937. * @returns {number} Returns the placeholder count.
  14938. */
  14939. function countHolders(array, placeholder) {
  14940. var length = array.length,
  14941. result = 0;
  14942. while (length--) {
  14943. if (array[length] === placeholder) {
  14944. ++result;
  14945. }
  14946. }
  14947. return result;
  14948. }
  14949. /**
  14950. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14951. * letters to basic Latin letters.
  14952. *
  14953. * @private
  14954. * @param {string} letter The matched letter to deburr.
  14955. * @returns {string} Returns the deburred letter.
  14956. */
  14957. var deburrLetter = basePropertyOf(deburredLetters);
  14958. /**
  14959. * Used by `_.escape` to convert characters to HTML entities.
  14960. *
  14961. * @private
  14962. * @param {string} chr The matched character to escape.
  14963. * @returns {string} Returns the escaped character.
  14964. */
  14965. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14966. /**
  14967. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14968. *
  14969. * @private
  14970. * @param {string} chr The matched character to escape.
  14971. * @returns {string} Returns the escaped character.
  14972. */
  14973. function escapeStringChar(chr) {
  14974. return '\\' + stringEscapes[chr];
  14975. }
  14976. /**
  14977. * Gets the value at `key` of `object`.
  14978. *
  14979. * @private
  14980. * @param {Object} [object] The object to query.
  14981. * @param {string} key The key of the property to get.
  14982. * @returns {*} Returns the property value.
  14983. */
  14984. function getValue(object, key) {
  14985. return object == null ? undefined : object[key];
  14986. }
  14987. /**
  14988. * Checks if `string` contains Unicode symbols.
  14989. *
  14990. * @private
  14991. * @param {string} string The string to inspect.
  14992. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  14993. */
  14994. function hasUnicode(string) {
  14995. return reHasUnicode.test(string);
  14996. }
  14997. /**
  14998. * Checks if `string` contains a word composed of Unicode symbols.
  14999. *
  15000. * @private
  15001. * @param {string} string The string to inspect.
  15002. * @returns {boolean} Returns `true` if a word is found, else `false`.
  15003. */
  15004. function hasUnicodeWord(string) {
  15005. return reHasUnicodeWord.test(string);
  15006. }
  15007. /**
  15008. * Converts `iterator` to an array.
  15009. *
  15010. * @private
  15011. * @param {Object} iterator The iterator to convert.
  15012. * @returns {Array} Returns the converted array.
  15013. */
  15014. function iteratorToArray(iterator) {
  15015. var data,
  15016. result = [];
  15017. while (!(data = iterator.next()).done) {
  15018. result.push(data.value);
  15019. }
  15020. return result;
  15021. }
  15022. /**
  15023. * Converts `map` to its key-value pairs.
  15024. *
  15025. * @private
  15026. * @param {Object} map The map to convert.
  15027. * @returns {Array} Returns the key-value pairs.
  15028. */
  15029. function mapToArray(map) {
  15030. var index = -1,
  15031. result = Array(map.size);
  15032. map.forEach(function(value, key) {
  15033. result[++index] = [key, value];
  15034. });
  15035. return result;
  15036. }
  15037. /**
  15038. * Creates a unary function that invokes `func` with its argument transformed.
  15039. *
  15040. * @private
  15041. * @param {Function} func The function to wrap.
  15042. * @param {Function} transform The argument transform.
  15043. * @returns {Function} Returns the new function.
  15044. */
  15045. function overArg(func, transform) {
  15046. return function(arg) {
  15047. return func(transform(arg));
  15048. };
  15049. }
  15050. /**
  15051. * Replaces all `placeholder` elements in `array` with an internal placeholder
  15052. * and returns an array of their indexes.
  15053. *
  15054. * @private
  15055. * @param {Array} array The array to modify.
  15056. * @param {*} placeholder The placeholder to replace.
  15057. * @returns {Array} Returns the new array of placeholder indexes.
  15058. */
  15059. function replaceHolders(array, placeholder) {
  15060. var index = -1,
  15061. length = array.length,
  15062. resIndex = 0,
  15063. result = [];
  15064. while (++index < length) {
  15065. var value = array[index];
  15066. if (value === placeholder || value === PLACEHOLDER) {
  15067. array[index] = PLACEHOLDER;
  15068. result[resIndex++] = index;
  15069. }
  15070. }
  15071. return result;
  15072. }
  15073. /**
  15074. * Converts `set` to an array of its values.
  15075. *
  15076. * @private
  15077. * @param {Object} set The set to convert.
  15078. * @returns {Array} Returns the values.
  15079. */
  15080. function setToArray(set) {
  15081. var index = -1,
  15082. result = Array(set.size);
  15083. set.forEach(function(value) {
  15084. result[++index] = value;
  15085. });
  15086. return result;
  15087. }
  15088. /**
  15089. * Converts `set` to its value-value pairs.
  15090. *
  15091. * @private
  15092. * @param {Object} set The set to convert.
  15093. * @returns {Array} Returns the value-value pairs.
  15094. */
  15095. function setToPairs(set) {
  15096. var index = -1,
  15097. result = Array(set.size);
  15098. set.forEach(function(value) {
  15099. result[++index] = [value, value];
  15100. });
  15101. return result;
  15102. }
  15103. /**
  15104. * A specialized version of `_.indexOf` which performs strict equality
  15105. * comparisons of values, i.e. `===`.
  15106. *
  15107. * @private
  15108. * @param {Array} array The array to inspect.
  15109. * @param {*} value The value to search for.
  15110. * @param {number} fromIndex The index to search from.
  15111. * @returns {number} Returns the index of the matched value, else `-1`.
  15112. */
  15113. function strictIndexOf(array, value, fromIndex) {
  15114. var index = fromIndex - 1,
  15115. length = array.length;
  15116. while (++index < length) {
  15117. if (array[index] === value) {
  15118. return index;
  15119. }
  15120. }
  15121. return -1;
  15122. }
  15123. /**
  15124. * A specialized version of `_.lastIndexOf` which performs strict equality
  15125. * comparisons of values, i.e. `===`.
  15126. *
  15127. * @private
  15128. * @param {Array} array The array to inspect.
  15129. * @param {*} value The value to search for.
  15130. * @param {number} fromIndex The index to search from.
  15131. * @returns {number} Returns the index of the matched value, else `-1`.
  15132. */
  15133. function strictLastIndexOf(array, value, fromIndex) {
  15134. var index = fromIndex + 1;
  15135. while (index--) {
  15136. if (array[index] === value) {
  15137. return index;
  15138. }
  15139. }
  15140. return index;
  15141. }
  15142. /**
  15143. * Gets the number of symbols in `string`.
  15144. *
  15145. * @private
  15146. * @param {string} string The string to inspect.
  15147. * @returns {number} Returns the string size.
  15148. */
  15149. function stringSize(string) {
  15150. return hasUnicode(string)
  15151. ? unicodeSize(string)
  15152. : asciiSize(string);
  15153. }
  15154. /**
  15155. * Converts `string` to an array.
  15156. *
  15157. * @private
  15158. * @param {string} string The string to convert.
  15159. * @returns {Array} Returns the converted array.
  15160. */
  15161. function stringToArray(string) {
  15162. return hasUnicode(string)
  15163. ? unicodeToArray(string)
  15164. : asciiToArray(string);
  15165. }
  15166. /**
  15167. * Used by `_.unescape` to convert HTML entities to characters.
  15168. *
  15169. * @private
  15170. * @param {string} chr The matched character to unescape.
  15171. * @returns {string} Returns the unescaped character.
  15172. */
  15173. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  15174. /**
  15175. * Gets the size of a Unicode `string`.
  15176. *
  15177. * @private
  15178. * @param {string} string The string inspect.
  15179. * @returns {number} Returns the string size.
  15180. */
  15181. function unicodeSize(string) {
  15182. var result = reUnicode.lastIndex = 0;
  15183. while (reUnicode.test(string)) {
  15184. ++result;
  15185. }
  15186. return result;
  15187. }
  15188. /**
  15189. * Converts a Unicode `string` to an array.
  15190. *
  15191. * @private
  15192. * @param {string} string The string to convert.
  15193. * @returns {Array} Returns the converted array.
  15194. */
  15195. function unicodeToArray(string) {
  15196. return string.match(reUnicode) || [];
  15197. }
  15198. /**
  15199. * Splits a Unicode `string` into an array of its words.
  15200. *
  15201. * @private
  15202. * @param {string} The string to inspect.
  15203. * @returns {Array} Returns the words of `string`.
  15204. */
  15205. function unicodeWords(string) {
  15206. return string.match(reUnicodeWord) || [];
  15207. }
  15208. /*--------------------------------------------------------------------------*/
  15209. /**
  15210. * Create a new pristine `lodash` function using the `context` object.
  15211. *
  15212. * @static
  15213. * @memberOf _
  15214. * @since 1.1.0
  15215. * @category Util
  15216. * @param {Object} [context=root] The context object.
  15217. * @returns {Function} Returns a new `lodash` function.
  15218. * @example
  15219. *
  15220. * _.mixin({ 'foo': _.constant('foo') });
  15221. *
  15222. * var lodash = _.runInContext();
  15223. * lodash.mixin({ 'bar': lodash.constant('bar') });
  15224. *
  15225. * _.isFunction(_.foo);
  15226. * // => true
  15227. * _.isFunction(_.bar);
  15228. * // => false
  15229. *
  15230. * lodash.isFunction(lodash.foo);
  15231. * // => false
  15232. * lodash.isFunction(lodash.bar);
  15233. * // => true
  15234. *
  15235. * // Create a suped-up `defer` in Node.js.
  15236. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  15237. */
  15238. var runInContext = (function runInContext(context) {
  15239. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  15240. /** Built-in constructor references. */
  15241. var Array = context.Array,
  15242. Date = context.Date,
  15243. Error = context.Error,
  15244. Function = context.Function,
  15245. Math = context.Math,
  15246. Object = context.Object,
  15247. RegExp = context.RegExp,
  15248. String = context.String,
  15249. TypeError = context.TypeError;
  15250. /** Used for built-in method references. */
  15251. var arrayProto = Array.prototype,
  15252. funcProto = Function.prototype,
  15253. objectProto = Object.prototype;
  15254. /** Used to detect overreaching core-js shims. */
  15255. var coreJsData = context['__core-js_shared__'];
  15256. /** Used to resolve the decompiled source of functions. */
  15257. var funcToString = funcProto.toString;
  15258. /** Used to check objects for own properties. */
  15259. var hasOwnProperty = objectProto.hasOwnProperty;
  15260. /** Used to generate unique IDs. */
  15261. var idCounter = 0;
  15262. /** Used to detect methods masquerading as native. */
  15263. var maskSrcKey = (function() {
  15264. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  15265. return uid ? ('Symbol(src)_1.' + uid) : '';
  15266. }());
  15267. /**
  15268. * Used to resolve the
  15269. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  15270. * of values.
  15271. */
  15272. var nativeObjectToString = objectProto.toString;
  15273. /** Used to infer the `Object` constructor. */
  15274. var objectCtorString = funcToString.call(Object);
  15275. /** Used to restore the original `_` reference in `_.noConflict`. */
  15276. var oldDash = root._;
  15277. /** Used to detect if a method is native. */
  15278. var reIsNative = RegExp('^' +
  15279. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  15280. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  15281. );
  15282. /** Built-in value references. */
  15283. var Buffer = moduleExports ? context.Buffer : undefined,
  15284. Symbol = context.Symbol,
  15285. Uint8Array = context.Uint8Array,
  15286. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  15287. getPrototype = overArg(Object.getPrototypeOf, Object),
  15288. objectCreate = Object.create,
  15289. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  15290. splice = arrayProto.splice,
  15291. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  15292. symIterator = Symbol ? Symbol.iterator : undefined,
  15293. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  15294. var defineProperty = (function() {
  15295. try {
  15296. var func = getNative(Object, 'defineProperty');
  15297. func({}, '', {});
  15298. return func;
  15299. } catch (e) {}
  15300. }());
  15301. /** Mocked built-ins. */
  15302. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  15303. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  15304. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  15305. /* Built-in method references for those with the same name as other `lodash` methods. */
  15306. var nativeCeil = Math.ceil,
  15307. nativeFloor = Math.floor,
  15308. nativeGetSymbols = Object.getOwnPropertySymbols,
  15309. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  15310. nativeIsFinite = context.isFinite,
  15311. nativeJoin = arrayProto.join,
  15312. nativeKeys = overArg(Object.keys, Object),
  15313. nativeMax = Math.max,
  15314. nativeMin = Math.min,
  15315. nativeNow = Date.now,
  15316. nativeParseInt = context.parseInt,
  15317. nativeRandom = Math.random,
  15318. nativeReverse = arrayProto.reverse;
  15319. /* Built-in method references that are verified to be native. */
  15320. var DataView = getNative(context, 'DataView'),
  15321. Map = getNative(context, 'Map'),
  15322. Promise = getNative(context, 'Promise'),
  15323. Set = getNative(context, 'Set'),
  15324. WeakMap = getNative(context, 'WeakMap'),
  15325. nativeCreate = getNative(Object, 'create');
  15326. /** Used to store function metadata. */
  15327. var metaMap = WeakMap && new WeakMap;
  15328. /** Used to lookup unminified function names. */
  15329. var realNames = {};
  15330. /** Used to detect maps, sets, and weakmaps. */
  15331. var dataViewCtorString = toSource(DataView),
  15332. mapCtorString = toSource(Map),
  15333. promiseCtorString = toSource(Promise),
  15334. setCtorString = toSource(Set),
  15335. weakMapCtorString = toSource(WeakMap);
  15336. /** Used to convert symbols to primitives and strings. */
  15337. var symbolProto = Symbol ? Symbol.prototype : undefined,
  15338. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  15339. symbolToString = symbolProto ? symbolProto.toString : undefined;
  15340. /*------------------------------------------------------------------------*/
  15341. /**
  15342. * Creates a `lodash` object which wraps `value` to enable implicit method
  15343. * chain sequences. Methods that operate on and return arrays, collections,
  15344. * and functions can be chained together. Methods that retrieve a single value
  15345. * or may return a primitive value will automatically end the chain sequence
  15346. * and return the unwrapped value. Otherwise, the value must be unwrapped
  15347. * with `_#value`.
  15348. *
  15349. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  15350. * enabled using `_.chain`.
  15351. *
  15352. * The execution of chained methods is lazy, that is, it's deferred until
  15353. * `_#value` is implicitly or explicitly called.
  15354. *
  15355. * Lazy evaluation allows several methods to support shortcut fusion.
  15356. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  15357. * the creation of intermediate arrays and can greatly reduce the number of
  15358. * iteratee executions. Sections of a chain sequence qualify for shortcut
  15359. * fusion if the section is applied to an array and iteratees accept only
  15360. * one argument. The heuristic for whether a section qualifies for shortcut
  15361. * fusion is subject to change.
  15362. *
  15363. * Chaining is supported in custom builds as long as the `_#value` method is
  15364. * directly or indirectly included in the build.
  15365. *
  15366. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  15367. *
  15368. * The wrapper `Array` methods are:
  15369. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  15370. *
  15371. * The wrapper `String` methods are:
  15372. * `replace` and `split`
  15373. *
  15374. * The wrapper methods that support shortcut fusion are:
  15375. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  15376. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  15377. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  15378. *
  15379. * The chainable wrapper methods are:
  15380. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  15381. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  15382. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  15383. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  15384. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  15385. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  15386. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  15387. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  15388. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  15389. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  15390. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  15391. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  15392. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  15393. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  15394. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  15395. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  15396. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  15397. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  15398. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  15399. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  15400. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  15401. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  15402. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  15403. * `zipObject`, `zipObjectDeep`, and `zipWith`
  15404. *
  15405. * The wrapper methods that are **not** chainable by default are:
  15406. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  15407. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  15408. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  15409. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  15410. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  15411. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  15412. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  15413. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  15414. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  15415. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  15416. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  15417. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  15418. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  15419. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  15420. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  15421. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  15422. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  15423. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  15424. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  15425. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  15426. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  15427. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  15428. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  15429. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  15430. * `upperFirst`, `value`, and `words`
  15431. *
  15432. * @name _
  15433. * @constructor
  15434. * @category Seq
  15435. * @param {*} value The value to wrap in a `lodash` instance.
  15436. * @returns {Object} Returns the new `lodash` wrapper instance.
  15437. * @example
  15438. *
  15439. * function square(n) {
  15440. * return n * n;
  15441. * }
  15442. *
  15443. * var wrapped = _([1, 2, 3]);
  15444. *
  15445. * // Returns an unwrapped value.
  15446. * wrapped.reduce(_.add);
  15447. * // => 6
  15448. *
  15449. * // Returns a wrapped value.
  15450. * var squares = wrapped.map(square);
  15451. *
  15452. * _.isArray(squares);
  15453. * // => false
  15454. *
  15455. * _.isArray(squares.value());
  15456. * // => true
  15457. */
  15458. function lodash(value) {
  15459. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  15460. if (value instanceof LodashWrapper) {
  15461. return value;
  15462. }
  15463. if (hasOwnProperty.call(value, '__wrapped__')) {
  15464. return wrapperClone(value);
  15465. }
  15466. }
  15467. return new LodashWrapper(value);
  15468. }
  15469. /**
  15470. * The base implementation of `_.create` without support for assigning
  15471. * properties to the created object.
  15472. *
  15473. * @private
  15474. * @param {Object} proto The object to inherit from.
  15475. * @returns {Object} Returns the new object.
  15476. */
  15477. var baseCreate = (function() {
  15478. function object() {}
  15479. return function(proto) {
  15480. if (!isObject(proto)) {
  15481. return {};
  15482. }
  15483. if (objectCreate) {
  15484. return objectCreate(proto);
  15485. }
  15486. object.prototype = proto;
  15487. var result = new object;
  15488. object.prototype = undefined;
  15489. return result;
  15490. };
  15491. }());
  15492. /**
  15493. * The function whose prototype chain sequence wrappers inherit from.
  15494. *
  15495. * @private
  15496. */
  15497. function baseLodash() {
  15498. // No operation performed.
  15499. }
  15500. /**
  15501. * The base constructor for creating `lodash` wrapper objects.
  15502. *
  15503. * @private
  15504. * @param {*} value The value to wrap.
  15505. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  15506. */
  15507. function LodashWrapper(value, chainAll) {
  15508. this.__wrapped__ = value;
  15509. this.__actions__ = [];
  15510. this.__chain__ = !!chainAll;
  15511. this.__index__ = 0;
  15512. this.__values__ = undefined;
  15513. }
  15514. /**
  15515. * By default, the template delimiters used by lodash are like those in
  15516. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  15517. * following template settings to use alternative delimiters.
  15518. *
  15519. * @static
  15520. * @memberOf _
  15521. * @type {Object}
  15522. */
  15523. lodash.templateSettings = {
  15524. /**
  15525. * Used to detect `data` property values to be HTML-escaped.
  15526. *
  15527. * @memberOf _.templateSettings
  15528. * @type {RegExp}
  15529. */
  15530. 'escape': reEscape,
  15531. /**
  15532. * Used to detect code to be evaluated.
  15533. *
  15534. * @memberOf _.templateSettings
  15535. * @type {RegExp}
  15536. */
  15537. 'evaluate': reEvaluate,
  15538. /**
  15539. * Used to detect `data` property values to inject.
  15540. *
  15541. * @memberOf _.templateSettings
  15542. * @type {RegExp}
  15543. */
  15544. 'interpolate': reInterpolate,
  15545. /**
  15546. * Used to reference the data object in the template text.
  15547. *
  15548. * @memberOf _.templateSettings
  15549. * @type {string}
  15550. */
  15551. 'variable': '',
  15552. /**
  15553. * Used to import variables into the compiled template.
  15554. *
  15555. * @memberOf _.templateSettings
  15556. * @type {Object}
  15557. */
  15558. 'imports': {
  15559. /**
  15560. * A reference to the `lodash` function.
  15561. *
  15562. * @memberOf _.templateSettings.imports
  15563. * @type {Function}
  15564. */
  15565. '_': lodash
  15566. }
  15567. };
  15568. // Ensure wrappers are instances of `baseLodash`.
  15569. lodash.prototype = baseLodash.prototype;
  15570. lodash.prototype.constructor = lodash;
  15571. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  15572. LodashWrapper.prototype.constructor = LodashWrapper;
  15573. /*------------------------------------------------------------------------*/
  15574. /**
  15575. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  15576. *
  15577. * @private
  15578. * @constructor
  15579. * @param {*} value The value to wrap.
  15580. */
  15581. function LazyWrapper(value) {
  15582. this.__wrapped__ = value;
  15583. this.__actions__ = [];
  15584. this.__dir__ = 1;
  15585. this.__filtered__ = false;
  15586. this.__iteratees__ = [];
  15587. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15588. this.__views__ = [];
  15589. }
  15590. /**
  15591. * Creates a clone of the lazy wrapper object.
  15592. *
  15593. * @private
  15594. * @name clone
  15595. * @memberOf LazyWrapper
  15596. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15597. */
  15598. function lazyClone() {
  15599. var result = new LazyWrapper(this.__wrapped__);
  15600. result.__actions__ = copyArray(this.__actions__);
  15601. result.__dir__ = this.__dir__;
  15602. result.__filtered__ = this.__filtered__;
  15603. result.__iteratees__ = copyArray(this.__iteratees__);
  15604. result.__takeCount__ = this.__takeCount__;
  15605. result.__views__ = copyArray(this.__views__);
  15606. return result;
  15607. }
  15608. /**
  15609. * Reverses the direction of lazy iteration.
  15610. *
  15611. * @private
  15612. * @name reverse
  15613. * @memberOf LazyWrapper
  15614. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15615. */
  15616. function lazyReverse() {
  15617. if (this.__filtered__) {
  15618. var result = new LazyWrapper(this);
  15619. result.__dir__ = -1;
  15620. result.__filtered__ = true;
  15621. } else {
  15622. result = this.clone();
  15623. result.__dir__ *= -1;
  15624. }
  15625. return result;
  15626. }
  15627. /**
  15628. * Extracts the unwrapped value from its lazy wrapper.
  15629. *
  15630. * @private
  15631. * @name value
  15632. * @memberOf LazyWrapper
  15633. * @returns {*} Returns the unwrapped value.
  15634. */
  15635. function lazyValue() {
  15636. var array = this.__wrapped__.value(),
  15637. dir = this.__dir__,
  15638. isArr = isArray(array),
  15639. isRight = dir < 0,
  15640. arrLength = isArr ? array.length : 0,
  15641. view = getView(0, arrLength, this.__views__),
  15642. start = view.start,
  15643. end = view.end,
  15644. length = end - start,
  15645. index = isRight ? end : (start - 1),
  15646. iteratees = this.__iteratees__,
  15647. iterLength = iteratees.length,
  15648. resIndex = 0,
  15649. takeCount = nativeMin(length, this.__takeCount__);
  15650. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15651. return baseWrapperValue(array, this.__actions__);
  15652. }
  15653. var result = [];
  15654. outer:
  15655. while (length-- && resIndex < takeCount) {
  15656. index += dir;
  15657. var iterIndex = -1,
  15658. value = array[index];
  15659. while (++iterIndex < iterLength) {
  15660. var data = iteratees[iterIndex],
  15661. iteratee = data.iteratee,
  15662. type = data.type,
  15663. computed = iteratee(value);
  15664. if (type == LAZY_MAP_FLAG) {
  15665. value = computed;
  15666. } else if (!computed) {
  15667. if (type == LAZY_FILTER_FLAG) {
  15668. continue outer;
  15669. } else {
  15670. break outer;
  15671. }
  15672. }
  15673. }
  15674. result[resIndex++] = value;
  15675. }
  15676. return result;
  15677. }
  15678. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15679. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15680. LazyWrapper.prototype.constructor = LazyWrapper;
  15681. /*------------------------------------------------------------------------*/
  15682. /**
  15683. * Creates a hash object.
  15684. *
  15685. * @private
  15686. * @constructor
  15687. * @param {Array} [entries] The key-value pairs to cache.
  15688. */
  15689. function Hash(entries) {
  15690. var index = -1,
  15691. length = entries == null ? 0 : entries.length;
  15692. this.clear();
  15693. while (++index < length) {
  15694. var entry = entries[index];
  15695. this.set(entry[0], entry[1]);
  15696. }
  15697. }
  15698. /**
  15699. * Removes all key-value entries from the hash.
  15700. *
  15701. * @private
  15702. * @name clear
  15703. * @memberOf Hash
  15704. */
  15705. function hashClear() {
  15706. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15707. this.size = 0;
  15708. }
  15709. /**
  15710. * Removes `key` and its value from the hash.
  15711. *
  15712. * @private
  15713. * @name delete
  15714. * @memberOf Hash
  15715. * @param {Object} hash The hash to modify.
  15716. * @param {string} key The key of the value to remove.
  15717. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15718. */
  15719. function hashDelete(key) {
  15720. var result = this.has(key) && delete this.__data__[key];
  15721. this.size -= result ? 1 : 0;
  15722. return result;
  15723. }
  15724. /**
  15725. * Gets the hash value for `key`.
  15726. *
  15727. * @private
  15728. * @name get
  15729. * @memberOf Hash
  15730. * @param {string} key The key of the value to get.
  15731. * @returns {*} Returns the entry value.
  15732. */
  15733. function hashGet(key) {
  15734. var data = this.__data__;
  15735. if (nativeCreate) {
  15736. var result = data[key];
  15737. return result === HASH_UNDEFINED ? undefined : result;
  15738. }
  15739. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15740. }
  15741. /**
  15742. * Checks if a hash value for `key` exists.
  15743. *
  15744. * @private
  15745. * @name has
  15746. * @memberOf Hash
  15747. * @param {string} key The key of the entry to check.
  15748. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15749. */
  15750. function hashHas(key) {
  15751. var data = this.__data__;
  15752. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15753. }
  15754. /**
  15755. * Sets the hash `key` to `value`.
  15756. *
  15757. * @private
  15758. * @name set
  15759. * @memberOf Hash
  15760. * @param {string} key The key of the value to set.
  15761. * @param {*} value The value to set.
  15762. * @returns {Object} Returns the hash instance.
  15763. */
  15764. function hashSet(key, value) {
  15765. var data = this.__data__;
  15766. this.size += this.has(key) ? 0 : 1;
  15767. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15768. return this;
  15769. }
  15770. // Add methods to `Hash`.
  15771. Hash.prototype.clear = hashClear;
  15772. Hash.prototype['delete'] = hashDelete;
  15773. Hash.prototype.get = hashGet;
  15774. Hash.prototype.has = hashHas;
  15775. Hash.prototype.set = hashSet;
  15776. /*------------------------------------------------------------------------*/
  15777. /**
  15778. * Creates an list cache object.
  15779. *
  15780. * @private
  15781. * @constructor
  15782. * @param {Array} [entries] The key-value pairs to cache.
  15783. */
  15784. function ListCache(entries) {
  15785. var index = -1,
  15786. length = entries == null ? 0 : entries.length;
  15787. this.clear();
  15788. while (++index < length) {
  15789. var entry = entries[index];
  15790. this.set(entry[0], entry[1]);
  15791. }
  15792. }
  15793. /**
  15794. * Removes all key-value entries from the list cache.
  15795. *
  15796. * @private
  15797. * @name clear
  15798. * @memberOf ListCache
  15799. */
  15800. function listCacheClear() {
  15801. this.__data__ = [];
  15802. this.size = 0;
  15803. }
  15804. /**
  15805. * Removes `key` and its value from the list cache.
  15806. *
  15807. * @private
  15808. * @name delete
  15809. * @memberOf ListCache
  15810. * @param {string} key The key of the value to remove.
  15811. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15812. */
  15813. function listCacheDelete(key) {
  15814. var data = this.__data__,
  15815. index = assocIndexOf(data, key);
  15816. if (index < 0) {
  15817. return false;
  15818. }
  15819. var lastIndex = data.length - 1;
  15820. if (index == lastIndex) {
  15821. data.pop();
  15822. } else {
  15823. splice.call(data, index, 1);
  15824. }
  15825. --this.size;
  15826. return true;
  15827. }
  15828. /**
  15829. * Gets the list cache value for `key`.
  15830. *
  15831. * @private
  15832. * @name get
  15833. * @memberOf ListCache
  15834. * @param {string} key The key of the value to get.
  15835. * @returns {*} Returns the entry value.
  15836. */
  15837. function listCacheGet(key) {
  15838. var data = this.__data__,
  15839. index = assocIndexOf(data, key);
  15840. return index < 0 ? undefined : data[index][1];
  15841. }
  15842. /**
  15843. * Checks if a list cache value for `key` exists.
  15844. *
  15845. * @private
  15846. * @name has
  15847. * @memberOf ListCache
  15848. * @param {string} key The key of the entry to check.
  15849. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15850. */
  15851. function listCacheHas(key) {
  15852. return assocIndexOf(this.__data__, key) > -1;
  15853. }
  15854. /**
  15855. * Sets the list cache `key` to `value`.
  15856. *
  15857. * @private
  15858. * @name set
  15859. * @memberOf ListCache
  15860. * @param {string} key The key of the value to set.
  15861. * @param {*} value The value to set.
  15862. * @returns {Object} Returns the list cache instance.
  15863. */
  15864. function listCacheSet(key, value) {
  15865. var data = this.__data__,
  15866. index = assocIndexOf(data, key);
  15867. if (index < 0) {
  15868. ++this.size;
  15869. data.push([key, value]);
  15870. } else {
  15871. data[index][1] = value;
  15872. }
  15873. return this;
  15874. }
  15875. // Add methods to `ListCache`.
  15876. ListCache.prototype.clear = listCacheClear;
  15877. ListCache.prototype['delete'] = listCacheDelete;
  15878. ListCache.prototype.get = listCacheGet;
  15879. ListCache.prototype.has = listCacheHas;
  15880. ListCache.prototype.set = listCacheSet;
  15881. /*------------------------------------------------------------------------*/
  15882. /**
  15883. * Creates a map cache object to store key-value pairs.
  15884. *
  15885. * @private
  15886. * @constructor
  15887. * @param {Array} [entries] The key-value pairs to cache.
  15888. */
  15889. function MapCache(entries) {
  15890. var index = -1,
  15891. length = entries == null ? 0 : entries.length;
  15892. this.clear();
  15893. while (++index < length) {
  15894. var entry = entries[index];
  15895. this.set(entry[0], entry[1]);
  15896. }
  15897. }
  15898. /**
  15899. * Removes all key-value entries from the map.
  15900. *
  15901. * @private
  15902. * @name clear
  15903. * @memberOf MapCache
  15904. */
  15905. function mapCacheClear() {
  15906. this.size = 0;
  15907. this.__data__ = {
  15908. 'hash': new Hash,
  15909. 'map': new (Map || ListCache),
  15910. 'string': new Hash
  15911. };
  15912. }
  15913. /**
  15914. * Removes `key` and its value from the map.
  15915. *
  15916. * @private
  15917. * @name delete
  15918. * @memberOf MapCache
  15919. * @param {string} key The key of the value to remove.
  15920. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15921. */
  15922. function mapCacheDelete(key) {
  15923. var result = getMapData(this, key)['delete'](key);
  15924. this.size -= result ? 1 : 0;
  15925. return result;
  15926. }
  15927. /**
  15928. * Gets the map value for `key`.
  15929. *
  15930. * @private
  15931. * @name get
  15932. * @memberOf MapCache
  15933. * @param {string} key The key of the value to get.
  15934. * @returns {*} Returns the entry value.
  15935. */
  15936. function mapCacheGet(key) {
  15937. return getMapData(this, key).get(key);
  15938. }
  15939. /**
  15940. * Checks if a map value for `key` exists.
  15941. *
  15942. * @private
  15943. * @name has
  15944. * @memberOf MapCache
  15945. * @param {string} key The key of the entry to check.
  15946. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15947. */
  15948. function mapCacheHas(key) {
  15949. return getMapData(this, key).has(key);
  15950. }
  15951. /**
  15952. * Sets the map `key` to `value`.
  15953. *
  15954. * @private
  15955. * @name set
  15956. * @memberOf MapCache
  15957. * @param {string} key The key of the value to set.
  15958. * @param {*} value The value to set.
  15959. * @returns {Object} Returns the map cache instance.
  15960. */
  15961. function mapCacheSet(key, value) {
  15962. var data = getMapData(this, key),
  15963. size = data.size;
  15964. data.set(key, value);
  15965. this.size += data.size == size ? 0 : 1;
  15966. return this;
  15967. }
  15968. // Add methods to `MapCache`.
  15969. MapCache.prototype.clear = mapCacheClear;
  15970. MapCache.prototype['delete'] = mapCacheDelete;
  15971. MapCache.prototype.get = mapCacheGet;
  15972. MapCache.prototype.has = mapCacheHas;
  15973. MapCache.prototype.set = mapCacheSet;
  15974. /*------------------------------------------------------------------------*/
  15975. /**
  15976. *
  15977. * Creates an array cache object to store unique values.
  15978. *
  15979. * @private
  15980. * @constructor
  15981. * @param {Array} [values] The values to cache.
  15982. */
  15983. function SetCache(values) {
  15984. var index = -1,
  15985. length = values == null ? 0 : values.length;
  15986. this.__data__ = new MapCache;
  15987. while (++index < length) {
  15988. this.add(values[index]);
  15989. }
  15990. }
  15991. /**
  15992. * Adds `value` to the array cache.
  15993. *
  15994. * @private
  15995. * @name add
  15996. * @memberOf SetCache
  15997. * @alias push
  15998. * @param {*} value The value to cache.
  15999. * @returns {Object} Returns the cache instance.
  16000. */
  16001. function setCacheAdd(value) {
  16002. this.__data__.set(value, HASH_UNDEFINED);
  16003. return this;
  16004. }
  16005. /**
  16006. * Checks if `value` is in the array cache.
  16007. *
  16008. * @private
  16009. * @name has
  16010. * @memberOf SetCache
  16011. * @param {*} value The value to search for.
  16012. * @returns {number} Returns `true` if `value` is found, else `false`.
  16013. */
  16014. function setCacheHas(value) {
  16015. return this.__data__.has(value);
  16016. }
  16017. // Add methods to `SetCache`.
  16018. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  16019. SetCache.prototype.has = setCacheHas;
  16020. /*------------------------------------------------------------------------*/
  16021. /**
  16022. * Creates a stack cache object to store key-value pairs.
  16023. *
  16024. * @private
  16025. * @constructor
  16026. * @param {Array} [entries] The key-value pairs to cache.
  16027. */
  16028. function Stack(entries) {
  16029. var data = this.__data__ = new ListCache(entries);
  16030. this.size = data.size;
  16031. }
  16032. /**
  16033. * Removes all key-value entries from the stack.
  16034. *
  16035. * @private
  16036. * @name clear
  16037. * @memberOf Stack
  16038. */
  16039. function stackClear() {
  16040. this.__data__ = new ListCache;
  16041. this.size = 0;
  16042. }
  16043. /**
  16044. * Removes `key` and its value from the stack.
  16045. *
  16046. * @private
  16047. * @name delete
  16048. * @memberOf Stack
  16049. * @param {string} key The key of the value to remove.
  16050. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  16051. */
  16052. function stackDelete(key) {
  16053. var data = this.__data__,
  16054. result = data['delete'](key);
  16055. this.size = data.size;
  16056. return result;
  16057. }
  16058. /**
  16059. * Gets the stack value for `key`.
  16060. *
  16061. * @private
  16062. * @name get
  16063. * @memberOf Stack
  16064. * @param {string} key The key of the value to get.
  16065. * @returns {*} Returns the entry value.
  16066. */
  16067. function stackGet(key) {
  16068. return this.__data__.get(key);
  16069. }
  16070. /**
  16071. * Checks if a stack value for `key` exists.
  16072. *
  16073. * @private
  16074. * @name has
  16075. * @memberOf Stack
  16076. * @param {string} key The key of the entry to check.
  16077. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  16078. */
  16079. function stackHas(key) {
  16080. return this.__data__.has(key);
  16081. }
  16082. /**
  16083. * Sets the stack `key` to `value`.
  16084. *
  16085. * @private
  16086. * @name set
  16087. * @memberOf Stack
  16088. * @param {string} key The key of the value to set.
  16089. * @param {*} value The value to set.
  16090. * @returns {Object} Returns the stack cache instance.
  16091. */
  16092. function stackSet(key, value) {
  16093. var data = this.__data__;
  16094. if (data instanceof ListCache) {
  16095. var pairs = data.__data__;
  16096. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  16097. pairs.push([key, value]);
  16098. this.size = ++data.size;
  16099. return this;
  16100. }
  16101. data = this.__data__ = new MapCache(pairs);
  16102. }
  16103. data.set(key, value);
  16104. this.size = data.size;
  16105. return this;
  16106. }
  16107. // Add methods to `Stack`.
  16108. Stack.prototype.clear = stackClear;
  16109. Stack.prototype['delete'] = stackDelete;
  16110. Stack.prototype.get = stackGet;
  16111. Stack.prototype.has = stackHas;
  16112. Stack.prototype.set = stackSet;
  16113. /*------------------------------------------------------------------------*/
  16114. /**
  16115. * Creates an array of the enumerable property names of the array-like `value`.
  16116. *
  16117. * @private
  16118. * @param {*} value The value to query.
  16119. * @param {boolean} inherited Specify returning inherited property names.
  16120. * @returns {Array} Returns the array of property names.
  16121. */
  16122. function arrayLikeKeys(value, inherited) {
  16123. var isArr = isArray(value),
  16124. isArg = !isArr && isArguments(value),
  16125. isBuff = !isArr && !isArg && isBuffer(value),
  16126. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  16127. skipIndexes = isArr || isArg || isBuff || isType,
  16128. result = skipIndexes ? baseTimes(value.length, String) : [],
  16129. length = result.length;
  16130. for (var key in value) {
  16131. if ((inherited || hasOwnProperty.call(value, key)) &&
  16132. !(skipIndexes && (
  16133. // Safari 9 has enumerable `arguments.length` in strict mode.
  16134. key == 'length' ||
  16135. // Node.js 0.10 has enumerable non-index properties on buffers.
  16136. (isBuff && (key == 'offset' || key == 'parent')) ||
  16137. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  16138. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  16139. // Skip index properties.
  16140. isIndex(key, length)
  16141. ))) {
  16142. result.push(key);
  16143. }
  16144. }
  16145. return result;
  16146. }
  16147. /**
  16148. * A specialized version of `_.sample` for arrays.
  16149. *
  16150. * @private
  16151. * @param {Array} array The array to sample.
  16152. * @returns {*} Returns the random element.
  16153. */
  16154. function arraySample(array) {
  16155. var length = array.length;
  16156. return length ? array[baseRandom(0, length - 1)] : undefined;
  16157. }
  16158. /**
  16159. * A specialized version of `_.sampleSize` for arrays.
  16160. *
  16161. * @private
  16162. * @param {Array} array The array to sample.
  16163. * @param {number} n The number of elements to sample.
  16164. * @returns {Array} Returns the random elements.
  16165. */
  16166. function arraySampleSize(array, n) {
  16167. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  16168. }
  16169. /**
  16170. * A specialized version of `_.shuffle` for arrays.
  16171. *
  16172. * @private
  16173. * @param {Array} array The array to shuffle.
  16174. * @returns {Array} Returns the new shuffled array.
  16175. */
  16176. function arrayShuffle(array) {
  16177. return shuffleSelf(copyArray(array));
  16178. }
  16179. /**
  16180. * This function is like `assignValue` except that it doesn't assign
  16181. * `undefined` values.
  16182. *
  16183. * @private
  16184. * @param {Object} object The object to modify.
  16185. * @param {string} key The key of the property to assign.
  16186. * @param {*} value The value to assign.
  16187. */
  16188. function assignMergeValue(object, key, value) {
  16189. if ((value !== undefined && !eq(object[key], value)) ||
  16190. (value === undefined && !(key in object))) {
  16191. baseAssignValue(object, key, value);
  16192. }
  16193. }
  16194. /**
  16195. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  16196. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16197. * for equality comparisons.
  16198. *
  16199. * @private
  16200. * @param {Object} object The object to modify.
  16201. * @param {string} key The key of the property to assign.
  16202. * @param {*} value The value to assign.
  16203. */
  16204. function assignValue(object, key, value) {
  16205. var objValue = object[key];
  16206. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  16207. (value === undefined && !(key in object))) {
  16208. baseAssignValue(object, key, value);
  16209. }
  16210. }
  16211. /**
  16212. * Gets the index at which the `key` is found in `array` of key-value pairs.
  16213. *
  16214. * @private
  16215. * @param {Array} array The array to inspect.
  16216. * @param {*} key The key to search for.
  16217. * @returns {number} Returns the index of the matched value, else `-1`.
  16218. */
  16219. function assocIndexOf(array, key) {
  16220. var length = array.length;
  16221. while (length--) {
  16222. if (eq(array[length][0], key)) {
  16223. return length;
  16224. }
  16225. }
  16226. return -1;
  16227. }
  16228. /**
  16229. * Aggregates elements of `collection` on `accumulator` with keys transformed
  16230. * by `iteratee` and values set by `setter`.
  16231. *
  16232. * @private
  16233. * @param {Array|Object} collection The collection to iterate over.
  16234. * @param {Function} setter The function to set `accumulator` values.
  16235. * @param {Function} iteratee The iteratee to transform keys.
  16236. * @param {Object} accumulator The initial aggregated object.
  16237. * @returns {Function} Returns `accumulator`.
  16238. */
  16239. function baseAggregator(collection, setter, iteratee, accumulator) {
  16240. baseEach(collection, function(value, key, collection) {
  16241. setter(accumulator, value, iteratee(value), collection);
  16242. });
  16243. return accumulator;
  16244. }
  16245. /**
  16246. * The base implementation of `_.assign` without support for multiple sources
  16247. * or `customizer` functions.
  16248. *
  16249. * @private
  16250. * @param {Object} object The destination object.
  16251. * @param {Object} source The source object.
  16252. * @returns {Object} Returns `object`.
  16253. */
  16254. function baseAssign(object, source) {
  16255. return object && copyObject(source, keys(source), object);
  16256. }
  16257. /**
  16258. * The base implementation of `_.assignIn` without support for multiple sources
  16259. * or `customizer` functions.
  16260. *
  16261. * @private
  16262. * @param {Object} object The destination object.
  16263. * @param {Object} source The source object.
  16264. * @returns {Object} Returns `object`.
  16265. */
  16266. function baseAssignIn(object, source) {
  16267. return object && copyObject(source, keysIn(source), object);
  16268. }
  16269. /**
  16270. * The base implementation of `assignValue` and `assignMergeValue` without
  16271. * value checks.
  16272. *
  16273. * @private
  16274. * @param {Object} object The object to modify.
  16275. * @param {string} key The key of the property to assign.
  16276. * @param {*} value The value to assign.
  16277. */
  16278. function baseAssignValue(object, key, value) {
  16279. if (key == '__proto__' && defineProperty) {
  16280. defineProperty(object, key, {
  16281. 'configurable': true,
  16282. 'enumerable': true,
  16283. 'value': value,
  16284. 'writable': true
  16285. });
  16286. } else {
  16287. object[key] = value;
  16288. }
  16289. }
  16290. /**
  16291. * The base implementation of `_.at` without support for individual paths.
  16292. *
  16293. * @private
  16294. * @param {Object} object The object to iterate over.
  16295. * @param {string[]} paths The property paths to pick.
  16296. * @returns {Array} Returns the picked elements.
  16297. */
  16298. function baseAt(object, paths) {
  16299. var index = -1,
  16300. length = paths.length,
  16301. result = Array(length),
  16302. skip = object == null;
  16303. while (++index < length) {
  16304. result[index] = skip ? undefined : get(object, paths[index]);
  16305. }
  16306. return result;
  16307. }
  16308. /**
  16309. * The base implementation of `_.clamp` which doesn't coerce arguments.
  16310. *
  16311. * @private
  16312. * @param {number} number The number to clamp.
  16313. * @param {number} [lower] The lower bound.
  16314. * @param {number} upper The upper bound.
  16315. * @returns {number} Returns the clamped number.
  16316. */
  16317. function baseClamp(number, lower, upper) {
  16318. if (number === number) {
  16319. if (upper !== undefined) {
  16320. number = number <= upper ? number : upper;
  16321. }
  16322. if (lower !== undefined) {
  16323. number = number >= lower ? number : lower;
  16324. }
  16325. }
  16326. return number;
  16327. }
  16328. /**
  16329. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  16330. * traversed objects.
  16331. *
  16332. * @private
  16333. * @param {*} value The value to clone.
  16334. * @param {boolean} bitmask The bitmask flags.
  16335. * 1 - Deep clone
  16336. * 2 - Flatten inherited properties
  16337. * 4 - Clone symbols
  16338. * @param {Function} [customizer] The function to customize cloning.
  16339. * @param {string} [key] The key of `value`.
  16340. * @param {Object} [object] The parent object of `value`.
  16341. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  16342. * @returns {*} Returns the cloned value.
  16343. */
  16344. function baseClone(value, bitmask, customizer, key, object, stack) {
  16345. var result,
  16346. isDeep = bitmask & CLONE_DEEP_FLAG,
  16347. isFlat = bitmask & CLONE_FLAT_FLAG,
  16348. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  16349. if (customizer) {
  16350. result = object ? customizer(value, key, object, stack) : customizer(value);
  16351. }
  16352. if (result !== undefined) {
  16353. return result;
  16354. }
  16355. if (!isObject(value)) {
  16356. return value;
  16357. }
  16358. var isArr = isArray(value);
  16359. if (isArr) {
  16360. result = initCloneArray(value);
  16361. if (!isDeep) {
  16362. return copyArray(value, result);
  16363. }
  16364. } else {
  16365. var tag = getTag(value),
  16366. isFunc = tag == funcTag || tag == genTag;
  16367. if (isBuffer(value)) {
  16368. return cloneBuffer(value, isDeep);
  16369. }
  16370. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  16371. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  16372. if (!isDeep) {
  16373. return isFlat
  16374. ? copySymbolsIn(value, baseAssignIn(result, value))
  16375. : copySymbols(value, baseAssign(result, value));
  16376. }
  16377. } else {
  16378. if (!cloneableTags[tag]) {
  16379. return object ? value : {};
  16380. }
  16381. result = initCloneByTag(value, tag, isDeep);
  16382. }
  16383. }
  16384. // Check for circular references and return its corresponding clone.
  16385. stack || (stack = new Stack);
  16386. var stacked = stack.get(value);
  16387. if (stacked) {
  16388. return stacked;
  16389. }
  16390. stack.set(value, result);
  16391. if (isSet(value)) {
  16392. value.forEach(function(subValue) {
  16393. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  16394. });
  16395. } else if (isMap(value)) {
  16396. value.forEach(function(subValue, key) {
  16397. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16398. });
  16399. }
  16400. var keysFunc = isFull
  16401. ? (isFlat ? getAllKeysIn : getAllKeys)
  16402. : (isFlat ? keysIn : keys);
  16403. var props = isArr ? undefined : keysFunc(value);
  16404. arrayEach(props || value, function(subValue, key) {
  16405. if (props) {
  16406. key = subValue;
  16407. subValue = value[key];
  16408. }
  16409. // Recursively populate clone (susceptible to call stack limits).
  16410. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16411. });
  16412. return result;
  16413. }
  16414. /**
  16415. * The base implementation of `_.conforms` which doesn't clone `source`.
  16416. *
  16417. * @private
  16418. * @param {Object} source The object of property predicates to conform to.
  16419. * @returns {Function} Returns the new spec function.
  16420. */
  16421. function baseConforms(source) {
  16422. var props = keys(source);
  16423. return function(object) {
  16424. return baseConformsTo(object, source, props);
  16425. };
  16426. }
  16427. /**
  16428. * The base implementation of `_.conformsTo` which accepts `props` to check.
  16429. *
  16430. * @private
  16431. * @param {Object} object The object to inspect.
  16432. * @param {Object} source The object of property predicates to conform to.
  16433. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  16434. */
  16435. function baseConformsTo(object, source, props) {
  16436. var length = props.length;
  16437. if (object == null) {
  16438. return !length;
  16439. }
  16440. object = Object(object);
  16441. while (length--) {
  16442. var key = props[length],
  16443. predicate = source[key],
  16444. value = object[key];
  16445. if ((value === undefined && !(key in object)) || !predicate(value)) {
  16446. return false;
  16447. }
  16448. }
  16449. return true;
  16450. }
  16451. /**
  16452. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  16453. * to provide to `func`.
  16454. *
  16455. * @private
  16456. * @param {Function} func The function to delay.
  16457. * @param {number} wait The number of milliseconds to delay invocation.
  16458. * @param {Array} args The arguments to provide to `func`.
  16459. * @returns {number|Object} Returns the timer id or timeout object.
  16460. */
  16461. function baseDelay(func, wait, args) {
  16462. if (typeof func != 'function') {
  16463. throw new TypeError(FUNC_ERROR_TEXT);
  16464. }
  16465. return setTimeout(function() { func.apply(undefined, args); }, wait);
  16466. }
  16467. /**
  16468. * The base implementation of methods like `_.difference` without support
  16469. * for excluding multiple arrays or iteratee shorthands.
  16470. *
  16471. * @private
  16472. * @param {Array} array The array to inspect.
  16473. * @param {Array} values The values to exclude.
  16474. * @param {Function} [iteratee] The iteratee invoked per element.
  16475. * @param {Function} [comparator] The comparator invoked per element.
  16476. * @returns {Array} Returns the new array of filtered values.
  16477. */
  16478. function baseDifference(array, values, iteratee, comparator) {
  16479. var index = -1,
  16480. includes = arrayIncludes,
  16481. isCommon = true,
  16482. length = array.length,
  16483. result = [],
  16484. valuesLength = values.length;
  16485. if (!length) {
  16486. return result;
  16487. }
  16488. if (iteratee) {
  16489. values = arrayMap(values, baseUnary(iteratee));
  16490. }
  16491. if (comparator) {
  16492. includes = arrayIncludesWith;
  16493. isCommon = false;
  16494. }
  16495. else if (values.length >= LARGE_ARRAY_SIZE) {
  16496. includes = cacheHas;
  16497. isCommon = false;
  16498. values = new SetCache(values);
  16499. }
  16500. outer:
  16501. while (++index < length) {
  16502. var value = array[index],
  16503. computed = iteratee == null ? value : iteratee(value);
  16504. value = (comparator || value !== 0) ? value : 0;
  16505. if (isCommon && computed === computed) {
  16506. var valuesIndex = valuesLength;
  16507. while (valuesIndex--) {
  16508. if (values[valuesIndex] === computed) {
  16509. continue outer;
  16510. }
  16511. }
  16512. result.push(value);
  16513. }
  16514. else if (!includes(values, computed, comparator)) {
  16515. result.push(value);
  16516. }
  16517. }
  16518. return result;
  16519. }
  16520. /**
  16521. * The base implementation of `_.forEach` without support for iteratee shorthands.
  16522. *
  16523. * @private
  16524. * @param {Array|Object} collection The collection to iterate over.
  16525. * @param {Function} iteratee The function invoked per iteration.
  16526. * @returns {Array|Object} Returns `collection`.
  16527. */
  16528. var baseEach = createBaseEach(baseForOwn);
  16529. /**
  16530. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  16531. *
  16532. * @private
  16533. * @param {Array|Object} collection The collection to iterate over.
  16534. * @param {Function} iteratee The function invoked per iteration.
  16535. * @returns {Array|Object} Returns `collection`.
  16536. */
  16537. var baseEachRight = createBaseEach(baseForOwnRight, true);
  16538. /**
  16539. * The base implementation of `_.every` without support for iteratee shorthands.
  16540. *
  16541. * @private
  16542. * @param {Array|Object} collection The collection to iterate over.
  16543. * @param {Function} predicate The function invoked per iteration.
  16544. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  16545. * else `false`
  16546. */
  16547. function baseEvery(collection, predicate) {
  16548. var result = true;
  16549. baseEach(collection, function(value, index, collection) {
  16550. result = !!predicate(value, index, collection);
  16551. return result;
  16552. });
  16553. return result;
  16554. }
  16555. /**
  16556. * The base implementation of methods like `_.max` and `_.min` which accepts a
  16557. * `comparator` to determine the extremum value.
  16558. *
  16559. * @private
  16560. * @param {Array} array The array to iterate over.
  16561. * @param {Function} iteratee The iteratee invoked per iteration.
  16562. * @param {Function} comparator The comparator used to compare values.
  16563. * @returns {*} Returns the extremum value.
  16564. */
  16565. function baseExtremum(array, iteratee, comparator) {
  16566. var index = -1,
  16567. length = array.length;
  16568. while (++index < length) {
  16569. var value = array[index],
  16570. current = iteratee(value);
  16571. if (current != null && (computed === undefined
  16572. ? (current === current && !isSymbol(current))
  16573. : comparator(current, computed)
  16574. )) {
  16575. var computed = current,
  16576. result = value;
  16577. }
  16578. }
  16579. return result;
  16580. }
  16581. /**
  16582. * The base implementation of `_.fill` without an iteratee call guard.
  16583. *
  16584. * @private
  16585. * @param {Array} array The array to fill.
  16586. * @param {*} value The value to fill `array` with.
  16587. * @param {number} [start=0] The start position.
  16588. * @param {number} [end=array.length] The end position.
  16589. * @returns {Array} Returns `array`.
  16590. */
  16591. function baseFill(array, value, start, end) {
  16592. var length = array.length;
  16593. start = toInteger(start);
  16594. if (start < 0) {
  16595. start = -start > length ? 0 : (length + start);
  16596. }
  16597. end = (end === undefined || end > length) ? length : toInteger(end);
  16598. if (end < 0) {
  16599. end += length;
  16600. }
  16601. end = start > end ? 0 : toLength(end);
  16602. while (start < end) {
  16603. array[start++] = value;
  16604. }
  16605. return array;
  16606. }
  16607. /**
  16608. * The base implementation of `_.filter` without support for iteratee shorthands.
  16609. *
  16610. * @private
  16611. * @param {Array|Object} collection The collection to iterate over.
  16612. * @param {Function} predicate The function invoked per iteration.
  16613. * @returns {Array} Returns the new filtered array.
  16614. */
  16615. function baseFilter(collection, predicate) {
  16616. var result = [];
  16617. baseEach(collection, function(value, index, collection) {
  16618. if (predicate(value, index, collection)) {
  16619. result.push(value);
  16620. }
  16621. });
  16622. return result;
  16623. }
  16624. /**
  16625. * The base implementation of `_.flatten` with support for restricting flattening.
  16626. *
  16627. * @private
  16628. * @param {Array} array The array to flatten.
  16629. * @param {number} depth The maximum recursion depth.
  16630. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16631. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16632. * @param {Array} [result=[]] The initial result value.
  16633. * @returns {Array} Returns the new flattened array.
  16634. */
  16635. function baseFlatten(array, depth, predicate, isStrict, result) {
  16636. var index = -1,
  16637. length = array.length;
  16638. predicate || (predicate = isFlattenable);
  16639. result || (result = []);
  16640. while (++index < length) {
  16641. var value = array[index];
  16642. if (depth > 0 && predicate(value)) {
  16643. if (depth > 1) {
  16644. // Recursively flatten arrays (susceptible to call stack limits).
  16645. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16646. } else {
  16647. arrayPush(result, value);
  16648. }
  16649. } else if (!isStrict) {
  16650. result[result.length] = value;
  16651. }
  16652. }
  16653. return result;
  16654. }
  16655. /**
  16656. * The base implementation of `baseForOwn` which iterates over `object`
  16657. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16658. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16659. *
  16660. * @private
  16661. * @param {Object} object The object to iterate over.
  16662. * @param {Function} iteratee The function invoked per iteration.
  16663. * @param {Function} keysFunc The function to get the keys of `object`.
  16664. * @returns {Object} Returns `object`.
  16665. */
  16666. var baseFor = createBaseFor();
  16667. /**
  16668. * This function is like `baseFor` except that it iterates over properties
  16669. * in the opposite order.
  16670. *
  16671. * @private
  16672. * @param {Object} object The object to iterate over.
  16673. * @param {Function} iteratee The function invoked per iteration.
  16674. * @param {Function} keysFunc The function to get the keys of `object`.
  16675. * @returns {Object} Returns `object`.
  16676. */
  16677. var baseForRight = createBaseFor(true);
  16678. /**
  16679. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16680. *
  16681. * @private
  16682. * @param {Object} object The object to iterate over.
  16683. * @param {Function} iteratee The function invoked per iteration.
  16684. * @returns {Object} Returns `object`.
  16685. */
  16686. function baseForOwn(object, iteratee) {
  16687. return object && baseFor(object, iteratee, keys);
  16688. }
  16689. /**
  16690. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16691. *
  16692. * @private
  16693. * @param {Object} object The object to iterate over.
  16694. * @param {Function} iteratee The function invoked per iteration.
  16695. * @returns {Object} Returns `object`.
  16696. */
  16697. function baseForOwnRight(object, iteratee) {
  16698. return object && baseForRight(object, iteratee, keys);
  16699. }
  16700. /**
  16701. * The base implementation of `_.functions` which creates an array of
  16702. * `object` function property names filtered from `props`.
  16703. *
  16704. * @private
  16705. * @param {Object} object The object to inspect.
  16706. * @param {Array} props The property names to filter.
  16707. * @returns {Array} Returns the function names.
  16708. */
  16709. function baseFunctions(object, props) {
  16710. return arrayFilter(props, function(key) {
  16711. return isFunction(object[key]);
  16712. });
  16713. }
  16714. /**
  16715. * The base implementation of `_.get` without support for default values.
  16716. *
  16717. * @private
  16718. * @param {Object} object The object to query.
  16719. * @param {Array|string} path The path of the property to get.
  16720. * @returns {*} Returns the resolved value.
  16721. */
  16722. function baseGet(object, path) {
  16723. path = castPath(path, object);
  16724. var index = 0,
  16725. length = path.length;
  16726. while (object != null && index < length) {
  16727. object = object[toKey(path[index++])];
  16728. }
  16729. return (index && index == length) ? object : undefined;
  16730. }
  16731. /**
  16732. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16733. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16734. * symbols of `object`.
  16735. *
  16736. * @private
  16737. * @param {Object} object The object to query.
  16738. * @param {Function} keysFunc The function to get the keys of `object`.
  16739. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16740. * @returns {Array} Returns the array of property names and symbols.
  16741. */
  16742. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16743. var result = keysFunc(object);
  16744. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16745. }
  16746. /**
  16747. * The base implementation of `getTag` without fallbacks for buggy environments.
  16748. *
  16749. * @private
  16750. * @param {*} value The value to query.
  16751. * @returns {string} Returns the `toStringTag`.
  16752. */
  16753. function baseGetTag(value) {
  16754. if (value == null) {
  16755. return value === undefined ? undefinedTag : nullTag;
  16756. }
  16757. return (symToStringTag && symToStringTag in Object(value))
  16758. ? getRawTag(value)
  16759. : objectToString(value);
  16760. }
  16761. /**
  16762. * The base implementation of `_.gt` which doesn't coerce arguments.
  16763. *
  16764. * @private
  16765. * @param {*} value The value to compare.
  16766. * @param {*} other The other value to compare.
  16767. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16768. * else `false`.
  16769. */
  16770. function baseGt(value, other) {
  16771. return value > other;
  16772. }
  16773. /**
  16774. * The base implementation of `_.has` without support for deep paths.
  16775. *
  16776. * @private
  16777. * @param {Object} [object] The object to query.
  16778. * @param {Array|string} key The key to check.
  16779. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16780. */
  16781. function baseHas(object, key) {
  16782. return object != null && hasOwnProperty.call(object, key);
  16783. }
  16784. /**
  16785. * The base implementation of `_.hasIn` without support for deep paths.
  16786. *
  16787. * @private
  16788. * @param {Object} [object] The object to query.
  16789. * @param {Array|string} key The key to check.
  16790. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16791. */
  16792. function baseHasIn(object, key) {
  16793. return object != null && key in Object(object);
  16794. }
  16795. /**
  16796. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16797. *
  16798. * @private
  16799. * @param {number} number The number to check.
  16800. * @param {number} start The start of the range.
  16801. * @param {number} end The end of the range.
  16802. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16803. */
  16804. function baseInRange(number, start, end) {
  16805. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16806. }
  16807. /**
  16808. * The base implementation of methods like `_.intersection`, without support
  16809. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16810. *
  16811. * @private
  16812. * @param {Array} arrays The arrays to inspect.
  16813. * @param {Function} [iteratee] The iteratee invoked per element.
  16814. * @param {Function} [comparator] The comparator invoked per element.
  16815. * @returns {Array} Returns the new array of shared values.
  16816. */
  16817. function baseIntersection(arrays, iteratee, comparator) {
  16818. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16819. length = arrays[0].length,
  16820. othLength = arrays.length,
  16821. othIndex = othLength,
  16822. caches = Array(othLength),
  16823. maxLength = Infinity,
  16824. result = [];
  16825. while (othIndex--) {
  16826. var array = arrays[othIndex];
  16827. if (othIndex && iteratee) {
  16828. array = arrayMap(array, baseUnary(iteratee));
  16829. }
  16830. maxLength = nativeMin(array.length, maxLength);
  16831. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16832. ? new SetCache(othIndex && array)
  16833. : undefined;
  16834. }
  16835. array = arrays[0];
  16836. var index = -1,
  16837. seen = caches[0];
  16838. outer:
  16839. while (++index < length && result.length < maxLength) {
  16840. var value = array[index],
  16841. computed = iteratee ? iteratee(value) : value;
  16842. value = (comparator || value !== 0) ? value : 0;
  16843. if (!(seen
  16844. ? cacheHas(seen, computed)
  16845. : includes(result, computed, comparator)
  16846. )) {
  16847. othIndex = othLength;
  16848. while (--othIndex) {
  16849. var cache = caches[othIndex];
  16850. if (!(cache
  16851. ? cacheHas(cache, computed)
  16852. : includes(arrays[othIndex], computed, comparator))
  16853. ) {
  16854. continue outer;
  16855. }
  16856. }
  16857. if (seen) {
  16858. seen.push(computed);
  16859. }
  16860. result.push(value);
  16861. }
  16862. }
  16863. return result;
  16864. }
  16865. /**
  16866. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16867. * `object` with values transformed by `iteratee` and set by `setter`.
  16868. *
  16869. * @private
  16870. * @param {Object} object The object to iterate over.
  16871. * @param {Function} setter The function to set `accumulator` values.
  16872. * @param {Function} iteratee The iteratee to transform values.
  16873. * @param {Object} accumulator The initial inverted object.
  16874. * @returns {Function} Returns `accumulator`.
  16875. */
  16876. function baseInverter(object, setter, iteratee, accumulator) {
  16877. baseForOwn(object, function(value, key, object) {
  16878. setter(accumulator, iteratee(value), key, object);
  16879. });
  16880. return accumulator;
  16881. }
  16882. /**
  16883. * The base implementation of `_.invoke` without support for individual
  16884. * method arguments.
  16885. *
  16886. * @private
  16887. * @param {Object} object The object to query.
  16888. * @param {Array|string} path The path of the method to invoke.
  16889. * @param {Array} args The arguments to invoke the method with.
  16890. * @returns {*} Returns the result of the invoked method.
  16891. */
  16892. function baseInvoke(object, path, args) {
  16893. path = castPath(path, object);
  16894. object = parent(object, path);
  16895. var func = object == null ? object : object[toKey(last(path))];
  16896. return func == null ? undefined : apply(func, object, args);
  16897. }
  16898. /**
  16899. * The base implementation of `_.isArguments`.
  16900. *
  16901. * @private
  16902. * @param {*} value The value to check.
  16903. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16904. */
  16905. function baseIsArguments(value) {
  16906. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16907. }
  16908. /**
  16909. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16910. *
  16911. * @private
  16912. * @param {*} value The value to check.
  16913. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16914. */
  16915. function baseIsArrayBuffer(value) {
  16916. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16917. }
  16918. /**
  16919. * The base implementation of `_.isDate` without Node.js optimizations.
  16920. *
  16921. * @private
  16922. * @param {*} value The value to check.
  16923. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16924. */
  16925. function baseIsDate(value) {
  16926. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16927. }
  16928. /**
  16929. * The base implementation of `_.isEqual` which supports partial comparisons
  16930. * and tracks traversed objects.
  16931. *
  16932. * @private
  16933. * @param {*} value The value to compare.
  16934. * @param {*} other The other value to compare.
  16935. * @param {boolean} bitmask The bitmask flags.
  16936. * 1 - Unordered comparison
  16937. * 2 - Partial comparison
  16938. * @param {Function} [customizer] The function to customize comparisons.
  16939. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16940. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16941. */
  16942. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16943. if (value === other) {
  16944. return true;
  16945. }
  16946. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16947. return value !== value && other !== other;
  16948. }
  16949. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16950. }
  16951. /**
  16952. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16953. * deep comparisons and tracks traversed objects enabling objects with circular
  16954. * references to be compared.
  16955. *
  16956. * @private
  16957. * @param {Object} object The object to compare.
  16958. * @param {Object} other The other object to compare.
  16959. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16960. * @param {Function} customizer The function to customize comparisons.
  16961. * @param {Function} equalFunc The function to determine equivalents of values.
  16962. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16963. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16964. */
  16965. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16966. var objIsArr = isArray(object),
  16967. othIsArr = isArray(other),
  16968. objTag = objIsArr ? arrayTag : getTag(object),
  16969. othTag = othIsArr ? arrayTag : getTag(other);
  16970. objTag = objTag == argsTag ? objectTag : objTag;
  16971. othTag = othTag == argsTag ? objectTag : othTag;
  16972. var objIsObj = objTag == objectTag,
  16973. othIsObj = othTag == objectTag,
  16974. isSameTag = objTag == othTag;
  16975. if (isSameTag && isBuffer(object)) {
  16976. if (!isBuffer(other)) {
  16977. return false;
  16978. }
  16979. objIsArr = true;
  16980. objIsObj = false;
  16981. }
  16982. if (isSameTag && !objIsObj) {
  16983. stack || (stack = new Stack);
  16984. return (objIsArr || isTypedArray(object))
  16985. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16986. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  16987. }
  16988. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  16989. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  16990. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  16991. if (objIsWrapped || othIsWrapped) {
  16992. var objUnwrapped = objIsWrapped ? object.value() : object,
  16993. othUnwrapped = othIsWrapped ? other.value() : other;
  16994. stack || (stack = new Stack);
  16995. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  16996. }
  16997. }
  16998. if (!isSameTag) {
  16999. return false;
  17000. }
  17001. stack || (stack = new Stack);
  17002. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  17003. }
  17004. /**
  17005. * The base implementation of `_.isMap` without Node.js optimizations.
  17006. *
  17007. * @private
  17008. * @param {*} value The value to check.
  17009. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  17010. */
  17011. function baseIsMap(value) {
  17012. return isObjectLike(value) && getTag(value) == mapTag;
  17013. }
  17014. /**
  17015. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  17016. *
  17017. * @private
  17018. * @param {Object} object The object to inspect.
  17019. * @param {Object} source The object of property values to match.
  17020. * @param {Array} matchData The property names, values, and compare flags to match.
  17021. * @param {Function} [customizer] The function to customize comparisons.
  17022. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  17023. */
  17024. function baseIsMatch(object, source, matchData, customizer) {
  17025. var index = matchData.length,
  17026. length = index,
  17027. noCustomizer = !customizer;
  17028. if (object == null) {
  17029. return !length;
  17030. }
  17031. object = Object(object);
  17032. while (index--) {
  17033. var data = matchData[index];
  17034. if ((noCustomizer && data[2])
  17035. ? data[1] !== object[data[0]]
  17036. : !(data[0] in object)
  17037. ) {
  17038. return false;
  17039. }
  17040. }
  17041. while (++index < length) {
  17042. data = matchData[index];
  17043. var key = data[0],
  17044. objValue = object[key],
  17045. srcValue = data[1];
  17046. if (noCustomizer && data[2]) {
  17047. if (objValue === undefined && !(key in object)) {
  17048. return false;
  17049. }
  17050. } else {
  17051. var stack = new Stack;
  17052. if (customizer) {
  17053. var result = customizer(objValue, srcValue, key, object, source, stack);
  17054. }
  17055. if (!(result === undefined
  17056. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  17057. : result
  17058. )) {
  17059. return false;
  17060. }
  17061. }
  17062. }
  17063. return true;
  17064. }
  17065. /**
  17066. * The base implementation of `_.isNative` without bad shim checks.
  17067. *
  17068. * @private
  17069. * @param {*} value The value to check.
  17070. * @returns {boolean} Returns `true` if `value` is a native function,
  17071. * else `false`.
  17072. */
  17073. function baseIsNative(value) {
  17074. if (!isObject(value) || isMasked(value)) {
  17075. return false;
  17076. }
  17077. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  17078. return pattern.test(toSource(value));
  17079. }
  17080. /**
  17081. * The base implementation of `_.isRegExp` without Node.js optimizations.
  17082. *
  17083. * @private
  17084. * @param {*} value The value to check.
  17085. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  17086. */
  17087. function baseIsRegExp(value) {
  17088. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  17089. }
  17090. /**
  17091. * The base implementation of `_.isSet` without Node.js optimizations.
  17092. *
  17093. * @private
  17094. * @param {*} value The value to check.
  17095. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  17096. */
  17097. function baseIsSet(value) {
  17098. return isObjectLike(value) && getTag(value) == setTag;
  17099. }
  17100. /**
  17101. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  17102. *
  17103. * @private
  17104. * @param {*} value The value to check.
  17105. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  17106. */
  17107. function baseIsTypedArray(value) {
  17108. return isObjectLike(value) &&
  17109. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  17110. }
  17111. /**
  17112. * The base implementation of `_.iteratee`.
  17113. *
  17114. * @private
  17115. * @param {*} [value=_.identity] The value to convert to an iteratee.
  17116. * @returns {Function} Returns the iteratee.
  17117. */
  17118. function baseIteratee(value) {
  17119. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  17120. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  17121. if (typeof value == 'function') {
  17122. return value;
  17123. }
  17124. if (value == null) {
  17125. return identity;
  17126. }
  17127. if (typeof value == 'object') {
  17128. return isArray(value)
  17129. ? baseMatchesProperty(value[0], value[1])
  17130. : baseMatches(value);
  17131. }
  17132. return property(value);
  17133. }
  17134. /**
  17135. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  17136. *
  17137. * @private
  17138. * @param {Object} object The object to query.
  17139. * @returns {Array} Returns the array of property names.
  17140. */
  17141. function baseKeys(object) {
  17142. if (!isPrototype(object)) {
  17143. return nativeKeys(object);
  17144. }
  17145. var result = [];
  17146. for (var key in Object(object)) {
  17147. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  17148. result.push(key);
  17149. }
  17150. }
  17151. return result;
  17152. }
  17153. /**
  17154. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  17155. *
  17156. * @private
  17157. * @param {Object} object The object to query.
  17158. * @returns {Array} Returns the array of property names.
  17159. */
  17160. function baseKeysIn(object) {
  17161. if (!isObject(object)) {
  17162. return nativeKeysIn(object);
  17163. }
  17164. var isProto = isPrototype(object),
  17165. result = [];
  17166. for (var key in object) {
  17167. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  17168. result.push(key);
  17169. }
  17170. }
  17171. return result;
  17172. }
  17173. /**
  17174. * The base implementation of `_.lt` which doesn't coerce arguments.
  17175. *
  17176. * @private
  17177. * @param {*} value The value to compare.
  17178. * @param {*} other The other value to compare.
  17179. * @returns {boolean} Returns `true` if `value` is less than `other`,
  17180. * else `false`.
  17181. */
  17182. function baseLt(value, other) {
  17183. return value < other;
  17184. }
  17185. /**
  17186. * The base implementation of `_.map` without support for iteratee shorthands.
  17187. *
  17188. * @private
  17189. * @param {Array|Object} collection The collection to iterate over.
  17190. * @param {Function} iteratee The function invoked per iteration.
  17191. * @returns {Array} Returns the new mapped array.
  17192. */
  17193. function baseMap(collection, iteratee) {
  17194. var index = -1,
  17195. result = isArrayLike(collection) ? Array(collection.length) : [];
  17196. baseEach(collection, function(value, key, collection) {
  17197. result[++index] = iteratee(value, key, collection);
  17198. });
  17199. return result;
  17200. }
  17201. /**
  17202. * The base implementation of `_.matches` which doesn't clone `source`.
  17203. *
  17204. * @private
  17205. * @param {Object} source The object of property values to match.
  17206. * @returns {Function} Returns the new spec function.
  17207. */
  17208. function baseMatches(source) {
  17209. var matchData = getMatchData(source);
  17210. if (matchData.length == 1 && matchData[0][2]) {
  17211. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  17212. }
  17213. return function(object) {
  17214. return object === source || baseIsMatch(object, source, matchData);
  17215. };
  17216. }
  17217. /**
  17218. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  17219. *
  17220. * @private
  17221. * @param {string} path The path of the property to get.
  17222. * @param {*} srcValue The value to match.
  17223. * @returns {Function} Returns the new spec function.
  17224. */
  17225. function baseMatchesProperty(path, srcValue) {
  17226. if (isKey(path) && isStrictComparable(srcValue)) {
  17227. return matchesStrictComparable(toKey(path), srcValue);
  17228. }
  17229. return function(object) {
  17230. var objValue = get(object, path);
  17231. return (objValue === undefined && objValue === srcValue)
  17232. ? hasIn(object, path)
  17233. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  17234. };
  17235. }
  17236. /**
  17237. * The base implementation of `_.merge` without support for multiple sources.
  17238. *
  17239. * @private
  17240. * @param {Object} object The destination object.
  17241. * @param {Object} source The source object.
  17242. * @param {number} srcIndex The index of `source`.
  17243. * @param {Function} [customizer] The function to customize merged values.
  17244. * @param {Object} [stack] Tracks traversed source values and their merged
  17245. * counterparts.
  17246. */
  17247. function baseMerge(object, source, srcIndex, customizer, stack) {
  17248. if (object === source) {
  17249. return;
  17250. }
  17251. baseFor(source, function(srcValue, key) {
  17252. stack || (stack = new Stack);
  17253. if (isObject(srcValue)) {
  17254. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  17255. }
  17256. else {
  17257. var newValue = customizer
  17258. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  17259. : undefined;
  17260. if (newValue === undefined) {
  17261. newValue = srcValue;
  17262. }
  17263. assignMergeValue(object, key, newValue);
  17264. }
  17265. }, keysIn);
  17266. }
  17267. /**
  17268. * A specialized version of `baseMerge` for arrays and objects which performs
  17269. * deep merges and tracks traversed objects enabling objects with circular
  17270. * references to be merged.
  17271. *
  17272. * @private
  17273. * @param {Object} object The destination object.
  17274. * @param {Object} source The source object.
  17275. * @param {string} key The key of the value to merge.
  17276. * @param {number} srcIndex The index of `source`.
  17277. * @param {Function} mergeFunc The function to merge values.
  17278. * @param {Function} [customizer] The function to customize assigned values.
  17279. * @param {Object} [stack] Tracks traversed source values and their merged
  17280. * counterparts.
  17281. */
  17282. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  17283. var objValue = safeGet(object, key),
  17284. srcValue = safeGet(source, key),
  17285. stacked = stack.get(srcValue);
  17286. if (stacked) {
  17287. assignMergeValue(object, key, stacked);
  17288. return;
  17289. }
  17290. var newValue = customizer
  17291. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  17292. : undefined;
  17293. var isCommon = newValue === undefined;
  17294. if (isCommon) {
  17295. var isArr = isArray(srcValue),
  17296. isBuff = !isArr && isBuffer(srcValue),
  17297. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  17298. newValue = srcValue;
  17299. if (isArr || isBuff || isTyped) {
  17300. if (isArray(objValue)) {
  17301. newValue = objValue;
  17302. }
  17303. else if (isArrayLikeObject(objValue)) {
  17304. newValue = copyArray(objValue);
  17305. }
  17306. else if (isBuff) {
  17307. isCommon = false;
  17308. newValue = cloneBuffer(srcValue, true);
  17309. }
  17310. else if (isTyped) {
  17311. isCommon = false;
  17312. newValue = cloneTypedArray(srcValue, true);
  17313. }
  17314. else {
  17315. newValue = [];
  17316. }
  17317. }
  17318. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  17319. newValue = objValue;
  17320. if (isArguments(objValue)) {
  17321. newValue = toPlainObject(objValue);
  17322. }
  17323. else if (!isObject(objValue) || isFunction(objValue)) {
  17324. newValue = initCloneObject(srcValue);
  17325. }
  17326. }
  17327. else {
  17328. isCommon = false;
  17329. }
  17330. }
  17331. if (isCommon) {
  17332. // Recursively merge objects and arrays (susceptible to call stack limits).
  17333. stack.set(srcValue, newValue);
  17334. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  17335. stack['delete'](srcValue);
  17336. }
  17337. assignMergeValue(object, key, newValue);
  17338. }
  17339. /**
  17340. * The base implementation of `_.nth` which doesn't coerce arguments.
  17341. *
  17342. * @private
  17343. * @param {Array} array The array to query.
  17344. * @param {number} n The index of the element to return.
  17345. * @returns {*} Returns the nth element of `array`.
  17346. */
  17347. function baseNth(array, n) {
  17348. var length = array.length;
  17349. if (!length) {
  17350. return;
  17351. }
  17352. n += n < 0 ? length : 0;
  17353. return isIndex(n, length) ? array[n] : undefined;
  17354. }
  17355. /**
  17356. * The base implementation of `_.orderBy` without param guards.
  17357. *
  17358. * @private
  17359. * @param {Array|Object} collection The collection to iterate over.
  17360. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  17361. * @param {string[]} orders The sort orders of `iteratees`.
  17362. * @returns {Array} Returns the new sorted array.
  17363. */
  17364. function baseOrderBy(collection, iteratees, orders) {
  17365. if (iteratees.length) {
  17366. iteratees = arrayMap(iteratees, function(iteratee) {
  17367. if (isArray(iteratee)) {
  17368. return function(value) {
  17369. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  17370. }
  17371. }
  17372. return iteratee;
  17373. });
  17374. } else {
  17375. iteratees = [identity];
  17376. }
  17377. var index = -1;
  17378. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  17379. var result = baseMap(collection, function(value, key, collection) {
  17380. var criteria = arrayMap(iteratees, function(iteratee) {
  17381. return iteratee(value);
  17382. });
  17383. return { 'criteria': criteria, 'index': ++index, 'value': value };
  17384. });
  17385. return baseSortBy(result, function(object, other) {
  17386. return compareMultiple(object, other, orders);
  17387. });
  17388. }
  17389. /**
  17390. * The base implementation of `_.pick` without support for individual
  17391. * property identifiers.
  17392. *
  17393. * @private
  17394. * @param {Object} object The source object.
  17395. * @param {string[]} paths The property paths to pick.
  17396. * @returns {Object} Returns the new object.
  17397. */
  17398. function basePick(object, paths) {
  17399. return basePickBy(object, paths, function(value, path) {
  17400. return hasIn(object, path);
  17401. });
  17402. }
  17403. /**
  17404. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  17405. *
  17406. * @private
  17407. * @param {Object} object The source object.
  17408. * @param {string[]} paths The property paths to pick.
  17409. * @param {Function} predicate The function invoked per property.
  17410. * @returns {Object} Returns the new object.
  17411. */
  17412. function basePickBy(object, paths, predicate) {
  17413. var index = -1,
  17414. length = paths.length,
  17415. result = {};
  17416. while (++index < length) {
  17417. var path = paths[index],
  17418. value = baseGet(object, path);
  17419. if (predicate(value, path)) {
  17420. baseSet(result, castPath(path, object), value);
  17421. }
  17422. }
  17423. return result;
  17424. }
  17425. /**
  17426. * A specialized version of `baseProperty` which supports deep paths.
  17427. *
  17428. * @private
  17429. * @param {Array|string} path The path of the property to get.
  17430. * @returns {Function} Returns the new accessor function.
  17431. */
  17432. function basePropertyDeep(path) {
  17433. return function(object) {
  17434. return baseGet(object, path);
  17435. };
  17436. }
  17437. /**
  17438. * The base implementation of `_.pullAllBy` without support for iteratee
  17439. * shorthands.
  17440. *
  17441. * @private
  17442. * @param {Array} array The array to modify.
  17443. * @param {Array} values The values to remove.
  17444. * @param {Function} [iteratee] The iteratee invoked per element.
  17445. * @param {Function} [comparator] The comparator invoked per element.
  17446. * @returns {Array} Returns `array`.
  17447. */
  17448. function basePullAll(array, values, iteratee, comparator) {
  17449. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  17450. index = -1,
  17451. length = values.length,
  17452. seen = array;
  17453. if (array === values) {
  17454. values = copyArray(values);
  17455. }
  17456. if (iteratee) {
  17457. seen = arrayMap(array, baseUnary(iteratee));
  17458. }
  17459. while (++index < length) {
  17460. var fromIndex = 0,
  17461. value = values[index],
  17462. computed = iteratee ? iteratee(value) : value;
  17463. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  17464. if (seen !== array) {
  17465. splice.call(seen, fromIndex, 1);
  17466. }
  17467. splice.call(array, fromIndex, 1);
  17468. }
  17469. }
  17470. return array;
  17471. }
  17472. /**
  17473. * The base implementation of `_.pullAt` without support for individual
  17474. * indexes or capturing the removed elements.
  17475. *
  17476. * @private
  17477. * @param {Array} array The array to modify.
  17478. * @param {number[]} indexes The indexes of elements to remove.
  17479. * @returns {Array} Returns `array`.
  17480. */
  17481. function basePullAt(array, indexes) {
  17482. var length = array ? indexes.length : 0,
  17483. lastIndex = length - 1;
  17484. while (length--) {
  17485. var index = indexes[length];
  17486. if (length == lastIndex || index !== previous) {
  17487. var previous = index;
  17488. if (isIndex(index)) {
  17489. splice.call(array, index, 1);
  17490. } else {
  17491. baseUnset(array, index);
  17492. }
  17493. }
  17494. }
  17495. return array;
  17496. }
  17497. /**
  17498. * The base implementation of `_.random` without support for returning
  17499. * floating-point numbers.
  17500. *
  17501. * @private
  17502. * @param {number} lower The lower bound.
  17503. * @param {number} upper The upper bound.
  17504. * @returns {number} Returns the random number.
  17505. */
  17506. function baseRandom(lower, upper) {
  17507. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  17508. }
  17509. /**
  17510. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  17511. * coerce arguments.
  17512. *
  17513. * @private
  17514. * @param {number} start The start of the range.
  17515. * @param {number} end The end of the range.
  17516. * @param {number} step The value to increment or decrement by.
  17517. * @param {boolean} [fromRight] Specify iterating from right to left.
  17518. * @returns {Array} Returns the range of numbers.
  17519. */
  17520. function baseRange(start, end, step, fromRight) {
  17521. var index = -1,
  17522. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  17523. result = Array(length);
  17524. while (length--) {
  17525. result[fromRight ? length : ++index] = start;
  17526. start += step;
  17527. }
  17528. return result;
  17529. }
  17530. /**
  17531. * The base implementation of `_.repeat` which doesn't coerce arguments.
  17532. *
  17533. * @private
  17534. * @param {string} string The string to repeat.
  17535. * @param {number} n The number of times to repeat the string.
  17536. * @returns {string} Returns the repeated string.
  17537. */
  17538. function baseRepeat(string, n) {
  17539. var result = '';
  17540. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  17541. return result;
  17542. }
  17543. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  17544. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  17545. do {
  17546. if (n % 2) {
  17547. result += string;
  17548. }
  17549. n = nativeFloor(n / 2);
  17550. if (n) {
  17551. string += string;
  17552. }
  17553. } while (n);
  17554. return result;
  17555. }
  17556. /**
  17557. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  17558. *
  17559. * @private
  17560. * @param {Function} func The function to apply a rest parameter to.
  17561. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17562. * @returns {Function} Returns the new function.
  17563. */
  17564. function baseRest(func, start) {
  17565. return setToString(overRest(func, start, identity), func + '');
  17566. }
  17567. /**
  17568. * The base implementation of `_.sample`.
  17569. *
  17570. * @private
  17571. * @param {Array|Object} collection The collection to sample.
  17572. * @returns {*} Returns the random element.
  17573. */
  17574. function baseSample(collection) {
  17575. return arraySample(values(collection));
  17576. }
  17577. /**
  17578. * The base implementation of `_.sampleSize` without param guards.
  17579. *
  17580. * @private
  17581. * @param {Array|Object} collection The collection to sample.
  17582. * @param {number} n The number of elements to sample.
  17583. * @returns {Array} Returns the random elements.
  17584. */
  17585. function baseSampleSize(collection, n) {
  17586. var array = values(collection);
  17587. return shuffleSelf(array, baseClamp(n, 0, array.length));
  17588. }
  17589. /**
  17590. * The base implementation of `_.set`.
  17591. *
  17592. * @private
  17593. * @param {Object} object The object to modify.
  17594. * @param {Array|string} path The path of the property to set.
  17595. * @param {*} value The value to set.
  17596. * @param {Function} [customizer] The function to customize path creation.
  17597. * @returns {Object} Returns `object`.
  17598. */
  17599. function baseSet(object, path, value, customizer) {
  17600. if (!isObject(object)) {
  17601. return object;
  17602. }
  17603. path = castPath(path, object);
  17604. var index = -1,
  17605. length = path.length,
  17606. lastIndex = length - 1,
  17607. nested = object;
  17608. while (nested != null && ++index < length) {
  17609. var key = toKey(path[index]),
  17610. newValue = value;
  17611. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  17612. return object;
  17613. }
  17614. if (index != lastIndex) {
  17615. var objValue = nested[key];
  17616. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17617. if (newValue === undefined) {
  17618. newValue = isObject(objValue)
  17619. ? objValue
  17620. : (isIndex(path[index + 1]) ? [] : {});
  17621. }
  17622. }
  17623. assignValue(nested, key, newValue);
  17624. nested = nested[key];
  17625. }
  17626. return object;
  17627. }
  17628. /**
  17629. * The base implementation of `setData` without support for hot loop shorting.
  17630. *
  17631. * @private
  17632. * @param {Function} func The function to associate metadata with.
  17633. * @param {*} data The metadata.
  17634. * @returns {Function} Returns `func`.
  17635. */
  17636. var baseSetData = !metaMap ? identity : function(func, data) {
  17637. metaMap.set(func, data);
  17638. return func;
  17639. };
  17640. /**
  17641. * The base implementation of `setToString` without support for hot loop shorting.
  17642. *
  17643. * @private
  17644. * @param {Function} func The function to modify.
  17645. * @param {Function} string The `toString` result.
  17646. * @returns {Function} Returns `func`.
  17647. */
  17648. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17649. return defineProperty(func, 'toString', {
  17650. 'configurable': true,
  17651. 'enumerable': false,
  17652. 'value': constant(string),
  17653. 'writable': true
  17654. });
  17655. };
  17656. /**
  17657. * The base implementation of `_.shuffle`.
  17658. *
  17659. * @private
  17660. * @param {Array|Object} collection The collection to shuffle.
  17661. * @returns {Array} Returns the new shuffled array.
  17662. */
  17663. function baseShuffle(collection) {
  17664. return shuffleSelf(values(collection));
  17665. }
  17666. /**
  17667. * The base implementation of `_.slice` without an iteratee call guard.
  17668. *
  17669. * @private
  17670. * @param {Array} array The array to slice.
  17671. * @param {number} [start=0] The start position.
  17672. * @param {number} [end=array.length] The end position.
  17673. * @returns {Array} Returns the slice of `array`.
  17674. */
  17675. function baseSlice(array, start, end) {
  17676. var index = -1,
  17677. length = array.length;
  17678. if (start < 0) {
  17679. start = -start > length ? 0 : (length + start);
  17680. }
  17681. end = end > length ? length : end;
  17682. if (end < 0) {
  17683. end += length;
  17684. }
  17685. length = start > end ? 0 : ((end - start) >>> 0);
  17686. start >>>= 0;
  17687. var result = Array(length);
  17688. while (++index < length) {
  17689. result[index] = array[index + start];
  17690. }
  17691. return result;
  17692. }
  17693. /**
  17694. * The base implementation of `_.some` without support for iteratee shorthands.
  17695. *
  17696. * @private
  17697. * @param {Array|Object} collection The collection to iterate over.
  17698. * @param {Function} predicate The function invoked per iteration.
  17699. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17700. * else `false`.
  17701. */
  17702. function baseSome(collection, predicate) {
  17703. var result;
  17704. baseEach(collection, function(value, index, collection) {
  17705. result = predicate(value, index, collection);
  17706. return !result;
  17707. });
  17708. return !!result;
  17709. }
  17710. /**
  17711. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17712. * performs a binary search of `array` to determine the index at which `value`
  17713. * should be inserted into `array` in order to maintain its sort order.
  17714. *
  17715. * @private
  17716. * @param {Array} array The sorted array to inspect.
  17717. * @param {*} value The value to evaluate.
  17718. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17719. * @returns {number} Returns the index at which `value` should be inserted
  17720. * into `array`.
  17721. */
  17722. function baseSortedIndex(array, value, retHighest) {
  17723. var low = 0,
  17724. high = array == null ? low : array.length;
  17725. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17726. while (low < high) {
  17727. var mid = (low + high) >>> 1,
  17728. computed = array[mid];
  17729. if (computed !== null && !isSymbol(computed) &&
  17730. (retHighest ? (computed <= value) : (computed < value))) {
  17731. low = mid + 1;
  17732. } else {
  17733. high = mid;
  17734. }
  17735. }
  17736. return high;
  17737. }
  17738. return baseSortedIndexBy(array, value, identity, retHighest);
  17739. }
  17740. /**
  17741. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17742. * which invokes `iteratee` for `value` and each element of `array` to compute
  17743. * their sort ranking. The iteratee is invoked with one argument; (value).
  17744. *
  17745. * @private
  17746. * @param {Array} array The sorted array to inspect.
  17747. * @param {*} value The value to evaluate.
  17748. * @param {Function} iteratee The iteratee invoked per element.
  17749. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17750. * @returns {number} Returns the index at which `value` should be inserted
  17751. * into `array`.
  17752. */
  17753. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17754. var low = 0,
  17755. high = array == null ? 0 : array.length;
  17756. if (high === 0) {
  17757. return 0;
  17758. }
  17759. value = iteratee(value);
  17760. var valIsNaN = value !== value,
  17761. valIsNull = value === null,
  17762. valIsSymbol = isSymbol(value),
  17763. valIsUndefined = value === undefined;
  17764. while (low < high) {
  17765. var mid = nativeFloor((low + high) / 2),
  17766. computed = iteratee(array[mid]),
  17767. othIsDefined = computed !== undefined,
  17768. othIsNull = computed === null,
  17769. othIsReflexive = computed === computed,
  17770. othIsSymbol = isSymbol(computed);
  17771. if (valIsNaN) {
  17772. var setLow = retHighest || othIsReflexive;
  17773. } else if (valIsUndefined) {
  17774. setLow = othIsReflexive && (retHighest || othIsDefined);
  17775. } else if (valIsNull) {
  17776. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17777. } else if (valIsSymbol) {
  17778. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17779. } else if (othIsNull || othIsSymbol) {
  17780. setLow = false;
  17781. } else {
  17782. setLow = retHighest ? (computed <= value) : (computed < value);
  17783. }
  17784. if (setLow) {
  17785. low = mid + 1;
  17786. } else {
  17787. high = mid;
  17788. }
  17789. }
  17790. return nativeMin(high, MAX_ARRAY_INDEX);
  17791. }
  17792. /**
  17793. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17794. * support for iteratee shorthands.
  17795. *
  17796. * @private
  17797. * @param {Array} array The array to inspect.
  17798. * @param {Function} [iteratee] The iteratee invoked per element.
  17799. * @returns {Array} Returns the new duplicate free array.
  17800. */
  17801. function baseSortedUniq(array, iteratee) {
  17802. var index = -1,
  17803. length = array.length,
  17804. resIndex = 0,
  17805. result = [];
  17806. while (++index < length) {
  17807. var value = array[index],
  17808. computed = iteratee ? iteratee(value) : value;
  17809. if (!index || !eq(computed, seen)) {
  17810. var seen = computed;
  17811. result[resIndex++] = value === 0 ? 0 : value;
  17812. }
  17813. }
  17814. return result;
  17815. }
  17816. /**
  17817. * The base implementation of `_.toNumber` which doesn't ensure correct
  17818. * conversions of binary, hexadecimal, or octal string values.
  17819. *
  17820. * @private
  17821. * @param {*} value The value to process.
  17822. * @returns {number} Returns the number.
  17823. */
  17824. function baseToNumber(value) {
  17825. if (typeof value == 'number') {
  17826. return value;
  17827. }
  17828. if (isSymbol(value)) {
  17829. return NAN;
  17830. }
  17831. return +value;
  17832. }
  17833. /**
  17834. * The base implementation of `_.toString` which doesn't convert nullish
  17835. * values to empty strings.
  17836. *
  17837. * @private
  17838. * @param {*} value The value to process.
  17839. * @returns {string} Returns the string.
  17840. */
  17841. function baseToString(value) {
  17842. // Exit early for strings to avoid a performance hit in some environments.
  17843. if (typeof value == 'string') {
  17844. return value;
  17845. }
  17846. if (isArray(value)) {
  17847. // Recursively convert values (susceptible to call stack limits).
  17848. return arrayMap(value, baseToString) + '';
  17849. }
  17850. if (isSymbol(value)) {
  17851. return symbolToString ? symbolToString.call(value) : '';
  17852. }
  17853. var result = (value + '');
  17854. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17855. }
  17856. /**
  17857. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17858. *
  17859. * @private
  17860. * @param {Array} array The array to inspect.
  17861. * @param {Function} [iteratee] The iteratee invoked per element.
  17862. * @param {Function} [comparator] The comparator invoked per element.
  17863. * @returns {Array} Returns the new duplicate free array.
  17864. */
  17865. function baseUniq(array, iteratee, comparator) {
  17866. var index = -1,
  17867. includes = arrayIncludes,
  17868. length = array.length,
  17869. isCommon = true,
  17870. result = [],
  17871. seen = result;
  17872. if (comparator) {
  17873. isCommon = false;
  17874. includes = arrayIncludesWith;
  17875. }
  17876. else if (length >= LARGE_ARRAY_SIZE) {
  17877. var set = iteratee ? null : createSet(array);
  17878. if (set) {
  17879. return setToArray(set);
  17880. }
  17881. isCommon = false;
  17882. includes = cacheHas;
  17883. seen = new SetCache;
  17884. }
  17885. else {
  17886. seen = iteratee ? [] : result;
  17887. }
  17888. outer:
  17889. while (++index < length) {
  17890. var value = array[index],
  17891. computed = iteratee ? iteratee(value) : value;
  17892. value = (comparator || value !== 0) ? value : 0;
  17893. if (isCommon && computed === computed) {
  17894. var seenIndex = seen.length;
  17895. while (seenIndex--) {
  17896. if (seen[seenIndex] === computed) {
  17897. continue outer;
  17898. }
  17899. }
  17900. if (iteratee) {
  17901. seen.push(computed);
  17902. }
  17903. result.push(value);
  17904. }
  17905. else if (!includes(seen, computed, comparator)) {
  17906. if (seen !== result) {
  17907. seen.push(computed);
  17908. }
  17909. result.push(value);
  17910. }
  17911. }
  17912. return result;
  17913. }
  17914. /**
  17915. * The base implementation of `_.unset`.
  17916. *
  17917. * @private
  17918. * @param {Object} object The object to modify.
  17919. * @param {Array|string} path The property path to unset.
  17920. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17921. */
  17922. function baseUnset(object, path) {
  17923. path = castPath(path, object);
  17924. object = parent(object, path);
  17925. return object == null || delete object[toKey(last(path))];
  17926. }
  17927. /**
  17928. * The base implementation of `_.update`.
  17929. *
  17930. * @private
  17931. * @param {Object} object The object to modify.
  17932. * @param {Array|string} path The path of the property to update.
  17933. * @param {Function} updater The function to produce the updated value.
  17934. * @param {Function} [customizer] The function to customize path creation.
  17935. * @returns {Object} Returns `object`.
  17936. */
  17937. function baseUpdate(object, path, updater, customizer) {
  17938. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17939. }
  17940. /**
  17941. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17942. * without support for iteratee shorthands.
  17943. *
  17944. * @private
  17945. * @param {Array} array The array to query.
  17946. * @param {Function} predicate The function invoked per iteration.
  17947. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17948. * @param {boolean} [fromRight] Specify iterating from right to left.
  17949. * @returns {Array} Returns the slice of `array`.
  17950. */
  17951. function baseWhile(array, predicate, isDrop, fromRight) {
  17952. var length = array.length,
  17953. index = fromRight ? length : -1;
  17954. while ((fromRight ? index-- : ++index < length) &&
  17955. predicate(array[index], index, array)) {}
  17956. return isDrop
  17957. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17958. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17959. }
  17960. /**
  17961. * The base implementation of `wrapperValue` which returns the result of
  17962. * performing a sequence of actions on the unwrapped `value`, where each
  17963. * successive action is supplied the return value of the previous.
  17964. *
  17965. * @private
  17966. * @param {*} value The unwrapped value.
  17967. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17968. * @returns {*} Returns the resolved value.
  17969. */
  17970. function baseWrapperValue(value, actions) {
  17971. var result = value;
  17972. if (result instanceof LazyWrapper) {
  17973. result = result.value();
  17974. }
  17975. return arrayReduce(actions, function(result, action) {
  17976. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17977. }, result);
  17978. }
  17979. /**
  17980. * The base implementation of methods like `_.xor`, without support for
  17981. * iteratee shorthands, that accepts an array of arrays to inspect.
  17982. *
  17983. * @private
  17984. * @param {Array} arrays The arrays to inspect.
  17985. * @param {Function} [iteratee] The iteratee invoked per element.
  17986. * @param {Function} [comparator] The comparator invoked per element.
  17987. * @returns {Array} Returns the new array of values.
  17988. */
  17989. function baseXor(arrays, iteratee, comparator) {
  17990. var length = arrays.length;
  17991. if (length < 2) {
  17992. return length ? baseUniq(arrays[0]) : [];
  17993. }
  17994. var index = -1,
  17995. result = Array(length);
  17996. while (++index < length) {
  17997. var array = arrays[index],
  17998. othIndex = -1;
  17999. while (++othIndex < length) {
  18000. if (othIndex != index) {
  18001. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  18002. }
  18003. }
  18004. }
  18005. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  18006. }
  18007. /**
  18008. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  18009. *
  18010. * @private
  18011. * @param {Array} props The property identifiers.
  18012. * @param {Array} values The property values.
  18013. * @param {Function} assignFunc The function to assign values.
  18014. * @returns {Object} Returns the new object.
  18015. */
  18016. function baseZipObject(props, values, assignFunc) {
  18017. var index = -1,
  18018. length = props.length,
  18019. valsLength = values.length,
  18020. result = {};
  18021. while (++index < length) {
  18022. var value = index < valsLength ? values[index] : undefined;
  18023. assignFunc(result, props[index], value);
  18024. }
  18025. return result;
  18026. }
  18027. /**
  18028. * Casts `value` to an empty array if it's not an array like object.
  18029. *
  18030. * @private
  18031. * @param {*} value The value to inspect.
  18032. * @returns {Array|Object} Returns the cast array-like object.
  18033. */
  18034. function castArrayLikeObject(value) {
  18035. return isArrayLikeObject(value) ? value : [];
  18036. }
  18037. /**
  18038. * Casts `value` to `identity` if it's not a function.
  18039. *
  18040. * @private
  18041. * @param {*} value The value to inspect.
  18042. * @returns {Function} Returns cast function.
  18043. */
  18044. function castFunction(value) {
  18045. return typeof value == 'function' ? value : identity;
  18046. }
  18047. /**
  18048. * Casts `value` to a path array if it's not one.
  18049. *
  18050. * @private
  18051. * @param {*} value The value to inspect.
  18052. * @param {Object} [object] The object to query keys on.
  18053. * @returns {Array} Returns the cast property path array.
  18054. */
  18055. function castPath(value, object) {
  18056. if (isArray(value)) {
  18057. return value;
  18058. }
  18059. return isKey(value, object) ? [value] : stringToPath(toString(value));
  18060. }
  18061. /**
  18062. * A `baseRest` alias which can be replaced with `identity` by module
  18063. * replacement plugins.
  18064. *
  18065. * @private
  18066. * @type {Function}
  18067. * @param {Function} func The function to apply a rest parameter to.
  18068. * @returns {Function} Returns the new function.
  18069. */
  18070. var castRest = baseRest;
  18071. /**
  18072. * Casts `array` to a slice if it's needed.
  18073. *
  18074. * @private
  18075. * @param {Array} array The array to inspect.
  18076. * @param {number} start The start position.
  18077. * @param {number} [end=array.length] The end position.
  18078. * @returns {Array} Returns the cast slice.
  18079. */
  18080. function castSlice(array, start, end) {
  18081. var length = array.length;
  18082. end = end === undefined ? length : end;
  18083. return (!start && end >= length) ? array : baseSlice(array, start, end);
  18084. }
  18085. /**
  18086. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  18087. *
  18088. * @private
  18089. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  18090. */
  18091. var clearTimeout = ctxClearTimeout || function(id) {
  18092. return root.clearTimeout(id);
  18093. };
  18094. /**
  18095. * Creates a clone of `buffer`.
  18096. *
  18097. * @private
  18098. * @param {Buffer} buffer The buffer to clone.
  18099. * @param {boolean} [isDeep] Specify a deep clone.
  18100. * @returns {Buffer} Returns the cloned buffer.
  18101. */
  18102. function cloneBuffer(buffer, isDeep) {
  18103. if (isDeep) {
  18104. return buffer.slice();
  18105. }
  18106. var length = buffer.length,
  18107. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  18108. buffer.copy(result);
  18109. return result;
  18110. }
  18111. /**
  18112. * Creates a clone of `arrayBuffer`.
  18113. *
  18114. * @private
  18115. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  18116. * @returns {ArrayBuffer} Returns the cloned array buffer.
  18117. */
  18118. function cloneArrayBuffer(arrayBuffer) {
  18119. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  18120. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  18121. return result;
  18122. }
  18123. /**
  18124. * Creates a clone of `dataView`.
  18125. *
  18126. * @private
  18127. * @param {Object} dataView The data view to clone.
  18128. * @param {boolean} [isDeep] Specify a deep clone.
  18129. * @returns {Object} Returns the cloned data view.
  18130. */
  18131. function cloneDataView(dataView, isDeep) {
  18132. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  18133. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  18134. }
  18135. /**
  18136. * Creates a clone of `regexp`.
  18137. *
  18138. * @private
  18139. * @param {Object} regexp The regexp to clone.
  18140. * @returns {Object} Returns the cloned regexp.
  18141. */
  18142. function cloneRegExp(regexp) {
  18143. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  18144. result.lastIndex = regexp.lastIndex;
  18145. return result;
  18146. }
  18147. /**
  18148. * Creates a clone of the `symbol` object.
  18149. *
  18150. * @private
  18151. * @param {Object} symbol The symbol object to clone.
  18152. * @returns {Object} Returns the cloned symbol object.
  18153. */
  18154. function cloneSymbol(symbol) {
  18155. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  18156. }
  18157. /**
  18158. * Creates a clone of `typedArray`.
  18159. *
  18160. * @private
  18161. * @param {Object} typedArray The typed array to clone.
  18162. * @param {boolean} [isDeep] Specify a deep clone.
  18163. * @returns {Object} Returns the cloned typed array.
  18164. */
  18165. function cloneTypedArray(typedArray, isDeep) {
  18166. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  18167. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  18168. }
  18169. /**
  18170. * Compares values to sort them in ascending order.
  18171. *
  18172. * @private
  18173. * @param {*} value The value to compare.
  18174. * @param {*} other The other value to compare.
  18175. * @returns {number} Returns the sort order indicator for `value`.
  18176. */
  18177. function compareAscending(value, other) {
  18178. if (value !== other) {
  18179. var valIsDefined = value !== undefined,
  18180. valIsNull = value === null,
  18181. valIsReflexive = value === value,
  18182. valIsSymbol = isSymbol(value);
  18183. var othIsDefined = other !== undefined,
  18184. othIsNull = other === null,
  18185. othIsReflexive = other === other,
  18186. othIsSymbol = isSymbol(other);
  18187. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  18188. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  18189. (valIsNull && othIsDefined && othIsReflexive) ||
  18190. (!valIsDefined && othIsReflexive) ||
  18191. !valIsReflexive) {
  18192. return 1;
  18193. }
  18194. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  18195. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  18196. (othIsNull && valIsDefined && valIsReflexive) ||
  18197. (!othIsDefined && valIsReflexive) ||
  18198. !othIsReflexive) {
  18199. return -1;
  18200. }
  18201. }
  18202. return 0;
  18203. }
  18204. /**
  18205. * Used by `_.orderBy` to compare multiple properties of a value to another
  18206. * and stable sort them.
  18207. *
  18208. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  18209. * specify an order of "desc" for descending or "asc" for ascending sort order
  18210. * of corresponding values.
  18211. *
  18212. * @private
  18213. * @param {Object} object The object to compare.
  18214. * @param {Object} other The other object to compare.
  18215. * @param {boolean[]|string[]} orders The order to sort by for each property.
  18216. * @returns {number} Returns the sort order indicator for `object`.
  18217. */
  18218. function compareMultiple(object, other, orders) {
  18219. var index = -1,
  18220. objCriteria = object.criteria,
  18221. othCriteria = other.criteria,
  18222. length = objCriteria.length,
  18223. ordersLength = orders.length;
  18224. while (++index < length) {
  18225. var result = compareAscending(objCriteria[index], othCriteria[index]);
  18226. if (result) {
  18227. if (index >= ordersLength) {
  18228. return result;
  18229. }
  18230. var order = orders[index];
  18231. return result * (order == 'desc' ? -1 : 1);
  18232. }
  18233. }
  18234. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  18235. // that causes it, under certain circumstances, to provide the same value for
  18236. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  18237. // for more details.
  18238. //
  18239. // This also ensures a stable sort in V8 and other engines.
  18240. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  18241. return object.index - other.index;
  18242. }
  18243. /**
  18244. * Creates an array that is the composition of partially applied arguments,
  18245. * placeholders, and provided arguments into a single array of arguments.
  18246. *
  18247. * @private
  18248. * @param {Array} args The provided arguments.
  18249. * @param {Array} partials The arguments to prepend to those provided.
  18250. * @param {Array} holders The `partials` placeholder indexes.
  18251. * @params {boolean} [isCurried] Specify composing for a curried function.
  18252. * @returns {Array} Returns the new array of composed arguments.
  18253. */
  18254. function composeArgs(args, partials, holders, isCurried) {
  18255. var argsIndex = -1,
  18256. argsLength = args.length,
  18257. holdersLength = holders.length,
  18258. leftIndex = -1,
  18259. leftLength = partials.length,
  18260. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18261. result = Array(leftLength + rangeLength),
  18262. isUncurried = !isCurried;
  18263. while (++leftIndex < leftLength) {
  18264. result[leftIndex] = partials[leftIndex];
  18265. }
  18266. while (++argsIndex < holdersLength) {
  18267. if (isUncurried || argsIndex < argsLength) {
  18268. result[holders[argsIndex]] = args[argsIndex];
  18269. }
  18270. }
  18271. while (rangeLength--) {
  18272. result[leftIndex++] = args[argsIndex++];
  18273. }
  18274. return result;
  18275. }
  18276. /**
  18277. * This function is like `composeArgs` except that the arguments composition
  18278. * is tailored for `_.partialRight`.
  18279. *
  18280. * @private
  18281. * @param {Array} args The provided arguments.
  18282. * @param {Array} partials The arguments to append to those provided.
  18283. * @param {Array} holders The `partials` placeholder indexes.
  18284. * @params {boolean} [isCurried] Specify composing for a curried function.
  18285. * @returns {Array} Returns the new array of composed arguments.
  18286. */
  18287. function composeArgsRight(args, partials, holders, isCurried) {
  18288. var argsIndex = -1,
  18289. argsLength = args.length,
  18290. holdersIndex = -1,
  18291. holdersLength = holders.length,
  18292. rightIndex = -1,
  18293. rightLength = partials.length,
  18294. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18295. result = Array(rangeLength + rightLength),
  18296. isUncurried = !isCurried;
  18297. while (++argsIndex < rangeLength) {
  18298. result[argsIndex] = args[argsIndex];
  18299. }
  18300. var offset = argsIndex;
  18301. while (++rightIndex < rightLength) {
  18302. result[offset + rightIndex] = partials[rightIndex];
  18303. }
  18304. while (++holdersIndex < holdersLength) {
  18305. if (isUncurried || argsIndex < argsLength) {
  18306. result[offset + holders[holdersIndex]] = args[argsIndex++];
  18307. }
  18308. }
  18309. return result;
  18310. }
  18311. /**
  18312. * Copies the values of `source` to `array`.
  18313. *
  18314. * @private
  18315. * @param {Array} source The array to copy values from.
  18316. * @param {Array} [array=[]] The array to copy values to.
  18317. * @returns {Array} Returns `array`.
  18318. */
  18319. function copyArray(source, array) {
  18320. var index = -1,
  18321. length = source.length;
  18322. array || (array = Array(length));
  18323. while (++index < length) {
  18324. array[index] = source[index];
  18325. }
  18326. return array;
  18327. }
  18328. /**
  18329. * Copies properties of `source` to `object`.
  18330. *
  18331. * @private
  18332. * @param {Object} source The object to copy properties from.
  18333. * @param {Array} props The property identifiers to copy.
  18334. * @param {Object} [object={}] The object to copy properties to.
  18335. * @param {Function} [customizer] The function to customize copied values.
  18336. * @returns {Object} Returns `object`.
  18337. */
  18338. function copyObject(source, props, object, customizer) {
  18339. var isNew = !object;
  18340. object || (object = {});
  18341. var index = -1,
  18342. length = props.length;
  18343. while (++index < length) {
  18344. var key = props[index];
  18345. var newValue = customizer
  18346. ? customizer(object[key], source[key], key, object, source)
  18347. : undefined;
  18348. if (newValue === undefined) {
  18349. newValue = source[key];
  18350. }
  18351. if (isNew) {
  18352. baseAssignValue(object, key, newValue);
  18353. } else {
  18354. assignValue(object, key, newValue);
  18355. }
  18356. }
  18357. return object;
  18358. }
  18359. /**
  18360. * Copies own symbols of `source` to `object`.
  18361. *
  18362. * @private
  18363. * @param {Object} source The object to copy symbols from.
  18364. * @param {Object} [object={}] The object to copy symbols to.
  18365. * @returns {Object} Returns `object`.
  18366. */
  18367. function copySymbols(source, object) {
  18368. return copyObject(source, getSymbols(source), object);
  18369. }
  18370. /**
  18371. * Copies own and inherited symbols of `source` to `object`.
  18372. *
  18373. * @private
  18374. * @param {Object} source The object to copy symbols from.
  18375. * @param {Object} [object={}] The object to copy symbols to.
  18376. * @returns {Object} Returns `object`.
  18377. */
  18378. function copySymbolsIn(source, object) {
  18379. return copyObject(source, getSymbolsIn(source), object);
  18380. }
  18381. /**
  18382. * Creates a function like `_.groupBy`.
  18383. *
  18384. * @private
  18385. * @param {Function} setter The function to set accumulator values.
  18386. * @param {Function} [initializer] The accumulator object initializer.
  18387. * @returns {Function} Returns the new aggregator function.
  18388. */
  18389. function createAggregator(setter, initializer) {
  18390. return function(collection, iteratee) {
  18391. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  18392. accumulator = initializer ? initializer() : {};
  18393. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  18394. };
  18395. }
  18396. /**
  18397. * Creates a function like `_.assign`.
  18398. *
  18399. * @private
  18400. * @param {Function} assigner The function to assign values.
  18401. * @returns {Function} Returns the new assigner function.
  18402. */
  18403. function createAssigner(assigner) {
  18404. return baseRest(function(object, sources) {
  18405. var index = -1,
  18406. length = sources.length,
  18407. customizer = length > 1 ? sources[length - 1] : undefined,
  18408. guard = length > 2 ? sources[2] : undefined;
  18409. customizer = (assigner.length > 3 && typeof customizer == 'function')
  18410. ? (length--, customizer)
  18411. : undefined;
  18412. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  18413. customizer = length < 3 ? undefined : customizer;
  18414. length = 1;
  18415. }
  18416. object = Object(object);
  18417. while (++index < length) {
  18418. var source = sources[index];
  18419. if (source) {
  18420. assigner(object, source, index, customizer);
  18421. }
  18422. }
  18423. return object;
  18424. });
  18425. }
  18426. /**
  18427. * Creates a `baseEach` or `baseEachRight` function.
  18428. *
  18429. * @private
  18430. * @param {Function} eachFunc The function to iterate over a collection.
  18431. * @param {boolean} [fromRight] Specify iterating from right to left.
  18432. * @returns {Function} Returns the new base function.
  18433. */
  18434. function createBaseEach(eachFunc, fromRight) {
  18435. return function(collection, iteratee) {
  18436. if (collection == null) {
  18437. return collection;
  18438. }
  18439. if (!isArrayLike(collection)) {
  18440. return eachFunc(collection, iteratee);
  18441. }
  18442. var length = collection.length,
  18443. index = fromRight ? length : -1,
  18444. iterable = Object(collection);
  18445. while ((fromRight ? index-- : ++index < length)) {
  18446. if (iteratee(iterable[index], index, iterable) === false) {
  18447. break;
  18448. }
  18449. }
  18450. return collection;
  18451. };
  18452. }
  18453. /**
  18454. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  18455. *
  18456. * @private
  18457. * @param {boolean} [fromRight] Specify iterating from right to left.
  18458. * @returns {Function} Returns the new base function.
  18459. */
  18460. function createBaseFor(fromRight) {
  18461. return function(object, iteratee, keysFunc) {
  18462. var index = -1,
  18463. iterable = Object(object),
  18464. props = keysFunc(object),
  18465. length = props.length;
  18466. while (length--) {
  18467. var key = props[fromRight ? length : ++index];
  18468. if (iteratee(iterable[key], key, iterable) === false) {
  18469. break;
  18470. }
  18471. }
  18472. return object;
  18473. };
  18474. }
  18475. /**
  18476. * Creates a function that wraps `func` to invoke it with the optional `this`
  18477. * binding of `thisArg`.
  18478. *
  18479. * @private
  18480. * @param {Function} func The function to wrap.
  18481. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18482. * @param {*} [thisArg] The `this` binding of `func`.
  18483. * @returns {Function} Returns the new wrapped function.
  18484. */
  18485. function createBind(func, bitmask, thisArg) {
  18486. var isBind = bitmask & WRAP_BIND_FLAG,
  18487. Ctor = createCtor(func);
  18488. function wrapper() {
  18489. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18490. return fn.apply(isBind ? thisArg : this, arguments);
  18491. }
  18492. return wrapper;
  18493. }
  18494. /**
  18495. * Creates a function like `_.lowerFirst`.
  18496. *
  18497. * @private
  18498. * @param {string} methodName The name of the `String` case method to use.
  18499. * @returns {Function} Returns the new case function.
  18500. */
  18501. function createCaseFirst(methodName) {
  18502. return function(string) {
  18503. string = toString(string);
  18504. var strSymbols = hasUnicode(string)
  18505. ? stringToArray(string)
  18506. : undefined;
  18507. var chr = strSymbols
  18508. ? strSymbols[0]
  18509. : string.charAt(0);
  18510. var trailing = strSymbols
  18511. ? castSlice(strSymbols, 1).join('')
  18512. : string.slice(1);
  18513. return chr[methodName]() + trailing;
  18514. };
  18515. }
  18516. /**
  18517. * Creates a function like `_.camelCase`.
  18518. *
  18519. * @private
  18520. * @param {Function} callback The function to combine each word.
  18521. * @returns {Function} Returns the new compounder function.
  18522. */
  18523. function createCompounder(callback) {
  18524. return function(string) {
  18525. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  18526. };
  18527. }
  18528. /**
  18529. * Creates a function that produces an instance of `Ctor` regardless of
  18530. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  18531. *
  18532. * @private
  18533. * @param {Function} Ctor The constructor to wrap.
  18534. * @returns {Function} Returns the new wrapped function.
  18535. */
  18536. function createCtor(Ctor) {
  18537. return function() {
  18538. // Use a `switch` statement to work with class constructors. See
  18539. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  18540. // for more details.
  18541. var args = arguments;
  18542. switch (args.length) {
  18543. case 0: return new Ctor;
  18544. case 1: return new Ctor(args[0]);
  18545. case 2: return new Ctor(args[0], args[1]);
  18546. case 3: return new Ctor(args[0], args[1], args[2]);
  18547. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  18548. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  18549. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  18550. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  18551. }
  18552. var thisBinding = baseCreate(Ctor.prototype),
  18553. result = Ctor.apply(thisBinding, args);
  18554. // Mimic the constructor's `return` behavior.
  18555. // See https://es5.github.io/#x13.2.2 for more details.
  18556. return isObject(result) ? result : thisBinding;
  18557. };
  18558. }
  18559. /**
  18560. * Creates a function that wraps `func` to enable currying.
  18561. *
  18562. * @private
  18563. * @param {Function} func The function to wrap.
  18564. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18565. * @param {number} arity The arity of `func`.
  18566. * @returns {Function} Returns the new wrapped function.
  18567. */
  18568. function createCurry(func, bitmask, arity) {
  18569. var Ctor = createCtor(func);
  18570. function wrapper() {
  18571. var length = arguments.length,
  18572. args = Array(length),
  18573. index = length,
  18574. placeholder = getHolder(wrapper);
  18575. while (index--) {
  18576. args[index] = arguments[index];
  18577. }
  18578. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  18579. ? []
  18580. : replaceHolders(args, placeholder);
  18581. length -= holders.length;
  18582. if (length < arity) {
  18583. return createRecurry(
  18584. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  18585. args, holders, undefined, undefined, arity - length);
  18586. }
  18587. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18588. return apply(fn, this, args);
  18589. }
  18590. return wrapper;
  18591. }
  18592. /**
  18593. * Creates a `_.find` or `_.findLast` function.
  18594. *
  18595. * @private
  18596. * @param {Function} findIndexFunc The function to find the collection index.
  18597. * @returns {Function} Returns the new find function.
  18598. */
  18599. function createFind(findIndexFunc) {
  18600. return function(collection, predicate, fromIndex) {
  18601. var iterable = Object(collection);
  18602. if (!isArrayLike(collection)) {
  18603. var iteratee = getIteratee(predicate, 3);
  18604. collection = keys(collection);
  18605. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18606. }
  18607. var index = findIndexFunc(collection, predicate, fromIndex);
  18608. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18609. };
  18610. }
  18611. /**
  18612. * Creates a `_.flow` or `_.flowRight` function.
  18613. *
  18614. * @private
  18615. * @param {boolean} [fromRight] Specify iterating from right to left.
  18616. * @returns {Function} Returns the new flow function.
  18617. */
  18618. function createFlow(fromRight) {
  18619. return flatRest(function(funcs) {
  18620. var length = funcs.length,
  18621. index = length,
  18622. prereq = LodashWrapper.prototype.thru;
  18623. if (fromRight) {
  18624. funcs.reverse();
  18625. }
  18626. while (index--) {
  18627. var func = funcs[index];
  18628. if (typeof func != 'function') {
  18629. throw new TypeError(FUNC_ERROR_TEXT);
  18630. }
  18631. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18632. var wrapper = new LodashWrapper([], true);
  18633. }
  18634. }
  18635. index = wrapper ? index : length;
  18636. while (++index < length) {
  18637. func = funcs[index];
  18638. var funcName = getFuncName(func),
  18639. data = funcName == 'wrapper' ? getData(func) : undefined;
  18640. if (data && isLaziable(data[0]) &&
  18641. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18642. !data[4].length && data[9] == 1
  18643. ) {
  18644. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18645. } else {
  18646. wrapper = (func.length == 1 && isLaziable(func))
  18647. ? wrapper[funcName]()
  18648. : wrapper.thru(func);
  18649. }
  18650. }
  18651. return function() {
  18652. var args = arguments,
  18653. value = args[0];
  18654. if (wrapper && args.length == 1 && isArray(value)) {
  18655. return wrapper.plant(value).value();
  18656. }
  18657. var index = 0,
  18658. result = length ? funcs[index].apply(this, args) : value;
  18659. while (++index < length) {
  18660. result = funcs[index].call(this, result);
  18661. }
  18662. return result;
  18663. };
  18664. });
  18665. }
  18666. /**
  18667. * Creates a function that wraps `func` to invoke it with optional `this`
  18668. * binding of `thisArg`, partial application, and currying.
  18669. *
  18670. * @private
  18671. * @param {Function|string} func The function or method name to wrap.
  18672. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18673. * @param {*} [thisArg] The `this` binding of `func`.
  18674. * @param {Array} [partials] The arguments to prepend to those provided to
  18675. * the new function.
  18676. * @param {Array} [holders] The `partials` placeholder indexes.
  18677. * @param {Array} [partialsRight] The arguments to append to those provided
  18678. * to the new function.
  18679. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18680. * @param {Array} [argPos] The argument positions of the new function.
  18681. * @param {number} [ary] The arity cap of `func`.
  18682. * @param {number} [arity] The arity of `func`.
  18683. * @returns {Function} Returns the new wrapped function.
  18684. */
  18685. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18686. var isAry = bitmask & WRAP_ARY_FLAG,
  18687. isBind = bitmask & WRAP_BIND_FLAG,
  18688. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18689. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18690. isFlip = bitmask & WRAP_FLIP_FLAG,
  18691. Ctor = isBindKey ? undefined : createCtor(func);
  18692. function wrapper() {
  18693. var length = arguments.length,
  18694. args = Array(length),
  18695. index = length;
  18696. while (index--) {
  18697. args[index] = arguments[index];
  18698. }
  18699. if (isCurried) {
  18700. var placeholder = getHolder(wrapper),
  18701. holdersCount = countHolders(args, placeholder);
  18702. }
  18703. if (partials) {
  18704. args = composeArgs(args, partials, holders, isCurried);
  18705. }
  18706. if (partialsRight) {
  18707. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18708. }
  18709. length -= holdersCount;
  18710. if (isCurried && length < arity) {
  18711. var newHolders = replaceHolders(args, placeholder);
  18712. return createRecurry(
  18713. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18714. args, newHolders, argPos, ary, arity - length
  18715. );
  18716. }
  18717. var thisBinding = isBind ? thisArg : this,
  18718. fn = isBindKey ? thisBinding[func] : func;
  18719. length = args.length;
  18720. if (argPos) {
  18721. args = reorder(args, argPos);
  18722. } else if (isFlip && length > 1) {
  18723. args.reverse();
  18724. }
  18725. if (isAry && ary < length) {
  18726. args.length = ary;
  18727. }
  18728. if (this && this !== root && this instanceof wrapper) {
  18729. fn = Ctor || createCtor(fn);
  18730. }
  18731. return fn.apply(thisBinding, args);
  18732. }
  18733. return wrapper;
  18734. }
  18735. /**
  18736. * Creates a function like `_.invertBy`.
  18737. *
  18738. * @private
  18739. * @param {Function} setter The function to set accumulator values.
  18740. * @param {Function} toIteratee The function to resolve iteratees.
  18741. * @returns {Function} Returns the new inverter function.
  18742. */
  18743. function createInverter(setter, toIteratee) {
  18744. return function(object, iteratee) {
  18745. return baseInverter(object, setter, toIteratee(iteratee), {});
  18746. };
  18747. }
  18748. /**
  18749. * Creates a function that performs a mathematical operation on two values.
  18750. *
  18751. * @private
  18752. * @param {Function} operator The function to perform the operation.
  18753. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18754. * @returns {Function} Returns the new mathematical operation function.
  18755. */
  18756. function createMathOperation(operator, defaultValue) {
  18757. return function(value, other) {
  18758. var result;
  18759. if (value === undefined && other === undefined) {
  18760. return defaultValue;
  18761. }
  18762. if (value !== undefined) {
  18763. result = value;
  18764. }
  18765. if (other !== undefined) {
  18766. if (result === undefined) {
  18767. return other;
  18768. }
  18769. if (typeof value == 'string' || typeof other == 'string') {
  18770. value = baseToString(value);
  18771. other = baseToString(other);
  18772. } else {
  18773. value = baseToNumber(value);
  18774. other = baseToNumber(other);
  18775. }
  18776. result = operator(value, other);
  18777. }
  18778. return result;
  18779. };
  18780. }
  18781. /**
  18782. * Creates a function like `_.over`.
  18783. *
  18784. * @private
  18785. * @param {Function} arrayFunc The function to iterate over iteratees.
  18786. * @returns {Function} Returns the new over function.
  18787. */
  18788. function createOver(arrayFunc) {
  18789. return flatRest(function(iteratees) {
  18790. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18791. return baseRest(function(args) {
  18792. var thisArg = this;
  18793. return arrayFunc(iteratees, function(iteratee) {
  18794. return apply(iteratee, thisArg, args);
  18795. });
  18796. });
  18797. });
  18798. }
  18799. /**
  18800. * Creates the padding for `string` based on `length`. The `chars` string
  18801. * is truncated if the number of characters exceeds `length`.
  18802. *
  18803. * @private
  18804. * @param {number} length The padding length.
  18805. * @param {string} [chars=' '] The string used as padding.
  18806. * @returns {string} Returns the padding for `string`.
  18807. */
  18808. function createPadding(length, chars) {
  18809. chars = chars === undefined ? ' ' : baseToString(chars);
  18810. var charsLength = chars.length;
  18811. if (charsLength < 2) {
  18812. return charsLength ? baseRepeat(chars, length) : chars;
  18813. }
  18814. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18815. return hasUnicode(chars)
  18816. ? castSlice(stringToArray(result), 0, length).join('')
  18817. : result.slice(0, length);
  18818. }
  18819. /**
  18820. * Creates a function that wraps `func` to invoke it with the `this` binding
  18821. * of `thisArg` and `partials` prepended to the arguments it receives.
  18822. *
  18823. * @private
  18824. * @param {Function} func The function to wrap.
  18825. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18826. * @param {*} thisArg The `this` binding of `func`.
  18827. * @param {Array} partials The arguments to prepend to those provided to
  18828. * the new function.
  18829. * @returns {Function} Returns the new wrapped function.
  18830. */
  18831. function createPartial(func, bitmask, thisArg, partials) {
  18832. var isBind = bitmask & WRAP_BIND_FLAG,
  18833. Ctor = createCtor(func);
  18834. function wrapper() {
  18835. var argsIndex = -1,
  18836. argsLength = arguments.length,
  18837. leftIndex = -1,
  18838. leftLength = partials.length,
  18839. args = Array(leftLength + argsLength),
  18840. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18841. while (++leftIndex < leftLength) {
  18842. args[leftIndex] = partials[leftIndex];
  18843. }
  18844. while (argsLength--) {
  18845. args[leftIndex++] = arguments[++argsIndex];
  18846. }
  18847. return apply(fn, isBind ? thisArg : this, args);
  18848. }
  18849. return wrapper;
  18850. }
  18851. /**
  18852. * Creates a `_.range` or `_.rangeRight` function.
  18853. *
  18854. * @private
  18855. * @param {boolean} [fromRight] Specify iterating from right to left.
  18856. * @returns {Function} Returns the new range function.
  18857. */
  18858. function createRange(fromRight) {
  18859. return function(start, end, step) {
  18860. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18861. end = step = undefined;
  18862. }
  18863. // Ensure the sign of `-0` is preserved.
  18864. start = toFinite(start);
  18865. if (end === undefined) {
  18866. end = start;
  18867. start = 0;
  18868. } else {
  18869. end = toFinite(end);
  18870. }
  18871. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18872. return baseRange(start, end, step, fromRight);
  18873. };
  18874. }
  18875. /**
  18876. * Creates a function that performs a relational operation on two values.
  18877. *
  18878. * @private
  18879. * @param {Function} operator The function to perform the operation.
  18880. * @returns {Function} Returns the new relational operation function.
  18881. */
  18882. function createRelationalOperation(operator) {
  18883. return function(value, other) {
  18884. if (!(typeof value == 'string' && typeof other == 'string')) {
  18885. value = toNumber(value);
  18886. other = toNumber(other);
  18887. }
  18888. return operator(value, other);
  18889. };
  18890. }
  18891. /**
  18892. * Creates a function that wraps `func` to continue currying.
  18893. *
  18894. * @private
  18895. * @param {Function} func The function to wrap.
  18896. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18897. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18898. * @param {*} placeholder The placeholder value.
  18899. * @param {*} [thisArg] The `this` binding of `func`.
  18900. * @param {Array} [partials] The arguments to prepend to those provided to
  18901. * the new function.
  18902. * @param {Array} [holders] The `partials` placeholder indexes.
  18903. * @param {Array} [argPos] The argument positions of the new function.
  18904. * @param {number} [ary] The arity cap of `func`.
  18905. * @param {number} [arity] The arity of `func`.
  18906. * @returns {Function} Returns the new wrapped function.
  18907. */
  18908. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18909. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18910. newHolders = isCurry ? holders : undefined,
  18911. newHoldersRight = isCurry ? undefined : holders,
  18912. newPartials = isCurry ? partials : undefined,
  18913. newPartialsRight = isCurry ? undefined : partials;
  18914. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18915. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18916. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18917. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18918. }
  18919. var newData = [
  18920. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18921. newHoldersRight, argPos, ary, arity
  18922. ];
  18923. var result = wrapFunc.apply(undefined, newData);
  18924. if (isLaziable(func)) {
  18925. setData(result, newData);
  18926. }
  18927. result.placeholder = placeholder;
  18928. return setWrapToString(result, func, bitmask);
  18929. }
  18930. /**
  18931. * Creates a function like `_.round`.
  18932. *
  18933. * @private
  18934. * @param {string} methodName The name of the `Math` method to use when rounding.
  18935. * @returns {Function} Returns the new round function.
  18936. */
  18937. function createRound(methodName) {
  18938. var func = Math[methodName];
  18939. return function(number, precision) {
  18940. number = toNumber(number);
  18941. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18942. if (precision && nativeIsFinite(number)) {
  18943. // Shift with exponential notation to avoid floating-point issues.
  18944. // See [MDN](https://mdn.io/round#Examples) for more details.
  18945. var pair = (toString(number) + 'e').split('e'),
  18946. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18947. pair = (toString(value) + 'e').split('e');
  18948. return +(pair[0] + 'e' + (+pair[1] - precision));
  18949. }
  18950. return func(number);
  18951. };
  18952. }
  18953. /**
  18954. * Creates a set object of `values`.
  18955. *
  18956. * @private
  18957. * @param {Array} values The values to add to the set.
  18958. * @returns {Object} Returns the new set.
  18959. */
  18960. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18961. return new Set(values);
  18962. };
  18963. /**
  18964. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18965. *
  18966. * @private
  18967. * @param {Function} keysFunc The function to get the keys of a given object.
  18968. * @returns {Function} Returns the new pairs function.
  18969. */
  18970. function createToPairs(keysFunc) {
  18971. return function(object) {
  18972. var tag = getTag(object);
  18973. if (tag == mapTag) {
  18974. return mapToArray(object);
  18975. }
  18976. if (tag == setTag) {
  18977. return setToPairs(object);
  18978. }
  18979. return baseToPairs(object, keysFunc(object));
  18980. };
  18981. }
  18982. /**
  18983. * Creates a function that either curries or invokes `func` with optional
  18984. * `this` binding and partially applied arguments.
  18985. *
  18986. * @private
  18987. * @param {Function|string} func The function or method name to wrap.
  18988. * @param {number} bitmask The bitmask flags.
  18989. * 1 - `_.bind`
  18990. * 2 - `_.bindKey`
  18991. * 4 - `_.curry` or `_.curryRight` of a bound function
  18992. * 8 - `_.curry`
  18993. * 16 - `_.curryRight`
  18994. * 32 - `_.partial`
  18995. * 64 - `_.partialRight`
  18996. * 128 - `_.rearg`
  18997. * 256 - `_.ary`
  18998. * 512 - `_.flip`
  18999. * @param {*} [thisArg] The `this` binding of `func`.
  19000. * @param {Array} [partials] The arguments to be partially applied.
  19001. * @param {Array} [holders] The `partials` placeholder indexes.
  19002. * @param {Array} [argPos] The argument positions of the new function.
  19003. * @param {number} [ary] The arity cap of `func`.
  19004. * @param {number} [arity] The arity of `func`.
  19005. * @returns {Function} Returns the new wrapped function.
  19006. */
  19007. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  19008. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  19009. if (!isBindKey && typeof func != 'function') {
  19010. throw new TypeError(FUNC_ERROR_TEXT);
  19011. }
  19012. var length = partials ? partials.length : 0;
  19013. if (!length) {
  19014. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  19015. partials = holders = undefined;
  19016. }
  19017. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  19018. arity = arity === undefined ? arity : toInteger(arity);
  19019. length -= holders ? holders.length : 0;
  19020. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  19021. var partialsRight = partials,
  19022. holdersRight = holders;
  19023. partials = holders = undefined;
  19024. }
  19025. var data = isBindKey ? undefined : getData(func);
  19026. var newData = [
  19027. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  19028. argPos, ary, arity
  19029. ];
  19030. if (data) {
  19031. mergeData(newData, data);
  19032. }
  19033. func = newData[0];
  19034. bitmask = newData[1];
  19035. thisArg = newData[2];
  19036. partials = newData[3];
  19037. holders = newData[4];
  19038. arity = newData[9] = newData[9] === undefined
  19039. ? (isBindKey ? 0 : func.length)
  19040. : nativeMax(newData[9] - length, 0);
  19041. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  19042. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  19043. }
  19044. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  19045. var result = createBind(func, bitmask, thisArg);
  19046. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  19047. result = createCurry(func, bitmask, arity);
  19048. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  19049. result = createPartial(func, bitmask, thisArg, partials);
  19050. } else {
  19051. result = createHybrid.apply(undefined, newData);
  19052. }
  19053. var setter = data ? baseSetData : setData;
  19054. return setWrapToString(setter(result, newData), func, bitmask);
  19055. }
  19056. /**
  19057. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  19058. * of source objects to the destination object for all destination properties
  19059. * that resolve to `undefined`.
  19060. *
  19061. * @private
  19062. * @param {*} objValue The destination value.
  19063. * @param {*} srcValue The source value.
  19064. * @param {string} key The key of the property to assign.
  19065. * @param {Object} object The parent object of `objValue`.
  19066. * @returns {*} Returns the value to assign.
  19067. */
  19068. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  19069. if (objValue === undefined ||
  19070. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  19071. return srcValue;
  19072. }
  19073. return objValue;
  19074. }
  19075. /**
  19076. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  19077. * objects into destination objects that are passed thru.
  19078. *
  19079. * @private
  19080. * @param {*} objValue The destination value.
  19081. * @param {*} srcValue The source value.
  19082. * @param {string} key The key of the property to merge.
  19083. * @param {Object} object The parent object of `objValue`.
  19084. * @param {Object} source The parent object of `srcValue`.
  19085. * @param {Object} [stack] Tracks traversed source values and their merged
  19086. * counterparts.
  19087. * @returns {*} Returns the value to assign.
  19088. */
  19089. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  19090. if (isObject(objValue) && isObject(srcValue)) {
  19091. // Recursively merge objects and arrays (susceptible to call stack limits).
  19092. stack.set(srcValue, objValue);
  19093. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  19094. stack['delete'](srcValue);
  19095. }
  19096. return objValue;
  19097. }
  19098. /**
  19099. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  19100. * objects.
  19101. *
  19102. * @private
  19103. * @param {*} value The value to inspect.
  19104. * @param {string} key The key of the property to inspect.
  19105. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  19106. */
  19107. function customOmitClone(value) {
  19108. return isPlainObject(value) ? undefined : value;
  19109. }
  19110. /**
  19111. * A specialized version of `baseIsEqualDeep` for arrays with support for
  19112. * partial deep comparisons.
  19113. *
  19114. * @private
  19115. * @param {Array} array The array to compare.
  19116. * @param {Array} other The other array to compare.
  19117. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19118. * @param {Function} customizer The function to customize comparisons.
  19119. * @param {Function} equalFunc The function to determine equivalents of values.
  19120. * @param {Object} stack Tracks traversed `array` and `other` objects.
  19121. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  19122. */
  19123. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  19124. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19125. arrLength = array.length,
  19126. othLength = other.length;
  19127. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  19128. return false;
  19129. }
  19130. // Check that cyclic values are equal.
  19131. var arrStacked = stack.get(array);
  19132. var othStacked = stack.get(other);
  19133. if (arrStacked && othStacked) {
  19134. return arrStacked == other && othStacked == array;
  19135. }
  19136. var index = -1,
  19137. result = true,
  19138. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19139. stack.set(array, other);
  19140. stack.set(other, array);
  19141. // Ignore non-index properties.
  19142. while (++index < arrLength) {
  19143. var arrValue = array[index],
  19144. othValue = other[index];
  19145. if (customizer) {
  19146. var compared = isPartial
  19147. ? customizer(othValue, arrValue, index, other, array, stack)
  19148. : customizer(arrValue, othValue, index, array, other, stack);
  19149. }
  19150. if (compared !== undefined) {
  19151. if (compared) {
  19152. continue;
  19153. }
  19154. result = false;
  19155. break;
  19156. }
  19157. // Recursively compare arrays (susceptible to call stack limits).
  19158. if (seen) {
  19159. if (!arraySome(other, function(othValue, othIndex) {
  19160. if (!cacheHas(seen, othIndex) &&
  19161. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19162. return seen.push(othIndex);
  19163. }
  19164. })) {
  19165. result = false;
  19166. break;
  19167. }
  19168. } else if (!(
  19169. arrValue === othValue ||
  19170. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19171. )) {
  19172. result = false;
  19173. break;
  19174. }
  19175. }
  19176. stack['delete'](array);
  19177. stack['delete'](other);
  19178. return result;
  19179. }
  19180. /**
  19181. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19182. * the same `toStringTag`.
  19183. *
  19184. * **Note:** This function only supports comparing values with tags of
  19185. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19186. *
  19187. * @private
  19188. * @param {Object} object The object to compare.
  19189. * @param {Object} other The other object to compare.
  19190. * @param {string} tag The `toStringTag` of the objects to compare.
  19191. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19192. * @param {Function} customizer The function to customize comparisons.
  19193. * @param {Function} equalFunc The function to determine equivalents of values.
  19194. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19195. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19196. */
  19197. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19198. switch (tag) {
  19199. case dataViewTag:
  19200. if ((object.byteLength != other.byteLength) ||
  19201. (object.byteOffset != other.byteOffset)) {
  19202. return false;
  19203. }
  19204. object = object.buffer;
  19205. other = other.buffer;
  19206. case arrayBufferTag:
  19207. if ((object.byteLength != other.byteLength) ||
  19208. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19209. return false;
  19210. }
  19211. return true;
  19212. case boolTag:
  19213. case dateTag:
  19214. case numberTag:
  19215. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19216. // Invalid dates are coerced to `NaN`.
  19217. return eq(+object, +other);
  19218. case errorTag:
  19219. return object.name == other.name && object.message == other.message;
  19220. case regexpTag:
  19221. case stringTag:
  19222. // Coerce regexes to strings and treat strings, primitives and objects,
  19223. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19224. // for more details.
  19225. return object == (other + '');
  19226. case mapTag:
  19227. var convert = mapToArray;
  19228. case setTag:
  19229. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19230. convert || (convert = setToArray);
  19231. if (object.size != other.size && !isPartial) {
  19232. return false;
  19233. }
  19234. // Assume cyclic values are equal.
  19235. var stacked = stack.get(object);
  19236. if (stacked) {
  19237. return stacked == other;
  19238. }
  19239. bitmask |= COMPARE_UNORDERED_FLAG;
  19240. // Recursively compare objects (susceptible to call stack limits).
  19241. stack.set(object, other);
  19242. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19243. stack['delete'](object);
  19244. return result;
  19245. case symbolTag:
  19246. if (symbolValueOf) {
  19247. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19248. }
  19249. }
  19250. return false;
  19251. }
  19252. /**
  19253. * A specialized version of `baseIsEqualDeep` for objects with support for
  19254. * partial deep comparisons.
  19255. *
  19256. * @private
  19257. * @param {Object} object The object to compare.
  19258. * @param {Object} other The other object to compare.
  19259. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19260. * @param {Function} customizer The function to customize comparisons.
  19261. * @param {Function} equalFunc The function to determine equivalents of values.
  19262. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19263. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19264. */
  19265. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19266. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19267. objProps = getAllKeys(object),
  19268. objLength = objProps.length,
  19269. othProps = getAllKeys(other),
  19270. othLength = othProps.length;
  19271. if (objLength != othLength && !isPartial) {
  19272. return false;
  19273. }
  19274. var index = objLength;
  19275. while (index--) {
  19276. var key = objProps[index];
  19277. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19278. return false;
  19279. }
  19280. }
  19281. // Check that cyclic values are equal.
  19282. var objStacked = stack.get(object);
  19283. var othStacked = stack.get(other);
  19284. if (objStacked && othStacked) {
  19285. return objStacked == other && othStacked == object;
  19286. }
  19287. var result = true;
  19288. stack.set(object, other);
  19289. stack.set(other, object);
  19290. var skipCtor = isPartial;
  19291. while (++index < objLength) {
  19292. key = objProps[index];
  19293. var objValue = object[key],
  19294. othValue = other[key];
  19295. if (customizer) {
  19296. var compared = isPartial
  19297. ? customizer(othValue, objValue, key, other, object, stack)
  19298. : customizer(objValue, othValue, key, object, other, stack);
  19299. }
  19300. // Recursively compare objects (susceptible to call stack limits).
  19301. if (!(compared === undefined
  19302. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19303. : compared
  19304. )) {
  19305. result = false;
  19306. break;
  19307. }
  19308. skipCtor || (skipCtor = key == 'constructor');
  19309. }
  19310. if (result && !skipCtor) {
  19311. var objCtor = object.constructor,
  19312. othCtor = other.constructor;
  19313. // Non `Object` object instances with different constructors are not equal.
  19314. if (objCtor != othCtor &&
  19315. ('constructor' in object && 'constructor' in other) &&
  19316. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19317. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19318. result = false;
  19319. }
  19320. }
  19321. stack['delete'](object);
  19322. stack['delete'](other);
  19323. return result;
  19324. }
  19325. /**
  19326. * A specialized version of `baseRest` which flattens the rest array.
  19327. *
  19328. * @private
  19329. * @param {Function} func The function to apply a rest parameter to.
  19330. * @returns {Function} Returns the new function.
  19331. */
  19332. function flatRest(func) {
  19333. return setToString(overRest(func, undefined, flatten), func + '');
  19334. }
  19335. /**
  19336. * Creates an array of own enumerable property names and symbols of `object`.
  19337. *
  19338. * @private
  19339. * @param {Object} object The object to query.
  19340. * @returns {Array} Returns the array of property names and symbols.
  19341. */
  19342. function getAllKeys(object) {
  19343. return baseGetAllKeys(object, keys, getSymbols);
  19344. }
  19345. /**
  19346. * Creates an array of own and inherited enumerable property names and
  19347. * symbols of `object`.
  19348. *
  19349. * @private
  19350. * @param {Object} object The object to query.
  19351. * @returns {Array} Returns the array of property names and symbols.
  19352. */
  19353. function getAllKeysIn(object) {
  19354. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  19355. }
  19356. /**
  19357. * Gets metadata for `func`.
  19358. *
  19359. * @private
  19360. * @param {Function} func The function to query.
  19361. * @returns {*} Returns the metadata for `func`.
  19362. */
  19363. var getData = !metaMap ? noop : function(func) {
  19364. return metaMap.get(func);
  19365. };
  19366. /**
  19367. * Gets the name of `func`.
  19368. *
  19369. * @private
  19370. * @param {Function} func The function to query.
  19371. * @returns {string} Returns the function name.
  19372. */
  19373. function getFuncName(func) {
  19374. var result = (func.name + ''),
  19375. array = realNames[result],
  19376. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  19377. while (length--) {
  19378. var data = array[length],
  19379. otherFunc = data.func;
  19380. if (otherFunc == null || otherFunc == func) {
  19381. return data.name;
  19382. }
  19383. }
  19384. return result;
  19385. }
  19386. /**
  19387. * Gets the argument placeholder value for `func`.
  19388. *
  19389. * @private
  19390. * @param {Function} func The function to inspect.
  19391. * @returns {*} Returns the placeholder value.
  19392. */
  19393. function getHolder(func) {
  19394. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  19395. return object.placeholder;
  19396. }
  19397. /**
  19398. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  19399. * this function returns the custom method, otherwise it returns `baseIteratee`.
  19400. * If arguments are provided, the chosen function is invoked with them and
  19401. * its result is returned.
  19402. *
  19403. * @private
  19404. * @param {*} [value] The value to convert to an iteratee.
  19405. * @param {number} [arity] The arity of the created iteratee.
  19406. * @returns {Function} Returns the chosen function or its result.
  19407. */
  19408. function getIteratee() {
  19409. var result = lodash.iteratee || iteratee;
  19410. result = result === iteratee ? baseIteratee : result;
  19411. return arguments.length ? result(arguments[0], arguments[1]) : result;
  19412. }
  19413. /**
  19414. * Gets the data for `map`.
  19415. *
  19416. * @private
  19417. * @param {Object} map The map to query.
  19418. * @param {string} key The reference key.
  19419. * @returns {*} Returns the map data.
  19420. */
  19421. function getMapData(map, key) {
  19422. var data = map.__data__;
  19423. return isKeyable(key)
  19424. ? data[typeof key == 'string' ? 'string' : 'hash']
  19425. : data.map;
  19426. }
  19427. /**
  19428. * Gets the property names, values, and compare flags of `object`.
  19429. *
  19430. * @private
  19431. * @param {Object} object The object to query.
  19432. * @returns {Array} Returns the match data of `object`.
  19433. */
  19434. function getMatchData(object) {
  19435. var result = keys(object),
  19436. length = result.length;
  19437. while (length--) {
  19438. var key = result[length],
  19439. value = object[key];
  19440. result[length] = [key, value, isStrictComparable(value)];
  19441. }
  19442. return result;
  19443. }
  19444. /**
  19445. * Gets the native function at `key` of `object`.
  19446. *
  19447. * @private
  19448. * @param {Object} object The object to query.
  19449. * @param {string} key The key of the method to get.
  19450. * @returns {*} Returns the function if it's native, else `undefined`.
  19451. */
  19452. function getNative(object, key) {
  19453. var value = getValue(object, key);
  19454. return baseIsNative(value) ? value : undefined;
  19455. }
  19456. /**
  19457. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19458. *
  19459. * @private
  19460. * @param {*} value The value to query.
  19461. * @returns {string} Returns the raw `toStringTag`.
  19462. */
  19463. function getRawTag(value) {
  19464. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19465. tag = value[symToStringTag];
  19466. try {
  19467. value[symToStringTag] = undefined;
  19468. var unmasked = true;
  19469. } catch (e) {}
  19470. var result = nativeObjectToString.call(value);
  19471. if (unmasked) {
  19472. if (isOwn) {
  19473. value[symToStringTag] = tag;
  19474. } else {
  19475. delete value[symToStringTag];
  19476. }
  19477. }
  19478. return result;
  19479. }
  19480. /**
  19481. * Creates an array of the own enumerable symbols of `object`.
  19482. *
  19483. * @private
  19484. * @param {Object} object The object to query.
  19485. * @returns {Array} Returns the array of symbols.
  19486. */
  19487. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19488. if (object == null) {
  19489. return [];
  19490. }
  19491. object = Object(object);
  19492. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19493. return propertyIsEnumerable.call(object, symbol);
  19494. });
  19495. };
  19496. /**
  19497. * Creates an array of the own and inherited enumerable symbols of `object`.
  19498. *
  19499. * @private
  19500. * @param {Object} object The object to query.
  19501. * @returns {Array} Returns the array of symbols.
  19502. */
  19503. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  19504. var result = [];
  19505. while (object) {
  19506. arrayPush(result, getSymbols(object));
  19507. object = getPrototype(object);
  19508. }
  19509. return result;
  19510. };
  19511. /**
  19512. * Gets the `toStringTag` of `value`.
  19513. *
  19514. * @private
  19515. * @param {*} value The value to query.
  19516. * @returns {string} Returns the `toStringTag`.
  19517. */
  19518. var getTag = baseGetTag;
  19519. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19520. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19521. (Map && getTag(new Map) != mapTag) ||
  19522. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19523. (Set && getTag(new Set) != setTag) ||
  19524. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19525. getTag = function(value) {
  19526. var result = baseGetTag(value),
  19527. Ctor = result == objectTag ? value.constructor : undefined,
  19528. ctorString = Ctor ? toSource(Ctor) : '';
  19529. if (ctorString) {
  19530. switch (ctorString) {
  19531. case dataViewCtorString: return dataViewTag;
  19532. case mapCtorString: return mapTag;
  19533. case promiseCtorString: return promiseTag;
  19534. case setCtorString: return setTag;
  19535. case weakMapCtorString: return weakMapTag;
  19536. }
  19537. }
  19538. return result;
  19539. };
  19540. }
  19541. /**
  19542. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  19543. *
  19544. * @private
  19545. * @param {number} start The start of the view.
  19546. * @param {number} end The end of the view.
  19547. * @param {Array} transforms The transformations to apply to the view.
  19548. * @returns {Object} Returns an object containing the `start` and `end`
  19549. * positions of the view.
  19550. */
  19551. function getView(start, end, transforms) {
  19552. var index = -1,
  19553. length = transforms.length;
  19554. while (++index < length) {
  19555. var data = transforms[index],
  19556. size = data.size;
  19557. switch (data.type) {
  19558. case 'drop': start += size; break;
  19559. case 'dropRight': end -= size; break;
  19560. case 'take': end = nativeMin(end, start + size); break;
  19561. case 'takeRight': start = nativeMax(start, end - size); break;
  19562. }
  19563. }
  19564. return { 'start': start, 'end': end };
  19565. }
  19566. /**
  19567. * Extracts wrapper details from the `source` body comment.
  19568. *
  19569. * @private
  19570. * @param {string} source The source to inspect.
  19571. * @returns {Array} Returns the wrapper details.
  19572. */
  19573. function getWrapDetails(source) {
  19574. var match = source.match(reWrapDetails);
  19575. return match ? match[1].split(reSplitDetails) : [];
  19576. }
  19577. /**
  19578. * Checks if `path` exists on `object`.
  19579. *
  19580. * @private
  19581. * @param {Object} object The object to query.
  19582. * @param {Array|string} path The path to check.
  19583. * @param {Function} hasFunc The function to check properties.
  19584. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  19585. */
  19586. function hasPath(object, path, hasFunc) {
  19587. path = castPath(path, object);
  19588. var index = -1,
  19589. length = path.length,
  19590. result = false;
  19591. while (++index < length) {
  19592. var key = toKey(path[index]);
  19593. if (!(result = object != null && hasFunc(object, key))) {
  19594. break;
  19595. }
  19596. object = object[key];
  19597. }
  19598. if (result || ++index != length) {
  19599. return result;
  19600. }
  19601. length = object == null ? 0 : object.length;
  19602. return !!length && isLength(length) && isIndex(key, length) &&
  19603. (isArray(object) || isArguments(object));
  19604. }
  19605. /**
  19606. * Initializes an array clone.
  19607. *
  19608. * @private
  19609. * @param {Array} array The array to clone.
  19610. * @returns {Array} Returns the initialized clone.
  19611. */
  19612. function initCloneArray(array) {
  19613. var length = array.length,
  19614. result = new array.constructor(length);
  19615. // Add properties assigned by `RegExp#exec`.
  19616. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19617. result.index = array.index;
  19618. result.input = array.input;
  19619. }
  19620. return result;
  19621. }
  19622. /**
  19623. * Initializes an object clone.
  19624. *
  19625. * @private
  19626. * @param {Object} object The object to clone.
  19627. * @returns {Object} Returns the initialized clone.
  19628. */
  19629. function initCloneObject(object) {
  19630. return (typeof object.constructor == 'function' && !isPrototype(object))
  19631. ? baseCreate(getPrototype(object))
  19632. : {};
  19633. }
  19634. /**
  19635. * Initializes an object clone based on its `toStringTag`.
  19636. *
  19637. * **Note:** This function only supports cloning values with tags of
  19638. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19639. *
  19640. * @private
  19641. * @param {Object} object The object to clone.
  19642. * @param {string} tag The `toStringTag` of the object to clone.
  19643. * @param {boolean} [isDeep] Specify a deep clone.
  19644. * @returns {Object} Returns the initialized clone.
  19645. */
  19646. function initCloneByTag(object, tag, isDeep) {
  19647. var Ctor = object.constructor;
  19648. switch (tag) {
  19649. case arrayBufferTag:
  19650. return cloneArrayBuffer(object);
  19651. case boolTag:
  19652. case dateTag:
  19653. return new Ctor(+object);
  19654. case dataViewTag:
  19655. return cloneDataView(object, isDeep);
  19656. case float32Tag: case float64Tag:
  19657. case int8Tag: case int16Tag: case int32Tag:
  19658. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19659. return cloneTypedArray(object, isDeep);
  19660. case mapTag:
  19661. return new Ctor;
  19662. case numberTag:
  19663. case stringTag:
  19664. return new Ctor(object);
  19665. case regexpTag:
  19666. return cloneRegExp(object);
  19667. case setTag:
  19668. return new Ctor;
  19669. case symbolTag:
  19670. return cloneSymbol(object);
  19671. }
  19672. }
  19673. /**
  19674. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19675. *
  19676. * @private
  19677. * @param {string} source The source to modify.
  19678. * @returns {Array} details The details to insert.
  19679. * @returns {string} Returns the modified source.
  19680. */
  19681. function insertWrapDetails(source, details) {
  19682. var length = details.length;
  19683. if (!length) {
  19684. return source;
  19685. }
  19686. var lastIndex = length - 1;
  19687. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19688. details = details.join(length > 2 ? ', ' : ' ');
  19689. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19690. }
  19691. /**
  19692. * Checks if `value` is a flattenable `arguments` object or array.
  19693. *
  19694. * @private
  19695. * @param {*} value The value to check.
  19696. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19697. */
  19698. function isFlattenable(value) {
  19699. return isArray(value) || isArguments(value) ||
  19700. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19701. }
  19702. /**
  19703. * Checks if `value` is a valid array-like index.
  19704. *
  19705. * @private
  19706. * @param {*} value The value to check.
  19707. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19708. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19709. */
  19710. function isIndex(value, length) {
  19711. var type = typeof value;
  19712. length = length == null ? MAX_SAFE_INTEGER : length;
  19713. return !!length &&
  19714. (type == 'number' ||
  19715. (type != 'symbol' && reIsUint.test(value))) &&
  19716. (value > -1 && value % 1 == 0 && value < length);
  19717. }
  19718. /**
  19719. * Checks if the given arguments are from an iteratee call.
  19720. *
  19721. * @private
  19722. * @param {*} value The potential iteratee value argument.
  19723. * @param {*} index The potential iteratee index or key argument.
  19724. * @param {*} object The potential iteratee object argument.
  19725. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19726. * else `false`.
  19727. */
  19728. function isIterateeCall(value, index, object) {
  19729. if (!isObject(object)) {
  19730. return false;
  19731. }
  19732. var type = typeof index;
  19733. if (type == 'number'
  19734. ? (isArrayLike(object) && isIndex(index, object.length))
  19735. : (type == 'string' && index in object)
  19736. ) {
  19737. return eq(object[index], value);
  19738. }
  19739. return false;
  19740. }
  19741. /**
  19742. * Checks if `value` is a property name and not a property path.
  19743. *
  19744. * @private
  19745. * @param {*} value The value to check.
  19746. * @param {Object} [object] The object to query keys on.
  19747. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19748. */
  19749. function isKey(value, object) {
  19750. if (isArray(value)) {
  19751. return false;
  19752. }
  19753. var type = typeof value;
  19754. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19755. value == null || isSymbol(value)) {
  19756. return true;
  19757. }
  19758. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19759. (object != null && value in Object(object));
  19760. }
  19761. /**
  19762. * Checks if `value` is suitable for use as unique object key.
  19763. *
  19764. * @private
  19765. * @param {*} value The value to check.
  19766. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19767. */
  19768. function isKeyable(value) {
  19769. var type = typeof value;
  19770. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19771. ? (value !== '__proto__')
  19772. : (value === null);
  19773. }
  19774. /**
  19775. * Checks if `func` has a lazy counterpart.
  19776. *
  19777. * @private
  19778. * @param {Function} func The function to check.
  19779. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19780. * else `false`.
  19781. */
  19782. function isLaziable(func) {
  19783. var funcName = getFuncName(func),
  19784. other = lodash[funcName];
  19785. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19786. return false;
  19787. }
  19788. if (func === other) {
  19789. return true;
  19790. }
  19791. var data = getData(other);
  19792. return !!data && func === data[0];
  19793. }
  19794. /**
  19795. * Checks if `func` has its source masked.
  19796. *
  19797. * @private
  19798. * @param {Function} func The function to check.
  19799. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19800. */
  19801. function isMasked(func) {
  19802. return !!maskSrcKey && (maskSrcKey in func);
  19803. }
  19804. /**
  19805. * Checks if `func` is capable of being masked.
  19806. *
  19807. * @private
  19808. * @param {*} value The value to check.
  19809. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19810. */
  19811. var isMaskable = coreJsData ? isFunction : stubFalse;
  19812. /**
  19813. * Checks if `value` is likely a prototype object.
  19814. *
  19815. * @private
  19816. * @param {*} value The value to check.
  19817. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19818. */
  19819. function isPrototype(value) {
  19820. var Ctor = value && value.constructor,
  19821. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19822. return value === proto;
  19823. }
  19824. /**
  19825. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19826. *
  19827. * @private
  19828. * @param {*} value The value to check.
  19829. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19830. * equality comparisons, else `false`.
  19831. */
  19832. function isStrictComparable(value) {
  19833. return value === value && !isObject(value);
  19834. }
  19835. /**
  19836. * A specialized version of `matchesProperty` for source values suitable
  19837. * for strict equality comparisons, i.e. `===`.
  19838. *
  19839. * @private
  19840. * @param {string} key The key of the property to get.
  19841. * @param {*} srcValue The value to match.
  19842. * @returns {Function} Returns the new spec function.
  19843. */
  19844. function matchesStrictComparable(key, srcValue) {
  19845. return function(object) {
  19846. if (object == null) {
  19847. return false;
  19848. }
  19849. return object[key] === srcValue &&
  19850. (srcValue !== undefined || (key in Object(object)));
  19851. };
  19852. }
  19853. /**
  19854. * A specialized version of `_.memoize` which clears the memoized function's
  19855. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19856. *
  19857. * @private
  19858. * @param {Function} func The function to have its output memoized.
  19859. * @returns {Function} Returns the new memoized function.
  19860. */
  19861. function memoizeCapped(func) {
  19862. var result = memoize(func, function(key) {
  19863. if (cache.size === MAX_MEMOIZE_SIZE) {
  19864. cache.clear();
  19865. }
  19866. return key;
  19867. });
  19868. var cache = result.cache;
  19869. return result;
  19870. }
  19871. /**
  19872. * Merges the function metadata of `source` into `data`.
  19873. *
  19874. * Merging metadata reduces the number of wrappers used to invoke a function.
  19875. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19876. * may be applied regardless of execution order. Methods like `_.ary` and
  19877. * `_.rearg` modify function arguments, making the order in which they are
  19878. * executed important, preventing the merging of metadata. However, we make
  19879. * an exception for a safe combined case where curried functions have `_.ary`
  19880. * and or `_.rearg` applied.
  19881. *
  19882. * @private
  19883. * @param {Array} data The destination metadata.
  19884. * @param {Array} source The source metadata.
  19885. * @returns {Array} Returns `data`.
  19886. */
  19887. function mergeData(data, source) {
  19888. var bitmask = data[1],
  19889. srcBitmask = source[1],
  19890. newBitmask = bitmask | srcBitmask,
  19891. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19892. var isCombo =
  19893. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19894. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19895. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19896. // Exit early if metadata can't be merged.
  19897. if (!(isCommon || isCombo)) {
  19898. return data;
  19899. }
  19900. // Use source `thisArg` if available.
  19901. if (srcBitmask & WRAP_BIND_FLAG) {
  19902. data[2] = source[2];
  19903. // Set when currying a bound function.
  19904. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19905. }
  19906. // Compose partial arguments.
  19907. var value = source[3];
  19908. if (value) {
  19909. var partials = data[3];
  19910. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19911. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19912. }
  19913. // Compose partial right arguments.
  19914. value = source[5];
  19915. if (value) {
  19916. partials = data[5];
  19917. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19918. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19919. }
  19920. // Use source `argPos` if available.
  19921. value = source[7];
  19922. if (value) {
  19923. data[7] = value;
  19924. }
  19925. // Use source `ary` if it's smaller.
  19926. if (srcBitmask & WRAP_ARY_FLAG) {
  19927. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19928. }
  19929. // Use source `arity` if one is not provided.
  19930. if (data[9] == null) {
  19931. data[9] = source[9];
  19932. }
  19933. // Use source `func` and merge bitmasks.
  19934. data[0] = source[0];
  19935. data[1] = newBitmask;
  19936. return data;
  19937. }
  19938. /**
  19939. * This function is like
  19940. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19941. * except that it includes inherited enumerable properties.
  19942. *
  19943. * @private
  19944. * @param {Object} object The object to query.
  19945. * @returns {Array} Returns the array of property names.
  19946. */
  19947. function nativeKeysIn(object) {
  19948. var result = [];
  19949. if (object != null) {
  19950. for (var key in Object(object)) {
  19951. result.push(key);
  19952. }
  19953. }
  19954. return result;
  19955. }
  19956. /**
  19957. * Converts `value` to a string using `Object.prototype.toString`.
  19958. *
  19959. * @private
  19960. * @param {*} value The value to convert.
  19961. * @returns {string} Returns the converted string.
  19962. */
  19963. function objectToString(value) {
  19964. return nativeObjectToString.call(value);
  19965. }
  19966. /**
  19967. * A specialized version of `baseRest` which transforms the rest array.
  19968. *
  19969. * @private
  19970. * @param {Function} func The function to apply a rest parameter to.
  19971. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19972. * @param {Function} transform The rest array transform.
  19973. * @returns {Function} Returns the new function.
  19974. */
  19975. function overRest(func, start, transform) {
  19976. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19977. return function() {
  19978. var args = arguments,
  19979. index = -1,
  19980. length = nativeMax(args.length - start, 0),
  19981. array = Array(length);
  19982. while (++index < length) {
  19983. array[index] = args[start + index];
  19984. }
  19985. index = -1;
  19986. var otherArgs = Array(start + 1);
  19987. while (++index < start) {
  19988. otherArgs[index] = args[index];
  19989. }
  19990. otherArgs[start] = transform(array);
  19991. return apply(func, this, otherArgs);
  19992. };
  19993. }
  19994. /**
  19995. * Gets the parent value at `path` of `object`.
  19996. *
  19997. * @private
  19998. * @param {Object} object The object to query.
  19999. * @param {Array} path The path to get the parent value of.
  20000. * @returns {*} Returns the parent value.
  20001. */
  20002. function parent(object, path) {
  20003. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  20004. }
  20005. /**
  20006. * Reorder `array` according to the specified indexes where the element at
  20007. * the first index is assigned as the first element, the element at
  20008. * the second index is assigned as the second element, and so on.
  20009. *
  20010. * @private
  20011. * @param {Array} array The array to reorder.
  20012. * @param {Array} indexes The arranged array indexes.
  20013. * @returns {Array} Returns `array`.
  20014. */
  20015. function reorder(array, indexes) {
  20016. var arrLength = array.length,
  20017. length = nativeMin(indexes.length, arrLength),
  20018. oldArray = copyArray(array);
  20019. while (length--) {
  20020. var index = indexes[length];
  20021. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  20022. }
  20023. return array;
  20024. }
  20025. /**
  20026. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  20027. *
  20028. * @private
  20029. * @param {Object} object The object to query.
  20030. * @param {string} key The key of the property to get.
  20031. * @returns {*} Returns the property value.
  20032. */
  20033. function safeGet(object, key) {
  20034. if (key === 'constructor' && typeof object[key] === 'function') {
  20035. return;
  20036. }
  20037. if (key == '__proto__') {
  20038. return;
  20039. }
  20040. return object[key];
  20041. }
  20042. /**
  20043. * Sets metadata for `func`.
  20044. *
  20045. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  20046. * period of time, it will trip its breaker and transition to an identity
  20047. * function to avoid garbage collection pauses in V8. See
  20048. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  20049. * for more details.
  20050. *
  20051. * @private
  20052. * @param {Function} func The function to associate metadata with.
  20053. * @param {*} data The metadata.
  20054. * @returns {Function} Returns `func`.
  20055. */
  20056. var setData = shortOut(baseSetData);
  20057. /**
  20058. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  20059. *
  20060. * @private
  20061. * @param {Function} func The function to delay.
  20062. * @param {number} wait The number of milliseconds to delay invocation.
  20063. * @returns {number|Object} Returns the timer id or timeout object.
  20064. */
  20065. var setTimeout = ctxSetTimeout || function(func, wait) {
  20066. return root.setTimeout(func, wait);
  20067. };
  20068. /**
  20069. * Sets the `toString` method of `func` to return `string`.
  20070. *
  20071. * @private
  20072. * @param {Function} func The function to modify.
  20073. * @param {Function} string The `toString` result.
  20074. * @returns {Function} Returns `func`.
  20075. */
  20076. var setToString = shortOut(baseSetToString);
  20077. /**
  20078. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  20079. * with wrapper details in a comment at the top of the source body.
  20080. *
  20081. * @private
  20082. * @param {Function} wrapper The function to modify.
  20083. * @param {Function} reference The reference function.
  20084. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20085. * @returns {Function} Returns `wrapper`.
  20086. */
  20087. function setWrapToString(wrapper, reference, bitmask) {
  20088. var source = (reference + '');
  20089. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  20090. }
  20091. /**
  20092. * Creates a function that'll short out and invoke `identity` instead
  20093. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  20094. * milliseconds.
  20095. *
  20096. * @private
  20097. * @param {Function} func The function to restrict.
  20098. * @returns {Function} Returns the new shortable function.
  20099. */
  20100. function shortOut(func) {
  20101. var count = 0,
  20102. lastCalled = 0;
  20103. return function() {
  20104. var stamp = nativeNow(),
  20105. remaining = HOT_SPAN - (stamp - lastCalled);
  20106. lastCalled = stamp;
  20107. if (remaining > 0) {
  20108. if (++count >= HOT_COUNT) {
  20109. return arguments[0];
  20110. }
  20111. } else {
  20112. count = 0;
  20113. }
  20114. return func.apply(undefined, arguments);
  20115. };
  20116. }
  20117. /**
  20118. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  20119. *
  20120. * @private
  20121. * @param {Array} array The array to shuffle.
  20122. * @param {number} [size=array.length] The size of `array`.
  20123. * @returns {Array} Returns `array`.
  20124. */
  20125. function shuffleSelf(array, size) {
  20126. var index = -1,
  20127. length = array.length,
  20128. lastIndex = length - 1;
  20129. size = size === undefined ? length : size;
  20130. while (++index < size) {
  20131. var rand = baseRandom(index, lastIndex),
  20132. value = array[rand];
  20133. array[rand] = array[index];
  20134. array[index] = value;
  20135. }
  20136. array.length = size;
  20137. return array;
  20138. }
  20139. /**
  20140. * Converts `string` to a property path array.
  20141. *
  20142. * @private
  20143. * @param {string} string The string to convert.
  20144. * @returns {Array} Returns the property path array.
  20145. */
  20146. var stringToPath = memoizeCapped(function(string) {
  20147. var result = [];
  20148. if (string.charCodeAt(0) === 46 /* . */) {
  20149. result.push('');
  20150. }
  20151. string.replace(rePropName, function(match, number, quote, subString) {
  20152. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  20153. });
  20154. return result;
  20155. });
  20156. /**
  20157. * Converts `value` to a string key if it's not a string or symbol.
  20158. *
  20159. * @private
  20160. * @param {*} value The value to inspect.
  20161. * @returns {string|symbol} Returns the key.
  20162. */
  20163. function toKey(value) {
  20164. if (typeof value == 'string' || isSymbol(value)) {
  20165. return value;
  20166. }
  20167. var result = (value + '');
  20168. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  20169. }
  20170. /**
  20171. * Converts `func` to its source code.
  20172. *
  20173. * @private
  20174. * @param {Function} func The function to convert.
  20175. * @returns {string} Returns the source code.
  20176. */
  20177. function toSource(func) {
  20178. if (func != null) {
  20179. try {
  20180. return funcToString.call(func);
  20181. } catch (e) {}
  20182. try {
  20183. return (func + '');
  20184. } catch (e) {}
  20185. }
  20186. return '';
  20187. }
  20188. /**
  20189. * Updates wrapper `details` based on `bitmask` flags.
  20190. *
  20191. * @private
  20192. * @returns {Array} details The details to modify.
  20193. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20194. * @returns {Array} Returns `details`.
  20195. */
  20196. function updateWrapDetails(details, bitmask) {
  20197. arrayEach(wrapFlags, function(pair) {
  20198. var value = '_.' + pair[0];
  20199. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  20200. details.push(value);
  20201. }
  20202. });
  20203. return details.sort();
  20204. }
  20205. /**
  20206. * Creates a clone of `wrapper`.
  20207. *
  20208. * @private
  20209. * @param {Object} wrapper The wrapper to clone.
  20210. * @returns {Object} Returns the cloned wrapper.
  20211. */
  20212. function wrapperClone(wrapper) {
  20213. if (wrapper instanceof LazyWrapper) {
  20214. return wrapper.clone();
  20215. }
  20216. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  20217. result.__actions__ = copyArray(wrapper.__actions__);
  20218. result.__index__ = wrapper.__index__;
  20219. result.__values__ = wrapper.__values__;
  20220. return result;
  20221. }
  20222. /*------------------------------------------------------------------------*/
  20223. /**
  20224. * Creates an array of elements split into groups the length of `size`.
  20225. * If `array` can't be split evenly, the final chunk will be the remaining
  20226. * elements.
  20227. *
  20228. * @static
  20229. * @memberOf _
  20230. * @since 3.0.0
  20231. * @category Array
  20232. * @param {Array} array The array to process.
  20233. * @param {number} [size=1] The length of each chunk
  20234. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20235. * @returns {Array} Returns the new array of chunks.
  20236. * @example
  20237. *
  20238. * _.chunk(['a', 'b', 'c', 'd'], 2);
  20239. * // => [['a', 'b'], ['c', 'd']]
  20240. *
  20241. * _.chunk(['a', 'b', 'c', 'd'], 3);
  20242. * // => [['a', 'b', 'c'], ['d']]
  20243. */
  20244. function chunk(array, size, guard) {
  20245. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  20246. size = 1;
  20247. } else {
  20248. size = nativeMax(toInteger(size), 0);
  20249. }
  20250. var length = array == null ? 0 : array.length;
  20251. if (!length || size < 1) {
  20252. return [];
  20253. }
  20254. var index = 0,
  20255. resIndex = 0,
  20256. result = Array(nativeCeil(length / size));
  20257. while (index < length) {
  20258. result[resIndex++] = baseSlice(array, index, (index += size));
  20259. }
  20260. return result;
  20261. }
  20262. /**
  20263. * Creates an array with all falsey values removed. The values `false`, `null`,
  20264. * `0`, `""`, `undefined`, and `NaN` are falsey.
  20265. *
  20266. * @static
  20267. * @memberOf _
  20268. * @since 0.1.0
  20269. * @category Array
  20270. * @param {Array} array The array to compact.
  20271. * @returns {Array} Returns the new array of filtered values.
  20272. * @example
  20273. *
  20274. * _.compact([0, 1, false, 2, '', 3]);
  20275. * // => [1, 2, 3]
  20276. */
  20277. function compact(array) {
  20278. var index = -1,
  20279. length = array == null ? 0 : array.length,
  20280. resIndex = 0,
  20281. result = [];
  20282. while (++index < length) {
  20283. var value = array[index];
  20284. if (value) {
  20285. result[resIndex++] = value;
  20286. }
  20287. }
  20288. return result;
  20289. }
  20290. /**
  20291. * Creates a new array concatenating `array` with any additional arrays
  20292. * and/or values.
  20293. *
  20294. * @static
  20295. * @memberOf _
  20296. * @since 4.0.0
  20297. * @category Array
  20298. * @param {Array} array The array to concatenate.
  20299. * @param {...*} [values] The values to concatenate.
  20300. * @returns {Array} Returns the new concatenated array.
  20301. * @example
  20302. *
  20303. * var array = [1];
  20304. * var other = _.concat(array, 2, [3], [[4]]);
  20305. *
  20306. * console.log(other);
  20307. * // => [1, 2, 3, [4]]
  20308. *
  20309. * console.log(array);
  20310. * // => [1]
  20311. */
  20312. function concat() {
  20313. var length = arguments.length;
  20314. if (!length) {
  20315. return [];
  20316. }
  20317. var args = Array(length - 1),
  20318. array = arguments[0],
  20319. index = length;
  20320. while (index--) {
  20321. args[index - 1] = arguments[index];
  20322. }
  20323. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  20324. }
  20325. /**
  20326. * Creates an array of `array` values not included in the other given arrays
  20327. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20328. * for equality comparisons. The order and references of result values are
  20329. * determined by the first array.
  20330. *
  20331. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  20332. *
  20333. * @static
  20334. * @memberOf _
  20335. * @since 0.1.0
  20336. * @category Array
  20337. * @param {Array} array The array to inspect.
  20338. * @param {...Array} [values] The values to exclude.
  20339. * @returns {Array} Returns the new array of filtered values.
  20340. * @see _.without, _.xor
  20341. * @example
  20342. *
  20343. * _.difference([2, 1], [2, 3]);
  20344. * // => [1]
  20345. */
  20346. var difference = baseRest(function(array, values) {
  20347. return isArrayLikeObject(array)
  20348. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  20349. : [];
  20350. });
  20351. /**
  20352. * This method is like `_.difference` except that it accepts `iteratee` which
  20353. * is invoked for each element of `array` and `values` to generate the criterion
  20354. * by which they're compared. The order and references of result values are
  20355. * determined by the first array. The iteratee is invoked with one argument:
  20356. * (value).
  20357. *
  20358. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  20359. *
  20360. * @static
  20361. * @memberOf _
  20362. * @since 4.0.0
  20363. * @category Array
  20364. * @param {Array} array The array to inspect.
  20365. * @param {...Array} [values] The values to exclude.
  20366. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20367. * @returns {Array} Returns the new array of filtered values.
  20368. * @example
  20369. *
  20370. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20371. * // => [1.2]
  20372. *
  20373. * // The `_.property` iteratee shorthand.
  20374. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  20375. * // => [{ 'x': 2 }]
  20376. */
  20377. var differenceBy = baseRest(function(array, values) {
  20378. var iteratee = last(values);
  20379. if (isArrayLikeObject(iteratee)) {
  20380. iteratee = undefined;
  20381. }
  20382. return isArrayLikeObject(array)
  20383. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  20384. : [];
  20385. });
  20386. /**
  20387. * This method is like `_.difference` except that it accepts `comparator`
  20388. * which is invoked to compare elements of `array` to `values`. The order and
  20389. * references of result values are determined by the first array. The comparator
  20390. * is invoked with two arguments: (arrVal, othVal).
  20391. *
  20392. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  20393. *
  20394. * @static
  20395. * @memberOf _
  20396. * @since 4.0.0
  20397. * @category Array
  20398. * @param {Array} array The array to inspect.
  20399. * @param {...Array} [values] The values to exclude.
  20400. * @param {Function} [comparator] The comparator invoked per element.
  20401. * @returns {Array} Returns the new array of filtered values.
  20402. * @example
  20403. *
  20404. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20405. *
  20406. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  20407. * // => [{ 'x': 2, 'y': 1 }]
  20408. */
  20409. var differenceWith = baseRest(function(array, values) {
  20410. var comparator = last(values);
  20411. if (isArrayLikeObject(comparator)) {
  20412. comparator = undefined;
  20413. }
  20414. return isArrayLikeObject(array)
  20415. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  20416. : [];
  20417. });
  20418. /**
  20419. * Creates a slice of `array` with `n` elements dropped from the beginning.
  20420. *
  20421. * @static
  20422. * @memberOf _
  20423. * @since 0.5.0
  20424. * @category Array
  20425. * @param {Array} array The array to query.
  20426. * @param {number} [n=1] The number of elements to drop.
  20427. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20428. * @returns {Array} Returns the slice of `array`.
  20429. * @example
  20430. *
  20431. * _.drop([1, 2, 3]);
  20432. * // => [2, 3]
  20433. *
  20434. * _.drop([1, 2, 3], 2);
  20435. * // => [3]
  20436. *
  20437. * _.drop([1, 2, 3], 5);
  20438. * // => []
  20439. *
  20440. * _.drop([1, 2, 3], 0);
  20441. * // => [1, 2, 3]
  20442. */
  20443. function drop(array, n, guard) {
  20444. var length = array == null ? 0 : array.length;
  20445. if (!length) {
  20446. return [];
  20447. }
  20448. n = (guard || n === undefined) ? 1 : toInteger(n);
  20449. return baseSlice(array, n < 0 ? 0 : n, length);
  20450. }
  20451. /**
  20452. * Creates a slice of `array` with `n` elements dropped from the end.
  20453. *
  20454. * @static
  20455. * @memberOf _
  20456. * @since 3.0.0
  20457. * @category Array
  20458. * @param {Array} array The array to query.
  20459. * @param {number} [n=1] The number of elements to drop.
  20460. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20461. * @returns {Array} Returns the slice of `array`.
  20462. * @example
  20463. *
  20464. * _.dropRight([1, 2, 3]);
  20465. * // => [1, 2]
  20466. *
  20467. * _.dropRight([1, 2, 3], 2);
  20468. * // => [1]
  20469. *
  20470. * _.dropRight([1, 2, 3], 5);
  20471. * // => []
  20472. *
  20473. * _.dropRight([1, 2, 3], 0);
  20474. * // => [1, 2, 3]
  20475. */
  20476. function dropRight(array, n, guard) {
  20477. var length = array == null ? 0 : array.length;
  20478. if (!length) {
  20479. return [];
  20480. }
  20481. n = (guard || n === undefined) ? 1 : toInteger(n);
  20482. n = length - n;
  20483. return baseSlice(array, 0, n < 0 ? 0 : n);
  20484. }
  20485. /**
  20486. * Creates a slice of `array` excluding elements dropped from the end.
  20487. * Elements are dropped until `predicate` returns falsey. The predicate is
  20488. * invoked with three arguments: (value, index, array).
  20489. *
  20490. * @static
  20491. * @memberOf _
  20492. * @since 3.0.0
  20493. * @category Array
  20494. * @param {Array} array The array to query.
  20495. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20496. * @returns {Array} Returns the slice of `array`.
  20497. * @example
  20498. *
  20499. * var users = [
  20500. * { 'user': 'barney', 'active': true },
  20501. * { 'user': 'fred', 'active': false },
  20502. * { 'user': 'pebbles', 'active': false }
  20503. * ];
  20504. *
  20505. * _.dropRightWhile(users, function(o) { return !o.active; });
  20506. * // => objects for ['barney']
  20507. *
  20508. * // The `_.matches` iteratee shorthand.
  20509. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  20510. * // => objects for ['barney', 'fred']
  20511. *
  20512. * // The `_.matchesProperty` iteratee shorthand.
  20513. * _.dropRightWhile(users, ['active', false]);
  20514. * // => objects for ['barney']
  20515. *
  20516. * // The `_.property` iteratee shorthand.
  20517. * _.dropRightWhile(users, 'active');
  20518. * // => objects for ['barney', 'fred', 'pebbles']
  20519. */
  20520. function dropRightWhile(array, predicate) {
  20521. return (array && array.length)
  20522. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  20523. : [];
  20524. }
  20525. /**
  20526. * Creates a slice of `array` excluding elements dropped from the beginning.
  20527. * Elements are dropped until `predicate` returns falsey. The predicate is
  20528. * invoked with three arguments: (value, index, array).
  20529. *
  20530. * @static
  20531. * @memberOf _
  20532. * @since 3.0.0
  20533. * @category Array
  20534. * @param {Array} array The array to query.
  20535. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20536. * @returns {Array} Returns the slice of `array`.
  20537. * @example
  20538. *
  20539. * var users = [
  20540. * { 'user': 'barney', 'active': false },
  20541. * { 'user': 'fred', 'active': false },
  20542. * { 'user': 'pebbles', 'active': true }
  20543. * ];
  20544. *
  20545. * _.dropWhile(users, function(o) { return !o.active; });
  20546. * // => objects for ['pebbles']
  20547. *
  20548. * // The `_.matches` iteratee shorthand.
  20549. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  20550. * // => objects for ['fred', 'pebbles']
  20551. *
  20552. * // The `_.matchesProperty` iteratee shorthand.
  20553. * _.dropWhile(users, ['active', false]);
  20554. * // => objects for ['pebbles']
  20555. *
  20556. * // The `_.property` iteratee shorthand.
  20557. * _.dropWhile(users, 'active');
  20558. * // => objects for ['barney', 'fred', 'pebbles']
  20559. */
  20560. function dropWhile(array, predicate) {
  20561. return (array && array.length)
  20562. ? baseWhile(array, getIteratee(predicate, 3), true)
  20563. : [];
  20564. }
  20565. /**
  20566. * Fills elements of `array` with `value` from `start` up to, but not
  20567. * including, `end`.
  20568. *
  20569. * **Note:** This method mutates `array`.
  20570. *
  20571. * @static
  20572. * @memberOf _
  20573. * @since 3.2.0
  20574. * @category Array
  20575. * @param {Array} array The array to fill.
  20576. * @param {*} value The value to fill `array` with.
  20577. * @param {number} [start=0] The start position.
  20578. * @param {number} [end=array.length] The end position.
  20579. * @returns {Array} Returns `array`.
  20580. * @example
  20581. *
  20582. * var array = [1, 2, 3];
  20583. *
  20584. * _.fill(array, 'a');
  20585. * console.log(array);
  20586. * // => ['a', 'a', 'a']
  20587. *
  20588. * _.fill(Array(3), 2);
  20589. * // => [2, 2, 2]
  20590. *
  20591. * _.fill([4, 6, 8, 10], '*', 1, 3);
  20592. * // => [4, '*', '*', 10]
  20593. */
  20594. function fill(array, value, start, end) {
  20595. var length = array == null ? 0 : array.length;
  20596. if (!length) {
  20597. return [];
  20598. }
  20599. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  20600. start = 0;
  20601. end = length;
  20602. }
  20603. return baseFill(array, value, start, end);
  20604. }
  20605. /**
  20606. * This method is like `_.find` except that it returns the index of the first
  20607. * element `predicate` returns truthy for instead of the element itself.
  20608. *
  20609. * @static
  20610. * @memberOf _
  20611. * @since 1.1.0
  20612. * @category Array
  20613. * @param {Array} array The array to inspect.
  20614. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20615. * @param {number} [fromIndex=0] The index to search from.
  20616. * @returns {number} Returns the index of the found element, else `-1`.
  20617. * @example
  20618. *
  20619. * var users = [
  20620. * { 'user': 'barney', 'active': false },
  20621. * { 'user': 'fred', 'active': false },
  20622. * { 'user': 'pebbles', 'active': true }
  20623. * ];
  20624. *
  20625. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20626. * // => 0
  20627. *
  20628. * // The `_.matches` iteratee shorthand.
  20629. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20630. * // => 1
  20631. *
  20632. * // The `_.matchesProperty` iteratee shorthand.
  20633. * _.findIndex(users, ['active', false]);
  20634. * // => 0
  20635. *
  20636. * // The `_.property` iteratee shorthand.
  20637. * _.findIndex(users, 'active');
  20638. * // => 2
  20639. */
  20640. function findIndex(array, predicate, fromIndex) {
  20641. var length = array == null ? 0 : array.length;
  20642. if (!length) {
  20643. return -1;
  20644. }
  20645. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20646. if (index < 0) {
  20647. index = nativeMax(length + index, 0);
  20648. }
  20649. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20650. }
  20651. /**
  20652. * This method is like `_.findIndex` except that it iterates over elements
  20653. * of `collection` from right to left.
  20654. *
  20655. * @static
  20656. * @memberOf _
  20657. * @since 2.0.0
  20658. * @category Array
  20659. * @param {Array} array The array to inspect.
  20660. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20661. * @param {number} [fromIndex=array.length-1] The index to search from.
  20662. * @returns {number} Returns the index of the found element, else `-1`.
  20663. * @example
  20664. *
  20665. * var users = [
  20666. * { 'user': 'barney', 'active': true },
  20667. * { 'user': 'fred', 'active': false },
  20668. * { 'user': 'pebbles', 'active': false }
  20669. * ];
  20670. *
  20671. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20672. * // => 2
  20673. *
  20674. * // The `_.matches` iteratee shorthand.
  20675. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20676. * // => 0
  20677. *
  20678. * // The `_.matchesProperty` iteratee shorthand.
  20679. * _.findLastIndex(users, ['active', false]);
  20680. * // => 2
  20681. *
  20682. * // The `_.property` iteratee shorthand.
  20683. * _.findLastIndex(users, 'active');
  20684. * // => 0
  20685. */
  20686. function findLastIndex(array, predicate, fromIndex) {
  20687. var length = array == null ? 0 : array.length;
  20688. if (!length) {
  20689. return -1;
  20690. }
  20691. var index = length - 1;
  20692. if (fromIndex !== undefined) {
  20693. index = toInteger(fromIndex);
  20694. index = fromIndex < 0
  20695. ? nativeMax(length + index, 0)
  20696. : nativeMin(index, length - 1);
  20697. }
  20698. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20699. }
  20700. /**
  20701. * Flattens `array` a single level deep.
  20702. *
  20703. * @static
  20704. * @memberOf _
  20705. * @since 0.1.0
  20706. * @category Array
  20707. * @param {Array} array The array to flatten.
  20708. * @returns {Array} Returns the new flattened array.
  20709. * @example
  20710. *
  20711. * _.flatten([1, [2, [3, [4]], 5]]);
  20712. * // => [1, 2, [3, [4]], 5]
  20713. */
  20714. function flatten(array) {
  20715. var length = array == null ? 0 : array.length;
  20716. return length ? baseFlatten(array, 1) : [];
  20717. }
  20718. /**
  20719. * Recursively flattens `array`.
  20720. *
  20721. * @static
  20722. * @memberOf _
  20723. * @since 3.0.0
  20724. * @category Array
  20725. * @param {Array} array The array to flatten.
  20726. * @returns {Array} Returns the new flattened array.
  20727. * @example
  20728. *
  20729. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20730. * // => [1, 2, 3, 4, 5]
  20731. */
  20732. function flattenDeep(array) {
  20733. var length = array == null ? 0 : array.length;
  20734. return length ? baseFlatten(array, INFINITY) : [];
  20735. }
  20736. /**
  20737. * Recursively flatten `array` up to `depth` times.
  20738. *
  20739. * @static
  20740. * @memberOf _
  20741. * @since 4.4.0
  20742. * @category Array
  20743. * @param {Array} array The array to flatten.
  20744. * @param {number} [depth=1] The maximum recursion depth.
  20745. * @returns {Array} Returns the new flattened array.
  20746. * @example
  20747. *
  20748. * var array = [1, [2, [3, [4]], 5]];
  20749. *
  20750. * _.flattenDepth(array, 1);
  20751. * // => [1, 2, [3, [4]], 5]
  20752. *
  20753. * _.flattenDepth(array, 2);
  20754. * // => [1, 2, 3, [4], 5]
  20755. */
  20756. function flattenDepth(array, depth) {
  20757. var length = array == null ? 0 : array.length;
  20758. if (!length) {
  20759. return [];
  20760. }
  20761. depth = depth === undefined ? 1 : toInteger(depth);
  20762. return baseFlatten(array, depth);
  20763. }
  20764. /**
  20765. * The inverse of `_.toPairs`; this method returns an object composed
  20766. * from key-value `pairs`.
  20767. *
  20768. * @static
  20769. * @memberOf _
  20770. * @since 4.0.0
  20771. * @category Array
  20772. * @param {Array} pairs The key-value pairs.
  20773. * @returns {Object} Returns the new object.
  20774. * @example
  20775. *
  20776. * _.fromPairs([['a', 1], ['b', 2]]);
  20777. * // => { 'a': 1, 'b': 2 }
  20778. */
  20779. function fromPairs(pairs) {
  20780. var index = -1,
  20781. length = pairs == null ? 0 : pairs.length,
  20782. result = {};
  20783. while (++index < length) {
  20784. var pair = pairs[index];
  20785. result[pair[0]] = pair[1];
  20786. }
  20787. return result;
  20788. }
  20789. /**
  20790. * Gets the first element of `array`.
  20791. *
  20792. * @static
  20793. * @memberOf _
  20794. * @since 0.1.0
  20795. * @alias first
  20796. * @category Array
  20797. * @param {Array} array The array to query.
  20798. * @returns {*} Returns the first element of `array`.
  20799. * @example
  20800. *
  20801. * _.head([1, 2, 3]);
  20802. * // => 1
  20803. *
  20804. * _.head([]);
  20805. * // => undefined
  20806. */
  20807. function head(array) {
  20808. return (array && array.length) ? array[0] : undefined;
  20809. }
  20810. /**
  20811. * Gets the index at which the first occurrence of `value` is found in `array`
  20812. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20813. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20814. * offset from the end of `array`.
  20815. *
  20816. * @static
  20817. * @memberOf _
  20818. * @since 0.1.0
  20819. * @category Array
  20820. * @param {Array} array The array to inspect.
  20821. * @param {*} value The value to search for.
  20822. * @param {number} [fromIndex=0] The index to search from.
  20823. * @returns {number} Returns the index of the matched value, else `-1`.
  20824. * @example
  20825. *
  20826. * _.indexOf([1, 2, 1, 2], 2);
  20827. * // => 1
  20828. *
  20829. * // Search from the `fromIndex`.
  20830. * _.indexOf([1, 2, 1, 2], 2, 2);
  20831. * // => 3
  20832. */
  20833. function indexOf(array, value, fromIndex) {
  20834. var length = array == null ? 0 : array.length;
  20835. if (!length) {
  20836. return -1;
  20837. }
  20838. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20839. if (index < 0) {
  20840. index = nativeMax(length + index, 0);
  20841. }
  20842. return baseIndexOf(array, value, index);
  20843. }
  20844. /**
  20845. * Gets all but the last element of `array`.
  20846. *
  20847. * @static
  20848. * @memberOf _
  20849. * @since 0.1.0
  20850. * @category Array
  20851. * @param {Array} array The array to query.
  20852. * @returns {Array} Returns the slice of `array`.
  20853. * @example
  20854. *
  20855. * _.initial([1, 2, 3]);
  20856. * // => [1, 2]
  20857. */
  20858. function initial(array) {
  20859. var length = array == null ? 0 : array.length;
  20860. return length ? baseSlice(array, 0, -1) : [];
  20861. }
  20862. /**
  20863. * Creates an array of unique values that are included in all given arrays
  20864. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20865. * for equality comparisons. The order and references of result values are
  20866. * determined by the first array.
  20867. *
  20868. * @static
  20869. * @memberOf _
  20870. * @since 0.1.0
  20871. * @category Array
  20872. * @param {...Array} [arrays] The arrays to inspect.
  20873. * @returns {Array} Returns the new array of intersecting values.
  20874. * @example
  20875. *
  20876. * _.intersection([2, 1], [2, 3]);
  20877. * // => [2]
  20878. */
  20879. var intersection = baseRest(function(arrays) {
  20880. var mapped = arrayMap(arrays, castArrayLikeObject);
  20881. return (mapped.length && mapped[0] === arrays[0])
  20882. ? baseIntersection(mapped)
  20883. : [];
  20884. });
  20885. /**
  20886. * This method is like `_.intersection` except that it accepts `iteratee`
  20887. * which is invoked for each element of each `arrays` to generate the criterion
  20888. * by which they're compared. The order and references of result values are
  20889. * determined by the first array. The iteratee is invoked with one argument:
  20890. * (value).
  20891. *
  20892. * @static
  20893. * @memberOf _
  20894. * @since 4.0.0
  20895. * @category Array
  20896. * @param {...Array} [arrays] The arrays to inspect.
  20897. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20898. * @returns {Array} Returns the new array of intersecting values.
  20899. * @example
  20900. *
  20901. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20902. * // => [2.1]
  20903. *
  20904. * // The `_.property` iteratee shorthand.
  20905. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20906. * // => [{ 'x': 1 }]
  20907. */
  20908. var intersectionBy = baseRest(function(arrays) {
  20909. var iteratee = last(arrays),
  20910. mapped = arrayMap(arrays, castArrayLikeObject);
  20911. if (iteratee === last(mapped)) {
  20912. iteratee = undefined;
  20913. } else {
  20914. mapped.pop();
  20915. }
  20916. return (mapped.length && mapped[0] === arrays[0])
  20917. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20918. : [];
  20919. });
  20920. /**
  20921. * This method is like `_.intersection` except that it accepts `comparator`
  20922. * which is invoked to compare elements of `arrays`. The order and references
  20923. * of result values are determined by the first array. The comparator is
  20924. * invoked with two arguments: (arrVal, othVal).
  20925. *
  20926. * @static
  20927. * @memberOf _
  20928. * @since 4.0.0
  20929. * @category Array
  20930. * @param {...Array} [arrays] The arrays to inspect.
  20931. * @param {Function} [comparator] The comparator invoked per element.
  20932. * @returns {Array} Returns the new array of intersecting values.
  20933. * @example
  20934. *
  20935. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20936. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20937. *
  20938. * _.intersectionWith(objects, others, _.isEqual);
  20939. * // => [{ 'x': 1, 'y': 2 }]
  20940. */
  20941. var intersectionWith = baseRest(function(arrays) {
  20942. var comparator = last(arrays),
  20943. mapped = arrayMap(arrays, castArrayLikeObject);
  20944. comparator = typeof comparator == 'function' ? comparator : undefined;
  20945. if (comparator) {
  20946. mapped.pop();
  20947. }
  20948. return (mapped.length && mapped[0] === arrays[0])
  20949. ? baseIntersection(mapped, undefined, comparator)
  20950. : [];
  20951. });
  20952. /**
  20953. * Converts all elements in `array` into a string separated by `separator`.
  20954. *
  20955. * @static
  20956. * @memberOf _
  20957. * @since 4.0.0
  20958. * @category Array
  20959. * @param {Array} array The array to convert.
  20960. * @param {string} [separator=','] The element separator.
  20961. * @returns {string} Returns the joined string.
  20962. * @example
  20963. *
  20964. * _.join(['a', 'b', 'c'], '~');
  20965. * // => 'a~b~c'
  20966. */
  20967. function join(array, separator) {
  20968. return array == null ? '' : nativeJoin.call(array, separator);
  20969. }
  20970. /**
  20971. * Gets the last element of `array`.
  20972. *
  20973. * @static
  20974. * @memberOf _
  20975. * @since 0.1.0
  20976. * @category Array
  20977. * @param {Array} array The array to query.
  20978. * @returns {*} Returns the last element of `array`.
  20979. * @example
  20980. *
  20981. * _.last([1, 2, 3]);
  20982. * // => 3
  20983. */
  20984. function last(array) {
  20985. var length = array == null ? 0 : array.length;
  20986. return length ? array[length - 1] : undefined;
  20987. }
  20988. /**
  20989. * This method is like `_.indexOf` except that it iterates over elements of
  20990. * `array` from right to left.
  20991. *
  20992. * @static
  20993. * @memberOf _
  20994. * @since 0.1.0
  20995. * @category Array
  20996. * @param {Array} array The array to inspect.
  20997. * @param {*} value The value to search for.
  20998. * @param {number} [fromIndex=array.length-1] The index to search from.
  20999. * @returns {number} Returns the index of the matched value, else `-1`.
  21000. * @example
  21001. *
  21002. * _.lastIndexOf([1, 2, 1, 2], 2);
  21003. * // => 3
  21004. *
  21005. * // Search from the `fromIndex`.
  21006. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  21007. * // => 1
  21008. */
  21009. function lastIndexOf(array, value, fromIndex) {
  21010. var length = array == null ? 0 : array.length;
  21011. if (!length) {
  21012. return -1;
  21013. }
  21014. var index = length;
  21015. if (fromIndex !== undefined) {
  21016. index = toInteger(fromIndex);
  21017. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  21018. }
  21019. return value === value
  21020. ? strictLastIndexOf(array, value, index)
  21021. : baseFindIndex(array, baseIsNaN, index, true);
  21022. }
  21023. /**
  21024. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  21025. * element from the end is returned.
  21026. *
  21027. * @static
  21028. * @memberOf _
  21029. * @since 4.11.0
  21030. * @category Array
  21031. * @param {Array} array The array to query.
  21032. * @param {number} [n=0] The index of the element to return.
  21033. * @returns {*} Returns the nth element of `array`.
  21034. * @example
  21035. *
  21036. * var array = ['a', 'b', 'c', 'd'];
  21037. *
  21038. * _.nth(array, 1);
  21039. * // => 'b'
  21040. *
  21041. * _.nth(array, -2);
  21042. * // => 'c';
  21043. */
  21044. function nth(array, n) {
  21045. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  21046. }
  21047. /**
  21048. * Removes all given values from `array` using
  21049. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21050. * for equality comparisons.
  21051. *
  21052. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  21053. * to remove elements from an array by predicate.
  21054. *
  21055. * @static
  21056. * @memberOf _
  21057. * @since 2.0.0
  21058. * @category Array
  21059. * @param {Array} array The array to modify.
  21060. * @param {...*} [values] The values to remove.
  21061. * @returns {Array} Returns `array`.
  21062. * @example
  21063. *
  21064. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21065. *
  21066. * _.pull(array, 'a', 'c');
  21067. * console.log(array);
  21068. * // => ['b', 'b']
  21069. */
  21070. var pull = baseRest(pullAll);
  21071. /**
  21072. * This method is like `_.pull` except that it accepts an array of values to remove.
  21073. *
  21074. * **Note:** Unlike `_.difference`, this method mutates `array`.
  21075. *
  21076. * @static
  21077. * @memberOf _
  21078. * @since 4.0.0
  21079. * @category Array
  21080. * @param {Array} array The array to modify.
  21081. * @param {Array} values The values to remove.
  21082. * @returns {Array} Returns `array`.
  21083. * @example
  21084. *
  21085. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  21086. *
  21087. * _.pullAll(array, ['a', 'c']);
  21088. * console.log(array);
  21089. * // => ['b', 'b']
  21090. */
  21091. function pullAll(array, values) {
  21092. return (array && array.length && values && values.length)
  21093. ? basePullAll(array, values)
  21094. : array;
  21095. }
  21096. /**
  21097. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  21098. * invoked for each element of `array` and `values` to generate the criterion
  21099. * by which they're compared. The iteratee is invoked with one argument: (value).
  21100. *
  21101. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  21102. *
  21103. * @static
  21104. * @memberOf _
  21105. * @since 4.0.0
  21106. * @category Array
  21107. * @param {Array} array The array to modify.
  21108. * @param {Array} values The values to remove.
  21109. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21110. * @returns {Array} Returns `array`.
  21111. * @example
  21112. *
  21113. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  21114. *
  21115. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  21116. * console.log(array);
  21117. * // => [{ 'x': 2 }]
  21118. */
  21119. function pullAllBy(array, values, iteratee) {
  21120. return (array && array.length && values && values.length)
  21121. ? basePullAll(array, values, getIteratee(iteratee, 2))
  21122. : array;
  21123. }
  21124. /**
  21125. * This method is like `_.pullAll` except that it accepts `comparator` which
  21126. * is invoked to compare elements of `array` to `values`. The comparator is
  21127. * invoked with two arguments: (arrVal, othVal).
  21128. *
  21129. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  21130. *
  21131. * @static
  21132. * @memberOf _
  21133. * @since 4.6.0
  21134. * @category Array
  21135. * @param {Array} array The array to modify.
  21136. * @param {Array} values The values to remove.
  21137. * @param {Function} [comparator] The comparator invoked per element.
  21138. * @returns {Array} Returns `array`.
  21139. * @example
  21140. *
  21141. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  21142. *
  21143. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  21144. * console.log(array);
  21145. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  21146. */
  21147. function pullAllWith(array, values, comparator) {
  21148. return (array && array.length && values && values.length)
  21149. ? basePullAll(array, values, undefined, comparator)
  21150. : array;
  21151. }
  21152. /**
  21153. * Removes elements from `array` corresponding to `indexes` and returns an
  21154. * array of removed elements.
  21155. *
  21156. * **Note:** Unlike `_.at`, this method mutates `array`.
  21157. *
  21158. * @static
  21159. * @memberOf _
  21160. * @since 3.0.0
  21161. * @category Array
  21162. * @param {Array} array The array to modify.
  21163. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  21164. * @returns {Array} Returns the new array of removed elements.
  21165. * @example
  21166. *
  21167. * var array = ['a', 'b', 'c', 'd'];
  21168. * var pulled = _.pullAt(array, [1, 3]);
  21169. *
  21170. * console.log(array);
  21171. * // => ['a', 'c']
  21172. *
  21173. * console.log(pulled);
  21174. * // => ['b', 'd']
  21175. */
  21176. var pullAt = flatRest(function(array, indexes) {
  21177. var length = array == null ? 0 : array.length,
  21178. result = baseAt(array, indexes);
  21179. basePullAt(array, arrayMap(indexes, function(index) {
  21180. return isIndex(index, length) ? +index : index;
  21181. }).sort(compareAscending));
  21182. return result;
  21183. });
  21184. /**
  21185. * Removes all elements from `array` that `predicate` returns truthy for
  21186. * and returns an array of the removed elements. The predicate is invoked
  21187. * with three arguments: (value, index, array).
  21188. *
  21189. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  21190. * to pull elements from an array by value.
  21191. *
  21192. * @static
  21193. * @memberOf _
  21194. * @since 2.0.0
  21195. * @category Array
  21196. * @param {Array} array The array to modify.
  21197. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21198. * @returns {Array} Returns the new array of removed elements.
  21199. * @example
  21200. *
  21201. * var array = [1, 2, 3, 4];
  21202. * var evens = _.remove(array, function(n) {
  21203. * return n % 2 == 0;
  21204. * });
  21205. *
  21206. * console.log(array);
  21207. * // => [1, 3]
  21208. *
  21209. * console.log(evens);
  21210. * // => [2, 4]
  21211. */
  21212. function remove(array, predicate) {
  21213. var result = [];
  21214. if (!(array && array.length)) {
  21215. return result;
  21216. }
  21217. var index = -1,
  21218. indexes = [],
  21219. length = array.length;
  21220. predicate = getIteratee(predicate, 3);
  21221. while (++index < length) {
  21222. var value = array[index];
  21223. if (predicate(value, index, array)) {
  21224. result.push(value);
  21225. indexes.push(index);
  21226. }
  21227. }
  21228. basePullAt(array, indexes);
  21229. return result;
  21230. }
  21231. /**
  21232. * Reverses `array` so that the first element becomes the last, the second
  21233. * element becomes the second to last, and so on.
  21234. *
  21235. * **Note:** This method mutates `array` and is based on
  21236. * [`Array#reverse`](https://mdn.io/Array/reverse).
  21237. *
  21238. * @static
  21239. * @memberOf _
  21240. * @since 4.0.0
  21241. * @category Array
  21242. * @param {Array} array The array to modify.
  21243. * @returns {Array} Returns `array`.
  21244. * @example
  21245. *
  21246. * var array = [1, 2, 3];
  21247. *
  21248. * _.reverse(array);
  21249. * // => [3, 2, 1]
  21250. *
  21251. * console.log(array);
  21252. * // => [3, 2, 1]
  21253. */
  21254. function reverse(array) {
  21255. return array == null ? array : nativeReverse.call(array);
  21256. }
  21257. /**
  21258. * Creates a slice of `array` from `start` up to, but not including, `end`.
  21259. *
  21260. * **Note:** This method is used instead of
  21261. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  21262. * returned.
  21263. *
  21264. * @static
  21265. * @memberOf _
  21266. * @since 3.0.0
  21267. * @category Array
  21268. * @param {Array} array The array to slice.
  21269. * @param {number} [start=0] The start position.
  21270. * @param {number} [end=array.length] The end position.
  21271. * @returns {Array} Returns the slice of `array`.
  21272. */
  21273. function slice(array, start, end) {
  21274. var length = array == null ? 0 : array.length;
  21275. if (!length) {
  21276. return [];
  21277. }
  21278. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  21279. start = 0;
  21280. end = length;
  21281. }
  21282. else {
  21283. start = start == null ? 0 : toInteger(start);
  21284. end = end === undefined ? length : toInteger(end);
  21285. }
  21286. return baseSlice(array, start, end);
  21287. }
  21288. /**
  21289. * Uses a binary search to determine the lowest index at which `value`
  21290. * should be inserted into `array` in order to maintain its sort order.
  21291. *
  21292. * @static
  21293. * @memberOf _
  21294. * @since 0.1.0
  21295. * @category Array
  21296. * @param {Array} array The sorted array to inspect.
  21297. * @param {*} value The value to evaluate.
  21298. * @returns {number} Returns the index at which `value` should be inserted
  21299. * into `array`.
  21300. * @example
  21301. *
  21302. * _.sortedIndex([30, 50], 40);
  21303. * // => 1
  21304. */
  21305. function sortedIndex(array, value) {
  21306. return baseSortedIndex(array, value);
  21307. }
  21308. /**
  21309. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  21310. * which is invoked for `value` and each element of `array` to compute their
  21311. * sort ranking. The iteratee is invoked with one argument: (value).
  21312. *
  21313. * @static
  21314. * @memberOf _
  21315. * @since 4.0.0
  21316. * @category Array
  21317. * @param {Array} array The sorted array to inspect.
  21318. * @param {*} value The value to evaluate.
  21319. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21320. * @returns {number} Returns the index at which `value` should be inserted
  21321. * into `array`.
  21322. * @example
  21323. *
  21324. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21325. *
  21326. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21327. * // => 0
  21328. *
  21329. * // The `_.property` iteratee shorthand.
  21330. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  21331. * // => 0
  21332. */
  21333. function sortedIndexBy(array, value, iteratee) {
  21334. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  21335. }
  21336. /**
  21337. * This method is like `_.indexOf` except that it performs a binary
  21338. * search on a sorted `array`.
  21339. *
  21340. * @static
  21341. * @memberOf _
  21342. * @since 4.0.0
  21343. * @category Array
  21344. * @param {Array} array The array to inspect.
  21345. * @param {*} value The value to search for.
  21346. * @returns {number} Returns the index of the matched value, else `-1`.
  21347. * @example
  21348. *
  21349. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  21350. * // => 1
  21351. */
  21352. function sortedIndexOf(array, value) {
  21353. var length = array == null ? 0 : array.length;
  21354. if (length) {
  21355. var index = baseSortedIndex(array, value);
  21356. if (index < length && eq(array[index], value)) {
  21357. return index;
  21358. }
  21359. }
  21360. return -1;
  21361. }
  21362. /**
  21363. * This method is like `_.sortedIndex` except that it returns the highest
  21364. * index at which `value` should be inserted into `array` in order to
  21365. * maintain its sort order.
  21366. *
  21367. * @static
  21368. * @memberOf _
  21369. * @since 3.0.0
  21370. * @category Array
  21371. * @param {Array} array The sorted array to inspect.
  21372. * @param {*} value The value to evaluate.
  21373. * @returns {number} Returns the index at which `value` should be inserted
  21374. * into `array`.
  21375. * @example
  21376. *
  21377. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  21378. * // => 4
  21379. */
  21380. function sortedLastIndex(array, value) {
  21381. return baseSortedIndex(array, value, true);
  21382. }
  21383. /**
  21384. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  21385. * which is invoked for `value` and each element of `array` to compute their
  21386. * sort ranking. The iteratee is invoked with one argument: (value).
  21387. *
  21388. * @static
  21389. * @memberOf _
  21390. * @since 4.0.0
  21391. * @category Array
  21392. * @param {Array} array The sorted array to inspect.
  21393. * @param {*} value The value to evaluate.
  21394. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21395. * @returns {number} Returns the index at which `value` should be inserted
  21396. * into `array`.
  21397. * @example
  21398. *
  21399. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21400. *
  21401. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21402. * // => 1
  21403. *
  21404. * // The `_.property` iteratee shorthand.
  21405. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  21406. * // => 1
  21407. */
  21408. function sortedLastIndexBy(array, value, iteratee) {
  21409. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  21410. }
  21411. /**
  21412. * This method is like `_.lastIndexOf` except that it performs a binary
  21413. * search on a sorted `array`.
  21414. *
  21415. * @static
  21416. * @memberOf _
  21417. * @since 4.0.0
  21418. * @category Array
  21419. * @param {Array} array The array to inspect.
  21420. * @param {*} value The value to search for.
  21421. * @returns {number} Returns the index of the matched value, else `-1`.
  21422. * @example
  21423. *
  21424. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  21425. * // => 3
  21426. */
  21427. function sortedLastIndexOf(array, value) {
  21428. var length = array == null ? 0 : array.length;
  21429. if (length) {
  21430. var index = baseSortedIndex(array, value, true) - 1;
  21431. if (eq(array[index], value)) {
  21432. return index;
  21433. }
  21434. }
  21435. return -1;
  21436. }
  21437. /**
  21438. * This method is like `_.uniq` except that it's designed and optimized
  21439. * for sorted arrays.
  21440. *
  21441. * @static
  21442. * @memberOf _
  21443. * @since 4.0.0
  21444. * @category Array
  21445. * @param {Array} array The array to inspect.
  21446. * @returns {Array} Returns the new duplicate free array.
  21447. * @example
  21448. *
  21449. * _.sortedUniq([1, 1, 2]);
  21450. * // => [1, 2]
  21451. */
  21452. function sortedUniq(array) {
  21453. return (array && array.length)
  21454. ? baseSortedUniq(array)
  21455. : [];
  21456. }
  21457. /**
  21458. * This method is like `_.uniqBy` except that it's designed and optimized
  21459. * for sorted arrays.
  21460. *
  21461. * @static
  21462. * @memberOf _
  21463. * @since 4.0.0
  21464. * @category Array
  21465. * @param {Array} array The array to inspect.
  21466. * @param {Function} [iteratee] The iteratee invoked per element.
  21467. * @returns {Array} Returns the new duplicate free array.
  21468. * @example
  21469. *
  21470. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  21471. * // => [1.1, 2.3]
  21472. */
  21473. function sortedUniqBy(array, iteratee) {
  21474. return (array && array.length)
  21475. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  21476. : [];
  21477. }
  21478. /**
  21479. * Gets all but the first element of `array`.
  21480. *
  21481. * @static
  21482. * @memberOf _
  21483. * @since 4.0.0
  21484. * @category Array
  21485. * @param {Array} array The array to query.
  21486. * @returns {Array} Returns the slice of `array`.
  21487. * @example
  21488. *
  21489. * _.tail([1, 2, 3]);
  21490. * // => [2, 3]
  21491. */
  21492. function tail(array) {
  21493. var length = array == null ? 0 : array.length;
  21494. return length ? baseSlice(array, 1, length) : [];
  21495. }
  21496. /**
  21497. * Creates a slice of `array` with `n` elements taken from the beginning.
  21498. *
  21499. * @static
  21500. * @memberOf _
  21501. * @since 0.1.0
  21502. * @category Array
  21503. * @param {Array} array The array to query.
  21504. * @param {number} [n=1] The number of elements to take.
  21505. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21506. * @returns {Array} Returns the slice of `array`.
  21507. * @example
  21508. *
  21509. * _.take([1, 2, 3]);
  21510. * // => [1]
  21511. *
  21512. * _.take([1, 2, 3], 2);
  21513. * // => [1, 2]
  21514. *
  21515. * _.take([1, 2, 3], 5);
  21516. * // => [1, 2, 3]
  21517. *
  21518. * _.take([1, 2, 3], 0);
  21519. * // => []
  21520. */
  21521. function take(array, n, guard) {
  21522. if (!(array && array.length)) {
  21523. return [];
  21524. }
  21525. n = (guard || n === undefined) ? 1 : toInteger(n);
  21526. return baseSlice(array, 0, n < 0 ? 0 : n);
  21527. }
  21528. /**
  21529. * Creates a slice of `array` with `n` elements taken from the end.
  21530. *
  21531. * @static
  21532. * @memberOf _
  21533. * @since 3.0.0
  21534. * @category Array
  21535. * @param {Array} array The array to query.
  21536. * @param {number} [n=1] The number of elements to take.
  21537. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21538. * @returns {Array} Returns the slice of `array`.
  21539. * @example
  21540. *
  21541. * _.takeRight([1, 2, 3]);
  21542. * // => [3]
  21543. *
  21544. * _.takeRight([1, 2, 3], 2);
  21545. * // => [2, 3]
  21546. *
  21547. * _.takeRight([1, 2, 3], 5);
  21548. * // => [1, 2, 3]
  21549. *
  21550. * _.takeRight([1, 2, 3], 0);
  21551. * // => []
  21552. */
  21553. function takeRight(array, n, guard) {
  21554. var length = array == null ? 0 : array.length;
  21555. if (!length) {
  21556. return [];
  21557. }
  21558. n = (guard || n === undefined) ? 1 : toInteger(n);
  21559. n = length - n;
  21560. return baseSlice(array, n < 0 ? 0 : n, length);
  21561. }
  21562. /**
  21563. * Creates a slice of `array` with elements taken from the end. Elements are
  21564. * taken until `predicate` returns falsey. The predicate is invoked with
  21565. * three arguments: (value, index, array).
  21566. *
  21567. * @static
  21568. * @memberOf _
  21569. * @since 3.0.0
  21570. * @category Array
  21571. * @param {Array} array The array to query.
  21572. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21573. * @returns {Array} Returns the slice of `array`.
  21574. * @example
  21575. *
  21576. * var users = [
  21577. * { 'user': 'barney', 'active': true },
  21578. * { 'user': 'fred', 'active': false },
  21579. * { 'user': 'pebbles', 'active': false }
  21580. * ];
  21581. *
  21582. * _.takeRightWhile(users, function(o) { return !o.active; });
  21583. * // => objects for ['fred', 'pebbles']
  21584. *
  21585. * // The `_.matches` iteratee shorthand.
  21586. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  21587. * // => objects for ['pebbles']
  21588. *
  21589. * // The `_.matchesProperty` iteratee shorthand.
  21590. * _.takeRightWhile(users, ['active', false]);
  21591. * // => objects for ['fred', 'pebbles']
  21592. *
  21593. * // The `_.property` iteratee shorthand.
  21594. * _.takeRightWhile(users, 'active');
  21595. * // => []
  21596. */
  21597. function takeRightWhile(array, predicate) {
  21598. return (array && array.length)
  21599. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  21600. : [];
  21601. }
  21602. /**
  21603. * Creates a slice of `array` with elements taken from the beginning. Elements
  21604. * are taken until `predicate` returns falsey. The predicate is invoked with
  21605. * three arguments: (value, index, array).
  21606. *
  21607. * @static
  21608. * @memberOf _
  21609. * @since 3.0.0
  21610. * @category Array
  21611. * @param {Array} array The array to query.
  21612. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21613. * @returns {Array} Returns the slice of `array`.
  21614. * @example
  21615. *
  21616. * var users = [
  21617. * { 'user': 'barney', 'active': false },
  21618. * { 'user': 'fred', 'active': false },
  21619. * { 'user': 'pebbles', 'active': true }
  21620. * ];
  21621. *
  21622. * _.takeWhile(users, function(o) { return !o.active; });
  21623. * // => objects for ['barney', 'fred']
  21624. *
  21625. * // The `_.matches` iteratee shorthand.
  21626. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21627. * // => objects for ['barney']
  21628. *
  21629. * // The `_.matchesProperty` iteratee shorthand.
  21630. * _.takeWhile(users, ['active', false]);
  21631. * // => objects for ['barney', 'fred']
  21632. *
  21633. * // The `_.property` iteratee shorthand.
  21634. * _.takeWhile(users, 'active');
  21635. * // => []
  21636. */
  21637. function takeWhile(array, predicate) {
  21638. return (array && array.length)
  21639. ? baseWhile(array, getIteratee(predicate, 3))
  21640. : [];
  21641. }
  21642. /**
  21643. * Creates an array of unique values, in order, from all given arrays using
  21644. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21645. * for equality comparisons.
  21646. *
  21647. * @static
  21648. * @memberOf _
  21649. * @since 0.1.0
  21650. * @category Array
  21651. * @param {...Array} [arrays] The arrays to inspect.
  21652. * @returns {Array} Returns the new array of combined values.
  21653. * @example
  21654. *
  21655. * _.union([2], [1, 2]);
  21656. * // => [2, 1]
  21657. */
  21658. var union = baseRest(function(arrays) {
  21659. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21660. });
  21661. /**
  21662. * This method is like `_.union` except that it accepts `iteratee` which is
  21663. * invoked for each element of each `arrays` to generate the criterion by
  21664. * which uniqueness is computed. Result values are chosen from the first
  21665. * array in which the value occurs. The iteratee is invoked with one argument:
  21666. * (value).
  21667. *
  21668. * @static
  21669. * @memberOf _
  21670. * @since 4.0.0
  21671. * @category Array
  21672. * @param {...Array} [arrays] The arrays to inspect.
  21673. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21674. * @returns {Array} Returns the new array of combined values.
  21675. * @example
  21676. *
  21677. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21678. * // => [2.1, 1.2]
  21679. *
  21680. * // The `_.property` iteratee shorthand.
  21681. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21682. * // => [{ 'x': 1 }, { 'x': 2 }]
  21683. */
  21684. var unionBy = baseRest(function(arrays) {
  21685. var iteratee = last(arrays);
  21686. if (isArrayLikeObject(iteratee)) {
  21687. iteratee = undefined;
  21688. }
  21689. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21690. });
  21691. /**
  21692. * This method is like `_.union` except that it accepts `comparator` which
  21693. * is invoked to compare elements of `arrays`. Result values are chosen from
  21694. * the first array in which the value occurs. The comparator is invoked
  21695. * with two arguments: (arrVal, othVal).
  21696. *
  21697. * @static
  21698. * @memberOf _
  21699. * @since 4.0.0
  21700. * @category Array
  21701. * @param {...Array} [arrays] The arrays to inspect.
  21702. * @param {Function} [comparator] The comparator invoked per element.
  21703. * @returns {Array} Returns the new array of combined values.
  21704. * @example
  21705. *
  21706. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21707. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21708. *
  21709. * _.unionWith(objects, others, _.isEqual);
  21710. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21711. */
  21712. var unionWith = baseRest(function(arrays) {
  21713. var comparator = last(arrays);
  21714. comparator = typeof comparator == 'function' ? comparator : undefined;
  21715. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21716. });
  21717. /**
  21718. * Creates a duplicate-free version of an array, using
  21719. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21720. * for equality comparisons, in which only the first occurrence of each element
  21721. * is kept. The order of result values is determined by the order they occur
  21722. * in the array.
  21723. *
  21724. * @static
  21725. * @memberOf _
  21726. * @since 0.1.0
  21727. * @category Array
  21728. * @param {Array} array The array to inspect.
  21729. * @returns {Array} Returns the new duplicate free array.
  21730. * @example
  21731. *
  21732. * _.uniq([2, 1, 2]);
  21733. * // => [2, 1]
  21734. */
  21735. function uniq(array) {
  21736. return (array && array.length) ? baseUniq(array) : [];
  21737. }
  21738. /**
  21739. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21740. * invoked for each element in `array` to generate the criterion by which
  21741. * uniqueness is computed. The order of result values is determined by the
  21742. * order they occur in the array. The iteratee is invoked with one argument:
  21743. * (value).
  21744. *
  21745. * @static
  21746. * @memberOf _
  21747. * @since 4.0.0
  21748. * @category Array
  21749. * @param {Array} array The array to inspect.
  21750. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21751. * @returns {Array} Returns the new duplicate free array.
  21752. * @example
  21753. *
  21754. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21755. * // => [2.1, 1.2]
  21756. *
  21757. * // The `_.property` iteratee shorthand.
  21758. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21759. * // => [{ 'x': 1 }, { 'x': 2 }]
  21760. */
  21761. function uniqBy(array, iteratee) {
  21762. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21763. }
  21764. /**
  21765. * This method is like `_.uniq` except that it accepts `comparator` which
  21766. * is invoked to compare elements of `array`. The order of result values is
  21767. * determined by the order they occur in the array.The comparator is invoked
  21768. * with two arguments: (arrVal, othVal).
  21769. *
  21770. * @static
  21771. * @memberOf _
  21772. * @since 4.0.0
  21773. * @category Array
  21774. * @param {Array} array The array to inspect.
  21775. * @param {Function} [comparator] The comparator invoked per element.
  21776. * @returns {Array} Returns the new duplicate free array.
  21777. * @example
  21778. *
  21779. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21780. *
  21781. * _.uniqWith(objects, _.isEqual);
  21782. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21783. */
  21784. function uniqWith(array, comparator) {
  21785. comparator = typeof comparator == 'function' ? comparator : undefined;
  21786. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21787. }
  21788. /**
  21789. * This method is like `_.zip` except that it accepts an array of grouped
  21790. * elements and creates an array regrouping the elements to their pre-zip
  21791. * configuration.
  21792. *
  21793. * @static
  21794. * @memberOf _
  21795. * @since 1.2.0
  21796. * @category Array
  21797. * @param {Array} array The array of grouped elements to process.
  21798. * @returns {Array} Returns the new array of regrouped elements.
  21799. * @example
  21800. *
  21801. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21802. * // => [['a', 1, true], ['b', 2, false]]
  21803. *
  21804. * _.unzip(zipped);
  21805. * // => [['a', 'b'], [1, 2], [true, false]]
  21806. */
  21807. function unzip(array) {
  21808. if (!(array && array.length)) {
  21809. return [];
  21810. }
  21811. var length = 0;
  21812. array = arrayFilter(array, function(group) {
  21813. if (isArrayLikeObject(group)) {
  21814. length = nativeMax(group.length, length);
  21815. return true;
  21816. }
  21817. });
  21818. return baseTimes(length, function(index) {
  21819. return arrayMap(array, baseProperty(index));
  21820. });
  21821. }
  21822. /**
  21823. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21824. * how regrouped values should be combined. The iteratee is invoked with the
  21825. * elements of each group: (...group).
  21826. *
  21827. * @static
  21828. * @memberOf _
  21829. * @since 3.8.0
  21830. * @category Array
  21831. * @param {Array} array The array of grouped elements to process.
  21832. * @param {Function} [iteratee=_.identity] The function to combine
  21833. * regrouped values.
  21834. * @returns {Array} Returns the new array of regrouped elements.
  21835. * @example
  21836. *
  21837. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21838. * // => [[1, 10, 100], [2, 20, 200]]
  21839. *
  21840. * _.unzipWith(zipped, _.add);
  21841. * // => [3, 30, 300]
  21842. */
  21843. function unzipWith(array, iteratee) {
  21844. if (!(array && array.length)) {
  21845. return [];
  21846. }
  21847. var result = unzip(array);
  21848. if (iteratee == null) {
  21849. return result;
  21850. }
  21851. return arrayMap(result, function(group) {
  21852. return apply(iteratee, undefined, group);
  21853. });
  21854. }
  21855. /**
  21856. * Creates an array excluding all given values using
  21857. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21858. * for equality comparisons.
  21859. *
  21860. * **Note:** Unlike `_.pull`, this method returns a new array.
  21861. *
  21862. * @static
  21863. * @memberOf _
  21864. * @since 0.1.0
  21865. * @category Array
  21866. * @param {Array} array The array to inspect.
  21867. * @param {...*} [values] The values to exclude.
  21868. * @returns {Array} Returns the new array of filtered values.
  21869. * @see _.difference, _.xor
  21870. * @example
  21871. *
  21872. * _.without([2, 1, 2, 3], 1, 2);
  21873. * // => [3]
  21874. */
  21875. var without = baseRest(function(array, values) {
  21876. return isArrayLikeObject(array)
  21877. ? baseDifference(array, values)
  21878. : [];
  21879. });
  21880. /**
  21881. * Creates an array of unique values that is the
  21882. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21883. * of the given arrays. The order of result values is determined by the order
  21884. * they occur in the arrays.
  21885. *
  21886. * @static
  21887. * @memberOf _
  21888. * @since 2.4.0
  21889. * @category Array
  21890. * @param {...Array} [arrays] The arrays to inspect.
  21891. * @returns {Array} Returns the new array of filtered values.
  21892. * @see _.difference, _.without
  21893. * @example
  21894. *
  21895. * _.xor([2, 1], [2, 3]);
  21896. * // => [1, 3]
  21897. */
  21898. var xor = baseRest(function(arrays) {
  21899. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21900. });
  21901. /**
  21902. * This method is like `_.xor` except that it accepts `iteratee` which is
  21903. * invoked for each element of each `arrays` to generate the criterion by
  21904. * which by which they're compared. The order of result values is determined
  21905. * by the order they occur in the arrays. The iteratee is invoked with one
  21906. * argument: (value).
  21907. *
  21908. * @static
  21909. * @memberOf _
  21910. * @since 4.0.0
  21911. * @category Array
  21912. * @param {...Array} [arrays] The arrays to inspect.
  21913. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21914. * @returns {Array} Returns the new array of filtered values.
  21915. * @example
  21916. *
  21917. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21918. * // => [1.2, 3.4]
  21919. *
  21920. * // The `_.property` iteratee shorthand.
  21921. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21922. * // => [{ 'x': 2 }]
  21923. */
  21924. var xorBy = baseRest(function(arrays) {
  21925. var iteratee = last(arrays);
  21926. if (isArrayLikeObject(iteratee)) {
  21927. iteratee = undefined;
  21928. }
  21929. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21930. });
  21931. /**
  21932. * This method is like `_.xor` except that it accepts `comparator` which is
  21933. * invoked to compare elements of `arrays`. The order of result values is
  21934. * determined by the order they occur in the arrays. The comparator is invoked
  21935. * with two arguments: (arrVal, othVal).
  21936. *
  21937. * @static
  21938. * @memberOf _
  21939. * @since 4.0.0
  21940. * @category Array
  21941. * @param {...Array} [arrays] The arrays to inspect.
  21942. * @param {Function} [comparator] The comparator invoked per element.
  21943. * @returns {Array} Returns the new array of filtered values.
  21944. * @example
  21945. *
  21946. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21947. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21948. *
  21949. * _.xorWith(objects, others, _.isEqual);
  21950. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21951. */
  21952. var xorWith = baseRest(function(arrays) {
  21953. var comparator = last(arrays);
  21954. comparator = typeof comparator == 'function' ? comparator : undefined;
  21955. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21956. });
  21957. /**
  21958. * Creates an array of grouped elements, the first of which contains the
  21959. * first elements of the given arrays, the second of which contains the
  21960. * second elements of the given arrays, and so on.
  21961. *
  21962. * @static
  21963. * @memberOf _
  21964. * @since 0.1.0
  21965. * @category Array
  21966. * @param {...Array} [arrays] The arrays to process.
  21967. * @returns {Array} Returns the new array of grouped elements.
  21968. * @example
  21969. *
  21970. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21971. * // => [['a', 1, true], ['b', 2, false]]
  21972. */
  21973. var zip = baseRest(unzip);
  21974. /**
  21975. * This method is like `_.fromPairs` except that it accepts two arrays,
  21976. * one of property identifiers and one of corresponding values.
  21977. *
  21978. * @static
  21979. * @memberOf _
  21980. * @since 0.4.0
  21981. * @category Array
  21982. * @param {Array} [props=[]] The property identifiers.
  21983. * @param {Array} [values=[]] The property values.
  21984. * @returns {Object} Returns the new object.
  21985. * @example
  21986. *
  21987. * _.zipObject(['a', 'b'], [1, 2]);
  21988. * // => { 'a': 1, 'b': 2 }
  21989. */
  21990. function zipObject(props, values) {
  21991. return baseZipObject(props || [], values || [], assignValue);
  21992. }
  21993. /**
  21994. * This method is like `_.zipObject` except that it supports property paths.
  21995. *
  21996. * @static
  21997. * @memberOf _
  21998. * @since 4.1.0
  21999. * @category Array
  22000. * @param {Array} [props=[]] The property identifiers.
  22001. * @param {Array} [values=[]] The property values.
  22002. * @returns {Object} Returns the new object.
  22003. * @example
  22004. *
  22005. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  22006. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  22007. */
  22008. function zipObjectDeep(props, values) {
  22009. return baseZipObject(props || [], values || [], baseSet);
  22010. }
  22011. /**
  22012. * This method is like `_.zip` except that it accepts `iteratee` to specify
  22013. * how grouped values should be combined. The iteratee is invoked with the
  22014. * elements of each group: (...group).
  22015. *
  22016. * @static
  22017. * @memberOf _
  22018. * @since 3.8.0
  22019. * @category Array
  22020. * @param {...Array} [arrays] The arrays to process.
  22021. * @param {Function} [iteratee=_.identity] The function to combine
  22022. * grouped values.
  22023. * @returns {Array} Returns the new array of grouped elements.
  22024. * @example
  22025. *
  22026. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  22027. * return a + b + c;
  22028. * });
  22029. * // => [111, 222]
  22030. */
  22031. var zipWith = baseRest(function(arrays) {
  22032. var length = arrays.length,
  22033. iteratee = length > 1 ? arrays[length - 1] : undefined;
  22034. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  22035. return unzipWith(arrays, iteratee);
  22036. });
  22037. /*------------------------------------------------------------------------*/
  22038. /**
  22039. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  22040. * chain sequences enabled. The result of such sequences must be unwrapped
  22041. * with `_#value`.
  22042. *
  22043. * @static
  22044. * @memberOf _
  22045. * @since 1.3.0
  22046. * @category Seq
  22047. * @param {*} value The value to wrap.
  22048. * @returns {Object} Returns the new `lodash` wrapper instance.
  22049. * @example
  22050. *
  22051. * var users = [
  22052. * { 'user': 'barney', 'age': 36 },
  22053. * { 'user': 'fred', 'age': 40 },
  22054. * { 'user': 'pebbles', 'age': 1 }
  22055. * ];
  22056. *
  22057. * var youngest = _
  22058. * .chain(users)
  22059. * .sortBy('age')
  22060. * .map(function(o) {
  22061. * return o.user + ' is ' + o.age;
  22062. * })
  22063. * .head()
  22064. * .value();
  22065. * // => 'pebbles is 1'
  22066. */
  22067. function chain(value) {
  22068. var result = lodash(value);
  22069. result.__chain__ = true;
  22070. return result;
  22071. }
  22072. /**
  22073. * This method invokes `interceptor` and returns `value`. The interceptor
  22074. * is invoked with one argument; (value). The purpose of this method is to
  22075. * "tap into" a method chain sequence in order to modify intermediate results.
  22076. *
  22077. * @static
  22078. * @memberOf _
  22079. * @since 0.1.0
  22080. * @category Seq
  22081. * @param {*} value The value to provide to `interceptor`.
  22082. * @param {Function} interceptor The function to invoke.
  22083. * @returns {*} Returns `value`.
  22084. * @example
  22085. *
  22086. * _([1, 2, 3])
  22087. * .tap(function(array) {
  22088. * // Mutate input array.
  22089. * array.pop();
  22090. * })
  22091. * .reverse()
  22092. * .value();
  22093. * // => [2, 1]
  22094. */
  22095. function tap(value, interceptor) {
  22096. interceptor(value);
  22097. return value;
  22098. }
  22099. /**
  22100. * This method is like `_.tap` except that it returns the result of `interceptor`.
  22101. * The purpose of this method is to "pass thru" values replacing intermediate
  22102. * results in a method chain sequence.
  22103. *
  22104. * @static
  22105. * @memberOf _
  22106. * @since 3.0.0
  22107. * @category Seq
  22108. * @param {*} value The value to provide to `interceptor`.
  22109. * @param {Function} interceptor The function to invoke.
  22110. * @returns {*} Returns the result of `interceptor`.
  22111. * @example
  22112. *
  22113. * _(' abc ')
  22114. * .chain()
  22115. * .trim()
  22116. * .thru(function(value) {
  22117. * return [value];
  22118. * })
  22119. * .value();
  22120. * // => ['abc']
  22121. */
  22122. function thru(value, interceptor) {
  22123. return interceptor(value);
  22124. }
  22125. /**
  22126. * This method is the wrapper version of `_.at`.
  22127. *
  22128. * @name at
  22129. * @memberOf _
  22130. * @since 1.0.0
  22131. * @category Seq
  22132. * @param {...(string|string[])} [paths] The property paths to pick.
  22133. * @returns {Object} Returns the new `lodash` wrapper instance.
  22134. * @example
  22135. *
  22136. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  22137. *
  22138. * _(object).at(['a[0].b.c', 'a[1]']).value();
  22139. * // => [3, 4]
  22140. */
  22141. var wrapperAt = flatRest(function(paths) {
  22142. var length = paths.length,
  22143. start = length ? paths[0] : 0,
  22144. value = this.__wrapped__,
  22145. interceptor = function(object) { return baseAt(object, paths); };
  22146. if (length > 1 || this.__actions__.length ||
  22147. !(value instanceof LazyWrapper) || !isIndex(start)) {
  22148. return this.thru(interceptor);
  22149. }
  22150. value = value.slice(start, +start + (length ? 1 : 0));
  22151. value.__actions__.push({
  22152. 'func': thru,
  22153. 'args': [interceptor],
  22154. 'thisArg': undefined
  22155. });
  22156. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  22157. if (length && !array.length) {
  22158. array.push(undefined);
  22159. }
  22160. return array;
  22161. });
  22162. });
  22163. /**
  22164. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  22165. *
  22166. * @name chain
  22167. * @memberOf _
  22168. * @since 0.1.0
  22169. * @category Seq
  22170. * @returns {Object} Returns the new `lodash` wrapper instance.
  22171. * @example
  22172. *
  22173. * var users = [
  22174. * { 'user': 'barney', 'age': 36 },
  22175. * { 'user': 'fred', 'age': 40 }
  22176. * ];
  22177. *
  22178. * // A sequence without explicit chaining.
  22179. * _(users).head();
  22180. * // => { 'user': 'barney', 'age': 36 }
  22181. *
  22182. * // A sequence with explicit chaining.
  22183. * _(users)
  22184. * .chain()
  22185. * .head()
  22186. * .pick('user')
  22187. * .value();
  22188. * // => { 'user': 'barney' }
  22189. */
  22190. function wrapperChain() {
  22191. return chain(this);
  22192. }
  22193. /**
  22194. * Executes the chain sequence and returns the wrapped result.
  22195. *
  22196. * @name commit
  22197. * @memberOf _
  22198. * @since 3.2.0
  22199. * @category Seq
  22200. * @returns {Object} Returns the new `lodash` wrapper instance.
  22201. * @example
  22202. *
  22203. * var array = [1, 2];
  22204. * var wrapped = _(array).push(3);
  22205. *
  22206. * console.log(array);
  22207. * // => [1, 2]
  22208. *
  22209. * wrapped = wrapped.commit();
  22210. * console.log(array);
  22211. * // => [1, 2, 3]
  22212. *
  22213. * wrapped.last();
  22214. * // => 3
  22215. *
  22216. * console.log(array);
  22217. * // => [1, 2, 3]
  22218. */
  22219. function wrapperCommit() {
  22220. return new LodashWrapper(this.value(), this.__chain__);
  22221. }
  22222. /**
  22223. * Gets the next value on a wrapped object following the
  22224. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  22225. *
  22226. * @name next
  22227. * @memberOf _
  22228. * @since 4.0.0
  22229. * @category Seq
  22230. * @returns {Object} Returns the next iterator value.
  22231. * @example
  22232. *
  22233. * var wrapped = _([1, 2]);
  22234. *
  22235. * wrapped.next();
  22236. * // => { 'done': false, 'value': 1 }
  22237. *
  22238. * wrapped.next();
  22239. * // => { 'done': false, 'value': 2 }
  22240. *
  22241. * wrapped.next();
  22242. * // => { 'done': true, 'value': undefined }
  22243. */
  22244. function wrapperNext() {
  22245. if (this.__values__ === undefined) {
  22246. this.__values__ = toArray(this.value());
  22247. }
  22248. var done = this.__index__ >= this.__values__.length,
  22249. value = done ? undefined : this.__values__[this.__index__++];
  22250. return { 'done': done, 'value': value };
  22251. }
  22252. /**
  22253. * Enables the wrapper to be iterable.
  22254. *
  22255. * @name Symbol.iterator
  22256. * @memberOf _
  22257. * @since 4.0.0
  22258. * @category Seq
  22259. * @returns {Object} Returns the wrapper object.
  22260. * @example
  22261. *
  22262. * var wrapped = _([1, 2]);
  22263. *
  22264. * wrapped[Symbol.iterator]() === wrapped;
  22265. * // => true
  22266. *
  22267. * Array.from(wrapped);
  22268. * // => [1, 2]
  22269. */
  22270. function wrapperToIterator() {
  22271. return this;
  22272. }
  22273. /**
  22274. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  22275. *
  22276. * @name plant
  22277. * @memberOf _
  22278. * @since 3.2.0
  22279. * @category Seq
  22280. * @param {*} value The value to plant.
  22281. * @returns {Object} Returns the new `lodash` wrapper instance.
  22282. * @example
  22283. *
  22284. * function square(n) {
  22285. * return n * n;
  22286. * }
  22287. *
  22288. * var wrapped = _([1, 2]).map(square);
  22289. * var other = wrapped.plant([3, 4]);
  22290. *
  22291. * other.value();
  22292. * // => [9, 16]
  22293. *
  22294. * wrapped.value();
  22295. * // => [1, 4]
  22296. */
  22297. function wrapperPlant(value) {
  22298. var result,
  22299. parent = this;
  22300. while (parent instanceof baseLodash) {
  22301. var clone = wrapperClone(parent);
  22302. clone.__index__ = 0;
  22303. clone.__values__ = undefined;
  22304. if (result) {
  22305. previous.__wrapped__ = clone;
  22306. } else {
  22307. result = clone;
  22308. }
  22309. var previous = clone;
  22310. parent = parent.__wrapped__;
  22311. }
  22312. previous.__wrapped__ = value;
  22313. return result;
  22314. }
  22315. /**
  22316. * This method is the wrapper version of `_.reverse`.
  22317. *
  22318. * **Note:** This method mutates the wrapped array.
  22319. *
  22320. * @name reverse
  22321. * @memberOf _
  22322. * @since 0.1.0
  22323. * @category Seq
  22324. * @returns {Object} Returns the new `lodash` wrapper instance.
  22325. * @example
  22326. *
  22327. * var array = [1, 2, 3];
  22328. *
  22329. * _(array).reverse().value()
  22330. * // => [3, 2, 1]
  22331. *
  22332. * console.log(array);
  22333. * // => [3, 2, 1]
  22334. */
  22335. function wrapperReverse() {
  22336. var value = this.__wrapped__;
  22337. if (value instanceof LazyWrapper) {
  22338. var wrapped = value;
  22339. if (this.__actions__.length) {
  22340. wrapped = new LazyWrapper(this);
  22341. }
  22342. wrapped = wrapped.reverse();
  22343. wrapped.__actions__.push({
  22344. 'func': thru,
  22345. 'args': [reverse],
  22346. 'thisArg': undefined
  22347. });
  22348. return new LodashWrapper(wrapped, this.__chain__);
  22349. }
  22350. return this.thru(reverse);
  22351. }
  22352. /**
  22353. * Executes the chain sequence to resolve the unwrapped value.
  22354. *
  22355. * @name value
  22356. * @memberOf _
  22357. * @since 0.1.0
  22358. * @alias toJSON, valueOf
  22359. * @category Seq
  22360. * @returns {*} Returns the resolved unwrapped value.
  22361. * @example
  22362. *
  22363. * _([1, 2, 3]).value();
  22364. * // => [1, 2, 3]
  22365. */
  22366. function wrapperValue() {
  22367. return baseWrapperValue(this.__wrapped__, this.__actions__);
  22368. }
  22369. /*------------------------------------------------------------------------*/
  22370. /**
  22371. * Creates an object composed of keys generated from the results of running
  22372. * each element of `collection` thru `iteratee`. The corresponding value of
  22373. * each key is the number of times the key was returned by `iteratee`. The
  22374. * iteratee is invoked with one argument: (value).
  22375. *
  22376. * @static
  22377. * @memberOf _
  22378. * @since 0.5.0
  22379. * @category Collection
  22380. * @param {Array|Object} collection The collection to iterate over.
  22381. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22382. * @returns {Object} Returns the composed aggregate object.
  22383. * @example
  22384. *
  22385. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  22386. * // => { '4': 1, '6': 2 }
  22387. *
  22388. * // The `_.property` iteratee shorthand.
  22389. * _.countBy(['one', 'two', 'three'], 'length');
  22390. * // => { '3': 2, '5': 1 }
  22391. */
  22392. var countBy = createAggregator(function(result, value, key) {
  22393. if (hasOwnProperty.call(result, key)) {
  22394. ++result[key];
  22395. } else {
  22396. baseAssignValue(result, key, 1);
  22397. }
  22398. });
  22399. /**
  22400. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  22401. * Iteration is stopped once `predicate` returns falsey. The predicate is
  22402. * invoked with three arguments: (value, index|key, collection).
  22403. *
  22404. * **Note:** This method returns `true` for
  22405. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  22406. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  22407. * elements of empty collections.
  22408. *
  22409. * @static
  22410. * @memberOf _
  22411. * @since 0.1.0
  22412. * @category Collection
  22413. * @param {Array|Object} collection The collection to iterate over.
  22414. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22415. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22416. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  22417. * else `false`.
  22418. * @example
  22419. *
  22420. * _.every([true, 1, null, 'yes'], Boolean);
  22421. * // => false
  22422. *
  22423. * var users = [
  22424. * { 'user': 'barney', 'age': 36, 'active': false },
  22425. * { 'user': 'fred', 'age': 40, 'active': false }
  22426. * ];
  22427. *
  22428. * // The `_.matches` iteratee shorthand.
  22429. * _.every(users, { 'user': 'barney', 'active': false });
  22430. * // => false
  22431. *
  22432. * // The `_.matchesProperty` iteratee shorthand.
  22433. * _.every(users, ['active', false]);
  22434. * // => true
  22435. *
  22436. * // The `_.property` iteratee shorthand.
  22437. * _.every(users, 'active');
  22438. * // => false
  22439. */
  22440. function every(collection, predicate, guard) {
  22441. var func = isArray(collection) ? arrayEvery : baseEvery;
  22442. if (guard && isIterateeCall(collection, predicate, guard)) {
  22443. predicate = undefined;
  22444. }
  22445. return func(collection, getIteratee(predicate, 3));
  22446. }
  22447. /**
  22448. * Iterates over elements of `collection`, returning an array of all elements
  22449. * `predicate` returns truthy for. The predicate is invoked with three
  22450. * arguments: (value, index|key, collection).
  22451. *
  22452. * **Note:** Unlike `_.remove`, this method returns a new array.
  22453. *
  22454. * @static
  22455. * @memberOf _
  22456. * @since 0.1.0
  22457. * @category Collection
  22458. * @param {Array|Object} collection The collection to iterate over.
  22459. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22460. * @returns {Array} Returns the new filtered array.
  22461. * @see _.reject
  22462. * @example
  22463. *
  22464. * var users = [
  22465. * { 'user': 'barney', 'age': 36, 'active': true },
  22466. * { 'user': 'fred', 'age': 40, 'active': false }
  22467. * ];
  22468. *
  22469. * _.filter(users, function(o) { return !o.active; });
  22470. * // => objects for ['fred']
  22471. *
  22472. * // The `_.matches` iteratee shorthand.
  22473. * _.filter(users, { 'age': 36, 'active': true });
  22474. * // => objects for ['barney']
  22475. *
  22476. * // The `_.matchesProperty` iteratee shorthand.
  22477. * _.filter(users, ['active', false]);
  22478. * // => objects for ['fred']
  22479. *
  22480. * // The `_.property` iteratee shorthand.
  22481. * _.filter(users, 'active');
  22482. * // => objects for ['barney']
  22483. *
  22484. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  22485. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  22486. * // => objects for ['fred', 'barney']
  22487. */
  22488. function filter(collection, predicate) {
  22489. var func = isArray(collection) ? arrayFilter : baseFilter;
  22490. return func(collection, getIteratee(predicate, 3));
  22491. }
  22492. /**
  22493. * Iterates over elements of `collection`, returning the first element
  22494. * `predicate` returns truthy for. The predicate is invoked with three
  22495. * arguments: (value, index|key, collection).
  22496. *
  22497. * @static
  22498. * @memberOf _
  22499. * @since 0.1.0
  22500. * @category Collection
  22501. * @param {Array|Object} collection The collection to inspect.
  22502. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22503. * @param {number} [fromIndex=0] The index to search from.
  22504. * @returns {*} Returns the matched element, else `undefined`.
  22505. * @example
  22506. *
  22507. * var users = [
  22508. * { 'user': 'barney', 'age': 36, 'active': true },
  22509. * { 'user': 'fred', 'age': 40, 'active': false },
  22510. * { 'user': 'pebbles', 'age': 1, 'active': true }
  22511. * ];
  22512. *
  22513. * _.find(users, function(o) { return o.age < 40; });
  22514. * // => object for 'barney'
  22515. *
  22516. * // The `_.matches` iteratee shorthand.
  22517. * _.find(users, { 'age': 1, 'active': true });
  22518. * // => object for 'pebbles'
  22519. *
  22520. * // The `_.matchesProperty` iteratee shorthand.
  22521. * _.find(users, ['active', false]);
  22522. * // => object for 'fred'
  22523. *
  22524. * // The `_.property` iteratee shorthand.
  22525. * _.find(users, 'active');
  22526. * // => object for 'barney'
  22527. */
  22528. var find = createFind(findIndex);
  22529. /**
  22530. * This method is like `_.find` except that it iterates over elements of
  22531. * `collection` from right to left.
  22532. *
  22533. * @static
  22534. * @memberOf _
  22535. * @since 2.0.0
  22536. * @category Collection
  22537. * @param {Array|Object} collection The collection to inspect.
  22538. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22539. * @param {number} [fromIndex=collection.length-1] The index to search from.
  22540. * @returns {*} Returns the matched element, else `undefined`.
  22541. * @example
  22542. *
  22543. * _.findLast([1, 2, 3, 4], function(n) {
  22544. * return n % 2 == 1;
  22545. * });
  22546. * // => 3
  22547. */
  22548. var findLast = createFind(findLastIndex);
  22549. /**
  22550. * Creates a flattened array of values by running each element in `collection`
  22551. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  22552. * with three arguments: (value, index|key, collection).
  22553. *
  22554. * @static
  22555. * @memberOf _
  22556. * @since 4.0.0
  22557. * @category Collection
  22558. * @param {Array|Object} collection The collection to iterate over.
  22559. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22560. * @returns {Array} Returns the new flattened array.
  22561. * @example
  22562. *
  22563. * function duplicate(n) {
  22564. * return [n, n];
  22565. * }
  22566. *
  22567. * _.flatMap([1, 2], duplicate);
  22568. * // => [1, 1, 2, 2]
  22569. */
  22570. function flatMap(collection, iteratee) {
  22571. return baseFlatten(map(collection, iteratee), 1);
  22572. }
  22573. /**
  22574. * This method is like `_.flatMap` except that it recursively flattens the
  22575. * mapped results.
  22576. *
  22577. * @static
  22578. * @memberOf _
  22579. * @since 4.7.0
  22580. * @category Collection
  22581. * @param {Array|Object} collection The collection to iterate over.
  22582. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22583. * @returns {Array} Returns the new flattened array.
  22584. * @example
  22585. *
  22586. * function duplicate(n) {
  22587. * return [[[n, n]]];
  22588. * }
  22589. *
  22590. * _.flatMapDeep([1, 2], duplicate);
  22591. * // => [1, 1, 2, 2]
  22592. */
  22593. function flatMapDeep(collection, iteratee) {
  22594. return baseFlatten(map(collection, iteratee), INFINITY);
  22595. }
  22596. /**
  22597. * This method is like `_.flatMap` except that it recursively flattens the
  22598. * mapped results up to `depth` times.
  22599. *
  22600. * @static
  22601. * @memberOf _
  22602. * @since 4.7.0
  22603. * @category Collection
  22604. * @param {Array|Object} collection The collection to iterate over.
  22605. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22606. * @param {number} [depth=1] The maximum recursion depth.
  22607. * @returns {Array} Returns the new flattened array.
  22608. * @example
  22609. *
  22610. * function duplicate(n) {
  22611. * return [[[n, n]]];
  22612. * }
  22613. *
  22614. * _.flatMapDepth([1, 2], duplicate, 2);
  22615. * // => [[1, 1], [2, 2]]
  22616. */
  22617. function flatMapDepth(collection, iteratee, depth) {
  22618. depth = depth === undefined ? 1 : toInteger(depth);
  22619. return baseFlatten(map(collection, iteratee), depth);
  22620. }
  22621. /**
  22622. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22623. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22624. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22625. *
  22626. * **Note:** As with other "Collections" methods, objects with a "length"
  22627. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22628. * or `_.forOwn` for object iteration.
  22629. *
  22630. * @static
  22631. * @memberOf _
  22632. * @since 0.1.0
  22633. * @alias each
  22634. * @category Collection
  22635. * @param {Array|Object} collection The collection to iterate over.
  22636. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22637. * @returns {Array|Object} Returns `collection`.
  22638. * @see _.forEachRight
  22639. * @example
  22640. *
  22641. * _.forEach([1, 2], function(value) {
  22642. * console.log(value);
  22643. * });
  22644. * // => Logs `1` then `2`.
  22645. *
  22646. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22647. * console.log(key);
  22648. * });
  22649. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22650. */
  22651. function forEach(collection, iteratee) {
  22652. var func = isArray(collection) ? arrayEach : baseEach;
  22653. return func(collection, getIteratee(iteratee, 3));
  22654. }
  22655. /**
  22656. * This method is like `_.forEach` except that it iterates over elements of
  22657. * `collection` from right to left.
  22658. *
  22659. * @static
  22660. * @memberOf _
  22661. * @since 2.0.0
  22662. * @alias eachRight
  22663. * @category Collection
  22664. * @param {Array|Object} collection The collection to iterate over.
  22665. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22666. * @returns {Array|Object} Returns `collection`.
  22667. * @see _.forEach
  22668. * @example
  22669. *
  22670. * _.forEachRight([1, 2], function(value) {
  22671. * console.log(value);
  22672. * });
  22673. * // => Logs `2` then `1`.
  22674. */
  22675. function forEachRight(collection, iteratee) {
  22676. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22677. return func(collection, getIteratee(iteratee, 3));
  22678. }
  22679. /**
  22680. * Creates an object composed of keys generated from the results of running
  22681. * each element of `collection` thru `iteratee`. The order of grouped values
  22682. * is determined by the order they occur in `collection`. The corresponding
  22683. * value of each key is an array of elements responsible for generating the
  22684. * key. The iteratee is invoked with one argument: (value).
  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 iteratee to transform keys.
  22692. * @returns {Object} Returns the composed aggregate object.
  22693. * @example
  22694. *
  22695. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22696. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22697. *
  22698. * // The `_.property` iteratee shorthand.
  22699. * _.groupBy(['one', 'two', 'three'], 'length');
  22700. * // => { '3': ['one', 'two'], '5': ['three'] }
  22701. */
  22702. var groupBy = createAggregator(function(result, value, key) {
  22703. if (hasOwnProperty.call(result, key)) {
  22704. result[key].push(value);
  22705. } else {
  22706. baseAssignValue(result, key, [value]);
  22707. }
  22708. });
  22709. /**
  22710. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22711. * checked for a substring of `value`, otherwise
  22712. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22713. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22714. * the offset from the end of `collection`.
  22715. *
  22716. * @static
  22717. * @memberOf _
  22718. * @since 0.1.0
  22719. * @category Collection
  22720. * @param {Array|Object|string} collection The collection to inspect.
  22721. * @param {*} value The value to search for.
  22722. * @param {number} [fromIndex=0] The index to search from.
  22723. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22724. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22725. * @example
  22726. *
  22727. * _.includes([1, 2, 3], 1);
  22728. * // => true
  22729. *
  22730. * _.includes([1, 2, 3], 1, 2);
  22731. * // => false
  22732. *
  22733. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22734. * // => true
  22735. *
  22736. * _.includes('abcd', 'bc');
  22737. * // => true
  22738. */
  22739. function includes(collection, value, fromIndex, guard) {
  22740. collection = isArrayLike(collection) ? collection : values(collection);
  22741. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22742. var length = collection.length;
  22743. if (fromIndex < 0) {
  22744. fromIndex = nativeMax(length + fromIndex, 0);
  22745. }
  22746. return isString(collection)
  22747. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22748. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22749. }
  22750. /**
  22751. * Invokes the method at `path` of each element in `collection`, returning
  22752. * an array of the results of each invoked method. Any additional arguments
  22753. * are provided to each invoked method. If `path` is a function, it's invoked
  22754. * for, and `this` bound to, each element in `collection`.
  22755. *
  22756. * @static
  22757. * @memberOf _
  22758. * @since 4.0.0
  22759. * @category Collection
  22760. * @param {Array|Object} collection The collection to iterate over.
  22761. * @param {Array|Function|string} path The path of the method to invoke or
  22762. * the function invoked per iteration.
  22763. * @param {...*} [args] The arguments to invoke each method with.
  22764. * @returns {Array} Returns the array of results.
  22765. * @example
  22766. *
  22767. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22768. * // => [[1, 5, 7], [1, 2, 3]]
  22769. *
  22770. * _.invokeMap([123, 456], String.prototype.split, '');
  22771. * // => [['1', '2', '3'], ['4', '5', '6']]
  22772. */
  22773. var invokeMap = baseRest(function(collection, path, args) {
  22774. var index = -1,
  22775. isFunc = typeof path == 'function',
  22776. result = isArrayLike(collection) ? Array(collection.length) : [];
  22777. baseEach(collection, function(value) {
  22778. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22779. });
  22780. return result;
  22781. });
  22782. /**
  22783. * Creates an object composed of keys generated from the results of running
  22784. * each element of `collection` thru `iteratee`. The corresponding value of
  22785. * each key is the last element responsible for generating the key. The
  22786. * iteratee is invoked with one argument: (value).
  22787. *
  22788. * @static
  22789. * @memberOf _
  22790. * @since 4.0.0
  22791. * @category Collection
  22792. * @param {Array|Object} collection The collection to iterate over.
  22793. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22794. * @returns {Object} Returns the composed aggregate object.
  22795. * @example
  22796. *
  22797. * var array = [
  22798. * { 'dir': 'left', 'code': 97 },
  22799. * { 'dir': 'right', 'code': 100 }
  22800. * ];
  22801. *
  22802. * _.keyBy(array, function(o) {
  22803. * return String.fromCharCode(o.code);
  22804. * });
  22805. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22806. *
  22807. * _.keyBy(array, 'dir');
  22808. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22809. */
  22810. var keyBy = createAggregator(function(result, value, key) {
  22811. baseAssignValue(result, key, value);
  22812. });
  22813. /**
  22814. * Creates an array of values by running each element in `collection` thru
  22815. * `iteratee`. The iteratee is invoked with three arguments:
  22816. * (value, index|key, collection).
  22817. *
  22818. * Many lodash methods are guarded to work as iteratees for methods like
  22819. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22820. *
  22821. * The guarded methods are:
  22822. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22823. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22824. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22825. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22826. *
  22827. * @static
  22828. * @memberOf _
  22829. * @since 0.1.0
  22830. * @category Collection
  22831. * @param {Array|Object} collection The collection to iterate over.
  22832. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22833. * @returns {Array} Returns the new mapped array.
  22834. * @example
  22835. *
  22836. * function square(n) {
  22837. * return n * n;
  22838. * }
  22839. *
  22840. * _.map([4, 8], square);
  22841. * // => [16, 64]
  22842. *
  22843. * _.map({ 'a': 4, 'b': 8 }, square);
  22844. * // => [16, 64] (iteration order is not guaranteed)
  22845. *
  22846. * var users = [
  22847. * { 'user': 'barney' },
  22848. * { 'user': 'fred' }
  22849. * ];
  22850. *
  22851. * // The `_.property` iteratee shorthand.
  22852. * _.map(users, 'user');
  22853. * // => ['barney', 'fred']
  22854. */
  22855. function map(collection, iteratee) {
  22856. var func = isArray(collection) ? arrayMap : baseMap;
  22857. return func(collection, getIteratee(iteratee, 3));
  22858. }
  22859. /**
  22860. * This method is like `_.sortBy` except that it allows specifying the sort
  22861. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22862. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22863. * descending or "asc" for ascending sort order of corresponding values.
  22864. *
  22865. * @static
  22866. * @memberOf _
  22867. * @since 4.0.0
  22868. * @category Collection
  22869. * @param {Array|Object} collection The collection to iterate over.
  22870. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22871. * The iteratees to sort by.
  22872. * @param {string[]} [orders] The sort orders of `iteratees`.
  22873. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22874. * @returns {Array} Returns the new sorted array.
  22875. * @example
  22876. *
  22877. * var users = [
  22878. * { 'user': 'fred', 'age': 48 },
  22879. * { 'user': 'barney', 'age': 34 },
  22880. * { 'user': 'fred', 'age': 40 },
  22881. * { 'user': 'barney', 'age': 36 }
  22882. * ];
  22883. *
  22884. * // Sort by `user` in ascending order and by `age` in descending order.
  22885. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22886. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22887. */
  22888. function orderBy(collection, iteratees, orders, guard) {
  22889. if (collection == null) {
  22890. return [];
  22891. }
  22892. if (!isArray(iteratees)) {
  22893. iteratees = iteratees == null ? [] : [iteratees];
  22894. }
  22895. orders = guard ? undefined : orders;
  22896. if (!isArray(orders)) {
  22897. orders = orders == null ? [] : [orders];
  22898. }
  22899. return baseOrderBy(collection, iteratees, orders);
  22900. }
  22901. /**
  22902. * Creates an array of elements split into two groups, the first of which
  22903. * contains elements `predicate` returns truthy for, the second of which
  22904. * contains elements `predicate` returns falsey for. The predicate is
  22905. * invoked with one argument: (value).
  22906. *
  22907. * @static
  22908. * @memberOf _
  22909. * @since 3.0.0
  22910. * @category Collection
  22911. * @param {Array|Object} collection The collection to iterate over.
  22912. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22913. * @returns {Array} Returns the array of grouped elements.
  22914. * @example
  22915. *
  22916. * var users = [
  22917. * { 'user': 'barney', 'age': 36, 'active': false },
  22918. * { 'user': 'fred', 'age': 40, 'active': true },
  22919. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22920. * ];
  22921. *
  22922. * _.partition(users, function(o) { return o.active; });
  22923. * // => objects for [['fred'], ['barney', 'pebbles']]
  22924. *
  22925. * // The `_.matches` iteratee shorthand.
  22926. * _.partition(users, { 'age': 1, 'active': false });
  22927. * // => objects for [['pebbles'], ['barney', 'fred']]
  22928. *
  22929. * // The `_.matchesProperty` iteratee shorthand.
  22930. * _.partition(users, ['active', false]);
  22931. * // => objects for [['barney', 'pebbles'], ['fred']]
  22932. *
  22933. * // The `_.property` iteratee shorthand.
  22934. * _.partition(users, 'active');
  22935. * // => objects for [['fred'], ['barney', 'pebbles']]
  22936. */
  22937. var partition = createAggregator(function(result, value, key) {
  22938. result[key ? 0 : 1].push(value);
  22939. }, function() { return [[], []]; });
  22940. /**
  22941. * Reduces `collection` to a value which is the accumulated result of running
  22942. * each element in `collection` thru `iteratee`, where each successive
  22943. * invocation is supplied the return value of the previous. If `accumulator`
  22944. * is not given, the first element of `collection` is used as the initial
  22945. * value. The iteratee is invoked with four arguments:
  22946. * (accumulator, value, index|key, collection).
  22947. *
  22948. * Many lodash methods are guarded to work as iteratees for methods like
  22949. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22950. *
  22951. * The guarded methods are:
  22952. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22953. * and `sortBy`
  22954. *
  22955. * @static
  22956. * @memberOf _
  22957. * @since 0.1.0
  22958. * @category Collection
  22959. * @param {Array|Object} collection The collection to iterate over.
  22960. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22961. * @param {*} [accumulator] The initial value.
  22962. * @returns {*} Returns the accumulated value.
  22963. * @see _.reduceRight
  22964. * @example
  22965. *
  22966. * _.reduce([1, 2], function(sum, n) {
  22967. * return sum + n;
  22968. * }, 0);
  22969. * // => 3
  22970. *
  22971. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22972. * (result[value] || (result[value] = [])).push(key);
  22973. * return result;
  22974. * }, {});
  22975. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22976. */
  22977. function reduce(collection, iteratee, accumulator) {
  22978. var func = isArray(collection) ? arrayReduce : baseReduce,
  22979. initAccum = arguments.length < 3;
  22980. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22981. }
  22982. /**
  22983. * This method is like `_.reduce` except that it iterates over elements of
  22984. * `collection` from right to left.
  22985. *
  22986. * @static
  22987. * @memberOf _
  22988. * @since 0.1.0
  22989. * @category Collection
  22990. * @param {Array|Object} collection The collection to iterate over.
  22991. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22992. * @param {*} [accumulator] The initial value.
  22993. * @returns {*} Returns the accumulated value.
  22994. * @see _.reduce
  22995. * @example
  22996. *
  22997. * var array = [[0, 1], [2, 3], [4, 5]];
  22998. *
  22999. * _.reduceRight(array, function(flattened, other) {
  23000. * return flattened.concat(other);
  23001. * }, []);
  23002. * // => [4, 5, 2, 3, 0, 1]
  23003. */
  23004. function reduceRight(collection, iteratee, accumulator) {
  23005. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  23006. initAccum = arguments.length < 3;
  23007. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  23008. }
  23009. /**
  23010. * The opposite of `_.filter`; this method returns the elements of `collection`
  23011. * that `predicate` does **not** return truthy for.
  23012. *
  23013. * @static
  23014. * @memberOf _
  23015. * @since 0.1.0
  23016. * @category Collection
  23017. * @param {Array|Object} collection The collection to iterate over.
  23018. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23019. * @returns {Array} Returns the new filtered array.
  23020. * @see _.filter
  23021. * @example
  23022. *
  23023. * var users = [
  23024. * { 'user': 'barney', 'age': 36, 'active': false },
  23025. * { 'user': 'fred', 'age': 40, 'active': true }
  23026. * ];
  23027. *
  23028. * _.reject(users, function(o) { return !o.active; });
  23029. * // => objects for ['fred']
  23030. *
  23031. * // The `_.matches` iteratee shorthand.
  23032. * _.reject(users, { 'age': 40, 'active': true });
  23033. * // => objects for ['barney']
  23034. *
  23035. * // The `_.matchesProperty` iteratee shorthand.
  23036. * _.reject(users, ['active', false]);
  23037. * // => objects for ['fred']
  23038. *
  23039. * // The `_.property` iteratee shorthand.
  23040. * _.reject(users, 'active');
  23041. * // => objects for ['barney']
  23042. */
  23043. function reject(collection, predicate) {
  23044. var func = isArray(collection) ? arrayFilter : baseFilter;
  23045. return func(collection, negate(getIteratee(predicate, 3)));
  23046. }
  23047. /**
  23048. * Gets a random element from `collection`.
  23049. *
  23050. * @static
  23051. * @memberOf _
  23052. * @since 2.0.0
  23053. * @category Collection
  23054. * @param {Array|Object} collection The collection to sample.
  23055. * @returns {*} Returns the random element.
  23056. * @example
  23057. *
  23058. * _.sample([1, 2, 3, 4]);
  23059. * // => 2
  23060. */
  23061. function sample(collection) {
  23062. var func = isArray(collection) ? arraySample : baseSample;
  23063. return func(collection);
  23064. }
  23065. /**
  23066. * Gets `n` random elements at unique keys from `collection` up to the
  23067. * size of `collection`.
  23068. *
  23069. * @static
  23070. * @memberOf _
  23071. * @since 4.0.0
  23072. * @category Collection
  23073. * @param {Array|Object} collection The collection to sample.
  23074. * @param {number} [n=1] The number of elements to sample.
  23075. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23076. * @returns {Array} Returns the random elements.
  23077. * @example
  23078. *
  23079. * _.sampleSize([1, 2, 3], 2);
  23080. * // => [3, 1]
  23081. *
  23082. * _.sampleSize([1, 2, 3], 4);
  23083. * // => [2, 3, 1]
  23084. */
  23085. function sampleSize(collection, n, guard) {
  23086. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  23087. n = 1;
  23088. } else {
  23089. n = toInteger(n);
  23090. }
  23091. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  23092. return func(collection, n);
  23093. }
  23094. /**
  23095. * Creates an array of shuffled values, using a version of the
  23096. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  23097. *
  23098. * @static
  23099. * @memberOf _
  23100. * @since 0.1.0
  23101. * @category Collection
  23102. * @param {Array|Object} collection The collection to shuffle.
  23103. * @returns {Array} Returns the new shuffled array.
  23104. * @example
  23105. *
  23106. * _.shuffle([1, 2, 3, 4]);
  23107. * // => [4, 1, 3, 2]
  23108. */
  23109. function shuffle(collection) {
  23110. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  23111. return func(collection);
  23112. }
  23113. /**
  23114. * Gets the size of `collection` by returning its length for array-like
  23115. * values or the number of own enumerable string keyed properties for objects.
  23116. *
  23117. * @static
  23118. * @memberOf _
  23119. * @since 0.1.0
  23120. * @category Collection
  23121. * @param {Array|Object|string} collection The collection to inspect.
  23122. * @returns {number} Returns the collection size.
  23123. * @example
  23124. *
  23125. * _.size([1, 2, 3]);
  23126. * // => 3
  23127. *
  23128. * _.size({ 'a': 1, 'b': 2 });
  23129. * // => 2
  23130. *
  23131. * _.size('pebbles');
  23132. * // => 7
  23133. */
  23134. function size(collection) {
  23135. if (collection == null) {
  23136. return 0;
  23137. }
  23138. if (isArrayLike(collection)) {
  23139. return isString(collection) ? stringSize(collection) : collection.length;
  23140. }
  23141. var tag = getTag(collection);
  23142. if (tag == mapTag || tag == setTag) {
  23143. return collection.size;
  23144. }
  23145. return baseKeys(collection).length;
  23146. }
  23147. /**
  23148. * Checks if `predicate` returns truthy for **any** element of `collection`.
  23149. * Iteration is stopped once `predicate` returns truthy. The predicate is
  23150. * invoked with three arguments: (value, index|key, collection).
  23151. *
  23152. * @static
  23153. * @memberOf _
  23154. * @since 0.1.0
  23155. * @category Collection
  23156. * @param {Array|Object} collection The collection to iterate over.
  23157. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23158. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23159. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23160. * else `false`.
  23161. * @example
  23162. *
  23163. * _.some([null, 0, 'yes', false], Boolean);
  23164. * // => true
  23165. *
  23166. * var users = [
  23167. * { 'user': 'barney', 'active': true },
  23168. * { 'user': 'fred', 'active': false }
  23169. * ];
  23170. *
  23171. * // The `_.matches` iteratee shorthand.
  23172. * _.some(users, { 'user': 'barney', 'active': false });
  23173. * // => false
  23174. *
  23175. * // The `_.matchesProperty` iteratee shorthand.
  23176. * _.some(users, ['active', false]);
  23177. * // => true
  23178. *
  23179. * // The `_.property` iteratee shorthand.
  23180. * _.some(users, 'active');
  23181. * // => true
  23182. */
  23183. function some(collection, predicate, guard) {
  23184. var func = isArray(collection) ? arraySome : baseSome;
  23185. if (guard && isIterateeCall(collection, predicate, guard)) {
  23186. predicate = undefined;
  23187. }
  23188. return func(collection, getIteratee(predicate, 3));
  23189. }
  23190. /**
  23191. * Creates an array of elements, sorted in ascending order by the results of
  23192. * running each element in a collection thru each iteratee. This method
  23193. * performs a stable sort, that is, it preserves the original sort order of
  23194. * equal elements. The iteratees are invoked with one argument: (value).
  23195. *
  23196. * @static
  23197. * @memberOf _
  23198. * @since 0.1.0
  23199. * @category Collection
  23200. * @param {Array|Object} collection The collection to iterate over.
  23201. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23202. * The iteratees to sort by.
  23203. * @returns {Array} Returns the new sorted array.
  23204. * @example
  23205. *
  23206. * var users = [
  23207. * { 'user': 'fred', 'age': 48 },
  23208. * { 'user': 'barney', 'age': 36 },
  23209. * { 'user': 'fred', 'age': 30 },
  23210. * { 'user': 'barney', 'age': 34 }
  23211. * ];
  23212. *
  23213. * _.sortBy(users, [function(o) { return o.user; }]);
  23214. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  23215. *
  23216. * _.sortBy(users, ['user', 'age']);
  23217. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  23218. */
  23219. var sortBy = baseRest(function(collection, iteratees) {
  23220. if (collection == null) {
  23221. return [];
  23222. }
  23223. var length = iteratees.length;
  23224. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  23225. iteratees = [];
  23226. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  23227. iteratees = [iteratees[0]];
  23228. }
  23229. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  23230. });
  23231. /*------------------------------------------------------------------------*/
  23232. /**
  23233. * Gets the timestamp of the number of milliseconds that have elapsed since
  23234. * the Unix epoch (1 January 1970 00:00:00 UTC).
  23235. *
  23236. * @static
  23237. * @memberOf _
  23238. * @since 2.4.0
  23239. * @category Date
  23240. * @returns {number} Returns the timestamp.
  23241. * @example
  23242. *
  23243. * _.defer(function(stamp) {
  23244. * console.log(_.now() - stamp);
  23245. * }, _.now());
  23246. * // => Logs the number of milliseconds it took for the deferred invocation.
  23247. */
  23248. var now = ctxNow || function() {
  23249. return root.Date.now();
  23250. };
  23251. /*------------------------------------------------------------------------*/
  23252. /**
  23253. * The opposite of `_.before`; this method creates a function that invokes
  23254. * `func` once it's called `n` or more times.
  23255. *
  23256. * @static
  23257. * @memberOf _
  23258. * @since 0.1.0
  23259. * @category Function
  23260. * @param {number} n The number of calls before `func` is invoked.
  23261. * @param {Function} func The function to restrict.
  23262. * @returns {Function} Returns the new restricted function.
  23263. * @example
  23264. *
  23265. * var saves = ['profile', 'settings'];
  23266. *
  23267. * var done = _.after(saves.length, function() {
  23268. * console.log('done saving!');
  23269. * });
  23270. *
  23271. * _.forEach(saves, function(type) {
  23272. * asyncSave({ 'type': type, 'complete': done });
  23273. * });
  23274. * // => Logs 'done saving!' after the two async saves have completed.
  23275. */
  23276. function after(n, func) {
  23277. if (typeof func != 'function') {
  23278. throw new TypeError(FUNC_ERROR_TEXT);
  23279. }
  23280. n = toInteger(n);
  23281. return function() {
  23282. if (--n < 1) {
  23283. return func.apply(this, arguments);
  23284. }
  23285. };
  23286. }
  23287. /**
  23288. * Creates a function that invokes `func`, with up to `n` arguments,
  23289. * ignoring any additional arguments.
  23290. *
  23291. * @static
  23292. * @memberOf _
  23293. * @since 3.0.0
  23294. * @category Function
  23295. * @param {Function} func The function to cap arguments for.
  23296. * @param {number} [n=func.length] The arity cap.
  23297. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23298. * @returns {Function} Returns the new capped function.
  23299. * @example
  23300. *
  23301. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  23302. * // => [6, 8, 10]
  23303. */
  23304. function ary(func, n, guard) {
  23305. n = guard ? undefined : n;
  23306. n = (func && n == null) ? func.length : n;
  23307. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  23308. }
  23309. /**
  23310. * Creates a function that invokes `func`, with the `this` binding and arguments
  23311. * of the created function, while it's called less than `n` times. Subsequent
  23312. * calls to the created function return the result of the last `func` invocation.
  23313. *
  23314. * @static
  23315. * @memberOf _
  23316. * @since 3.0.0
  23317. * @category Function
  23318. * @param {number} n The number of calls at which `func` is no longer invoked.
  23319. * @param {Function} func The function to restrict.
  23320. * @returns {Function} Returns the new restricted function.
  23321. * @example
  23322. *
  23323. * jQuery(element).on('click', _.before(5, addContactToList));
  23324. * // => Allows adding up to 4 contacts to the list.
  23325. */
  23326. function before(n, func) {
  23327. var result;
  23328. if (typeof func != 'function') {
  23329. throw new TypeError(FUNC_ERROR_TEXT);
  23330. }
  23331. n = toInteger(n);
  23332. return function() {
  23333. if (--n > 0) {
  23334. result = func.apply(this, arguments);
  23335. }
  23336. if (n <= 1) {
  23337. func = undefined;
  23338. }
  23339. return result;
  23340. };
  23341. }
  23342. /**
  23343. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  23344. * and `partials` prepended to the arguments it receives.
  23345. *
  23346. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  23347. * may be used as a placeholder for partially applied arguments.
  23348. *
  23349. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  23350. * property of bound functions.
  23351. *
  23352. * @static
  23353. * @memberOf _
  23354. * @since 0.1.0
  23355. * @category Function
  23356. * @param {Function} func The function to bind.
  23357. * @param {*} thisArg The `this` binding of `func`.
  23358. * @param {...*} [partials] The arguments to be partially applied.
  23359. * @returns {Function} Returns the new bound function.
  23360. * @example
  23361. *
  23362. * function greet(greeting, punctuation) {
  23363. * return greeting + ' ' + this.user + punctuation;
  23364. * }
  23365. *
  23366. * var object = { 'user': 'fred' };
  23367. *
  23368. * var bound = _.bind(greet, object, 'hi');
  23369. * bound('!');
  23370. * // => 'hi fred!'
  23371. *
  23372. * // Bound with placeholders.
  23373. * var bound = _.bind(greet, object, _, '!');
  23374. * bound('hi');
  23375. * // => 'hi fred!'
  23376. */
  23377. var bind = baseRest(function(func, thisArg, partials) {
  23378. var bitmask = WRAP_BIND_FLAG;
  23379. if (partials.length) {
  23380. var holders = replaceHolders(partials, getHolder(bind));
  23381. bitmask |= WRAP_PARTIAL_FLAG;
  23382. }
  23383. return createWrap(func, bitmask, thisArg, partials, holders);
  23384. });
  23385. /**
  23386. * Creates a function that invokes the method at `object[key]` with `partials`
  23387. * prepended to the arguments it receives.
  23388. *
  23389. * This method differs from `_.bind` by allowing bound functions to reference
  23390. * methods that may be redefined or don't yet exist. See
  23391. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  23392. * for more details.
  23393. *
  23394. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  23395. * builds, may be used as a placeholder for partially applied arguments.
  23396. *
  23397. * @static
  23398. * @memberOf _
  23399. * @since 0.10.0
  23400. * @category Function
  23401. * @param {Object} object The object to invoke the method on.
  23402. * @param {string} key The key of the method.
  23403. * @param {...*} [partials] The arguments to be partially applied.
  23404. * @returns {Function} Returns the new bound function.
  23405. * @example
  23406. *
  23407. * var object = {
  23408. * 'user': 'fred',
  23409. * 'greet': function(greeting, punctuation) {
  23410. * return greeting + ' ' + this.user + punctuation;
  23411. * }
  23412. * };
  23413. *
  23414. * var bound = _.bindKey(object, 'greet', 'hi');
  23415. * bound('!');
  23416. * // => 'hi fred!'
  23417. *
  23418. * object.greet = function(greeting, punctuation) {
  23419. * return greeting + 'ya ' + this.user + punctuation;
  23420. * };
  23421. *
  23422. * bound('!');
  23423. * // => 'hiya fred!'
  23424. *
  23425. * // Bound with placeholders.
  23426. * var bound = _.bindKey(object, 'greet', _, '!');
  23427. * bound('hi');
  23428. * // => 'hiya fred!'
  23429. */
  23430. var bindKey = baseRest(function(object, key, partials) {
  23431. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  23432. if (partials.length) {
  23433. var holders = replaceHolders(partials, getHolder(bindKey));
  23434. bitmask |= WRAP_PARTIAL_FLAG;
  23435. }
  23436. return createWrap(key, bitmask, object, partials, holders);
  23437. });
  23438. /**
  23439. * Creates a function that accepts arguments of `func` and either invokes
  23440. * `func` returning its result, if at least `arity` number of arguments have
  23441. * been provided, or returns a function that accepts the remaining `func`
  23442. * arguments, and so on. The arity of `func` may be specified if `func.length`
  23443. * is not sufficient.
  23444. *
  23445. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  23446. * may be used as a placeholder for provided arguments.
  23447. *
  23448. * **Note:** This method doesn't set the "length" property of curried functions.
  23449. *
  23450. * @static
  23451. * @memberOf _
  23452. * @since 2.0.0
  23453. * @category Function
  23454. * @param {Function} func The function to curry.
  23455. * @param {number} [arity=func.length] The arity of `func`.
  23456. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23457. * @returns {Function} Returns the new curried function.
  23458. * @example
  23459. *
  23460. * var abc = function(a, b, c) {
  23461. * return [a, b, c];
  23462. * };
  23463. *
  23464. * var curried = _.curry(abc);
  23465. *
  23466. * curried(1)(2)(3);
  23467. * // => [1, 2, 3]
  23468. *
  23469. * curried(1, 2)(3);
  23470. * // => [1, 2, 3]
  23471. *
  23472. * curried(1, 2, 3);
  23473. * // => [1, 2, 3]
  23474. *
  23475. * // Curried with placeholders.
  23476. * curried(1)(_, 3)(2);
  23477. * // => [1, 2, 3]
  23478. */
  23479. function curry(func, arity, guard) {
  23480. arity = guard ? undefined : arity;
  23481. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23482. result.placeholder = curry.placeholder;
  23483. return result;
  23484. }
  23485. /**
  23486. * This method is like `_.curry` except that arguments are applied to `func`
  23487. * in the manner of `_.partialRight` instead of `_.partial`.
  23488. *
  23489. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  23490. * builds, may be used as a placeholder for provided arguments.
  23491. *
  23492. * **Note:** This method doesn't set the "length" property of curried functions.
  23493. *
  23494. * @static
  23495. * @memberOf _
  23496. * @since 3.0.0
  23497. * @category Function
  23498. * @param {Function} func The function to curry.
  23499. * @param {number} [arity=func.length] The arity of `func`.
  23500. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23501. * @returns {Function} Returns the new curried function.
  23502. * @example
  23503. *
  23504. * var abc = function(a, b, c) {
  23505. * return [a, b, c];
  23506. * };
  23507. *
  23508. * var curried = _.curryRight(abc);
  23509. *
  23510. * curried(3)(2)(1);
  23511. * // => [1, 2, 3]
  23512. *
  23513. * curried(2, 3)(1);
  23514. * // => [1, 2, 3]
  23515. *
  23516. * curried(1, 2, 3);
  23517. * // => [1, 2, 3]
  23518. *
  23519. * // Curried with placeholders.
  23520. * curried(3)(1, _)(2);
  23521. * // => [1, 2, 3]
  23522. */
  23523. function curryRight(func, arity, guard) {
  23524. arity = guard ? undefined : arity;
  23525. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23526. result.placeholder = curryRight.placeholder;
  23527. return result;
  23528. }
  23529. /**
  23530. * Creates a debounced function that delays invoking `func` until after `wait`
  23531. * milliseconds have elapsed since the last time the debounced function was
  23532. * invoked. The debounced function comes with a `cancel` method to cancel
  23533. * delayed `func` invocations and a `flush` method to immediately invoke them.
  23534. * Provide `options` to indicate whether `func` should be invoked on the
  23535. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  23536. * with the last arguments provided to the debounced function. Subsequent
  23537. * calls to the debounced function return the result of the last `func`
  23538. * invocation.
  23539. *
  23540. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23541. * invoked on the trailing edge of the timeout only if the debounced function
  23542. * is invoked more than once during the `wait` timeout.
  23543. *
  23544. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23545. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23546. *
  23547. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23548. * for details over the differences between `_.debounce` and `_.throttle`.
  23549. *
  23550. * @static
  23551. * @memberOf _
  23552. * @since 0.1.0
  23553. * @category Function
  23554. * @param {Function} func The function to debounce.
  23555. * @param {number} [wait=0] The number of milliseconds to delay.
  23556. * @param {Object} [options={}] The options object.
  23557. * @param {boolean} [options.leading=false]
  23558. * Specify invoking on the leading edge of the timeout.
  23559. * @param {number} [options.maxWait]
  23560. * The maximum time `func` is allowed to be delayed before it's invoked.
  23561. * @param {boolean} [options.trailing=true]
  23562. * Specify invoking on the trailing edge of the timeout.
  23563. * @returns {Function} Returns the new debounced function.
  23564. * @example
  23565. *
  23566. * // Avoid costly calculations while the window size is in flux.
  23567. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  23568. *
  23569. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  23570. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  23571. * 'leading': true,
  23572. * 'trailing': false
  23573. * }));
  23574. *
  23575. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  23576. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  23577. * var source = new EventSource('/stream');
  23578. * jQuery(source).on('message', debounced);
  23579. *
  23580. * // Cancel the trailing debounced invocation.
  23581. * jQuery(window).on('popstate', debounced.cancel);
  23582. */
  23583. function debounce(func, wait, options) {
  23584. var lastArgs,
  23585. lastThis,
  23586. maxWait,
  23587. result,
  23588. timerId,
  23589. lastCallTime,
  23590. lastInvokeTime = 0,
  23591. leading = false,
  23592. maxing = false,
  23593. trailing = true;
  23594. if (typeof func != 'function') {
  23595. throw new TypeError(FUNC_ERROR_TEXT);
  23596. }
  23597. wait = toNumber(wait) || 0;
  23598. if (isObject(options)) {
  23599. leading = !!options.leading;
  23600. maxing = 'maxWait' in options;
  23601. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  23602. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23603. }
  23604. function invokeFunc(time) {
  23605. var args = lastArgs,
  23606. thisArg = lastThis;
  23607. lastArgs = lastThis = undefined;
  23608. lastInvokeTime = time;
  23609. result = func.apply(thisArg, args);
  23610. return result;
  23611. }
  23612. function leadingEdge(time) {
  23613. // Reset any `maxWait` timer.
  23614. lastInvokeTime = time;
  23615. // Start the timer for the trailing edge.
  23616. timerId = setTimeout(timerExpired, wait);
  23617. // Invoke the leading edge.
  23618. return leading ? invokeFunc(time) : result;
  23619. }
  23620. function remainingWait(time) {
  23621. var timeSinceLastCall = time - lastCallTime,
  23622. timeSinceLastInvoke = time - lastInvokeTime,
  23623. timeWaiting = wait - timeSinceLastCall;
  23624. return maxing
  23625. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23626. : timeWaiting;
  23627. }
  23628. function shouldInvoke(time) {
  23629. var timeSinceLastCall = time - lastCallTime,
  23630. timeSinceLastInvoke = time - lastInvokeTime;
  23631. // Either this is the first call, activity has stopped and we're at the
  23632. // trailing edge, the system time has gone backwards and we're treating
  23633. // it as the trailing edge, or we've hit the `maxWait` limit.
  23634. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23635. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23636. }
  23637. function timerExpired() {
  23638. var time = now();
  23639. if (shouldInvoke(time)) {
  23640. return trailingEdge(time);
  23641. }
  23642. // Restart the timer.
  23643. timerId = setTimeout(timerExpired, remainingWait(time));
  23644. }
  23645. function trailingEdge(time) {
  23646. timerId = undefined;
  23647. // Only invoke if we have `lastArgs` which means `func` has been
  23648. // debounced at least once.
  23649. if (trailing && lastArgs) {
  23650. return invokeFunc(time);
  23651. }
  23652. lastArgs = lastThis = undefined;
  23653. return result;
  23654. }
  23655. function cancel() {
  23656. if (timerId !== undefined) {
  23657. clearTimeout(timerId);
  23658. }
  23659. lastInvokeTime = 0;
  23660. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23661. }
  23662. function flush() {
  23663. return timerId === undefined ? result : trailingEdge(now());
  23664. }
  23665. function debounced() {
  23666. var time = now(),
  23667. isInvoking = shouldInvoke(time);
  23668. lastArgs = arguments;
  23669. lastThis = this;
  23670. lastCallTime = time;
  23671. if (isInvoking) {
  23672. if (timerId === undefined) {
  23673. return leadingEdge(lastCallTime);
  23674. }
  23675. if (maxing) {
  23676. // Handle invocations in a tight loop.
  23677. clearTimeout(timerId);
  23678. timerId = setTimeout(timerExpired, wait);
  23679. return invokeFunc(lastCallTime);
  23680. }
  23681. }
  23682. if (timerId === undefined) {
  23683. timerId = setTimeout(timerExpired, wait);
  23684. }
  23685. return result;
  23686. }
  23687. debounced.cancel = cancel;
  23688. debounced.flush = flush;
  23689. return debounced;
  23690. }
  23691. /**
  23692. * Defers invoking the `func` until the current call stack has cleared. Any
  23693. * additional arguments are provided to `func` when it's invoked.
  23694. *
  23695. * @static
  23696. * @memberOf _
  23697. * @since 0.1.0
  23698. * @category Function
  23699. * @param {Function} func The function to defer.
  23700. * @param {...*} [args] The arguments to invoke `func` with.
  23701. * @returns {number} Returns the timer id.
  23702. * @example
  23703. *
  23704. * _.defer(function(text) {
  23705. * console.log(text);
  23706. * }, 'deferred');
  23707. * // => Logs 'deferred' after one millisecond.
  23708. */
  23709. var defer = baseRest(function(func, args) {
  23710. return baseDelay(func, 1, args);
  23711. });
  23712. /**
  23713. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23714. * provided to `func` when it's invoked.
  23715. *
  23716. * @static
  23717. * @memberOf _
  23718. * @since 0.1.0
  23719. * @category Function
  23720. * @param {Function} func The function to delay.
  23721. * @param {number} wait The number of milliseconds to delay invocation.
  23722. * @param {...*} [args] The arguments to invoke `func` with.
  23723. * @returns {number} Returns the timer id.
  23724. * @example
  23725. *
  23726. * _.delay(function(text) {
  23727. * console.log(text);
  23728. * }, 1000, 'later');
  23729. * // => Logs 'later' after one second.
  23730. */
  23731. var delay = baseRest(function(func, wait, args) {
  23732. return baseDelay(func, toNumber(wait) || 0, args);
  23733. });
  23734. /**
  23735. * Creates a function that invokes `func` with arguments reversed.
  23736. *
  23737. * @static
  23738. * @memberOf _
  23739. * @since 4.0.0
  23740. * @category Function
  23741. * @param {Function} func The function to flip arguments for.
  23742. * @returns {Function} Returns the new flipped function.
  23743. * @example
  23744. *
  23745. * var flipped = _.flip(function() {
  23746. * return _.toArray(arguments);
  23747. * });
  23748. *
  23749. * flipped('a', 'b', 'c', 'd');
  23750. * // => ['d', 'c', 'b', 'a']
  23751. */
  23752. function flip(func) {
  23753. return createWrap(func, WRAP_FLIP_FLAG);
  23754. }
  23755. /**
  23756. * Creates a function that memoizes the result of `func`. If `resolver` is
  23757. * provided, it determines the cache key for storing the result based on the
  23758. * arguments provided to the memoized function. By default, the first argument
  23759. * provided to the memoized function is used as the map cache key. The `func`
  23760. * is invoked with the `this` binding of the memoized function.
  23761. *
  23762. * **Note:** The cache is exposed as the `cache` property on the memoized
  23763. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23764. * constructor with one whose instances implement the
  23765. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23766. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23767. *
  23768. * @static
  23769. * @memberOf _
  23770. * @since 0.1.0
  23771. * @category Function
  23772. * @param {Function} func The function to have its output memoized.
  23773. * @param {Function} [resolver] The function to resolve the cache key.
  23774. * @returns {Function} Returns the new memoized function.
  23775. * @example
  23776. *
  23777. * var object = { 'a': 1, 'b': 2 };
  23778. * var other = { 'c': 3, 'd': 4 };
  23779. *
  23780. * var values = _.memoize(_.values);
  23781. * values(object);
  23782. * // => [1, 2]
  23783. *
  23784. * values(other);
  23785. * // => [3, 4]
  23786. *
  23787. * object.a = 2;
  23788. * values(object);
  23789. * // => [1, 2]
  23790. *
  23791. * // Modify the result cache.
  23792. * values.cache.set(object, ['a', 'b']);
  23793. * values(object);
  23794. * // => ['a', 'b']
  23795. *
  23796. * // Replace `_.memoize.Cache`.
  23797. * _.memoize.Cache = WeakMap;
  23798. */
  23799. function memoize(func, resolver) {
  23800. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23801. throw new TypeError(FUNC_ERROR_TEXT);
  23802. }
  23803. var memoized = function() {
  23804. var args = arguments,
  23805. key = resolver ? resolver.apply(this, args) : args[0],
  23806. cache = memoized.cache;
  23807. if (cache.has(key)) {
  23808. return cache.get(key);
  23809. }
  23810. var result = func.apply(this, args);
  23811. memoized.cache = cache.set(key, result) || cache;
  23812. return result;
  23813. };
  23814. memoized.cache = new (memoize.Cache || MapCache);
  23815. return memoized;
  23816. }
  23817. // Expose `MapCache`.
  23818. memoize.Cache = MapCache;
  23819. /**
  23820. * Creates a function that negates the result of the predicate `func`. The
  23821. * `func` predicate is invoked with the `this` binding and arguments of the
  23822. * created function.
  23823. *
  23824. * @static
  23825. * @memberOf _
  23826. * @since 3.0.0
  23827. * @category Function
  23828. * @param {Function} predicate The predicate to negate.
  23829. * @returns {Function} Returns the new negated function.
  23830. * @example
  23831. *
  23832. * function isEven(n) {
  23833. * return n % 2 == 0;
  23834. * }
  23835. *
  23836. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23837. * // => [1, 3, 5]
  23838. */
  23839. function negate(predicate) {
  23840. if (typeof predicate != 'function') {
  23841. throw new TypeError(FUNC_ERROR_TEXT);
  23842. }
  23843. return function() {
  23844. var args = arguments;
  23845. switch (args.length) {
  23846. case 0: return !predicate.call(this);
  23847. case 1: return !predicate.call(this, args[0]);
  23848. case 2: return !predicate.call(this, args[0], args[1]);
  23849. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23850. }
  23851. return !predicate.apply(this, args);
  23852. };
  23853. }
  23854. /**
  23855. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23856. * to the function return the value of the first invocation. The `func` is
  23857. * invoked with the `this` binding and arguments of the created function.
  23858. *
  23859. * @static
  23860. * @memberOf _
  23861. * @since 0.1.0
  23862. * @category Function
  23863. * @param {Function} func The function to restrict.
  23864. * @returns {Function} Returns the new restricted function.
  23865. * @example
  23866. *
  23867. * var initialize = _.once(createApplication);
  23868. * initialize();
  23869. * initialize();
  23870. * // => `createApplication` is invoked once
  23871. */
  23872. function once(func) {
  23873. return before(2, func);
  23874. }
  23875. /**
  23876. * Creates a function that invokes `func` with its arguments transformed.
  23877. *
  23878. * @static
  23879. * @since 4.0.0
  23880. * @memberOf _
  23881. * @category Function
  23882. * @param {Function} func The function to wrap.
  23883. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23884. * The argument transforms.
  23885. * @returns {Function} Returns the new function.
  23886. * @example
  23887. *
  23888. * function doubled(n) {
  23889. * return n * 2;
  23890. * }
  23891. *
  23892. * function square(n) {
  23893. * return n * n;
  23894. * }
  23895. *
  23896. * var func = _.overArgs(function(x, y) {
  23897. * return [x, y];
  23898. * }, [square, doubled]);
  23899. *
  23900. * func(9, 3);
  23901. * // => [81, 6]
  23902. *
  23903. * func(10, 5);
  23904. * // => [100, 10]
  23905. */
  23906. var overArgs = castRest(function(func, transforms) {
  23907. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23908. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23909. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23910. var funcsLength = transforms.length;
  23911. return baseRest(function(args) {
  23912. var index = -1,
  23913. length = nativeMin(args.length, funcsLength);
  23914. while (++index < length) {
  23915. args[index] = transforms[index].call(this, args[index]);
  23916. }
  23917. return apply(func, this, args);
  23918. });
  23919. });
  23920. /**
  23921. * Creates a function that invokes `func` with `partials` prepended to the
  23922. * arguments it receives. This method is like `_.bind` except it does **not**
  23923. * alter the `this` binding.
  23924. *
  23925. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23926. * builds, may be used as a placeholder for partially applied arguments.
  23927. *
  23928. * **Note:** This method doesn't set the "length" property of partially
  23929. * applied functions.
  23930. *
  23931. * @static
  23932. * @memberOf _
  23933. * @since 0.2.0
  23934. * @category Function
  23935. * @param {Function} func The function to partially apply arguments to.
  23936. * @param {...*} [partials] The arguments to be partially applied.
  23937. * @returns {Function} Returns the new partially applied function.
  23938. * @example
  23939. *
  23940. * function greet(greeting, name) {
  23941. * return greeting + ' ' + name;
  23942. * }
  23943. *
  23944. * var sayHelloTo = _.partial(greet, 'hello');
  23945. * sayHelloTo('fred');
  23946. * // => 'hello fred'
  23947. *
  23948. * // Partially applied with placeholders.
  23949. * var greetFred = _.partial(greet, _, 'fred');
  23950. * greetFred('hi');
  23951. * // => 'hi fred'
  23952. */
  23953. var partial = baseRest(function(func, partials) {
  23954. var holders = replaceHolders(partials, getHolder(partial));
  23955. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23956. });
  23957. /**
  23958. * This method is like `_.partial` except that partially applied arguments
  23959. * are appended to the arguments it receives.
  23960. *
  23961. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23962. * builds, may be used as a placeholder for partially applied arguments.
  23963. *
  23964. * **Note:** This method doesn't set the "length" property of partially
  23965. * applied functions.
  23966. *
  23967. * @static
  23968. * @memberOf _
  23969. * @since 1.0.0
  23970. * @category Function
  23971. * @param {Function} func The function to partially apply arguments to.
  23972. * @param {...*} [partials] The arguments to be partially applied.
  23973. * @returns {Function} Returns the new partially applied function.
  23974. * @example
  23975. *
  23976. * function greet(greeting, name) {
  23977. * return greeting + ' ' + name;
  23978. * }
  23979. *
  23980. * var greetFred = _.partialRight(greet, 'fred');
  23981. * greetFred('hi');
  23982. * // => 'hi fred'
  23983. *
  23984. * // Partially applied with placeholders.
  23985. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23986. * sayHelloTo('fred');
  23987. * // => 'hello fred'
  23988. */
  23989. var partialRight = baseRest(function(func, partials) {
  23990. var holders = replaceHolders(partials, getHolder(partialRight));
  23991. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  23992. });
  23993. /**
  23994. * Creates a function that invokes `func` with arguments arranged according
  23995. * to the specified `indexes` where the argument value at the first index is
  23996. * provided as the first argument, the argument value at the second index is
  23997. * provided as the second argument, and so on.
  23998. *
  23999. * @static
  24000. * @memberOf _
  24001. * @since 3.0.0
  24002. * @category Function
  24003. * @param {Function} func The function to rearrange arguments for.
  24004. * @param {...(number|number[])} indexes The arranged argument indexes.
  24005. * @returns {Function} Returns the new function.
  24006. * @example
  24007. *
  24008. * var rearged = _.rearg(function(a, b, c) {
  24009. * return [a, b, c];
  24010. * }, [2, 0, 1]);
  24011. *
  24012. * rearged('b', 'c', 'a')
  24013. * // => ['a', 'b', 'c']
  24014. */
  24015. var rearg = flatRest(function(func, indexes) {
  24016. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  24017. });
  24018. /**
  24019. * Creates a function that invokes `func` with the `this` binding of the
  24020. * created function and arguments from `start` and beyond provided as
  24021. * an array.
  24022. *
  24023. * **Note:** This method is based on the
  24024. * [rest parameter](https://mdn.io/rest_parameters).
  24025. *
  24026. * @static
  24027. * @memberOf _
  24028. * @since 4.0.0
  24029. * @category Function
  24030. * @param {Function} func The function to apply a rest parameter to.
  24031. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24032. * @returns {Function} Returns the new function.
  24033. * @example
  24034. *
  24035. * var say = _.rest(function(what, names) {
  24036. * return what + ' ' + _.initial(names).join(', ') +
  24037. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  24038. * });
  24039. *
  24040. * say('hello', 'fred', 'barney', 'pebbles');
  24041. * // => 'hello fred, barney, & pebbles'
  24042. */
  24043. function rest(func, start) {
  24044. if (typeof func != 'function') {
  24045. throw new TypeError(FUNC_ERROR_TEXT);
  24046. }
  24047. start = start === undefined ? start : toInteger(start);
  24048. return baseRest(func, start);
  24049. }
  24050. /**
  24051. * Creates a function that invokes `func` with the `this` binding of the
  24052. * create function and an array of arguments much like
  24053. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  24054. *
  24055. * **Note:** This method is based on the
  24056. * [spread operator](https://mdn.io/spread_operator).
  24057. *
  24058. * @static
  24059. * @memberOf _
  24060. * @since 3.2.0
  24061. * @category Function
  24062. * @param {Function} func The function to spread arguments over.
  24063. * @param {number} [start=0] The start position of the spread.
  24064. * @returns {Function} Returns the new function.
  24065. * @example
  24066. *
  24067. * var say = _.spread(function(who, what) {
  24068. * return who + ' says ' + what;
  24069. * });
  24070. *
  24071. * say(['fred', 'hello']);
  24072. * // => 'fred says hello'
  24073. *
  24074. * var numbers = Promise.all([
  24075. * Promise.resolve(40),
  24076. * Promise.resolve(36)
  24077. * ]);
  24078. *
  24079. * numbers.then(_.spread(function(x, y) {
  24080. * return x + y;
  24081. * }));
  24082. * // => a Promise of 76
  24083. */
  24084. function spread(func, start) {
  24085. if (typeof func != 'function') {
  24086. throw new TypeError(FUNC_ERROR_TEXT);
  24087. }
  24088. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  24089. return baseRest(function(args) {
  24090. var array = args[start],
  24091. otherArgs = castSlice(args, 0, start);
  24092. if (array) {
  24093. arrayPush(otherArgs, array);
  24094. }
  24095. return apply(func, this, otherArgs);
  24096. });
  24097. }
  24098. /**
  24099. * Creates a throttled function that only invokes `func` at most once per
  24100. * every `wait` milliseconds. The throttled function comes with a `cancel`
  24101. * method to cancel delayed `func` invocations and a `flush` method to
  24102. * immediately invoke them. Provide `options` to indicate whether `func`
  24103. * should be invoked on the leading and/or trailing edge of the `wait`
  24104. * timeout. The `func` is invoked with the last arguments provided to the
  24105. * throttled function. Subsequent calls to the throttled function return the
  24106. * result of the last `func` invocation.
  24107. *
  24108. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  24109. * invoked on the trailing edge of the timeout only if the throttled function
  24110. * is invoked more than once during the `wait` timeout.
  24111. *
  24112. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  24113. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  24114. *
  24115. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  24116. * for details over the differences between `_.throttle` and `_.debounce`.
  24117. *
  24118. * @static
  24119. * @memberOf _
  24120. * @since 0.1.0
  24121. * @category Function
  24122. * @param {Function} func The function to throttle.
  24123. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  24124. * @param {Object} [options={}] The options object.
  24125. * @param {boolean} [options.leading=true]
  24126. * Specify invoking on the leading edge of the timeout.
  24127. * @param {boolean} [options.trailing=true]
  24128. * Specify invoking on the trailing edge of the timeout.
  24129. * @returns {Function} Returns the new throttled function.
  24130. * @example
  24131. *
  24132. * // Avoid excessively updating the position while scrolling.
  24133. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  24134. *
  24135. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  24136. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  24137. * jQuery(element).on('click', throttled);
  24138. *
  24139. * // Cancel the trailing throttled invocation.
  24140. * jQuery(window).on('popstate', throttled.cancel);
  24141. */
  24142. function throttle(func, wait, options) {
  24143. var leading = true,
  24144. trailing = true;
  24145. if (typeof func != 'function') {
  24146. throw new TypeError(FUNC_ERROR_TEXT);
  24147. }
  24148. if (isObject(options)) {
  24149. leading = 'leading' in options ? !!options.leading : leading;
  24150. trailing = 'trailing' in options ? !!options.trailing : trailing;
  24151. }
  24152. return debounce(func, wait, {
  24153. 'leading': leading,
  24154. 'maxWait': wait,
  24155. 'trailing': trailing
  24156. });
  24157. }
  24158. /**
  24159. * Creates a function that accepts up to one argument, ignoring any
  24160. * additional arguments.
  24161. *
  24162. * @static
  24163. * @memberOf _
  24164. * @since 4.0.0
  24165. * @category Function
  24166. * @param {Function} func The function to cap arguments for.
  24167. * @returns {Function} Returns the new capped function.
  24168. * @example
  24169. *
  24170. * _.map(['6', '8', '10'], _.unary(parseInt));
  24171. * // => [6, 8, 10]
  24172. */
  24173. function unary(func) {
  24174. return ary(func, 1);
  24175. }
  24176. /**
  24177. * Creates a function that provides `value` to `wrapper` as its first
  24178. * argument. Any additional arguments provided to the function are appended
  24179. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  24180. * binding of the created function.
  24181. *
  24182. * @static
  24183. * @memberOf _
  24184. * @since 0.1.0
  24185. * @category Function
  24186. * @param {*} value The value to wrap.
  24187. * @param {Function} [wrapper=identity] The wrapper function.
  24188. * @returns {Function} Returns the new function.
  24189. * @example
  24190. *
  24191. * var p = _.wrap(_.escape, function(func, text) {
  24192. * return '<p>' + func(text) + '</p>';
  24193. * });
  24194. *
  24195. * p('fred, barney, & pebbles');
  24196. * // => '<p>fred, barney, &amp; pebbles</p>'
  24197. */
  24198. function wrap(value, wrapper) {
  24199. return partial(castFunction(wrapper), value);
  24200. }
  24201. /*------------------------------------------------------------------------*/
  24202. /**
  24203. * Casts `value` as an array if it's not one.
  24204. *
  24205. * @static
  24206. * @memberOf _
  24207. * @since 4.4.0
  24208. * @category Lang
  24209. * @param {*} value The value to inspect.
  24210. * @returns {Array} Returns the cast array.
  24211. * @example
  24212. *
  24213. * _.castArray(1);
  24214. * // => [1]
  24215. *
  24216. * _.castArray({ 'a': 1 });
  24217. * // => [{ 'a': 1 }]
  24218. *
  24219. * _.castArray('abc');
  24220. * // => ['abc']
  24221. *
  24222. * _.castArray(null);
  24223. * // => [null]
  24224. *
  24225. * _.castArray(undefined);
  24226. * // => [undefined]
  24227. *
  24228. * _.castArray();
  24229. * // => []
  24230. *
  24231. * var array = [1, 2, 3];
  24232. * console.log(_.castArray(array) === array);
  24233. * // => true
  24234. */
  24235. function castArray() {
  24236. if (!arguments.length) {
  24237. return [];
  24238. }
  24239. var value = arguments[0];
  24240. return isArray(value) ? value : [value];
  24241. }
  24242. /**
  24243. * Creates a shallow clone of `value`.
  24244. *
  24245. * **Note:** This method is loosely based on the
  24246. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  24247. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  24248. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  24249. * arrays. The own enumerable properties of `arguments` objects are cloned
  24250. * as plain objects. An empty object is returned for uncloneable values such
  24251. * as error objects, functions, DOM nodes, and WeakMaps.
  24252. *
  24253. * @static
  24254. * @memberOf _
  24255. * @since 0.1.0
  24256. * @category Lang
  24257. * @param {*} value The value to clone.
  24258. * @returns {*} Returns the cloned value.
  24259. * @see _.cloneDeep
  24260. * @example
  24261. *
  24262. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24263. *
  24264. * var shallow = _.clone(objects);
  24265. * console.log(shallow[0] === objects[0]);
  24266. * // => true
  24267. */
  24268. function clone(value) {
  24269. return baseClone(value, CLONE_SYMBOLS_FLAG);
  24270. }
  24271. /**
  24272. * This method is like `_.clone` except that it accepts `customizer` which
  24273. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  24274. * cloning is handled by the method instead. The `customizer` is invoked with
  24275. * up to four arguments; (value [, index|key, object, stack]).
  24276. *
  24277. * @static
  24278. * @memberOf _
  24279. * @since 4.0.0
  24280. * @category Lang
  24281. * @param {*} value The value to clone.
  24282. * @param {Function} [customizer] The function to customize cloning.
  24283. * @returns {*} Returns the cloned value.
  24284. * @see _.cloneDeepWith
  24285. * @example
  24286. *
  24287. * function customizer(value) {
  24288. * if (_.isElement(value)) {
  24289. * return value.cloneNode(false);
  24290. * }
  24291. * }
  24292. *
  24293. * var el = _.cloneWith(document.body, customizer);
  24294. *
  24295. * console.log(el === document.body);
  24296. * // => false
  24297. * console.log(el.nodeName);
  24298. * // => 'BODY'
  24299. * console.log(el.childNodes.length);
  24300. * // => 0
  24301. */
  24302. function cloneWith(value, customizer) {
  24303. customizer = typeof customizer == 'function' ? customizer : undefined;
  24304. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  24305. }
  24306. /**
  24307. * This method is like `_.clone` except that it recursively clones `value`.
  24308. *
  24309. * @static
  24310. * @memberOf _
  24311. * @since 1.0.0
  24312. * @category Lang
  24313. * @param {*} value The value to recursively clone.
  24314. * @returns {*} Returns the deep cloned value.
  24315. * @see _.clone
  24316. * @example
  24317. *
  24318. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24319. *
  24320. * var deep = _.cloneDeep(objects);
  24321. * console.log(deep[0] === objects[0]);
  24322. * // => false
  24323. */
  24324. function cloneDeep(value) {
  24325. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  24326. }
  24327. /**
  24328. * This method is like `_.cloneWith` except that it recursively clones `value`.
  24329. *
  24330. * @static
  24331. * @memberOf _
  24332. * @since 4.0.0
  24333. * @category Lang
  24334. * @param {*} value The value to recursively clone.
  24335. * @param {Function} [customizer] The function to customize cloning.
  24336. * @returns {*} Returns the deep cloned value.
  24337. * @see _.cloneWith
  24338. * @example
  24339. *
  24340. * function customizer(value) {
  24341. * if (_.isElement(value)) {
  24342. * return value.cloneNode(true);
  24343. * }
  24344. * }
  24345. *
  24346. * var el = _.cloneDeepWith(document.body, customizer);
  24347. *
  24348. * console.log(el === document.body);
  24349. * // => false
  24350. * console.log(el.nodeName);
  24351. * // => 'BODY'
  24352. * console.log(el.childNodes.length);
  24353. * // => 20
  24354. */
  24355. function cloneDeepWith(value, customizer) {
  24356. customizer = typeof customizer == 'function' ? customizer : undefined;
  24357. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  24358. }
  24359. /**
  24360. * Checks if `object` conforms to `source` by invoking the predicate
  24361. * properties of `source` with the corresponding property values of `object`.
  24362. *
  24363. * **Note:** This method is equivalent to `_.conforms` when `source` is
  24364. * partially applied.
  24365. *
  24366. * @static
  24367. * @memberOf _
  24368. * @since 4.14.0
  24369. * @category Lang
  24370. * @param {Object} object The object to inspect.
  24371. * @param {Object} source The object of property predicates to conform to.
  24372. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  24373. * @example
  24374. *
  24375. * var object = { 'a': 1, 'b': 2 };
  24376. *
  24377. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  24378. * // => true
  24379. *
  24380. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  24381. * // => false
  24382. */
  24383. function conformsTo(object, source) {
  24384. return source == null || baseConformsTo(object, source, keys(source));
  24385. }
  24386. /**
  24387. * Performs a
  24388. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24389. * comparison between two values to determine if they are equivalent.
  24390. *
  24391. * @static
  24392. * @memberOf _
  24393. * @since 4.0.0
  24394. * @category Lang
  24395. * @param {*} value The value to compare.
  24396. * @param {*} other The other value to compare.
  24397. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24398. * @example
  24399. *
  24400. * var object = { 'a': 1 };
  24401. * var other = { 'a': 1 };
  24402. *
  24403. * _.eq(object, object);
  24404. * // => true
  24405. *
  24406. * _.eq(object, other);
  24407. * // => false
  24408. *
  24409. * _.eq('a', 'a');
  24410. * // => true
  24411. *
  24412. * _.eq('a', Object('a'));
  24413. * // => false
  24414. *
  24415. * _.eq(NaN, NaN);
  24416. * // => true
  24417. */
  24418. function eq(value, other) {
  24419. return value === other || (value !== value && other !== other);
  24420. }
  24421. /**
  24422. * Checks if `value` is greater than `other`.
  24423. *
  24424. * @static
  24425. * @memberOf _
  24426. * @since 3.9.0
  24427. * @category Lang
  24428. * @param {*} value The value to compare.
  24429. * @param {*} other The other value to compare.
  24430. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  24431. * else `false`.
  24432. * @see _.lt
  24433. * @example
  24434. *
  24435. * _.gt(3, 1);
  24436. * // => true
  24437. *
  24438. * _.gt(3, 3);
  24439. * // => false
  24440. *
  24441. * _.gt(1, 3);
  24442. * // => false
  24443. */
  24444. var gt = createRelationalOperation(baseGt);
  24445. /**
  24446. * Checks if `value` is greater than or equal to `other`.
  24447. *
  24448. * @static
  24449. * @memberOf _
  24450. * @since 3.9.0
  24451. * @category Lang
  24452. * @param {*} value The value to compare.
  24453. * @param {*} other The other value to compare.
  24454. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  24455. * `other`, else `false`.
  24456. * @see _.lte
  24457. * @example
  24458. *
  24459. * _.gte(3, 1);
  24460. * // => true
  24461. *
  24462. * _.gte(3, 3);
  24463. * // => true
  24464. *
  24465. * _.gte(1, 3);
  24466. * // => false
  24467. */
  24468. var gte = createRelationalOperation(function(value, other) {
  24469. return value >= other;
  24470. });
  24471. /**
  24472. * Checks if `value` is likely an `arguments` object.
  24473. *
  24474. * @static
  24475. * @memberOf _
  24476. * @since 0.1.0
  24477. * @category Lang
  24478. * @param {*} value The value to check.
  24479. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  24480. * else `false`.
  24481. * @example
  24482. *
  24483. * _.isArguments(function() { return arguments; }());
  24484. * // => true
  24485. *
  24486. * _.isArguments([1, 2, 3]);
  24487. * // => false
  24488. */
  24489. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  24490. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  24491. !propertyIsEnumerable.call(value, 'callee');
  24492. };
  24493. /**
  24494. * Checks if `value` is classified as an `Array` object.
  24495. *
  24496. * @static
  24497. * @memberOf _
  24498. * @since 0.1.0
  24499. * @category Lang
  24500. * @param {*} value The value to check.
  24501. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  24502. * @example
  24503. *
  24504. * _.isArray([1, 2, 3]);
  24505. * // => true
  24506. *
  24507. * _.isArray(document.body.children);
  24508. * // => false
  24509. *
  24510. * _.isArray('abc');
  24511. * // => false
  24512. *
  24513. * _.isArray(_.noop);
  24514. * // => false
  24515. */
  24516. var isArray = Array.isArray;
  24517. /**
  24518. * Checks if `value` is classified as an `ArrayBuffer` object.
  24519. *
  24520. * @static
  24521. * @memberOf _
  24522. * @since 4.3.0
  24523. * @category Lang
  24524. * @param {*} value The value to check.
  24525. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24526. * @example
  24527. *
  24528. * _.isArrayBuffer(new ArrayBuffer(2));
  24529. * // => true
  24530. *
  24531. * _.isArrayBuffer(new Array(2));
  24532. * // => false
  24533. */
  24534. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  24535. /**
  24536. * Checks if `value` is array-like. A value is considered array-like if it's
  24537. * not a function and has a `value.length` that's an integer greater than or
  24538. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  24539. *
  24540. * @static
  24541. * @memberOf _
  24542. * @since 4.0.0
  24543. * @category Lang
  24544. * @param {*} value The value to check.
  24545. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  24546. * @example
  24547. *
  24548. * _.isArrayLike([1, 2, 3]);
  24549. * // => true
  24550. *
  24551. * _.isArrayLike(document.body.children);
  24552. * // => true
  24553. *
  24554. * _.isArrayLike('abc');
  24555. * // => true
  24556. *
  24557. * _.isArrayLike(_.noop);
  24558. * // => false
  24559. */
  24560. function isArrayLike(value) {
  24561. return value != null && isLength(value.length) && !isFunction(value);
  24562. }
  24563. /**
  24564. * This method is like `_.isArrayLike` except that it also checks if `value`
  24565. * is an object.
  24566. *
  24567. * @static
  24568. * @memberOf _
  24569. * @since 4.0.0
  24570. * @category Lang
  24571. * @param {*} value The value to check.
  24572. * @returns {boolean} Returns `true` if `value` is an array-like object,
  24573. * else `false`.
  24574. * @example
  24575. *
  24576. * _.isArrayLikeObject([1, 2, 3]);
  24577. * // => true
  24578. *
  24579. * _.isArrayLikeObject(document.body.children);
  24580. * // => true
  24581. *
  24582. * _.isArrayLikeObject('abc');
  24583. * // => false
  24584. *
  24585. * _.isArrayLikeObject(_.noop);
  24586. * // => false
  24587. */
  24588. function isArrayLikeObject(value) {
  24589. return isObjectLike(value) && isArrayLike(value);
  24590. }
  24591. /**
  24592. * Checks if `value` is classified as a boolean primitive or object.
  24593. *
  24594. * @static
  24595. * @memberOf _
  24596. * @since 0.1.0
  24597. * @category Lang
  24598. * @param {*} value The value to check.
  24599. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  24600. * @example
  24601. *
  24602. * _.isBoolean(false);
  24603. * // => true
  24604. *
  24605. * _.isBoolean(null);
  24606. * // => false
  24607. */
  24608. function isBoolean(value) {
  24609. return value === true || value === false ||
  24610. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24611. }
  24612. /**
  24613. * Checks if `value` is a buffer.
  24614. *
  24615. * @static
  24616. * @memberOf _
  24617. * @since 4.3.0
  24618. * @category Lang
  24619. * @param {*} value The value to check.
  24620. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24621. * @example
  24622. *
  24623. * _.isBuffer(new Buffer(2));
  24624. * // => true
  24625. *
  24626. * _.isBuffer(new Uint8Array(2));
  24627. * // => false
  24628. */
  24629. var isBuffer = nativeIsBuffer || stubFalse;
  24630. /**
  24631. * Checks if `value` is classified as a `Date` object.
  24632. *
  24633. * @static
  24634. * @memberOf _
  24635. * @since 0.1.0
  24636. * @category Lang
  24637. * @param {*} value The value to check.
  24638. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24639. * @example
  24640. *
  24641. * _.isDate(new Date);
  24642. * // => true
  24643. *
  24644. * _.isDate('Mon April 23 2012');
  24645. * // => false
  24646. */
  24647. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24648. /**
  24649. * Checks if `value` is likely a DOM element.
  24650. *
  24651. * @static
  24652. * @memberOf _
  24653. * @since 0.1.0
  24654. * @category Lang
  24655. * @param {*} value The value to check.
  24656. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  24657. * @example
  24658. *
  24659. * _.isElement(document.body);
  24660. * // => true
  24661. *
  24662. * _.isElement('<body>');
  24663. * // => false
  24664. */
  24665. function isElement(value) {
  24666. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24667. }
  24668. /**
  24669. * Checks if `value` is an empty object, collection, map, or set.
  24670. *
  24671. * Objects are considered empty if they have no own enumerable string keyed
  24672. * properties.
  24673. *
  24674. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24675. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24676. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24677. *
  24678. * @static
  24679. * @memberOf _
  24680. * @since 0.1.0
  24681. * @category Lang
  24682. * @param {*} value The value to check.
  24683. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24684. * @example
  24685. *
  24686. * _.isEmpty(null);
  24687. * // => true
  24688. *
  24689. * _.isEmpty(true);
  24690. * // => true
  24691. *
  24692. * _.isEmpty(1);
  24693. * // => true
  24694. *
  24695. * _.isEmpty([1, 2, 3]);
  24696. * // => false
  24697. *
  24698. * _.isEmpty({ 'a': 1 });
  24699. * // => false
  24700. */
  24701. function isEmpty(value) {
  24702. if (value == null) {
  24703. return true;
  24704. }
  24705. if (isArrayLike(value) &&
  24706. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24707. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24708. return !value.length;
  24709. }
  24710. var tag = getTag(value);
  24711. if (tag == mapTag || tag == setTag) {
  24712. return !value.size;
  24713. }
  24714. if (isPrototype(value)) {
  24715. return !baseKeys(value).length;
  24716. }
  24717. for (var key in value) {
  24718. if (hasOwnProperty.call(value, key)) {
  24719. return false;
  24720. }
  24721. }
  24722. return true;
  24723. }
  24724. /**
  24725. * Performs a deep comparison between two values to determine if they are
  24726. * equivalent.
  24727. *
  24728. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24729. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24730. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24731. * by their own, not inherited, enumerable properties. Functions and DOM
  24732. * nodes are compared by strict equality, i.e. `===`.
  24733. *
  24734. * @static
  24735. * @memberOf _
  24736. * @since 0.1.0
  24737. * @category Lang
  24738. * @param {*} value The value to compare.
  24739. * @param {*} other The other value to compare.
  24740. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24741. * @example
  24742. *
  24743. * var object = { 'a': 1 };
  24744. * var other = { 'a': 1 };
  24745. *
  24746. * _.isEqual(object, other);
  24747. * // => true
  24748. *
  24749. * object === other;
  24750. * // => false
  24751. */
  24752. function isEqual(value, other) {
  24753. return baseIsEqual(value, other);
  24754. }
  24755. /**
  24756. * This method is like `_.isEqual` except that it accepts `customizer` which
  24757. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24758. * are handled by the method instead. The `customizer` is invoked with up to
  24759. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24760. *
  24761. * @static
  24762. * @memberOf _
  24763. * @since 4.0.0
  24764. * @category Lang
  24765. * @param {*} value The value to compare.
  24766. * @param {*} other The other value to compare.
  24767. * @param {Function} [customizer] The function to customize comparisons.
  24768. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24769. * @example
  24770. *
  24771. * function isGreeting(value) {
  24772. * return /^h(?:i|ello)$/.test(value);
  24773. * }
  24774. *
  24775. * function customizer(objValue, othValue) {
  24776. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24777. * return true;
  24778. * }
  24779. * }
  24780. *
  24781. * var array = ['hello', 'goodbye'];
  24782. * var other = ['hi', 'goodbye'];
  24783. *
  24784. * _.isEqualWith(array, other, customizer);
  24785. * // => true
  24786. */
  24787. function isEqualWith(value, other, customizer) {
  24788. customizer = typeof customizer == 'function' ? customizer : undefined;
  24789. var result = customizer ? customizer(value, other) : undefined;
  24790. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24791. }
  24792. /**
  24793. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24794. * `SyntaxError`, `TypeError`, or `URIError` object.
  24795. *
  24796. * @static
  24797. * @memberOf _
  24798. * @since 3.0.0
  24799. * @category Lang
  24800. * @param {*} value The value to check.
  24801. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24802. * @example
  24803. *
  24804. * _.isError(new Error);
  24805. * // => true
  24806. *
  24807. * _.isError(Error);
  24808. * // => false
  24809. */
  24810. function isError(value) {
  24811. if (!isObjectLike(value)) {
  24812. return false;
  24813. }
  24814. var tag = baseGetTag(value);
  24815. return tag == errorTag || tag == domExcTag ||
  24816. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24817. }
  24818. /**
  24819. * Checks if `value` is a finite primitive number.
  24820. *
  24821. * **Note:** This method is based on
  24822. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24823. *
  24824. * @static
  24825. * @memberOf _
  24826. * @since 0.1.0
  24827. * @category Lang
  24828. * @param {*} value The value to check.
  24829. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24830. * @example
  24831. *
  24832. * _.isFinite(3);
  24833. * // => true
  24834. *
  24835. * _.isFinite(Number.MIN_VALUE);
  24836. * // => true
  24837. *
  24838. * _.isFinite(Infinity);
  24839. * // => false
  24840. *
  24841. * _.isFinite('3');
  24842. * // => false
  24843. */
  24844. function isFinite(value) {
  24845. return typeof value == 'number' && nativeIsFinite(value);
  24846. }
  24847. /**
  24848. * Checks if `value` is classified as a `Function` object.
  24849. *
  24850. * @static
  24851. * @memberOf _
  24852. * @since 0.1.0
  24853. * @category Lang
  24854. * @param {*} value The value to check.
  24855. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24856. * @example
  24857. *
  24858. * _.isFunction(_);
  24859. * // => true
  24860. *
  24861. * _.isFunction(/abc/);
  24862. * // => false
  24863. */
  24864. function isFunction(value) {
  24865. if (!isObject(value)) {
  24866. return false;
  24867. }
  24868. // The use of `Object#toString` avoids issues with the `typeof` operator
  24869. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24870. var tag = baseGetTag(value);
  24871. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24872. }
  24873. /**
  24874. * Checks if `value` is an integer.
  24875. *
  24876. * **Note:** This method is based on
  24877. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24878. *
  24879. * @static
  24880. * @memberOf _
  24881. * @since 4.0.0
  24882. * @category Lang
  24883. * @param {*} value The value to check.
  24884. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24885. * @example
  24886. *
  24887. * _.isInteger(3);
  24888. * // => true
  24889. *
  24890. * _.isInteger(Number.MIN_VALUE);
  24891. * // => false
  24892. *
  24893. * _.isInteger(Infinity);
  24894. * // => false
  24895. *
  24896. * _.isInteger('3');
  24897. * // => false
  24898. */
  24899. function isInteger(value) {
  24900. return typeof value == 'number' && value == toInteger(value);
  24901. }
  24902. /**
  24903. * Checks if `value` is a valid array-like length.
  24904. *
  24905. * **Note:** This method is loosely based on
  24906. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24907. *
  24908. * @static
  24909. * @memberOf _
  24910. * @since 4.0.0
  24911. * @category Lang
  24912. * @param {*} value The value to check.
  24913. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24914. * @example
  24915. *
  24916. * _.isLength(3);
  24917. * // => true
  24918. *
  24919. * _.isLength(Number.MIN_VALUE);
  24920. * // => false
  24921. *
  24922. * _.isLength(Infinity);
  24923. * // => false
  24924. *
  24925. * _.isLength('3');
  24926. * // => false
  24927. */
  24928. function isLength(value) {
  24929. return typeof value == 'number' &&
  24930. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24931. }
  24932. /**
  24933. * Checks if `value` is the
  24934. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24935. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24936. *
  24937. * @static
  24938. * @memberOf _
  24939. * @since 0.1.0
  24940. * @category Lang
  24941. * @param {*} value The value to check.
  24942. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24943. * @example
  24944. *
  24945. * _.isObject({});
  24946. * // => true
  24947. *
  24948. * _.isObject([1, 2, 3]);
  24949. * // => true
  24950. *
  24951. * _.isObject(_.noop);
  24952. * // => true
  24953. *
  24954. * _.isObject(null);
  24955. * // => false
  24956. */
  24957. function isObject(value) {
  24958. var type = typeof value;
  24959. return value != null && (type == 'object' || type == 'function');
  24960. }
  24961. /**
  24962. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24963. * and has a `typeof` result of "object".
  24964. *
  24965. * @static
  24966. * @memberOf _
  24967. * @since 4.0.0
  24968. * @category Lang
  24969. * @param {*} value The value to check.
  24970. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24971. * @example
  24972. *
  24973. * _.isObjectLike({});
  24974. * // => true
  24975. *
  24976. * _.isObjectLike([1, 2, 3]);
  24977. * // => true
  24978. *
  24979. * _.isObjectLike(_.noop);
  24980. * // => false
  24981. *
  24982. * _.isObjectLike(null);
  24983. * // => false
  24984. */
  24985. function isObjectLike(value) {
  24986. return value != null && typeof value == 'object';
  24987. }
  24988. /**
  24989. * Checks if `value` is classified as a `Map` object.
  24990. *
  24991. * @static
  24992. * @memberOf _
  24993. * @since 4.3.0
  24994. * @category Lang
  24995. * @param {*} value The value to check.
  24996. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24997. * @example
  24998. *
  24999. * _.isMap(new Map);
  25000. * // => true
  25001. *
  25002. * _.isMap(new WeakMap);
  25003. * // => false
  25004. */
  25005. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  25006. /**
  25007. * Performs a partial deep comparison between `object` and `source` to
  25008. * determine if `object` contains equivalent property values.
  25009. *
  25010. * **Note:** This method is equivalent to `_.matches` when `source` is
  25011. * partially applied.
  25012. *
  25013. * Partial comparisons will match empty array and empty object `source`
  25014. * values against any array or object value, respectively. See `_.isEqual`
  25015. * for a list of supported value comparisons.
  25016. *
  25017. * @static
  25018. * @memberOf _
  25019. * @since 3.0.0
  25020. * @category Lang
  25021. * @param {Object} object The object to inspect.
  25022. * @param {Object} source The object of property values to match.
  25023. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25024. * @example
  25025. *
  25026. * var object = { 'a': 1, 'b': 2 };
  25027. *
  25028. * _.isMatch(object, { 'b': 2 });
  25029. * // => true
  25030. *
  25031. * _.isMatch(object, { 'b': 1 });
  25032. * // => false
  25033. */
  25034. function isMatch(object, source) {
  25035. return object === source || baseIsMatch(object, source, getMatchData(source));
  25036. }
  25037. /**
  25038. * This method is like `_.isMatch` except that it accepts `customizer` which
  25039. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  25040. * are handled by the method instead. The `customizer` is invoked with five
  25041. * arguments: (objValue, srcValue, index|key, object, source).
  25042. *
  25043. * @static
  25044. * @memberOf _
  25045. * @since 4.0.0
  25046. * @category Lang
  25047. * @param {Object} object The object to inspect.
  25048. * @param {Object} source The object of property values to match.
  25049. * @param {Function} [customizer] The function to customize comparisons.
  25050. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  25051. * @example
  25052. *
  25053. * function isGreeting(value) {
  25054. * return /^h(?:i|ello)$/.test(value);
  25055. * }
  25056. *
  25057. * function customizer(objValue, srcValue) {
  25058. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  25059. * return true;
  25060. * }
  25061. * }
  25062. *
  25063. * var object = { 'greeting': 'hello' };
  25064. * var source = { 'greeting': 'hi' };
  25065. *
  25066. * _.isMatchWith(object, source, customizer);
  25067. * // => true
  25068. */
  25069. function isMatchWith(object, source, customizer) {
  25070. customizer = typeof customizer == 'function' ? customizer : undefined;
  25071. return baseIsMatch(object, source, getMatchData(source), customizer);
  25072. }
  25073. /**
  25074. * Checks if `value` is `NaN`.
  25075. *
  25076. * **Note:** This method is based on
  25077. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  25078. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  25079. * `undefined` and other non-number values.
  25080. *
  25081. * @static
  25082. * @memberOf _
  25083. * @since 0.1.0
  25084. * @category Lang
  25085. * @param {*} value The value to check.
  25086. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  25087. * @example
  25088. *
  25089. * _.isNaN(NaN);
  25090. * // => true
  25091. *
  25092. * _.isNaN(new Number(NaN));
  25093. * // => true
  25094. *
  25095. * isNaN(undefined);
  25096. * // => true
  25097. *
  25098. * _.isNaN(undefined);
  25099. * // => false
  25100. */
  25101. function isNaN(value) {
  25102. // An `NaN` primitive is the only value that is not equal to itself.
  25103. // Perform the `toStringTag` check first to avoid errors with some
  25104. // ActiveX objects in IE.
  25105. return isNumber(value) && value != +value;
  25106. }
  25107. /**
  25108. * Checks if `value` is a pristine native function.
  25109. *
  25110. * **Note:** This method can't reliably detect native functions in the presence
  25111. * of the core-js package because core-js circumvents this kind of detection.
  25112. * Despite multiple requests, the core-js maintainer has made it clear: any
  25113. * attempt to fix the detection will be obstructed. As a result, we're left
  25114. * with little choice but to throw an error. Unfortunately, this also affects
  25115. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  25116. * which rely on core-js.
  25117. *
  25118. * @static
  25119. * @memberOf _
  25120. * @since 3.0.0
  25121. * @category Lang
  25122. * @param {*} value The value to check.
  25123. * @returns {boolean} Returns `true` if `value` is a native function,
  25124. * else `false`.
  25125. * @example
  25126. *
  25127. * _.isNative(Array.prototype.push);
  25128. * // => true
  25129. *
  25130. * _.isNative(_);
  25131. * // => false
  25132. */
  25133. function isNative(value) {
  25134. if (isMaskable(value)) {
  25135. throw new Error(CORE_ERROR_TEXT);
  25136. }
  25137. return baseIsNative(value);
  25138. }
  25139. /**
  25140. * Checks if `value` is `null`.
  25141. *
  25142. * @static
  25143. * @memberOf _
  25144. * @since 0.1.0
  25145. * @category Lang
  25146. * @param {*} value The value to check.
  25147. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  25148. * @example
  25149. *
  25150. * _.isNull(null);
  25151. * // => true
  25152. *
  25153. * _.isNull(void 0);
  25154. * // => false
  25155. */
  25156. function isNull(value) {
  25157. return value === null;
  25158. }
  25159. /**
  25160. * Checks if `value` is `null` or `undefined`.
  25161. *
  25162. * @static
  25163. * @memberOf _
  25164. * @since 4.0.0
  25165. * @category Lang
  25166. * @param {*} value The value to check.
  25167. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  25168. * @example
  25169. *
  25170. * _.isNil(null);
  25171. * // => true
  25172. *
  25173. * _.isNil(void 0);
  25174. * // => true
  25175. *
  25176. * _.isNil(NaN);
  25177. * // => false
  25178. */
  25179. function isNil(value) {
  25180. return value == null;
  25181. }
  25182. /**
  25183. * Checks if `value` is classified as a `Number` primitive or object.
  25184. *
  25185. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  25186. * classified as numbers, use the `_.isFinite` method.
  25187. *
  25188. * @static
  25189. * @memberOf _
  25190. * @since 0.1.0
  25191. * @category Lang
  25192. * @param {*} value The value to check.
  25193. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  25194. * @example
  25195. *
  25196. * _.isNumber(3);
  25197. * // => true
  25198. *
  25199. * _.isNumber(Number.MIN_VALUE);
  25200. * // => true
  25201. *
  25202. * _.isNumber(Infinity);
  25203. * // => true
  25204. *
  25205. * _.isNumber('3');
  25206. * // => false
  25207. */
  25208. function isNumber(value) {
  25209. return typeof value == 'number' ||
  25210. (isObjectLike(value) && baseGetTag(value) == numberTag);
  25211. }
  25212. /**
  25213. * Checks if `value` is a plain object, that is, an object created by the
  25214. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  25215. *
  25216. * @static
  25217. * @memberOf _
  25218. * @since 0.8.0
  25219. * @category Lang
  25220. * @param {*} value The value to check.
  25221. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  25222. * @example
  25223. *
  25224. * function Foo() {
  25225. * this.a = 1;
  25226. * }
  25227. *
  25228. * _.isPlainObject(new Foo);
  25229. * // => false
  25230. *
  25231. * _.isPlainObject([1, 2, 3]);
  25232. * // => false
  25233. *
  25234. * _.isPlainObject({ 'x': 0, 'y': 0 });
  25235. * // => true
  25236. *
  25237. * _.isPlainObject(Object.create(null));
  25238. * // => true
  25239. */
  25240. function isPlainObject(value) {
  25241. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  25242. return false;
  25243. }
  25244. var proto = getPrototype(value);
  25245. if (proto === null) {
  25246. return true;
  25247. }
  25248. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  25249. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  25250. funcToString.call(Ctor) == objectCtorString;
  25251. }
  25252. /**
  25253. * Checks if `value` is classified as a `RegExp` object.
  25254. *
  25255. * @static
  25256. * @memberOf _
  25257. * @since 0.1.0
  25258. * @category Lang
  25259. * @param {*} value The value to check.
  25260. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  25261. * @example
  25262. *
  25263. * _.isRegExp(/abc/);
  25264. * // => true
  25265. *
  25266. * _.isRegExp('/abc/');
  25267. * // => false
  25268. */
  25269. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  25270. /**
  25271. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  25272. * double precision number which isn't the result of a rounded unsafe integer.
  25273. *
  25274. * **Note:** This method is based on
  25275. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  25276. *
  25277. * @static
  25278. * @memberOf _
  25279. * @since 4.0.0
  25280. * @category Lang
  25281. * @param {*} value The value to check.
  25282. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  25283. * @example
  25284. *
  25285. * _.isSafeInteger(3);
  25286. * // => true
  25287. *
  25288. * _.isSafeInteger(Number.MIN_VALUE);
  25289. * // => false
  25290. *
  25291. * _.isSafeInteger(Infinity);
  25292. * // => false
  25293. *
  25294. * _.isSafeInteger('3');
  25295. * // => false
  25296. */
  25297. function isSafeInteger(value) {
  25298. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  25299. }
  25300. /**
  25301. * Checks if `value` is classified as a `Set` object.
  25302. *
  25303. * @static
  25304. * @memberOf _
  25305. * @since 4.3.0
  25306. * @category Lang
  25307. * @param {*} value The value to check.
  25308. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  25309. * @example
  25310. *
  25311. * _.isSet(new Set);
  25312. * // => true
  25313. *
  25314. * _.isSet(new WeakSet);
  25315. * // => false
  25316. */
  25317. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  25318. /**
  25319. * Checks if `value` is classified as a `String` primitive or object.
  25320. *
  25321. * @static
  25322. * @since 0.1.0
  25323. * @memberOf _
  25324. * @category Lang
  25325. * @param {*} value The value to check.
  25326. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  25327. * @example
  25328. *
  25329. * _.isString('abc');
  25330. * // => true
  25331. *
  25332. * _.isString(1);
  25333. * // => false
  25334. */
  25335. function isString(value) {
  25336. return typeof value == 'string' ||
  25337. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  25338. }
  25339. /**
  25340. * Checks if `value` is classified as a `Symbol` primitive or object.
  25341. *
  25342. * @static
  25343. * @memberOf _
  25344. * @since 4.0.0
  25345. * @category Lang
  25346. * @param {*} value The value to check.
  25347. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  25348. * @example
  25349. *
  25350. * _.isSymbol(Symbol.iterator);
  25351. * // => true
  25352. *
  25353. * _.isSymbol('abc');
  25354. * // => false
  25355. */
  25356. function isSymbol(value) {
  25357. return typeof value == 'symbol' ||
  25358. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  25359. }
  25360. /**
  25361. * Checks if `value` is classified as a typed array.
  25362. *
  25363. * @static
  25364. * @memberOf _
  25365. * @since 3.0.0
  25366. * @category Lang
  25367. * @param {*} value The value to check.
  25368. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  25369. * @example
  25370. *
  25371. * _.isTypedArray(new Uint8Array);
  25372. * // => true
  25373. *
  25374. * _.isTypedArray([]);
  25375. * // => false
  25376. */
  25377. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  25378. /**
  25379. * Checks if `value` is `undefined`.
  25380. *
  25381. * @static
  25382. * @since 0.1.0
  25383. * @memberOf _
  25384. * @category Lang
  25385. * @param {*} value The value to check.
  25386. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  25387. * @example
  25388. *
  25389. * _.isUndefined(void 0);
  25390. * // => true
  25391. *
  25392. * _.isUndefined(null);
  25393. * // => false
  25394. */
  25395. function isUndefined(value) {
  25396. return value === undefined;
  25397. }
  25398. /**
  25399. * Checks if `value` is classified as a `WeakMap` object.
  25400. *
  25401. * @static
  25402. * @memberOf _
  25403. * @since 4.3.0
  25404. * @category Lang
  25405. * @param {*} value The value to check.
  25406. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  25407. * @example
  25408. *
  25409. * _.isWeakMap(new WeakMap);
  25410. * // => true
  25411. *
  25412. * _.isWeakMap(new Map);
  25413. * // => false
  25414. */
  25415. function isWeakMap(value) {
  25416. return isObjectLike(value) && getTag(value) == weakMapTag;
  25417. }
  25418. /**
  25419. * Checks if `value` is classified as a `WeakSet` object.
  25420. *
  25421. * @static
  25422. * @memberOf _
  25423. * @since 4.3.0
  25424. * @category Lang
  25425. * @param {*} value The value to check.
  25426. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  25427. * @example
  25428. *
  25429. * _.isWeakSet(new WeakSet);
  25430. * // => true
  25431. *
  25432. * _.isWeakSet(new Set);
  25433. * // => false
  25434. */
  25435. function isWeakSet(value) {
  25436. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  25437. }
  25438. /**
  25439. * Checks if `value` is less than `other`.
  25440. *
  25441. * @static
  25442. * @memberOf _
  25443. * @since 3.9.0
  25444. * @category Lang
  25445. * @param {*} value The value to compare.
  25446. * @param {*} other The other value to compare.
  25447. * @returns {boolean} Returns `true` if `value` is less than `other`,
  25448. * else `false`.
  25449. * @see _.gt
  25450. * @example
  25451. *
  25452. * _.lt(1, 3);
  25453. * // => true
  25454. *
  25455. * _.lt(3, 3);
  25456. * // => false
  25457. *
  25458. * _.lt(3, 1);
  25459. * // => false
  25460. */
  25461. var lt = createRelationalOperation(baseLt);
  25462. /**
  25463. * Checks if `value` is less than or equal to `other`.
  25464. *
  25465. * @static
  25466. * @memberOf _
  25467. * @since 3.9.0
  25468. * @category Lang
  25469. * @param {*} value The value to compare.
  25470. * @param {*} other The other value to compare.
  25471. * @returns {boolean} Returns `true` if `value` is less than or equal to
  25472. * `other`, else `false`.
  25473. * @see _.gte
  25474. * @example
  25475. *
  25476. * _.lte(1, 3);
  25477. * // => true
  25478. *
  25479. * _.lte(3, 3);
  25480. * // => true
  25481. *
  25482. * _.lte(3, 1);
  25483. * // => false
  25484. */
  25485. var lte = createRelationalOperation(function(value, other) {
  25486. return value <= other;
  25487. });
  25488. /**
  25489. * Converts `value` to an array.
  25490. *
  25491. * @static
  25492. * @since 0.1.0
  25493. * @memberOf _
  25494. * @category Lang
  25495. * @param {*} value The value to convert.
  25496. * @returns {Array} Returns the converted array.
  25497. * @example
  25498. *
  25499. * _.toArray({ 'a': 1, 'b': 2 });
  25500. * // => [1, 2]
  25501. *
  25502. * _.toArray('abc');
  25503. * // => ['a', 'b', 'c']
  25504. *
  25505. * _.toArray(1);
  25506. * // => []
  25507. *
  25508. * _.toArray(null);
  25509. * // => []
  25510. */
  25511. function toArray(value) {
  25512. if (!value) {
  25513. return [];
  25514. }
  25515. if (isArrayLike(value)) {
  25516. return isString(value) ? stringToArray(value) : copyArray(value);
  25517. }
  25518. if (symIterator && value[symIterator]) {
  25519. return iteratorToArray(value[symIterator]());
  25520. }
  25521. var tag = getTag(value),
  25522. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  25523. return func(value);
  25524. }
  25525. /**
  25526. * Converts `value` to a finite number.
  25527. *
  25528. * @static
  25529. * @memberOf _
  25530. * @since 4.12.0
  25531. * @category Lang
  25532. * @param {*} value The value to convert.
  25533. * @returns {number} Returns the converted number.
  25534. * @example
  25535. *
  25536. * _.toFinite(3.2);
  25537. * // => 3.2
  25538. *
  25539. * _.toFinite(Number.MIN_VALUE);
  25540. * // => 5e-324
  25541. *
  25542. * _.toFinite(Infinity);
  25543. * // => 1.7976931348623157e+308
  25544. *
  25545. * _.toFinite('3.2');
  25546. * // => 3.2
  25547. */
  25548. function toFinite(value) {
  25549. if (!value) {
  25550. return value === 0 ? value : 0;
  25551. }
  25552. value = toNumber(value);
  25553. if (value === INFINITY || value === -INFINITY) {
  25554. var sign = (value < 0 ? -1 : 1);
  25555. return sign * MAX_INTEGER;
  25556. }
  25557. return value === value ? value : 0;
  25558. }
  25559. /**
  25560. * Converts `value` to an integer.
  25561. *
  25562. * **Note:** This method is loosely based on
  25563. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  25564. *
  25565. * @static
  25566. * @memberOf _
  25567. * @since 4.0.0
  25568. * @category Lang
  25569. * @param {*} value The value to convert.
  25570. * @returns {number} Returns the converted integer.
  25571. * @example
  25572. *
  25573. * _.toInteger(3.2);
  25574. * // => 3
  25575. *
  25576. * _.toInteger(Number.MIN_VALUE);
  25577. * // => 0
  25578. *
  25579. * _.toInteger(Infinity);
  25580. * // => 1.7976931348623157e+308
  25581. *
  25582. * _.toInteger('3.2');
  25583. * // => 3
  25584. */
  25585. function toInteger(value) {
  25586. var result = toFinite(value),
  25587. remainder = result % 1;
  25588. return result === result ? (remainder ? result - remainder : result) : 0;
  25589. }
  25590. /**
  25591. * Converts `value` to an integer suitable for use as the length of an
  25592. * array-like object.
  25593. *
  25594. * **Note:** This method is based on
  25595. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  25596. *
  25597. * @static
  25598. * @memberOf _
  25599. * @since 4.0.0
  25600. * @category Lang
  25601. * @param {*} value The value to convert.
  25602. * @returns {number} Returns the converted integer.
  25603. * @example
  25604. *
  25605. * _.toLength(3.2);
  25606. * // => 3
  25607. *
  25608. * _.toLength(Number.MIN_VALUE);
  25609. * // => 0
  25610. *
  25611. * _.toLength(Infinity);
  25612. * // => 4294967295
  25613. *
  25614. * _.toLength('3.2');
  25615. * // => 3
  25616. */
  25617. function toLength(value) {
  25618. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25619. }
  25620. /**
  25621. * Converts `value` to a number.
  25622. *
  25623. * @static
  25624. * @memberOf _
  25625. * @since 4.0.0
  25626. * @category Lang
  25627. * @param {*} value The value to process.
  25628. * @returns {number} Returns the number.
  25629. * @example
  25630. *
  25631. * _.toNumber(3.2);
  25632. * // => 3.2
  25633. *
  25634. * _.toNumber(Number.MIN_VALUE);
  25635. * // => 5e-324
  25636. *
  25637. * _.toNumber(Infinity);
  25638. * // => Infinity
  25639. *
  25640. * _.toNumber('3.2');
  25641. * // => 3.2
  25642. */
  25643. function toNumber(value) {
  25644. if (typeof value == 'number') {
  25645. return value;
  25646. }
  25647. if (isSymbol(value)) {
  25648. return NAN;
  25649. }
  25650. if (isObject(value)) {
  25651. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25652. value = isObject(other) ? (other + '') : other;
  25653. }
  25654. if (typeof value != 'string') {
  25655. return value === 0 ? value : +value;
  25656. }
  25657. value = value.replace(reTrim, '');
  25658. var isBinary = reIsBinary.test(value);
  25659. return (isBinary || reIsOctal.test(value))
  25660. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25661. : (reIsBadHex.test(value) ? NAN : +value);
  25662. }
  25663. /**
  25664. * Converts `value` to a plain object flattening inherited enumerable string
  25665. * keyed properties of `value` to own properties of the plain object.
  25666. *
  25667. * @static
  25668. * @memberOf _
  25669. * @since 3.0.0
  25670. * @category Lang
  25671. * @param {*} value The value to convert.
  25672. * @returns {Object} Returns the converted plain object.
  25673. * @example
  25674. *
  25675. * function Foo() {
  25676. * this.b = 2;
  25677. * }
  25678. *
  25679. * Foo.prototype.c = 3;
  25680. *
  25681. * _.assign({ 'a': 1 }, new Foo);
  25682. * // => { 'a': 1, 'b': 2 }
  25683. *
  25684. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25685. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25686. */
  25687. function toPlainObject(value) {
  25688. return copyObject(value, keysIn(value));
  25689. }
  25690. /**
  25691. * Converts `value` to a safe integer. A safe integer can be compared and
  25692. * represented correctly.
  25693. *
  25694. * @static
  25695. * @memberOf _
  25696. * @since 4.0.0
  25697. * @category Lang
  25698. * @param {*} value The value to convert.
  25699. * @returns {number} Returns the converted integer.
  25700. * @example
  25701. *
  25702. * _.toSafeInteger(3.2);
  25703. * // => 3
  25704. *
  25705. * _.toSafeInteger(Number.MIN_VALUE);
  25706. * // => 0
  25707. *
  25708. * _.toSafeInteger(Infinity);
  25709. * // => 9007199254740991
  25710. *
  25711. * _.toSafeInteger('3.2');
  25712. * // => 3
  25713. */
  25714. function toSafeInteger(value) {
  25715. return value
  25716. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25717. : (value === 0 ? value : 0);
  25718. }
  25719. /**
  25720. * Converts `value` to a string. An empty string is returned for `null`
  25721. * and `undefined` values. The sign of `-0` is preserved.
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 4.0.0
  25726. * @category Lang
  25727. * @param {*} value The value to convert.
  25728. * @returns {string} Returns the converted string.
  25729. * @example
  25730. *
  25731. * _.toString(null);
  25732. * // => ''
  25733. *
  25734. * _.toString(-0);
  25735. * // => '-0'
  25736. *
  25737. * _.toString([1, 2, 3]);
  25738. * // => '1,2,3'
  25739. */
  25740. function toString(value) {
  25741. return value == null ? '' : baseToString(value);
  25742. }
  25743. /*------------------------------------------------------------------------*/
  25744. /**
  25745. * Assigns own enumerable string keyed properties of source objects to the
  25746. * destination object. Source objects are applied from left to right.
  25747. * Subsequent sources overwrite property assignments of previous sources.
  25748. *
  25749. * **Note:** This method mutates `object` and is loosely based on
  25750. * [`Object.assign`](https://mdn.io/Object/assign).
  25751. *
  25752. * @static
  25753. * @memberOf _
  25754. * @since 0.10.0
  25755. * @category Object
  25756. * @param {Object} object The destination object.
  25757. * @param {...Object} [sources] The source objects.
  25758. * @returns {Object} Returns `object`.
  25759. * @see _.assignIn
  25760. * @example
  25761. *
  25762. * function Foo() {
  25763. * this.a = 1;
  25764. * }
  25765. *
  25766. * function Bar() {
  25767. * this.c = 3;
  25768. * }
  25769. *
  25770. * Foo.prototype.b = 2;
  25771. * Bar.prototype.d = 4;
  25772. *
  25773. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25774. * // => { 'a': 1, 'c': 3 }
  25775. */
  25776. var assign = createAssigner(function(object, source) {
  25777. if (isPrototype(source) || isArrayLike(source)) {
  25778. copyObject(source, keys(source), object);
  25779. return;
  25780. }
  25781. for (var key in source) {
  25782. if (hasOwnProperty.call(source, key)) {
  25783. assignValue(object, key, source[key]);
  25784. }
  25785. }
  25786. });
  25787. /**
  25788. * This method is like `_.assign` except that it iterates over own and
  25789. * inherited source properties.
  25790. *
  25791. * **Note:** This method mutates `object`.
  25792. *
  25793. * @static
  25794. * @memberOf _
  25795. * @since 4.0.0
  25796. * @alias extend
  25797. * @category Object
  25798. * @param {Object} object The destination object.
  25799. * @param {...Object} [sources] The source objects.
  25800. * @returns {Object} Returns `object`.
  25801. * @see _.assign
  25802. * @example
  25803. *
  25804. * function Foo() {
  25805. * this.a = 1;
  25806. * }
  25807. *
  25808. * function Bar() {
  25809. * this.c = 3;
  25810. * }
  25811. *
  25812. * Foo.prototype.b = 2;
  25813. * Bar.prototype.d = 4;
  25814. *
  25815. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25816. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25817. */
  25818. var assignIn = createAssigner(function(object, source) {
  25819. copyObject(source, keysIn(source), object);
  25820. });
  25821. /**
  25822. * This method is like `_.assignIn` except that it accepts `customizer`
  25823. * which is invoked to produce the assigned values. If `customizer` returns
  25824. * `undefined`, assignment is handled by the method instead. The `customizer`
  25825. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25826. *
  25827. * **Note:** This method mutates `object`.
  25828. *
  25829. * @static
  25830. * @memberOf _
  25831. * @since 4.0.0
  25832. * @alias extendWith
  25833. * @category Object
  25834. * @param {Object} object The destination object.
  25835. * @param {...Object} sources The source objects.
  25836. * @param {Function} [customizer] The function to customize assigned values.
  25837. * @returns {Object} Returns `object`.
  25838. * @see _.assignWith
  25839. * @example
  25840. *
  25841. * function customizer(objValue, srcValue) {
  25842. * return _.isUndefined(objValue) ? srcValue : objValue;
  25843. * }
  25844. *
  25845. * var defaults = _.partialRight(_.assignInWith, customizer);
  25846. *
  25847. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25848. * // => { 'a': 1, 'b': 2 }
  25849. */
  25850. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25851. copyObject(source, keysIn(source), object, customizer);
  25852. });
  25853. /**
  25854. * This method is like `_.assign` except that it accepts `customizer`
  25855. * which is invoked to produce the assigned values. If `customizer` returns
  25856. * `undefined`, assignment is handled by the method instead. The `customizer`
  25857. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25858. *
  25859. * **Note:** This method mutates `object`.
  25860. *
  25861. * @static
  25862. * @memberOf _
  25863. * @since 4.0.0
  25864. * @category Object
  25865. * @param {Object} object The destination object.
  25866. * @param {...Object} sources The source objects.
  25867. * @param {Function} [customizer] The function to customize assigned values.
  25868. * @returns {Object} Returns `object`.
  25869. * @see _.assignInWith
  25870. * @example
  25871. *
  25872. * function customizer(objValue, srcValue) {
  25873. * return _.isUndefined(objValue) ? srcValue : objValue;
  25874. * }
  25875. *
  25876. * var defaults = _.partialRight(_.assignWith, customizer);
  25877. *
  25878. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25879. * // => { 'a': 1, 'b': 2 }
  25880. */
  25881. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25882. copyObject(source, keys(source), object, customizer);
  25883. });
  25884. /**
  25885. * Creates an array of values corresponding to `paths` of `object`.
  25886. *
  25887. * @static
  25888. * @memberOf _
  25889. * @since 1.0.0
  25890. * @category Object
  25891. * @param {Object} object The object to iterate over.
  25892. * @param {...(string|string[])} [paths] The property paths to pick.
  25893. * @returns {Array} Returns the picked values.
  25894. * @example
  25895. *
  25896. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25897. *
  25898. * _.at(object, ['a[0].b.c', 'a[1]']);
  25899. * // => [3, 4]
  25900. */
  25901. var at = flatRest(baseAt);
  25902. /**
  25903. * Creates an object that inherits from the `prototype` object. If a
  25904. * `properties` object is given, its own enumerable string keyed properties
  25905. * are assigned to the created object.
  25906. *
  25907. * @static
  25908. * @memberOf _
  25909. * @since 2.3.0
  25910. * @category Object
  25911. * @param {Object} prototype The object to inherit from.
  25912. * @param {Object} [properties] The properties to assign to the object.
  25913. * @returns {Object} Returns the new object.
  25914. * @example
  25915. *
  25916. * function Shape() {
  25917. * this.x = 0;
  25918. * this.y = 0;
  25919. * }
  25920. *
  25921. * function Circle() {
  25922. * Shape.call(this);
  25923. * }
  25924. *
  25925. * Circle.prototype = _.create(Shape.prototype, {
  25926. * 'constructor': Circle
  25927. * });
  25928. *
  25929. * var circle = new Circle;
  25930. * circle instanceof Circle;
  25931. * // => true
  25932. *
  25933. * circle instanceof Shape;
  25934. * // => true
  25935. */
  25936. function create(prototype, properties) {
  25937. var result = baseCreate(prototype);
  25938. return properties == null ? result : baseAssign(result, properties);
  25939. }
  25940. /**
  25941. * Assigns own and inherited enumerable string keyed properties of source
  25942. * objects to the destination object for all destination properties that
  25943. * resolve to `undefined`. Source objects are applied from left to right.
  25944. * Once a property is set, additional values of the same property are ignored.
  25945. *
  25946. * **Note:** This method mutates `object`.
  25947. *
  25948. * @static
  25949. * @since 0.1.0
  25950. * @memberOf _
  25951. * @category Object
  25952. * @param {Object} object The destination object.
  25953. * @param {...Object} [sources] The source objects.
  25954. * @returns {Object} Returns `object`.
  25955. * @see _.defaultsDeep
  25956. * @example
  25957. *
  25958. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25959. * // => { 'a': 1, 'b': 2 }
  25960. */
  25961. var defaults = baseRest(function(object, sources) {
  25962. object = Object(object);
  25963. var index = -1;
  25964. var length = sources.length;
  25965. var guard = length > 2 ? sources[2] : undefined;
  25966. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25967. length = 1;
  25968. }
  25969. while (++index < length) {
  25970. var source = sources[index];
  25971. var props = keysIn(source);
  25972. var propsIndex = -1;
  25973. var propsLength = props.length;
  25974. while (++propsIndex < propsLength) {
  25975. var key = props[propsIndex];
  25976. var value = object[key];
  25977. if (value === undefined ||
  25978. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25979. object[key] = source[key];
  25980. }
  25981. }
  25982. }
  25983. return object;
  25984. });
  25985. /**
  25986. * This method is like `_.defaults` except that it recursively assigns
  25987. * default properties.
  25988. *
  25989. * **Note:** This method mutates `object`.
  25990. *
  25991. * @static
  25992. * @memberOf _
  25993. * @since 3.10.0
  25994. * @category Object
  25995. * @param {Object} object The destination object.
  25996. * @param {...Object} [sources] The source objects.
  25997. * @returns {Object} Returns `object`.
  25998. * @see _.defaults
  25999. * @example
  26000. *
  26001. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  26002. * // => { 'a': { 'b': 2, 'c': 3 } }
  26003. */
  26004. var defaultsDeep = baseRest(function(args) {
  26005. args.push(undefined, customDefaultsMerge);
  26006. return apply(mergeWith, undefined, args);
  26007. });
  26008. /**
  26009. * This method is like `_.find` except that it returns the key of the first
  26010. * element `predicate` returns truthy for instead of the element itself.
  26011. *
  26012. * @static
  26013. * @memberOf _
  26014. * @since 1.1.0
  26015. * @category Object
  26016. * @param {Object} object The object to inspect.
  26017. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26018. * @returns {string|undefined} Returns the key of the matched element,
  26019. * else `undefined`.
  26020. * @example
  26021. *
  26022. * var users = {
  26023. * 'barney': { 'age': 36, 'active': true },
  26024. * 'fred': { 'age': 40, 'active': false },
  26025. * 'pebbles': { 'age': 1, 'active': true }
  26026. * };
  26027. *
  26028. * _.findKey(users, function(o) { return o.age < 40; });
  26029. * // => 'barney' (iteration order is not guaranteed)
  26030. *
  26031. * // The `_.matches` iteratee shorthand.
  26032. * _.findKey(users, { 'age': 1, 'active': true });
  26033. * // => 'pebbles'
  26034. *
  26035. * // The `_.matchesProperty` iteratee shorthand.
  26036. * _.findKey(users, ['active', false]);
  26037. * // => 'fred'
  26038. *
  26039. * // The `_.property` iteratee shorthand.
  26040. * _.findKey(users, 'active');
  26041. * // => 'barney'
  26042. */
  26043. function findKey(object, predicate) {
  26044. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  26045. }
  26046. /**
  26047. * This method is like `_.findKey` except that it iterates over elements of
  26048. * a collection in the opposite order.
  26049. *
  26050. * @static
  26051. * @memberOf _
  26052. * @since 2.0.0
  26053. * @category Object
  26054. * @param {Object} object The object to inspect.
  26055. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26056. * @returns {string|undefined} Returns the key of the matched element,
  26057. * else `undefined`.
  26058. * @example
  26059. *
  26060. * var users = {
  26061. * 'barney': { 'age': 36, 'active': true },
  26062. * 'fred': { 'age': 40, 'active': false },
  26063. * 'pebbles': { 'age': 1, 'active': true }
  26064. * };
  26065. *
  26066. * _.findLastKey(users, function(o) { return o.age < 40; });
  26067. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  26068. *
  26069. * // The `_.matches` iteratee shorthand.
  26070. * _.findLastKey(users, { 'age': 36, 'active': true });
  26071. * // => 'barney'
  26072. *
  26073. * // The `_.matchesProperty` iteratee shorthand.
  26074. * _.findLastKey(users, ['active', false]);
  26075. * // => 'fred'
  26076. *
  26077. * // The `_.property` iteratee shorthand.
  26078. * _.findLastKey(users, 'active');
  26079. * // => 'pebbles'
  26080. */
  26081. function findLastKey(object, predicate) {
  26082. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  26083. }
  26084. /**
  26085. * Iterates over own and inherited enumerable string keyed properties of an
  26086. * object and invokes `iteratee` for each property. The iteratee is invoked
  26087. * with three arguments: (value, key, object). Iteratee functions may exit
  26088. * iteration early by explicitly returning `false`.
  26089. *
  26090. * @static
  26091. * @memberOf _
  26092. * @since 0.3.0
  26093. * @category Object
  26094. * @param {Object} object The object to iterate over.
  26095. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26096. * @returns {Object} Returns `object`.
  26097. * @see _.forInRight
  26098. * @example
  26099. *
  26100. * function Foo() {
  26101. * this.a = 1;
  26102. * this.b = 2;
  26103. * }
  26104. *
  26105. * Foo.prototype.c = 3;
  26106. *
  26107. * _.forIn(new Foo, function(value, key) {
  26108. * console.log(key);
  26109. * });
  26110. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  26111. */
  26112. function forIn(object, iteratee) {
  26113. return object == null
  26114. ? object
  26115. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  26116. }
  26117. /**
  26118. * This method is like `_.forIn` except that it iterates over properties of
  26119. * `object` in the opposite order.
  26120. *
  26121. * @static
  26122. * @memberOf _
  26123. * @since 2.0.0
  26124. * @category Object
  26125. * @param {Object} object The object to iterate over.
  26126. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26127. * @returns {Object} Returns `object`.
  26128. * @see _.forIn
  26129. * @example
  26130. *
  26131. * function Foo() {
  26132. * this.a = 1;
  26133. * this.b = 2;
  26134. * }
  26135. *
  26136. * Foo.prototype.c = 3;
  26137. *
  26138. * _.forInRight(new Foo, function(value, key) {
  26139. * console.log(key);
  26140. * });
  26141. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  26142. */
  26143. function forInRight(object, iteratee) {
  26144. return object == null
  26145. ? object
  26146. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  26147. }
  26148. /**
  26149. * Iterates over own enumerable string keyed properties of an object and
  26150. * invokes `iteratee` for each property. The iteratee is invoked with three
  26151. * arguments: (value, key, object). Iteratee functions may exit iteration
  26152. * early by explicitly returning `false`.
  26153. *
  26154. * @static
  26155. * @memberOf _
  26156. * @since 0.3.0
  26157. * @category Object
  26158. * @param {Object} object The object to iterate over.
  26159. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26160. * @returns {Object} Returns `object`.
  26161. * @see _.forOwnRight
  26162. * @example
  26163. *
  26164. * function Foo() {
  26165. * this.a = 1;
  26166. * this.b = 2;
  26167. * }
  26168. *
  26169. * Foo.prototype.c = 3;
  26170. *
  26171. * _.forOwn(new Foo, function(value, key) {
  26172. * console.log(key);
  26173. * });
  26174. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26175. */
  26176. function forOwn(object, iteratee) {
  26177. return object && baseForOwn(object, getIteratee(iteratee, 3));
  26178. }
  26179. /**
  26180. * This method is like `_.forOwn` except that it iterates over properties of
  26181. * `object` in the opposite order.
  26182. *
  26183. * @static
  26184. * @memberOf _
  26185. * @since 2.0.0
  26186. * @category Object
  26187. * @param {Object} object The object to iterate over.
  26188. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26189. * @returns {Object} Returns `object`.
  26190. * @see _.forOwn
  26191. * @example
  26192. *
  26193. * function Foo() {
  26194. * this.a = 1;
  26195. * this.b = 2;
  26196. * }
  26197. *
  26198. * Foo.prototype.c = 3;
  26199. *
  26200. * _.forOwnRight(new Foo, function(value, key) {
  26201. * console.log(key);
  26202. * });
  26203. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  26204. */
  26205. function forOwnRight(object, iteratee) {
  26206. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  26207. }
  26208. /**
  26209. * Creates an array of function property names from own enumerable properties
  26210. * of `object`.
  26211. *
  26212. * @static
  26213. * @since 0.1.0
  26214. * @memberOf _
  26215. * @category Object
  26216. * @param {Object} object The object to inspect.
  26217. * @returns {Array} Returns the function names.
  26218. * @see _.functionsIn
  26219. * @example
  26220. *
  26221. * function Foo() {
  26222. * this.a = _.constant('a');
  26223. * this.b = _.constant('b');
  26224. * }
  26225. *
  26226. * Foo.prototype.c = _.constant('c');
  26227. *
  26228. * _.functions(new Foo);
  26229. * // => ['a', 'b']
  26230. */
  26231. function functions(object) {
  26232. return object == null ? [] : baseFunctions(object, keys(object));
  26233. }
  26234. /**
  26235. * Creates an array of function property names from own and inherited
  26236. * enumerable properties of `object`.
  26237. *
  26238. * @static
  26239. * @memberOf _
  26240. * @since 4.0.0
  26241. * @category Object
  26242. * @param {Object} object The object to inspect.
  26243. * @returns {Array} Returns the function names.
  26244. * @see _.functions
  26245. * @example
  26246. *
  26247. * function Foo() {
  26248. * this.a = _.constant('a');
  26249. * this.b = _.constant('b');
  26250. * }
  26251. *
  26252. * Foo.prototype.c = _.constant('c');
  26253. *
  26254. * _.functionsIn(new Foo);
  26255. * // => ['a', 'b', 'c']
  26256. */
  26257. function functionsIn(object) {
  26258. return object == null ? [] : baseFunctions(object, keysIn(object));
  26259. }
  26260. /**
  26261. * Gets the value at `path` of `object`. If the resolved value is
  26262. * `undefined`, the `defaultValue` is returned in its place.
  26263. *
  26264. * @static
  26265. * @memberOf _
  26266. * @since 3.7.0
  26267. * @category Object
  26268. * @param {Object} object The object to query.
  26269. * @param {Array|string} path The path of the property to get.
  26270. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26271. * @returns {*} Returns the resolved value.
  26272. * @example
  26273. *
  26274. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26275. *
  26276. * _.get(object, 'a[0].b.c');
  26277. * // => 3
  26278. *
  26279. * _.get(object, ['a', '0', 'b', 'c']);
  26280. * // => 3
  26281. *
  26282. * _.get(object, 'a.b.c', 'default');
  26283. * // => 'default'
  26284. */
  26285. function get(object, path, defaultValue) {
  26286. var result = object == null ? undefined : baseGet(object, path);
  26287. return result === undefined ? defaultValue : result;
  26288. }
  26289. /**
  26290. * Checks if `path` is a direct property of `object`.
  26291. *
  26292. * @static
  26293. * @since 0.1.0
  26294. * @memberOf _
  26295. * @category Object
  26296. * @param {Object} object The object to query.
  26297. * @param {Array|string} path The path to check.
  26298. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26299. * @example
  26300. *
  26301. * var object = { 'a': { 'b': 2 } };
  26302. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  26303. *
  26304. * _.has(object, 'a');
  26305. * // => true
  26306. *
  26307. * _.has(object, 'a.b');
  26308. * // => true
  26309. *
  26310. * _.has(object, ['a', 'b']);
  26311. * // => true
  26312. *
  26313. * _.has(other, 'a');
  26314. * // => false
  26315. */
  26316. function has(object, path) {
  26317. return object != null && hasPath(object, path, baseHas);
  26318. }
  26319. /**
  26320. * Checks if `path` is a direct or inherited property of `object`.
  26321. *
  26322. * @static
  26323. * @memberOf _
  26324. * @since 4.0.0
  26325. * @category Object
  26326. * @param {Object} object The object to query.
  26327. * @param {Array|string} path The path to check.
  26328. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26329. * @example
  26330. *
  26331. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  26332. *
  26333. * _.hasIn(object, 'a');
  26334. * // => true
  26335. *
  26336. * _.hasIn(object, 'a.b');
  26337. * // => true
  26338. *
  26339. * _.hasIn(object, ['a', 'b']);
  26340. * // => true
  26341. *
  26342. * _.hasIn(object, 'b');
  26343. * // => false
  26344. */
  26345. function hasIn(object, path) {
  26346. return object != null && hasPath(object, path, baseHasIn);
  26347. }
  26348. /**
  26349. * Creates an object composed of the inverted keys and values of `object`.
  26350. * If `object` contains duplicate values, subsequent values overwrite
  26351. * property assignments of previous values.
  26352. *
  26353. * @static
  26354. * @memberOf _
  26355. * @since 0.7.0
  26356. * @category Object
  26357. * @param {Object} object The object to invert.
  26358. * @returns {Object} Returns the new inverted object.
  26359. * @example
  26360. *
  26361. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26362. *
  26363. * _.invert(object);
  26364. * // => { '1': 'c', '2': 'b' }
  26365. */
  26366. var invert = createInverter(function(result, value, key) {
  26367. if (value != null &&
  26368. typeof value.toString != 'function') {
  26369. value = nativeObjectToString.call(value);
  26370. }
  26371. result[value] = key;
  26372. }, constant(identity));
  26373. /**
  26374. * This method is like `_.invert` except that the inverted object is generated
  26375. * from the results of running each element of `object` thru `iteratee`. The
  26376. * corresponding inverted value of each inverted key is an array of keys
  26377. * responsible for generating the inverted value. The iteratee is invoked
  26378. * with one argument: (value).
  26379. *
  26380. * @static
  26381. * @memberOf _
  26382. * @since 4.1.0
  26383. * @category Object
  26384. * @param {Object} object The object to invert.
  26385. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26386. * @returns {Object} Returns the new inverted object.
  26387. * @example
  26388. *
  26389. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26390. *
  26391. * _.invertBy(object);
  26392. * // => { '1': ['a', 'c'], '2': ['b'] }
  26393. *
  26394. * _.invertBy(object, function(value) {
  26395. * return 'group' + value;
  26396. * });
  26397. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  26398. */
  26399. var invertBy = createInverter(function(result, value, key) {
  26400. if (value != null &&
  26401. typeof value.toString != 'function') {
  26402. value = nativeObjectToString.call(value);
  26403. }
  26404. if (hasOwnProperty.call(result, value)) {
  26405. result[value].push(key);
  26406. } else {
  26407. result[value] = [key];
  26408. }
  26409. }, getIteratee);
  26410. /**
  26411. * Invokes the method at `path` of `object`.
  26412. *
  26413. * @static
  26414. * @memberOf _
  26415. * @since 4.0.0
  26416. * @category Object
  26417. * @param {Object} object The object to query.
  26418. * @param {Array|string} path The path of the method to invoke.
  26419. * @param {...*} [args] The arguments to invoke the method with.
  26420. * @returns {*} Returns the result of the invoked method.
  26421. * @example
  26422. *
  26423. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  26424. *
  26425. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  26426. * // => [2, 3]
  26427. */
  26428. var invoke = baseRest(baseInvoke);
  26429. /**
  26430. * Creates an array of the own enumerable property names of `object`.
  26431. *
  26432. * **Note:** Non-object values are coerced to objects. See the
  26433. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  26434. * for more details.
  26435. *
  26436. * @static
  26437. * @since 0.1.0
  26438. * @memberOf _
  26439. * @category Object
  26440. * @param {Object} object The object to query.
  26441. * @returns {Array} Returns the array of property names.
  26442. * @example
  26443. *
  26444. * function Foo() {
  26445. * this.a = 1;
  26446. * this.b = 2;
  26447. * }
  26448. *
  26449. * Foo.prototype.c = 3;
  26450. *
  26451. * _.keys(new Foo);
  26452. * // => ['a', 'b'] (iteration order is not guaranteed)
  26453. *
  26454. * _.keys('hi');
  26455. * // => ['0', '1']
  26456. */
  26457. function keys(object) {
  26458. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  26459. }
  26460. /**
  26461. * Creates an array of the own and inherited enumerable property names of `object`.
  26462. *
  26463. * **Note:** Non-object values are coerced to objects.
  26464. *
  26465. * @static
  26466. * @memberOf _
  26467. * @since 3.0.0
  26468. * @category Object
  26469. * @param {Object} object The object to query.
  26470. * @returns {Array} Returns the array of property names.
  26471. * @example
  26472. *
  26473. * function Foo() {
  26474. * this.a = 1;
  26475. * this.b = 2;
  26476. * }
  26477. *
  26478. * Foo.prototype.c = 3;
  26479. *
  26480. * _.keysIn(new Foo);
  26481. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26482. */
  26483. function keysIn(object) {
  26484. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  26485. }
  26486. /**
  26487. * The opposite of `_.mapValues`; this method creates an object with the
  26488. * same values as `object` and keys generated by running each own enumerable
  26489. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  26490. * with three arguments: (value, key, object).
  26491. *
  26492. * @static
  26493. * @memberOf _
  26494. * @since 3.8.0
  26495. * @category Object
  26496. * @param {Object} object The object to iterate over.
  26497. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26498. * @returns {Object} Returns the new mapped object.
  26499. * @see _.mapValues
  26500. * @example
  26501. *
  26502. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  26503. * return key + value;
  26504. * });
  26505. * // => { 'a1': 1, 'b2': 2 }
  26506. */
  26507. function mapKeys(object, iteratee) {
  26508. var result = {};
  26509. iteratee = getIteratee(iteratee, 3);
  26510. baseForOwn(object, function(value, key, object) {
  26511. baseAssignValue(result, iteratee(value, key, object), value);
  26512. });
  26513. return result;
  26514. }
  26515. /**
  26516. * Creates an object with the same keys as `object` and values generated
  26517. * by running each own enumerable string keyed property of `object` thru
  26518. * `iteratee`. The iteratee is invoked with three arguments:
  26519. * (value, key, object).
  26520. *
  26521. * @static
  26522. * @memberOf _
  26523. * @since 2.4.0
  26524. * @category Object
  26525. * @param {Object} object The object to iterate over.
  26526. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26527. * @returns {Object} Returns the new mapped object.
  26528. * @see _.mapKeys
  26529. * @example
  26530. *
  26531. * var users = {
  26532. * 'fred': { 'user': 'fred', 'age': 40 },
  26533. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  26534. * };
  26535. *
  26536. * _.mapValues(users, function(o) { return o.age; });
  26537. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26538. *
  26539. * // The `_.property` iteratee shorthand.
  26540. * _.mapValues(users, 'age');
  26541. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26542. */
  26543. function mapValues(object, iteratee) {
  26544. var result = {};
  26545. iteratee = getIteratee(iteratee, 3);
  26546. baseForOwn(object, function(value, key, object) {
  26547. baseAssignValue(result, key, iteratee(value, key, object));
  26548. });
  26549. return result;
  26550. }
  26551. /**
  26552. * This method is like `_.assign` except that it recursively merges own and
  26553. * inherited enumerable string keyed properties of source objects into the
  26554. * destination object. Source properties that resolve to `undefined` are
  26555. * skipped if a destination value exists. Array and plain object properties
  26556. * are merged recursively. Other objects and value types are overridden by
  26557. * assignment. Source objects are applied from left to right. Subsequent
  26558. * sources overwrite property assignments of previous sources.
  26559. *
  26560. * **Note:** This method mutates `object`.
  26561. *
  26562. * @static
  26563. * @memberOf _
  26564. * @since 0.5.0
  26565. * @category Object
  26566. * @param {Object} object The destination object.
  26567. * @param {...Object} [sources] The source objects.
  26568. * @returns {Object} Returns `object`.
  26569. * @example
  26570. *
  26571. * var object = {
  26572. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  26573. * };
  26574. *
  26575. * var other = {
  26576. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  26577. * };
  26578. *
  26579. * _.merge(object, other);
  26580. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  26581. */
  26582. var merge = createAssigner(function(object, source, srcIndex) {
  26583. baseMerge(object, source, srcIndex);
  26584. });
  26585. /**
  26586. * This method is like `_.merge` except that it accepts `customizer` which
  26587. * is invoked to produce the merged values of the destination and source
  26588. * properties. If `customizer` returns `undefined`, merging is handled by the
  26589. * method instead. The `customizer` is invoked with six arguments:
  26590. * (objValue, srcValue, key, object, source, stack).
  26591. *
  26592. * **Note:** This method mutates `object`.
  26593. *
  26594. * @static
  26595. * @memberOf _
  26596. * @since 4.0.0
  26597. * @category Object
  26598. * @param {Object} object The destination object.
  26599. * @param {...Object} sources The source objects.
  26600. * @param {Function} customizer The function to customize assigned values.
  26601. * @returns {Object} Returns `object`.
  26602. * @example
  26603. *
  26604. * function customizer(objValue, srcValue) {
  26605. * if (_.isArray(objValue)) {
  26606. * return objValue.concat(srcValue);
  26607. * }
  26608. * }
  26609. *
  26610. * var object = { 'a': [1], 'b': [2] };
  26611. * var other = { 'a': [3], 'b': [4] };
  26612. *
  26613. * _.mergeWith(object, other, customizer);
  26614. * // => { 'a': [1, 3], 'b': [2, 4] }
  26615. */
  26616. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26617. baseMerge(object, source, srcIndex, customizer);
  26618. });
  26619. /**
  26620. * The opposite of `_.pick`; this method creates an object composed of the
  26621. * own and inherited enumerable property paths of `object` that are not omitted.
  26622. *
  26623. * **Note:** This method is considerably slower than `_.pick`.
  26624. *
  26625. * @static
  26626. * @since 0.1.0
  26627. * @memberOf _
  26628. * @category Object
  26629. * @param {Object} object The source object.
  26630. * @param {...(string|string[])} [paths] The property paths to omit.
  26631. * @returns {Object} Returns the new object.
  26632. * @example
  26633. *
  26634. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26635. *
  26636. * _.omit(object, ['a', 'c']);
  26637. * // => { 'b': '2' }
  26638. */
  26639. var omit = flatRest(function(object, paths) {
  26640. var result = {};
  26641. if (object == null) {
  26642. return result;
  26643. }
  26644. var isDeep = false;
  26645. paths = arrayMap(paths, function(path) {
  26646. path = castPath(path, object);
  26647. isDeep || (isDeep = path.length > 1);
  26648. return path;
  26649. });
  26650. copyObject(object, getAllKeysIn(object), result);
  26651. if (isDeep) {
  26652. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26653. }
  26654. var length = paths.length;
  26655. while (length--) {
  26656. baseUnset(result, paths[length]);
  26657. }
  26658. return result;
  26659. });
  26660. /**
  26661. * The opposite of `_.pickBy`; this method creates an object composed of
  26662. * the own and inherited enumerable string keyed properties of `object` that
  26663. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26664. * arguments: (value, key).
  26665. *
  26666. * @static
  26667. * @memberOf _
  26668. * @since 4.0.0
  26669. * @category Object
  26670. * @param {Object} object The source object.
  26671. * @param {Function} [predicate=_.identity] The function invoked per property.
  26672. * @returns {Object} Returns the new object.
  26673. * @example
  26674. *
  26675. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26676. *
  26677. * _.omitBy(object, _.isNumber);
  26678. * // => { 'b': '2' }
  26679. */
  26680. function omitBy(object, predicate) {
  26681. return pickBy(object, negate(getIteratee(predicate)));
  26682. }
  26683. /**
  26684. * Creates an object composed of the picked `object` properties.
  26685. *
  26686. * @static
  26687. * @since 0.1.0
  26688. * @memberOf _
  26689. * @category Object
  26690. * @param {Object} object The source object.
  26691. * @param {...(string|string[])} [paths] The property paths to pick.
  26692. * @returns {Object} Returns the new object.
  26693. * @example
  26694. *
  26695. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26696. *
  26697. * _.pick(object, ['a', 'c']);
  26698. * // => { 'a': 1, 'c': 3 }
  26699. */
  26700. var pick = flatRest(function(object, paths) {
  26701. return object == null ? {} : basePick(object, paths);
  26702. });
  26703. /**
  26704. * Creates an object composed of the `object` properties `predicate` returns
  26705. * truthy for. The predicate is invoked with two arguments: (value, key).
  26706. *
  26707. * @static
  26708. * @memberOf _
  26709. * @since 4.0.0
  26710. * @category Object
  26711. * @param {Object} object The source object.
  26712. * @param {Function} [predicate=_.identity] The function invoked per property.
  26713. * @returns {Object} Returns the new object.
  26714. * @example
  26715. *
  26716. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26717. *
  26718. * _.pickBy(object, _.isNumber);
  26719. * // => { 'a': 1, 'c': 3 }
  26720. */
  26721. function pickBy(object, predicate) {
  26722. if (object == null) {
  26723. return {};
  26724. }
  26725. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26726. return [prop];
  26727. });
  26728. predicate = getIteratee(predicate);
  26729. return basePickBy(object, props, function(value, path) {
  26730. return predicate(value, path[0]);
  26731. });
  26732. }
  26733. /**
  26734. * This method is like `_.get` except that if the resolved value is a
  26735. * function it's invoked with the `this` binding of its parent object and
  26736. * its result is returned.
  26737. *
  26738. * @static
  26739. * @since 0.1.0
  26740. * @memberOf _
  26741. * @category Object
  26742. * @param {Object} object The object to query.
  26743. * @param {Array|string} path The path of the property to resolve.
  26744. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26745. * @returns {*} Returns the resolved value.
  26746. * @example
  26747. *
  26748. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26749. *
  26750. * _.result(object, 'a[0].b.c1');
  26751. * // => 3
  26752. *
  26753. * _.result(object, 'a[0].b.c2');
  26754. * // => 4
  26755. *
  26756. * _.result(object, 'a[0].b.c3', 'default');
  26757. * // => 'default'
  26758. *
  26759. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26760. * // => 'default'
  26761. */
  26762. function result(object, path, defaultValue) {
  26763. path = castPath(path, object);
  26764. var index = -1,
  26765. length = path.length;
  26766. // Ensure the loop is entered when path is empty.
  26767. if (!length) {
  26768. length = 1;
  26769. object = undefined;
  26770. }
  26771. while (++index < length) {
  26772. var value = object == null ? undefined : object[toKey(path[index])];
  26773. if (value === undefined) {
  26774. index = length;
  26775. value = defaultValue;
  26776. }
  26777. object = isFunction(value) ? value.call(object) : value;
  26778. }
  26779. return object;
  26780. }
  26781. /**
  26782. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26783. * it's created. Arrays are created for missing index properties while objects
  26784. * are created for all other missing properties. Use `_.setWith` to customize
  26785. * `path` creation.
  26786. *
  26787. * **Note:** This method mutates `object`.
  26788. *
  26789. * @static
  26790. * @memberOf _
  26791. * @since 3.7.0
  26792. * @category Object
  26793. * @param {Object} object The object to modify.
  26794. * @param {Array|string} path The path of the property to set.
  26795. * @param {*} value The value to set.
  26796. * @returns {Object} Returns `object`.
  26797. * @example
  26798. *
  26799. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26800. *
  26801. * _.set(object, 'a[0].b.c', 4);
  26802. * console.log(object.a[0].b.c);
  26803. * // => 4
  26804. *
  26805. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26806. * console.log(object.x[0].y.z);
  26807. * // => 5
  26808. */
  26809. function set(object, path, value) {
  26810. return object == null ? object : baseSet(object, path, value);
  26811. }
  26812. /**
  26813. * This method is like `_.set` except that it accepts `customizer` which is
  26814. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26815. * path creation is handled by the method instead. The `customizer` is invoked
  26816. * with three arguments: (nsValue, key, nsObject).
  26817. *
  26818. * **Note:** This method mutates `object`.
  26819. *
  26820. * @static
  26821. * @memberOf _
  26822. * @since 4.0.0
  26823. * @category Object
  26824. * @param {Object} object The object to modify.
  26825. * @param {Array|string} path The path of the property to set.
  26826. * @param {*} value The value to set.
  26827. * @param {Function} [customizer] The function to customize assigned values.
  26828. * @returns {Object} Returns `object`.
  26829. * @example
  26830. *
  26831. * var object = {};
  26832. *
  26833. * _.setWith(object, '[0][1]', 'a', Object);
  26834. * // => { '0': { '1': 'a' } }
  26835. */
  26836. function setWith(object, path, value, customizer) {
  26837. customizer = typeof customizer == 'function' ? customizer : undefined;
  26838. return object == null ? object : baseSet(object, path, value, customizer);
  26839. }
  26840. /**
  26841. * Creates an array of own enumerable string keyed-value pairs for `object`
  26842. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26843. * entries are returned.
  26844. *
  26845. * @static
  26846. * @memberOf _
  26847. * @since 4.0.0
  26848. * @alias entries
  26849. * @category Object
  26850. * @param {Object} object The object to query.
  26851. * @returns {Array} Returns the key-value pairs.
  26852. * @example
  26853. *
  26854. * function Foo() {
  26855. * this.a = 1;
  26856. * this.b = 2;
  26857. * }
  26858. *
  26859. * Foo.prototype.c = 3;
  26860. *
  26861. * _.toPairs(new Foo);
  26862. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26863. */
  26864. var toPairs = createToPairs(keys);
  26865. /**
  26866. * Creates an array of own and inherited enumerable string keyed-value pairs
  26867. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26868. * or set, its entries are returned.
  26869. *
  26870. * @static
  26871. * @memberOf _
  26872. * @since 4.0.0
  26873. * @alias entriesIn
  26874. * @category Object
  26875. * @param {Object} object The object to query.
  26876. * @returns {Array} Returns the key-value pairs.
  26877. * @example
  26878. *
  26879. * function Foo() {
  26880. * this.a = 1;
  26881. * this.b = 2;
  26882. * }
  26883. *
  26884. * Foo.prototype.c = 3;
  26885. *
  26886. * _.toPairsIn(new Foo);
  26887. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26888. */
  26889. var toPairsIn = createToPairs(keysIn);
  26890. /**
  26891. * An alternative to `_.reduce`; this method transforms `object` to a new
  26892. * `accumulator` object which is the result of running each of its own
  26893. * enumerable string keyed properties thru `iteratee`, with each invocation
  26894. * potentially mutating the `accumulator` object. If `accumulator` is not
  26895. * provided, a new object with the same `[[Prototype]]` will be used. The
  26896. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26897. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26898. *
  26899. * @static
  26900. * @memberOf _
  26901. * @since 1.3.0
  26902. * @category Object
  26903. * @param {Object} object The object to iterate over.
  26904. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26905. * @param {*} [accumulator] The custom accumulator value.
  26906. * @returns {*} Returns the accumulated value.
  26907. * @example
  26908. *
  26909. * _.transform([2, 3, 4], function(result, n) {
  26910. * result.push(n *= n);
  26911. * return n % 2 == 0;
  26912. * }, []);
  26913. * // => [4, 9]
  26914. *
  26915. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26916. * (result[value] || (result[value] = [])).push(key);
  26917. * }, {});
  26918. * // => { '1': ['a', 'c'], '2': ['b'] }
  26919. */
  26920. function transform(object, iteratee, accumulator) {
  26921. var isArr = isArray(object),
  26922. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26923. iteratee = getIteratee(iteratee, 4);
  26924. if (accumulator == null) {
  26925. var Ctor = object && object.constructor;
  26926. if (isArrLike) {
  26927. accumulator = isArr ? new Ctor : [];
  26928. }
  26929. else if (isObject(object)) {
  26930. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26931. }
  26932. else {
  26933. accumulator = {};
  26934. }
  26935. }
  26936. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26937. return iteratee(accumulator, value, index, object);
  26938. });
  26939. return accumulator;
  26940. }
  26941. /**
  26942. * Removes the property at `path` of `object`.
  26943. *
  26944. * **Note:** This method mutates `object`.
  26945. *
  26946. * @static
  26947. * @memberOf _
  26948. * @since 4.0.0
  26949. * @category Object
  26950. * @param {Object} object The object to modify.
  26951. * @param {Array|string} path The path of the property to unset.
  26952. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26953. * @example
  26954. *
  26955. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26956. * _.unset(object, 'a[0].b.c');
  26957. * // => true
  26958. *
  26959. * console.log(object);
  26960. * // => { 'a': [{ 'b': {} }] };
  26961. *
  26962. * _.unset(object, ['a', '0', 'b', 'c']);
  26963. * // => true
  26964. *
  26965. * console.log(object);
  26966. * // => { 'a': [{ 'b': {} }] };
  26967. */
  26968. function unset(object, path) {
  26969. return object == null ? true : baseUnset(object, path);
  26970. }
  26971. /**
  26972. * This method is like `_.set` except that accepts `updater` to produce the
  26973. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26974. * is invoked with one argument: (value).
  26975. *
  26976. * **Note:** This method mutates `object`.
  26977. *
  26978. * @static
  26979. * @memberOf _
  26980. * @since 4.6.0
  26981. * @category Object
  26982. * @param {Object} object The object to modify.
  26983. * @param {Array|string} path The path of the property to set.
  26984. * @param {Function} updater The function to produce the updated value.
  26985. * @returns {Object} Returns `object`.
  26986. * @example
  26987. *
  26988. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26989. *
  26990. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  26991. * console.log(object.a[0].b.c);
  26992. * // => 9
  26993. *
  26994. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  26995. * console.log(object.x[0].y.z);
  26996. * // => 0
  26997. */
  26998. function update(object, path, updater) {
  26999. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  27000. }
  27001. /**
  27002. * This method is like `_.update` except that it accepts `customizer` which is
  27003. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  27004. * path creation is handled by the method instead. The `customizer` is invoked
  27005. * with three arguments: (nsValue, key, nsObject).
  27006. *
  27007. * **Note:** This method mutates `object`.
  27008. *
  27009. * @static
  27010. * @memberOf _
  27011. * @since 4.6.0
  27012. * @category Object
  27013. * @param {Object} object The object to modify.
  27014. * @param {Array|string} path The path of the property to set.
  27015. * @param {Function} updater The function to produce the updated value.
  27016. * @param {Function} [customizer] The function to customize assigned values.
  27017. * @returns {Object} Returns `object`.
  27018. * @example
  27019. *
  27020. * var object = {};
  27021. *
  27022. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  27023. * // => { '0': { '1': 'a' } }
  27024. */
  27025. function updateWith(object, path, updater, customizer) {
  27026. customizer = typeof customizer == 'function' ? customizer : undefined;
  27027. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  27028. }
  27029. /**
  27030. * Creates an array of the own enumerable string keyed property values of `object`.
  27031. *
  27032. * **Note:** Non-object values are coerced to objects.
  27033. *
  27034. * @static
  27035. * @since 0.1.0
  27036. * @memberOf _
  27037. * @category Object
  27038. * @param {Object} object The object to query.
  27039. * @returns {Array} Returns the array of property values.
  27040. * @example
  27041. *
  27042. * function Foo() {
  27043. * this.a = 1;
  27044. * this.b = 2;
  27045. * }
  27046. *
  27047. * Foo.prototype.c = 3;
  27048. *
  27049. * _.values(new Foo);
  27050. * // => [1, 2] (iteration order is not guaranteed)
  27051. *
  27052. * _.values('hi');
  27053. * // => ['h', 'i']
  27054. */
  27055. function values(object) {
  27056. return object == null ? [] : baseValues(object, keys(object));
  27057. }
  27058. /**
  27059. * Creates an array of the own and inherited enumerable string keyed property
  27060. * values of `object`.
  27061. *
  27062. * **Note:** Non-object values are coerced to objects.
  27063. *
  27064. * @static
  27065. * @memberOf _
  27066. * @since 3.0.0
  27067. * @category Object
  27068. * @param {Object} object The object to query.
  27069. * @returns {Array} Returns the array of property values.
  27070. * @example
  27071. *
  27072. * function Foo() {
  27073. * this.a = 1;
  27074. * this.b = 2;
  27075. * }
  27076. *
  27077. * Foo.prototype.c = 3;
  27078. *
  27079. * _.valuesIn(new Foo);
  27080. * // => [1, 2, 3] (iteration order is not guaranteed)
  27081. */
  27082. function valuesIn(object) {
  27083. return object == null ? [] : baseValues(object, keysIn(object));
  27084. }
  27085. /*------------------------------------------------------------------------*/
  27086. /**
  27087. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  27088. *
  27089. * @static
  27090. * @memberOf _
  27091. * @since 4.0.0
  27092. * @category Number
  27093. * @param {number} number The number to clamp.
  27094. * @param {number} [lower] The lower bound.
  27095. * @param {number} upper The upper bound.
  27096. * @returns {number} Returns the clamped number.
  27097. * @example
  27098. *
  27099. * _.clamp(-10, -5, 5);
  27100. * // => -5
  27101. *
  27102. * _.clamp(10, -5, 5);
  27103. * // => 5
  27104. */
  27105. function clamp(number, lower, upper) {
  27106. if (upper === undefined) {
  27107. upper = lower;
  27108. lower = undefined;
  27109. }
  27110. if (upper !== undefined) {
  27111. upper = toNumber(upper);
  27112. upper = upper === upper ? upper : 0;
  27113. }
  27114. if (lower !== undefined) {
  27115. lower = toNumber(lower);
  27116. lower = lower === lower ? lower : 0;
  27117. }
  27118. return baseClamp(toNumber(number), lower, upper);
  27119. }
  27120. /**
  27121. * Checks if `n` is between `start` and up to, but not including, `end`. If
  27122. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  27123. * If `start` is greater than `end` the params are swapped to support
  27124. * negative ranges.
  27125. *
  27126. * @static
  27127. * @memberOf _
  27128. * @since 3.3.0
  27129. * @category Number
  27130. * @param {number} number The number to check.
  27131. * @param {number} [start=0] The start of the range.
  27132. * @param {number} end The end of the range.
  27133. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  27134. * @see _.range, _.rangeRight
  27135. * @example
  27136. *
  27137. * _.inRange(3, 2, 4);
  27138. * // => true
  27139. *
  27140. * _.inRange(4, 8);
  27141. * // => true
  27142. *
  27143. * _.inRange(4, 2);
  27144. * // => false
  27145. *
  27146. * _.inRange(2, 2);
  27147. * // => false
  27148. *
  27149. * _.inRange(1.2, 2);
  27150. * // => true
  27151. *
  27152. * _.inRange(5.2, 4);
  27153. * // => false
  27154. *
  27155. * _.inRange(-3, -2, -6);
  27156. * // => true
  27157. */
  27158. function inRange(number, start, end) {
  27159. start = toFinite(start);
  27160. if (end === undefined) {
  27161. end = start;
  27162. start = 0;
  27163. } else {
  27164. end = toFinite(end);
  27165. }
  27166. number = toNumber(number);
  27167. return baseInRange(number, start, end);
  27168. }
  27169. /**
  27170. * Produces a random number between the inclusive `lower` and `upper` bounds.
  27171. * If only one argument is provided a number between `0` and the given number
  27172. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  27173. * floats, a floating-point number is returned instead of an integer.
  27174. *
  27175. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  27176. * floating-point values which can produce unexpected results.
  27177. *
  27178. * @static
  27179. * @memberOf _
  27180. * @since 0.7.0
  27181. * @category Number
  27182. * @param {number} [lower=0] The lower bound.
  27183. * @param {number} [upper=1] The upper bound.
  27184. * @param {boolean} [floating] Specify returning a floating-point number.
  27185. * @returns {number} Returns the random number.
  27186. * @example
  27187. *
  27188. * _.random(0, 5);
  27189. * // => an integer between 0 and 5
  27190. *
  27191. * _.random(5);
  27192. * // => also an integer between 0 and 5
  27193. *
  27194. * _.random(5, true);
  27195. * // => a floating-point number between 0 and 5
  27196. *
  27197. * _.random(1.2, 5.2);
  27198. * // => a floating-point number between 1.2 and 5.2
  27199. */
  27200. function random(lower, upper, floating) {
  27201. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  27202. upper = floating = undefined;
  27203. }
  27204. if (floating === undefined) {
  27205. if (typeof upper == 'boolean') {
  27206. floating = upper;
  27207. upper = undefined;
  27208. }
  27209. else if (typeof lower == 'boolean') {
  27210. floating = lower;
  27211. lower = undefined;
  27212. }
  27213. }
  27214. if (lower === undefined && upper === undefined) {
  27215. lower = 0;
  27216. upper = 1;
  27217. }
  27218. else {
  27219. lower = toFinite(lower);
  27220. if (upper === undefined) {
  27221. upper = lower;
  27222. lower = 0;
  27223. } else {
  27224. upper = toFinite(upper);
  27225. }
  27226. }
  27227. if (lower > upper) {
  27228. var temp = lower;
  27229. lower = upper;
  27230. upper = temp;
  27231. }
  27232. if (floating || lower % 1 || upper % 1) {
  27233. var rand = nativeRandom();
  27234. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  27235. }
  27236. return baseRandom(lower, upper);
  27237. }
  27238. /*------------------------------------------------------------------------*/
  27239. /**
  27240. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  27241. *
  27242. * @static
  27243. * @memberOf _
  27244. * @since 3.0.0
  27245. * @category String
  27246. * @param {string} [string=''] The string to convert.
  27247. * @returns {string} Returns the camel cased string.
  27248. * @example
  27249. *
  27250. * _.camelCase('Foo Bar');
  27251. * // => 'fooBar'
  27252. *
  27253. * _.camelCase('--foo-bar--');
  27254. * // => 'fooBar'
  27255. *
  27256. * _.camelCase('__FOO_BAR__');
  27257. * // => 'fooBar'
  27258. */
  27259. var camelCase = createCompounder(function(result, word, index) {
  27260. word = word.toLowerCase();
  27261. return result + (index ? capitalize(word) : word);
  27262. });
  27263. /**
  27264. * Converts the first character of `string` to upper case and the remaining
  27265. * to lower case.
  27266. *
  27267. * @static
  27268. * @memberOf _
  27269. * @since 3.0.0
  27270. * @category String
  27271. * @param {string} [string=''] The string to capitalize.
  27272. * @returns {string} Returns the capitalized string.
  27273. * @example
  27274. *
  27275. * _.capitalize('FRED');
  27276. * // => 'Fred'
  27277. */
  27278. function capitalize(string) {
  27279. return upperFirst(toString(string).toLowerCase());
  27280. }
  27281. /**
  27282. * Deburrs `string` by converting
  27283. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  27284. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  27285. * letters to basic Latin letters and removing
  27286. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  27287. *
  27288. * @static
  27289. * @memberOf _
  27290. * @since 3.0.0
  27291. * @category String
  27292. * @param {string} [string=''] The string to deburr.
  27293. * @returns {string} Returns the deburred string.
  27294. * @example
  27295. *
  27296. * _.deburr('déjà vu');
  27297. * // => 'deja vu'
  27298. */
  27299. function deburr(string) {
  27300. string = toString(string);
  27301. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  27302. }
  27303. /**
  27304. * Checks if `string` ends with the given target string.
  27305. *
  27306. * @static
  27307. * @memberOf _
  27308. * @since 3.0.0
  27309. * @category String
  27310. * @param {string} [string=''] The string to inspect.
  27311. * @param {string} [target] The string to search for.
  27312. * @param {number} [position=string.length] The position to search up to.
  27313. * @returns {boolean} Returns `true` if `string` ends with `target`,
  27314. * else `false`.
  27315. * @example
  27316. *
  27317. * _.endsWith('abc', 'c');
  27318. * // => true
  27319. *
  27320. * _.endsWith('abc', 'b');
  27321. * // => false
  27322. *
  27323. * _.endsWith('abc', 'b', 2);
  27324. * // => true
  27325. */
  27326. function endsWith(string, target, position) {
  27327. string = toString(string);
  27328. target = baseToString(target);
  27329. var length = string.length;
  27330. position = position === undefined
  27331. ? length
  27332. : baseClamp(toInteger(position), 0, length);
  27333. var end = position;
  27334. position -= target.length;
  27335. return position >= 0 && string.slice(position, end) == target;
  27336. }
  27337. /**
  27338. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  27339. * corresponding HTML entities.
  27340. *
  27341. * **Note:** No other characters are escaped. To escape additional
  27342. * characters use a third-party library like [_he_](https://mths.be/he).
  27343. *
  27344. * Though the ">" character is escaped for symmetry, characters like
  27345. * ">" and "/" don't need escaping in HTML and have no special meaning
  27346. * unless they're part of a tag or unquoted attribute value. See
  27347. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  27348. * (under "semi-related fun fact") for more details.
  27349. *
  27350. * When working with HTML you should always
  27351. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  27352. * XSS vectors.
  27353. *
  27354. * @static
  27355. * @since 0.1.0
  27356. * @memberOf _
  27357. * @category String
  27358. * @param {string} [string=''] The string to escape.
  27359. * @returns {string} Returns the escaped string.
  27360. * @example
  27361. *
  27362. * _.escape('fred, barney, & pebbles');
  27363. * // => 'fred, barney, &amp; pebbles'
  27364. */
  27365. function escape(string) {
  27366. string = toString(string);
  27367. return (string && reHasUnescapedHtml.test(string))
  27368. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  27369. : string;
  27370. }
  27371. /**
  27372. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  27373. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  27374. *
  27375. * @static
  27376. * @memberOf _
  27377. * @since 3.0.0
  27378. * @category String
  27379. * @param {string} [string=''] The string to escape.
  27380. * @returns {string} Returns the escaped string.
  27381. * @example
  27382. *
  27383. * _.escapeRegExp('[lodash](https://lodash.com/)');
  27384. * // => '\[lodash\]\(https://lodash\.com/\)'
  27385. */
  27386. function escapeRegExp(string) {
  27387. string = toString(string);
  27388. return (string && reHasRegExpChar.test(string))
  27389. ? string.replace(reRegExpChar, '\\$&')
  27390. : string;
  27391. }
  27392. /**
  27393. * Converts `string` to
  27394. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  27395. *
  27396. * @static
  27397. * @memberOf _
  27398. * @since 3.0.0
  27399. * @category String
  27400. * @param {string} [string=''] The string to convert.
  27401. * @returns {string} Returns the kebab cased string.
  27402. * @example
  27403. *
  27404. * _.kebabCase('Foo Bar');
  27405. * // => 'foo-bar'
  27406. *
  27407. * _.kebabCase('fooBar');
  27408. * // => 'foo-bar'
  27409. *
  27410. * _.kebabCase('__FOO_BAR__');
  27411. * // => 'foo-bar'
  27412. */
  27413. var kebabCase = createCompounder(function(result, word, index) {
  27414. return result + (index ? '-' : '') + word.toLowerCase();
  27415. });
  27416. /**
  27417. * Converts `string`, as space separated words, to lower case.
  27418. *
  27419. * @static
  27420. * @memberOf _
  27421. * @since 4.0.0
  27422. * @category String
  27423. * @param {string} [string=''] The string to convert.
  27424. * @returns {string} Returns the lower cased string.
  27425. * @example
  27426. *
  27427. * _.lowerCase('--Foo-Bar--');
  27428. * // => 'foo bar'
  27429. *
  27430. * _.lowerCase('fooBar');
  27431. * // => 'foo bar'
  27432. *
  27433. * _.lowerCase('__FOO_BAR__');
  27434. * // => 'foo bar'
  27435. */
  27436. var lowerCase = createCompounder(function(result, word, index) {
  27437. return result + (index ? ' ' : '') + word.toLowerCase();
  27438. });
  27439. /**
  27440. * Converts the first character of `string` to lower case.
  27441. *
  27442. * @static
  27443. * @memberOf _
  27444. * @since 4.0.0
  27445. * @category String
  27446. * @param {string} [string=''] The string to convert.
  27447. * @returns {string} Returns the converted string.
  27448. * @example
  27449. *
  27450. * _.lowerFirst('Fred');
  27451. * // => 'fred'
  27452. *
  27453. * _.lowerFirst('FRED');
  27454. * // => 'fRED'
  27455. */
  27456. var lowerFirst = createCaseFirst('toLowerCase');
  27457. /**
  27458. * Pads `string` on the left and right sides if it's shorter than `length`.
  27459. * Padding characters are truncated if they can't be evenly divided by `length`.
  27460. *
  27461. * @static
  27462. * @memberOf _
  27463. * @since 3.0.0
  27464. * @category String
  27465. * @param {string} [string=''] The string to pad.
  27466. * @param {number} [length=0] The padding length.
  27467. * @param {string} [chars=' '] The string used as padding.
  27468. * @returns {string} Returns the padded string.
  27469. * @example
  27470. *
  27471. * _.pad('abc', 8);
  27472. * // => ' abc '
  27473. *
  27474. * _.pad('abc', 8, '_-');
  27475. * // => '_-abc_-_'
  27476. *
  27477. * _.pad('abc', 3);
  27478. * // => 'abc'
  27479. */
  27480. function pad(string, length, chars) {
  27481. string = toString(string);
  27482. length = toInteger(length);
  27483. var strLength = length ? stringSize(string) : 0;
  27484. if (!length || strLength >= length) {
  27485. return string;
  27486. }
  27487. var mid = (length - strLength) / 2;
  27488. return (
  27489. createPadding(nativeFloor(mid), chars) +
  27490. string +
  27491. createPadding(nativeCeil(mid), chars)
  27492. );
  27493. }
  27494. /**
  27495. * Pads `string` on the right side if it's shorter than `length`. Padding
  27496. * characters are truncated if they exceed `length`.
  27497. *
  27498. * @static
  27499. * @memberOf _
  27500. * @since 4.0.0
  27501. * @category String
  27502. * @param {string} [string=''] The string to pad.
  27503. * @param {number} [length=0] The padding length.
  27504. * @param {string} [chars=' '] The string used as padding.
  27505. * @returns {string} Returns the padded string.
  27506. * @example
  27507. *
  27508. * _.padEnd('abc', 6);
  27509. * // => 'abc '
  27510. *
  27511. * _.padEnd('abc', 6, '_-');
  27512. * // => 'abc_-_'
  27513. *
  27514. * _.padEnd('abc', 3);
  27515. * // => 'abc'
  27516. */
  27517. function padEnd(string, length, chars) {
  27518. string = toString(string);
  27519. length = toInteger(length);
  27520. var strLength = length ? stringSize(string) : 0;
  27521. return (length && strLength < length)
  27522. ? (string + createPadding(length - strLength, chars))
  27523. : string;
  27524. }
  27525. /**
  27526. * Pads `string` on the left side if it's shorter than `length`. Padding
  27527. * characters are truncated if they exceed `length`.
  27528. *
  27529. * @static
  27530. * @memberOf _
  27531. * @since 4.0.0
  27532. * @category String
  27533. * @param {string} [string=''] The string to pad.
  27534. * @param {number} [length=0] The padding length.
  27535. * @param {string} [chars=' '] The string used as padding.
  27536. * @returns {string} Returns the padded string.
  27537. * @example
  27538. *
  27539. * _.padStart('abc', 6);
  27540. * // => ' abc'
  27541. *
  27542. * _.padStart('abc', 6, '_-');
  27543. * // => '_-_abc'
  27544. *
  27545. * _.padStart('abc', 3);
  27546. * // => 'abc'
  27547. */
  27548. function padStart(string, length, chars) {
  27549. string = toString(string);
  27550. length = toInteger(length);
  27551. var strLength = length ? stringSize(string) : 0;
  27552. return (length && strLength < length)
  27553. ? (createPadding(length - strLength, chars) + string)
  27554. : string;
  27555. }
  27556. /**
  27557. * Converts `string` to an integer of the specified radix. If `radix` is
  27558. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  27559. * hexadecimal, in which case a `radix` of `16` is used.
  27560. *
  27561. * **Note:** This method aligns with the
  27562. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  27563. *
  27564. * @static
  27565. * @memberOf _
  27566. * @since 1.1.0
  27567. * @category String
  27568. * @param {string} string The string to convert.
  27569. * @param {number} [radix=10] The radix to interpret `value` by.
  27570. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27571. * @returns {number} Returns the converted integer.
  27572. * @example
  27573. *
  27574. * _.parseInt('08');
  27575. * // => 8
  27576. *
  27577. * _.map(['6', '08', '10'], _.parseInt);
  27578. * // => [6, 8, 10]
  27579. */
  27580. function parseInt(string, radix, guard) {
  27581. if (guard || radix == null) {
  27582. radix = 0;
  27583. } else if (radix) {
  27584. radix = +radix;
  27585. }
  27586. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  27587. }
  27588. /**
  27589. * Repeats the given string `n` times.
  27590. *
  27591. * @static
  27592. * @memberOf _
  27593. * @since 3.0.0
  27594. * @category String
  27595. * @param {string} [string=''] The string to repeat.
  27596. * @param {number} [n=1] The number of times to repeat the string.
  27597. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27598. * @returns {string} Returns the repeated string.
  27599. * @example
  27600. *
  27601. * _.repeat('*', 3);
  27602. * // => '***'
  27603. *
  27604. * _.repeat('abc', 2);
  27605. * // => 'abcabc'
  27606. *
  27607. * _.repeat('abc', 0);
  27608. * // => ''
  27609. */
  27610. function repeat(string, n, guard) {
  27611. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27612. n = 1;
  27613. } else {
  27614. n = toInteger(n);
  27615. }
  27616. return baseRepeat(toString(string), n);
  27617. }
  27618. /**
  27619. * Replaces matches for `pattern` in `string` with `replacement`.
  27620. *
  27621. * **Note:** This method is based on
  27622. * [`String#replace`](https://mdn.io/String/replace).
  27623. *
  27624. * @static
  27625. * @memberOf _
  27626. * @since 4.0.0
  27627. * @category String
  27628. * @param {string} [string=''] The string to modify.
  27629. * @param {RegExp|string} pattern The pattern to replace.
  27630. * @param {Function|string} replacement The match replacement.
  27631. * @returns {string} Returns the modified string.
  27632. * @example
  27633. *
  27634. * _.replace('Hi Fred', 'Fred', 'Barney');
  27635. * // => 'Hi Barney'
  27636. */
  27637. function replace() {
  27638. var args = arguments,
  27639. string = toString(args[0]);
  27640. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27641. }
  27642. /**
  27643. * Converts `string` to
  27644. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27645. *
  27646. * @static
  27647. * @memberOf _
  27648. * @since 3.0.0
  27649. * @category String
  27650. * @param {string} [string=''] The string to convert.
  27651. * @returns {string} Returns the snake cased string.
  27652. * @example
  27653. *
  27654. * _.snakeCase('Foo Bar');
  27655. * // => 'foo_bar'
  27656. *
  27657. * _.snakeCase('fooBar');
  27658. * // => 'foo_bar'
  27659. *
  27660. * _.snakeCase('--FOO-BAR--');
  27661. * // => 'foo_bar'
  27662. */
  27663. var snakeCase = createCompounder(function(result, word, index) {
  27664. return result + (index ? '_' : '') + word.toLowerCase();
  27665. });
  27666. /**
  27667. * Splits `string` by `separator`.
  27668. *
  27669. * **Note:** This method is based on
  27670. * [`String#split`](https://mdn.io/String/split).
  27671. *
  27672. * @static
  27673. * @memberOf _
  27674. * @since 4.0.0
  27675. * @category String
  27676. * @param {string} [string=''] The string to split.
  27677. * @param {RegExp|string} separator The separator pattern to split by.
  27678. * @param {number} [limit] The length to truncate results to.
  27679. * @returns {Array} Returns the string segments.
  27680. * @example
  27681. *
  27682. * _.split('a-b-c', '-', 2);
  27683. * // => ['a', 'b']
  27684. */
  27685. function split(string, separator, limit) {
  27686. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27687. separator = limit = undefined;
  27688. }
  27689. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27690. if (!limit) {
  27691. return [];
  27692. }
  27693. string = toString(string);
  27694. if (string && (
  27695. typeof separator == 'string' ||
  27696. (separator != null && !isRegExp(separator))
  27697. )) {
  27698. separator = baseToString(separator);
  27699. if (!separator && hasUnicode(string)) {
  27700. return castSlice(stringToArray(string), 0, limit);
  27701. }
  27702. }
  27703. return string.split(separator, limit);
  27704. }
  27705. /**
  27706. * Converts `string` to
  27707. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27708. *
  27709. * @static
  27710. * @memberOf _
  27711. * @since 3.1.0
  27712. * @category String
  27713. * @param {string} [string=''] The string to convert.
  27714. * @returns {string} Returns the start cased string.
  27715. * @example
  27716. *
  27717. * _.startCase('--foo-bar--');
  27718. * // => 'Foo Bar'
  27719. *
  27720. * _.startCase('fooBar');
  27721. * // => 'Foo Bar'
  27722. *
  27723. * _.startCase('__FOO_BAR__');
  27724. * // => 'FOO BAR'
  27725. */
  27726. var startCase = createCompounder(function(result, word, index) {
  27727. return result + (index ? ' ' : '') + upperFirst(word);
  27728. });
  27729. /**
  27730. * Checks if `string` starts with the given target string.
  27731. *
  27732. * @static
  27733. * @memberOf _
  27734. * @since 3.0.0
  27735. * @category String
  27736. * @param {string} [string=''] The string to inspect.
  27737. * @param {string} [target] The string to search for.
  27738. * @param {number} [position=0] The position to search from.
  27739. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27740. * else `false`.
  27741. * @example
  27742. *
  27743. * _.startsWith('abc', 'a');
  27744. * // => true
  27745. *
  27746. * _.startsWith('abc', 'b');
  27747. * // => false
  27748. *
  27749. * _.startsWith('abc', 'b', 1);
  27750. * // => true
  27751. */
  27752. function startsWith(string, target, position) {
  27753. string = toString(string);
  27754. position = position == null
  27755. ? 0
  27756. : baseClamp(toInteger(position), 0, string.length);
  27757. target = baseToString(target);
  27758. return string.slice(position, position + target.length) == target;
  27759. }
  27760. /**
  27761. * Creates a compiled template function that can interpolate data properties
  27762. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27763. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27764. * properties may be accessed as free variables in the template. If a setting
  27765. * object is given, it takes precedence over `_.templateSettings` values.
  27766. *
  27767. * **Note:** In the development build `_.template` utilizes
  27768. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27769. * for easier debugging.
  27770. *
  27771. * For more information on precompiling templates see
  27772. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27773. *
  27774. * For more information on Chrome extension sandboxes see
  27775. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27776. *
  27777. * @static
  27778. * @since 0.1.0
  27779. * @memberOf _
  27780. * @category String
  27781. * @param {string} [string=''] The template string.
  27782. * @param {Object} [options={}] The options object.
  27783. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27784. * The HTML "escape" delimiter.
  27785. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27786. * The "evaluate" delimiter.
  27787. * @param {Object} [options.imports=_.templateSettings.imports]
  27788. * An object to import into the template as free variables.
  27789. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27790. * The "interpolate" delimiter.
  27791. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27792. * The sourceURL of the compiled template.
  27793. * @param {string} [options.variable='obj']
  27794. * The data object variable name.
  27795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27796. * @returns {Function} Returns the compiled template function.
  27797. * @example
  27798. *
  27799. * // Use the "interpolate" delimiter to create a compiled template.
  27800. * var compiled = _.template('hello <%= user %>!');
  27801. * compiled({ 'user': 'fred' });
  27802. * // => 'hello fred!'
  27803. *
  27804. * // Use the HTML "escape" delimiter to escape data property values.
  27805. * var compiled = _.template('<b><%- value %></b>');
  27806. * compiled({ 'value': '<script>' });
  27807. * // => '<b>&lt;script&gt;</b>'
  27808. *
  27809. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27810. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27811. * compiled({ 'users': ['fred', 'barney'] });
  27812. * // => '<li>fred</li><li>barney</li>'
  27813. *
  27814. * // Use the internal `print` function in "evaluate" delimiters.
  27815. * var compiled = _.template('<% print("hello " + user); %>!');
  27816. * compiled({ 'user': 'barney' });
  27817. * // => 'hello barney!'
  27818. *
  27819. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27820. * // Disable support by replacing the "interpolate" delimiter.
  27821. * var compiled = _.template('hello ${ user }!');
  27822. * compiled({ 'user': 'pebbles' });
  27823. * // => 'hello pebbles!'
  27824. *
  27825. * // Use backslashes to treat delimiters as plain text.
  27826. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27827. * compiled({ 'value': 'ignored' });
  27828. * // => '<%- value %>'
  27829. *
  27830. * // Use the `imports` option to import `jQuery` as `jq`.
  27831. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27832. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27833. * compiled({ 'users': ['fred', 'barney'] });
  27834. * // => '<li>fred</li><li>barney</li>'
  27835. *
  27836. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27837. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27838. * compiled(data);
  27839. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27840. *
  27841. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27842. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27843. * compiled.source;
  27844. * // => function(data) {
  27845. * // var __t, __p = '';
  27846. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27847. * // return __p;
  27848. * // }
  27849. *
  27850. * // Use custom template delimiters.
  27851. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27852. * var compiled = _.template('hello {{ user }}!');
  27853. * compiled({ 'user': 'mustache' });
  27854. * // => 'hello mustache!'
  27855. *
  27856. * // Use the `source` property to inline compiled templates for meaningful
  27857. * // line numbers in error messages and stack traces.
  27858. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27859. * var JST = {\
  27860. * "main": ' + _.template(mainText).source + '\
  27861. * };\
  27862. * ');
  27863. */
  27864. function template(string, options, guard) {
  27865. // Based on John Resig's `tmpl` implementation
  27866. // (http://ejohn.org/blog/javascript-micro-templating/)
  27867. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27868. var settings = lodash.templateSettings;
  27869. if (guard && isIterateeCall(string, options, guard)) {
  27870. options = undefined;
  27871. }
  27872. string = toString(string);
  27873. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27874. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27875. importsKeys = keys(imports),
  27876. importsValues = baseValues(imports, importsKeys);
  27877. var isEscaping,
  27878. isEvaluating,
  27879. index = 0,
  27880. interpolate = options.interpolate || reNoMatch,
  27881. source = "__p += '";
  27882. // Compile the regexp to match each delimiter.
  27883. var reDelimiters = RegExp(
  27884. (options.escape || reNoMatch).source + '|' +
  27885. interpolate.source + '|' +
  27886. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27887. (options.evaluate || reNoMatch).source + '|$'
  27888. , 'g');
  27889. // Use a sourceURL for easier debugging.
  27890. // The sourceURL gets injected into the source that's eval-ed, so be careful
  27891. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  27892. // and escape the comment, thus injecting code that gets evaled.
  27893. var sourceURL = '//# sourceURL=' +
  27894. (hasOwnProperty.call(options, 'sourceURL')
  27895. ? (options.sourceURL + '').replace(/\s/g, ' ')
  27896. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27897. ) + '\n';
  27898. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27899. interpolateValue || (interpolateValue = esTemplateValue);
  27900. // Escape characters that can't be included in string literals.
  27901. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27902. // Replace delimiters with snippets.
  27903. if (escapeValue) {
  27904. isEscaping = true;
  27905. source += "' +\n__e(" + escapeValue + ") +\n'";
  27906. }
  27907. if (evaluateValue) {
  27908. isEvaluating = true;
  27909. source += "';\n" + evaluateValue + ";\n__p += '";
  27910. }
  27911. if (interpolateValue) {
  27912. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27913. }
  27914. index = offset + match.length;
  27915. // The JS engine embedded in Adobe products needs `match` returned in
  27916. // order to produce the correct `offset` value.
  27917. return match;
  27918. });
  27919. source += "';\n";
  27920. // If `variable` is not specified wrap a with-statement around the generated
  27921. // code to add the data object to the top of the scope chain.
  27922. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  27923. if (!variable) {
  27924. source = 'with (obj) {\n' + source + '\n}\n';
  27925. }
  27926. // Cleanup code by stripping empty strings.
  27927. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27928. .replace(reEmptyStringMiddle, '$1')
  27929. .replace(reEmptyStringTrailing, '$1;');
  27930. // Frame code as the function body.
  27931. source = 'function(' + (variable || 'obj') + ') {\n' +
  27932. (variable
  27933. ? ''
  27934. : 'obj || (obj = {});\n'
  27935. ) +
  27936. "var __t, __p = ''" +
  27937. (isEscaping
  27938. ? ', __e = _.escape'
  27939. : ''
  27940. ) +
  27941. (isEvaluating
  27942. ? ', __j = Array.prototype.join;\n' +
  27943. "function print() { __p += __j.call(arguments, '') }\n"
  27944. : ';\n'
  27945. ) +
  27946. source +
  27947. 'return __p\n}';
  27948. var result = attempt(function() {
  27949. return Function(importsKeys, sourceURL + 'return ' + source)
  27950. .apply(undefined, importsValues);
  27951. });
  27952. // Provide the compiled function's source by its `toString` method or
  27953. // the `source` property as a convenience for inlining compiled templates.
  27954. result.source = source;
  27955. if (isError(result)) {
  27956. throw result;
  27957. }
  27958. return result;
  27959. }
  27960. /**
  27961. * Converts `string`, as a whole, to lower case just like
  27962. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27963. *
  27964. * @static
  27965. * @memberOf _
  27966. * @since 4.0.0
  27967. * @category String
  27968. * @param {string} [string=''] The string to convert.
  27969. * @returns {string} Returns the lower cased string.
  27970. * @example
  27971. *
  27972. * _.toLower('--Foo-Bar--');
  27973. * // => '--foo-bar--'
  27974. *
  27975. * _.toLower('fooBar');
  27976. * // => 'foobar'
  27977. *
  27978. * _.toLower('__FOO_BAR__');
  27979. * // => '__foo_bar__'
  27980. */
  27981. function toLower(value) {
  27982. return toString(value).toLowerCase();
  27983. }
  27984. /**
  27985. * Converts `string`, as a whole, to upper case just like
  27986. * [String#toUpperCase](https://mdn.io/toUpperCase).
  27987. *
  27988. * @static
  27989. * @memberOf _
  27990. * @since 4.0.0
  27991. * @category String
  27992. * @param {string} [string=''] The string to convert.
  27993. * @returns {string} Returns the upper cased string.
  27994. * @example
  27995. *
  27996. * _.toUpper('--foo-bar--');
  27997. * // => '--FOO-BAR--'
  27998. *
  27999. * _.toUpper('fooBar');
  28000. * // => 'FOOBAR'
  28001. *
  28002. * _.toUpper('__foo_bar__');
  28003. * // => '__FOO_BAR__'
  28004. */
  28005. function toUpper(value) {
  28006. return toString(value).toUpperCase();
  28007. }
  28008. /**
  28009. * Removes leading and trailing whitespace or specified characters from `string`.
  28010. *
  28011. * @static
  28012. * @memberOf _
  28013. * @since 3.0.0
  28014. * @category String
  28015. * @param {string} [string=''] The string to trim.
  28016. * @param {string} [chars=whitespace] The characters to trim.
  28017. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28018. * @returns {string} Returns the trimmed string.
  28019. * @example
  28020. *
  28021. * _.trim(' abc ');
  28022. * // => 'abc'
  28023. *
  28024. * _.trim('-_-abc-_-', '_-');
  28025. * // => 'abc'
  28026. *
  28027. * _.map([' foo ', ' bar '], _.trim);
  28028. * // => ['foo', 'bar']
  28029. */
  28030. function trim(string, chars, guard) {
  28031. string = toString(string);
  28032. if (string && (guard || chars === undefined)) {
  28033. return string.replace(reTrim, '');
  28034. }
  28035. if (!string || !(chars = baseToString(chars))) {
  28036. return string;
  28037. }
  28038. var strSymbols = stringToArray(string),
  28039. chrSymbols = stringToArray(chars),
  28040. start = charsStartIndex(strSymbols, chrSymbols),
  28041. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  28042. return castSlice(strSymbols, start, end).join('');
  28043. }
  28044. /**
  28045. * Removes trailing whitespace or specified characters from `string`.
  28046. *
  28047. * @static
  28048. * @memberOf _
  28049. * @since 4.0.0
  28050. * @category String
  28051. * @param {string} [string=''] The string to trim.
  28052. * @param {string} [chars=whitespace] The characters to trim.
  28053. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28054. * @returns {string} Returns the trimmed string.
  28055. * @example
  28056. *
  28057. * _.trimEnd(' abc ');
  28058. * // => ' abc'
  28059. *
  28060. * _.trimEnd('-_-abc-_-', '_-');
  28061. * // => '-_-abc'
  28062. */
  28063. function trimEnd(string, chars, guard) {
  28064. string = toString(string);
  28065. if (string && (guard || chars === undefined)) {
  28066. return string.replace(reTrimEnd, '');
  28067. }
  28068. if (!string || !(chars = baseToString(chars))) {
  28069. return string;
  28070. }
  28071. var strSymbols = stringToArray(string),
  28072. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  28073. return castSlice(strSymbols, 0, end).join('');
  28074. }
  28075. /**
  28076. * Removes leading whitespace or specified characters from `string`.
  28077. *
  28078. * @static
  28079. * @memberOf _
  28080. * @since 4.0.0
  28081. * @category String
  28082. * @param {string} [string=''] The string to trim.
  28083. * @param {string} [chars=whitespace] The characters to trim.
  28084. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28085. * @returns {string} Returns the trimmed string.
  28086. * @example
  28087. *
  28088. * _.trimStart(' abc ');
  28089. * // => 'abc '
  28090. *
  28091. * _.trimStart('-_-abc-_-', '_-');
  28092. * // => 'abc-_-'
  28093. */
  28094. function trimStart(string, chars, guard) {
  28095. string = toString(string);
  28096. if (string && (guard || chars === undefined)) {
  28097. return string.replace(reTrimStart, '');
  28098. }
  28099. if (!string || !(chars = baseToString(chars))) {
  28100. return string;
  28101. }
  28102. var strSymbols = stringToArray(string),
  28103. start = charsStartIndex(strSymbols, stringToArray(chars));
  28104. return castSlice(strSymbols, start).join('');
  28105. }
  28106. /**
  28107. * Truncates `string` if it's longer than the given maximum string length.
  28108. * The last characters of the truncated string are replaced with the omission
  28109. * string which defaults to "...".
  28110. *
  28111. * @static
  28112. * @memberOf _
  28113. * @since 4.0.0
  28114. * @category String
  28115. * @param {string} [string=''] The string to truncate.
  28116. * @param {Object} [options={}] The options object.
  28117. * @param {number} [options.length=30] The maximum string length.
  28118. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  28119. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  28120. * @returns {string} Returns the truncated string.
  28121. * @example
  28122. *
  28123. * _.truncate('hi-diddly-ho there, neighborino');
  28124. * // => 'hi-diddly-ho there, neighbo...'
  28125. *
  28126. * _.truncate('hi-diddly-ho there, neighborino', {
  28127. * 'length': 24,
  28128. * 'separator': ' '
  28129. * });
  28130. * // => 'hi-diddly-ho there,...'
  28131. *
  28132. * _.truncate('hi-diddly-ho there, neighborino', {
  28133. * 'length': 24,
  28134. * 'separator': /,? +/
  28135. * });
  28136. * // => 'hi-diddly-ho there...'
  28137. *
  28138. * _.truncate('hi-diddly-ho there, neighborino', {
  28139. * 'omission': ' [...]'
  28140. * });
  28141. * // => 'hi-diddly-ho there, neig [...]'
  28142. */
  28143. function truncate(string, options) {
  28144. var length = DEFAULT_TRUNC_LENGTH,
  28145. omission = DEFAULT_TRUNC_OMISSION;
  28146. if (isObject(options)) {
  28147. var separator = 'separator' in options ? options.separator : separator;
  28148. length = 'length' in options ? toInteger(options.length) : length;
  28149. omission = 'omission' in options ? baseToString(options.omission) : omission;
  28150. }
  28151. string = toString(string);
  28152. var strLength = string.length;
  28153. if (hasUnicode(string)) {
  28154. var strSymbols = stringToArray(string);
  28155. strLength = strSymbols.length;
  28156. }
  28157. if (length >= strLength) {
  28158. return string;
  28159. }
  28160. var end = length - stringSize(omission);
  28161. if (end < 1) {
  28162. return omission;
  28163. }
  28164. var result = strSymbols
  28165. ? castSlice(strSymbols, 0, end).join('')
  28166. : string.slice(0, end);
  28167. if (separator === undefined) {
  28168. return result + omission;
  28169. }
  28170. if (strSymbols) {
  28171. end += (result.length - end);
  28172. }
  28173. if (isRegExp(separator)) {
  28174. if (string.slice(end).search(separator)) {
  28175. var match,
  28176. substring = result;
  28177. if (!separator.global) {
  28178. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  28179. }
  28180. separator.lastIndex = 0;
  28181. while ((match = separator.exec(substring))) {
  28182. var newEnd = match.index;
  28183. }
  28184. result = result.slice(0, newEnd === undefined ? end : newEnd);
  28185. }
  28186. } else if (string.indexOf(baseToString(separator), end) != end) {
  28187. var index = result.lastIndexOf(separator);
  28188. if (index > -1) {
  28189. result = result.slice(0, index);
  28190. }
  28191. }
  28192. return result + omission;
  28193. }
  28194. /**
  28195. * The inverse of `_.escape`; this method converts the HTML entities
  28196. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  28197. * their corresponding characters.
  28198. *
  28199. * **Note:** No other HTML entities are unescaped. To unescape additional
  28200. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  28201. *
  28202. * @static
  28203. * @memberOf _
  28204. * @since 0.6.0
  28205. * @category String
  28206. * @param {string} [string=''] The string to unescape.
  28207. * @returns {string} Returns the unescaped string.
  28208. * @example
  28209. *
  28210. * _.unescape('fred, barney, &amp; pebbles');
  28211. * // => 'fred, barney, & pebbles'
  28212. */
  28213. function unescape(string) {
  28214. string = toString(string);
  28215. return (string && reHasEscapedHtml.test(string))
  28216. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  28217. : string;
  28218. }
  28219. /**
  28220. * Converts `string`, as space separated words, to upper case.
  28221. *
  28222. * @static
  28223. * @memberOf _
  28224. * @since 4.0.0
  28225. * @category String
  28226. * @param {string} [string=''] The string to convert.
  28227. * @returns {string} Returns the upper cased string.
  28228. * @example
  28229. *
  28230. * _.upperCase('--foo-bar');
  28231. * // => 'FOO BAR'
  28232. *
  28233. * _.upperCase('fooBar');
  28234. * // => 'FOO BAR'
  28235. *
  28236. * _.upperCase('__foo_bar__');
  28237. * // => 'FOO BAR'
  28238. */
  28239. var upperCase = createCompounder(function(result, word, index) {
  28240. return result + (index ? ' ' : '') + word.toUpperCase();
  28241. });
  28242. /**
  28243. * Converts the first character of `string` to upper case.
  28244. *
  28245. * @static
  28246. * @memberOf _
  28247. * @since 4.0.0
  28248. * @category String
  28249. * @param {string} [string=''] The string to convert.
  28250. * @returns {string} Returns the converted string.
  28251. * @example
  28252. *
  28253. * _.upperFirst('fred');
  28254. * // => 'Fred'
  28255. *
  28256. * _.upperFirst('FRED');
  28257. * // => 'FRED'
  28258. */
  28259. var upperFirst = createCaseFirst('toUpperCase');
  28260. /**
  28261. * Splits `string` into an array of its words.
  28262. *
  28263. * @static
  28264. * @memberOf _
  28265. * @since 3.0.0
  28266. * @category String
  28267. * @param {string} [string=''] The string to inspect.
  28268. * @param {RegExp|string} [pattern] The pattern to match words.
  28269. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28270. * @returns {Array} Returns the words of `string`.
  28271. * @example
  28272. *
  28273. * _.words('fred, barney, & pebbles');
  28274. * // => ['fred', 'barney', 'pebbles']
  28275. *
  28276. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  28277. * // => ['fred', 'barney', '&', 'pebbles']
  28278. */
  28279. function words(string, pattern, guard) {
  28280. string = toString(string);
  28281. pattern = guard ? undefined : pattern;
  28282. if (pattern === undefined) {
  28283. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  28284. }
  28285. return string.match(pattern) || [];
  28286. }
  28287. /*------------------------------------------------------------------------*/
  28288. /**
  28289. * Attempts to invoke `func`, returning either the result or the caught error
  28290. * object. Any additional arguments are provided to `func` when it's invoked.
  28291. *
  28292. * @static
  28293. * @memberOf _
  28294. * @since 3.0.0
  28295. * @category Util
  28296. * @param {Function} func The function to attempt.
  28297. * @param {...*} [args] The arguments to invoke `func` with.
  28298. * @returns {*} Returns the `func` result or error object.
  28299. * @example
  28300. *
  28301. * // Avoid throwing errors for invalid selectors.
  28302. * var elements = _.attempt(function(selector) {
  28303. * return document.querySelectorAll(selector);
  28304. * }, '>_>');
  28305. *
  28306. * if (_.isError(elements)) {
  28307. * elements = [];
  28308. * }
  28309. */
  28310. var attempt = baseRest(function(func, args) {
  28311. try {
  28312. return apply(func, undefined, args);
  28313. } catch (e) {
  28314. return isError(e) ? e : new Error(e);
  28315. }
  28316. });
  28317. /**
  28318. * Binds methods of an object to the object itself, overwriting the existing
  28319. * method.
  28320. *
  28321. * **Note:** This method doesn't set the "length" property of bound functions.
  28322. *
  28323. * @static
  28324. * @since 0.1.0
  28325. * @memberOf _
  28326. * @category Util
  28327. * @param {Object} object The object to bind and assign the bound methods to.
  28328. * @param {...(string|string[])} methodNames The object method names to bind.
  28329. * @returns {Object} Returns `object`.
  28330. * @example
  28331. *
  28332. * var view = {
  28333. * 'label': 'docs',
  28334. * 'click': function() {
  28335. * console.log('clicked ' + this.label);
  28336. * }
  28337. * };
  28338. *
  28339. * _.bindAll(view, ['click']);
  28340. * jQuery(element).on('click', view.click);
  28341. * // => Logs 'clicked docs' when clicked.
  28342. */
  28343. var bindAll = flatRest(function(object, methodNames) {
  28344. arrayEach(methodNames, function(key) {
  28345. key = toKey(key);
  28346. baseAssignValue(object, key, bind(object[key], object));
  28347. });
  28348. return object;
  28349. });
  28350. /**
  28351. * Creates a function that iterates over `pairs` and invokes the corresponding
  28352. * function of the first predicate to return truthy. The predicate-function
  28353. * pairs are invoked with the `this` binding and arguments of the created
  28354. * function.
  28355. *
  28356. * @static
  28357. * @memberOf _
  28358. * @since 4.0.0
  28359. * @category Util
  28360. * @param {Array} pairs The predicate-function pairs.
  28361. * @returns {Function} Returns the new composite function.
  28362. * @example
  28363. *
  28364. * var func = _.cond([
  28365. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  28366. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  28367. * [_.stubTrue, _.constant('no match')]
  28368. * ]);
  28369. *
  28370. * func({ 'a': 1, 'b': 2 });
  28371. * // => 'matches A'
  28372. *
  28373. * func({ 'a': 0, 'b': 1 });
  28374. * // => 'matches B'
  28375. *
  28376. * func({ 'a': '1', 'b': '2' });
  28377. * // => 'no match'
  28378. */
  28379. function cond(pairs) {
  28380. var length = pairs == null ? 0 : pairs.length,
  28381. toIteratee = getIteratee();
  28382. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  28383. if (typeof pair[1] != 'function') {
  28384. throw new TypeError(FUNC_ERROR_TEXT);
  28385. }
  28386. return [toIteratee(pair[0]), pair[1]];
  28387. });
  28388. return baseRest(function(args) {
  28389. var index = -1;
  28390. while (++index < length) {
  28391. var pair = pairs[index];
  28392. if (apply(pair[0], this, args)) {
  28393. return apply(pair[1], this, args);
  28394. }
  28395. }
  28396. });
  28397. }
  28398. /**
  28399. * Creates a function that invokes the predicate properties of `source` with
  28400. * the corresponding property values of a given object, returning `true` if
  28401. * all predicates return truthy, else `false`.
  28402. *
  28403. * **Note:** The created function is equivalent to `_.conformsTo` with
  28404. * `source` partially applied.
  28405. *
  28406. * @static
  28407. * @memberOf _
  28408. * @since 4.0.0
  28409. * @category Util
  28410. * @param {Object} source The object of property predicates to conform to.
  28411. * @returns {Function} Returns the new spec function.
  28412. * @example
  28413. *
  28414. * var objects = [
  28415. * { 'a': 2, 'b': 1 },
  28416. * { 'a': 1, 'b': 2 }
  28417. * ];
  28418. *
  28419. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  28420. * // => [{ 'a': 1, 'b': 2 }]
  28421. */
  28422. function conforms(source) {
  28423. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  28424. }
  28425. /**
  28426. * Creates a function that returns `value`.
  28427. *
  28428. * @static
  28429. * @memberOf _
  28430. * @since 2.4.0
  28431. * @category Util
  28432. * @param {*} value The value to return from the new function.
  28433. * @returns {Function} Returns the new constant function.
  28434. * @example
  28435. *
  28436. * var objects = _.times(2, _.constant({ 'a': 1 }));
  28437. *
  28438. * console.log(objects);
  28439. * // => [{ 'a': 1 }, { 'a': 1 }]
  28440. *
  28441. * console.log(objects[0] === objects[1]);
  28442. * // => true
  28443. */
  28444. function constant(value) {
  28445. return function() {
  28446. return value;
  28447. };
  28448. }
  28449. /**
  28450. * Checks `value` to determine whether a default value should be returned in
  28451. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  28452. * or `undefined`.
  28453. *
  28454. * @static
  28455. * @memberOf _
  28456. * @since 4.14.0
  28457. * @category Util
  28458. * @param {*} value The value to check.
  28459. * @param {*} defaultValue The default value.
  28460. * @returns {*} Returns the resolved value.
  28461. * @example
  28462. *
  28463. * _.defaultTo(1, 10);
  28464. * // => 1
  28465. *
  28466. * _.defaultTo(undefined, 10);
  28467. * // => 10
  28468. */
  28469. function defaultTo(value, defaultValue) {
  28470. return (value == null || value !== value) ? defaultValue : value;
  28471. }
  28472. /**
  28473. * Creates a function that returns the result of invoking the given functions
  28474. * with the `this` binding of the created function, where each successive
  28475. * invocation is supplied the return value of the previous.
  28476. *
  28477. * @static
  28478. * @memberOf _
  28479. * @since 3.0.0
  28480. * @category Util
  28481. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28482. * @returns {Function} Returns the new composite function.
  28483. * @see _.flowRight
  28484. * @example
  28485. *
  28486. * function square(n) {
  28487. * return n * n;
  28488. * }
  28489. *
  28490. * var addSquare = _.flow([_.add, square]);
  28491. * addSquare(1, 2);
  28492. * // => 9
  28493. */
  28494. var flow = createFlow();
  28495. /**
  28496. * This method is like `_.flow` except that it creates a function that
  28497. * invokes the given functions from right to left.
  28498. *
  28499. * @static
  28500. * @since 3.0.0
  28501. * @memberOf _
  28502. * @category Util
  28503. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28504. * @returns {Function} Returns the new composite function.
  28505. * @see _.flow
  28506. * @example
  28507. *
  28508. * function square(n) {
  28509. * return n * n;
  28510. * }
  28511. *
  28512. * var addSquare = _.flowRight([square, _.add]);
  28513. * addSquare(1, 2);
  28514. * // => 9
  28515. */
  28516. var flowRight = createFlow(true);
  28517. /**
  28518. * This method returns the first argument it receives.
  28519. *
  28520. * @static
  28521. * @since 0.1.0
  28522. * @memberOf _
  28523. * @category Util
  28524. * @param {*} value Any value.
  28525. * @returns {*} Returns `value`.
  28526. * @example
  28527. *
  28528. * var object = { 'a': 1 };
  28529. *
  28530. * console.log(_.identity(object) === object);
  28531. * // => true
  28532. */
  28533. function identity(value) {
  28534. return value;
  28535. }
  28536. /**
  28537. * Creates a function that invokes `func` with the arguments of the created
  28538. * function. If `func` is a property name, the created function returns the
  28539. * property value for a given element. If `func` is an array or object, the
  28540. * created function returns `true` for elements that contain the equivalent
  28541. * source properties, otherwise it returns `false`.
  28542. *
  28543. * @static
  28544. * @since 4.0.0
  28545. * @memberOf _
  28546. * @category Util
  28547. * @param {*} [func=_.identity] The value to convert to a callback.
  28548. * @returns {Function} Returns the callback.
  28549. * @example
  28550. *
  28551. * var users = [
  28552. * { 'user': 'barney', 'age': 36, 'active': true },
  28553. * { 'user': 'fred', 'age': 40, 'active': false }
  28554. * ];
  28555. *
  28556. * // The `_.matches` iteratee shorthand.
  28557. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  28558. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  28559. *
  28560. * // The `_.matchesProperty` iteratee shorthand.
  28561. * _.filter(users, _.iteratee(['user', 'fred']));
  28562. * // => [{ 'user': 'fred', 'age': 40 }]
  28563. *
  28564. * // The `_.property` iteratee shorthand.
  28565. * _.map(users, _.iteratee('user'));
  28566. * // => ['barney', 'fred']
  28567. *
  28568. * // Create custom iteratee shorthands.
  28569. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  28570. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  28571. * return func.test(string);
  28572. * };
  28573. * });
  28574. *
  28575. * _.filter(['abc', 'def'], /ef/);
  28576. * // => ['def']
  28577. */
  28578. function iteratee(func) {
  28579. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  28580. }
  28581. /**
  28582. * Creates a function that performs a partial deep comparison between a given
  28583. * object and `source`, returning `true` if the given object has equivalent
  28584. * property values, else `false`.
  28585. *
  28586. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  28587. * partially applied.
  28588. *
  28589. * Partial comparisons will match empty array and empty object `source`
  28590. * values against any array or object value, respectively. See `_.isEqual`
  28591. * for a list of supported value comparisons.
  28592. *
  28593. * **Note:** Multiple values can be checked by combining several matchers
  28594. * using `_.overSome`
  28595. *
  28596. * @static
  28597. * @memberOf _
  28598. * @since 3.0.0
  28599. * @category Util
  28600. * @param {Object} source The object of property values to match.
  28601. * @returns {Function} Returns the new spec function.
  28602. * @example
  28603. *
  28604. * var objects = [
  28605. * { 'a': 1, 'b': 2, 'c': 3 },
  28606. * { 'a': 4, 'b': 5, 'c': 6 }
  28607. * ];
  28608. *
  28609. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  28610. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  28611. *
  28612. * // Checking for several possible values
  28613. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  28614. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28615. */
  28616. function matches(source) {
  28617. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  28618. }
  28619. /**
  28620. * Creates a function that performs a partial deep comparison between the
  28621. * value at `path` of a given object to `srcValue`, returning `true` if the
  28622. * object value is equivalent, else `false`.
  28623. *
  28624. * **Note:** Partial comparisons will match empty array and empty object
  28625. * `srcValue` values against any array or object value, respectively. See
  28626. * `_.isEqual` for a list of supported value comparisons.
  28627. *
  28628. * **Note:** Multiple values can be checked by combining several matchers
  28629. * using `_.overSome`
  28630. *
  28631. * @static
  28632. * @memberOf _
  28633. * @since 3.2.0
  28634. * @category Util
  28635. * @param {Array|string} path The path of the property to get.
  28636. * @param {*} srcValue The value to match.
  28637. * @returns {Function} Returns the new spec function.
  28638. * @example
  28639. *
  28640. * var objects = [
  28641. * { 'a': 1, 'b': 2, 'c': 3 },
  28642. * { 'a': 4, 'b': 5, 'c': 6 }
  28643. * ];
  28644. *
  28645. * _.find(objects, _.matchesProperty('a', 4));
  28646. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28647. *
  28648. * // Checking for several possible values
  28649. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  28650. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  28651. */
  28652. function matchesProperty(path, srcValue) {
  28653. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28654. }
  28655. /**
  28656. * Creates a function that invokes the method at `path` of a given object.
  28657. * Any additional arguments are provided to the invoked method.
  28658. *
  28659. * @static
  28660. * @memberOf _
  28661. * @since 3.7.0
  28662. * @category Util
  28663. * @param {Array|string} path The path of the method to invoke.
  28664. * @param {...*} [args] The arguments to invoke the method with.
  28665. * @returns {Function} Returns the new invoker function.
  28666. * @example
  28667. *
  28668. * var objects = [
  28669. * { 'a': { 'b': _.constant(2) } },
  28670. * { 'a': { 'b': _.constant(1) } }
  28671. * ];
  28672. *
  28673. * _.map(objects, _.method('a.b'));
  28674. * // => [2, 1]
  28675. *
  28676. * _.map(objects, _.method(['a', 'b']));
  28677. * // => [2, 1]
  28678. */
  28679. var method = baseRest(function(path, args) {
  28680. return function(object) {
  28681. return baseInvoke(object, path, args);
  28682. };
  28683. });
  28684. /**
  28685. * The opposite of `_.method`; this method creates a function that invokes
  28686. * the method at a given path of `object`. Any additional arguments are
  28687. * provided to the invoked method.
  28688. *
  28689. * @static
  28690. * @memberOf _
  28691. * @since 3.7.0
  28692. * @category Util
  28693. * @param {Object} object The object to query.
  28694. * @param {...*} [args] The arguments to invoke the method with.
  28695. * @returns {Function} Returns the new invoker function.
  28696. * @example
  28697. *
  28698. * var array = _.times(3, _.constant),
  28699. * object = { 'a': array, 'b': array, 'c': array };
  28700. *
  28701. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28702. * // => [2, 0]
  28703. *
  28704. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28705. * // => [2, 0]
  28706. */
  28707. var methodOf = baseRest(function(object, args) {
  28708. return function(path) {
  28709. return baseInvoke(object, path, args);
  28710. };
  28711. });
  28712. /**
  28713. * Adds all own enumerable string keyed function properties of a source
  28714. * object to the destination object. If `object` is a function, then methods
  28715. * are added to its prototype as well.
  28716. *
  28717. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28718. * avoid conflicts caused by modifying the original.
  28719. *
  28720. * @static
  28721. * @since 0.1.0
  28722. * @memberOf _
  28723. * @category Util
  28724. * @param {Function|Object} [object=lodash] The destination object.
  28725. * @param {Object} source The object of functions to add.
  28726. * @param {Object} [options={}] The options object.
  28727. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28728. * @returns {Function|Object} Returns `object`.
  28729. * @example
  28730. *
  28731. * function vowels(string) {
  28732. * return _.filter(string, function(v) {
  28733. * return /[aeiou]/i.test(v);
  28734. * });
  28735. * }
  28736. *
  28737. * _.mixin({ 'vowels': vowels });
  28738. * _.vowels('fred');
  28739. * // => ['e']
  28740. *
  28741. * _('fred').vowels().value();
  28742. * // => ['e']
  28743. *
  28744. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28745. * _('fred').vowels();
  28746. * // => ['e']
  28747. */
  28748. function mixin(object, source, options) {
  28749. var props = keys(source),
  28750. methodNames = baseFunctions(source, props);
  28751. if (options == null &&
  28752. !(isObject(source) && (methodNames.length || !props.length))) {
  28753. options = source;
  28754. source = object;
  28755. object = this;
  28756. methodNames = baseFunctions(source, keys(source));
  28757. }
  28758. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28759. isFunc = isFunction(object);
  28760. arrayEach(methodNames, function(methodName) {
  28761. var func = source[methodName];
  28762. object[methodName] = func;
  28763. if (isFunc) {
  28764. object.prototype[methodName] = function() {
  28765. var chainAll = this.__chain__;
  28766. if (chain || chainAll) {
  28767. var result = object(this.__wrapped__),
  28768. actions = result.__actions__ = copyArray(this.__actions__);
  28769. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28770. result.__chain__ = chainAll;
  28771. return result;
  28772. }
  28773. return func.apply(object, arrayPush([this.value()], arguments));
  28774. };
  28775. }
  28776. });
  28777. return object;
  28778. }
  28779. /**
  28780. * Reverts the `_` variable to its previous value and returns a reference to
  28781. * the `lodash` function.
  28782. *
  28783. * @static
  28784. * @since 0.1.0
  28785. * @memberOf _
  28786. * @category Util
  28787. * @returns {Function} Returns the `lodash` function.
  28788. * @example
  28789. *
  28790. * var lodash = _.noConflict();
  28791. */
  28792. function noConflict() {
  28793. if (root._ === this) {
  28794. root._ = oldDash;
  28795. }
  28796. return this;
  28797. }
  28798. /**
  28799. * This method returns `undefined`.
  28800. *
  28801. * @static
  28802. * @memberOf _
  28803. * @since 2.3.0
  28804. * @category Util
  28805. * @example
  28806. *
  28807. * _.times(2, _.noop);
  28808. * // => [undefined, undefined]
  28809. */
  28810. function noop() {
  28811. // No operation performed.
  28812. }
  28813. /**
  28814. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28815. * the nth argument from the end is returned.
  28816. *
  28817. * @static
  28818. * @memberOf _
  28819. * @since 4.0.0
  28820. * @category Util
  28821. * @param {number} [n=0] The index of the argument to return.
  28822. * @returns {Function} Returns the new pass-thru function.
  28823. * @example
  28824. *
  28825. * var func = _.nthArg(1);
  28826. * func('a', 'b', 'c', 'd');
  28827. * // => 'b'
  28828. *
  28829. * var func = _.nthArg(-2);
  28830. * func('a', 'b', 'c', 'd');
  28831. * // => 'c'
  28832. */
  28833. function nthArg(n) {
  28834. n = toInteger(n);
  28835. return baseRest(function(args) {
  28836. return baseNth(args, n);
  28837. });
  28838. }
  28839. /**
  28840. * Creates a function that invokes `iteratees` with the arguments it receives
  28841. * and returns their results.
  28842. *
  28843. * @static
  28844. * @memberOf _
  28845. * @since 4.0.0
  28846. * @category Util
  28847. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28848. * The iteratees to invoke.
  28849. * @returns {Function} Returns the new function.
  28850. * @example
  28851. *
  28852. * var func = _.over([Math.max, Math.min]);
  28853. *
  28854. * func(1, 2, 3, 4);
  28855. * // => [4, 1]
  28856. */
  28857. var over = createOver(arrayMap);
  28858. /**
  28859. * Creates a function that checks if **all** of the `predicates` return
  28860. * truthy when invoked with the arguments it receives.
  28861. *
  28862. * Following shorthands are possible for providing predicates.
  28863. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28864. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28865. *
  28866. * @static
  28867. * @memberOf _
  28868. * @since 4.0.0
  28869. * @category Util
  28870. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28871. * The predicates to check.
  28872. * @returns {Function} Returns the new function.
  28873. * @example
  28874. *
  28875. * var func = _.overEvery([Boolean, isFinite]);
  28876. *
  28877. * func('1');
  28878. * // => true
  28879. *
  28880. * func(null);
  28881. * // => false
  28882. *
  28883. * func(NaN);
  28884. * // => false
  28885. */
  28886. var overEvery = createOver(arrayEvery);
  28887. /**
  28888. * Creates a function that checks if **any** of the `predicates` return
  28889. * truthy when invoked with the arguments it receives.
  28890. *
  28891. * Following shorthands are possible for providing predicates.
  28892. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  28893. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  28894. *
  28895. * @static
  28896. * @memberOf _
  28897. * @since 4.0.0
  28898. * @category Util
  28899. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28900. * The predicates to check.
  28901. * @returns {Function} Returns the new function.
  28902. * @example
  28903. *
  28904. * var func = _.overSome([Boolean, isFinite]);
  28905. *
  28906. * func('1');
  28907. * // => true
  28908. *
  28909. * func(null);
  28910. * // => true
  28911. *
  28912. * func(NaN);
  28913. * // => false
  28914. *
  28915. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  28916. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  28917. */
  28918. var overSome = createOver(arraySome);
  28919. /**
  28920. * Creates a function that returns the value at `path` of a given object.
  28921. *
  28922. * @static
  28923. * @memberOf _
  28924. * @since 2.4.0
  28925. * @category Util
  28926. * @param {Array|string} path The path of the property to get.
  28927. * @returns {Function} Returns the new accessor function.
  28928. * @example
  28929. *
  28930. * var objects = [
  28931. * { 'a': { 'b': 2 } },
  28932. * { 'a': { 'b': 1 } }
  28933. * ];
  28934. *
  28935. * _.map(objects, _.property('a.b'));
  28936. * // => [2, 1]
  28937. *
  28938. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28939. * // => [1, 2]
  28940. */
  28941. function property(path) {
  28942. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28943. }
  28944. /**
  28945. * The opposite of `_.property`; this method creates a function that returns
  28946. * the value at a given path of `object`.
  28947. *
  28948. * @static
  28949. * @memberOf _
  28950. * @since 3.0.0
  28951. * @category Util
  28952. * @param {Object} object The object to query.
  28953. * @returns {Function} Returns the new accessor function.
  28954. * @example
  28955. *
  28956. * var array = [0, 1, 2],
  28957. * object = { 'a': array, 'b': array, 'c': array };
  28958. *
  28959. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28960. * // => [2, 0]
  28961. *
  28962. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28963. * // => [2, 0]
  28964. */
  28965. function propertyOf(object) {
  28966. return function(path) {
  28967. return object == null ? undefined : baseGet(object, path);
  28968. };
  28969. }
  28970. /**
  28971. * Creates an array of numbers (positive and/or negative) progressing from
  28972. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28973. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28974. * it's set to `start` with `start` then set to `0`.
  28975. *
  28976. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28977. * floating-point values which can produce unexpected results.
  28978. *
  28979. * @static
  28980. * @since 0.1.0
  28981. * @memberOf _
  28982. * @category Util
  28983. * @param {number} [start=0] The start of the range.
  28984. * @param {number} end The end of the range.
  28985. * @param {number} [step=1] The value to increment or decrement by.
  28986. * @returns {Array} Returns the range of numbers.
  28987. * @see _.inRange, _.rangeRight
  28988. * @example
  28989. *
  28990. * _.range(4);
  28991. * // => [0, 1, 2, 3]
  28992. *
  28993. * _.range(-4);
  28994. * // => [0, -1, -2, -3]
  28995. *
  28996. * _.range(1, 5);
  28997. * // => [1, 2, 3, 4]
  28998. *
  28999. * _.range(0, 20, 5);
  29000. * // => [0, 5, 10, 15]
  29001. *
  29002. * _.range(0, -4, -1);
  29003. * // => [0, -1, -2, -3]
  29004. *
  29005. * _.range(1, 4, 0);
  29006. * // => [1, 1, 1]
  29007. *
  29008. * _.range(0);
  29009. * // => []
  29010. */
  29011. var range = createRange();
  29012. /**
  29013. * This method is like `_.range` except that it populates values in
  29014. * descending order.
  29015. *
  29016. * @static
  29017. * @memberOf _
  29018. * @since 4.0.0
  29019. * @category Util
  29020. * @param {number} [start=0] The start of the range.
  29021. * @param {number} end The end of the range.
  29022. * @param {number} [step=1] The value to increment or decrement by.
  29023. * @returns {Array} Returns the range of numbers.
  29024. * @see _.inRange, _.range
  29025. * @example
  29026. *
  29027. * _.rangeRight(4);
  29028. * // => [3, 2, 1, 0]
  29029. *
  29030. * _.rangeRight(-4);
  29031. * // => [-3, -2, -1, 0]
  29032. *
  29033. * _.rangeRight(1, 5);
  29034. * // => [4, 3, 2, 1]
  29035. *
  29036. * _.rangeRight(0, 20, 5);
  29037. * // => [15, 10, 5, 0]
  29038. *
  29039. * _.rangeRight(0, -4, -1);
  29040. * // => [-3, -2, -1, 0]
  29041. *
  29042. * _.rangeRight(1, 4, 0);
  29043. * // => [1, 1, 1]
  29044. *
  29045. * _.rangeRight(0);
  29046. * // => []
  29047. */
  29048. var rangeRight = createRange(true);
  29049. /**
  29050. * This method returns a new empty array.
  29051. *
  29052. * @static
  29053. * @memberOf _
  29054. * @since 4.13.0
  29055. * @category Util
  29056. * @returns {Array} Returns the new empty array.
  29057. * @example
  29058. *
  29059. * var arrays = _.times(2, _.stubArray);
  29060. *
  29061. * console.log(arrays);
  29062. * // => [[], []]
  29063. *
  29064. * console.log(arrays[0] === arrays[1]);
  29065. * // => false
  29066. */
  29067. function stubArray() {
  29068. return [];
  29069. }
  29070. /**
  29071. * This method returns `false`.
  29072. *
  29073. * @static
  29074. * @memberOf _
  29075. * @since 4.13.0
  29076. * @category Util
  29077. * @returns {boolean} Returns `false`.
  29078. * @example
  29079. *
  29080. * _.times(2, _.stubFalse);
  29081. * // => [false, false]
  29082. */
  29083. function stubFalse() {
  29084. return false;
  29085. }
  29086. /**
  29087. * This method returns a new empty object.
  29088. *
  29089. * @static
  29090. * @memberOf _
  29091. * @since 4.13.0
  29092. * @category Util
  29093. * @returns {Object} Returns the new empty object.
  29094. * @example
  29095. *
  29096. * var objects = _.times(2, _.stubObject);
  29097. *
  29098. * console.log(objects);
  29099. * // => [{}, {}]
  29100. *
  29101. * console.log(objects[0] === objects[1]);
  29102. * // => false
  29103. */
  29104. function stubObject() {
  29105. return {};
  29106. }
  29107. /**
  29108. * This method returns an empty string.
  29109. *
  29110. * @static
  29111. * @memberOf _
  29112. * @since 4.13.0
  29113. * @category Util
  29114. * @returns {string} Returns the empty string.
  29115. * @example
  29116. *
  29117. * _.times(2, _.stubString);
  29118. * // => ['', '']
  29119. */
  29120. function stubString() {
  29121. return '';
  29122. }
  29123. /**
  29124. * This method returns `true`.
  29125. *
  29126. * @static
  29127. * @memberOf _
  29128. * @since 4.13.0
  29129. * @category Util
  29130. * @returns {boolean} Returns `true`.
  29131. * @example
  29132. *
  29133. * _.times(2, _.stubTrue);
  29134. * // => [true, true]
  29135. */
  29136. function stubTrue() {
  29137. return true;
  29138. }
  29139. /**
  29140. * Invokes the iteratee `n` times, returning an array of the results of
  29141. * each invocation. The iteratee is invoked with one argument; (index).
  29142. *
  29143. * @static
  29144. * @since 0.1.0
  29145. * @memberOf _
  29146. * @category Util
  29147. * @param {number} n The number of times to invoke `iteratee`.
  29148. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29149. * @returns {Array} Returns the array of results.
  29150. * @example
  29151. *
  29152. * _.times(3, String);
  29153. * // => ['0', '1', '2']
  29154. *
  29155. * _.times(4, _.constant(0));
  29156. * // => [0, 0, 0, 0]
  29157. */
  29158. function times(n, iteratee) {
  29159. n = toInteger(n);
  29160. if (n < 1 || n > MAX_SAFE_INTEGER) {
  29161. return [];
  29162. }
  29163. var index = MAX_ARRAY_LENGTH,
  29164. length = nativeMin(n, MAX_ARRAY_LENGTH);
  29165. iteratee = getIteratee(iteratee);
  29166. n -= MAX_ARRAY_LENGTH;
  29167. var result = baseTimes(length, iteratee);
  29168. while (++index < n) {
  29169. iteratee(index);
  29170. }
  29171. return result;
  29172. }
  29173. /**
  29174. * Converts `value` to a property path array.
  29175. *
  29176. * @static
  29177. * @memberOf _
  29178. * @since 4.0.0
  29179. * @category Util
  29180. * @param {*} value The value to convert.
  29181. * @returns {Array} Returns the new property path array.
  29182. * @example
  29183. *
  29184. * _.toPath('a.b.c');
  29185. * // => ['a', 'b', 'c']
  29186. *
  29187. * _.toPath('a[0].b.c');
  29188. * // => ['a', '0', 'b', 'c']
  29189. */
  29190. function toPath(value) {
  29191. if (isArray(value)) {
  29192. return arrayMap(value, toKey);
  29193. }
  29194. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  29195. }
  29196. /**
  29197. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  29198. *
  29199. * @static
  29200. * @since 0.1.0
  29201. * @memberOf _
  29202. * @category Util
  29203. * @param {string} [prefix=''] The value to prefix the ID with.
  29204. * @returns {string} Returns the unique ID.
  29205. * @example
  29206. *
  29207. * _.uniqueId('contact_');
  29208. * // => 'contact_104'
  29209. *
  29210. * _.uniqueId();
  29211. * // => '105'
  29212. */
  29213. function uniqueId(prefix) {
  29214. var id = ++idCounter;
  29215. return toString(prefix) + id;
  29216. }
  29217. /*------------------------------------------------------------------------*/
  29218. /**
  29219. * Adds two numbers.
  29220. *
  29221. * @static
  29222. * @memberOf _
  29223. * @since 3.4.0
  29224. * @category Math
  29225. * @param {number} augend The first number in an addition.
  29226. * @param {number} addend The second number in an addition.
  29227. * @returns {number} Returns the total.
  29228. * @example
  29229. *
  29230. * _.add(6, 4);
  29231. * // => 10
  29232. */
  29233. var add = createMathOperation(function(augend, addend) {
  29234. return augend + addend;
  29235. }, 0);
  29236. /**
  29237. * Computes `number` rounded up to `precision`.
  29238. *
  29239. * @static
  29240. * @memberOf _
  29241. * @since 3.10.0
  29242. * @category Math
  29243. * @param {number} number The number to round up.
  29244. * @param {number} [precision=0] The precision to round up to.
  29245. * @returns {number} Returns the rounded up number.
  29246. * @example
  29247. *
  29248. * _.ceil(4.006);
  29249. * // => 5
  29250. *
  29251. * _.ceil(6.004, 2);
  29252. * // => 6.01
  29253. *
  29254. * _.ceil(6040, -2);
  29255. * // => 6100
  29256. */
  29257. var ceil = createRound('ceil');
  29258. /**
  29259. * Divide two numbers.
  29260. *
  29261. * @static
  29262. * @memberOf _
  29263. * @since 4.7.0
  29264. * @category Math
  29265. * @param {number} dividend The first number in a division.
  29266. * @param {number} divisor The second number in a division.
  29267. * @returns {number} Returns the quotient.
  29268. * @example
  29269. *
  29270. * _.divide(6, 4);
  29271. * // => 1.5
  29272. */
  29273. var divide = createMathOperation(function(dividend, divisor) {
  29274. return dividend / divisor;
  29275. }, 1);
  29276. /**
  29277. * Computes `number` rounded down to `precision`.
  29278. *
  29279. * @static
  29280. * @memberOf _
  29281. * @since 3.10.0
  29282. * @category Math
  29283. * @param {number} number The number to round down.
  29284. * @param {number} [precision=0] The precision to round down to.
  29285. * @returns {number} Returns the rounded down number.
  29286. * @example
  29287. *
  29288. * _.floor(4.006);
  29289. * // => 4
  29290. *
  29291. * _.floor(0.046, 2);
  29292. * // => 0.04
  29293. *
  29294. * _.floor(4060, -2);
  29295. * // => 4000
  29296. */
  29297. var floor = createRound('floor');
  29298. /**
  29299. * Computes the maximum value of `array`. If `array` is empty or falsey,
  29300. * `undefined` is returned.
  29301. *
  29302. * @static
  29303. * @since 0.1.0
  29304. * @memberOf _
  29305. * @category Math
  29306. * @param {Array} array The array to iterate over.
  29307. * @returns {*} Returns the maximum value.
  29308. * @example
  29309. *
  29310. * _.max([4, 2, 8, 6]);
  29311. * // => 8
  29312. *
  29313. * _.max([]);
  29314. * // => undefined
  29315. */
  29316. function max(array) {
  29317. return (array && array.length)
  29318. ? baseExtremum(array, identity, baseGt)
  29319. : undefined;
  29320. }
  29321. /**
  29322. * This method is like `_.max` except that it accepts `iteratee` which is
  29323. * invoked for each element in `array` to generate the criterion by which
  29324. * the value is ranked. The iteratee is invoked with one argument: (value).
  29325. *
  29326. * @static
  29327. * @memberOf _
  29328. * @since 4.0.0
  29329. * @category Math
  29330. * @param {Array} array The array to iterate over.
  29331. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29332. * @returns {*} Returns the maximum value.
  29333. * @example
  29334. *
  29335. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29336. *
  29337. * _.maxBy(objects, function(o) { return o.n; });
  29338. * // => { 'n': 2 }
  29339. *
  29340. * // The `_.property` iteratee shorthand.
  29341. * _.maxBy(objects, 'n');
  29342. * // => { 'n': 2 }
  29343. */
  29344. function maxBy(array, iteratee) {
  29345. return (array && array.length)
  29346. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  29347. : undefined;
  29348. }
  29349. /**
  29350. * Computes the mean of the values in `array`.
  29351. *
  29352. * @static
  29353. * @memberOf _
  29354. * @since 4.0.0
  29355. * @category Math
  29356. * @param {Array} array The array to iterate over.
  29357. * @returns {number} Returns the mean.
  29358. * @example
  29359. *
  29360. * _.mean([4, 2, 8, 6]);
  29361. * // => 5
  29362. */
  29363. function mean(array) {
  29364. return baseMean(array, identity);
  29365. }
  29366. /**
  29367. * This method is like `_.mean` except that it accepts `iteratee` which is
  29368. * invoked for each element in `array` to generate the value to be averaged.
  29369. * The iteratee is invoked with one argument: (value).
  29370. *
  29371. * @static
  29372. * @memberOf _
  29373. * @since 4.7.0
  29374. * @category Math
  29375. * @param {Array} array The array to iterate over.
  29376. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29377. * @returns {number} Returns the mean.
  29378. * @example
  29379. *
  29380. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29381. *
  29382. * _.meanBy(objects, function(o) { return o.n; });
  29383. * // => 5
  29384. *
  29385. * // The `_.property` iteratee shorthand.
  29386. * _.meanBy(objects, 'n');
  29387. * // => 5
  29388. */
  29389. function meanBy(array, iteratee) {
  29390. return baseMean(array, getIteratee(iteratee, 2));
  29391. }
  29392. /**
  29393. * Computes the minimum value of `array`. If `array` is empty or falsey,
  29394. * `undefined` is returned.
  29395. *
  29396. * @static
  29397. * @since 0.1.0
  29398. * @memberOf _
  29399. * @category Math
  29400. * @param {Array} array The array to iterate over.
  29401. * @returns {*} Returns the minimum value.
  29402. * @example
  29403. *
  29404. * _.min([4, 2, 8, 6]);
  29405. * // => 2
  29406. *
  29407. * _.min([]);
  29408. * // => undefined
  29409. */
  29410. function min(array) {
  29411. return (array && array.length)
  29412. ? baseExtremum(array, identity, baseLt)
  29413. : undefined;
  29414. }
  29415. /**
  29416. * This method is like `_.min` except that it accepts `iteratee` which is
  29417. * invoked for each element in `array` to generate the criterion by which
  29418. * the value is ranked. The iteratee is invoked with one argument: (value).
  29419. *
  29420. * @static
  29421. * @memberOf _
  29422. * @since 4.0.0
  29423. * @category Math
  29424. * @param {Array} array The array to iterate over.
  29425. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29426. * @returns {*} Returns the minimum value.
  29427. * @example
  29428. *
  29429. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29430. *
  29431. * _.minBy(objects, function(o) { return o.n; });
  29432. * // => { 'n': 1 }
  29433. *
  29434. * // The `_.property` iteratee shorthand.
  29435. * _.minBy(objects, 'n');
  29436. * // => { 'n': 1 }
  29437. */
  29438. function minBy(array, iteratee) {
  29439. return (array && array.length)
  29440. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  29441. : undefined;
  29442. }
  29443. /**
  29444. * Multiply two numbers.
  29445. *
  29446. * @static
  29447. * @memberOf _
  29448. * @since 4.7.0
  29449. * @category Math
  29450. * @param {number} multiplier The first number in a multiplication.
  29451. * @param {number} multiplicand The second number in a multiplication.
  29452. * @returns {number} Returns the product.
  29453. * @example
  29454. *
  29455. * _.multiply(6, 4);
  29456. * // => 24
  29457. */
  29458. var multiply = createMathOperation(function(multiplier, multiplicand) {
  29459. return multiplier * multiplicand;
  29460. }, 1);
  29461. /**
  29462. * Computes `number` rounded to `precision`.
  29463. *
  29464. * @static
  29465. * @memberOf _
  29466. * @since 3.10.0
  29467. * @category Math
  29468. * @param {number} number The number to round.
  29469. * @param {number} [precision=0] The precision to round to.
  29470. * @returns {number} Returns the rounded number.
  29471. * @example
  29472. *
  29473. * _.round(4.006);
  29474. * // => 4
  29475. *
  29476. * _.round(4.006, 2);
  29477. * // => 4.01
  29478. *
  29479. * _.round(4060, -2);
  29480. * // => 4100
  29481. */
  29482. var round = createRound('round');
  29483. /**
  29484. * Subtract two numbers.
  29485. *
  29486. * @static
  29487. * @memberOf _
  29488. * @since 4.0.0
  29489. * @category Math
  29490. * @param {number} minuend The first number in a subtraction.
  29491. * @param {number} subtrahend The second number in a subtraction.
  29492. * @returns {number} Returns the difference.
  29493. * @example
  29494. *
  29495. * _.subtract(6, 4);
  29496. * // => 2
  29497. */
  29498. var subtract = createMathOperation(function(minuend, subtrahend) {
  29499. return minuend - subtrahend;
  29500. }, 0);
  29501. /**
  29502. * Computes the sum of the values in `array`.
  29503. *
  29504. * @static
  29505. * @memberOf _
  29506. * @since 3.4.0
  29507. * @category Math
  29508. * @param {Array} array The array to iterate over.
  29509. * @returns {number} Returns the sum.
  29510. * @example
  29511. *
  29512. * _.sum([4, 2, 8, 6]);
  29513. * // => 20
  29514. */
  29515. function sum(array) {
  29516. return (array && array.length)
  29517. ? baseSum(array, identity)
  29518. : 0;
  29519. }
  29520. /**
  29521. * This method is like `_.sum` except that it accepts `iteratee` which is
  29522. * invoked for each element in `array` to generate the value to be summed.
  29523. * The iteratee is invoked with one argument: (value).
  29524. *
  29525. * @static
  29526. * @memberOf _
  29527. * @since 4.0.0
  29528. * @category Math
  29529. * @param {Array} array The array to iterate over.
  29530. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29531. * @returns {number} Returns the sum.
  29532. * @example
  29533. *
  29534. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29535. *
  29536. * _.sumBy(objects, function(o) { return o.n; });
  29537. * // => 20
  29538. *
  29539. * // The `_.property` iteratee shorthand.
  29540. * _.sumBy(objects, 'n');
  29541. * // => 20
  29542. */
  29543. function sumBy(array, iteratee) {
  29544. return (array && array.length)
  29545. ? baseSum(array, getIteratee(iteratee, 2))
  29546. : 0;
  29547. }
  29548. /*------------------------------------------------------------------------*/
  29549. // Add methods that return wrapped values in chain sequences.
  29550. lodash.after = after;
  29551. lodash.ary = ary;
  29552. lodash.assign = assign;
  29553. lodash.assignIn = assignIn;
  29554. lodash.assignInWith = assignInWith;
  29555. lodash.assignWith = assignWith;
  29556. lodash.at = at;
  29557. lodash.before = before;
  29558. lodash.bind = bind;
  29559. lodash.bindAll = bindAll;
  29560. lodash.bindKey = bindKey;
  29561. lodash.castArray = castArray;
  29562. lodash.chain = chain;
  29563. lodash.chunk = chunk;
  29564. lodash.compact = compact;
  29565. lodash.concat = concat;
  29566. lodash.cond = cond;
  29567. lodash.conforms = conforms;
  29568. lodash.constant = constant;
  29569. lodash.countBy = countBy;
  29570. lodash.create = create;
  29571. lodash.curry = curry;
  29572. lodash.curryRight = curryRight;
  29573. lodash.debounce = debounce;
  29574. lodash.defaults = defaults;
  29575. lodash.defaultsDeep = defaultsDeep;
  29576. lodash.defer = defer;
  29577. lodash.delay = delay;
  29578. lodash.difference = difference;
  29579. lodash.differenceBy = differenceBy;
  29580. lodash.differenceWith = differenceWith;
  29581. lodash.drop = drop;
  29582. lodash.dropRight = dropRight;
  29583. lodash.dropRightWhile = dropRightWhile;
  29584. lodash.dropWhile = dropWhile;
  29585. lodash.fill = fill;
  29586. lodash.filter = filter;
  29587. lodash.flatMap = flatMap;
  29588. lodash.flatMapDeep = flatMapDeep;
  29589. lodash.flatMapDepth = flatMapDepth;
  29590. lodash.flatten = flatten;
  29591. lodash.flattenDeep = flattenDeep;
  29592. lodash.flattenDepth = flattenDepth;
  29593. lodash.flip = flip;
  29594. lodash.flow = flow;
  29595. lodash.flowRight = flowRight;
  29596. lodash.fromPairs = fromPairs;
  29597. lodash.functions = functions;
  29598. lodash.functionsIn = functionsIn;
  29599. lodash.groupBy = groupBy;
  29600. lodash.initial = initial;
  29601. lodash.intersection = intersection;
  29602. lodash.intersectionBy = intersectionBy;
  29603. lodash.intersectionWith = intersectionWith;
  29604. lodash.invert = invert;
  29605. lodash.invertBy = invertBy;
  29606. lodash.invokeMap = invokeMap;
  29607. lodash.iteratee = iteratee;
  29608. lodash.keyBy = keyBy;
  29609. lodash.keys = keys;
  29610. lodash.keysIn = keysIn;
  29611. lodash.map = map;
  29612. lodash.mapKeys = mapKeys;
  29613. lodash.mapValues = mapValues;
  29614. lodash.matches = matches;
  29615. lodash.matchesProperty = matchesProperty;
  29616. lodash.memoize = memoize;
  29617. lodash.merge = merge;
  29618. lodash.mergeWith = mergeWith;
  29619. lodash.method = method;
  29620. lodash.methodOf = methodOf;
  29621. lodash.mixin = mixin;
  29622. lodash.negate = negate;
  29623. lodash.nthArg = nthArg;
  29624. lodash.omit = omit;
  29625. lodash.omitBy = omitBy;
  29626. lodash.once = once;
  29627. lodash.orderBy = orderBy;
  29628. lodash.over = over;
  29629. lodash.overArgs = overArgs;
  29630. lodash.overEvery = overEvery;
  29631. lodash.overSome = overSome;
  29632. lodash.partial = partial;
  29633. lodash.partialRight = partialRight;
  29634. lodash.partition = partition;
  29635. lodash.pick = pick;
  29636. lodash.pickBy = pickBy;
  29637. lodash.property = property;
  29638. lodash.propertyOf = propertyOf;
  29639. lodash.pull = pull;
  29640. lodash.pullAll = pullAll;
  29641. lodash.pullAllBy = pullAllBy;
  29642. lodash.pullAllWith = pullAllWith;
  29643. lodash.pullAt = pullAt;
  29644. lodash.range = range;
  29645. lodash.rangeRight = rangeRight;
  29646. lodash.rearg = rearg;
  29647. lodash.reject = reject;
  29648. lodash.remove = remove;
  29649. lodash.rest = rest;
  29650. lodash.reverse = reverse;
  29651. lodash.sampleSize = sampleSize;
  29652. lodash.set = set;
  29653. lodash.setWith = setWith;
  29654. lodash.shuffle = shuffle;
  29655. lodash.slice = slice;
  29656. lodash.sortBy = sortBy;
  29657. lodash.sortedUniq = sortedUniq;
  29658. lodash.sortedUniqBy = sortedUniqBy;
  29659. lodash.split = split;
  29660. lodash.spread = spread;
  29661. lodash.tail = tail;
  29662. lodash.take = take;
  29663. lodash.takeRight = takeRight;
  29664. lodash.takeRightWhile = takeRightWhile;
  29665. lodash.takeWhile = takeWhile;
  29666. lodash.tap = tap;
  29667. lodash.throttle = throttle;
  29668. lodash.thru = thru;
  29669. lodash.toArray = toArray;
  29670. lodash.toPairs = toPairs;
  29671. lodash.toPairsIn = toPairsIn;
  29672. lodash.toPath = toPath;
  29673. lodash.toPlainObject = toPlainObject;
  29674. lodash.transform = transform;
  29675. lodash.unary = unary;
  29676. lodash.union = union;
  29677. lodash.unionBy = unionBy;
  29678. lodash.unionWith = unionWith;
  29679. lodash.uniq = uniq;
  29680. lodash.uniqBy = uniqBy;
  29681. lodash.uniqWith = uniqWith;
  29682. lodash.unset = unset;
  29683. lodash.unzip = unzip;
  29684. lodash.unzipWith = unzipWith;
  29685. lodash.update = update;
  29686. lodash.updateWith = updateWith;
  29687. lodash.values = values;
  29688. lodash.valuesIn = valuesIn;
  29689. lodash.without = without;
  29690. lodash.words = words;
  29691. lodash.wrap = wrap;
  29692. lodash.xor = xor;
  29693. lodash.xorBy = xorBy;
  29694. lodash.xorWith = xorWith;
  29695. lodash.zip = zip;
  29696. lodash.zipObject = zipObject;
  29697. lodash.zipObjectDeep = zipObjectDeep;
  29698. lodash.zipWith = zipWith;
  29699. // Add aliases.
  29700. lodash.entries = toPairs;
  29701. lodash.entriesIn = toPairsIn;
  29702. lodash.extend = assignIn;
  29703. lodash.extendWith = assignInWith;
  29704. // Add methods to `lodash.prototype`.
  29705. mixin(lodash, lodash);
  29706. /*------------------------------------------------------------------------*/
  29707. // Add methods that return unwrapped values in chain sequences.
  29708. lodash.add = add;
  29709. lodash.attempt = attempt;
  29710. lodash.camelCase = camelCase;
  29711. lodash.capitalize = capitalize;
  29712. lodash.ceil = ceil;
  29713. lodash.clamp = clamp;
  29714. lodash.clone = clone;
  29715. lodash.cloneDeep = cloneDeep;
  29716. lodash.cloneDeepWith = cloneDeepWith;
  29717. lodash.cloneWith = cloneWith;
  29718. lodash.conformsTo = conformsTo;
  29719. lodash.deburr = deburr;
  29720. lodash.defaultTo = defaultTo;
  29721. lodash.divide = divide;
  29722. lodash.endsWith = endsWith;
  29723. lodash.eq = eq;
  29724. lodash.escape = escape;
  29725. lodash.escapeRegExp = escapeRegExp;
  29726. lodash.every = every;
  29727. lodash.find = find;
  29728. lodash.findIndex = findIndex;
  29729. lodash.findKey = findKey;
  29730. lodash.findLast = findLast;
  29731. lodash.findLastIndex = findLastIndex;
  29732. lodash.findLastKey = findLastKey;
  29733. lodash.floor = floor;
  29734. lodash.forEach = forEach;
  29735. lodash.forEachRight = forEachRight;
  29736. lodash.forIn = forIn;
  29737. lodash.forInRight = forInRight;
  29738. lodash.forOwn = forOwn;
  29739. lodash.forOwnRight = forOwnRight;
  29740. lodash.get = get;
  29741. lodash.gt = gt;
  29742. lodash.gte = gte;
  29743. lodash.has = has;
  29744. lodash.hasIn = hasIn;
  29745. lodash.head = head;
  29746. lodash.identity = identity;
  29747. lodash.includes = includes;
  29748. lodash.indexOf = indexOf;
  29749. lodash.inRange = inRange;
  29750. lodash.invoke = invoke;
  29751. lodash.isArguments = isArguments;
  29752. lodash.isArray = isArray;
  29753. lodash.isArrayBuffer = isArrayBuffer;
  29754. lodash.isArrayLike = isArrayLike;
  29755. lodash.isArrayLikeObject = isArrayLikeObject;
  29756. lodash.isBoolean = isBoolean;
  29757. lodash.isBuffer = isBuffer;
  29758. lodash.isDate = isDate;
  29759. lodash.isElement = isElement;
  29760. lodash.isEmpty = isEmpty;
  29761. lodash.isEqual = isEqual;
  29762. lodash.isEqualWith = isEqualWith;
  29763. lodash.isError = isError;
  29764. lodash.isFinite = isFinite;
  29765. lodash.isFunction = isFunction;
  29766. lodash.isInteger = isInteger;
  29767. lodash.isLength = isLength;
  29768. lodash.isMap = isMap;
  29769. lodash.isMatch = isMatch;
  29770. lodash.isMatchWith = isMatchWith;
  29771. lodash.isNaN = isNaN;
  29772. lodash.isNative = isNative;
  29773. lodash.isNil = isNil;
  29774. lodash.isNull = isNull;
  29775. lodash.isNumber = isNumber;
  29776. lodash.isObject = isObject;
  29777. lodash.isObjectLike = isObjectLike;
  29778. lodash.isPlainObject = isPlainObject;
  29779. lodash.isRegExp = isRegExp;
  29780. lodash.isSafeInteger = isSafeInteger;
  29781. lodash.isSet = isSet;
  29782. lodash.isString = isString;
  29783. lodash.isSymbol = isSymbol;
  29784. lodash.isTypedArray = isTypedArray;
  29785. lodash.isUndefined = isUndefined;
  29786. lodash.isWeakMap = isWeakMap;
  29787. lodash.isWeakSet = isWeakSet;
  29788. lodash.join = join;
  29789. lodash.kebabCase = kebabCase;
  29790. lodash.last = last;
  29791. lodash.lastIndexOf = lastIndexOf;
  29792. lodash.lowerCase = lowerCase;
  29793. lodash.lowerFirst = lowerFirst;
  29794. lodash.lt = lt;
  29795. lodash.lte = lte;
  29796. lodash.max = max;
  29797. lodash.maxBy = maxBy;
  29798. lodash.mean = mean;
  29799. lodash.meanBy = meanBy;
  29800. lodash.min = min;
  29801. lodash.minBy = minBy;
  29802. lodash.stubArray = stubArray;
  29803. lodash.stubFalse = stubFalse;
  29804. lodash.stubObject = stubObject;
  29805. lodash.stubString = stubString;
  29806. lodash.stubTrue = stubTrue;
  29807. lodash.multiply = multiply;
  29808. lodash.nth = nth;
  29809. lodash.noConflict = noConflict;
  29810. lodash.noop = noop;
  29811. lodash.now = now;
  29812. lodash.pad = pad;
  29813. lodash.padEnd = padEnd;
  29814. lodash.padStart = padStart;
  29815. lodash.parseInt = parseInt;
  29816. lodash.random = random;
  29817. lodash.reduce = reduce;
  29818. lodash.reduceRight = reduceRight;
  29819. lodash.repeat = repeat;
  29820. lodash.replace = replace;
  29821. lodash.result = result;
  29822. lodash.round = round;
  29823. lodash.runInContext = runInContext;
  29824. lodash.sample = sample;
  29825. lodash.size = size;
  29826. lodash.snakeCase = snakeCase;
  29827. lodash.some = some;
  29828. lodash.sortedIndex = sortedIndex;
  29829. lodash.sortedIndexBy = sortedIndexBy;
  29830. lodash.sortedIndexOf = sortedIndexOf;
  29831. lodash.sortedLastIndex = sortedLastIndex;
  29832. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29833. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29834. lodash.startCase = startCase;
  29835. lodash.startsWith = startsWith;
  29836. lodash.subtract = subtract;
  29837. lodash.sum = sum;
  29838. lodash.sumBy = sumBy;
  29839. lodash.template = template;
  29840. lodash.times = times;
  29841. lodash.toFinite = toFinite;
  29842. lodash.toInteger = toInteger;
  29843. lodash.toLength = toLength;
  29844. lodash.toLower = toLower;
  29845. lodash.toNumber = toNumber;
  29846. lodash.toSafeInteger = toSafeInteger;
  29847. lodash.toString = toString;
  29848. lodash.toUpper = toUpper;
  29849. lodash.trim = trim;
  29850. lodash.trimEnd = trimEnd;
  29851. lodash.trimStart = trimStart;
  29852. lodash.truncate = truncate;
  29853. lodash.unescape = unescape;
  29854. lodash.uniqueId = uniqueId;
  29855. lodash.upperCase = upperCase;
  29856. lodash.upperFirst = upperFirst;
  29857. // Add aliases.
  29858. lodash.each = forEach;
  29859. lodash.eachRight = forEachRight;
  29860. lodash.first = head;
  29861. mixin(lodash, (function() {
  29862. var source = {};
  29863. baseForOwn(lodash, function(func, methodName) {
  29864. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29865. source[methodName] = func;
  29866. }
  29867. });
  29868. return source;
  29869. }()), { 'chain': false });
  29870. /*------------------------------------------------------------------------*/
  29871. /**
  29872. * The semantic version number.
  29873. *
  29874. * @static
  29875. * @memberOf _
  29876. * @type {string}
  29877. */
  29878. lodash.VERSION = VERSION;
  29879. // Assign default placeholders.
  29880. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29881. lodash[methodName].placeholder = lodash;
  29882. });
  29883. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29884. arrayEach(['drop', 'take'], function(methodName, index) {
  29885. LazyWrapper.prototype[methodName] = function(n) {
  29886. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29887. var result = (this.__filtered__ && !index)
  29888. ? new LazyWrapper(this)
  29889. : this.clone();
  29890. if (result.__filtered__) {
  29891. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29892. } else {
  29893. result.__views__.push({
  29894. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29895. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29896. });
  29897. }
  29898. return result;
  29899. };
  29900. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29901. return this.reverse()[methodName](n).reverse();
  29902. };
  29903. });
  29904. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29905. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29906. var type = index + 1,
  29907. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29908. LazyWrapper.prototype[methodName] = function(iteratee) {
  29909. var result = this.clone();
  29910. result.__iteratees__.push({
  29911. 'iteratee': getIteratee(iteratee, 3),
  29912. 'type': type
  29913. });
  29914. result.__filtered__ = result.__filtered__ || isFilter;
  29915. return result;
  29916. };
  29917. });
  29918. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29919. arrayEach(['head', 'last'], function(methodName, index) {
  29920. var takeName = 'take' + (index ? 'Right' : '');
  29921. LazyWrapper.prototype[methodName] = function() {
  29922. return this[takeName](1).value()[0];
  29923. };
  29924. });
  29925. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29926. arrayEach(['initial', 'tail'], function(methodName, index) {
  29927. var dropName = 'drop' + (index ? '' : 'Right');
  29928. LazyWrapper.prototype[methodName] = function() {
  29929. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29930. };
  29931. });
  29932. LazyWrapper.prototype.compact = function() {
  29933. return this.filter(identity);
  29934. };
  29935. LazyWrapper.prototype.find = function(predicate) {
  29936. return this.filter(predicate).head();
  29937. };
  29938. LazyWrapper.prototype.findLast = function(predicate) {
  29939. return this.reverse().find(predicate);
  29940. };
  29941. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29942. if (typeof path == 'function') {
  29943. return new LazyWrapper(this);
  29944. }
  29945. return this.map(function(value) {
  29946. return baseInvoke(value, path, args);
  29947. });
  29948. });
  29949. LazyWrapper.prototype.reject = function(predicate) {
  29950. return this.filter(negate(getIteratee(predicate)));
  29951. };
  29952. LazyWrapper.prototype.slice = function(start, end) {
  29953. start = toInteger(start);
  29954. var result = this;
  29955. if (result.__filtered__ && (start > 0 || end < 0)) {
  29956. return new LazyWrapper(result);
  29957. }
  29958. if (start < 0) {
  29959. result = result.takeRight(-start);
  29960. } else if (start) {
  29961. result = result.drop(start);
  29962. }
  29963. if (end !== undefined) {
  29964. end = toInteger(end);
  29965. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29966. }
  29967. return result;
  29968. };
  29969. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29970. return this.reverse().takeWhile(predicate).reverse();
  29971. };
  29972. LazyWrapper.prototype.toArray = function() {
  29973. return this.take(MAX_ARRAY_LENGTH);
  29974. };
  29975. // Add `LazyWrapper` methods to `lodash.prototype`.
  29976. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29977. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29978. isTaker = /^(?:head|last)$/.test(methodName),
  29979. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29980. retUnwrapped = isTaker || /^find/.test(methodName);
  29981. if (!lodashFunc) {
  29982. return;
  29983. }
  29984. lodash.prototype[methodName] = function() {
  29985. var value = this.__wrapped__,
  29986. args = isTaker ? [1] : arguments,
  29987. isLazy = value instanceof LazyWrapper,
  29988. iteratee = args[0],
  29989. useLazy = isLazy || isArray(value);
  29990. var interceptor = function(value) {
  29991. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  29992. return (isTaker && chainAll) ? result[0] : result;
  29993. };
  29994. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  29995. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  29996. isLazy = useLazy = false;
  29997. }
  29998. var chainAll = this.__chain__,
  29999. isHybrid = !!this.__actions__.length,
  30000. isUnwrapped = retUnwrapped && !chainAll,
  30001. onlyLazy = isLazy && !isHybrid;
  30002. if (!retUnwrapped && useLazy) {
  30003. value = onlyLazy ? value : new LazyWrapper(this);
  30004. var result = func.apply(value, args);
  30005. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  30006. return new LodashWrapper(result, chainAll);
  30007. }
  30008. if (isUnwrapped && onlyLazy) {
  30009. return func.apply(this, args);
  30010. }
  30011. result = this.thru(interceptor);
  30012. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  30013. };
  30014. });
  30015. // Add `Array` methods to `lodash.prototype`.
  30016. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  30017. var func = arrayProto[methodName],
  30018. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  30019. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  30020. lodash.prototype[methodName] = function() {
  30021. var args = arguments;
  30022. if (retUnwrapped && !this.__chain__) {
  30023. var value = this.value();
  30024. return func.apply(isArray(value) ? value : [], args);
  30025. }
  30026. return this[chainName](function(value) {
  30027. return func.apply(isArray(value) ? value : [], args);
  30028. });
  30029. };
  30030. });
  30031. // Map minified method names to their real names.
  30032. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  30033. var lodashFunc = lodash[methodName];
  30034. if (lodashFunc) {
  30035. var key = lodashFunc.name + '';
  30036. if (!hasOwnProperty.call(realNames, key)) {
  30037. realNames[key] = [];
  30038. }
  30039. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  30040. }
  30041. });
  30042. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  30043. 'name': 'wrapper',
  30044. 'func': undefined
  30045. }];
  30046. // Add methods to `LazyWrapper`.
  30047. LazyWrapper.prototype.clone = lazyClone;
  30048. LazyWrapper.prototype.reverse = lazyReverse;
  30049. LazyWrapper.prototype.value = lazyValue;
  30050. // Add chain sequence methods to the `lodash` wrapper.
  30051. lodash.prototype.at = wrapperAt;
  30052. lodash.prototype.chain = wrapperChain;
  30053. lodash.prototype.commit = wrapperCommit;
  30054. lodash.prototype.next = wrapperNext;
  30055. lodash.prototype.plant = wrapperPlant;
  30056. lodash.prototype.reverse = wrapperReverse;
  30057. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  30058. // Add lazy aliases.
  30059. lodash.prototype.first = lodash.prototype.head;
  30060. if (symIterator) {
  30061. lodash.prototype[symIterator] = wrapperToIterator;
  30062. }
  30063. return lodash;
  30064. });
  30065. /*--------------------------------------------------------------------------*/
  30066. // Export lodash.
  30067. var _ = runInContext();
  30068. // Some AMD build optimizers, like r.js, check for condition patterns like:
  30069. if (true) {
  30070. // Expose Lodash on the global object to prevent errors when Lodash is
  30071. // loaded by a script tag in the presence of an AMD loader.
  30072. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  30073. // Use `_.noConflict` to remove Lodash from the global object.
  30074. root._ = _;
  30075. // Define as an anonymous module so, through path mapping, it can be
  30076. // referenced as the "underscore" module.
  30077. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  30078. return _;
  30079. }).call(exports, __webpack_require__, exports, module),
  30080. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  30081. }
  30082. // Check for `exports` after `define` in case a build optimizer adds it.
  30083. else {}
  30084. }.call(this));
  30085. /* 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)))
  30086. /***/ }),
  30087. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  30088. /*!***************************************************!*\
  30089. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  30090. \***************************************************/
  30091. /*! exports provided: default */
  30092. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  30093. "use strict";
  30094. __webpack_require__.r(__webpack_exports__);
  30095. /* WEBPACK VAR INJECTION */(function(global) {/**!
  30096. * @fileOverview Kickass library to create and place poppers near their reference elements.
  30097. * @version 1.16.1
  30098. * @license
  30099. * Copyright (c) 2016 Federico Zivolo and contributors
  30100. *
  30101. * Permission is hereby granted, free of charge, to any person obtaining a copy
  30102. * of this software and associated documentation files (the "Software"), to deal
  30103. * in the Software without restriction, including without limitation the rights
  30104. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30105. * copies of the Software, and to permit persons to whom the Software is
  30106. * furnished to do so, subject to the following conditions:
  30107. *
  30108. * The above copyright notice and this permission notice shall be included in all
  30109. * copies or substantial portions of the Software.
  30110. *
  30111. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30112. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30113. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30114. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30115. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  30116. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30117. * SOFTWARE.
  30118. */
  30119. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  30120. var timeoutDuration = function () {
  30121. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  30122. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  30123. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  30124. return 1;
  30125. }
  30126. }
  30127. return 0;
  30128. }();
  30129. function microtaskDebounce(fn) {
  30130. var called = false;
  30131. return function () {
  30132. if (called) {
  30133. return;
  30134. }
  30135. called = true;
  30136. window.Promise.resolve().then(function () {
  30137. called = false;
  30138. fn();
  30139. });
  30140. };
  30141. }
  30142. function taskDebounce(fn) {
  30143. var scheduled = false;
  30144. return function () {
  30145. if (!scheduled) {
  30146. scheduled = true;
  30147. setTimeout(function () {
  30148. scheduled = false;
  30149. fn();
  30150. }, timeoutDuration);
  30151. }
  30152. };
  30153. }
  30154. var supportsMicroTasks = isBrowser && window.Promise;
  30155. /**
  30156. * Create a debounced version of a method, that's asynchronously deferred
  30157. * but called in the minimum time possible.
  30158. *
  30159. * @method
  30160. * @memberof Popper.Utils
  30161. * @argument {Function} fn
  30162. * @returns {Function}
  30163. */
  30164. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  30165. /**
  30166. * Check if the given variable is a function
  30167. * @method
  30168. * @memberof Popper.Utils
  30169. * @argument {Any} functionToCheck - variable to check
  30170. * @returns {Boolean} answer to: is a function?
  30171. */
  30172. function isFunction(functionToCheck) {
  30173. var getType = {};
  30174. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  30175. }
  30176. /**
  30177. * Get CSS computed property of the given element
  30178. * @method
  30179. * @memberof Popper.Utils
  30180. * @argument {Eement} element
  30181. * @argument {String} property
  30182. */
  30183. function getStyleComputedProperty(element, property) {
  30184. if (element.nodeType !== 1) {
  30185. return [];
  30186. }
  30187. // NOTE: 1 DOM access here
  30188. var window = element.ownerDocument.defaultView;
  30189. var css = window.getComputedStyle(element, null);
  30190. return property ? css[property] : css;
  30191. }
  30192. /**
  30193. * Returns the parentNode or the host of the element
  30194. * @method
  30195. * @memberof Popper.Utils
  30196. * @argument {Element} element
  30197. * @returns {Element} parent
  30198. */
  30199. function getParentNode(element) {
  30200. if (element.nodeName === 'HTML') {
  30201. return element;
  30202. }
  30203. return element.parentNode || element.host;
  30204. }
  30205. /**
  30206. * Returns the scrolling parent of the given element
  30207. * @method
  30208. * @memberof Popper.Utils
  30209. * @argument {Element} element
  30210. * @returns {Element} scroll parent
  30211. */
  30212. function getScrollParent(element) {
  30213. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  30214. if (!element) {
  30215. return document.body;
  30216. }
  30217. switch (element.nodeName) {
  30218. case 'HTML':
  30219. case 'BODY':
  30220. return element.ownerDocument.body;
  30221. case '#document':
  30222. return element.body;
  30223. }
  30224. // Firefox want us to check `-x` and `-y` variations as well
  30225. var _getStyleComputedProp = getStyleComputedProperty(element),
  30226. overflow = _getStyleComputedProp.overflow,
  30227. overflowX = _getStyleComputedProp.overflowX,
  30228. overflowY = _getStyleComputedProp.overflowY;
  30229. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  30230. return element;
  30231. }
  30232. return getScrollParent(getParentNode(element));
  30233. }
  30234. /**
  30235. * Returns the reference node of the reference object, or the reference object itself.
  30236. * @method
  30237. * @memberof Popper.Utils
  30238. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  30239. * @returns {Element} parent
  30240. */
  30241. function getReferenceNode(reference) {
  30242. return reference && reference.referenceNode ? reference.referenceNode : reference;
  30243. }
  30244. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  30245. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  30246. /**
  30247. * Determines if the browser is Internet Explorer
  30248. * @method
  30249. * @memberof Popper.Utils
  30250. * @param {Number} version to check
  30251. * @returns {Boolean} isIE
  30252. */
  30253. function isIE(version) {
  30254. if (version === 11) {
  30255. return isIE11;
  30256. }
  30257. if (version === 10) {
  30258. return isIE10;
  30259. }
  30260. return isIE11 || isIE10;
  30261. }
  30262. /**
  30263. * Returns the offset parent of the given element
  30264. * @method
  30265. * @memberof Popper.Utils
  30266. * @argument {Element} element
  30267. * @returns {Element} offset parent
  30268. */
  30269. function getOffsetParent(element) {
  30270. if (!element) {
  30271. return document.documentElement;
  30272. }
  30273. var noOffsetParent = isIE(10) ? document.body : null;
  30274. // NOTE: 1 DOM access here
  30275. var offsetParent = element.offsetParent || null;
  30276. // Skip hidden elements which don't have an offsetParent
  30277. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  30278. offsetParent = (element = element.nextElementSibling).offsetParent;
  30279. }
  30280. var nodeName = offsetParent && offsetParent.nodeName;
  30281. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  30282. return element ? element.ownerDocument.documentElement : document.documentElement;
  30283. }
  30284. // .offsetParent will return the closest TH, TD or TABLE in case
  30285. // no offsetParent is present, I hate this job...
  30286. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  30287. return getOffsetParent(offsetParent);
  30288. }
  30289. return offsetParent;
  30290. }
  30291. function isOffsetContainer(element) {
  30292. var nodeName = element.nodeName;
  30293. if (nodeName === 'BODY') {
  30294. return false;
  30295. }
  30296. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  30297. }
  30298. /**
  30299. * Finds the root node (document, shadowDOM root) of the given element
  30300. * @method
  30301. * @memberof Popper.Utils
  30302. * @argument {Element} node
  30303. * @returns {Element} root node
  30304. */
  30305. function getRoot(node) {
  30306. if (node.parentNode !== null) {
  30307. return getRoot(node.parentNode);
  30308. }
  30309. return node;
  30310. }
  30311. /**
  30312. * Finds the offset parent common to the two provided nodes
  30313. * @method
  30314. * @memberof Popper.Utils
  30315. * @argument {Element} element1
  30316. * @argument {Element} element2
  30317. * @returns {Element} common offset parent
  30318. */
  30319. function findCommonOffsetParent(element1, element2) {
  30320. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30321. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  30322. return document.documentElement;
  30323. }
  30324. // Here we make sure to give as "start" the element that comes first in the DOM
  30325. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  30326. var start = order ? element1 : element2;
  30327. var end = order ? element2 : element1;
  30328. // Get common ancestor container
  30329. var range = document.createRange();
  30330. range.setStart(start, 0);
  30331. range.setEnd(end, 0);
  30332. var commonAncestorContainer = range.commonAncestorContainer;
  30333. // Both nodes are inside #document
  30334. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  30335. if (isOffsetContainer(commonAncestorContainer)) {
  30336. return commonAncestorContainer;
  30337. }
  30338. return getOffsetParent(commonAncestorContainer);
  30339. }
  30340. // one of the nodes is inside shadowDOM, find which one
  30341. var element1root = getRoot(element1);
  30342. if (element1root.host) {
  30343. return findCommonOffsetParent(element1root.host, element2);
  30344. } else {
  30345. return findCommonOffsetParent(element1, getRoot(element2).host);
  30346. }
  30347. }
  30348. /**
  30349. * Gets the scroll value of the given element in the given side (top and left)
  30350. * @method
  30351. * @memberof Popper.Utils
  30352. * @argument {Element} element
  30353. * @argument {String} side `top` or `left`
  30354. * @returns {number} amount of scrolled pixels
  30355. */
  30356. function getScroll(element) {
  30357. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  30358. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  30359. var nodeName = element.nodeName;
  30360. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30361. var html = element.ownerDocument.documentElement;
  30362. var scrollingElement = element.ownerDocument.scrollingElement || html;
  30363. return scrollingElement[upperSide];
  30364. }
  30365. return element[upperSide];
  30366. }
  30367. /*
  30368. * Sum or subtract the element scroll values (left and top) from a given rect object
  30369. * @method
  30370. * @memberof Popper.Utils
  30371. * @param {Object} rect - Rect object you want to change
  30372. * @param {HTMLElement} element - The element from the function reads the scroll values
  30373. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  30374. * @return {Object} rect - The modifier rect object
  30375. */
  30376. function includeScroll(rect, element) {
  30377. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30378. var scrollTop = getScroll(element, 'top');
  30379. var scrollLeft = getScroll(element, 'left');
  30380. var modifier = subtract ? -1 : 1;
  30381. rect.top += scrollTop * modifier;
  30382. rect.bottom += scrollTop * modifier;
  30383. rect.left += scrollLeft * modifier;
  30384. rect.right += scrollLeft * modifier;
  30385. return rect;
  30386. }
  30387. /*
  30388. * Helper to detect borders of a given element
  30389. * @method
  30390. * @memberof Popper.Utils
  30391. * @param {CSSStyleDeclaration} styles
  30392. * Result of `getStyleComputedProperty` on the given element
  30393. * @param {String} axis - `x` or `y`
  30394. * @return {number} borders - The borders size of the given axis
  30395. */
  30396. function getBordersSize(styles, axis) {
  30397. var sideA = axis === 'x' ? 'Left' : 'Top';
  30398. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  30399. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  30400. }
  30401. function getSize(axis, body, html, computedStyle) {
  30402. 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);
  30403. }
  30404. function getWindowSizes(document) {
  30405. var body = document.body;
  30406. var html = document.documentElement;
  30407. var computedStyle = isIE(10) && getComputedStyle(html);
  30408. return {
  30409. height: getSize('Height', body, html, computedStyle),
  30410. width: getSize('Width', body, html, computedStyle)
  30411. };
  30412. }
  30413. var classCallCheck = function (instance, Constructor) {
  30414. if (!(instance instanceof Constructor)) {
  30415. throw new TypeError("Cannot call a class as a function");
  30416. }
  30417. };
  30418. var createClass = function () {
  30419. function defineProperties(target, props) {
  30420. for (var i = 0; i < props.length; i++) {
  30421. var descriptor = props[i];
  30422. descriptor.enumerable = descriptor.enumerable || false;
  30423. descriptor.configurable = true;
  30424. if ("value" in descriptor) descriptor.writable = true;
  30425. Object.defineProperty(target, descriptor.key, descriptor);
  30426. }
  30427. }
  30428. return function (Constructor, protoProps, staticProps) {
  30429. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  30430. if (staticProps) defineProperties(Constructor, staticProps);
  30431. return Constructor;
  30432. };
  30433. }();
  30434. var defineProperty = function (obj, key, value) {
  30435. if (key in obj) {
  30436. Object.defineProperty(obj, key, {
  30437. value: value,
  30438. enumerable: true,
  30439. configurable: true,
  30440. writable: true
  30441. });
  30442. } else {
  30443. obj[key] = value;
  30444. }
  30445. return obj;
  30446. };
  30447. var _extends = Object.assign || function (target) {
  30448. for (var i = 1; i < arguments.length; i++) {
  30449. var source = arguments[i];
  30450. for (var key in source) {
  30451. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30452. target[key] = source[key];
  30453. }
  30454. }
  30455. }
  30456. return target;
  30457. };
  30458. /**
  30459. * Given element offsets, generate an output similar to getBoundingClientRect
  30460. * @method
  30461. * @memberof Popper.Utils
  30462. * @argument {Object} offsets
  30463. * @returns {Object} ClientRect like output
  30464. */
  30465. function getClientRect(offsets) {
  30466. return _extends({}, offsets, {
  30467. right: offsets.left + offsets.width,
  30468. bottom: offsets.top + offsets.height
  30469. });
  30470. }
  30471. /**
  30472. * Get bounding client rect of given element
  30473. * @method
  30474. * @memberof Popper.Utils
  30475. * @param {HTMLElement} element
  30476. * @return {Object} client rect
  30477. */
  30478. function getBoundingClientRect(element) {
  30479. var rect = {};
  30480. // IE10 10 FIX: Please, don't ask, the element isn't
  30481. // considered in DOM in some circumstances...
  30482. // This isn't reproducible in IE10 compatibility mode of IE11
  30483. try {
  30484. if (isIE(10)) {
  30485. rect = element.getBoundingClientRect();
  30486. var scrollTop = getScroll(element, 'top');
  30487. var scrollLeft = getScroll(element, 'left');
  30488. rect.top += scrollTop;
  30489. rect.left += scrollLeft;
  30490. rect.bottom += scrollTop;
  30491. rect.right += scrollLeft;
  30492. } else {
  30493. rect = element.getBoundingClientRect();
  30494. }
  30495. } catch (e) {}
  30496. var result = {
  30497. left: rect.left,
  30498. top: rect.top,
  30499. width: rect.right - rect.left,
  30500. height: rect.bottom - rect.top
  30501. };
  30502. // subtract scrollbar size from sizes
  30503. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  30504. var width = sizes.width || element.clientWidth || result.width;
  30505. var height = sizes.height || element.clientHeight || result.height;
  30506. var horizScrollbar = element.offsetWidth - width;
  30507. var vertScrollbar = element.offsetHeight - height;
  30508. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  30509. // we make this check conditional for performance reasons
  30510. if (horizScrollbar || vertScrollbar) {
  30511. var styles = getStyleComputedProperty(element);
  30512. horizScrollbar -= getBordersSize(styles, 'x');
  30513. vertScrollbar -= getBordersSize(styles, 'y');
  30514. result.width -= horizScrollbar;
  30515. result.height -= vertScrollbar;
  30516. }
  30517. return getClientRect(result);
  30518. }
  30519. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  30520. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30521. var isIE10 = isIE(10);
  30522. var isHTML = parent.nodeName === 'HTML';
  30523. var childrenRect = getBoundingClientRect(children);
  30524. var parentRect = getBoundingClientRect(parent);
  30525. var scrollParent = getScrollParent(children);
  30526. var styles = getStyleComputedProperty(parent);
  30527. var borderTopWidth = parseFloat(styles.borderTopWidth);
  30528. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  30529. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  30530. if (fixedPosition && isHTML) {
  30531. parentRect.top = Math.max(parentRect.top, 0);
  30532. parentRect.left = Math.max(parentRect.left, 0);
  30533. }
  30534. var offsets = getClientRect({
  30535. top: childrenRect.top - parentRect.top - borderTopWidth,
  30536. left: childrenRect.left - parentRect.left - borderLeftWidth,
  30537. width: childrenRect.width,
  30538. height: childrenRect.height
  30539. });
  30540. offsets.marginTop = 0;
  30541. offsets.marginLeft = 0;
  30542. // Subtract margins of documentElement in case it's being used as parent
  30543. // we do this only on HTML because it's the only element that behaves
  30544. // differently when margins are applied to it. The margins are included in
  30545. // the box of the documentElement, in the other cases not.
  30546. if (!isIE10 && isHTML) {
  30547. var marginTop = parseFloat(styles.marginTop);
  30548. var marginLeft = parseFloat(styles.marginLeft);
  30549. offsets.top -= borderTopWidth - marginTop;
  30550. offsets.bottom -= borderTopWidth - marginTop;
  30551. offsets.left -= borderLeftWidth - marginLeft;
  30552. offsets.right -= borderLeftWidth - marginLeft;
  30553. // Attach marginTop and marginLeft because in some circumstances we may need them
  30554. offsets.marginTop = marginTop;
  30555. offsets.marginLeft = marginLeft;
  30556. }
  30557. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  30558. offsets = includeScroll(offsets, parent);
  30559. }
  30560. return offsets;
  30561. }
  30562. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  30563. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30564. var html = element.ownerDocument.documentElement;
  30565. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  30566. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  30567. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  30568. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  30569. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  30570. var offset = {
  30571. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  30572. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  30573. width: width,
  30574. height: height
  30575. };
  30576. return getClientRect(offset);
  30577. }
  30578. /**
  30579. * Check if the given element is fixed or is inside a fixed parent
  30580. * @method
  30581. * @memberof Popper.Utils
  30582. * @argument {Element} element
  30583. * @argument {Element} customContainer
  30584. * @returns {Boolean} answer to "isFixed?"
  30585. */
  30586. function isFixed(element) {
  30587. var nodeName = element.nodeName;
  30588. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30589. return false;
  30590. }
  30591. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  30592. return true;
  30593. }
  30594. var parentNode = getParentNode(element);
  30595. if (!parentNode) {
  30596. return false;
  30597. }
  30598. return isFixed(parentNode);
  30599. }
  30600. /**
  30601. * Finds the first parent of an element that has a transformed property defined
  30602. * @method
  30603. * @memberof Popper.Utils
  30604. * @argument {Element} element
  30605. * @returns {Element} first transformed parent or documentElement
  30606. */
  30607. function getFixedPositionOffsetParent(element) {
  30608. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30609. if (!element || !element.parentElement || isIE()) {
  30610. return document.documentElement;
  30611. }
  30612. var el = element.parentElement;
  30613. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  30614. el = el.parentElement;
  30615. }
  30616. return el || document.documentElement;
  30617. }
  30618. /**
  30619. * Computed the boundaries limits and return them
  30620. * @method
  30621. * @memberof Popper.Utils
  30622. * @param {HTMLElement} popper
  30623. * @param {HTMLElement} reference
  30624. * @param {number} padding
  30625. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  30626. * @param {Boolean} fixedPosition - Is in fixed position mode
  30627. * @returns {Object} Coordinates of the boundaries
  30628. */
  30629. function getBoundaries(popper, reference, padding, boundariesElement) {
  30630. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  30631. // NOTE: 1 DOM access here
  30632. var boundaries = { top: 0, left: 0 };
  30633. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30634. // Handle viewport case
  30635. if (boundariesElement === 'viewport') {
  30636. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  30637. } else {
  30638. // Handle other cases based on DOM element used as boundaries
  30639. var boundariesNode = void 0;
  30640. if (boundariesElement === 'scrollParent') {
  30641. boundariesNode = getScrollParent(getParentNode(reference));
  30642. if (boundariesNode.nodeName === 'BODY') {
  30643. boundariesNode = popper.ownerDocument.documentElement;
  30644. }
  30645. } else if (boundariesElement === 'window') {
  30646. boundariesNode = popper.ownerDocument.documentElement;
  30647. } else {
  30648. boundariesNode = boundariesElement;
  30649. }
  30650. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30651. // In case of HTML, we need a different computation
  30652. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30653. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30654. height = _getWindowSizes.height,
  30655. width = _getWindowSizes.width;
  30656. boundaries.top += offsets.top - offsets.marginTop;
  30657. boundaries.bottom = height + offsets.top;
  30658. boundaries.left += offsets.left - offsets.marginLeft;
  30659. boundaries.right = width + offsets.left;
  30660. } else {
  30661. // for all the other DOM elements, this one is good
  30662. boundaries = offsets;
  30663. }
  30664. }
  30665. // Add paddings
  30666. padding = padding || 0;
  30667. var isPaddingNumber = typeof padding === 'number';
  30668. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30669. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30670. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30671. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30672. return boundaries;
  30673. }
  30674. function getArea(_ref) {
  30675. var width = _ref.width,
  30676. height = _ref.height;
  30677. return width * height;
  30678. }
  30679. /**
  30680. * Utility used to transform the `auto` placement to the placement with more
  30681. * available space.
  30682. * @method
  30683. * @memberof Popper.Utils
  30684. * @argument {Object} data - The data object generated by update method
  30685. * @argument {Object} options - Modifiers configuration and options
  30686. * @returns {Object} The data object, properly modified
  30687. */
  30688. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30689. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30690. if (placement.indexOf('auto') === -1) {
  30691. return placement;
  30692. }
  30693. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30694. var rects = {
  30695. top: {
  30696. width: boundaries.width,
  30697. height: refRect.top - boundaries.top
  30698. },
  30699. right: {
  30700. width: boundaries.right - refRect.right,
  30701. height: boundaries.height
  30702. },
  30703. bottom: {
  30704. width: boundaries.width,
  30705. height: boundaries.bottom - refRect.bottom
  30706. },
  30707. left: {
  30708. width: refRect.left - boundaries.left,
  30709. height: boundaries.height
  30710. }
  30711. };
  30712. var sortedAreas = Object.keys(rects).map(function (key) {
  30713. return _extends({
  30714. key: key
  30715. }, rects[key], {
  30716. area: getArea(rects[key])
  30717. });
  30718. }).sort(function (a, b) {
  30719. return b.area - a.area;
  30720. });
  30721. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30722. var width = _ref2.width,
  30723. height = _ref2.height;
  30724. return width >= popper.clientWidth && height >= popper.clientHeight;
  30725. });
  30726. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30727. var variation = placement.split('-')[1];
  30728. return computedPlacement + (variation ? '-' + variation : '');
  30729. }
  30730. /**
  30731. * Get offsets to the reference element
  30732. * @method
  30733. * @memberof Popper.Utils
  30734. * @param {Object} state
  30735. * @param {Element} popper - the popper element
  30736. * @param {Element} reference - the reference element (the popper will be relative to this)
  30737. * @param {Element} fixedPosition - is in fixed position mode
  30738. * @returns {Object} An object containing the offsets which will be applied to the popper
  30739. */
  30740. function getReferenceOffsets(state, popper, reference) {
  30741. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30742. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30743. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30744. }
  30745. /**
  30746. * Get the outer sizes of the given element (offset size + margins)
  30747. * @method
  30748. * @memberof Popper.Utils
  30749. * @argument {Element} element
  30750. * @returns {Object} object containing width and height properties
  30751. */
  30752. function getOuterSizes(element) {
  30753. var window = element.ownerDocument.defaultView;
  30754. var styles = window.getComputedStyle(element);
  30755. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30756. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30757. var result = {
  30758. width: element.offsetWidth + y,
  30759. height: element.offsetHeight + x
  30760. };
  30761. return result;
  30762. }
  30763. /**
  30764. * Get the opposite placement of the given one
  30765. * @method
  30766. * @memberof Popper.Utils
  30767. * @argument {String} placement
  30768. * @returns {String} flipped placement
  30769. */
  30770. function getOppositePlacement(placement) {
  30771. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30772. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30773. return hash[matched];
  30774. });
  30775. }
  30776. /**
  30777. * Get offsets to the popper
  30778. * @method
  30779. * @memberof Popper.Utils
  30780. * @param {Object} position - CSS position the Popper will get applied
  30781. * @param {HTMLElement} popper - the popper element
  30782. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30783. * @param {String} placement - one of the valid placement options
  30784. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30785. */
  30786. function getPopperOffsets(popper, referenceOffsets, placement) {
  30787. placement = placement.split('-')[0];
  30788. // Get popper node sizes
  30789. var popperRect = getOuterSizes(popper);
  30790. // Add position, width and height to our offsets object
  30791. var popperOffsets = {
  30792. width: popperRect.width,
  30793. height: popperRect.height
  30794. };
  30795. // depending by the popper placement we have to compute its offsets slightly differently
  30796. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30797. var mainSide = isHoriz ? 'top' : 'left';
  30798. var secondarySide = isHoriz ? 'left' : 'top';
  30799. var measurement = isHoriz ? 'height' : 'width';
  30800. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30801. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30802. if (placement === secondarySide) {
  30803. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30804. } else {
  30805. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30806. }
  30807. return popperOffsets;
  30808. }
  30809. /**
  30810. * Mimics the `find` method of Array
  30811. * @method
  30812. * @memberof Popper.Utils
  30813. * @argument {Array} arr
  30814. * @argument prop
  30815. * @argument value
  30816. * @returns index or -1
  30817. */
  30818. function find(arr, check) {
  30819. // use native find if supported
  30820. if (Array.prototype.find) {
  30821. return arr.find(check);
  30822. }
  30823. // use `filter` to obtain the same behavior of `find`
  30824. return arr.filter(check)[0];
  30825. }
  30826. /**
  30827. * Return the index of the matching object
  30828. * @method
  30829. * @memberof Popper.Utils
  30830. * @argument {Array} arr
  30831. * @argument prop
  30832. * @argument value
  30833. * @returns index or -1
  30834. */
  30835. function findIndex(arr, prop, value) {
  30836. // use native findIndex if supported
  30837. if (Array.prototype.findIndex) {
  30838. return arr.findIndex(function (cur) {
  30839. return cur[prop] === value;
  30840. });
  30841. }
  30842. // use `find` + `indexOf` if `findIndex` isn't supported
  30843. var match = find(arr, function (obj) {
  30844. return obj[prop] === value;
  30845. });
  30846. return arr.indexOf(match);
  30847. }
  30848. /**
  30849. * Loop trough the list of modifiers and run them in order,
  30850. * each of them will then edit the data object.
  30851. * @method
  30852. * @memberof Popper.Utils
  30853. * @param {dataObject} data
  30854. * @param {Array} modifiers
  30855. * @param {String} ends - Optional modifier name used as stopper
  30856. * @returns {dataObject}
  30857. */
  30858. function runModifiers(modifiers, data, ends) {
  30859. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30860. modifiersToRun.forEach(function (modifier) {
  30861. if (modifier['function']) {
  30862. // eslint-disable-line dot-notation
  30863. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30864. }
  30865. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30866. if (modifier.enabled && isFunction(fn)) {
  30867. // Add properties to offsets to make them a complete clientRect object
  30868. // we do this before each modifier to make sure the previous one doesn't
  30869. // mess with these values
  30870. data.offsets.popper = getClientRect(data.offsets.popper);
  30871. data.offsets.reference = getClientRect(data.offsets.reference);
  30872. data = fn(data, modifier);
  30873. }
  30874. });
  30875. return data;
  30876. }
  30877. /**
  30878. * Updates the position of the popper, computing the new offsets and applying
  30879. * the new style.<br />
  30880. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30881. * @method
  30882. * @memberof Popper
  30883. */
  30884. function update() {
  30885. // if popper is destroyed, don't perform any further update
  30886. if (this.state.isDestroyed) {
  30887. return;
  30888. }
  30889. var data = {
  30890. instance: this,
  30891. styles: {},
  30892. arrowStyles: {},
  30893. attributes: {},
  30894. flipped: false,
  30895. offsets: {}
  30896. };
  30897. // compute reference element offsets
  30898. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30899. // compute auto placement, store placement inside the data object,
  30900. // modifiers will be able to edit `placement` if needed
  30901. // and refer to originalPlacement to know the original value
  30902. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30903. // store the computed placement inside `originalPlacement`
  30904. data.originalPlacement = data.placement;
  30905. data.positionFixed = this.options.positionFixed;
  30906. // compute the popper offsets
  30907. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30908. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30909. // run the modifiers
  30910. data = runModifiers(this.modifiers, data);
  30911. // the first `update` will call `onCreate` callback
  30912. // the other ones will call `onUpdate` callback
  30913. if (!this.state.isCreated) {
  30914. this.state.isCreated = true;
  30915. this.options.onCreate(data);
  30916. } else {
  30917. this.options.onUpdate(data);
  30918. }
  30919. }
  30920. /**
  30921. * Helper used to know if the given modifier is enabled.
  30922. * @method
  30923. * @memberof Popper.Utils
  30924. * @returns {Boolean}
  30925. */
  30926. function isModifierEnabled(modifiers, modifierName) {
  30927. return modifiers.some(function (_ref) {
  30928. var name = _ref.name,
  30929. enabled = _ref.enabled;
  30930. return enabled && name === modifierName;
  30931. });
  30932. }
  30933. /**
  30934. * Get the prefixed supported property name
  30935. * @method
  30936. * @memberof Popper.Utils
  30937. * @argument {String} property (camelCase)
  30938. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30939. */
  30940. function getSupportedPropertyName(property) {
  30941. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30942. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30943. for (var i = 0; i < prefixes.length; i++) {
  30944. var prefix = prefixes[i];
  30945. var toCheck = prefix ? '' + prefix + upperProp : property;
  30946. if (typeof document.body.style[toCheck] !== 'undefined') {
  30947. return toCheck;
  30948. }
  30949. }
  30950. return null;
  30951. }
  30952. /**
  30953. * Destroys the popper.
  30954. * @method
  30955. * @memberof Popper
  30956. */
  30957. function destroy() {
  30958. this.state.isDestroyed = true;
  30959. // touch DOM only if `applyStyle` modifier is enabled
  30960. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30961. this.popper.removeAttribute('x-placement');
  30962. this.popper.style.position = '';
  30963. this.popper.style.top = '';
  30964. this.popper.style.left = '';
  30965. this.popper.style.right = '';
  30966. this.popper.style.bottom = '';
  30967. this.popper.style.willChange = '';
  30968. this.popper.style[getSupportedPropertyName('transform')] = '';
  30969. }
  30970. this.disableEventListeners();
  30971. // remove the popper if user explicitly asked for the deletion on destroy
  30972. // do not use `remove` because IE11 doesn't support it
  30973. if (this.options.removeOnDestroy) {
  30974. this.popper.parentNode.removeChild(this.popper);
  30975. }
  30976. return this;
  30977. }
  30978. /**
  30979. * Get the window associated with the element
  30980. * @argument {Element} element
  30981. * @returns {Window}
  30982. */
  30983. function getWindow(element) {
  30984. var ownerDocument = element.ownerDocument;
  30985. return ownerDocument ? ownerDocument.defaultView : window;
  30986. }
  30987. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  30988. var isBody = scrollParent.nodeName === 'BODY';
  30989. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  30990. target.addEventListener(event, callback, { passive: true });
  30991. if (!isBody) {
  30992. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  30993. }
  30994. scrollParents.push(target);
  30995. }
  30996. /**
  30997. * Setup needed event listeners used to update the popper position
  30998. * @method
  30999. * @memberof Popper.Utils
  31000. * @private
  31001. */
  31002. function setupEventListeners(reference, options, state, updateBound) {
  31003. // Resize event listener on window
  31004. state.updateBound = updateBound;
  31005. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  31006. // Scroll event listener on scroll parents
  31007. var scrollElement = getScrollParent(reference);
  31008. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  31009. state.scrollElement = scrollElement;
  31010. state.eventsEnabled = true;
  31011. return state;
  31012. }
  31013. /**
  31014. * It will add resize/scroll events and start recalculating
  31015. * position of the popper element when they are triggered.
  31016. * @method
  31017. * @memberof Popper
  31018. */
  31019. function enableEventListeners() {
  31020. if (!this.state.eventsEnabled) {
  31021. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  31022. }
  31023. }
  31024. /**
  31025. * Remove event listeners used to update the popper position
  31026. * @method
  31027. * @memberof Popper.Utils
  31028. * @private
  31029. */
  31030. function removeEventListeners(reference, state) {
  31031. // Remove resize event listener on window
  31032. getWindow(reference).removeEventListener('resize', state.updateBound);
  31033. // Remove scroll event listener on scroll parents
  31034. state.scrollParents.forEach(function (target) {
  31035. target.removeEventListener('scroll', state.updateBound);
  31036. });
  31037. // Reset state
  31038. state.updateBound = null;
  31039. state.scrollParents = [];
  31040. state.scrollElement = null;
  31041. state.eventsEnabled = false;
  31042. return state;
  31043. }
  31044. /**
  31045. * It will remove resize/scroll events and won't recalculate popper position
  31046. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  31047. * unless you call `update` method manually.
  31048. * @method
  31049. * @memberof Popper
  31050. */
  31051. function disableEventListeners() {
  31052. if (this.state.eventsEnabled) {
  31053. cancelAnimationFrame(this.scheduleUpdate);
  31054. this.state = removeEventListeners(this.reference, this.state);
  31055. }
  31056. }
  31057. /**
  31058. * Tells if a given input is a number
  31059. * @method
  31060. * @memberof Popper.Utils
  31061. * @param {*} input to check
  31062. * @return {Boolean}
  31063. */
  31064. function isNumeric(n) {
  31065. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  31066. }
  31067. /**
  31068. * Set the style to the given popper
  31069. * @method
  31070. * @memberof Popper.Utils
  31071. * @argument {Element} element - Element to apply the style to
  31072. * @argument {Object} styles
  31073. * Object with a list of properties and values which will be applied to the element
  31074. */
  31075. function setStyles(element, styles) {
  31076. Object.keys(styles).forEach(function (prop) {
  31077. var unit = '';
  31078. // add unit if the value is numeric and is one of the following
  31079. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  31080. unit = 'px';
  31081. }
  31082. element.style[prop] = styles[prop] + unit;
  31083. });
  31084. }
  31085. /**
  31086. * Set the attributes to the given popper
  31087. * @method
  31088. * @memberof Popper.Utils
  31089. * @argument {Element} element - Element to apply the attributes to
  31090. * @argument {Object} styles
  31091. * Object with a list of properties and values which will be applied to the element
  31092. */
  31093. function setAttributes(element, attributes) {
  31094. Object.keys(attributes).forEach(function (prop) {
  31095. var value = attributes[prop];
  31096. if (value !== false) {
  31097. element.setAttribute(prop, attributes[prop]);
  31098. } else {
  31099. element.removeAttribute(prop);
  31100. }
  31101. });
  31102. }
  31103. /**
  31104. * @function
  31105. * @memberof Modifiers
  31106. * @argument {Object} data - The data object generated by `update` method
  31107. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  31108. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  31109. * @argument {Object} options - Modifiers configuration and options
  31110. * @returns {Object} The same data object
  31111. */
  31112. function applyStyle(data) {
  31113. // any property present in `data.styles` will be applied to the popper,
  31114. // in this way we can make the 3rd party modifiers add custom styles to it
  31115. // Be aware, modifiers could override the properties defined in the previous
  31116. // lines of this modifier!
  31117. setStyles(data.instance.popper, data.styles);
  31118. // any property present in `data.attributes` will be applied to the popper,
  31119. // they will be set as HTML attributes of the element
  31120. setAttributes(data.instance.popper, data.attributes);
  31121. // if arrowElement is defined and arrowStyles has some properties
  31122. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  31123. setStyles(data.arrowElement, data.arrowStyles);
  31124. }
  31125. return data;
  31126. }
  31127. /**
  31128. * Set the x-placement attribute before everything else because it could be used
  31129. * to add margins to the popper margins needs to be calculated to get the
  31130. * correct popper offsets.
  31131. * @method
  31132. * @memberof Popper.modifiers
  31133. * @param {HTMLElement} reference - The reference element used to position the popper
  31134. * @param {HTMLElement} popper - The HTML element used as popper
  31135. * @param {Object} options - Popper.js options
  31136. */
  31137. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  31138. // compute reference element offsets
  31139. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  31140. // compute auto placement, store placement inside the data object,
  31141. // modifiers will be able to edit `placement` if needed
  31142. // and refer to originalPlacement to know the original value
  31143. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  31144. popper.setAttribute('x-placement', placement);
  31145. // Apply `position` to popper before anything else because
  31146. // without the position applied we can't guarantee correct computations
  31147. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  31148. return options;
  31149. }
  31150. /**
  31151. * @function
  31152. * @memberof Popper.Utils
  31153. * @argument {Object} data - The data object generated by `update` method
  31154. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  31155. * @returns {Object} The popper's position offsets rounded
  31156. *
  31157. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  31158. * good as it can be within reason.
  31159. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  31160. *
  31161. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  31162. * as well on High DPI screens).
  31163. *
  31164. * Firefox prefers no rounding for positioning and does not have blurriness on
  31165. * high DPI screens.
  31166. *
  31167. * Only horizontal placement and left/right values need to be considered.
  31168. */
  31169. function getRoundedOffsets(data, shouldRound) {
  31170. var _data$offsets = data.offsets,
  31171. popper = _data$offsets.popper,
  31172. reference = _data$offsets.reference;
  31173. var round = Math.round,
  31174. floor = Math.floor;
  31175. var noRound = function noRound(v) {
  31176. return v;
  31177. };
  31178. var referenceWidth = round(reference.width);
  31179. var popperWidth = round(popper.width);
  31180. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  31181. var isVariation = data.placement.indexOf('-') !== -1;
  31182. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  31183. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  31184. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  31185. var verticalToInteger = !shouldRound ? noRound : round;
  31186. return {
  31187. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  31188. top: verticalToInteger(popper.top),
  31189. bottom: verticalToInteger(popper.bottom),
  31190. right: horizontalToInteger(popper.right)
  31191. };
  31192. }
  31193. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  31194. /**
  31195. * @function
  31196. * @memberof Modifiers
  31197. * @argument {Object} data - The data object generated by `update` method
  31198. * @argument {Object} options - Modifiers configuration and options
  31199. * @returns {Object} The data object, properly modified
  31200. */
  31201. function computeStyle(data, options) {
  31202. var x = options.x,
  31203. y = options.y;
  31204. var popper = data.offsets.popper;
  31205. // Remove this legacy support in Popper.js v2
  31206. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  31207. return modifier.name === 'applyStyle';
  31208. }).gpuAcceleration;
  31209. if (legacyGpuAccelerationOption !== undefined) {
  31210. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  31211. }
  31212. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  31213. var offsetParent = getOffsetParent(data.instance.popper);
  31214. var offsetParentRect = getBoundingClientRect(offsetParent);
  31215. // Styles
  31216. var styles = {
  31217. position: popper.position
  31218. };
  31219. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  31220. var sideA = x === 'bottom' ? 'top' : 'bottom';
  31221. var sideB = y === 'right' ? 'left' : 'right';
  31222. // if gpuAcceleration is set to `true` and transform is supported,
  31223. // we use `translate3d` to apply the position to the popper we
  31224. // automatically use the supported prefixed version if needed
  31225. var prefixedProperty = getSupportedPropertyName('transform');
  31226. // now, let's make a step back and look at this code closely (wtf?)
  31227. // If the content of the popper grows once it's been positioned, it
  31228. // may happen that the popper gets misplaced because of the new content
  31229. // overflowing its reference element
  31230. // To avoid this problem, we provide two options (x and y), which allow
  31231. // the consumer to define the offset origin.
  31232. // If we position a popper on top of a reference element, we can set
  31233. // `x` to `top` to make the popper grow towards its top instead of
  31234. // its bottom.
  31235. var left = void 0,
  31236. top = void 0;
  31237. if (sideA === 'bottom') {
  31238. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  31239. // and not the bottom of the html element
  31240. if (offsetParent.nodeName === 'HTML') {
  31241. top = -offsetParent.clientHeight + offsets.bottom;
  31242. } else {
  31243. top = -offsetParentRect.height + offsets.bottom;
  31244. }
  31245. } else {
  31246. top = offsets.top;
  31247. }
  31248. if (sideB === 'right') {
  31249. if (offsetParent.nodeName === 'HTML') {
  31250. left = -offsetParent.clientWidth + offsets.right;
  31251. } else {
  31252. left = -offsetParentRect.width + offsets.right;
  31253. }
  31254. } else {
  31255. left = offsets.left;
  31256. }
  31257. if (gpuAcceleration && prefixedProperty) {
  31258. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  31259. styles[sideA] = 0;
  31260. styles[sideB] = 0;
  31261. styles.willChange = 'transform';
  31262. } else {
  31263. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  31264. var invertTop = sideA === 'bottom' ? -1 : 1;
  31265. var invertLeft = sideB === 'right' ? -1 : 1;
  31266. styles[sideA] = top * invertTop;
  31267. styles[sideB] = left * invertLeft;
  31268. styles.willChange = sideA + ', ' + sideB;
  31269. }
  31270. // Attributes
  31271. var attributes = {
  31272. 'x-placement': data.placement
  31273. };
  31274. // Update `data` attributes, styles and arrowStyles
  31275. data.attributes = _extends({}, attributes, data.attributes);
  31276. data.styles = _extends({}, styles, data.styles);
  31277. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  31278. return data;
  31279. }
  31280. /**
  31281. * Helper used to know if the given modifier depends from another one.<br />
  31282. * It checks if the needed modifier is listed and enabled.
  31283. * @method
  31284. * @memberof Popper.Utils
  31285. * @param {Array} modifiers - list of modifiers
  31286. * @param {String} requestingName - name of requesting modifier
  31287. * @param {String} requestedName - name of requested modifier
  31288. * @returns {Boolean}
  31289. */
  31290. function isModifierRequired(modifiers, requestingName, requestedName) {
  31291. var requesting = find(modifiers, function (_ref) {
  31292. var name = _ref.name;
  31293. return name === requestingName;
  31294. });
  31295. var isRequired = !!requesting && modifiers.some(function (modifier) {
  31296. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  31297. });
  31298. if (!isRequired) {
  31299. var _requesting = '`' + requestingName + '`';
  31300. var requested = '`' + requestedName + '`';
  31301. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  31302. }
  31303. return isRequired;
  31304. }
  31305. /**
  31306. * @function
  31307. * @memberof Modifiers
  31308. * @argument {Object} data - The data object generated by update method
  31309. * @argument {Object} options - Modifiers configuration and options
  31310. * @returns {Object} The data object, properly modified
  31311. */
  31312. function arrow(data, options) {
  31313. var _data$offsets$arrow;
  31314. // arrow depends on keepTogether in order to work
  31315. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  31316. return data;
  31317. }
  31318. var arrowElement = options.element;
  31319. // if arrowElement is a string, suppose it's a CSS selector
  31320. if (typeof arrowElement === 'string') {
  31321. arrowElement = data.instance.popper.querySelector(arrowElement);
  31322. // if arrowElement is not found, don't run the modifier
  31323. if (!arrowElement) {
  31324. return data;
  31325. }
  31326. } else {
  31327. // if the arrowElement isn't a query selector we must check that the
  31328. // provided DOM node is child of its popper node
  31329. if (!data.instance.popper.contains(arrowElement)) {
  31330. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  31331. return data;
  31332. }
  31333. }
  31334. var placement = data.placement.split('-')[0];
  31335. var _data$offsets = data.offsets,
  31336. popper = _data$offsets.popper,
  31337. reference = _data$offsets.reference;
  31338. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  31339. var len = isVertical ? 'height' : 'width';
  31340. var sideCapitalized = isVertical ? 'Top' : 'Left';
  31341. var side = sideCapitalized.toLowerCase();
  31342. var altSide = isVertical ? 'left' : 'top';
  31343. var opSide = isVertical ? 'bottom' : 'right';
  31344. var arrowElementSize = getOuterSizes(arrowElement)[len];
  31345. //
  31346. // extends keepTogether behavior making sure the popper and its
  31347. // reference have enough pixels in conjunction
  31348. //
  31349. // top/left side
  31350. if (reference[opSide] - arrowElementSize < popper[side]) {
  31351. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  31352. }
  31353. // bottom/right side
  31354. if (reference[side] + arrowElementSize > popper[opSide]) {
  31355. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  31356. }
  31357. data.offsets.popper = getClientRect(data.offsets.popper);
  31358. // compute center of the popper
  31359. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  31360. // Compute the sideValue using the updated popper offsets
  31361. // take popper margin in account because we don't have this info available
  31362. var css = getStyleComputedProperty(data.instance.popper);
  31363. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  31364. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  31365. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  31366. // prevent arrowElement from being placed not contiguously to its popper
  31367. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  31368. data.arrowElement = arrowElement;
  31369. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  31370. return data;
  31371. }
  31372. /**
  31373. * Get the opposite placement variation of the given one
  31374. * @method
  31375. * @memberof Popper.Utils
  31376. * @argument {String} placement variation
  31377. * @returns {String} flipped placement variation
  31378. */
  31379. function getOppositeVariation(variation) {
  31380. if (variation === 'end') {
  31381. return 'start';
  31382. } else if (variation === 'start') {
  31383. return 'end';
  31384. }
  31385. return variation;
  31386. }
  31387. /**
  31388. * List of accepted placements to use as values of the `placement` option.<br />
  31389. * Valid placements are:
  31390. * - `auto`
  31391. * - `top`
  31392. * - `right`
  31393. * - `bottom`
  31394. * - `left`
  31395. *
  31396. * Each placement can have a variation from this list:
  31397. * - `-start`
  31398. * - `-end`
  31399. *
  31400. * Variations are interpreted easily if you think of them as the left to right
  31401. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  31402. * is right.<br />
  31403. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  31404. *
  31405. * Some valid examples are:
  31406. * - `top-end` (on top of reference, right aligned)
  31407. * - `right-start` (on right of reference, top aligned)
  31408. * - `bottom` (on bottom, centered)
  31409. * - `auto-end` (on the side with more space available, alignment depends by placement)
  31410. *
  31411. * @static
  31412. * @type {Array}
  31413. * @enum {String}
  31414. * @readonly
  31415. * @method placements
  31416. * @memberof Popper
  31417. */
  31418. 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'];
  31419. // Get rid of `auto` `auto-start` and `auto-end`
  31420. var validPlacements = placements.slice(3);
  31421. /**
  31422. * Given an initial placement, returns all the subsequent placements
  31423. * clockwise (or counter-clockwise).
  31424. *
  31425. * @method
  31426. * @memberof Popper.Utils
  31427. * @argument {String} placement - A valid placement (it accepts variations)
  31428. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  31429. * @returns {Array} placements including their variations
  31430. */
  31431. function clockwise(placement) {
  31432. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  31433. var index = validPlacements.indexOf(placement);
  31434. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  31435. return counter ? arr.reverse() : arr;
  31436. }
  31437. var BEHAVIORS = {
  31438. FLIP: 'flip',
  31439. CLOCKWISE: 'clockwise',
  31440. COUNTERCLOCKWISE: 'counterclockwise'
  31441. };
  31442. /**
  31443. * @function
  31444. * @memberof Modifiers
  31445. * @argument {Object} data - The data object generated by update method
  31446. * @argument {Object} options - Modifiers configuration and options
  31447. * @returns {Object} The data object, properly modified
  31448. */
  31449. function flip(data, options) {
  31450. // if `inner` modifier is enabled, we can't use the `flip` modifier
  31451. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  31452. return data;
  31453. }
  31454. if (data.flipped && data.placement === data.originalPlacement) {
  31455. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  31456. return data;
  31457. }
  31458. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  31459. var placement = data.placement.split('-')[0];
  31460. var placementOpposite = getOppositePlacement(placement);
  31461. var variation = data.placement.split('-')[1] || '';
  31462. var flipOrder = [];
  31463. switch (options.behavior) {
  31464. case BEHAVIORS.FLIP:
  31465. flipOrder = [placement, placementOpposite];
  31466. break;
  31467. case BEHAVIORS.CLOCKWISE:
  31468. flipOrder = clockwise(placement);
  31469. break;
  31470. case BEHAVIORS.COUNTERCLOCKWISE:
  31471. flipOrder = clockwise(placement, true);
  31472. break;
  31473. default:
  31474. flipOrder = options.behavior;
  31475. }
  31476. flipOrder.forEach(function (step, index) {
  31477. if (placement !== step || flipOrder.length === index + 1) {
  31478. return data;
  31479. }
  31480. placement = data.placement.split('-')[0];
  31481. placementOpposite = getOppositePlacement(placement);
  31482. var popperOffsets = data.offsets.popper;
  31483. var refOffsets = data.offsets.reference;
  31484. // using floor because the reference offsets may contain decimals we are not going to consider here
  31485. var floor = Math.floor;
  31486. 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);
  31487. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  31488. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  31489. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  31490. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  31491. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  31492. // flip the variation if required
  31493. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31494. // flips variation if reference element overflows boundaries
  31495. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  31496. // flips variation if popper content overflows boundaries
  31497. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  31498. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  31499. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  31500. // this boolean to detect any flip loop
  31501. data.flipped = true;
  31502. if (overlapsRef || overflowsBoundaries) {
  31503. placement = flipOrder[index + 1];
  31504. }
  31505. if (flippedVariation) {
  31506. variation = getOppositeVariation(variation);
  31507. }
  31508. data.placement = placement + (variation ? '-' + variation : '');
  31509. // this object contains `position`, we want to preserve it along with
  31510. // any additional property we may add in the future
  31511. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  31512. data = runModifiers(data.instance.modifiers, data, 'flip');
  31513. }
  31514. });
  31515. return data;
  31516. }
  31517. /**
  31518. * @function
  31519. * @memberof Modifiers
  31520. * @argument {Object} data - The data object generated by update method
  31521. * @argument {Object} options - Modifiers configuration and options
  31522. * @returns {Object} The data object, properly modified
  31523. */
  31524. function keepTogether(data) {
  31525. var _data$offsets = data.offsets,
  31526. popper = _data$offsets.popper,
  31527. reference = _data$offsets.reference;
  31528. var placement = data.placement.split('-')[0];
  31529. var floor = Math.floor;
  31530. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31531. var side = isVertical ? 'right' : 'bottom';
  31532. var opSide = isVertical ? 'left' : 'top';
  31533. var measurement = isVertical ? 'width' : 'height';
  31534. if (popper[side] < floor(reference[opSide])) {
  31535. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  31536. }
  31537. if (popper[opSide] > floor(reference[side])) {
  31538. data.offsets.popper[opSide] = floor(reference[side]);
  31539. }
  31540. return data;
  31541. }
  31542. /**
  31543. * Converts a string containing value + unit into a px value number
  31544. * @function
  31545. * @memberof {modifiers~offset}
  31546. * @private
  31547. * @argument {String} str - Value + unit string
  31548. * @argument {String} measurement - `height` or `width`
  31549. * @argument {Object} popperOffsets
  31550. * @argument {Object} referenceOffsets
  31551. * @returns {Number|String}
  31552. * Value in pixels, or original string if no values were extracted
  31553. */
  31554. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  31555. // separate value from unit
  31556. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  31557. var value = +split[1];
  31558. var unit = split[2];
  31559. // If it's not a number it's an operator, I guess
  31560. if (!value) {
  31561. return str;
  31562. }
  31563. if (unit.indexOf('%') === 0) {
  31564. var element = void 0;
  31565. switch (unit) {
  31566. case '%p':
  31567. element = popperOffsets;
  31568. break;
  31569. case '%':
  31570. case '%r':
  31571. default:
  31572. element = referenceOffsets;
  31573. }
  31574. var rect = getClientRect(element);
  31575. return rect[measurement] / 100 * value;
  31576. } else if (unit === 'vh' || unit === 'vw') {
  31577. // if is a vh or vw, we calculate the size based on the viewport
  31578. var size = void 0;
  31579. if (unit === 'vh') {
  31580. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  31581. } else {
  31582. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  31583. }
  31584. return size / 100 * value;
  31585. } else {
  31586. // if is an explicit pixel unit, we get rid of the unit and keep the value
  31587. // if is an implicit unit, it's px, and we return just the value
  31588. return value;
  31589. }
  31590. }
  31591. /**
  31592. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  31593. * @function
  31594. * @memberof {modifiers~offset}
  31595. * @private
  31596. * @argument {String} offset
  31597. * @argument {Object} popperOffsets
  31598. * @argument {Object} referenceOffsets
  31599. * @argument {String} basePlacement
  31600. * @returns {Array} a two cells array with x and y offsets in numbers
  31601. */
  31602. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  31603. var offsets = [0, 0];
  31604. // Use height if placement is left or right and index is 0 otherwise use width
  31605. // in this way the first offset will use an axis and the second one
  31606. // will use the other one
  31607. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  31608. // Split the offset string to obtain a list of values and operands
  31609. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  31610. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  31611. return frag.trim();
  31612. });
  31613. // Detect if the offset string contains a pair of values or a single one
  31614. // they could be separated by comma or space
  31615. var divider = fragments.indexOf(find(fragments, function (frag) {
  31616. return frag.search(/,|\s/) !== -1;
  31617. }));
  31618. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  31619. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  31620. }
  31621. // If divider is found, we divide the list of values and operands to divide
  31622. // them by ofset X and Y.
  31623. var splitRegex = /\s*,\s*|\s+/;
  31624. 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];
  31625. // Convert the values with units to absolute pixels to allow our computations
  31626. ops = ops.map(function (op, index) {
  31627. // Most of the units rely on the orientation of the popper
  31628. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  31629. var mergeWithPrevious = false;
  31630. return op
  31631. // This aggregates any `+` or `-` sign that aren't considered operators
  31632. // e.g.: 10 + +5 => [10, +, +5]
  31633. .reduce(function (a, b) {
  31634. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  31635. a[a.length - 1] = b;
  31636. mergeWithPrevious = true;
  31637. return a;
  31638. } else if (mergeWithPrevious) {
  31639. a[a.length - 1] += b;
  31640. mergeWithPrevious = false;
  31641. return a;
  31642. } else {
  31643. return a.concat(b);
  31644. }
  31645. }, [])
  31646. // Here we convert the string values into number values (in px)
  31647. .map(function (str) {
  31648. return toValue(str, measurement, popperOffsets, referenceOffsets);
  31649. });
  31650. });
  31651. // Loop trough the offsets arrays and execute the operations
  31652. ops.forEach(function (op, index) {
  31653. op.forEach(function (frag, index2) {
  31654. if (isNumeric(frag)) {
  31655. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31656. }
  31657. });
  31658. });
  31659. return offsets;
  31660. }
  31661. /**
  31662. * @function
  31663. * @memberof Modifiers
  31664. * @argument {Object} data - The data object generated by update method
  31665. * @argument {Object} options - Modifiers configuration and options
  31666. * @argument {Number|String} options.offset=0
  31667. * The offset value as described in the modifier description
  31668. * @returns {Object} The data object, properly modified
  31669. */
  31670. function offset(data, _ref) {
  31671. var offset = _ref.offset;
  31672. var placement = data.placement,
  31673. _data$offsets = data.offsets,
  31674. popper = _data$offsets.popper,
  31675. reference = _data$offsets.reference;
  31676. var basePlacement = placement.split('-')[0];
  31677. var offsets = void 0;
  31678. if (isNumeric(+offset)) {
  31679. offsets = [+offset, 0];
  31680. } else {
  31681. offsets = parseOffset(offset, popper, reference, basePlacement);
  31682. }
  31683. if (basePlacement === 'left') {
  31684. popper.top += offsets[0];
  31685. popper.left -= offsets[1];
  31686. } else if (basePlacement === 'right') {
  31687. popper.top += offsets[0];
  31688. popper.left += offsets[1];
  31689. } else if (basePlacement === 'top') {
  31690. popper.left += offsets[0];
  31691. popper.top -= offsets[1];
  31692. } else if (basePlacement === 'bottom') {
  31693. popper.left += offsets[0];
  31694. popper.top += offsets[1];
  31695. }
  31696. data.popper = popper;
  31697. return data;
  31698. }
  31699. /**
  31700. * @function
  31701. * @memberof Modifiers
  31702. * @argument {Object} data - The data object generated by `update` method
  31703. * @argument {Object} options - Modifiers configuration and options
  31704. * @returns {Object} The data object, properly modified
  31705. */
  31706. function preventOverflow(data, options) {
  31707. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31708. // If offsetParent is the reference element, we really want to
  31709. // go one step up and use the next offsetParent as reference to
  31710. // avoid to make this modifier completely useless and look like broken
  31711. if (data.instance.reference === boundariesElement) {
  31712. boundariesElement = getOffsetParent(boundariesElement);
  31713. }
  31714. // NOTE: DOM access here
  31715. // resets the popper's position so that the document size can be calculated excluding
  31716. // the size of the popper element itself
  31717. var transformProp = getSupportedPropertyName('transform');
  31718. var popperStyles = data.instance.popper.style; // assignment to help minification
  31719. var top = popperStyles.top,
  31720. left = popperStyles.left,
  31721. transform = popperStyles[transformProp];
  31722. popperStyles.top = '';
  31723. popperStyles.left = '';
  31724. popperStyles[transformProp] = '';
  31725. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31726. // NOTE: DOM access here
  31727. // restores the original style properties after the offsets have been computed
  31728. popperStyles.top = top;
  31729. popperStyles.left = left;
  31730. popperStyles[transformProp] = transform;
  31731. options.boundaries = boundaries;
  31732. var order = options.priority;
  31733. var popper = data.offsets.popper;
  31734. var check = {
  31735. primary: function primary(placement) {
  31736. var value = popper[placement];
  31737. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31738. value = Math.max(popper[placement], boundaries[placement]);
  31739. }
  31740. return defineProperty({}, placement, value);
  31741. },
  31742. secondary: function secondary(placement) {
  31743. var mainSide = placement === 'right' ? 'left' : 'top';
  31744. var value = popper[mainSide];
  31745. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31746. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31747. }
  31748. return defineProperty({}, mainSide, value);
  31749. }
  31750. };
  31751. order.forEach(function (placement) {
  31752. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31753. popper = _extends({}, popper, check[side](placement));
  31754. });
  31755. data.offsets.popper = popper;
  31756. return data;
  31757. }
  31758. /**
  31759. * @function
  31760. * @memberof Modifiers
  31761. * @argument {Object} data - The data object generated by `update` method
  31762. * @argument {Object} options - Modifiers configuration and options
  31763. * @returns {Object} The data object, properly modified
  31764. */
  31765. function shift(data) {
  31766. var placement = data.placement;
  31767. var basePlacement = placement.split('-')[0];
  31768. var shiftvariation = placement.split('-')[1];
  31769. // if shift shiftvariation is specified, run the modifier
  31770. if (shiftvariation) {
  31771. var _data$offsets = data.offsets,
  31772. reference = _data$offsets.reference,
  31773. popper = _data$offsets.popper;
  31774. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31775. var side = isVertical ? 'left' : 'top';
  31776. var measurement = isVertical ? 'width' : 'height';
  31777. var shiftOffsets = {
  31778. start: defineProperty({}, side, reference[side]),
  31779. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31780. };
  31781. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31782. }
  31783. return data;
  31784. }
  31785. /**
  31786. * @function
  31787. * @memberof Modifiers
  31788. * @argument {Object} data - The data object generated by update method
  31789. * @argument {Object} options - Modifiers configuration and options
  31790. * @returns {Object} The data object, properly modified
  31791. */
  31792. function hide(data) {
  31793. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31794. return data;
  31795. }
  31796. var refRect = data.offsets.reference;
  31797. var bound = find(data.instance.modifiers, function (modifier) {
  31798. return modifier.name === 'preventOverflow';
  31799. }).boundaries;
  31800. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31801. // Avoid unnecessary DOM access if visibility hasn't changed
  31802. if (data.hide === true) {
  31803. return data;
  31804. }
  31805. data.hide = true;
  31806. data.attributes['x-out-of-boundaries'] = '';
  31807. } else {
  31808. // Avoid unnecessary DOM access if visibility hasn't changed
  31809. if (data.hide === false) {
  31810. return data;
  31811. }
  31812. data.hide = false;
  31813. data.attributes['x-out-of-boundaries'] = false;
  31814. }
  31815. return data;
  31816. }
  31817. /**
  31818. * @function
  31819. * @memberof Modifiers
  31820. * @argument {Object} data - The data object generated by `update` method
  31821. * @argument {Object} options - Modifiers configuration and options
  31822. * @returns {Object} The data object, properly modified
  31823. */
  31824. function inner(data) {
  31825. var placement = data.placement;
  31826. var basePlacement = placement.split('-')[0];
  31827. var _data$offsets = data.offsets,
  31828. popper = _data$offsets.popper,
  31829. reference = _data$offsets.reference;
  31830. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31831. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31832. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31833. data.placement = getOppositePlacement(placement);
  31834. data.offsets.popper = getClientRect(popper);
  31835. return data;
  31836. }
  31837. /**
  31838. * Modifier function, each modifier can have a function of this type assigned
  31839. * to its `fn` property.<br />
  31840. * These functions will be called on each update, this means that you must
  31841. * make sure they are performant enough to avoid performance bottlenecks.
  31842. *
  31843. * @function ModifierFn
  31844. * @argument {dataObject} data - The data object generated by `update` method
  31845. * @argument {Object} options - Modifiers configuration and options
  31846. * @returns {dataObject} The data object, properly modified
  31847. */
  31848. /**
  31849. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31850. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31851. * needed by the library.
  31852. *
  31853. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31854. * All the other properties are configurations that could be tweaked.
  31855. * @namespace modifiers
  31856. */
  31857. var modifiers = {
  31858. /**
  31859. * Modifier used to shift the popper on the start or end of its reference
  31860. * element.<br />
  31861. * It will read the variation of the `placement` property.<br />
  31862. * It can be one either `-end` or `-start`.
  31863. * @memberof modifiers
  31864. * @inner
  31865. */
  31866. shift: {
  31867. /** @prop {number} order=100 - Index used to define the order of execution */
  31868. order: 100,
  31869. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31870. enabled: true,
  31871. /** @prop {ModifierFn} */
  31872. fn: shift
  31873. },
  31874. /**
  31875. * The `offset` modifier can shift your popper on both its axis.
  31876. *
  31877. * It accepts the following units:
  31878. * - `px` or unit-less, interpreted as pixels
  31879. * - `%` or `%r`, percentage relative to the length of the reference element
  31880. * - `%p`, percentage relative to the length of the popper element
  31881. * - `vw`, CSS viewport width unit
  31882. * - `vh`, CSS viewport height unit
  31883. *
  31884. * For length is intended the main axis relative to the placement of the popper.<br />
  31885. * This means that if the placement is `top` or `bottom`, the length will be the
  31886. * `width`. In case of `left` or `right`, it will be the `height`.
  31887. *
  31888. * You can provide a single value (as `Number` or `String`), or a pair of values
  31889. * as `String` divided by a comma or one (or more) white spaces.<br />
  31890. * The latter is a deprecated method because it leads to confusion and will be
  31891. * removed in v2.<br />
  31892. * Additionally, it accepts additions and subtractions between different units.
  31893. * Note that multiplications and divisions aren't supported.
  31894. *
  31895. * Valid examples are:
  31896. * ```
  31897. * 10
  31898. * '10%'
  31899. * '10, 10'
  31900. * '10%, 10'
  31901. * '10 + 10%'
  31902. * '10 - 5vh + 3%'
  31903. * '-10px + 5vh, 5px - 6%'
  31904. * ```
  31905. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31906. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31907. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31908. *
  31909. * @memberof modifiers
  31910. * @inner
  31911. */
  31912. offset: {
  31913. /** @prop {number} order=200 - Index used to define the order of execution */
  31914. order: 200,
  31915. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31916. enabled: true,
  31917. /** @prop {ModifierFn} */
  31918. fn: offset,
  31919. /** @prop {Number|String} offset=0
  31920. * The offset value as described in the modifier description
  31921. */
  31922. offset: 0
  31923. },
  31924. /**
  31925. * Modifier used to prevent the popper from being positioned outside the boundary.
  31926. *
  31927. * A scenario exists where the reference itself is not within the boundaries.<br />
  31928. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31929. * In this case we need to decide whether the popper should either:
  31930. *
  31931. * - detach from the reference and remain "trapped" in the boundaries, or
  31932. * - if it should ignore the boundary and "escape with its reference"
  31933. *
  31934. * When `escapeWithReference` is set to`true` and reference is completely
  31935. * outside its boundaries, the popper will overflow (or completely leave)
  31936. * the boundaries in order to remain attached to the edge of the reference.
  31937. *
  31938. * @memberof modifiers
  31939. * @inner
  31940. */
  31941. preventOverflow: {
  31942. /** @prop {number} order=300 - Index used to define the order of execution */
  31943. order: 300,
  31944. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31945. enabled: true,
  31946. /** @prop {ModifierFn} */
  31947. fn: preventOverflow,
  31948. /**
  31949. * @prop {Array} [priority=['left','right','top','bottom']]
  31950. * Popper will try to prevent overflow following these priorities by default,
  31951. * then, it could overflow on the left and on top of the `boundariesElement`
  31952. */
  31953. priority: ['left', 'right', 'top', 'bottom'],
  31954. /**
  31955. * @prop {number} padding=5
  31956. * Amount of pixel used to define a minimum distance between the boundaries
  31957. * and the popper. This makes sure the popper always has a little padding
  31958. * between the edges of its container
  31959. */
  31960. padding: 5,
  31961. /**
  31962. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31963. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31964. * `viewport` or any DOM element.
  31965. */
  31966. boundariesElement: 'scrollParent'
  31967. },
  31968. /**
  31969. * Modifier used to make sure the reference and its popper stay near each other
  31970. * without leaving any gap between the two. Especially useful when the arrow is
  31971. * enabled and you want to ensure that it points to its reference element.
  31972. * It cares only about the first axis. You can still have poppers with margin
  31973. * between the popper and its reference element.
  31974. * @memberof modifiers
  31975. * @inner
  31976. */
  31977. keepTogether: {
  31978. /** @prop {number} order=400 - Index used to define the order of execution */
  31979. order: 400,
  31980. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31981. enabled: true,
  31982. /** @prop {ModifierFn} */
  31983. fn: keepTogether
  31984. },
  31985. /**
  31986. * This modifier is used to move the `arrowElement` of the popper to make
  31987. * sure it is positioned between the reference element and its popper element.
  31988. * It will read the outer size of the `arrowElement` node to detect how many
  31989. * pixels of conjunction are needed.
  31990. *
  31991. * It has no effect if no `arrowElement` is provided.
  31992. * @memberof modifiers
  31993. * @inner
  31994. */
  31995. arrow: {
  31996. /** @prop {number} order=500 - Index used to define the order of execution */
  31997. order: 500,
  31998. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31999. enabled: true,
  32000. /** @prop {ModifierFn} */
  32001. fn: arrow,
  32002. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  32003. element: '[x-arrow]'
  32004. },
  32005. /**
  32006. * Modifier used to flip the popper's placement when it starts to overlap its
  32007. * reference element.
  32008. *
  32009. * Requires the `preventOverflow` modifier before it in order to work.
  32010. *
  32011. * **NOTE:** this modifier will interrupt the current update cycle and will
  32012. * restart it if it detects the need to flip the placement.
  32013. * @memberof modifiers
  32014. * @inner
  32015. */
  32016. flip: {
  32017. /** @prop {number} order=600 - Index used to define the order of execution */
  32018. order: 600,
  32019. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32020. enabled: true,
  32021. /** @prop {ModifierFn} */
  32022. fn: flip,
  32023. /**
  32024. * @prop {String|Array} behavior='flip'
  32025. * The behavior used to change the popper's placement. It can be one of
  32026. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  32027. * placements (with optional variations)
  32028. */
  32029. behavior: 'flip',
  32030. /**
  32031. * @prop {number} padding=5
  32032. * The popper will flip if it hits the edges of the `boundariesElement`
  32033. */
  32034. padding: 5,
  32035. /**
  32036. * @prop {String|HTMLElement} boundariesElement='viewport'
  32037. * The element which will define the boundaries of the popper position.
  32038. * The popper will never be placed outside of the defined boundaries
  32039. * (except if `keepTogether` is enabled)
  32040. */
  32041. boundariesElement: 'viewport',
  32042. /**
  32043. * @prop {Boolean} flipVariations=false
  32044. * The popper will switch placement variation between `-start` and `-end` when
  32045. * the reference element overlaps its boundaries.
  32046. *
  32047. * The original placement should have a set variation.
  32048. */
  32049. flipVariations: false,
  32050. /**
  32051. * @prop {Boolean} flipVariationsByContent=false
  32052. * The popper will switch placement variation between `-start` and `-end` when
  32053. * the popper element overlaps its reference boundaries.
  32054. *
  32055. * The original placement should have a set variation.
  32056. */
  32057. flipVariationsByContent: false
  32058. },
  32059. /**
  32060. * Modifier used to make the popper flow toward the inner of the reference element.
  32061. * By default, when this modifier is disabled, the popper will be placed outside
  32062. * the reference element.
  32063. * @memberof modifiers
  32064. * @inner
  32065. */
  32066. inner: {
  32067. /** @prop {number} order=700 - Index used to define the order of execution */
  32068. order: 700,
  32069. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  32070. enabled: false,
  32071. /** @prop {ModifierFn} */
  32072. fn: inner
  32073. },
  32074. /**
  32075. * Modifier used to hide the popper when its reference element is outside of the
  32076. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  32077. * be used to hide with a CSS selector the popper when its reference is
  32078. * out of boundaries.
  32079. *
  32080. * Requires the `preventOverflow` modifier before it in order to work.
  32081. * @memberof modifiers
  32082. * @inner
  32083. */
  32084. hide: {
  32085. /** @prop {number} order=800 - Index used to define the order of execution */
  32086. order: 800,
  32087. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32088. enabled: true,
  32089. /** @prop {ModifierFn} */
  32090. fn: hide
  32091. },
  32092. /**
  32093. * Computes the style that will be applied to the popper element to gets
  32094. * properly positioned.
  32095. *
  32096. * Note that this modifier will not touch the DOM, it just prepares the styles
  32097. * so that `applyStyle` modifier can apply it. This separation is useful
  32098. * in case you need to replace `applyStyle` with a custom implementation.
  32099. *
  32100. * This modifier has `850` as `order` value to maintain backward compatibility
  32101. * with previous versions of Popper.js. Expect the modifiers ordering method
  32102. * to change in future major versions of the library.
  32103. *
  32104. * @memberof modifiers
  32105. * @inner
  32106. */
  32107. computeStyle: {
  32108. /** @prop {number} order=850 - Index used to define the order of execution */
  32109. order: 850,
  32110. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32111. enabled: true,
  32112. /** @prop {ModifierFn} */
  32113. fn: computeStyle,
  32114. /**
  32115. * @prop {Boolean} gpuAcceleration=true
  32116. * If true, it uses the CSS 3D transformation to position the popper.
  32117. * Otherwise, it will use the `top` and `left` properties
  32118. */
  32119. gpuAcceleration: true,
  32120. /**
  32121. * @prop {string} [x='bottom']
  32122. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  32123. * Change this if your popper should grow in a direction different from `bottom`
  32124. */
  32125. x: 'bottom',
  32126. /**
  32127. * @prop {string} [x='left']
  32128. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  32129. * Change this if your popper should grow in a direction different from `right`
  32130. */
  32131. y: 'right'
  32132. },
  32133. /**
  32134. * Applies the computed styles to the popper element.
  32135. *
  32136. * All the DOM manipulations are limited to this modifier. This is useful in case
  32137. * you want to integrate Popper.js inside a framework or view library and you
  32138. * want to delegate all the DOM manipulations to it.
  32139. *
  32140. * Note that if you disable this modifier, you must make sure the popper element
  32141. * has its position set to `absolute` before Popper.js can do its work!
  32142. *
  32143. * Just disable this modifier and define your own to achieve the desired effect.
  32144. *
  32145. * @memberof modifiers
  32146. * @inner
  32147. */
  32148. applyStyle: {
  32149. /** @prop {number} order=900 - Index used to define the order of execution */
  32150. order: 900,
  32151. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32152. enabled: true,
  32153. /** @prop {ModifierFn} */
  32154. fn: applyStyle,
  32155. /** @prop {Function} */
  32156. onLoad: applyStyleOnLoad,
  32157. /**
  32158. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  32159. * @prop {Boolean} gpuAcceleration=true
  32160. * If true, it uses the CSS 3D transformation to position the popper.
  32161. * Otherwise, it will use the `top` and `left` properties
  32162. */
  32163. gpuAcceleration: undefined
  32164. }
  32165. };
  32166. /**
  32167. * The `dataObject` is an object containing all the information used by Popper.js.
  32168. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  32169. * @name dataObject
  32170. * @property {Object} data.instance The Popper.js instance
  32171. * @property {String} data.placement Placement applied to popper
  32172. * @property {String} data.originalPlacement Placement originally defined on init
  32173. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  32174. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  32175. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  32176. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32177. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32178. * @property {Object} data.boundaries Offsets of the popper boundaries
  32179. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  32180. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  32181. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  32182. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  32183. */
  32184. /**
  32185. * Default options provided to Popper.js constructor.<br />
  32186. * These can be overridden using the `options` argument of Popper.js.<br />
  32187. * To override an option, simply pass an object with the same
  32188. * structure of the `options` object, as the 3rd argument. For example:
  32189. * ```
  32190. * new Popper(ref, pop, {
  32191. * modifiers: {
  32192. * preventOverflow: { enabled: false }
  32193. * }
  32194. * })
  32195. * ```
  32196. * @type {Object}
  32197. * @static
  32198. * @memberof Popper
  32199. */
  32200. var Defaults = {
  32201. /**
  32202. * Popper's placement.
  32203. * @prop {Popper.placements} placement='bottom'
  32204. */
  32205. placement: 'bottom',
  32206. /**
  32207. * Set this to true if you want popper to position it self in 'fixed' mode
  32208. * @prop {Boolean} positionFixed=false
  32209. */
  32210. positionFixed: false,
  32211. /**
  32212. * Whether events (resize, scroll) are initially enabled.
  32213. * @prop {Boolean} eventsEnabled=true
  32214. */
  32215. eventsEnabled: true,
  32216. /**
  32217. * Set to true if you want to automatically remove the popper when
  32218. * you call the `destroy` method.
  32219. * @prop {Boolean} removeOnDestroy=false
  32220. */
  32221. removeOnDestroy: false,
  32222. /**
  32223. * Callback called when the popper is created.<br />
  32224. * By default, it is set to no-op.<br />
  32225. * Access Popper.js instance with `data.instance`.
  32226. * @prop {onCreate}
  32227. */
  32228. onCreate: function onCreate() {},
  32229. /**
  32230. * Callback called when the popper is updated. This callback is not called
  32231. * on the initialization/creation of the popper, but only on subsequent
  32232. * updates.<br />
  32233. * By default, it is set to no-op.<br />
  32234. * Access Popper.js instance with `data.instance`.
  32235. * @prop {onUpdate}
  32236. */
  32237. onUpdate: function onUpdate() {},
  32238. /**
  32239. * List of modifiers used to modify the offsets before they are applied to the popper.
  32240. * They provide most of the functionalities of Popper.js.
  32241. * @prop {modifiers}
  32242. */
  32243. modifiers: modifiers
  32244. };
  32245. /**
  32246. * @callback onCreate
  32247. * @param {dataObject} data
  32248. */
  32249. /**
  32250. * @callback onUpdate
  32251. * @param {dataObject} data
  32252. */
  32253. // Utils
  32254. // Methods
  32255. var Popper = function () {
  32256. /**
  32257. * Creates a new Popper.js instance.
  32258. * @class Popper
  32259. * @param {Element|referenceObject} reference - The reference element used to position the popper
  32260. * @param {Element} popper - The HTML / XML element used as the popper
  32261. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  32262. * @return {Object} instance - The generated Popper.js instance
  32263. */
  32264. function Popper(reference, popper) {
  32265. var _this = this;
  32266. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  32267. classCallCheck(this, Popper);
  32268. this.scheduleUpdate = function () {
  32269. return requestAnimationFrame(_this.update);
  32270. };
  32271. // make update() debounced, so that it only runs at most once-per-tick
  32272. this.update = debounce(this.update.bind(this));
  32273. // with {} we create a new object with the options inside it
  32274. this.options = _extends({}, Popper.Defaults, options);
  32275. // init state
  32276. this.state = {
  32277. isDestroyed: false,
  32278. isCreated: false,
  32279. scrollParents: []
  32280. };
  32281. // get reference and popper elements (allow jQuery wrappers)
  32282. this.reference = reference && reference.jquery ? reference[0] : reference;
  32283. this.popper = popper && popper.jquery ? popper[0] : popper;
  32284. // Deep merge modifiers options
  32285. this.options.modifiers = {};
  32286. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  32287. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  32288. });
  32289. // Refactoring modifiers' list (Object => Array)
  32290. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  32291. return _extends({
  32292. name: name
  32293. }, _this.options.modifiers[name]);
  32294. })
  32295. // sort the modifiers by order
  32296. .sort(function (a, b) {
  32297. return a.order - b.order;
  32298. });
  32299. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  32300. // such code is executed in the same order of its modifier
  32301. // they could add new properties to their options configuration
  32302. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  32303. this.modifiers.forEach(function (modifierOptions) {
  32304. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  32305. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  32306. }
  32307. });
  32308. // fire the first update to position the popper in the right place
  32309. this.update();
  32310. var eventsEnabled = this.options.eventsEnabled;
  32311. if (eventsEnabled) {
  32312. // setup event listeners, they will take care of update the position in specific situations
  32313. this.enableEventListeners();
  32314. }
  32315. this.state.eventsEnabled = eventsEnabled;
  32316. }
  32317. // We can't use class properties because they don't get listed in the
  32318. // class prototype and break stuff like Sinon stubs
  32319. createClass(Popper, [{
  32320. key: 'update',
  32321. value: function update$$1() {
  32322. return update.call(this);
  32323. }
  32324. }, {
  32325. key: 'destroy',
  32326. value: function destroy$$1() {
  32327. return destroy.call(this);
  32328. }
  32329. }, {
  32330. key: 'enableEventListeners',
  32331. value: function enableEventListeners$$1() {
  32332. return enableEventListeners.call(this);
  32333. }
  32334. }, {
  32335. key: 'disableEventListeners',
  32336. value: function disableEventListeners$$1() {
  32337. return disableEventListeners.call(this);
  32338. }
  32339. /**
  32340. * Schedules an update. It will run on the next UI update available.
  32341. * @method scheduleUpdate
  32342. * @memberof Popper
  32343. */
  32344. /**
  32345. * Collection of utilities useful when writing custom modifiers.
  32346. * Starting from version 1.7, this method is available only if you
  32347. * include `popper-utils.js` before `popper.js`.
  32348. *
  32349. * **DEPRECATION**: This way to access PopperUtils is deprecated
  32350. * and will be removed in v2! Use the PopperUtils module directly instead.
  32351. * Due to the high instability of the methods contained in Utils, we can't
  32352. * guarantee them to follow semver. Use them at your own risk!
  32353. * @static
  32354. * @private
  32355. * @type {Object}
  32356. * @deprecated since version 1.8
  32357. * @member Utils
  32358. * @memberof Popper
  32359. */
  32360. }]);
  32361. return Popper;
  32362. }();
  32363. /**
  32364. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  32365. * and lets you use it as replacement of a real DOM node.<br />
  32366. * You can use this method to position a popper relatively to a set of coordinates
  32367. * in case you don't have a DOM node to use as reference.
  32368. *
  32369. * ```
  32370. * new Popper(referenceObject, popperNode);
  32371. * ```
  32372. *
  32373. * NB: This feature isn't supported in Internet Explorer 10.
  32374. * @name referenceObject
  32375. * @property {Function} data.getBoundingClientRect
  32376. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  32377. * @property {number} data.clientWidth
  32378. * An ES6 getter that will return the width of the virtual reference element.
  32379. * @property {number} data.clientHeight
  32380. * An ES6 getter that will return the height of the virtual reference element.
  32381. */
  32382. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  32383. Popper.placements = placements;
  32384. Popper.Defaults = Defaults;
  32385. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  32386. //# sourceMappingURL=popper.js.map
  32387. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32388. /***/ }),
  32389. /***/ "./node_modules/process/browser.js":
  32390. /*!*****************************************!*\
  32391. !*** ./node_modules/process/browser.js ***!
  32392. \*****************************************/
  32393. /*! no static exports found */
  32394. /***/ (function(module, exports) {
  32395. // shim for using process in browser
  32396. var process = module.exports = {};
  32397. // cached from whatever global is present so that test runners that stub it
  32398. // don't break things. But we need to wrap it in a try catch in case it is
  32399. // wrapped in strict mode code which doesn't define any globals. It's inside a
  32400. // function because try/catches deoptimize in certain engines.
  32401. var cachedSetTimeout;
  32402. var cachedClearTimeout;
  32403. function defaultSetTimout() {
  32404. throw new Error('setTimeout has not been defined');
  32405. }
  32406. function defaultClearTimeout () {
  32407. throw new Error('clearTimeout has not been defined');
  32408. }
  32409. (function () {
  32410. try {
  32411. if (typeof setTimeout === 'function') {
  32412. cachedSetTimeout = setTimeout;
  32413. } else {
  32414. cachedSetTimeout = defaultSetTimout;
  32415. }
  32416. } catch (e) {
  32417. cachedSetTimeout = defaultSetTimout;
  32418. }
  32419. try {
  32420. if (typeof clearTimeout === 'function') {
  32421. cachedClearTimeout = clearTimeout;
  32422. } else {
  32423. cachedClearTimeout = defaultClearTimeout;
  32424. }
  32425. } catch (e) {
  32426. cachedClearTimeout = defaultClearTimeout;
  32427. }
  32428. } ())
  32429. function runTimeout(fun) {
  32430. if (cachedSetTimeout === setTimeout) {
  32431. //normal enviroments in sane situations
  32432. return setTimeout(fun, 0);
  32433. }
  32434. // if setTimeout wasn't available but was latter defined
  32435. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  32436. cachedSetTimeout = setTimeout;
  32437. return setTimeout(fun, 0);
  32438. }
  32439. try {
  32440. // when when somebody has screwed with setTimeout but no I.E. maddness
  32441. return cachedSetTimeout(fun, 0);
  32442. } catch(e){
  32443. try {
  32444. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32445. return cachedSetTimeout.call(null, fun, 0);
  32446. } catch(e){
  32447. // 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
  32448. return cachedSetTimeout.call(this, fun, 0);
  32449. }
  32450. }
  32451. }
  32452. function runClearTimeout(marker) {
  32453. if (cachedClearTimeout === clearTimeout) {
  32454. //normal enviroments in sane situations
  32455. return clearTimeout(marker);
  32456. }
  32457. // if clearTimeout wasn't available but was latter defined
  32458. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  32459. cachedClearTimeout = clearTimeout;
  32460. return clearTimeout(marker);
  32461. }
  32462. try {
  32463. // when when somebody has screwed with setTimeout but no I.E. maddness
  32464. return cachedClearTimeout(marker);
  32465. } catch (e){
  32466. try {
  32467. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32468. return cachedClearTimeout.call(null, marker);
  32469. } catch (e){
  32470. // 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.
  32471. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  32472. return cachedClearTimeout.call(this, marker);
  32473. }
  32474. }
  32475. }
  32476. var queue = [];
  32477. var draining = false;
  32478. var currentQueue;
  32479. var queueIndex = -1;
  32480. function cleanUpNextTick() {
  32481. if (!draining || !currentQueue) {
  32482. return;
  32483. }
  32484. draining = false;
  32485. if (currentQueue.length) {
  32486. queue = currentQueue.concat(queue);
  32487. } else {
  32488. queueIndex = -1;
  32489. }
  32490. if (queue.length) {
  32491. drainQueue();
  32492. }
  32493. }
  32494. function drainQueue() {
  32495. if (draining) {
  32496. return;
  32497. }
  32498. var timeout = runTimeout(cleanUpNextTick);
  32499. draining = true;
  32500. var len = queue.length;
  32501. while(len) {
  32502. currentQueue = queue;
  32503. queue = [];
  32504. while (++queueIndex < len) {
  32505. if (currentQueue) {
  32506. currentQueue[queueIndex].run();
  32507. }
  32508. }
  32509. queueIndex = -1;
  32510. len = queue.length;
  32511. }
  32512. currentQueue = null;
  32513. draining = false;
  32514. runClearTimeout(timeout);
  32515. }
  32516. process.nextTick = function (fun) {
  32517. var args = new Array(arguments.length - 1);
  32518. if (arguments.length > 1) {
  32519. for (var i = 1; i < arguments.length; i++) {
  32520. args[i - 1] = arguments[i];
  32521. }
  32522. }
  32523. queue.push(new Item(fun, args));
  32524. if (queue.length === 1 && !draining) {
  32525. runTimeout(drainQueue);
  32526. }
  32527. };
  32528. // v8 likes predictible objects
  32529. function Item(fun, array) {
  32530. this.fun = fun;
  32531. this.array = array;
  32532. }
  32533. Item.prototype.run = function () {
  32534. this.fun.apply(null, this.array);
  32535. };
  32536. process.title = 'browser';
  32537. process.browser = true;
  32538. process.env = {};
  32539. process.argv = [];
  32540. process.version = ''; // empty string to avoid regexp issues
  32541. process.versions = {};
  32542. function noop() {}
  32543. process.on = noop;
  32544. process.addListener = noop;
  32545. process.once = noop;
  32546. process.off = noop;
  32547. process.removeListener = noop;
  32548. process.removeAllListeners = noop;
  32549. process.emit = noop;
  32550. process.prependListener = noop;
  32551. process.prependOnceListener = noop;
  32552. process.listeners = function (name) { return [] }
  32553. process.binding = function (name) {
  32554. throw new Error('process.binding is not supported');
  32555. };
  32556. process.cwd = function () { return '/' };
  32557. process.chdir = function (dir) {
  32558. throw new Error('process.chdir is not supported');
  32559. };
  32560. process.umask = function() { return 0; };
  32561. /***/ }),
  32562. /***/ "./node_modules/setimmediate/setImmediate.js":
  32563. /*!***************************************************!*\
  32564. !*** ./node_modules/setimmediate/setImmediate.js ***!
  32565. \***************************************************/
  32566. /*! no static exports found */
  32567. /***/ (function(module, exports, __webpack_require__) {
  32568. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  32569. "use strict";
  32570. if (global.setImmediate) {
  32571. return;
  32572. }
  32573. var nextHandle = 1; // Spec says greater than zero
  32574. var tasksByHandle = {};
  32575. var currentlyRunningATask = false;
  32576. var doc = global.document;
  32577. var registerImmediate;
  32578. function setImmediate(callback) {
  32579. // Callback can either be a function or a string
  32580. if (typeof callback !== "function") {
  32581. callback = new Function("" + callback);
  32582. }
  32583. // Copy function arguments
  32584. var args = new Array(arguments.length - 1);
  32585. for (var i = 0; i < args.length; i++) {
  32586. args[i] = arguments[i + 1];
  32587. }
  32588. // Store and register the task
  32589. var task = { callback: callback, args: args };
  32590. tasksByHandle[nextHandle] = task;
  32591. registerImmediate(nextHandle);
  32592. return nextHandle++;
  32593. }
  32594. function clearImmediate(handle) {
  32595. delete tasksByHandle[handle];
  32596. }
  32597. function run(task) {
  32598. var callback = task.callback;
  32599. var args = task.args;
  32600. switch (args.length) {
  32601. case 0:
  32602. callback();
  32603. break;
  32604. case 1:
  32605. callback(args[0]);
  32606. break;
  32607. case 2:
  32608. callback(args[0], args[1]);
  32609. break;
  32610. case 3:
  32611. callback(args[0], args[1], args[2]);
  32612. break;
  32613. default:
  32614. callback.apply(undefined, args);
  32615. break;
  32616. }
  32617. }
  32618. function runIfPresent(handle) {
  32619. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  32620. // So if we're currently running a task, we'll need to delay this invocation.
  32621. if (currentlyRunningATask) {
  32622. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  32623. // "too much recursion" error.
  32624. setTimeout(runIfPresent, 0, handle);
  32625. } else {
  32626. var task = tasksByHandle[handle];
  32627. if (task) {
  32628. currentlyRunningATask = true;
  32629. try {
  32630. run(task);
  32631. } finally {
  32632. clearImmediate(handle);
  32633. currentlyRunningATask = false;
  32634. }
  32635. }
  32636. }
  32637. }
  32638. function installNextTickImplementation() {
  32639. registerImmediate = function(handle) {
  32640. process.nextTick(function () { runIfPresent(handle); });
  32641. };
  32642. }
  32643. function canUsePostMessage() {
  32644. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  32645. // where `global.postMessage` means something completely different and can't be used for this purpose.
  32646. if (global.postMessage && !global.importScripts) {
  32647. var postMessageIsAsynchronous = true;
  32648. var oldOnMessage = global.onmessage;
  32649. global.onmessage = function() {
  32650. postMessageIsAsynchronous = false;
  32651. };
  32652. global.postMessage("", "*");
  32653. global.onmessage = oldOnMessage;
  32654. return postMessageIsAsynchronous;
  32655. }
  32656. }
  32657. function installPostMessageImplementation() {
  32658. // Installs an event handler on `global` for the `message` event: see
  32659. // * https://developer.mozilla.org/en/DOM/window.postMessage
  32660. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  32661. var messagePrefix = "setImmediate$" + Math.random() + "$";
  32662. var onGlobalMessage = function(event) {
  32663. if (event.source === global &&
  32664. typeof event.data === "string" &&
  32665. event.data.indexOf(messagePrefix) === 0) {
  32666. runIfPresent(+event.data.slice(messagePrefix.length));
  32667. }
  32668. };
  32669. if (global.addEventListener) {
  32670. global.addEventListener("message", onGlobalMessage, false);
  32671. } else {
  32672. global.attachEvent("onmessage", onGlobalMessage);
  32673. }
  32674. registerImmediate = function(handle) {
  32675. global.postMessage(messagePrefix + handle, "*");
  32676. };
  32677. }
  32678. function installMessageChannelImplementation() {
  32679. var channel = new MessageChannel();
  32680. channel.port1.onmessage = function(event) {
  32681. var handle = event.data;
  32682. runIfPresent(handle);
  32683. };
  32684. registerImmediate = function(handle) {
  32685. channel.port2.postMessage(handle);
  32686. };
  32687. }
  32688. function installReadyStateChangeImplementation() {
  32689. var html = doc.documentElement;
  32690. registerImmediate = function(handle) {
  32691. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32692. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32693. var script = doc.createElement("script");
  32694. script.onreadystatechange = function () {
  32695. runIfPresent(handle);
  32696. script.onreadystatechange = null;
  32697. html.removeChild(script);
  32698. script = null;
  32699. };
  32700. html.appendChild(script);
  32701. };
  32702. }
  32703. function installSetTimeoutImplementation() {
  32704. registerImmediate = function(handle) {
  32705. setTimeout(runIfPresent, 0, handle);
  32706. };
  32707. }
  32708. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32709. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32710. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32711. // Don't get fooled by e.g. browserify environments.
  32712. if ({}.toString.call(global.process) === "[object process]") {
  32713. // For Node.js before 0.9
  32714. installNextTickImplementation();
  32715. } else if (canUsePostMessage()) {
  32716. // For non-IE10 modern browsers
  32717. installPostMessageImplementation();
  32718. } else if (global.MessageChannel) {
  32719. // For web workers, where supported
  32720. installMessageChannelImplementation();
  32721. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32722. // For IE 6–8
  32723. installReadyStateChangeImplementation();
  32724. } else {
  32725. // For older browsers
  32726. installSetTimeoutImplementation();
  32727. }
  32728. attachTo.setImmediate = setImmediate;
  32729. attachTo.clearImmediate = clearImmediate;
  32730. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32731. /* 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")))
  32732. /***/ }),
  32733. /***/ "./node_modules/timers-browserify/main.js":
  32734. /*!************************************************!*\
  32735. !*** ./node_modules/timers-browserify/main.js ***!
  32736. \************************************************/
  32737. /*! no static exports found */
  32738. /***/ (function(module, exports, __webpack_require__) {
  32739. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32740. (typeof self !== "undefined" && self) ||
  32741. window;
  32742. var apply = Function.prototype.apply;
  32743. // DOM APIs, for completeness
  32744. exports.setTimeout = function() {
  32745. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32746. };
  32747. exports.setInterval = function() {
  32748. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32749. };
  32750. exports.clearTimeout =
  32751. exports.clearInterval = function(timeout) {
  32752. if (timeout) {
  32753. timeout.close();
  32754. }
  32755. };
  32756. function Timeout(id, clearFn) {
  32757. this._id = id;
  32758. this._clearFn = clearFn;
  32759. }
  32760. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32761. Timeout.prototype.close = function() {
  32762. this._clearFn.call(scope, this._id);
  32763. };
  32764. // Does not start the time, just sets up the members needed.
  32765. exports.enroll = function(item, msecs) {
  32766. clearTimeout(item._idleTimeoutId);
  32767. item._idleTimeout = msecs;
  32768. };
  32769. exports.unenroll = function(item) {
  32770. clearTimeout(item._idleTimeoutId);
  32771. item._idleTimeout = -1;
  32772. };
  32773. exports._unrefActive = exports.active = function(item) {
  32774. clearTimeout(item._idleTimeoutId);
  32775. var msecs = item._idleTimeout;
  32776. if (msecs >= 0) {
  32777. item._idleTimeoutId = setTimeout(function onTimeout() {
  32778. if (item._onTimeout)
  32779. item._onTimeout();
  32780. }, msecs);
  32781. }
  32782. };
  32783. // setimmediate attaches itself to the global object
  32784. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  32785. // On some exotic environments, it's not clear which object `setimmediate` was
  32786. // able to install onto. Search each possibility in the same order as the
  32787. // `setimmediate` library.
  32788. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32789. (typeof global !== "undefined" && global.setImmediate) ||
  32790. (this && this.setImmediate);
  32791. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32792. (typeof global !== "undefined" && global.clearImmediate) ||
  32793. (this && this.clearImmediate);
  32794. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32795. /***/ }),
  32796. /***/ "./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&":
  32797. /*!*******************************************************************************************************************************************************************************************************************!*\
  32798. !*** ./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& ***!
  32799. \*******************************************************************************************************************************************************************************************************************/
  32800. /*! exports provided: render, staticRenderFns */
  32801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32802. "use strict";
  32803. __webpack_require__.r(__webpack_exports__);
  32804. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  32805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  32806. var render = function() {
  32807. var _vm = this
  32808. var _h = _vm.$createElement
  32809. var _c = _vm._self._c || _h
  32810. return _vm._m(0)
  32811. }
  32812. var staticRenderFns = [
  32813. function() {
  32814. var _vm = this
  32815. var _h = _vm.$createElement
  32816. var _c = _vm._self._c || _h
  32817. return _c("div", { staticClass: "container" }, [
  32818. _c("div", { staticClass: "row justify-content-center" }, [
  32819. _c("div", { staticClass: "col-md-8" }, [
  32820. _c("div", { staticClass: "card" }, [
  32821. _c("div", { staticClass: "card-header" }, [
  32822. _vm._v("Example Component")
  32823. ]),
  32824. _vm._v(" "),
  32825. _c("div", { staticClass: "card-body" }, [
  32826. _vm._v(
  32827. "\n I'm an example component.\n "
  32828. )
  32829. ])
  32830. ])
  32831. ])
  32832. ])
  32833. ])
  32834. }
  32835. ]
  32836. render._withStripped = true
  32837. /***/ }),
  32838. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  32839. /*!********************************************************************!*\
  32840. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  32841. \********************************************************************/
  32842. /*! exports provided: default */
  32843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32844. "use strict";
  32845. __webpack_require__.r(__webpack_exports__);
  32846. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  32847. /* globals __VUE_SSR_CONTEXT__ */
  32848. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  32849. // This module is a runtime utility for cleaner component module output and will
  32850. // be included in the final webpack user bundle.
  32851. function normalizeComponent (
  32852. scriptExports,
  32853. render,
  32854. staticRenderFns,
  32855. functionalTemplate,
  32856. injectStyles,
  32857. scopeId,
  32858. moduleIdentifier, /* server only */
  32859. shadowMode /* vue-cli only */
  32860. ) {
  32861. // Vue.extend constructor export interop
  32862. var options = typeof scriptExports === 'function'
  32863. ? scriptExports.options
  32864. : scriptExports
  32865. // render functions
  32866. if (render) {
  32867. options.render = render
  32868. options.staticRenderFns = staticRenderFns
  32869. options._compiled = true
  32870. }
  32871. // functional template
  32872. if (functionalTemplate) {
  32873. options.functional = true
  32874. }
  32875. // scopedId
  32876. if (scopeId) {
  32877. options._scopeId = 'data-v-' + scopeId
  32878. }
  32879. var hook
  32880. if (moduleIdentifier) { // server build
  32881. hook = function (context) {
  32882. // 2.3 injection
  32883. context =
  32884. context || // cached call
  32885. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32886. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32887. // 2.2 with runInNewContext: true
  32888. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32889. context = __VUE_SSR_CONTEXT__
  32890. }
  32891. // inject component styles
  32892. if (injectStyles) {
  32893. injectStyles.call(this, context)
  32894. }
  32895. // register component module identifier for async chunk inferrence
  32896. if (context && context._registeredComponents) {
  32897. context._registeredComponents.add(moduleIdentifier)
  32898. }
  32899. }
  32900. // used by ssr in case component is cached and beforeCreate
  32901. // never gets called
  32902. options._ssrRegister = hook
  32903. } else if (injectStyles) {
  32904. hook = shadowMode
  32905. ? function () {
  32906. injectStyles.call(
  32907. this,
  32908. (options.functional ? this.parent : this).$root.$options.shadowRoot
  32909. )
  32910. }
  32911. : injectStyles
  32912. }
  32913. if (hook) {
  32914. if (options.functional) {
  32915. // for template-only hot-reload because in that case the render fn doesn't
  32916. // go through the normalizer
  32917. options._injectStyles = hook
  32918. // register for functional component in vue file
  32919. var originalRender = options.render
  32920. options.render = function renderWithStyleInjection (h, context) {
  32921. hook.call(context)
  32922. return originalRender(h, context)
  32923. }
  32924. } else {
  32925. // inject component registration as beforeCreate hook
  32926. var existing = options.beforeCreate
  32927. options.beforeCreate = existing
  32928. ? [].concat(existing, hook)
  32929. : [hook]
  32930. }
  32931. }
  32932. return {
  32933. exports: scriptExports,
  32934. options: options
  32935. }
  32936. }
  32937. /***/ }),
  32938. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32939. /*!*************************************************!*\
  32940. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  32941. \*************************************************/
  32942. /*! no static exports found */
  32943. /***/ (function(module, exports, __webpack_require__) {
  32944. "use strict";
  32945. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32946. * Vue.js v2.6.12
  32947. * (c) 2014-2020 Evan You
  32948. * Released under the MIT License.
  32949. */
  32950. /* */
  32951. var emptyObject = Object.freeze({});
  32952. // These helpers produce better VM code in JS engines due to their
  32953. // explicitness and function inlining.
  32954. function isUndef (v) {
  32955. return v === undefined || v === null
  32956. }
  32957. function isDef (v) {
  32958. return v !== undefined && v !== null
  32959. }
  32960. function isTrue (v) {
  32961. return v === true
  32962. }
  32963. function isFalse (v) {
  32964. return v === false
  32965. }
  32966. /**
  32967. * Check if value is primitive.
  32968. */
  32969. function isPrimitive (value) {
  32970. return (
  32971. typeof value === 'string' ||
  32972. typeof value === 'number' ||
  32973. // $flow-disable-line
  32974. typeof value === 'symbol' ||
  32975. typeof value === 'boolean'
  32976. )
  32977. }
  32978. /**
  32979. * Quick object check - this is primarily used to tell
  32980. * Objects from primitive values when we know the value
  32981. * is a JSON-compliant type.
  32982. */
  32983. function isObject (obj) {
  32984. return obj !== null && typeof obj === 'object'
  32985. }
  32986. /**
  32987. * Get the raw type string of a value, e.g., [object Object].
  32988. */
  32989. var _toString = Object.prototype.toString;
  32990. function toRawType (value) {
  32991. return _toString.call(value).slice(8, -1)
  32992. }
  32993. /**
  32994. * Strict object type check. Only returns true
  32995. * for plain JavaScript objects.
  32996. */
  32997. function isPlainObject (obj) {
  32998. return _toString.call(obj) === '[object Object]'
  32999. }
  33000. function isRegExp (v) {
  33001. return _toString.call(v) === '[object RegExp]'
  33002. }
  33003. /**
  33004. * Check if val is a valid array index.
  33005. */
  33006. function isValidArrayIndex (val) {
  33007. var n = parseFloat(String(val));
  33008. return n >= 0 && Math.floor(n) === n && isFinite(val)
  33009. }
  33010. function isPromise (val) {
  33011. return (
  33012. isDef(val) &&
  33013. typeof val.then === 'function' &&
  33014. typeof val.catch === 'function'
  33015. )
  33016. }
  33017. /**
  33018. * Convert a value to a string that is actually rendered.
  33019. */
  33020. function toString (val) {
  33021. return val == null
  33022. ? ''
  33023. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  33024. ? JSON.stringify(val, null, 2)
  33025. : String(val)
  33026. }
  33027. /**
  33028. * Convert an input value to a number for persistence.
  33029. * If the conversion fails, return original string.
  33030. */
  33031. function toNumber (val) {
  33032. var n = parseFloat(val);
  33033. return isNaN(n) ? val : n
  33034. }
  33035. /**
  33036. * Make a map and return a function for checking if a key
  33037. * is in that map.
  33038. */
  33039. function makeMap (
  33040. str,
  33041. expectsLowerCase
  33042. ) {
  33043. var map = Object.create(null);
  33044. var list = str.split(',');
  33045. for (var i = 0; i < list.length; i++) {
  33046. map[list[i]] = true;
  33047. }
  33048. return expectsLowerCase
  33049. ? function (val) { return map[val.toLowerCase()]; }
  33050. : function (val) { return map[val]; }
  33051. }
  33052. /**
  33053. * Check if a tag is a built-in tag.
  33054. */
  33055. var isBuiltInTag = makeMap('slot,component', true);
  33056. /**
  33057. * Check if an attribute is a reserved attribute.
  33058. */
  33059. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  33060. /**
  33061. * Remove an item from an array.
  33062. */
  33063. function remove (arr, item) {
  33064. if (arr.length) {
  33065. var index = arr.indexOf(item);
  33066. if (index > -1) {
  33067. return arr.splice(index, 1)
  33068. }
  33069. }
  33070. }
  33071. /**
  33072. * Check whether an object has the property.
  33073. */
  33074. var hasOwnProperty = Object.prototype.hasOwnProperty;
  33075. function hasOwn (obj, key) {
  33076. return hasOwnProperty.call(obj, key)
  33077. }
  33078. /**
  33079. * Create a cached version of a pure function.
  33080. */
  33081. function cached (fn) {
  33082. var cache = Object.create(null);
  33083. return (function cachedFn (str) {
  33084. var hit = cache[str];
  33085. return hit || (cache[str] = fn(str))
  33086. })
  33087. }
  33088. /**
  33089. * Camelize a hyphen-delimited string.
  33090. */
  33091. var camelizeRE = /-(\w)/g;
  33092. var camelize = cached(function (str) {
  33093. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  33094. });
  33095. /**
  33096. * Capitalize a string.
  33097. */
  33098. var capitalize = cached(function (str) {
  33099. return str.charAt(0).toUpperCase() + str.slice(1)
  33100. });
  33101. /**
  33102. * Hyphenate a camelCase string.
  33103. */
  33104. var hyphenateRE = /\B([A-Z])/g;
  33105. var hyphenate = cached(function (str) {
  33106. return str.replace(hyphenateRE, '-$1').toLowerCase()
  33107. });
  33108. /**
  33109. * Simple bind polyfill for environments that do not support it,
  33110. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  33111. * since native bind is now performant enough in most browsers.
  33112. * But removing it would mean breaking code that was able to run in
  33113. * PhantomJS 1.x, so this must be kept for backward compatibility.
  33114. */
  33115. /* istanbul ignore next */
  33116. function polyfillBind (fn, ctx) {
  33117. function boundFn (a) {
  33118. var l = arguments.length;
  33119. return l
  33120. ? l > 1
  33121. ? fn.apply(ctx, arguments)
  33122. : fn.call(ctx, a)
  33123. : fn.call(ctx)
  33124. }
  33125. boundFn._length = fn.length;
  33126. return boundFn
  33127. }
  33128. function nativeBind (fn, ctx) {
  33129. return fn.bind(ctx)
  33130. }
  33131. var bind = Function.prototype.bind
  33132. ? nativeBind
  33133. : polyfillBind;
  33134. /**
  33135. * Convert an Array-like object to a real Array.
  33136. */
  33137. function toArray (list, start) {
  33138. start = start || 0;
  33139. var i = list.length - start;
  33140. var ret = new Array(i);
  33141. while (i--) {
  33142. ret[i] = list[i + start];
  33143. }
  33144. return ret
  33145. }
  33146. /**
  33147. * Mix properties into target object.
  33148. */
  33149. function extend (to, _from) {
  33150. for (var key in _from) {
  33151. to[key] = _from[key];
  33152. }
  33153. return to
  33154. }
  33155. /**
  33156. * Merge an Array of Objects into a single Object.
  33157. */
  33158. function toObject (arr) {
  33159. var res = {};
  33160. for (var i = 0; i < arr.length; i++) {
  33161. if (arr[i]) {
  33162. extend(res, arr[i]);
  33163. }
  33164. }
  33165. return res
  33166. }
  33167. /* eslint-disable no-unused-vars */
  33168. /**
  33169. * Perform no operation.
  33170. * Stubbing args to make Flow happy without leaving useless transpiled code
  33171. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  33172. */
  33173. function noop (a, b, c) {}
  33174. /**
  33175. * Always return false.
  33176. */
  33177. var no = function (a, b, c) { return false; };
  33178. /* eslint-enable no-unused-vars */
  33179. /**
  33180. * Return the same value.
  33181. */
  33182. var identity = function (_) { return _; };
  33183. /**
  33184. * Generate a string containing static keys from compiler modules.
  33185. */
  33186. function genStaticKeys (modules) {
  33187. return modules.reduce(function (keys, m) {
  33188. return keys.concat(m.staticKeys || [])
  33189. }, []).join(',')
  33190. }
  33191. /**
  33192. * Check if two values are loosely equal - that is,
  33193. * if they are plain objects, do they have the same shape?
  33194. */
  33195. function looseEqual (a, b) {
  33196. if (a === b) { return true }
  33197. var isObjectA = isObject(a);
  33198. var isObjectB = isObject(b);
  33199. if (isObjectA && isObjectB) {
  33200. try {
  33201. var isArrayA = Array.isArray(a);
  33202. var isArrayB = Array.isArray(b);
  33203. if (isArrayA && isArrayB) {
  33204. return a.length === b.length && a.every(function (e, i) {
  33205. return looseEqual(e, b[i])
  33206. })
  33207. } else if (a instanceof Date && b instanceof Date) {
  33208. return a.getTime() === b.getTime()
  33209. } else if (!isArrayA && !isArrayB) {
  33210. var keysA = Object.keys(a);
  33211. var keysB = Object.keys(b);
  33212. return keysA.length === keysB.length && keysA.every(function (key) {
  33213. return looseEqual(a[key], b[key])
  33214. })
  33215. } else {
  33216. /* istanbul ignore next */
  33217. return false
  33218. }
  33219. } catch (e) {
  33220. /* istanbul ignore next */
  33221. return false
  33222. }
  33223. } else if (!isObjectA && !isObjectB) {
  33224. return String(a) === String(b)
  33225. } else {
  33226. return false
  33227. }
  33228. }
  33229. /**
  33230. * Return the first index at which a loosely equal value can be
  33231. * found in the array (if value is a plain object, the array must
  33232. * contain an object of the same shape), or -1 if it is not present.
  33233. */
  33234. function looseIndexOf (arr, val) {
  33235. for (var i = 0; i < arr.length; i++) {
  33236. if (looseEqual(arr[i], val)) { return i }
  33237. }
  33238. return -1
  33239. }
  33240. /**
  33241. * Ensure a function is called only once.
  33242. */
  33243. function once (fn) {
  33244. var called = false;
  33245. return function () {
  33246. if (!called) {
  33247. called = true;
  33248. fn.apply(this, arguments);
  33249. }
  33250. }
  33251. }
  33252. var SSR_ATTR = 'data-server-rendered';
  33253. var ASSET_TYPES = [
  33254. 'component',
  33255. 'directive',
  33256. 'filter'
  33257. ];
  33258. var LIFECYCLE_HOOKS = [
  33259. 'beforeCreate',
  33260. 'created',
  33261. 'beforeMount',
  33262. 'mounted',
  33263. 'beforeUpdate',
  33264. 'updated',
  33265. 'beforeDestroy',
  33266. 'destroyed',
  33267. 'activated',
  33268. 'deactivated',
  33269. 'errorCaptured',
  33270. 'serverPrefetch'
  33271. ];
  33272. /* */
  33273. var config = ({
  33274. /**
  33275. * Option merge strategies (used in core/util/options)
  33276. */
  33277. // $flow-disable-line
  33278. optionMergeStrategies: Object.create(null),
  33279. /**
  33280. * Whether to suppress warnings.
  33281. */
  33282. silent: false,
  33283. /**
  33284. * Show production mode tip message on boot?
  33285. */
  33286. productionTip: "development" !== 'production',
  33287. /**
  33288. * Whether to enable devtools
  33289. */
  33290. devtools: "development" !== 'production',
  33291. /**
  33292. * Whether to record perf
  33293. */
  33294. performance: false,
  33295. /**
  33296. * Error handler for watcher errors
  33297. */
  33298. errorHandler: null,
  33299. /**
  33300. * Warn handler for watcher warns
  33301. */
  33302. warnHandler: null,
  33303. /**
  33304. * Ignore certain custom elements
  33305. */
  33306. ignoredElements: [],
  33307. /**
  33308. * Custom user key aliases for v-on
  33309. */
  33310. // $flow-disable-line
  33311. keyCodes: Object.create(null),
  33312. /**
  33313. * Check if a tag is reserved so that it cannot be registered as a
  33314. * component. This is platform-dependent and may be overwritten.
  33315. */
  33316. isReservedTag: no,
  33317. /**
  33318. * Check if an attribute is reserved so that it cannot be used as a component
  33319. * prop. This is platform-dependent and may be overwritten.
  33320. */
  33321. isReservedAttr: no,
  33322. /**
  33323. * Check if a tag is an unknown element.
  33324. * Platform-dependent.
  33325. */
  33326. isUnknownElement: no,
  33327. /**
  33328. * Get the namespace of an element
  33329. */
  33330. getTagNamespace: noop,
  33331. /**
  33332. * Parse the real tag name for the specific platform.
  33333. */
  33334. parsePlatformTagName: identity,
  33335. /**
  33336. * Check if an attribute must be bound using property, e.g. value
  33337. * Platform-dependent.
  33338. */
  33339. mustUseProp: no,
  33340. /**
  33341. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  33342. * This will significantly reduce performance if set to false.
  33343. */
  33344. async: true,
  33345. /**
  33346. * Exposed for legacy reasons
  33347. */
  33348. _lifecycleHooks: LIFECYCLE_HOOKS
  33349. });
  33350. /* */
  33351. /**
  33352. * unicode letters used for parsing html tags, component names and property paths.
  33353. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  33354. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  33355. */
  33356. 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/;
  33357. /**
  33358. * Check if a string starts with $ or _
  33359. */
  33360. function isReserved (str) {
  33361. var c = (str + '').charCodeAt(0);
  33362. return c === 0x24 || c === 0x5F
  33363. }
  33364. /**
  33365. * Define a property.
  33366. */
  33367. function def (obj, key, val, enumerable) {
  33368. Object.defineProperty(obj, key, {
  33369. value: val,
  33370. enumerable: !!enumerable,
  33371. writable: true,
  33372. configurable: true
  33373. });
  33374. }
  33375. /**
  33376. * Parse simple path.
  33377. */
  33378. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  33379. function parsePath (path) {
  33380. if (bailRE.test(path)) {
  33381. return
  33382. }
  33383. var segments = path.split('.');
  33384. return function (obj) {
  33385. for (var i = 0; i < segments.length; i++) {
  33386. if (!obj) { return }
  33387. obj = obj[segments[i]];
  33388. }
  33389. return obj
  33390. }
  33391. }
  33392. /* */
  33393. // can we use __proto__?
  33394. var hasProto = '__proto__' in {};
  33395. // Browser environment sniffing
  33396. var inBrowser = typeof window !== 'undefined';
  33397. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  33398. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  33399. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  33400. var isIE = UA && /msie|trident/.test(UA);
  33401. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  33402. var isEdge = UA && UA.indexOf('edge/') > 0;
  33403. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  33404. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  33405. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  33406. var isPhantomJS = UA && /phantomjs/.test(UA);
  33407. var isFF = UA && UA.match(/firefox\/(\d+)/);
  33408. // Firefox has a "watch" function on Object.prototype...
  33409. var nativeWatch = ({}).watch;
  33410. var supportsPassive = false;
  33411. if (inBrowser) {
  33412. try {
  33413. var opts = {};
  33414. Object.defineProperty(opts, 'passive', ({
  33415. get: function get () {
  33416. /* istanbul ignore next */
  33417. supportsPassive = true;
  33418. }
  33419. })); // https://github.com/facebook/flow/issues/285
  33420. window.addEventListener('test-passive', null, opts);
  33421. } catch (e) {}
  33422. }
  33423. // this needs to be lazy-evaled because vue may be required before
  33424. // vue-server-renderer can set VUE_ENV
  33425. var _isServer;
  33426. var isServerRendering = function () {
  33427. if (_isServer === undefined) {
  33428. /* istanbul ignore if */
  33429. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  33430. // detect presence of vue-server-renderer and avoid
  33431. // Webpack shimming the process
  33432. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  33433. } else {
  33434. _isServer = false;
  33435. }
  33436. }
  33437. return _isServer
  33438. };
  33439. // detect devtools
  33440. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  33441. /* istanbul ignore next */
  33442. function isNative (Ctor) {
  33443. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  33444. }
  33445. var hasSymbol =
  33446. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  33447. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  33448. var _Set;
  33449. /* istanbul ignore if */ // $flow-disable-line
  33450. if (typeof Set !== 'undefined' && isNative(Set)) {
  33451. // use native Set when available.
  33452. _Set = Set;
  33453. } else {
  33454. // a non-standard Set polyfill that only works with primitive keys.
  33455. _Set = /*@__PURE__*/(function () {
  33456. function Set () {
  33457. this.set = Object.create(null);
  33458. }
  33459. Set.prototype.has = function has (key) {
  33460. return this.set[key] === true
  33461. };
  33462. Set.prototype.add = function add (key) {
  33463. this.set[key] = true;
  33464. };
  33465. Set.prototype.clear = function clear () {
  33466. this.set = Object.create(null);
  33467. };
  33468. return Set;
  33469. }());
  33470. }
  33471. /* */
  33472. var warn = noop;
  33473. var tip = noop;
  33474. var generateComponentTrace = (noop); // work around flow check
  33475. var formatComponentName = (noop);
  33476. {
  33477. var hasConsole = typeof console !== 'undefined';
  33478. var classifyRE = /(?:^|[-_])(\w)/g;
  33479. var classify = function (str) { return str
  33480. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  33481. .replace(/[-_]/g, ''); };
  33482. warn = function (msg, vm) {
  33483. var trace = vm ? generateComponentTrace(vm) : '';
  33484. if (config.warnHandler) {
  33485. config.warnHandler.call(null, msg, vm, trace);
  33486. } else if (hasConsole && (!config.silent)) {
  33487. console.error(("[Vue warn]: " + msg + trace));
  33488. }
  33489. };
  33490. tip = function (msg, vm) {
  33491. if (hasConsole && (!config.silent)) {
  33492. console.warn("[Vue tip]: " + msg + (
  33493. vm ? generateComponentTrace(vm) : ''
  33494. ));
  33495. }
  33496. };
  33497. formatComponentName = function (vm, includeFile) {
  33498. if (vm.$root === vm) {
  33499. return '<Root>'
  33500. }
  33501. var options = typeof vm === 'function' && vm.cid != null
  33502. ? vm.options
  33503. : vm._isVue
  33504. ? vm.$options || vm.constructor.options
  33505. : vm;
  33506. var name = options.name || options._componentTag;
  33507. var file = options.__file;
  33508. if (!name && file) {
  33509. var match = file.match(/([^/\\]+)\.vue$/);
  33510. name = match && match[1];
  33511. }
  33512. return (
  33513. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  33514. (file && includeFile !== false ? (" at " + file) : '')
  33515. )
  33516. };
  33517. var repeat = function (str, n) {
  33518. var res = '';
  33519. while (n) {
  33520. if (n % 2 === 1) { res += str; }
  33521. if (n > 1) { str += str; }
  33522. n >>= 1;
  33523. }
  33524. return res
  33525. };
  33526. generateComponentTrace = function (vm) {
  33527. if (vm._isVue && vm.$parent) {
  33528. var tree = [];
  33529. var currentRecursiveSequence = 0;
  33530. while (vm) {
  33531. if (tree.length > 0) {
  33532. var last = tree[tree.length - 1];
  33533. if (last.constructor === vm.constructor) {
  33534. currentRecursiveSequence++;
  33535. vm = vm.$parent;
  33536. continue
  33537. } else if (currentRecursiveSequence > 0) {
  33538. tree[tree.length - 1] = [last, currentRecursiveSequence];
  33539. currentRecursiveSequence = 0;
  33540. }
  33541. }
  33542. tree.push(vm);
  33543. vm = vm.$parent;
  33544. }
  33545. return '\n\nfound in\n\n' + tree
  33546. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  33547. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  33548. : formatComponentName(vm))); })
  33549. .join('\n')
  33550. } else {
  33551. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  33552. }
  33553. };
  33554. }
  33555. /* */
  33556. var uid = 0;
  33557. /**
  33558. * A dep is an observable that can have multiple
  33559. * directives subscribing to it.
  33560. */
  33561. var Dep = function Dep () {
  33562. this.id = uid++;
  33563. this.subs = [];
  33564. };
  33565. Dep.prototype.addSub = function addSub (sub) {
  33566. this.subs.push(sub);
  33567. };
  33568. Dep.prototype.removeSub = function removeSub (sub) {
  33569. remove(this.subs, sub);
  33570. };
  33571. Dep.prototype.depend = function depend () {
  33572. if (Dep.target) {
  33573. Dep.target.addDep(this);
  33574. }
  33575. };
  33576. Dep.prototype.notify = function notify () {
  33577. // stabilize the subscriber list first
  33578. var subs = this.subs.slice();
  33579. if (!config.async) {
  33580. // subs aren't sorted in scheduler if not running async
  33581. // we need to sort them now to make sure they fire in correct
  33582. // order
  33583. subs.sort(function (a, b) { return a.id - b.id; });
  33584. }
  33585. for (var i = 0, l = subs.length; i < l; i++) {
  33586. subs[i].update();
  33587. }
  33588. };
  33589. // The current target watcher being evaluated.
  33590. // This is globally unique because only one watcher
  33591. // can be evaluated at a time.
  33592. Dep.target = null;
  33593. var targetStack = [];
  33594. function pushTarget (target) {
  33595. targetStack.push(target);
  33596. Dep.target = target;
  33597. }
  33598. function popTarget () {
  33599. targetStack.pop();
  33600. Dep.target = targetStack[targetStack.length - 1];
  33601. }
  33602. /* */
  33603. var VNode = function VNode (
  33604. tag,
  33605. data,
  33606. children,
  33607. text,
  33608. elm,
  33609. context,
  33610. componentOptions,
  33611. asyncFactory
  33612. ) {
  33613. this.tag = tag;
  33614. this.data = data;
  33615. this.children = children;
  33616. this.text = text;
  33617. this.elm = elm;
  33618. this.ns = undefined;
  33619. this.context = context;
  33620. this.fnContext = undefined;
  33621. this.fnOptions = undefined;
  33622. this.fnScopeId = undefined;
  33623. this.key = data && data.key;
  33624. this.componentOptions = componentOptions;
  33625. this.componentInstance = undefined;
  33626. this.parent = undefined;
  33627. this.raw = false;
  33628. this.isStatic = false;
  33629. this.isRootInsert = true;
  33630. this.isComment = false;
  33631. this.isCloned = false;
  33632. this.isOnce = false;
  33633. this.asyncFactory = asyncFactory;
  33634. this.asyncMeta = undefined;
  33635. this.isAsyncPlaceholder = false;
  33636. };
  33637. var prototypeAccessors = { child: { configurable: true } };
  33638. // DEPRECATED: alias for componentInstance for backwards compat.
  33639. /* istanbul ignore next */
  33640. prototypeAccessors.child.get = function () {
  33641. return this.componentInstance
  33642. };
  33643. Object.defineProperties( VNode.prototype, prototypeAccessors );
  33644. var createEmptyVNode = function (text) {
  33645. if ( text === void 0 ) text = '';
  33646. var node = new VNode();
  33647. node.text = text;
  33648. node.isComment = true;
  33649. return node
  33650. };
  33651. function createTextVNode (val) {
  33652. return new VNode(undefined, undefined, undefined, String(val))
  33653. }
  33654. // optimized shallow clone
  33655. // used for static nodes and slot nodes because they may be reused across
  33656. // multiple renders, cloning them avoids errors when DOM manipulations rely
  33657. // on their elm reference.
  33658. function cloneVNode (vnode) {
  33659. var cloned = new VNode(
  33660. vnode.tag,
  33661. vnode.data,
  33662. // #7975
  33663. // clone children array to avoid mutating original in case of cloning
  33664. // a child.
  33665. vnode.children && vnode.children.slice(),
  33666. vnode.text,
  33667. vnode.elm,
  33668. vnode.context,
  33669. vnode.componentOptions,
  33670. vnode.asyncFactory
  33671. );
  33672. cloned.ns = vnode.ns;
  33673. cloned.isStatic = vnode.isStatic;
  33674. cloned.key = vnode.key;
  33675. cloned.isComment = vnode.isComment;
  33676. cloned.fnContext = vnode.fnContext;
  33677. cloned.fnOptions = vnode.fnOptions;
  33678. cloned.fnScopeId = vnode.fnScopeId;
  33679. cloned.asyncMeta = vnode.asyncMeta;
  33680. cloned.isCloned = true;
  33681. return cloned
  33682. }
  33683. /*
  33684. * not type checking this file because flow doesn't play well with
  33685. * dynamically accessing methods on Array prototype
  33686. */
  33687. var arrayProto = Array.prototype;
  33688. var arrayMethods = Object.create(arrayProto);
  33689. var methodsToPatch = [
  33690. 'push',
  33691. 'pop',
  33692. 'shift',
  33693. 'unshift',
  33694. 'splice',
  33695. 'sort',
  33696. 'reverse'
  33697. ];
  33698. /**
  33699. * Intercept mutating methods and emit events
  33700. */
  33701. methodsToPatch.forEach(function (method) {
  33702. // cache original method
  33703. var original = arrayProto[method];
  33704. def(arrayMethods, method, function mutator () {
  33705. var args = [], len = arguments.length;
  33706. while ( len-- ) args[ len ] = arguments[ len ];
  33707. var result = original.apply(this, args);
  33708. var ob = this.__ob__;
  33709. var inserted;
  33710. switch (method) {
  33711. case 'push':
  33712. case 'unshift':
  33713. inserted = args;
  33714. break
  33715. case 'splice':
  33716. inserted = args.slice(2);
  33717. break
  33718. }
  33719. if (inserted) { ob.observeArray(inserted); }
  33720. // notify change
  33721. ob.dep.notify();
  33722. return result
  33723. });
  33724. });
  33725. /* */
  33726. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33727. /**
  33728. * In some cases we may want to disable observation inside a component's
  33729. * update computation.
  33730. */
  33731. var shouldObserve = true;
  33732. function toggleObserving (value) {
  33733. shouldObserve = value;
  33734. }
  33735. /**
  33736. * Observer class that is attached to each observed
  33737. * object. Once attached, the observer converts the target
  33738. * object's property keys into getter/setters that
  33739. * collect dependencies and dispatch updates.
  33740. */
  33741. var Observer = function Observer (value) {
  33742. this.value = value;
  33743. this.dep = new Dep();
  33744. this.vmCount = 0;
  33745. def(value, '__ob__', this);
  33746. if (Array.isArray(value)) {
  33747. if (hasProto) {
  33748. protoAugment(value, arrayMethods);
  33749. } else {
  33750. copyAugment(value, arrayMethods, arrayKeys);
  33751. }
  33752. this.observeArray(value);
  33753. } else {
  33754. this.walk(value);
  33755. }
  33756. };
  33757. /**
  33758. * Walk through all properties and convert them into
  33759. * getter/setters. This method should only be called when
  33760. * value type is Object.
  33761. */
  33762. Observer.prototype.walk = function walk (obj) {
  33763. var keys = Object.keys(obj);
  33764. for (var i = 0; i < keys.length; i++) {
  33765. defineReactive$$1(obj, keys[i]);
  33766. }
  33767. };
  33768. /**
  33769. * Observe a list of Array items.
  33770. */
  33771. Observer.prototype.observeArray = function observeArray (items) {
  33772. for (var i = 0, l = items.length; i < l; i++) {
  33773. observe(items[i]);
  33774. }
  33775. };
  33776. // helpers
  33777. /**
  33778. * Augment a target Object or Array by intercepting
  33779. * the prototype chain using __proto__
  33780. */
  33781. function protoAugment (target, src) {
  33782. /* eslint-disable no-proto */
  33783. target.__proto__ = src;
  33784. /* eslint-enable no-proto */
  33785. }
  33786. /**
  33787. * Augment a target Object or Array by defining
  33788. * hidden properties.
  33789. */
  33790. /* istanbul ignore next */
  33791. function copyAugment (target, src, keys) {
  33792. for (var i = 0, l = keys.length; i < l; i++) {
  33793. var key = keys[i];
  33794. def(target, key, src[key]);
  33795. }
  33796. }
  33797. /**
  33798. * Attempt to create an observer instance for a value,
  33799. * returns the new observer if successfully observed,
  33800. * or the existing observer if the value already has one.
  33801. */
  33802. function observe (value, asRootData) {
  33803. if (!isObject(value) || value instanceof VNode) {
  33804. return
  33805. }
  33806. var ob;
  33807. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33808. ob = value.__ob__;
  33809. } else if (
  33810. shouldObserve &&
  33811. !isServerRendering() &&
  33812. (Array.isArray(value) || isPlainObject(value)) &&
  33813. Object.isExtensible(value) &&
  33814. !value._isVue
  33815. ) {
  33816. ob = new Observer(value);
  33817. }
  33818. if (asRootData && ob) {
  33819. ob.vmCount++;
  33820. }
  33821. return ob
  33822. }
  33823. /**
  33824. * Define a reactive property on an Object.
  33825. */
  33826. function defineReactive$$1 (
  33827. obj,
  33828. key,
  33829. val,
  33830. customSetter,
  33831. shallow
  33832. ) {
  33833. var dep = new Dep();
  33834. var property = Object.getOwnPropertyDescriptor(obj, key);
  33835. if (property && property.configurable === false) {
  33836. return
  33837. }
  33838. // cater for pre-defined getter/setters
  33839. var getter = property && property.get;
  33840. var setter = property && property.set;
  33841. if ((!getter || setter) && arguments.length === 2) {
  33842. val = obj[key];
  33843. }
  33844. var childOb = !shallow && observe(val);
  33845. Object.defineProperty(obj, key, {
  33846. enumerable: true,
  33847. configurable: true,
  33848. get: function reactiveGetter () {
  33849. var value = getter ? getter.call(obj) : val;
  33850. if (Dep.target) {
  33851. dep.depend();
  33852. if (childOb) {
  33853. childOb.dep.depend();
  33854. if (Array.isArray(value)) {
  33855. dependArray(value);
  33856. }
  33857. }
  33858. }
  33859. return value
  33860. },
  33861. set: function reactiveSetter (newVal) {
  33862. var value = getter ? getter.call(obj) : val;
  33863. /* eslint-disable no-self-compare */
  33864. if (newVal === value || (newVal !== newVal && value !== value)) {
  33865. return
  33866. }
  33867. /* eslint-enable no-self-compare */
  33868. if (customSetter) {
  33869. customSetter();
  33870. }
  33871. // #7981: for accessor properties without setter
  33872. if (getter && !setter) { return }
  33873. if (setter) {
  33874. setter.call(obj, newVal);
  33875. } else {
  33876. val = newVal;
  33877. }
  33878. childOb = !shallow && observe(newVal);
  33879. dep.notify();
  33880. }
  33881. });
  33882. }
  33883. /**
  33884. * Set a property on an object. Adds the new property and
  33885. * triggers change notification if the property doesn't
  33886. * already exist.
  33887. */
  33888. function set (target, key, val) {
  33889. if (isUndef(target) || isPrimitive(target)
  33890. ) {
  33891. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33892. }
  33893. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33894. target.length = Math.max(target.length, key);
  33895. target.splice(key, 1, val);
  33896. return val
  33897. }
  33898. if (key in target && !(key in Object.prototype)) {
  33899. target[key] = val;
  33900. return val
  33901. }
  33902. var ob = (target).__ob__;
  33903. if (target._isVue || (ob && ob.vmCount)) {
  33904. warn(
  33905. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33906. 'at runtime - declare it upfront in the data option.'
  33907. );
  33908. return val
  33909. }
  33910. if (!ob) {
  33911. target[key] = val;
  33912. return val
  33913. }
  33914. defineReactive$$1(ob.value, key, val);
  33915. ob.dep.notify();
  33916. return val
  33917. }
  33918. /**
  33919. * Delete a property and trigger change if necessary.
  33920. */
  33921. function del (target, key) {
  33922. if (isUndef(target) || isPrimitive(target)
  33923. ) {
  33924. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33925. }
  33926. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33927. target.splice(key, 1);
  33928. return
  33929. }
  33930. var ob = (target).__ob__;
  33931. if (target._isVue || (ob && ob.vmCount)) {
  33932. warn(
  33933. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33934. '- just set it to null.'
  33935. );
  33936. return
  33937. }
  33938. if (!hasOwn(target, key)) {
  33939. return
  33940. }
  33941. delete target[key];
  33942. if (!ob) {
  33943. return
  33944. }
  33945. ob.dep.notify();
  33946. }
  33947. /**
  33948. * Collect dependencies on array elements when the array is touched, since
  33949. * we cannot intercept array element access like property getters.
  33950. */
  33951. function dependArray (value) {
  33952. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33953. e = value[i];
  33954. e && e.__ob__ && e.__ob__.dep.depend();
  33955. if (Array.isArray(e)) {
  33956. dependArray(e);
  33957. }
  33958. }
  33959. }
  33960. /* */
  33961. /**
  33962. * Option overwriting strategies are functions that handle
  33963. * how to merge a parent option value and a child option
  33964. * value into the final value.
  33965. */
  33966. var strats = config.optionMergeStrategies;
  33967. /**
  33968. * Options with restrictions
  33969. */
  33970. {
  33971. strats.el = strats.propsData = function (parent, child, vm, key) {
  33972. if (!vm) {
  33973. warn(
  33974. "option \"" + key + "\" can only be used during instance " +
  33975. 'creation with the `new` keyword.'
  33976. );
  33977. }
  33978. return defaultStrat(parent, child)
  33979. };
  33980. }
  33981. /**
  33982. * Helper that recursively merges two data objects together.
  33983. */
  33984. function mergeData (to, from) {
  33985. if (!from) { return to }
  33986. var key, toVal, fromVal;
  33987. var keys = hasSymbol
  33988. ? Reflect.ownKeys(from)
  33989. : Object.keys(from);
  33990. for (var i = 0; i < keys.length; i++) {
  33991. key = keys[i];
  33992. // in case the object is already observed...
  33993. if (key === '__ob__') { continue }
  33994. toVal = to[key];
  33995. fromVal = from[key];
  33996. if (!hasOwn(to, key)) {
  33997. set(to, key, fromVal);
  33998. } else if (
  33999. toVal !== fromVal &&
  34000. isPlainObject(toVal) &&
  34001. isPlainObject(fromVal)
  34002. ) {
  34003. mergeData(toVal, fromVal);
  34004. }
  34005. }
  34006. return to
  34007. }
  34008. /**
  34009. * Data
  34010. */
  34011. function mergeDataOrFn (
  34012. parentVal,
  34013. childVal,
  34014. vm
  34015. ) {
  34016. if (!vm) {
  34017. // in a Vue.extend merge, both should be functions
  34018. if (!childVal) {
  34019. return parentVal
  34020. }
  34021. if (!parentVal) {
  34022. return childVal
  34023. }
  34024. // when parentVal & childVal are both present,
  34025. // we need to return a function that returns the
  34026. // merged result of both functions... no need to
  34027. // check if parentVal is a function here because
  34028. // it has to be a function to pass previous merges.
  34029. return function mergedDataFn () {
  34030. return mergeData(
  34031. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  34032. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  34033. )
  34034. }
  34035. } else {
  34036. return function mergedInstanceDataFn () {
  34037. // instance merge
  34038. var instanceData = typeof childVal === 'function'
  34039. ? childVal.call(vm, vm)
  34040. : childVal;
  34041. var defaultData = typeof parentVal === 'function'
  34042. ? parentVal.call(vm, vm)
  34043. : parentVal;
  34044. if (instanceData) {
  34045. return mergeData(instanceData, defaultData)
  34046. } else {
  34047. return defaultData
  34048. }
  34049. }
  34050. }
  34051. }
  34052. strats.data = function (
  34053. parentVal,
  34054. childVal,
  34055. vm
  34056. ) {
  34057. if (!vm) {
  34058. if (childVal && typeof childVal !== 'function') {
  34059. warn(
  34060. 'The "data" option should be a function ' +
  34061. 'that returns a per-instance value in component ' +
  34062. 'definitions.',
  34063. vm
  34064. );
  34065. return parentVal
  34066. }
  34067. return mergeDataOrFn(parentVal, childVal)
  34068. }
  34069. return mergeDataOrFn(parentVal, childVal, vm)
  34070. };
  34071. /**
  34072. * Hooks and props are merged as arrays.
  34073. */
  34074. function mergeHook (
  34075. parentVal,
  34076. childVal
  34077. ) {
  34078. var res = childVal
  34079. ? parentVal
  34080. ? parentVal.concat(childVal)
  34081. : Array.isArray(childVal)
  34082. ? childVal
  34083. : [childVal]
  34084. : parentVal;
  34085. return res
  34086. ? dedupeHooks(res)
  34087. : res
  34088. }
  34089. function dedupeHooks (hooks) {
  34090. var res = [];
  34091. for (var i = 0; i < hooks.length; i++) {
  34092. if (res.indexOf(hooks[i]) === -1) {
  34093. res.push(hooks[i]);
  34094. }
  34095. }
  34096. return res
  34097. }
  34098. LIFECYCLE_HOOKS.forEach(function (hook) {
  34099. strats[hook] = mergeHook;
  34100. });
  34101. /**
  34102. * Assets
  34103. *
  34104. * When a vm is present (instance creation), we need to do
  34105. * a three-way merge between constructor options, instance
  34106. * options and parent options.
  34107. */
  34108. function mergeAssets (
  34109. parentVal,
  34110. childVal,
  34111. vm,
  34112. key
  34113. ) {
  34114. var res = Object.create(parentVal || null);
  34115. if (childVal) {
  34116. assertObjectType(key, childVal, vm);
  34117. return extend(res, childVal)
  34118. } else {
  34119. return res
  34120. }
  34121. }
  34122. ASSET_TYPES.forEach(function (type) {
  34123. strats[type + 's'] = mergeAssets;
  34124. });
  34125. /**
  34126. * Watchers.
  34127. *
  34128. * Watchers hashes should not overwrite one
  34129. * another, so we merge them as arrays.
  34130. */
  34131. strats.watch = function (
  34132. parentVal,
  34133. childVal,
  34134. vm,
  34135. key
  34136. ) {
  34137. // work around Firefox's Object.prototype.watch...
  34138. if (parentVal === nativeWatch) { parentVal = undefined; }
  34139. if (childVal === nativeWatch) { childVal = undefined; }
  34140. /* istanbul ignore if */
  34141. if (!childVal) { return Object.create(parentVal || null) }
  34142. {
  34143. assertObjectType(key, childVal, vm);
  34144. }
  34145. if (!parentVal) { return childVal }
  34146. var ret = {};
  34147. extend(ret, parentVal);
  34148. for (var key$1 in childVal) {
  34149. var parent = ret[key$1];
  34150. var child = childVal[key$1];
  34151. if (parent && !Array.isArray(parent)) {
  34152. parent = [parent];
  34153. }
  34154. ret[key$1] = parent
  34155. ? parent.concat(child)
  34156. : Array.isArray(child) ? child : [child];
  34157. }
  34158. return ret
  34159. };
  34160. /**
  34161. * Other object hashes.
  34162. */
  34163. strats.props =
  34164. strats.methods =
  34165. strats.inject =
  34166. strats.computed = function (
  34167. parentVal,
  34168. childVal,
  34169. vm,
  34170. key
  34171. ) {
  34172. if (childVal && "development" !== 'production') {
  34173. assertObjectType(key, childVal, vm);
  34174. }
  34175. if (!parentVal) { return childVal }
  34176. var ret = Object.create(null);
  34177. extend(ret, parentVal);
  34178. if (childVal) { extend(ret, childVal); }
  34179. return ret
  34180. };
  34181. strats.provide = mergeDataOrFn;
  34182. /**
  34183. * Default strategy.
  34184. */
  34185. var defaultStrat = function (parentVal, childVal) {
  34186. return childVal === undefined
  34187. ? parentVal
  34188. : childVal
  34189. };
  34190. /**
  34191. * Validate component names
  34192. */
  34193. function checkComponents (options) {
  34194. for (var key in options.components) {
  34195. validateComponentName(key);
  34196. }
  34197. }
  34198. function validateComponentName (name) {
  34199. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  34200. warn(
  34201. 'Invalid component name: "' + name + '". Component names ' +
  34202. 'should conform to valid custom element name in html5 specification.'
  34203. );
  34204. }
  34205. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  34206. warn(
  34207. 'Do not use built-in or reserved HTML elements as component ' +
  34208. 'id: ' + name
  34209. );
  34210. }
  34211. }
  34212. /**
  34213. * Ensure all props option syntax are normalized into the
  34214. * Object-based format.
  34215. */
  34216. function normalizeProps (options, vm) {
  34217. var props = options.props;
  34218. if (!props) { return }
  34219. var res = {};
  34220. var i, val, name;
  34221. if (Array.isArray(props)) {
  34222. i = props.length;
  34223. while (i--) {
  34224. val = props[i];
  34225. if (typeof val === 'string') {
  34226. name = camelize(val);
  34227. res[name] = { type: null };
  34228. } else {
  34229. warn('props must be strings when using array syntax.');
  34230. }
  34231. }
  34232. } else if (isPlainObject(props)) {
  34233. for (var key in props) {
  34234. val = props[key];
  34235. name = camelize(key);
  34236. res[name] = isPlainObject(val)
  34237. ? val
  34238. : { type: val };
  34239. }
  34240. } else {
  34241. warn(
  34242. "Invalid value for option \"props\": expected an Array or an Object, " +
  34243. "but got " + (toRawType(props)) + ".",
  34244. vm
  34245. );
  34246. }
  34247. options.props = res;
  34248. }
  34249. /**
  34250. * Normalize all injections into Object-based format
  34251. */
  34252. function normalizeInject (options, vm) {
  34253. var inject = options.inject;
  34254. if (!inject) { return }
  34255. var normalized = options.inject = {};
  34256. if (Array.isArray(inject)) {
  34257. for (var i = 0; i < inject.length; i++) {
  34258. normalized[inject[i]] = { from: inject[i] };
  34259. }
  34260. } else if (isPlainObject(inject)) {
  34261. for (var key in inject) {
  34262. var val = inject[key];
  34263. normalized[key] = isPlainObject(val)
  34264. ? extend({ from: key }, val)
  34265. : { from: val };
  34266. }
  34267. } else {
  34268. warn(
  34269. "Invalid value for option \"inject\": expected an Array or an Object, " +
  34270. "but got " + (toRawType(inject)) + ".",
  34271. vm
  34272. );
  34273. }
  34274. }
  34275. /**
  34276. * Normalize raw function directives into object format.
  34277. */
  34278. function normalizeDirectives (options) {
  34279. var dirs = options.directives;
  34280. if (dirs) {
  34281. for (var key in dirs) {
  34282. var def$$1 = dirs[key];
  34283. if (typeof def$$1 === 'function') {
  34284. dirs[key] = { bind: def$$1, update: def$$1 };
  34285. }
  34286. }
  34287. }
  34288. }
  34289. function assertObjectType (name, value, vm) {
  34290. if (!isPlainObject(value)) {
  34291. warn(
  34292. "Invalid value for option \"" + name + "\": expected an Object, " +
  34293. "but got " + (toRawType(value)) + ".",
  34294. vm
  34295. );
  34296. }
  34297. }
  34298. /**
  34299. * Merge two option objects into a new one.
  34300. * Core utility used in both instantiation and inheritance.
  34301. */
  34302. function mergeOptions (
  34303. parent,
  34304. child,
  34305. vm
  34306. ) {
  34307. {
  34308. checkComponents(child);
  34309. }
  34310. if (typeof child === 'function') {
  34311. child = child.options;
  34312. }
  34313. normalizeProps(child, vm);
  34314. normalizeInject(child, vm);
  34315. normalizeDirectives(child);
  34316. // Apply extends and mixins on the child options,
  34317. // but only if it is a raw options object that isn't
  34318. // the result of another mergeOptions call.
  34319. // Only merged options has the _base property.
  34320. if (!child._base) {
  34321. if (child.extends) {
  34322. parent = mergeOptions(parent, child.extends, vm);
  34323. }
  34324. if (child.mixins) {
  34325. for (var i = 0, l = child.mixins.length; i < l; i++) {
  34326. parent = mergeOptions(parent, child.mixins[i], vm);
  34327. }
  34328. }
  34329. }
  34330. var options = {};
  34331. var key;
  34332. for (key in parent) {
  34333. mergeField(key);
  34334. }
  34335. for (key in child) {
  34336. if (!hasOwn(parent, key)) {
  34337. mergeField(key);
  34338. }
  34339. }
  34340. function mergeField (key) {
  34341. var strat = strats[key] || defaultStrat;
  34342. options[key] = strat(parent[key], child[key], vm, key);
  34343. }
  34344. return options
  34345. }
  34346. /**
  34347. * Resolve an asset.
  34348. * This function is used because child instances need access
  34349. * to assets defined in its ancestor chain.
  34350. */
  34351. function resolveAsset (
  34352. options,
  34353. type,
  34354. id,
  34355. warnMissing
  34356. ) {
  34357. /* istanbul ignore if */
  34358. if (typeof id !== 'string') {
  34359. return
  34360. }
  34361. var assets = options[type];
  34362. // check local registration variations first
  34363. if (hasOwn(assets, id)) { return assets[id] }
  34364. var camelizedId = camelize(id);
  34365. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  34366. var PascalCaseId = capitalize(camelizedId);
  34367. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  34368. // fallback to prototype chain
  34369. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  34370. if (warnMissing && !res) {
  34371. warn(
  34372. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  34373. options
  34374. );
  34375. }
  34376. return res
  34377. }
  34378. /* */
  34379. function validateProp (
  34380. key,
  34381. propOptions,
  34382. propsData,
  34383. vm
  34384. ) {
  34385. var prop = propOptions[key];
  34386. var absent = !hasOwn(propsData, key);
  34387. var value = propsData[key];
  34388. // boolean casting
  34389. var booleanIndex = getTypeIndex(Boolean, prop.type);
  34390. if (booleanIndex > -1) {
  34391. if (absent && !hasOwn(prop, 'default')) {
  34392. value = false;
  34393. } else if (value === '' || value === hyphenate(key)) {
  34394. // only cast empty string / same name to boolean if
  34395. // boolean has higher priority
  34396. var stringIndex = getTypeIndex(String, prop.type);
  34397. if (stringIndex < 0 || booleanIndex < stringIndex) {
  34398. value = true;
  34399. }
  34400. }
  34401. }
  34402. // check default value
  34403. if (value === undefined) {
  34404. value = getPropDefaultValue(vm, prop, key);
  34405. // since the default value is a fresh copy,
  34406. // make sure to observe it.
  34407. var prevShouldObserve = shouldObserve;
  34408. toggleObserving(true);
  34409. observe(value);
  34410. toggleObserving(prevShouldObserve);
  34411. }
  34412. {
  34413. assertProp(prop, key, value, vm, absent);
  34414. }
  34415. return value
  34416. }
  34417. /**
  34418. * Get the default value of a prop.
  34419. */
  34420. function getPropDefaultValue (vm, prop, key) {
  34421. // no default, return undefined
  34422. if (!hasOwn(prop, 'default')) {
  34423. return undefined
  34424. }
  34425. var def = prop.default;
  34426. // warn against non-factory defaults for Object & Array
  34427. if (isObject(def)) {
  34428. warn(
  34429. 'Invalid default value for prop "' + key + '": ' +
  34430. 'Props with type Object/Array must use a factory function ' +
  34431. 'to return the default value.',
  34432. vm
  34433. );
  34434. }
  34435. // the raw prop value was also undefined from previous render,
  34436. // return previous default value to avoid unnecessary watcher trigger
  34437. if (vm && vm.$options.propsData &&
  34438. vm.$options.propsData[key] === undefined &&
  34439. vm._props[key] !== undefined
  34440. ) {
  34441. return vm._props[key]
  34442. }
  34443. // call factory function for non-Function types
  34444. // a value is Function if its prototype is function even across different execution context
  34445. return typeof def === 'function' && getType(prop.type) !== 'Function'
  34446. ? def.call(vm)
  34447. : def
  34448. }
  34449. /**
  34450. * Assert whether a prop is valid.
  34451. */
  34452. function assertProp (
  34453. prop,
  34454. name,
  34455. value,
  34456. vm,
  34457. absent
  34458. ) {
  34459. if (prop.required && absent) {
  34460. warn(
  34461. 'Missing required prop: "' + name + '"',
  34462. vm
  34463. );
  34464. return
  34465. }
  34466. if (value == null && !prop.required) {
  34467. return
  34468. }
  34469. var type = prop.type;
  34470. var valid = !type || type === true;
  34471. var expectedTypes = [];
  34472. if (type) {
  34473. if (!Array.isArray(type)) {
  34474. type = [type];
  34475. }
  34476. for (var i = 0; i < type.length && !valid; i++) {
  34477. var assertedType = assertType(value, type[i]);
  34478. expectedTypes.push(assertedType.expectedType || '');
  34479. valid = assertedType.valid;
  34480. }
  34481. }
  34482. if (!valid) {
  34483. warn(
  34484. getInvalidTypeMessage(name, value, expectedTypes),
  34485. vm
  34486. );
  34487. return
  34488. }
  34489. var validator = prop.validator;
  34490. if (validator) {
  34491. if (!validator(value)) {
  34492. warn(
  34493. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  34494. vm
  34495. );
  34496. }
  34497. }
  34498. }
  34499. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  34500. function assertType (value, type) {
  34501. var valid;
  34502. var expectedType = getType(type);
  34503. if (simpleCheckRE.test(expectedType)) {
  34504. var t = typeof value;
  34505. valid = t === expectedType.toLowerCase();
  34506. // for primitive wrapper objects
  34507. if (!valid && t === 'object') {
  34508. valid = value instanceof type;
  34509. }
  34510. } else if (expectedType === 'Object') {
  34511. valid = isPlainObject(value);
  34512. } else if (expectedType === 'Array') {
  34513. valid = Array.isArray(value);
  34514. } else {
  34515. valid = value instanceof type;
  34516. }
  34517. return {
  34518. valid: valid,
  34519. expectedType: expectedType
  34520. }
  34521. }
  34522. /**
  34523. * Use function string name to check built-in types,
  34524. * because a simple equality check will fail when running
  34525. * across different vms / iframes.
  34526. */
  34527. function getType (fn) {
  34528. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  34529. return match ? match[1] : ''
  34530. }
  34531. function isSameType (a, b) {
  34532. return getType(a) === getType(b)
  34533. }
  34534. function getTypeIndex (type, expectedTypes) {
  34535. if (!Array.isArray(expectedTypes)) {
  34536. return isSameType(expectedTypes, type) ? 0 : -1
  34537. }
  34538. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  34539. if (isSameType(expectedTypes[i], type)) {
  34540. return i
  34541. }
  34542. }
  34543. return -1
  34544. }
  34545. function getInvalidTypeMessage (name, value, expectedTypes) {
  34546. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  34547. " Expected " + (expectedTypes.map(capitalize).join(', '));
  34548. var expectedType = expectedTypes[0];
  34549. var receivedType = toRawType(value);
  34550. var expectedValue = styleValue(value, expectedType);
  34551. var receivedValue = styleValue(value, receivedType);
  34552. // check if we need to specify expected value
  34553. if (expectedTypes.length === 1 &&
  34554. isExplicable(expectedType) &&
  34555. !isBoolean(expectedType, receivedType)) {
  34556. message += " with value " + expectedValue;
  34557. }
  34558. message += ", got " + receivedType + " ";
  34559. // check if we need to specify received value
  34560. if (isExplicable(receivedType)) {
  34561. message += "with value " + receivedValue + ".";
  34562. }
  34563. return message
  34564. }
  34565. function styleValue (value, type) {
  34566. if (type === 'String') {
  34567. return ("\"" + value + "\"")
  34568. } else if (type === 'Number') {
  34569. return ("" + (Number(value)))
  34570. } else {
  34571. return ("" + value)
  34572. }
  34573. }
  34574. function isExplicable (value) {
  34575. var explicitTypes = ['string', 'number', 'boolean'];
  34576. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  34577. }
  34578. function isBoolean () {
  34579. var args = [], len = arguments.length;
  34580. while ( len-- ) args[ len ] = arguments[ len ];
  34581. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  34582. }
  34583. /* */
  34584. function handleError (err, vm, info) {
  34585. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  34586. // See: https://github.com/vuejs/vuex/issues/1505
  34587. pushTarget();
  34588. try {
  34589. if (vm) {
  34590. var cur = vm;
  34591. while ((cur = cur.$parent)) {
  34592. var hooks = cur.$options.errorCaptured;
  34593. if (hooks) {
  34594. for (var i = 0; i < hooks.length; i++) {
  34595. try {
  34596. var capture = hooks[i].call(cur, err, vm, info) === false;
  34597. if (capture) { return }
  34598. } catch (e) {
  34599. globalHandleError(e, cur, 'errorCaptured hook');
  34600. }
  34601. }
  34602. }
  34603. }
  34604. }
  34605. globalHandleError(err, vm, info);
  34606. } finally {
  34607. popTarget();
  34608. }
  34609. }
  34610. function invokeWithErrorHandling (
  34611. handler,
  34612. context,
  34613. args,
  34614. vm,
  34615. info
  34616. ) {
  34617. var res;
  34618. try {
  34619. res = args ? handler.apply(context, args) : handler.call(context);
  34620. if (res && !res._isVue && isPromise(res) && !res._handled) {
  34621. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  34622. // issue #9511
  34623. // avoid catch triggering multiple times when nested calls
  34624. res._handled = true;
  34625. }
  34626. } catch (e) {
  34627. handleError(e, vm, info);
  34628. }
  34629. return res
  34630. }
  34631. function globalHandleError (err, vm, info) {
  34632. if (config.errorHandler) {
  34633. try {
  34634. return config.errorHandler.call(null, err, vm, info)
  34635. } catch (e) {
  34636. // if the user intentionally throws the original error in the handler,
  34637. // do not log it twice
  34638. if (e !== err) {
  34639. logError(e, null, 'config.errorHandler');
  34640. }
  34641. }
  34642. }
  34643. logError(err, vm, info);
  34644. }
  34645. function logError (err, vm, info) {
  34646. {
  34647. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  34648. }
  34649. /* istanbul ignore else */
  34650. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  34651. console.error(err);
  34652. } else {
  34653. throw err
  34654. }
  34655. }
  34656. /* */
  34657. var isUsingMicroTask = false;
  34658. var callbacks = [];
  34659. var pending = false;
  34660. function flushCallbacks () {
  34661. pending = false;
  34662. var copies = callbacks.slice(0);
  34663. callbacks.length = 0;
  34664. for (var i = 0; i < copies.length; i++) {
  34665. copies[i]();
  34666. }
  34667. }
  34668. // Here we have async deferring wrappers using microtasks.
  34669. // In 2.5 we used (macro) tasks (in combination with microtasks).
  34670. // However, it has subtle problems when state is changed right before repaint
  34671. // (e.g. #6813, out-in transitions).
  34672. // Also, using (macro) tasks in event handler would cause some weird behaviors
  34673. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  34674. // So we now use microtasks everywhere, again.
  34675. // A major drawback of this tradeoff is that there are some scenarios
  34676. // where microtasks have too high a priority and fire in between supposedly
  34677. // sequential events (e.g. #4521, #6690, which have workarounds)
  34678. // or even between bubbling of the same event (#6566).
  34679. var timerFunc;
  34680. // The nextTick behavior leverages the microtask queue, which can be accessed
  34681. // via either native Promise.then or MutationObserver.
  34682. // MutationObserver has wider support, however it is seriously bugged in
  34683. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  34684. // completely stops working after triggering a few times... so, if native
  34685. // Promise is available, we will use it:
  34686. /* istanbul ignore next, $flow-disable-line */
  34687. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  34688. var p = Promise.resolve();
  34689. timerFunc = function () {
  34690. p.then(flushCallbacks);
  34691. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34692. // it can get stuck in a weird state where callbacks are pushed into the
  34693. // microtask queue but the queue isn't being flushed, until the browser
  34694. // needs to do some other work, e.g. handle a timer. Therefore we can
  34695. // "force" the microtask queue to be flushed by adding an empty timer.
  34696. if (isIOS) { setTimeout(noop); }
  34697. };
  34698. isUsingMicroTask = true;
  34699. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34700. isNative(MutationObserver) ||
  34701. // PhantomJS and iOS 7.x
  34702. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34703. )) {
  34704. // Use MutationObserver where native Promise is not available,
  34705. // e.g. PhantomJS, iOS7, Android 4.4
  34706. // (#6466 MutationObserver is unreliable in IE11)
  34707. var counter = 1;
  34708. var observer = new MutationObserver(flushCallbacks);
  34709. var textNode = document.createTextNode(String(counter));
  34710. observer.observe(textNode, {
  34711. characterData: true
  34712. });
  34713. timerFunc = function () {
  34714. counter = (counter + 1) % 2;
  34715. textNode.data = String(counter);
  34716. };
  34717. isUsingMicroTask = true;
  34718. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34719. // Fallback to setImmediate.
  34720. // Technically it leverages the (macro) task queue,
  34721. // but it is still a better choice than setTimeout.
  34722. timerFunc = function () {
  34723. setImmediate(flushCallbacks);
  34724. };
  34725. } else {
  34726. // Fallback to setTimeout.
  34727. timerFunc = function () {
  34728. setTimeout(flushCallbacks, 0);
  34729. };
  34730. }
  34731. function nextTick (cb, ctx) {
  34732. var _resolve;
  34733. callbacks.push(function () {
  34734. if (cb) {
  34735. try {
  34736. cb.call(ctx);
  34737. } catch (e) {
  34738. handleError(e, ctx, 'nextTick');
  34739. }
  34740. } else if (_resolve) {
  34741. _resolve(ctx);
  34742. }
  34743. });
  34744. if (!pending) {
  34745. pending = true;
  34746. timerFunc();
  34747. }
  34748. // $flow-disable-line
  34749. if (!cb && typeof Promise !== 'undefined') {
  34750. return new Promise(function (resolve) {
  34751. _resolve = resolve;
  34752. })
  34753. }
  34754. }
  34755. /* */
  34756. var mark;
  34757. var measure;
  34758. {
  34759. var perf = inBrowser && window.performance;
  34760. /* istanbul ignore if */
  34761. if (
  34762. perf &&
  34763. perf.mark &&
  34764. perf.measure &&
  34765. perf.clearMarks &&
  34766. perf.clearMeasures
  34767. ) {
  34768. mark = function (tag) { return perf.mark(tag); };
  34769. measure = function (name, startTag, endTag) {
  34770. perf.measure(name, startTag, endTag);
  34771. perf.clearMarks(startTag);
  34772. perf.clearMarks(endTag);
  34773. // perf.clearMeasures(name)
  34774. };
  34775. }
  34776. }
  34777. /* not type checking this file because flow doesn't play well with Proxy */
  34778. var initProxy;
  34779. {
  34780. var allowedGlobals = makeMap(
  34781. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34782. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34783. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34784. 'require' // for Webpack/Browserify
  34785. );
  34786. var warnNonPresent = function (target, key) {
  34787. warn(
  34788. "Property or method \"" + key + "\" is not defined on the instance but " +
  34789. 'referenced during render. Make sure that this property is reactive, ' +
  34790. 'either in the data option, or for class-based components, by ' +
  34791. 'initializing the property. ' +
  34792. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34793. target
  34794. );
  34795. };
  34796. var warnReservedPrefix = function (target, key) {
  34797. warn(
  34798. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34799. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34800. 'prevent conflicts with Vue internals. ' +
  34801. 'See: https://vuejs.org/v2/api/#data',
  34802. target
  34803. );
  34804. };
  34805. var hasProxy =
  34806. typeof Proxy !== 'undefined' && isNative(Proxy);
  34807. if (hasProxy) {
  34808. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34809. config.keyCodes = new Proxy(config.keyCodes, {
  34810. set: function set (target, key, value) {
  34811. if (isBuiltInModifier(key)) {
  34812. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34813. return false
  34814. } else {
  34815. target[key] = value;
  34816. return true
  34817. }
  34818. }
  34819. });
  34820. }
  34821. var hasHandler = {
  34822. has: function has (target, key) {
  34823. var has = key in target;
  34824. var isAllowed = allowedGlobals(key) ||
  34825. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34826. if (!has && !isAllowed) {
  34827. if (key in target.$data) { warnReservedPrefix(target, key); }
  34828. else { warnNonPresent(target, key); }
  34829. }
  34830. return has || !isAllowed
  34831. }
  34832. };
  34833. var getHandler = {
  34834. get: function get (target, key) {
  34835. if (typeof key === 'string' && !(key in target)) {
  34836. if (key in target.$data) { warnReservedPrefix(target, key); }
  34837. else { warnNonPresent(target, key); }
  34838. }
  34839. return target[key]
  34840. }
  34841. };
  34842. initProxy = function initProxy (vm) {
  34843. if (hasProxy) {
  34844. // determine which proxy handler to use
  34845. var options = vm.$options;
  34846. var handlers = options.render && options.render._withStripped
  34847. ? getHandler
  34848. : hasHandler;
  34849. vm._renderProxy = new Proxy(vm, handlers);
  34850. } else {
  34851. vm._renderProxy = vm;
  34852. }
  34853. };
  34854. }
  34855. /* */
  34856. var seenObjects = new _Set();
  34857. /**
  34858. * Recursively traverse an object to evoke all converted
  34859. * getters, so that every nested property inside the object
  34860. * is collected as a "deep" dependency.
  34861. */
  34862. function traverse (val) {
  34863. _traverse(val, seenObjects);
  34864. seenObjects.clear();
  34865. }
  34866. function _traverse (val, seen) {
  34867. var i, keys;
  34868. var isA = Array.isArray(val);
  34869. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34870. return
  34871. }
  34872. if (val.__ob__) {
  34873. var depId = val.__ob__.dep.id;
  34874. if (seen.has(depId)) {
  34875. return
  34876. }
  34877. seen.add(depId);
  34878. }
  34879. if (isA) {
  34880. i = val.length;
  34881. while (i--) { _traverse(val[i], seen); }
  34882. } else {
  34883. keys = Object.keys(val);
  34884. i = keys.length;
  34885. while (i--) { _traverse(val[keys[i]], seen); }
  34886. }
  34887. }
  34888. /* */
  34889. var normalizeEvent = cached(function (name) {
  34890. var passive = name.charAt(0) === '&';
  34891. name = passive ? name.slice(1) : name;
  34892. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34893. name = once$$1 ? name.slice(1) : name;
  34894. var capture = name.charAt(0) === '!';
  34895. name = capture ? name.slice(1) : name;
  34896. return {
  34897. name: name,
  34898. once: once$$1,
  34899. capture: capture,
  34900. passive: passive
  34901. }
  34902. });
  34903. function createFnInvoker (fns, vm) {
  34904. function invoker () {
  34905. var arguments$1 = arguments;
  34906. var fns = invoker.fns;
  34907. if (Array.isArray(fns)) {
  34908. var cloned = fns.slice();
  34909. for (var i = 0; i < cloned.length; i++) {
  34910. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34911. }
  34912. } else {
  34913. // return handler return value for single handlers
  34914. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34915. }
  34916. }
  34917. invoker.fns = fns;
  34918. return invoker
  34919. }
  34920. function updateListeners (
  34921. on,
  34922. oldOn,
  34923. add,
  34924. remove$$1,
  34925. createOnceHandler,
  34926. vm
  34927. ) {
  34928. var name, def$$1, cur, old, event;
  34929. for (name in on) {
  34930. def$$1 = cur = on[name];
  34931. old = oldOn[name];
  34932. event = normalizeEvent(name);
  34933. if (isUndef(cur)) {
  34934. warn(
  34935. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34936. vm
  34937. );
  34938. } else if (isUndef(old)) {
  34939. if (isUndef(cur.fns)) {
  34940. cur = on[name] = createFnInvoker(cur, vm);
  34941. }
  34942. if (isTrue(event.once)) {
  34943. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34944. }
  34945. add(event.name, cur, event.capture, event.passive, event.params);
  34946. } else if (cur !== old) {
  34947. old.fns = cur;
  34948. on[name] = old;
  34949. }
  34950. }
  34951. for (name in oldOn) {
  34952. if (isUndef(on[name])) {
  34953. event = normalizeEvent(name);
  34954. remove$$1(event.name, oldOn[name], event.capture);
  34955. }
  34956. }
  34957. }
  34958. /* */
  34959. function mergeVNodeHook (def, hookKey, hook) {
  34960. if (def instanceof VNode) {
  34961. def = def.data.hook || (def.data.hook = {});
  34962. }
  34963. var invoker;
  34964. var oldHook = def[hookKey];
  34965. function wrappedHook () {
  34966. hook.apply(this, arguments);
  34967. // important: remove merged hook to ensure it's called only once
  34968. // and prevent memory leak
  34969. remove(invoker.fns, wrappedHook);
  34970. }
  34971. if (isUndef(oldHook)) {
  34972. // no existing hook
  34973. invoker = createFnInvoker([wrappedHook]);
  34974. } else {
  34975. /* istanbul ignore if */
  34976. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34977. // already a merged invoker
  34978. invoker = oldHook;
  34979. invoker.fns.push(wrappedHook);
  34980. } else {
  34981. // existing plain hook
  34982. invoker = createFnInvoker([oldHook, wrappedHook]);
  34983. }
  34984. }
  34985. invoker.merged = true;
  34986. def[hookKey] = invoker;
  34987. }
  34988. /* */
  34989. function extractPropsFromVNodeData (
  34990. data,
  34991. Ctor,
  34992. tag
  34993. ) {
  34994. // we are only extracting raw values here.
  34995. // validation and default values are handled in the child
  34996. // component itself.
  34997. var propOptions = Ctor.options.props;
  34998. if (isUndef(propOptions)) {
  34999. return
  35000. }
  35001. var res = {};
  35002. var attrs = data.attrs;
  35003. var props = data.props;
  35004. if (isDef(attrs) || isDef(props)) {
  35005. for (var key in propOptions) {
  35006. var altKey = hyphenate(key);
  35007. {
  35008. var keyInLowerCase = key.toLowerCase();
  35009. if (
  35010. key !== keyInLowerCase &&
  35011. attrs && hasOwn(attrs, keyInLowerCase)
  35012. ) {
  35013. tip(
  35014. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  35015. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  35016. " \"" + key + "\". " +
  35017. "Note that HTML attributes are case-insensitive and camelCased " +
  35018. "props need to use their kebab-case equivalents when using in-DOM " +
  35019. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  35020. );
  35021. }
  35022. }
  35023. checkProp(res, props, key, altKey, true) ||
  35024. checkProp(res, attrs, key, altKey, false);
  35025. }
  35026. }
  35027. return res
  35028. }
  35029. function checkProp (
  35030. res,
  35031. hash,
  35032. key,
  35033. altKey,
  35034. preserve
  35035. ) {
  35036. if (isDef(hash)) {
  35037. if (hasOwn(hash, key)) {
  35038. res[key] = hash[key];
  35039. if (!preserve) {
  35040. delete hash[key];
  35041. }
  35042. return true
  35043. } else if (hasOwn(hash, altKey)) {
  35044. res[key] = hash[altKey];
  35045. if (!preserve) {
  35046. delete hash[altKey];
  35047. }
  35048. return true
  35049. }
  35050. }
  35051. return false
  35052. }
  35053. /* */
  35054. // The template compiler attempts to minimize the need for normalization by
  35055. // statically analyzing the template at compile time.
  35056. //
  35057. // For plain HTML markup, normalization can be completely skipped because the
  35058. // generated render function is guaranteed to return Array<VNode>. There are
  35059. // two cases where extra normalization is needed:
  35060. // 1. When the children contains components - because a functional component
  35061. // may return an Array instead of a single root. In this case, just a simple
  35062. // normalization is needed - if any child is an Array, we flatten the whole
  35063. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  35064. // because functional components already normalize their own children.
  35065. function simpleNormalizeChildren (children) {
  35066. for (var i = 0; i < children.length; i++) {
  35067. if (Array.isArray(children[i])) {
  35068. return Array.prototype.concat.apply([], children)
  35069. }
  35070. }
  35071. return children
  35072. }
  35073. // 2. When the children contains constructs that always generated nested Arrays,
  35074. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  35075. // with hand-written render functions / JSX. In such cases a full normalization
  35076. // is needed to cater to all possible types of children values.
  35077. function normalizeChildren (children) {
  35078. return isPrimitive(children)
  35079. ? [createTextVNode(children)]
  35080. : Array.isArray(children)
  35081. ? normalizeArrayChildren(children)
  35082. : undefined
  35083. }
  35084. function isTextNode (node) {
  35085. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  35086. }
  35087. function normalizeArrayChildren (children, nestedIndex) {
  35088. var res = [];
  35089. var i, c, lastIndex, last;
  35090. for (i = 0; i < children.length; i++) {
  35091. c = children[i];
  35092. if (isUndef(c) || typeof c === 'boolean') { continue }
  35093. lastIndex = res.length - 1;
  35094. last = res[lastIndex];
  35095. // nested
  35096. if (Array.isArray(c)) {
  35097. if (c.length > 0) {
  35098. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  35099. // merge adjacent text nodes
  35100. if (isTextNode(c[0]) && isTextNode(last)) {
  35101. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  35102. c.shift();
  35103. }
  35104. res.push.apply(res, c);
  35105. }
  35106. } else if (isPrimitive(c)) {
  35107. if (isTextNode(last)) {
  35108. // merge adjacent text nodes
  35109. // this is necessary for SSR hydration because text nodes are
  35110. // essentially merged when rendered to HTML strings
  35111. res[lastIndex] = createTextVNode(last.text + c);
  35112. } else if (c !== '') {
  35113. // convert primitive to vnode
  35114. res.push(createTextVNode(c));
  35115. }
  35116. } else {
  35117. if (isTextNode(c) && isTextNode(last)) {
  35118. // merge adjacent text nodes
  35119. res[lastIndex] = createTextVNode(last.text + c.text);
  35120. } else {
  35121. // default key for nested array children (likely generated by v-for)
  35122. if (isTrue(children._isVList) &&
  35123. isDef(c.tag) &&
  35124. isUndef(c.key) &&
  35125. isDef(nestedIndex)) {
  35126. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  35127. }
  35128. res.push(c);
  35129. }
  35130. }
  35131. }
  35132. return res
  35133. }
  35134. /* */
  35135. function initProvide (vm) {
  35136. var provide = vm.$options.provide;
  35137. if (provide) {
  35138. vm._provided = typeof provide === 'function'
  35139. ? provide.call(vm)
  35140. : provide;
  35141. }
  35142. }
  35143. function initInjections (vm) {
  35144. var result = resolveInject(vm.$options.inject, vm);
  35145. if (result) {
  35146. toggleObserving(false);
  35147. Object.keys(result).forEach(function (key) {
  35148. /* istanbul ignore else */
  35149. {
  35150. defineReactive$$1(vm, key, result[key], function () {
  35151. warn(
  35152. "Avoid mutating an injected value directly since the changes will be " +
  35153. "overwritten whenever the provided component re-renders. " +
  35154. "injection being mutated: \"" + key + "\"",
  35155. vm
  35156. );
  35157. });
  35158. }
  35159. });
  35160. toggleObserving(true);
  35161. }
  35162. }
  35163. function resolveInject (inject, vm) {
  35164. if (inject) {
  35165. // inject is :any because flow is not smart enough to figure out cached
  35166. var result = Object.create(null);
  35167. var keys = hasSymbol
  35168. ? Reflect.ownKeys(inject)
  35169. : Object.keys(inject);
  35170. for (var i = 0; i < keys.length; i++) {
  35171. var key = keys[i];
  35172. // #6574 in case the inject object is observed...
  35173. if (key === '__ob__') { continue }
  35174. var provideKey = inject[key].from;
  35175. var source = vm;
  35176. while (source) {
  35177. if (source._provided && hasOwn(source._provided, provideKey)) {
  35178. result[key] = source._provided[provideKey];
  35179. break
  35180. }
  35181. source = source.$parent;
  35182. }
  35183. if (!source) {
  35184. if ('default' in inject[key]) {
  35185. var provideDefault = inject[key].default;
  35186. result[key] = typeof provideDefault === 'function'
  35187. ? provideDefault.call(vm)
  35188. : provideDefault;
  35189. } else {
  35190. warn(("Injection \"" + key + "\" not found"), vm);
  35191. }
  35192. }
  35193. }
  35194. return result
  35195. }
  35196. }
  35197. /* */
  35198. /**
  35199. * Runtime helper for resolving raw children VNodes into a slot object.
  35200. */
  35201. function resolveSlots (
  35202. children,
  35203. context
  35204. ) {
  35205. if (!children || !children.length) {
  35206. return {}
  35207. }
  35208. var slots = {};
  35209. for (var i = 0, l = children.length; i < l; i++) {
  35210. var child = children[i];
  35211. var data = child.data;
  35212. // remove slot attribute if the node is resolved as a Vue slot node
  35213. if (data && data.attrs && data.attrs.slot) {
  35214. delete data.attrs.slot;
  35215. }
  35216. // named slots should only be respected if the vnode was rendered in the
  35217. // same context.
  35218. if ((child.context === context || child.fnContext === context) &&
  35219. data && data.slot != null
  35220. ) {
  35221. var name = data.slot;
  35222. var slot = (slots[name] || (slots[name] = []));
  35223. if (child.tag === 'template') {
  35224. slot.push.apply(slot, child.children || []);
  35225. } else {
  35226. slot.push(child);
  35227. }
  35228. } else {
  35229. (slots.default || (slots.default = [])).push(child);
  35230. }
  35231. }
  35232. // ignore slots that contains only whitespace
  35233. for (var name$1 in slots) {
  35234. if (slots[name$1].every(isWhitespace)) {
  35235. delete slots[name$1];
  35236. }
  35237. }
  35238. return slots
  35239. }
  35240. function isWhitespace (node) {
  35241. return (node.isComment && !node.asyncFactory) || node.text === ' '
  35242. }
  35243. /* */
  35244. function normalizeScopedSlots (
  35245. slots,
  35246. normalSlots,
  35247. prevSlots
  35248. ) {
  35249. var res;
  35250. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  35251. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  35252. var key = slots && slots.$key;
  35253. if (!slots) {
  35254. res = {};
  35255. } else if (slots._normalized) {
  35256. // fast path 1: child component re-render only, parent did not change
  35257. return slots._normalized
  35258. } else if (
  35259. isStable &&
  35260. prevSlots &&
  35261. prevSlots !== emptyObject &&
  35262. key === prevSlots.$key &&
  35263. !hasNormalSlots &&
  35264. !prevSlots.$hasNormal
  35265. ) {
  35266. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  35267. // only need to normalize once
  35268. return prevSlots
  35269. } else {
  35270. res = {};
  35271. for (var key$1 in slots) {
  35272. if (slots[key$1] && key$1[0] !== '$') {
  35273. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  35274. }
  35275. }
  35276. }
  35277. // expose normal slots on scopedSlots
  35278. for (var key$2 in normalSlots) {
  35279. if (!(key$2 in res)) {
  35280. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  35281. }
  35282. }
  35283. // avoriaz seems to mock a non-extensible $scopedSlots object
  35284. // and when that is passed down this would cause an error
  35285. if (slots && Object.isExtensible(slots)) {
  35286. (slots)._normalized = res;
  35287. }
  35288. def(res, '$stable', isStable);
  35289. def(res, '$key', key);
  35290. def(res, '$hasNormal', hasNormalSlots);
  35291. return res
  35292. }
  35293. function normalizeScopedSlot(normalSlots, key, fn) {
  35294. var normalized = function () {
  35295. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  35296. res = res && typeof res === 'object' && !Array.isArray(res)
  35297. ? [res] // single vnode
  35298. : normalizeChildren(res);
  35299. return res && (
  35300. res.length === 0 ||
  35301. (res.length === 1 && res[0].isComment) // #9658
  35302. ) ? undefined
  35303. : res
  35304. };
  35305. // this is a slot using the new v-slot syntax without scope. although it is
  35306. // compiled as a scoped slot, render fn users would expect it to be present
  35307. // on this.$slots because the usage is semantically a normal slot.
  35308. if (fn.proxy) {
  35309. Object.defineProperty(normalSlots, key, {
  35310. get: normalized,
  35311. enumerable: true,
  35312. configurable: true
  35313. });
  35314. }
  35315. return normalized
  35316. }
  35317. function proxyNormalSlot(slots, key) {
  35318. return function () { return slots[key]; }
  35319. }
  35320. /* */
  35321. /**
  35322. * Runtime helper for rendering v-for lists.
  35323. */
  35324. function renderList (
  35325. val,
  35326. render
  35327. ) {
  35328. var ret, i, l, keys, key;
  35329. if (Array.isArray(val) || typeof val === 'string') {
  35330. ret = new Array(val.length);
  35331. for (i = 0, l = val.length; i < l; i++) {
  35332. ret[i] = render(val[i], i);
  35333. }
  35334. } else if (typeof val === 'number') {
  35335. ret = new Array(val);
  35336. for (i = 0; i < val; i++) {
  35337. ret[i] = render(i + 1, i);
  35338. }
  35339. } else if (isObject(val)) {
  35340. if (hasSymbol && val[Symbol.iterator]) {
  35341. ret = [];
  35342. var iterator = val[Symbol.iterator]();
  35343. var result = iterator.next();
  35344. while (!result.done) {
  35345. ret.push(render(result.value, ret.length));
  35346. result = iterator.next();
  35347. }
  35348. } else {
  35349. keys = Object.keys(val);
  35350. ret = new Array(keys.length);
  35351. for (i = 0, l = keys.length; i < l; i++) {
  35352. key = keys[i];
  35353. ret[i] = render(val[key], key, i);
  35354. }
  35355. }
  35356. }
  35357. if (!isDef(ret)) {
  35358. ret = [];
  35359. }
  35360. (ret)._isVList = true;
  35361. return ret
  35362. }
  35363. /* */
  35364. /**
  35365. * Runtime helper for rendering <slot>
  35366. */
  35367. function renderSlot (
  35368. name,
  35369. fallback,
  35370. props,
  35371. bindObject
  35372. ) {
  35373. var scopedSlotFn = this.$scopedSlots[name];
  35374. var nodes;
  35375. if (scopedSlotFn) { // scoped slot
  35376. props = props || {};
  35377. if (bindObject) {
  35378. if (!isObject(bindObject)) {
  35379. warn(
  35380. 'slot v-bind without argument expects an Object',
  35381. this
  35382. );
  35383. }
  35384. props = extend(extend({}, bindObject), props);
  35385. }
  35386. nodes = scopedSlotFn(props) || fallback;
  35387. } else {
  35388. nodes = this.$slots[name] || fallback;
  35389. }
  35390. var target = props && props.slot;
  35391. if (target) {
  35392. return this.$createElement('template', { slot: target }, nodes)
  35393. } else {
  35394. return nodes
  35395. }
  35396. }
  35397. /* */
  35398. /**
  35399. * Runtime helper for resolving filters
  35400. */
  35401. function resolveFilter (id) {
  35402. return resolveAsset(this.$options, 'filters', id, true) || identity
  35403. }
  35404. /* */
  35405. function isKeyNotMatch (expect, actual) {
  35406. if (Array.isArray(expect)) {
  35407. return expect.indexOf(actual) === -1
  35408. } else {
  35409. return expect !== actual
  35410. }
  35411. }
  35412. /**
  35413. * Runtime helper for checking keyCodes from config.
  35414. * exposed as Vue.prototype._k
  35415. * passing in eventKeyName as last argument separately for backwards compat
  35416. */
  35417. function checkKeyCodes (
  35418. eventKeyCode,
  35419. key,
  35420. builtInKeyCode,
  35421. eventKeyName,
  35422. builtInKeyName
  35423. ) {
  35424. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  35425. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  35426. return isKeyNotMatch(builtInKeyName, eventKeyName)
  35427. } else if (mappedKeyCode) {
  35428. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  35429. } else if (eventKeyName) {
  35430. return hyphenate(eventKeyName) !== key
  35431. }
  35432. }
  35433. /* */
  35434. /**
  35435. * Runtime helper for merging v-bind="object" into a VNode's data.
  35436. */
  35437. function bindObjectProps (
  35438. data,
  35439. tag,
  35440. value,
  35441. asProp,
  35442. isSync
  35443. ) {
  35444. if (value) {
  35445. if (!isObject(value)) {
  35446. warn(
  35447. 'v-bind without argument expects an Object or Array value',
  35448. this
  35449. );
  35450. } else {
  35451. if (Array.isArray(value)) {
  35452. value = toObject(value);
  35453. }
  35454. var hash;
  35455. var loop = function ( key ) {
  35456. if (
  35457. key === 'class' ||
  35458. key === 'style' ||
  35459. isReservedAttribute(key)
  35460. ) {
  35461. hash = data;
  35462. } else {
  35463. var type = data.attrs && data.attrs.type;
  35464. hash = asProp || config.mustUseProp(tag, type, key)
  35465. ? data.domProps || (data.domProps = {})
  35466. : data.attrs || (data.attrs = {});
  35467. }
  35468. var camelizedKey = camelize(key);
  35469. var hyphenatedKey = hyphenate(key);
  35470. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  35471. hash[key] = value[key];
  35472. if (isSync) {
  35473. var on = data.on || (data.on = {});
  35474. on[("update:" + key)] = function ($event) {
  35475. value[key] = $event;
  35476. };
  35477. }
  35478. }
  35479. };
  35480. for (var key in value) loop( key );
  35481. }
  35482. }
  35483. return data
  35484. }
  35485. /* */
  35486. /**
  35487. * Runtime helper for rendering static trees.
  35488. */
  35489. function renderStatic (
  35490. index,
  35491. isInFor
  35492. ) {
  35493. var cached = this._staticTrees || (this._staticTrees = []);
  35494. var tree = cached[index];
  35495. // if has already-rendered static tree and not inside v-for,
  35496. // we can reuse the same tree.
  35497. if (tree && !isInFor) {
  35498. return tree
  35499. }
  35500. // otherwise, render a fresh tree.
  35501. tree = cached[index] = this.$options.staticRenderFns[index].call(
  35502. this._renderProxy,
  35503. null,
  35504. this // for render fns generated for functional component templates
  35505. );
  35506. markStatic(tree, ("__static__" + index), false);
  35507. return tree
  35508. }
  35509. /**
  35510. * Runtime helper for v-once.
  35511. * Effectively it means marking the node as static with a unique key.
  35512. */
  35513. function markOnce (
  35514. tree,
  35515. index,
  35516. key
  35517. ) {
  35518. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  35519. return tree
  35520. }
  35521. function markStatic (
  35522. tree,
  35523. key,
  35524. isOnce
  35525. ) {
  35526. if (Array.isArray(tree)) {
  35527. for (var i = 0; i < tree.length; i++) {
  35528. if (tree[i] && typeof tree[i] !== 'string') {
  35529. markStaticNode(tree[i], (key + "_" + i), isOnce);
  35530. }
  35531. }
  35532. } else {
  35533. markStaticNode(tree, key, isOnce);
  35534. }
  35535. }
  35536. function markStaticNode (node, key, isOnce) {
  35537. node.isStatic = true;
  35538. node.key = key;
  35539. node.isOnce = isOnce;
  35540. }
  35541. /* */
  35542. function bindObjectListeners (data, value) {
  35543. if (value) {
  35544. if (!isPlainObject(value)) {
  35545. warn(
  35546. 'v-on without argument expects an Object value',
  35547. this
  35548. );
  35549. } else {
  35550. var on = data.on = data.on ? extend({}, data.on) : {};
  35551. for (var key in value) {
  35552. var existing = on[key];
  35553. var ours = value[key];
  35554. on[key] = existing ? [].concat(existing, ours) : ours;
  35555. }
  35556. }
  35557. }
  35558. return data
  35559. }
  35560. /* */
  35561. function resolveScopedSlots (
  35562. fns, // see flow/vnode
  35563. res,
  35564. // the following are added in 2.6
  35565. hasDynamicKeys,
  35566. contentHashKey
  35567. ) {
  35568. res = res || { $stable: !hasDynamicKeys };
  35569. for (var i = 0; i < fns.length; i++) {
  35570. var slot = fns[i];
  35571. if (Array.isArray(slot)) {
  35572. resolveScopedSlots(slot, res, hasDynamicKeys);
  35573. } else if (slot) {
  35574. // marker for reverse proxying v-slot without scope on this.$slots
  35575. if (slot.proxy) {
  35576. slot.fn.proxy = true;
  35577. }
  35578. res[slot.key] = slot.fn;
  35579. }
  35580. }
  35581. if (contentHashKey) {
  35582. (res).$key = contentHashKey;
  35583. }
  35584. return res
  35585. }
  35586. /* */
  35587. function bindDynamicKeys (baseObj, values) {
  35588. for (var i = 0; i < values.length; i += 2) {
  35589. var key = values[i];
  35590. if (typeof key === 'string' && key) {
  35591. baseObj[values[i]] = values[i + 1];
  35592. } else if (key !== '' && key !== null) {
  35593. // null is a special value for explicitly removing a binding
  35594. warn(
  35595. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  35596. this
  35597. );
  35598. }
  35599. }
  35600. return baseObj
  35601. }
  35602. // helper to dynamically append modifier runtime markers to event names.
  35603. // ensure only append when value is already string, otherwise it will be cast
  35604. // to string and cause the type check to miss.
  35605. function prependModifier (value, symbol) {
  35606. return typeof value === 'string' ? symbol + value : value
  35607. }
  35608. /* */
  35609. function installRenderHelpers (target) {
  35610. target._o = markOnce;
  35611. target._n = toNumber;
  35612. target._s = toString;
  35613. target._l = renderList;
  35614. target._t = renderSlot;
  35615. target._q = looseEqual;
  35616. target._i = looseIndexOf;
  35617. target._m = renderStatic;
  35618. target._f = resolveFilter;
  35619. target._k = checkKeyCodes;
  35620. target._b = bindObjectProps;
  35621. target._v = createTextVNode;
  35622. target._e = createEmptyVNode;
  35623. target._u = resolveScopedSlots;
  35624. target._g = bindObjectListeners;
  35625. target._d = bindDynamicKeys;
  35626. target._p = prependModifier;
  35627. }
  35628. /* */
  35629. function FunctionalRenderContext (
  35630. data,
  35631. props,
  35632. children,
  35633. parent,
  35634. Ctor
  35635. ) {
  35636. var this$1 = this;
  35637. var options = Ctor.options;
  35638. // ensure the createElement function in functional components
  35639. // gets a unique context - this is necessary for correct named slot check
  35640. var contextVm;
  35641. if (hasOwn(parent, '_uid')) {
  35642. contextVm = Object.create(parent);
  35643. // $flow-disable-line
  35644. contextVm._original = parent;
  35645. } else {
  35646. // the context vm passed in is a functional context as well.
  35647. // in this case we want to make sure we are able to get a hold to the
  35648. // real context instance.
  35649. contextVm = parent;
  35650. // $flow-disable-line
  35651. parent = parent._original;
  35652. }
  35653. var isCompiled = isTrue(options._compiled);
  35654. var needNormalization = !isCompiled;
  35655. this.data = data;
  35656. this.props = props;
  35657. this.children = children;
  35658. this.parent = parent;
  35659. this.listeners = data.on || emptyObject;
  35660. this.injections = resolveInject(options.inject, parent);
  35661. this.slots = function () {
  35662. if (!this$1.$slots) {
  35663. normalizeScopedSlots(
  35664. data.scopedSlots,
  35665. this$1.$slots = resolveSlots(children, parent)
  35666. );
  35667. }
  35668. return this$1.$slots
  35669. };
  35670. Object.defineProperty(this, 'scopedSlots', ({
  35671. enumerable: true,
  35672. get: function get () {
  35673. return normalizeScopedSlots(data.scopedSlots, this.slots())
  35674. }
  35675. }));
  35676. // support for compiled functional template
  35677. if (isCompiled) {
  35678. // exposing $options for renderStatic()
  35679. this.$options = options;
  35680. // pre-resolve slots for renderSlot()
  35681. this.$slots = this.slots();
  35682. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  35683. }
  35684. if (options._scopeId) {
  35685. this._c = function (a, b, c, d) {
  35686. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  35687. if (vnode && !Array.isArray(vnode)) {
  35688. vnode.fnScopeId = options._scopeId;
  35689. vnode.fnContext = parent;
  35690. }
  35691. return vnode
  35692. };
  35693. } else {
  35694. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35695. }
  35696. }
  35697. installRenderHelpers(FunctionalRenderContext.prototype);
  35698. function createFunctionalComponent (
  35699. Ctor,
  35700. propsData,
  35701. data,
  35702. contextVm,
  35703. children
  35704. ) {
  35705. var options = Ctor.options;
  35706. var props = {};
  35707. var propOptions = options.props;
  35708. if (isDef(propOptions)) {
  35709. for (var key in propOptions) {
  35710. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35711. }
  35712. } else {
  35713. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35714. if (isDef(data.props)) { mergeProps(props, data.props); }
  35715. }
  35716. var renderContext = new FunctionalRenderContext(
  35717. data,
  35718. props,
  35719. children,
  35720. contextVm,
  35721. Ctor
  35722. );
  35723. var vnode = options.render.call(null, renderContext._c, renderContext);
  35724. if (vnode instanceof VNode) {
  35725. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35726. } else if (Array.isArray(vnode)) {
  35727. var vnodes = normalizeChildren(vnode) || [];
  35728. var res = new Array(vnodes.length);
  35729. for (var i = 0; i < vnodes.length; i++) {
  35730. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35731. }
  35732. return res
  35733. }
  35734. }
  35735. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35736. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35737. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35738. // that should not be matched to match.
  35739. var clone = cloneVNode(vnode);
  35740. clone.fnContext = contextVm;
  35741. clone.fnOptions = options;
  35742. {
  35743. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35744. }
  35745. if (data.slot) {
  35746. (clone.data || (clone.data = {})).slot = data.slot;
  35747. }
  35748. return clone
  35749. }
  35750. function mergeProps (to, from) {
  35751. for (var key in from) {
  35752. to[camelize(key)] = from[key];
  35753. }
  35754. }
  35755. /* */
  35756. /* */
  35757. /* */
  35758. /* */
  35759. // inline hooks to be invoked on component VNodes during patch
  35760. var componentVNodeHooks = {
  35761. init: function init (vnode, hydrating) {
  35762. if (
  35763. vnode.componentInstance &&
  35764. !vnode.componentInstance._isDestroyed &&
  35765. vnode.data.keepAlive
  35766. ) {
  35767. // kept-alive components, treat as a patch
  35768. var mountedNode = vnode; // work around flow
  35769. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35770. } else {
  35771. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35772. vnode,
  35773. activeInstance
  35774. );
  35775. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35776. }
  35777. },
  35778. prepatch: function prepatch (oldVnode, vnode) {
  35779. var options = vnode.componentOptions;
  35780. var child = vnode.componentInstance = oldVnode.componentInstance;
  35781. updateChildComponent(
  35782. child,
  35783. options.propsData, // updated props
  35784. options.listeners, // updated listeners
  35785. vnode, // new parent vnode
  35786. options.children // new children
  35787. );
  35788. },
  35789. insert: function insert (vnode) {
  35790. var context = vnode.context;
  35791. var componentInstance = vnode.componentInstance;
  35792. if (!componentInstance._isMounted) {
  35793. componentInstance._isMounted = true;
  35794. callHook(componentInstance, 'mounted');
  35795. }
  35796. if (vnode.data.keepAlive) {
  35797. if (context._isMounted) {
  35798. // vue-router#1212
  35799. // During updates, a kept-alive component's child components may
  35800. // change, so directly walking the tree here may call activated hooks
  35801. // on incorrect children. Instead we push them into a queue which will
  35802. // be processed after the whole patch process ended.
  35803. queueActivatedComponent(componentInstance);
  35804. } else {
  35805. activateChildComponent(componentInstance, true /* direct */);
  35806. }
  35807. }
  35808. },
  35809. destroy: function destroy (vnode) {
  35810. var componentInstance = vnode.componentInstance;
  35811. if (!componentInstance._isDestroyed) {
  35812. if (!vnode.data.keepAlive) {
  35813. componentInstance.$destroy();
  35814. } else {
  35815. deactivateChildComponent(componentInstance, true /* direct */);
  35816. }
  35817. }
  35818. }
  35819. };
  35820. var hooksToMerge = Object.keys(componentVNodeHooks);
  35821. function createComponent (
  35822. Ctor,
  35823. data,
  35824. context,
  35825. children,
  35826. tag
  35827. ) {
  35828. if (isUndef(Ctor)) {
  35829. return
  35830. }
  35831. var baseCtor = context.$options._base;
  35832. // plain options object: turn it into a constructor
  35833. if (isObject(Ctor)) {
  35834. Ctor = baseCtor.extend(Ctor);
  35835. }
  35836. // if at this stage it's not a constructor or an async component factory,
  35837. // reject.
  35838. if (typeof Ctor !== 'function') {
  35839. {
  35840. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35841. }
  35842. return
  35843. }
  35844. // async component
  35845. var asyncFactory;
  35846. if (isUndef(Ctor.cid)) {
  35847. asyncFactory = Ctor;
  35848. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35849. if (Ctor === undefined) {
  35850. // return a placeholder node for async component, which is rendered
  35851. // as a comment node but preserves all the raw information for the node.
  35852. // the information will be used for async server-rendering and hydration.
  35853. return createAsyncPlaceholder(
  35854. asyncFactory,
  35855. data,
  35856. context,
  35857. children,
  35858. tag
  35859. )
  35860. }
  35861. }
  35862. data = data || {};
  35863. // resolve constructor options in case global mixins are applied after
  35864. // component constructor creation
  35865. resolveConstructorOptions(Ctor);
  35866. // transform component v-model data into props & events
  35867. if (isDef(data.model)) {
  35868. transformModel(Ctor.options, data);
  35869. }
  35870. // extract props
  35871. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35872. // functional component
  35873. if (isTrue(Ctor.options.functional)) {
  35874. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35875. }
  35876. // extract listeners, since these needs to be treated as
  35877. // child component listeners instead of DOM listeners
  35878. var listeners = data.on;
  35879. // replace with listeners with .native modifier
  35880. // so it gets processed during parent component patch.
  35881. data.on = data.nativeOn;
  35882. if (isTrue(Ctor.options.abstract)) {
  35883. // abstract components do not keep anything
  35884. // other than props & listeners & slot
  35885. // work around flow
  35886. var slot = data.slot;
  35887. data = {};
  35888. if (slot) {
  35889. data.slot = slot;
  35890. }
  35891. }
  35892. // install component management hooks onto the placeholder node
  35893. installComponentHooks(data);
  35894. // return a placeholder vnode
  35895. var name = Ctor.options.name || tag;
  35896. var vnode = new VNode(
  35897. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35898. data, undefined, undefined, undefined, context,
  35899. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35900. asyncFactory
  35901. );
  35902. return vnode
  35903. }
  35904. function createComponentInstanceForVnode (
  35905. vnode, // we know it's MountedComponentVNode but flow doesn't
  35906. parent // activeInstance in lifecycle state
  35907. ) {
  35908. var options = {
  35909. _isComponent: true,
  35910. _parentVnode: vnode,
  35911. parent: parent
  35912. };
  35913. // check inline-template render functions
  35914. var inlineTemplate = vnode.data.inlineTemplate;
  35915. if (isDef(inlineTemplate)) {
  35916. options.render = inlineTemplate.render;
  35917. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35918. }
  35919. return new vnode.componentOptions.Ctor(options)
  35920. }
  35921. function installComponentHooks (data) {
  35922. var hooks = data.hook || (data.hook = {});
  35923. for (var i = 0; i < hooksToMerge.length; i++) {
  35924. var key = hooksToMerge[i];
  35925. var existing = hooks[key];
  35926. var toMerge = componentVNodeHooks[key];
  35927. if (existing !== toMerge && !(existing && existing._merged)) {
  35928. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35929. }
  35930. }
  35931. }
  35932. function mergeHook$1 (f1, f2) {
  35933. var merged = function (a, b) {
  35934. // flow complains about extra args which is why we use any
  35935. f1(a, b);
  35936. f2(a, b);
  35937. };
  35938. merged._merged = true;
  35939. return merged
  35940. }
  35941. // transform component v-model info (value and callback) into
  35942. // prop and event handler respectively.
  35943. function transformModel (options, data) {
  35944. var prop = (options.model && options.model.prop) || 'value';
  35945. var event = (options.model && options.model.event) || 'input'
  35946. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35947. var on = data.on || (data.on = {});
  35948. var existing = on[event];
  35949. var callback = data.model.callback;
  35950. if (isDef(existing)) {
  35951. if (
  35952. Array.isArray(existing)
  35953. ? existing.indexOf(callback) === -1
  35954. : existing !== callback
  35955. ) {
  35956. on[event] = [callback].concat(existing);
  35957. }
  35958. } else {
  35959. on[event] = callback;
  35960. }
  35961. }
  35962. /* */
  35963. var SIMPLE_NORMALIZE = 1;
  35964. var ALWAYS_NORMALIZE = 2;
  35965. // wrapper function for providing a more flexible interface
  35966. // without getting yelled at by flow
  35967. function createElement (
  35968. context,
  35969. tag,
  35970. data,
  35971. children,
  35972. normalizationType,
  35973. alwaysNormalize
  35974. ) {
  35975. if (Array.isArray(data) || isPrimitive(data)) {
  35976. normalizationType = children;
  35977. children = data;
  35978. data = undefined;
  35979. }
  35980. if (isTrue(alwaysNormalize)) {
  35981. normalizationType = ALWAYS_NORMALIZE;
  35982. }
  35983. return _createElement(context, tag, data, children, normalizationType)
  35984. }
  35985. function _createElement (
  35986. context,
  35987. tag,
  35988. data,
  35989. children,
  35990. normalizationType
  35991. ) {
  35992. if (isDef(data) && isDef((data).__ob__)) {
  35993. warn(
  35994. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35995. 'Always create fresh vnode data objects in each render!',
  35996. context
  35997. );
  35998. return createEmptyVNode()
  35999. }
  36000. // object syntax in v-bind
  36001. if (isDef(data) && isDef(data.is)) {
  36002. tag = data.is;
  36003. }
  36004. if (!tag) {
  36005. // in case of component :is set to falsy value
  36006. return createEmptyVNode()
  36007. }
  36008. // warn against non-primitive key
  36009. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  36010. ) {
  36011. {
  36012. warn(
  36013. 'Avoid using non-primitive value as key, ' +
  36014. 'use string/number value instead.',
  36015. context
  36016. );
  36017. }
  36018. }
  36019. // support single function children as default scoped slot
  36020. if (Array.isArray(children) &&
  36021. typeof children[0] === 'function'
  36022. ) {
  36023. data = data || {};
  36024. data.scopedSlots = { default: children[0] };
  36025. children.length = 0;
  36026. }
  36027. if (normalizationType === ALWAYS_NORMALIZE) {
  36028. children = normalizeChildren(children);
  36029. } else if (normalizationType === SIMPLE_NORMALIZE) {
  36030. children = simpleNormalizeChildren(children);
  36031. }
  36032. var vnode, ns;
  36033. if (typeof tag === 'string') {
  36034. var Ctor;
  36035. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  36036. if (config.isReservedTag(tag)) {
  36037. // platform built-in elements
  36038. if (isDef(data) && isDef(data.nativeOn)) {
  36039. warn(
  36040. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  36041. context
  36042. );
  36043. }
  36044. vnode = new VNode(
  36045. config.parsePlatformTagName(tag), data, children,
  36046. undefined, undefined, context
  36047. );
  36048. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  36049. // component
  36050. vnode = createComponent(Ctor, data, context, children, tag);
  36051. } else {
  36052. // unknown or unlisted namespaced elements
  36053. // check at runtime because it may get assigned a namespace when its
  36054. // parent normalizes children
  36055. vnode = new VNode(
  36056. tag, data, children,
  36057. undefined, undefined, context
  36058. );
  36059. }
  36060. } else {
  36061. // direct component options / constructor
  36062. vnode = createComponent(tag, data, context, children);
  36063. }
  36064. if (Array.isArray(vnode)) {
  36065. return vnode
  36066. } else if (isDef(vnode)) {
  36067. if (isDef(ns)) { applyNS(vnode, ns); }
  36068. if (isDef(data)) { registerDeepBindings(data); }
  36069. return vnode
  36070. } else {
  36071. return createEmptyVNode()
  36072. }
  36073. }
  36074. function applyNS (vnode, ns, force) {
  36075. vnode.ns = ns;
  36076. if (vnode.tag === 'foreignObject') {
  36077. // use default namespace inside foreignObject
  36078. ns = undefined;
  36079. force = true;
  36080. }
  36081. if (isDef(vnode.children)) {
  36082. for (var i = 0, l = vnode.children.length; i < l; i++) {
  36083. var child = vnode.children[i];
  36084. if (isDef(child.tag) && (
  36085. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  36086. applyNS(child, ns, force);
  36087. }
  36088. }
  36089. }
  36090. }
  36091. // ref #5318
  36092. // necessary to ensure parent re-render when deep bindings like :style and
  36093. // :class are used on slot nodes
  36094. function registerDeepBindings (data) {
  36095. if (isObject(data.style)) {
  36096. traverse(data.style);
  36097. }
  36098. if (isObject(data.class)) {
  36099. traverse(data.class);
  36100. }
  36101. }
  36102. /* */
  36103. function initRender (vm) {
  36104. vm._vnode = null; // the root of the child tree
  36105. vm._staticTrees = null; // v-once cached trees
  36106. var options = vm.$options;
  36107. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  36108. var renderContext = parentVnode && parentVnode.context;
  36109. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  36110. vm.$scopedSlots = emptyObject;
  36111. // bind the createElement fn to this instance
  36112. // so that we get proper render context inside it.
  36113. // args order: tag, data, children, normalizationType, alwaysNormalize
  36114. // internal version is used by render functions compiled from templates
  36115. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  36116. // normalization is always applied for the public version, used in
  36117. // user-written render functions.
  36118. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  36119. // $attrs & $listeners are exposed for easier HOC creation.
  36120. // they need to be reactive so that HOCs using them are always updated
  36121. var parentData = parentVnode && parentVnode.data;
  36122. /* istanbul ignore else */
  36123. {
  36124. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  36125. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  36126. }, true);
  36127. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  36128. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  36129. }, true);
  36130. }
  36131. }
  36132. var currentRenderingInstance = null;
  36133. function renderMixin (Vue) {
  36134. // install runtime convenience helpers
  36135. installRenderHelpers(Vue.prototype);
  36136. Vue.prototype.$nextTick = function (fn) {
  36137. return nextTick(fn, this)
  36138. };
  36139. Vue.prototype._render = function () {
  36140. var vm = this;
  36141. var ref = vm.$options;
  36142. var render = ref.render;
  36143. var _parentVnode = ref._parentVnode;
  36144. if (_parentVnode) {
  36145. vm.$scopedSlots = normalizeScopedSlots(
  36146. _parentVnode.data.scopedSlots,
  36147. vm.$slots,
  36148. vm.$scopedSlots
  36149. );
  36150. }
  36151. // set parent vnode. this allows render functions to have access
  36152. // to the data on the placeholder node.
  36153. vm.$vnode = _parentVnode;
  36154. // render self
  36155. var vnode;
  36156. try {
  36157. // There's no need to maintain a stack because all render fns are called
  36158. // separately from one another. Nested component's render fns are called
  36159. // when parent component is patched.
  36160. currentRenderingInstance = vm;
  36161. vnode = render.call(vm._renderProxy, vm.$createElement);
  36162. } catch (e) {
  36163. handleError(e, vm, "render");
  36164. // return error render result,
  36165. // or previous vnode to prevent render error causing blank component
  36166. /* istanbul ignore else */
  36167. if (vm.$options.renderError) {
  36168. try {
  36169. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  36170. } catch (e) {
  36171. handleError(e, vm, "renderError");
  36172. vnode = vm._vnode;
  36173. }
  36174. } else {
  36175. vnode = vm._vnode;
  36176. }
  36177. } finally {
  36178. currentRenderingInstance = null;
  36179. }
  36180. // if the returned array contains only a single node, allow it
  36181. if (Array.isArray(vnode) && vnode.length === 1) {
  36182. vnode = vnode[0];
  36183. }
  36184. // return empty vnode in case the render function errored out
  36185. if (!(vnode instanceof VNode)) {
  36186. if (Array.isArray(vnode)) {
  36187. warn(
  36188. 'Multiple root nodes returned from render function. Render function ' +
  36189. 'should return a single root node.',
  36190. vm
  36191. );
  36192. }
  36193. vnode = createEmptyVNode();
  36194. }
  36195. // set parent
  36196. vnode.parent = _parentVnode;
  36197. return vnode
  36198. };
  36199. }
  36200. /* */
  36201. function ensureCtor (comp, base) {
  36202. if (
  36203. comp.__esModule ||
  36204. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  36205. ) {
  36206. comp = comp.default;
  36207. }
  36208. return isObject(comp)
  36209. ? base.extend(comp)
  36210. : comp
  36211. }
  36212. function createAsyncPlaceholder (
  36213. factory,
  36214. data,
  36215. context,
  36216. children,
  36217. tag
  36218. ) {
  36219. var node = createEmptyVNode();
  36220. node.asyncFactory = factory;
  36221. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  36222. return node
  36223. }
  36224. function resolveAsyncComponent (
  36225. factory,
  36226. baseCtor
  36227. ) {
  36228. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  36229. return factory.errorComp
  36230. }
  36231. if (isDef(factory.resolved)) {
  36232. return factory.resolved
  36233. }
  36234. var owner = currentRenderingInstance;
  36235. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  36236. // already pending
  36237. factory.owners.push(owner);
  36238. }
  36239. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  36240. return factory.loadingComp
  36241. }
  36242. if (owner && !isDef(factory.owners)) {
  36243. var owners = factory.owners = [owner];
  36244. var sync = true;
  36245. var timerLoading = null;
  36246. var timerTimeout = null
  36247. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  36248. var forceRender = function (renderCompleted) {
  36249. for (var i = 0, l = owners.length; i < l; i++) {
  36250. (owners[i]).$forceUpdate();
  36251. }
  36252. if (renderCompleted) {
  36253. owners.length = 0;
  36254. if (timerLoading !== null) {
  36255. clearTimeout(timerLoading);
  36256. timerLoading = null;
  36257. }
  36258. if (timerTimeout !== null) {
  36259. clearTimeout(timerTimeout);
  36260. timerTimeout = null;
  36261. }
  36262. }
  36263. };
  36264. var resolve = once(function (res) {
  36265. // cache resolved
  36266. factory.resolved = ensureCtor(res, baseCtor);
  36267. // invoke callbacks only if this is not a synchronous resolve
  36268. // (async resolves are shimmed as synchronous during SSR)
  36269. if (!sync) {
  36270. forceRender(true);
  36271. } else {
  36272. owners.length = 0;
  36273. }
  36274. });
  36275. var reject = once(function (reason) {
  36276. warn(
  36277. "Failed to resolve async component: " + (String(factory)) +
  36278. (reason ? ("\nReason: " + reason) : '')
  36279. );
  36280. if (isDef(factory.errorComp)) {
  36281. factory.error = true;
  36282. forceRender(true);
  36283. }
  36284. });
  36285. var res = factory(resolve, reject);
  36286. if (isObject(res)) {
  36287. if (isPromise(res)) {
  36288. // () => Promise
  36289. if (isUndef(factory.resolved)) {
  36290. res.then(resolve, reject);
  36291. }
  36292. } else if (isPromise(res.component)) {
  36293. res.component.then(resolve, reject);
  36294. if (isDef(res.error)) {
  36295. factory.errorComp = ensureCtor(res.error, baseCtor);
  36296. }
  36297. if (isDef(res.loading)) {
  36298. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  36299. if (res.delay === 0) {
  36300. factory.loading = true;
  36301. } else {
  36302. timerLoading = setTimeout(function () {
  36303. timerLoading = null;
  36304. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  36305. factory.loading = true;
  36306. forceRender(false);
  36307. }
  36308. }, res.delay || 200);
  36309. }
  36310. }
  36311. if (isDef(res.timeout)) {
  36312. timerTimeout = setTimeout(function () {
  36313. timerTimeout = null;
  36314. if (isUndef(factory.resolved)) {
  36315. reject(
  36316. "timeout (" + (res.timeout) + "ms)"
  36317. );
  36318. }
  36319. }, res.timeout);
  36320. }
  36321. }
  36322. }
  36323. sync = false;
  36324. // return in case resolved synchronously
  36325. return factory.loading
  36326. ? factory.loadingComp
  36327. : factory.resolved
  36328. }
  36329. }
  36330. /* */
  36331. function isAsyncPlaceholder (node) {
  36332. return node.isComment && node.asyncFactory
  36333. }
  36334. /* */
  36335. function getFirstComponentChild (children) {
  36336. if (Array.isArray(children)) {
  36337. for (var i = 0; i < children.length; i++) {
  36338. var c = children[i];
  36339. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  36340. return c
  36341. }
  36342. }
  36343. }
  36344. }
  36345. /* */
  36346. /* */
  36347. function initEvents (vm) {
  36348. vm._events = Object.create(null);
  36349. vm._hasHookEvent = false;
  36350. // init parent attached events
  36351. var listeners = vm.$options._parentListeners;
  36352. if (listeners) {
  36353. updateComponentListeners(vm, listeners);
  36354. }
  36355. }
  36356. var target;
  36357. function add (event, fn) {
  36358. target.$on(event, fn);
  36359. }
  36360. function remove$1 (event, fn) {
  36361. target.$off(event, fn);
  36362. }
  36363. function createOnceHandler (event, fn) {
  36364. var _target = target;
  36365. return function onceHandler () {
  36366. var res = fn.apply(null, arguments);
  36367. if (res !== null) {
  36368. _target.$off(event, onceHandler);
  36369. }
  36370. }
  36371. }
  36372. function updateComponentListeners (
  36373. vm,
  36374. listeners,
  36375. oldListeners
  36376. ) {
  36377. target = vm;
  36378. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  36379. target = undefined;
  36380. }
  36381. function eventsMixin (Vue) {
  36382. var hookRE = /^hook:/;
  36383. Vue.prototype.$on = function (event, fn) {
  36384. var vm = this;
  36385. if (Array.isArray(event)) {
  36386. for (var i = 0, l = event.length; i < l; i++) {
  36387. vm.$on(event[i], fn);
  36388. }
  36389. } else {
  36390. (vm._events[event] || (vm._events[event] = [])).push(fn);
  36391. // optimize hook:event cost by using a boolean flag marked at registration
  36392. // instead of a hash lookup
  36393. if (hookRE.test(event)) {
  36394. vm._hasHookEvent = true;
  36395. }
  36396. }
  36397. return vm
  36398. };
  36399. Vue.prototype.$once = function (event, fn) {
  36400. var vm = this;
  36401. function on () {
  36402. vm.$off(event, on);
  36403. fn.apply(vm, arguments);
  36404. }
  36405. on.fn = fn;
  36406. vm.$on(event, on);
  36407. return vm
  36408. };
  36409. Vue.prototype.$off = function (event, fn) {
  36410. var vm = this;
  36411. // all
  36412. if (!arguments.length) {
  36413. vm._events = Object.create(null);
  36414. return vm
  36415. }
  36416. // array of events
  36417. if (Array.isArray(event)) {
  36418. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  36419. vm.$off(event[i$1], fn);
  36420. }
  36421. return vm
  36422. }
  36423. // specific event
  36424. var cbs = vm._events[event];
  36425. if (!cbs) {
  36426. return vm
  36427. }
  36428. if (!fn) {
  36429. vm._events[event] = null;
  36430. return vm
  36431. }
  36432. // specific handler
  36433. var cb;
  36434. var i = cbs.length;
  36435. while (i--) {
  36436. cb = cbs[i];
  36437. if (cb === fn || cb.fn === fn) {
  36438. cbs.splice(i, 1);
  36439. break
  36440. }
  36441. }
  36442. return vm
  36443. };
  36444. Vue.prototype.$emit = function (event) {
  36445. var vm = this;
  36446. {
  36447. var lowerCaseEvent = event.toLowerCase();
  36448. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  36449. tip(
  36450. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  36451. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  36452. "Note that HTML attributes are case-insensitive and you cannot use " +
  36453. "v-on to listen to camelCase events when using in-DOM templates. " +
  36454. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  36455. );
  36456. }
  36457. }
  36458. var cbs = vm._events[event];
  36459. if (cbs) {
  36460. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  36461. var args = toArray(arguments, 1);
  36462. var info = "event handler for \"" + event + "\"";
  36463. for (var i = 0, l = cbs.length; i < l; i++) {
  36464. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  36465. }
  36466. }
  36467. return vm
  36468. };
  36469. }
  36470. /* */
  36471. var activeInstance = null;
  36472. var isUpdatingChildComponent = false;
  36473. function setActiveInstance(vm) {
  36474. var prevActiveInstance = activeInstance;
  36475. activeInstance = vm;
  36476. return function () {
  36477. activeInstance = prevActiveInstance;
  36478. }
  36479. }
  36480. function initLifecycle (vm) {
  36481. var options = vm.$options;
  36482. // locate first non-abstract parent
  36483. var parent = options.parent;
  36484. if (parent && !options.abstract) {
  36485. while (parent.$options.abstract && parent.$parent) {
  36486. parent = parent.$parent;
  36487. }
  36488. parent.$children.push(vm);
  36489. }
  36490. vm.$parent = parent;
  36491. vm.$root = parent ? parent.$root : vm;
  36492. vm.$children = [];
  36493. vm.$refs = {};
  36494. vm._watcher = null;
  36495. vm._inactive = null;
  36496. vm._directInactive = false;
  36497. vm._isMounted = false;
  36498. vm._isDestroyed = false;
  36499. vm._isBeingDestroyed = false;
  36500. }
  36501. function lifecycleMixin (Vue) {
  36502. Vue.prototype._update = function (vnode, hydrating) {
  36503. var vm = this;
  36504. var prevEl = vm.$el;
  36505. var prevVnode = vm._vnode;
  36506. var restoreActiveInstance = setActiveInstance(vm);
  36507. vm._vnode = vnode;
  36508. // Vue.prototype.__patch__ is injected in entry points
  36509. // based on the rendering backend used.
  36510. if (!prevVnode) {
  36511. // initial render
  36512. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  36513. } else {
  36514. // updates
  36515. vm.$el = vm.__patch__(prevVnode, vnode);
  36516. }
  36517. restoreActiveInstance();
  36518. // update __vue__ reference
  36519. if (prevEl) {
  36520. prevEl.__vue__ = null;
  36521. }
  36522. if (vm.$el) {
  36523. vm.$el.__vue__ = vm;
  36524. }
  36525. // if parent is an HOC, update its $el as well
  36526. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  36527. vm.$parent.$el = vm.$el;
  36528. }
  36529. // updated hook is called by the scheduler to ensure that children are
  36530. // updated in a parent's updated hook.
  36531. };
  36532. Vue.prototype.$forceUpdate = function () {
  36533. var vm = this;
  36534. if (vm._watcher) {
  36535. vm._watcher.update();
  36536. }
  36537. };
  36538. Vue.prototype.$destroy = function () {
  36539. var vm = this;
  36540. if (vm._isBeingDestroyed) {
  36541. return
  36542. }
  36543. callHook(vm, 'beforeDestroy');
  36544. vm._isBeingDestroyed = true;
  36545. // remove self from parent
  36546. var parent = vm.$parent;
  36547. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  36548. remove(parent.$children, vm);
  36549. }
  36550. // teardown watchers
  36551. if (vm._watcher) {
  36552. vm._watcher.teardown();
  36553. }
  36554. var i = vm._watchers.length;
  36555. while (i--) {
  36556. vm._watchers[i].teardown();
  36557. }
  36558. // remove reference from data ob
  36559. // frozen object may not have observer.
  36560. if (vm._data.__ob__) {
  36561. vm._data.__ob__.vmCount--;
  36562. }
  36563. // call the last hook...
  36564. vm._isDestroyed = true;
  36565. // invoke destroy hooks on current rendered tree
  36566. vm.__patch__(vm._vnode, null);
  36567. // fire destroyed hook
  36568. callHook(vm, 'destroyed');
  36569. // turn off all instance listeners.
  36570. vm.$off();
  36571. // remove __vue__ reference
  36572. if (vm.$el) {
  36573. vm.$el.__vue__ = null;
  36574. }
  36575. // release circular reference (#6759)
  36576. if (vm.$vnode) {
  36577. vm.$vnode.parent = null;
  36578. }
  36579. };
  36580. }
  36581. function mountComponent (
  36582. vm,
  36583. el,
  36584. hydrating
  36585. ) {
  36586. vm.$el = el;
  36587. if (!vm.$options.render) {
  36588. vm.$options.render = createEmptyVNode;
  36589. {
  36590. /* istanbul ignore if */
  36591. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  36592. vm.$options.el || el) {
  36593. warn(
  36594. 'You are using the runtime-only build of Vue where the template ' +
  36595. 'compiler is not available. Either pre-compile the templates into ' +
  36596. 'render functions, or use the compiler-included build.',
  36597. vm
  36598. );
  36599. } else {
  36600. warn(
  36601. 'Failed to mount component: template or render function not defined.',
  36602. vm
  36603. );
  36604. }
  36605. }
  36606. }
  36607. callHook(vm, 'beforeMount');
  36608. var updateComponent;
  36609. /* istanbul ignore if */
  36610. if (config.performance && mark) {
  36611. updateComponent = function () {
  36612. var name = vm._name;
  36613. var id = vm._uid;
  36614. var startTag = "vue-perf-start:" + id;
  36615. var endTag = "vue-perf-end:" + id;
  36616. mark(startTag);
  36617. var vnode = vm._render();
  36618. mark(endTag);
  36619. measure(("vue " + name + " render"), startTag, endTag);
  36620. mark(startTag);
  36621. vm._update(vnode, hydrating);
  36622. mark(endTag);
  36623. measure(("vue " + name + " patch"), startTag, endTag);
  36624. };
  36625. } else {
  36626. updateComponent = function () {
  36627. vm._update(vm._render(), hydrating);
  36628. };
  36629. }
  36630. // we set this to vm._watcher inside the watcher's constructor
  36631. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  36632. // component's mounted hook), which relies on vm._watcher being already defined
  36633. new Watcher(vm, updateComponent, noop, {
  36634. before: function before () {
  36635. if (vm._isMounted && !vm._isDestroyed) {
  36636. callHook(vm, 'beforeUpdate');
  36637. }
  36638. }
  36639. }, true /* isRenderWatcher */);
  36640. hydrating = false;
  36641. // manually mounted instance, call mounted on self
  36642. // mounted is called for render-created child components in its inserted hook
  36643. if (vm.$vnode == null) {
  36644. vm._isMounted = true;
  36645. callHook(vm, 'mounted');
  36646. }
  36647. return vm
  36648. }
  36649. function updateChildComponent (
  36650. vm,
  36651. propsData,
  36652. listeners,
  36653. parentVnode,
  36654. renderChildren
  36655. ) {
  36656. {
  36657. isUpdatingChildComponent = true;
  36658. }
  36659. // determine whether component has slot children
  36660. // we need to do this before overwriting $options._renderChildren.
  36661. // check if there are dynamic scopedSlots (hand-written or compiled but with
  36662. // dynamic slot names). Static scoped slots compiled from template has the
  36663. // "$stable" marker.
  36664. var newScopedSlots = parentVnode.data.scopedSlots;
  36665. var oldScopedSlots = vm.$scopedSlots;
  36666. var hasDynamicScopedSlot = !!(
  36667. (newScopedSlots && !newScopedSlots.$stable) ||
  36668. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  36669. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  36670. );
  36671. // Any static slot children from the parent may have changed during parent's
  36672. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  36673. // update is necessary to ensure correctness.
  36674. var needsForceUpdate = !!(
  36675. renderChildren || // has new static slots
  36676. vm.$options._renderChildren || // has old static slots
  36677. hasDynamicScopedSlot
  36678. );
  36679. vm.$options._parentVnode = parentVnode;
  36680. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  36681. if (vm._vnode) { // update child tree's parent
  36682. vm._vnode.parent = parentVnode;
  36683. }
  36684. vm.$options._renderChildren = renderChildren;
  36685. // update $attrs and $listeners hash
  36686. // these are also reactive so they may trigger child update if the child
  36687. // used them during render
  36688. vm.$attrs = parentVnode.data.attrs || emptyObject;
  36689. vm.$listeners = listeners || emptyObject;
  36690. // update props
  36691. if (propsData && vm.$options.props) {
  36692. toggleObserving(false);
  36693. var props = vm._props;
  36694. var propKeys = vm.$options._propKeys || [];
  36695. for (var i = 0; i < propKeys.length; i++) {
  36696. var key = propKeys[i];
  36697. var propOptions = vm.$options.props; // wtf flow?
  36698. props[key] = validateProp(key, propOptions, propsData, vm);
  36699. }
  36700. toggleObserving(true);
  36701. // keep a copy of raw propsData
  36702. vm.$options.propsData = propsData;
  36703. }
  36704. // update listeners
  36705. listeners = listeners || emptyObject;
  36706. var oldListeners = vm.$options._parentListeners;
  36707. vm.$options._parentListeners = listeners;
  36708. updateComponentListeners(vm, listeners, oldListeners);
  36709. // resolve slots + force update if has children
  36710. if (needsForceUpdate) {
  36711. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  36712. vm.$forceUpdate();
  36713. }
  36714. {
  36715. isUpdatingChildComponent = false;
  36716. }
  36717. }
  36718. function isInInactiveTree (vm) {
  36719. while (vm && (vm = vm.$parent)) {
  36720. if (vm._inactive) { return true }
  36721. }
  36722. return false
  36723. }
  36724. function activateChildComponent (vm, direct) {
  36725. if (direct) {
  36726. vm._directInactive = false;
  36727. if (isInInactiveTree(vm)) {
  36728. return
  36729. }
  36730. } else if (vm._directInactive) {
  36731. return
  36732. }
  36733. if (vm._inactive || vm._inactive === null) {
  36734. vm._inactive = false;
  36735. for (var i = 0; i < vm.$children.length; i++) {
  36736. activateChildComponent(vm.$children[i]);
  36737. }
  36738. callHook(vm, 'activated');
  36739. }
  36740. }
  36741. function deactivateChildComponent (vm, direct) {
  36742. if (direct) {
  36743. vm._directInactive = true;
  36744. if (isInInactiveTree(vm)) {
  36745. return
  36746. }
  36747. }
  36748. if (!vm._inactive) {
  36749. vm._inactive = true;
  36750. for (var i = 0; i < vm.$children.length; i++) {
  36751. deactivateChildComponent(vm.$children[i]);
  36752. }
  36753. callHook(vm, 'deactivated');
  36754. }
  36755. }
  36756. function callHook (vm, hook) {
  36757. // #7573 disable dep collection when invoking lifecycle hooks
  36758. pushTarget();
  36759. var handlers = vm.$options[hook];
  36760. var info = hook + " hook";
  36761. if (handlers) {
  36762. for (var i = 0, j = handlers.length; i < j; i++) {
  36763. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36764. }
  36765. }
  36766. if (vm._hasHookEvent) {
  36767. vm.$emit('hook:' + hook);
  36768. }
  36769. popTarget();
  36770. }
  36771. /* */
  36772. var MAX_UPDATE_COUNT = 100;
  36773. var queue = [];
  36774. var activatedChildren = [];
  36775. var has = {};
  36776. var circular = {};
  36777. var waiting = false;
  36778. var flushing = false;
  36779. var index = 0;
  36780. /**
  36781. * Reset the scheduler's state.
  36782. */
  36783. function resetSchedulerState () {
  36784. index = queue.length = activatedChildren.length = 0;
  36785. has = {};
  36786. {
  36787. circular = {};
  36788. }
  36789. waiting = flushing = false;
  36790. }
  36791. // Async edge case #6566 requires saving the timestamp when event listeners are
  36792. // attached. However, calling performance.now() has a perf overhead especially
  36793. // if the page has thousands of event listeners. Instead, we take a timestamp
  36794. // every time the scheduler flushes and use that for all event listeners
  36795. // attached during that flush.
  36796. var currentFlushTimestamp = 0;
  36797. // Async edge case fix requires storing an event listener's attach timestamp.
  36798. var getNow = Date.now;
  36799. // Determine what event timestamp the browser is using. Annoyingly, the
  36800. // timestamp can either be hi-res (relative to page load) or low-res
  36801. // (relative to UNIX epoch), so in order to compare time we have to use the
  36802. // same timestamp type when saving the flush timestamp.
  36803. // All IE versions use low-res event timestamps, and have problematic clock
  36804. // implementations (#9632)
  36805. if (inBrowser && !isIE) {
  36806. var performance = window.performance;
  36807. if (
  36808. performance &&
  36809. typeof performance.now === 'function' &&
  36810. getNow() > document.createEvent('Event').timeStamp
  36811. ) {
  36812. // if the event timestamp, although evaluated AFTER the Date.now(), is
  36813. // smaller than it, it means the event is using a hi-res timestamp,
  36814. // and we need to use the hi-res version for event listener timestamps as
  36815. // well.
  36816. getNow = function () { return performance.now(); };
  36817. }
  36818. }
  36819. /**
  36820. * Flush both queues and run the watchers.
  36821. */
  36822. function flushSchedulerQueue () {
  36823. currentFlushTimestamp = getNow();
  36824. flushing = true;
  36825. var watcher, id;
  36826. // Sort queue before flush.
  36827. // This ensures that:
  36828. // 1. Components are updated from parent to child. (because parent is always
  36829. // created before the child)
  36830. // 2. A component's user watchers are run before its render watcher (because
  36831. // user watchers are created before the render watcher)
  36832. // 3. If a component is destroyed during a parent component's watcher run,
  36833. // its watchers can be skipped.
  36834. queue.sort(function (a, b) { return a.id - b.id; });
  36835. // do not cache length because more watchers might be pushed
  36836. // as we run existing watchers
  36837. for (index = 0; index < queue.length; index++) {
  36838. watcher = queue[index];
  36839. if (watcher.before) {
  36840. watcher.before();
  36841. }
  36842. id = watcher.id;
  36843. has[id] = null;
  36844. watcher.run();
  36845. // in dev build, check and stop circular updates.
  36846. if (has[id] != null) {
  36847. circular[id] = (circular[id] || 0) + 1;
  36848. if (circular[id] > MAX_UPDATE_COUNT) {
  36849. warn(
  36850. 'You may have an infinite update loop ' + (
  36851. watcher.user
  36852. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36853. : "in a component render function."
  36854. ),
  36855. watcher.vm
  36856. );
  36857. break
  36858. }
  36859. }
  36860. }
  36861. // keep copies of post queues before resetting state
  36862. var activatedQueue = activatedChildren.slice();
  36863. var updatedQueue = queue.slice();
  36864. resetSchedulerState();
  36865. // call component updated and activated hooks
  36866. callActivatedHooks(activatedQueue);
  36867. callUpdatedHooks(updatedQueue);
  36868. // devtool hook
  36869. /* istanbul ignore if */
  36870. if (devtools && config.devtools) {
  36871. devtools.emit('flush');
  36872. }
  36873. }
  36874. function callUpdatedHooks (queue) {
  36875. var i = queue.length;
  36876. while (i--) {
  36877. var watcher = queue[i];
  36878. var vm = watcher.vm;
  36879. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36880. callHook(vm, 'updated');
  36881. }
  36882. }
  36883. }
  36884. /**
  36885. * Queue a kept-alive component that was activated during patch.
  36886. * The queue will be processed after the entire tree has been patched.
  36887. */
  36888. function queueActivatedComponent (vm) {
  36889. // setting _inactive to false here so that a render function can
  36890. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36891. vm._inactive = false;
  36892. activatedChildren.push(vm);
  36893. }
  36894. function callActivatedHooks (queue) {
  36895. for (var i = 0; i < queue.length; i++) {
  36896. queue[i]._inactive = true;
  36897. activateChildComponent(queue[i], true /* true */);
  36898. }
  36899. }
  36900. /**
  36901. * Push a watcher into the watcher queue.
  36902. * Jobs with duplicate IDs will be skipped unless it's
  36903. * pushed when the queue is being flushed.
  36904. */
  36905. function queueWatcher (watcher) {
  36906. var id = watcher.id;
  36907. if (has[id] == null) {
  36908. has[id] = true;
  36909. if (!flushing) {
  36910. queue.push(watcher);
  36911. } else {
  36912. // if already flushing, splice the watcher based on its id
  36913. // if already past its id, it will be run next immediately.
  36914. var i = queue.length - 1;
  36915. while (i > index && queue[i].id > watcher.id) {
  36916. i--;
  36917. }
  36918. queue.splice(i + 1, 0, watcher);
  36919. }
  36920. // queue the flush
  36921. if (!waiting) {
  36922. waiting = true;
  36923. if (!config.async) {
  36924. flushSchedulerQueue();
  36925. return
  36926. }
  36927. nextTick(flushSchedulerQueue);
  36928. }
  36929. }
  36930. }
  36931. /* */
  36932. var uid$2 = 0;
  36933. /**
  36934. * A watcher parses an expression, collects dependencies,
  36935. * and fires callback when the expression value changes.
  36936. * This is used for both the $watch() api and directives.
  36937. */
  36938. var Watcher = function Watcher (
  36939. vm,
  36940. expOrFn,
  36941. cb,
  36942. options,
  36943. isRenderWatcher
  36944. ) {
  36945. this.vm = vm;
  36946. if (isRenderWatcher) {
  36947. vm._watcher = this;
  36948. }
  36949. vm._watchers.push(this);
  36950. // options
  36951. if (options) {
  36952. this.deep = !!options.deep;
  36953. this.user = !!options.user;
  36954. this.lazy = !!options.lazy;
  36955. this.sync = !!options.sync;
  36956. this.before = options.before;
  36957. } else {
  36958. this.deep = this.user = this.lazy = this.sync = false;
  36959. }
  36960. this.cb = cb;
  36961. this.id = ++uid$2; // uid for batching
  36962. this.active = true;
  36963. this.dirty = this.lazy; // for lazy watchers
  36964. this.deps = [];
  36965. this.newDeps = [];
  36966. this.depIds = new _Set();
  36967. this.newDepIds = new _Set();
  36968. this.expression = expOrFn.toString();
  36969. // parse expression for getter
  36970. if (typeof expOrFn === 'function') {
  36971. this.getter = expOrFn;
  36972. } else {
  36973. this.getter = parsePath(expOrFn);
  36974. if (!this.getter) {
  36975. this.getter = noop;
  36976. warn(
  36977. "Failed watching path: \"" + expOrFn + "\" " +
  36978. 'Watcher only accepts simple dot-delimited paths. ' +
  36979. 'For full control, use a function instead.',
  36980. vm
  36981. );
  36982. }
  36983. }
  36984. this.value = this.lazy
  36985. ? undefined
  36986. : this.get();
  36987. };
  36988. /**
  36989. * Evaluate the getter, and re-collect dependencies.
  36990. */
  36991. Watcher.prototype.get = function get () {
  36992. pushTarget(this);
  36993. var value;
  36994. var vm = this.vm;
  36995. try {
  36996. value = this.getter.call(vm, vm);
  36997. } catch (e) {
  36998. if (this.user) {
  36999. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  37000. } else {
  37001. throw e
  37002. }
  37003. } finally {
  37004. // "touch" every property so they are all tracked as
  37005. // dependencies for deep watching
  37006. if (this.deep) {
  37007. traverse(value);
  37008. }
  37009. popTarget();
  37010. this.cleanupDeps();
  37011. }
  37012. return value
  37013. };
  37014. /**
  37015. * Add a dependency to this directive.
  37016. */
  37017. Watcher.prototype.addDep = function addDep (dep) {
  37018. var id = dep.id;
  37019. if (!this.newDepIds.has(id)) {
  37020. this.newDepIds.add(id);
  37021. this.newDeps.push(dep);
  37022. if (!this.depIds.has(id)) {
  37023. dep.addSub(this);
  37024. }
  37025. }
  37026. };
  37027. /**
  37028. * Clean up for dependency collection.
  37029. */
  37030. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  37031. var i = this.deps.length;
  37032. while (i--) {
  37033. var dep = this.deps[i];
  37034. if (!this.newDepIds.has(dep.id)) {
  37035. dep.removeSub(this);
  37036. }
  37037. }
  37038. var tmp = this.depIds;
  37039. this.depIds = this.newDepIds;
  37040. this.newDepIds = tmp;
  37041. this.newDepIds.clear();
  37042. tmp = this.deps;
  37043. this.deps = this.newDeps;
  37044. this.newDeps = tmp;
  37045. this.newDeps.length = 0;
  37046. };
  37047. /**
  37048. * Subscriber interface.
  37049. * Will be called when a dependency changes.
  37050. */
  37051. Watcher.prototype.update = function update () {
  37052. /* istanbul ignore else */
  37053. if (this.lazy) {
  37054. this.dirty = true;
  37055. } else if (this.sync) {
  37056. this.run();
  37057. } else {
  37058. queueWatcher(this);
  37059. }
  37060. };
  37061. /**
  37062. * Scheduler job interface.
  37063. * Will be called by the scheduler.
  37064. */
  37065. Watcher.prototype.run = function run () {
  37066. if (this.active) {
  37067. var value = this.get();
  37068. if (
  37069. value !== this.value ||
  37070. // Deep watchers and watchers on Object/Arrays should fire even
  37071. // when the value is the same, because the value may
  37072. // have mutated.
  37073. isObject(value) ||
  37074. this.deep
  37075. ) {
  37076. // set new value
  37077. var oldValue = this.value;
  37078. this.value = value;
  37079. if (this.user) {
  37080. try {
  37081. this.cb.call(this.vm, value, oldValue);
  37082. } catch (e) {
  37083. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  37084. }
  37085. } else {
  37086. this.cb.call(this.vm, value, oldValue);
  37087. }
  37088. }
  37089. }
  37090. };
  37091. /**
  37092. * Evaluate the value of the watcher.
  37093. * This only gets called for lazy watchers.
  37094. */
  37095. Watcher.prototype.evaluate = function evaluate () {
  37096. this.value = this.get();
  37097. this.dirty = false;
  37098. };
  37099. /**
  37100. * Depend on all deps collected by this watcher.
  37101. */
  37102. Watcher.prototype.depend = function depend () {
  37103. var i = this.deps.length;
  37104. while (i--) {
  37105. this.deps[i].depend();
  37106. }
  37107. };
  37108. /**
  37109. * Remove self from all dependencies' subscriber list.
  37110. */
  37111. Watcher.prototype.teardown = function teardown () {
  37112. if (this.active) {
  37113. // remove self from vm's watcher list
  37114. // this is a somewhat expensive operation so we skip it
  37115. // if the vm is being destroyed.
  37116. if (!this.vm._isBeingDestroyed) {
  37117. remove(this.vm._watchers, this);
  37118. }
  37119. var i = this.deps.length;
  37120. while (i--) {
  37121. this.deps[i].removeSub(this);
  37122. }
  37123. this.active = false;
  37124. }
  37125. };
  37126. /* */
  37127. var sharedPropertyDefinition = {
  37128. enumerable: true,
  37129. configurable: true,
  37130. get: noop,
  37131. set: noop
  37132. };
  37133. function proxy (target, sourceKey, key) {
  37134. sharedPropertyDefinition.get = function proxyGetter () {
  37135. return this[sourceKey][key]
  37136. };
  37137. sharedPropertyDefinition.set = function proxySetter (val) {
  37138. this[sourceKey][key] = val;
  37139. };
  37140. Object.defineProperty(target, key, sharedPropertyDefinition);
  37141. }
  37142. function initState (vm) {
  37143. vm._watchers = [];
  37144. var opts = vm.$options;
  37145. if (opts.props) { initProps(vm, opts.props); }
  37146. if (opts.methods) { initMethods(vm, opts.methods); }
  37147. if (opts.data) {
  37148. initData(vm);
  37149. } else {
  37150. observe(vm._data = {}, true /* asRootData */);
  37151. }
  37152. if (opts.computed) { initComputed(vm, opts.computed); }
  37153. if (opts.watch && opts.watch !== nativeWatch) {
  37154. initWatch(vm, opts.watch);
  37155. }
  37156. }
  37157. function initProps (vm, propsOptions) {
  37158. var propsData = vm.$options.propsData || {};
  37159. var props = vm._props = {};
  37160. // cache prop keys so that future props updates can iterate using Array
  37161. // instead of dynamic object key enumeration.
  37162. var keys = vm.$options._propKeys = [];
  37163. var isRoot = !vm.$parent;
  37164. // root instance props should be converted
  37165. if (!isRoot) {
  37166. toggleObserving(false);
  37167. }
  37168. var loop = function ( key ) {
  37169. keys.push(key);
  37170. var value = validateProp(key, propsOptions, propsData, vm);
  37171. /* istanbul ignore else */
  37172. {
  37173. var hyphenatedKey = hyphenate(key);
  37174. if (isReservedAttribute(hyphenatedKey) ||
  37175. config.isReservedAttr(hyphenatedKey)) {
  37176. warn(
  37177. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  37178. vm
  37179. );
  37180. }
  37181. defineReactive$$1(props, key, value, function () {
  37182. if (!isRoot && !isUpdatingChildComponent) {
  37183. warn(
  37184. "Avoid mutating a prop directly since the value will be " +
  37185. "overwritten whenever the parent component re-renders. " +
  37186. "Instead, use a data or computed property based on the prop's " +
  37187. "value. Prop being mutated: \"" + key + "\"",
  37188. vm
  37189. );
  37190. }
  37191. });
  37192. }
  37193. // static props are already proxied on the component's prototype
  37194. // during Vue.extend(). We only need to proxy props defined at
  37195. // instantiation here.
  37196. if (!(key in vm)) {
  37197. proxy(vm, "_props", key);
  37198. }
  37199. };
  37200. for (var key in propsOptions) loop( key );
  37201. toggleObserving(true);
  37202. }
  37203. function initData (vm) {
  37204. var data = vm.$options.data;
  37205. data = vm._data = typeof data === 'function'
  37206. ? getData(data, vm)
  37207. : data || {};
  37208. if (!isPlainObject(data)) {
  37209. data = {};
  37210. warn(
  37211. 'data functions should return an object:\n' +
  37212. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  37213. vm
  37214. );
  37215. }
  37216. // proxy data on instance
  37217. var keys = Object.keys(data);
  37218. var props = vm.$options.props;
  37219. var methods = vm.$options.methods;
  37220. var i = keys.length;
  37221. while (i--) {
  37222. var key = keys[i];
  37223. {
  37224. if (methods && hasOwn(methods, key)) {
  37225. warn(
  37226. ("Method \"" + key + "\" has already been defined as a data property."),
  37227. vm
  37228. );
  37229. }
  37230. }
  37231. if (props && hasOwn(props, key)) {
  37232. warn(
  37233. "The data property \"" + key + "\" is already declared as a prop. " +
  37234. "Use prop default value instead.",
  37235. vm
  37236. );
  37237. } else if (!isReserved(key)) {
  37238. proxy(vm, "_data", key);
  37239. }
  37240. }
  37241. // observe data
  37242. observe(data, true /* asRootData */);
  37243. }
  37244. function getData (data, vm) {
  37245. // #7573 disable dep collection when invoking data getters
  37246. pushTarget();
  37247. try {
  37248. return data.call(vm, vm)
  37249. } catch (e) {
  37250. handleError(e, vm, "data()");
  37251. return {}
  37252. } finally {
  37253. popTarget();
  37254. }
  37255. }
  37256. var computedWatcherOptions = { lazy: true };
  37257. function initComputed (vm, computed) {
  37258. // $flow-disable-line
  37259. var watchers = vm._computedWatchers = Object.create(null);
  37260. // computed properties are just getters during SSR
  37261. var isSSR = isServerRendering();
  37262. for (var key in computed) {
  37263. var userDef = computed[key];
  37264. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  37265. if (getter == null) {
  37266. warn(
  37267. ("Getter is missing for computed property \"" + key + "\"."),
  37268. vm
  37269. );
  37270. }
  37271. if (!isSSR) {
  37272. // create internal watcher for the computed property.
  37273. watchers[key] = new Watcher(
  37274. vm,
  37275. getter || noop,
  37276. noop,
  37277. computedWatcherOptions
  37278. );
  37279. }
  37280. // component-defined computed properties are already defined on the
  37281. // component prototype. We only need to define computed properties defined
  37282. // at instantiation here.
  37283. if (!(key in vm)) {
  37284. defineComputed(vm, key, userDef);
  37285. } else {
  37286. if (key in vm.$data) {
  37287. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  37288. } else if (vm.$options.props && key in vm.$options.props) {
  37289. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  37290. }
  37291. }
  37292. }
  37293. }
  37294. function defineComputed (
  37295. target,
  37296. key,
  37297. userDef
  37298. ) {
  37299. var shouldCache = !isServerRendering();
  37300. if (typeof userDef === 'function') {
  37301. sharedPropertyDefinition.get = shouldCache
  37302. ? createComputedGetter(key)
  37303. : createGetterInvoker(userDef);
  37304. sharedPropertyDefinition.set = noop;
  37305. } else {
  37306. sharedPropertyDefinition.get = userDef.get
  37307. ? shouldCache && userDef.cache !== false
  37308. ? createComputedGetter(key)
  37309. : createGetterInvoker(userDef.get)
  37310. : noop;
  37311. sharedPropertyDefinition.set = userDef.set || noop;
  37312. }
  37313. if (sharedPropertyDefinition.set === noop) {
  37314. sharedPropertyDefinition.set = function () {
  37315. warn(
  37316. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  37317. this
  37318. );
  37319. };
  37320. }
  37321. Object.defineProperty(target, key, sharedPropertyDefinition);
  37322. }
  37323. function createComputedGetter (key) {
  37324. return function computedGetter () {
  37325. var watcher = this._computedWatchers && this._computedWatchers[key];
  37326. if (watcher) {
  37327. if (watcher.dirty) {
  37328. watcher.evaluate();
  37329. }
  37330. if (Dep.target) {
  37331. watcher.depend();
  37332. }
  37333. return watcher.value
  37334. }
  37335. }
  37336. }
  37337. function createGetterInvoker(fn) {
  37338. return function computedGetter () {
  37339. return fn.call(this, this)
  37340. }
  37341. }
  37342. function initMethods (vm, methods) {
  37343. var props = vm.$options.props;
  37344. for (var key in methods) {
  37345. {
  37346. if (typeof methods[key] !== 'function') {
  37347. warn(
  37348. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  37349. "Did you reference the function correctly?",
  37350. vm
  37351. );
  37352. }
  37353. if (props && hasOwn(props, key)) {
  37354. warn(
  37355. ("Method \"" + key + "\" has already been defined as a prop."),
  37356. vm
  37357. );
  37358. }
  37359. if ((key in vm) && isReserved(key)) {
  37360. warn(
  37361. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  37362. "Avoid defining component methods that start with _ or $."
  37363. );
  37364. }
  37365. }
  37366. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  37367. }
  37368. }
  37369. function initWatch (vm, watch) {
  37370. for (var key in watch) {
  37371. var handler = watch[key];
  37372. if (Array.isArray(handler)) {
  37373. for (var i = 0; i < handler.length; i++) {
  37374. createWatcher(vm, key, handler[i]);
  37375. }
  37376. } else {
  37377. createWatcher(vm, key, handler);
  37378. }
  37379. }
  37380. }
  37381. function createWatcher (
  37382. vm,
  37383. expOrFn,
  37384. handler,
  37385. options
  37386. ) {
  37387. if (isPlainObject(handler)) {
  37388. options = handler;
  37389. handler = handler.handler;
  37390. }
  37391. if (typeof handler === 'string') {
  37392. handler = vm[handler];
  37393. }
  37394. return vm.$watch(expOrFn, handler, options)
  37395. }
  37396. function stateMixin (Vue) {
  37397. // flow somehow has problems with directly declared definition object
  37398. // when using Object.defineProperty, so we have to procedurally build up
  37399. // the object here.
  37400. var dataDef = {};
  37401. dataDef.get = function () { return this._data };
  37402. var propsDef = {};
  37403. propsDef.get = function () { return this._props };
  37404. {
  37405. dataDef.set = function () {
  37406. warn(
  37407. 'Avoid replacing instance root $data. ' +
  37408. 'Use nested data properties instead.',
  37409. this
  37410. );
  37411. };
  37412. propsDef.set = function () {
  37413. warn("$props is readonly.", this);
  37414. };
  37415. }
  37416. Object.defineProperty(Vue.prototype, '$data', dataDef);
  37417. Object.defineProperty(Vue.prototype, '$props', propsDef);
  37418. Vue.prototype.$set = set;
  37419. Vue.prototype.$delete = del;
  37420. Vue.prototype.$watch = function (
  37421. expOrFn,
  37422. cb,
  37423. options
  37424. ) {
  37425. var vm = this;
  37426. if (isPlainObject(cb)) {
  37427. return createWatcher(vm, expOrFn, cb, options)
  37428. }
  37429. options = options || {};
  37430. options.user = true;
  37431. var watcher = new Watcher(vm, expOrFn, cb, options);
  37432. if (options.immediate) {
  37433. try {
  37434. cb.call(vm, watcher.value);
  37435. } catch (error) {
  37436. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  37437. }
  37438. }
  37439. return function unwatchFn () {
  37440. watcher.teardown();
  37441. }
  37442. };
  37443. }
  37444. /* */
  37445. var uid$3 = 0;
  37446. function initMixin (Vue) {
  37447. Vue.prototype._init = function (options) {
  37448. var vm = this;
  37449. // a uid
  37450. vm._uid = uid$3++;
  37451. var startTag, endTag;
  37452. /* istanbul ignore if */
  37453. if (config.performance && mark) {
  37454. startTag = "vue-perf-start:" + (vm._uid);
  37455. endTag = "vue-perf-end:" + (vm._uid);
  37456. mark(startTag);
  37457. }
  37458. // a flag to avoid this being observed
  37459. vm._isVue = true;
  37460. // merge options
  37461. if (options && options._isComponent) {
  37462. // optimize internal component instantiation
  37463. // since dynamic options merging is pretty slow, and none of the
  37464. // internal component options needs special treatment.
  37465. initInternalComponent(vm, options);
  37466. } else {
  37467. vm.$options = mergeOptions(
  37468. resolveConstructorOptions(vm.constructor),
  37469. options || {},
  37470. vm
  37471. );
  37472. }
  37473. /* istanbul ignore else */
  37474. {
  37475. initProxy(vm);
  37476. }
  37477. // expose real self
  37478. vm._self = vm;
  37479. initLifecycle(vm);
  37480. initEvents(vm);
  37481. initRender(vm);
  37482. callHook(vm, 'beforeCreate');
  37483. initInjections(vm); // resolve injections before data/props
  37484. initState(vm);
  37485. initProvide(vm); // resolve provide after data/props
  37486. callHook(vm, 'created');
  37487. /* istanbul ignore if */
  37488. if (config.performance && mark) {
  37489. vm._name = formatComponentName(vm, false);
  37490. mark(endTag);
  37491. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  37492. }
  37493. if (vm.$options.el) {
  37494. vm.$mount(vm.$options.el);
  37495. }
  37496. };
  37497. }
  37498. function initInternalComponent (vm, options) {
  37499. var opts = vm.$options = Object.create(vm.constructor.options);
  37500. // doing this because it's faster than dynamic enumeration.
  37501. var parentVnode = options._parentVnode;
  37502. opts.parent = options.parent;
  37503. opts._parentVnode = parentVnode;
  37504. var vnodeComponentOptions = parentVnode.componentOptions;
  37505. opts.propsData = vnodeComponentOptions.propsData;
  37506. opts._parentListeners = vnodeComponentOptions.listeners;
  37507. opts._renderChildren = vnodeComponentOptions.children;
  37508. opts._componentTag = vnodeComponentOptions.tag;
  37509. if (options.render) {
  37510. opts.render = options.render;
  37511. opts.staticRenderFns = options.staticRenderFns;
  37512. }
  37513. }
  37514. function resolveConstructorOptions (Ctor) {
  37515. var options = Ctor.options;
  37516. if (Ctor.super) {
  37517. var superOptions = resolveConstructorOptions(Ctor.super);
  37518. var cachedSuperOptions = Ctor.superOptions;
  37519. if (superOptions !== cachedSuperOptions) {
  37520. // super option changed,
  37521. // need to resolve new options.
  37522. Ctor.superOptions = superOptions;
  37523. // check if there are any late-modified/attached options (#4976)
  37524. var modifiedOptions = resolveModifiedOptions(Ctor);
  37525. // update base extend options
  37526. if (modifiedOptions) {
  37527. extend(Ctor.extendOptions, modifiedOptions);
  37528. }
  37529. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  37530. if (options.name) {
  37531. options.components[options.name] = Ctor;
  37532. }
  37533. }
  37534. }
  37535. return options
  37536. }
  37537. function resolveModifiedOptions (Ctor) {
  37538. var modified;
  37539. var latest = Ctor.options;
  37540. var sealed = Ctor.sealedOptions;
  37541. for (var key in latest) {
  37542. if (latest[key] !== sealed[key]) {
  37543. if (!modified) { modified = {}; }
  37544. modified[key] = latest[key];
  37545. }
  37546. }
  37547. return modified
  37548. }
  37549. function Vue (options) {
  37550. if (!(this instanceof Vue)
  37551. ) {
  37552. warn('Vue is a constructor and should be called with the `new` keyword');
  37553. }
  37554. this._init(options);
  37555. }
  37556. initMixin(Vue);
  37557. stateMixin(Vue);
  37558. eventsMixin(Vue);
  37559. lifecycleMixin(Vue);
  37560. renderMixin(Vue);
  37561. /* */
  37562. function initUse (Vue) {
  37563. Vue.use = function (plugin) {
  37564. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  37565. if (installedPlugins.indexOf(plugin) > -1) {
  37566. return this
  37567. }
  37568. // additional parameters
  37569. var args = toArray(arguments, 1);
  37570. args.unshift(this);
  37571. if (typeof plugin.install === 'function') {
  37572. plugin.install.apply(plugin, args);
  37573. } else if (typeof plugin === 'function') {
  37574. plugin.apply(null, args);
  37575. }
  37576. installedPlugins.push(plugin);
  37577. return this
  37578. };
  37579. }
  37580. /* */
  37581. function initMixin$1 (Vue) {
  37582. Vue.mixin = function (mixin) {
  37583. this.options = mergeOptions(this.options, mixin);
  37584. return this
  37585. };
  37586. }
  37587. /* */
  37588. function initExtend (Vue) {
  37589. /**
  37590. * Each instance constructor, including Vue, has a unique
  37591. * cid. This enables us to create wrapped "child
  37592. * constructors" for prototypal inheritance and cache them.
  37593. */
  37594. Vue.cid = 0;
  37595. var cid = 1;
  37596. /**
  37597. * Class inheritance
  37598. */
  37599. Vue.extend = function (extendOptions) {
  37600. extendOptions = extendOptions || {};
  37601. var Super = this;
  37602. var SuperId = Super.cid;
  37603. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  37604. if (cachedCtors[SuperId]) {
  37605. return cachedCtors[SuperId]
  37606. }
  37607. var name = extendOptions.name || Super.options.name;
  37608. if (name) {
  37609. validateComponentName(name);
  37610. }
  37611. var Sub = function VueComponent (options) {
  37612. this._init(options);
  37613. };
  37614. Sub.prototype = Object.create(Super.prototype);
  37615. Sub.prototype.constructor = Sub;
  37616. Sub.cid = cid++;
  37617. Sub.options = mergeOptions(
  37618. Super.options,
  37619. extendOptions
  37620. );
  37621. Sub['super'] = Super;
  37622. // For props and computed properties, we define the proxy getters on
  37623. // the Vue instances at extension time, on the extended prototype. This
  37624. // avoids Object.defineProperty calls for each instance created.
  37625. if (Sub.options.props) {
  37626. initProps$1(Sub);
  37627. }
  37628. if (Sub.options.computed) {
  37629. initComputed$1(Sub);
  37630. }
  37631. // allow further extension/mixin/plugin usage
  37632. Sub.extend = Super.extend;
  37633. Sub.mixin = Super.mixin;
  37634. Sub.use = Super.use;
  37635. // create asset registers, so extended classes
  37636. // can have their private assets too.
  37637. ASSET_TYPES.forEach(function (type) {
  37638. Sub[type] = Super[type];
  37639. });
  37640. // enable recursive self-lookup
  37641. if (name) {
  37642. Sub.options.components[name] = Sub;
  37643. }
  37644. // keep a reference to the super options at extension time.
  37645. // later at instantiation we can check if Super's options have
  37646. // been updated.
  37647. Sub.superOptions = Super.options;
  37648. Sub.extendOptions = extendOptions;
  37649. Sub.sealedOptions = extend({}, Sub.options);
  37650. // cache constructor
  37651. cachedCtors[SuperId] = Sub;
  37652. return Sub
  37653. };
  37654. }
  37655. function initProps$1 (Comp) {
  37656. var props = Comp.options.props;
  37657. for (var key in props) {
  37658. proxy(Comp.prototype, "_props", key);
  37659. }
  37660. }
  37661. function initComputed$1 (Comp) {
  37662. var computed = Comp.options.computed;
  37663. for (var key in computed) {
  37664. defineComputed(Comp.prototype, key, computed[key]);
  37665. }
  37666. }
  37667. /* */
  37668. function initAssetRegisters (Vue) {
  37669. /**
  37670. * Create asset registration methods.
  37671. */
  37672. ASSET_TYPES.forEach(function (type) {
  37673. Vue[type] = function (
  37674. id,
  37675. definition
  37676. ) {
  37677. if (!definition) {
  37678. return this.options[type + 's'][id]
  37679. } else {
  37680. /* istanbul ignore if */
  37681. if (type === 'component') {
  37682. validateComponentName(id);
  37683. }
  37684. if (type === 'component' && isPlainObject(definition)) {
  37685. definition.name = definition.name || id;
  37686. definition = this.options._base.extend(definition);
  37687. }
  37688. if (type === 'directive' && typeof definition === 'function') {
  37689. definition = { bind: definition, update: definition };
  37690. }
  37691. this.options[type + 's'][id] = definition;
  37692. return definition
  37693. }
  37694. };
  37695. });
  37696. }
  37697. /* */
  37698. function getComponentName (opts) {
  37699. return opts && (opts.Ctor.options.name || opts.tag)
  37700. }
  37701. function matches (pattern, name) {
  37702. if (Array.isArray(pattern)) {
  37703. return pattern.indexOf(name) > -1
  37704. } else if (typeof pattern === 'string') {
  37705. return pattern.split(',').indexOf(name) > -1
  37706. } else if (isRegExp(pattern)) {
  37707. return pattern.test(name)
  37708. }
  37709. /* istanbul ignore next */
  37710. return false
  37711. }
  37712. function pruneCache (keepAliveInstance, filter) {
  37713. var cache = keepAliveInstance.cache;
  37714. var keys = keepAliveInstance.keys;
  37715. var _vnode = keepAliveInstance._vnode;
  37716. for (var key in cache) {
  37717. var cachedNode = cache[key];
  37718. if (cachedNode) {
  37719. var name = getComponentName(cachedNode.componentOptions);
  37720. if (name && !filter(name)) {
  37721. pruneCacheEntry(cache, key, keys, _vnode);
  37722. }
  37723. }
  37724. }
  37725. }
  37726. function pruneCacheEntry (
  37727. cache,
  37728. key,
  37729. keys,
  37730. current
  37731. ) {
  37732. var cached$$1 = cache[key];
  37733. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37734. cached$$1.componentInstance.$destroy();
  37735. }
  37736. cache[key] = null;
  37737. remove(keys, key);
  37738. }
  37739. var patternTypes = [String, RegExp, Array];
  37740. var KeepAlive = {
  37741. name: 'keep-alive',
  37742. abstract: true,
  37743. props: {
  37744. include: patternTypes,
  37745. exclude: patternTypes,
  37746. max: [String, Number]
  37747. },
  37748. created: function created () {
  37749. this.cache = Object.create(null);
  37750. this.keys = [];
  37751. },
  37752. destroyed: function destroyed () {
  37753. for (var key in this.cache) {
  37754. pruneCacheEntry(this.cache, key, this.keys);
  37755. }
  37756. },
  37757. mounted: function mounted () {
  37758. var this$1 = this;
  37759. this.$watch('include', function (val) {
  37760. pruneCache(this$1, function (name) { return matches(val, name); });
  37761. });
  37762. this.$watch('exclude', function (val) {
  37763. pruneCache(this$1, function (name) { return !matches(val, name); });
  37764. });
  37765. },
  37766. render: function render () {
  37767. var slot = this.$slots.default;
  37768. var vnode = getFirstComponentChild(slot);
  37769. var componentOptions = vnode && vnode.componentOptions;
  37770. if (componentOptions) {
  37771. // check pattern
  37772. var name = getComponentName(componentOptions);
  37773. var ref = this;
  37774. var include = ref.include;
  37775. var exclude = ref.exclude;
  37776. if (
  37777. // not included
  37778. (include && (!name || !matches(include, name))) ||
  37779. // excluded
  37780. (exclude && name && matches(exclude, name))
  37781. ) {
  37782. return vnode
  37783. }
  37784. var ref$1 = this;
  37785. var cache = ref$1.cache;
  37786. var keys = ref$1.keys;
  37787. var key = vnode.key == null
  37788. // same constructor may get registered as different local components
  37789. // so cid alone is not enough (#3269)
  37790. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37791. : vnode.key;
  37792. if (cache[key]) {
  37793. vnode.componentInstance = cache[key].componentInstance;
  37794. // make current key freshest
  37795. remove(keys, key);
  37796. keys.push(key);
  37797. } else {
  37798. cache[key] = vnode;
  37799. keys.push(key);
  37800. // prune oldest entry
  37801. if (this.max && keys.length > parseInt(this.max)) {
  37802. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37803. }
  37804. }
  37805. vnode.data.keepAlive = true;
  37806. }
  37807. return vnode || (slot && slot[0])
  37808. }
  37809. };
  37810. var builtInComponents = {
  37811. KeepAlive: KeepAlive
  37812. };
  37813. /* */
  37814. function initGlobalAPI (Vue) {
  37815. // config
  37816. var configDef = {};
  37817. configDef.get = function () { return config; };
  37818. {
  37819. configDef.set = function () {
  37820. warn(
  37821. 'Do not replace the Vue.config object, set individual fields instead.'
  37822. );
  37823. };
  37824. }
  37825. Object.defineProperty(Vue, 'config', configDef);
  37826. // exposed util methods.
  37827. // NOTE: these are not considered part of the public API - avoid relying on
  37828. // them unless you are aware of the risk.
  37829. Vue.util = {
  37830. warn: warn,
  37831. extend: extend,
  37832. mergeOptions: mergeOptions,
  37833. defineReactive: defineReactive$$1
  37834. };
  37835. Vue.set = set;
  37836. Vue.delete = del;
  37837. Vue.nextTick = nextTick;
  37838. // 2.6 explicit observable API
  37839. Vue.observable = function (obj) {
  37840. observe(obj);
  37841. return obj
  37842. };
  37843. Vue.options = Object.create(null);
  37844. ASSET_TYPES.forEach(function (type) {
  37845. Vue.options[type + 's'] = Object.create(null);
  37846. });
  37847. // this is used to identify the "base" constructor to extend all plain-object
  37848. // components with in Weex's multi-instance scenarios.
  37849. Vue.options._base = Vue;
  37850. extend(Vue.options.components, builtInComponents);
  37851. initUse(Vue);
  37852. initMixin$1(Vue);
  37853. initExtend(Vue);
  37854. initAssetRegisters(Vue);
  37855. }
  37856. initGlobalAPI(Vue);
  37857. Object.defineProperty(Vue.prototype, '$isServer', {
  37858. get: isServerRendering
  37859. });
  37860. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37861. get: function get () {
  37862. /* istanbul ignore next */
  37863. return this.$vnode && this.$vnode.ssrContext
  37864. }
  37865. });
  37866. // expose FunctionalRenderContext for ssr runtime helper installation
  37867. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37868. value: FunctionalRenderContext
  37869. });
  37870. Vue.version = '2.6.12';
  37871. /* */
  37872. // these are reserved for web because they are directly compiled away
  37873. // during template compilation
  37874. var isReservedAttr = makeMap('style,class');
  37875. // attributes that should be using props for binding
  37876. var acceptValue = makeMap('input,textarea,option,select,progress');
  37877. var mustUseProp = function (tag, type, attr) {
  37878. return (
  37879. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37880. (attr === 'selected' && tag === 'option') ||
  37881. (attr === 'checked' && tag === 'input') ||
  37882. (attr === 'muted' && tag === 'video')
  37883. )
  37884. };
  37885. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37886. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37887. var convertEnumeratedValue = function (key, value) {
  37888. return isFalsyAttrValue(value) || value === 'false'
  37889. ? 'false'
  37890. // allow arbitrary string value for contenteditable
  37891. : key === 'contenteditable' && isValidContentEditableValue(value)
  37892. ? value
  37893. : 'true'
  37894. };
  37895. var isBooleanAttr = makeMap(
  37896. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37897. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37898. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37899. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37900. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37901. 'truespeed,typemustmatch,visible'
  37902. );
  37903. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37904. var isXlink = function (name) {
  37905. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37906. };
  37907. var getXlinkProp = function (name) {
  37908. return isXlink(name) ? name.slice(6, name.length) : ''
  37909. };
  37910. var isFalsyAttrValue = function (val) {
  37911. return val == null || val === false
  37912. };
  37913. /* */
  37914. function genClassForVnode (vnode) {
  37915. var data = vnode.data;
  37916. var parentNode = vnode;
  37917. var childNode = vnode;
  37918. while (isDef(childNode.componentInstance)) {
  37919. childNode = childNode.componentInstance._vnode;
  37920. if (childNode && childNode.data) {
  37921. data = mergeClassData(childNode.data, data);
  37922. }
  37923. }
  37924. while (isDef(parentNode = parentNode.parent)) {
  37925. if (parentNode && parentNode.data) {
  37926. data = mergeClassData(data, parentNode.data);
  37927. }
  37928. }
  37929. return renderClass(data.staticClass, data.class)
  37930. }
  37931. function mergeClassData (child, parent) {
  37932. return {
  37933. staticClass: concat(child.staticClass, parent.staticClass),
  37934. class: isDef(child.class)
  37935. ? [child.class, parent.class]
  37936. : parent.class
  37937. }
  37938. }
  37939. function renderClass (
  37940. staticClass,
  37941. dynamicClass
  37942. ) {
  37943. if (isDef(staticClass) || isDef(dynamicClass)) {
  37944. return concat(staticClass, stringifyClass(dynamicClass))
  37945. }
  37946. /* istanbul ignore next */
  37947. return ''
  37948. }
  37949. function concat (a, b) {
  37950. return a ? b ? (a + ' ' + b) : a : (b || '')
  37951. }
  37952. function stringifyClass (value) {
  37953. if (Array.isArray(value)) {
  37954. return stringifyArray(value)
  37955. }
  37956. if (isObject(value)) {
  37957. return stringifyObject(value)
  37958. }
  37959. if (typeof value === 'string') {
  37960. return value
  37961. }
  37962. /* istanbul ignore next */
  37963. return ''
  37964. }
  37965. function stringifyArray (value) {
  37966. var res = '';
  37967. var stringified;
  37968. for (var i = 0, l = value.length; i < l; i++) {
  37969. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37970. if (res) { res += ' '; }
  37971. res += stringified;
  37972. }
  37973. }
  37974. return res
  37975. }
  37976. function stringifyObject (value) {
  37977. var res = '';
  37978. for (var key in value) {
  37979. if (value[key]) {
  37980. if (res) { res += ' '; }
  37981. res += key;
  37982. }
  37983. }
  37984. return res
  37985. }
  37986. /* */
  37987. var namespaceMap = {
  37988. svg: 'http://www.w3.org/2000/svg',
  37989. math: 'http://www.w3.org/1998/Math/MathML'
  37990. };
  37991. var isHTMLTag = makeMap(
  37992. 'html,body,base,head,link,meta,style,title,' +
  37993. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37994. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37995. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37996. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37997. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37998. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37999. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  38000. 'output,progress,select,textarea,' +
  38001. 'details,dialog,menu,menuitem,summary,' +
  38002. 'content,element,shadow,template,blockquote,iframe,tfoot'
  38003. );
  38004. // this map is intentionally selective, only covering SVG elements that may
  38005. // contain child elements.
  38006. var isSVG = makeMap(
  38007. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  38008. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  38009. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  38010. true
  38011. );
  38012. var isPreTag = function (tag) { return tag === 'pre'; };
  38013. var isReservedTag = function (tag) {
  38014. return isHTMLTag(tag) || isSVG(tag)
  38015. };
  38016. function getTagNamespace (tag) {
  38017. if (isSVG(tag)) {
  38018. return 'svg'
  38019. }
  38020. // basic support for MathML
  38021. // note it doesn't support other MathML elements being component roots
  38022. if (tag === 'math') {
  38023. return 'math'
  38024. }
  38025. }
  38026. var unknownElementCache = Object.create(null);
  38027. function isUnknownElement (tag) {
  38028. /* istanbul ignore if */
  38029. if (!inBrowser) {
  38030. return true
  38031. }
  38032. if (isReservedTag(tag)) {
  38033. return false
  38034. }
  38035. tag = tag.toLowerCase();
  38036. /* istanbul ignore if */
  38037. if (unknownElementCache[tag] != null) {
  38038. return unknownElementCache[tag]
  38039. }
  38040. var el = document.createElement(tag);
  38041. if (tag.indexOf('-') > -1) {
  38042. // http://stackoverflow.com/a/28210364/1070244
  38043. return (unknownElementCache[tag] = (
  38044. el.constructor === window.HTMLUnknownElement ||
  38045. el.constructor === window.HTMLElement
  38046. ))
  38047. } else {
  38048. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  38049. }
  38050. }
  38051. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  38052. /* */
  38053. /**
  38054. * Query an element selector if it's not an element already.
  38055. */
  38056. function query (el) {
  38057. if (typeof el === 'string') {
  38058. var selected = document.querySelector(el);
  38059. if (!selected) {
  38060. warn(
  38061. 'Cannot find element: ' + el
  38062. );
  38063. return document.createElement('div')
  38064. }
  38065. return selected
  38066. } else {
  38067. return el
  38068. }
  38069. }
  38070. /* */
  38071. function createElement$1 (tagName, vnode) {
  38072. var elm = document.createElement(tagName);
  38073. if (tagName !== 'select') {
  38074. return elm
  38075. }
  38076. // false or null will remove the attribute but undefined will not
  38077. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  38078. elm.setAttribute('multiple', 'multiple');
  38079. }
  38080. return elm
  38081. }
  38082. function createElementNS (namespace, tagName) {
  38083. return document.createElementNS(namespaceMap[namespace], tagName)
  38084. }
  38085. function createTextNode (text) {
  38086. return document.createTextNode(text)
  38087. }
  38088. function createComment (text) {
  38089. return document.createComment(text)
  38090. }
  38091. function insertBefore (parentNode, newNode, referenceNode) {
  38092. parentNode.insertBefore(newNode, referenceNode);
  38093. }
  38094. function removeChild (node, child) {
  38095. node.removeChild(child);
  38096. }
  38097. function appendChild (node, child) {
  38098. node.appendChild(child);
  38099. }
  38100. function parentNode (node) {
  38101. return node.parentNode
  38102. }
  38103. function nextSibling (node) {
  38104. return node.nextSibling
  38105. }
  38106. function tagName (node) {
  38107. return node.tagName
  38108. }
  38109. function setTextContent (node, text) {
  38110. node.textContent = text;
  38111. }
  38112. function setStyleScope (node, scopeId) {
  38113. node.setAttribute(scopeId, '');
  38114. }
  38115. var nodeOps = /*#__PURE__*/Object.freeze({
  38116. createElement: createElement$1,
  38117. createElementNS: createElementNS,
  38118. createTextNode: createTextNode,
  38119. createComment: createComment,
  38120. insertBefore: insertBefore,
  38121. removeChild: removeChild,
  38122. appendChild: appendChild,
  38123. parentNode: parentNode,
  38124. nextSibling: nextSibling,
  38125. tagName: tagName,
  38126. setTextContent: setTextContent,
  38127. setStyleScope: setStyleScope
  38128. });
  38129. /* */
  38130. var ref = {
  38131. create: function create (_, vnode) {
  38132. registerRef(vnode);
  38133. },
  38134. update: function update (oldVnode, vnode) {
  38135. if (oldVnode.data.ref !== vnode.data.ref) {
  38136. registerRef(oldVnode, true);
  38137. registerRef(vnode);
  38138. }
  38139. },
  38140. destroy: function destroy (vnode) {
  38141. registerRef(vnode, true);
  38142. }
  38143. };
  38144. function registerRef (vnode, isRemoval) {
  38145. var key = vnode.data.ref;
  38146. if (!isDef(key)) { return }
  38147. var vm = vnode.context;
  38148. var ref = vnode.componentInstance || vnode.elm;
  38149. var refs = vm.$refs;
  38150. if (isRemoval) {
  38151. if (Array.isArray(refs[key])) {
  38152. remove(refs[key], ref);
  38153. } else if (refs[key] === ref) {
  38154. refs[key] = undefined;
  38155. }
  38156. } else {
  38157. if (vnode.data.refInFor) {
  38158. if (!Array.isArray(refs[key])) {
  38159. refs[key] = [ref];
  38160. } else if (refs[key].indexOf(ref) < 0) {
  38161. // $flow-disable-line
  38162. refs[key].push(ref);
  38163. }
  38164. } else {
  38165. refs[key] = ref;
  38166. }
  38167. }
  38168. }
  38169. /**
  38170. * Virtual DOM patching algorithm based on Snabbdom by
  38171. * Simon Friis Vindum (@paldepind)
  38172. * Licensed under the MIT License
  38173. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  38174. *
  38175. * modified by Evan You (@yyx990803)
  38176. *
  38177. * Not type-checking this because this file is perf-critical and the cost
  38178. * of making flow understand it is not worth it.
  38179. */
  38180. var emptyNode = new VNode('', {}, []);
  38181. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  38182. function sameVnode (a, b) {
  38183. return (
  38184. a.key === b.key && (
  38185. (
  38186. a.tag === b.tag &&
  38187. a.isComment === b.isComment &&
  38188. isDef(a.data) === isDef(b.data) &&
  38189. sameInputType(a, b)
  38190. ) || (
  38191. isTrue(a.isAsyncPlaceholder) &&
  38192. a.asyncFactory === b.asyncFactory &&
  38193. isUndef(b.asyncFactory.error)
  38194. )
  38195. )
  38196. )
  38197. }
  38198. function sameInputType (a, b) {
  38199. if (a.tag !== 'input') { return true }
  38200. var i;
  38201. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  38202. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  38203. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  38204. }
  38205. function createKeyToOldIdx (children, beginIdx, endIdx) {
  38206. var i, key;
  38207. var map = {};
  38208. for (i = beginIdx; i <= endIdx; ++i) {
  38209. key = children[i].key;
  38210. if (isDef(key)) { map[key] = i; }
  38211. }
  38212. return map
  38213. }
  38214. function createPatchFunction (backend) {
  38215. var i, j;
  38216. var cbs = {};
  38217. var modules = backend.modules;
  38218. var nodeOps = backend.nodeOps;
  38219. for (i = 0; i < hooks.length; ++i) {
  38220. cbs[hooks[i]] = [];
  38221. for (j = 0; j < modules.length; ++j) {
  38222. if (isDef(modules[j][hooks[i]])) {
  38223. cbs[hooks[i]].push(modules[j][hooks[i]]);
  38224. }
  38225. }
  38226. }
  38227. function emptyNodeAt (elm) {
  38228. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  38229. }
  38230. function createRmCb (childElm, listeners) {
  38231. function remove$$1 () {
  38232. if (--remove$$1.listeners === 0) {
  38233. removeNode(childElm);
  38234. }
  38235. }
  38236. remove$$1.listeners = listeners;
  38237. return remove$$1
  38238. }
  38239. function removeNode (el) {
  38240. var parent = nodeOps.parentNode(el);
  38241. // element may have already been removed due to v-html / v-text
  38242. if (isDef(parent)) {
  38243. nodeOps.removeChild(parent, el);
  38244. }
  38245. }
  38246. function isUnknownElement$$1 (vnode, inVPre) {
  38247. return (
  38248. !inVPre &&
  38249. !vnode.ns &&
  38250. !(
  38251. config.ignoredElements.length &&
  38252. config.ignoredElements.some(function (ignore) {
  38253. return isRegExp(ignore)
  38254. ? ignore.test(vnode.tag)
  38255. : ignore === vnode.tag
  38256. })
  38257. ) &&
  38258. config.isUnknownElement(vnode.tag)
  38259. )
  38260. }
  38261. var creatingElmInVPre = 0;
  38262. function createElm (
  38263. vnode,
  38264. insertedVnodeQueue,
  38265. parentElm,
  38266. refElm,
  38267. nested,
  38268. ownerArray,
  38269. index
  38270. ) {
  38271. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38272. // This vnode was used in a previous render!
  38273. // now it's used as a new node, overwriting its elm would cause
  38274. // potential patch errors down the road when it's used as an insertion
  38275. // reference node. Instead, we clone the node on-demand before creating
  38276. // associated DOM element for it.
  38277. vnode = ownerArray[index] = cloneVNode(vnode);
  38278. }
  38279. vnode.isRootInsert = !nested; // for transition enter check
  38280. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  38281. return
  38282. }
  38283. var data = vnode.data;
  38284. var children = vnode.children;
  38285. var tag = vnode.tag;
  38286. if (isDef(tag)) {
  38287. {
  38288. if (data && data.pre) {
  38289. creatingElmInVPre++;
  38290. }
  38291. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  38292. warn(
  38293. 'Unknown custom element: <' + tag + '> - did you ' +
  38294. 'register the component correctly? For recursive components, ' +
  38295. 'make sure to provide the "name" option.',
  38296. vnode.context
  38297. );
  38298. }
  38299. }
  38300. vnode.elm = vnode.ns
  38301. ? nodeOps.createElementNS(vnode.ns, tag)
  38302. : nodeOps.createElement(tag, vnode);
  38303. setScope(vnode);
  38304. /* istanbul ignore if */
  38305. {
  38306. createChildren(vnode, children, insertedVnodeQueue);
  38307. if (isDef(data)) {
  38308. invokeCreateHooks(vnode, insertedVnodeQueue);
  38309. }
  38310. insert(parentElm, vnode.elm, refElm);
  38311. }
  38312. if (data && data.pre) {
  38313. creatingElmInVPre--;
  38314. }
  38315. } else if (isTrue(vnode.isComment)) {
  38316. vnode.elm = nodeOps.createComment(vnode.text);
  38317. insert(parentElm, vnode.elm, refElm);
  38318. } else {
  38319. vnode.elm = nodeOps.createTextNode(vnode.text);
  38320. insert(parentElm, vnode.elm, refElm);
  38321. }
  38322. }
  38323. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38324. var i = vnode.data;
  38325. if (isDef(i)) {
  38326. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  38327. if (isDef(i = i.hook) && isDef(i = i.init)) {
  38328. i(vnode, false /* hydrating */);
  38329. }
  38330. // after calling the init hook, if the vnode is a child component
  38331. // it should've created a child instance and mounted it. the child
  38332. // component also has set the placeholder vnode's elm.
  38333. // in that case we can just return the element and be done.
  38334. if (isDef(vnode.componentInstance)) {
  38335. initComponent(vnode, insertedVnodeQueue);
  38336. insert(parentElm, vnode.elm, refElm);
  38337. if (isTrue(isReactivated)) {
  38338. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  38339. }
  38340. return true
  38341. }
  38342. }
  38343. }
  38344. function initComponent (vnode, insertedVnodeQueue) {
  38345. if (isDef(vnode.data.pendingInsert)) {
  38346. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  38347. vnode.data.pendingInsert = null;
  38348. }
  38349. vnode.elm = vnode.componentInstance.$el;
  38350. if (isPatchable(vnode)) {
  38351. invokeCreateHooks(vnode, insertedVnodeQueue);
  38352. setScope(vnode);
  38353. } else {
  38354. // empty component root.
  38355. // skip all element-related modules except for ref (#3455)
  38356. registerRef(vnode);
  38357. // make sure to invoke the insert hook
  38358. insertedVnodeQueue.push(vnode);
  38359. }
  38360. }
  38361. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38362. var i;
  38363. // hack for #4339: a reactivated component with inner transition
  38364. // does not trigger because the inner node's created hooks are not called
  38365. // again. It's not ideal to involve module-specific logic in here but
  38366. // there doesn't seem to be a better way to do it.
  38367. var innerNode = vnode;
  38368. while (innerNode.componentInstance) {
  38369. innerNode = innerNode.componentInstance._vnode;
  38370. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  38371. for (i = 0; i < cbs.activate.length; ++i) {
  38372. cbs.activate[i](emptyNode, innerNode);
  38373. }
  38374. insertedVnodeQueue.push(innerNode);
  38375. break
  38376. }
  38377. }
  38378. // unlike a newly created component,
  38379. // a reactivated keep-alive component doesn't insert itself
  38380. insert(parentElm, vnode.elm, refElm);
  38381. }
  38382. function insert (parent, elm, ref$$1) {
  38383. if (isDef(parent)) {
  38384. if (isDef(ref$$1)) {
  38385. if (nodeOps.parentNode(ref$$1) === parent) {
  38386. nodeOps.insertBefore(parent, elm, ref$$1);
  38387. }
  38388. } else {
  38389. nodeOps.appendChild(parent, elm);
  38390. }
  38391. }
  38392. }
  38393. function createChildren (vnode, children, insertedVnodeQueue) {
  38394. if (Array.isArray(children)) {
  38395. {
  38396. checkDuplicateKeys(children);
  38397. }
  38398. for (var i = 0; i < children.length; ++i) {
  38399. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  38400. }
  38401. } else if (isPrimitive(vnode.text)) {
  38402. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  38403. }
  38404. }
  38405. function isPatchable (vnode) {
  38406. while (vnode.componentInstance) {
  38407. vnode = vnode.componentInstance._vnode;
  38408. }
  38409. return isDef(vnode.tag)
  38410. }
  38411. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  38412. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38413. cbs.create[i$1](emptyNode, vnode);
  38414. }
  38415. i = vnode.data.hook; // Reuse variable
  38416. if (isDef(i)) {
  38417. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  38418. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  38419. }
  38420. }
  38421. // set scope id attribute for scoped CSS.
  38422. // this is implemented as a special case to avoid the overhead
  38423. // of going through the normal attribute patching process.
  38424. function setScope (vnode) {
  38425. var i;
  38426. if (isDef(i = vnode.fnScopeId)) {
  38427. nodeOps.setStyleScope(vnode.elm, i);
  38428. } else {
  38429. var ancestor = vnode;
  38430. while (ancestor) {
  38431. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  38432. nodeOps.setStyleScope(vnode.elm, i);
  38433. }
  38434. ancestor = ancestor.parent;
  38435. }
  38436. }
  38437. // for slot content they should also get the scopeId from the host instance.
  38438. if (isDef(i = activeInstance) &&
  38439. i !== vnode.context &&
  38440. i !== vnode.fnContext &&
  38441. isDef(i = i.$options._scopeId)
  38442. ) {
  38443. nodeOps.setStyleScope(vnode.elm, i);
  38444. }
  38445. }
  38446. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  38447. for (; startIdx <= endIdx; ++startIdx) {
  38448. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  38449. }
  38450. }
  38451. function invokeDestroyHook (vnode) {
  38452. var i, j;
  38453. var data = vnode.data;
  38454. if (isDef(data)) {
  38455. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  38456. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  38457. }
  38458. if (isDef(i = vnode.children)) {
  38459. for (j = 0; j < vnode.children.length; ++j) {
  38460. invokeDestroyHook(vnode.children[j]);
  38461. }
  38462. }
  38463. }
  38464. function removeVnodes (vnodes, startIdx, endIdx) {
  38465. for (; startIdx <= endIdx; ++startIdx) {
  38466. var ch = vnodes[startIdx];
  38467. if (isDef(ch)) {
  38468. if (isDef(ch.tag)) {
  38469. removeAndInvokeRemoveHook(ch);
  38470. invokeDestroyHook(ch);
  38471. } else { // Text node
  38472. removeNode(ch.elm);
  38473. }
  38474. }
  38475. }
  38476. }
  38477. function removeAndInvokeRemoveHook (vnode, rm) {
  38478. if (isDef(rm) || isDef(vnode.data)) {
  38479. var i;
  38480. var listeners = cbs.remove.length + 1;
  38481. if (isDef(rm)) {
  38482. // we have a recursively passed down rm callback
  38483. // increase the listeners count
  38484. rm.listeners += listeners;
  38485. } else {
  38486. // directly removing
  38487. rm = createRmCb(vnode.elm, listeners);
  38488. }
  38489. // recursively invoke hooks on child component root node
  38490. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  38491. removeAndInvokeRemoveHook(i, rm);
  38492. }
  38493. for (i = 0; i < cbs.remove.length; ++i) {
  38494. cbs.remove[i](vnode, rm);
  38495. }
  38496. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  38497. i(vnode, rm);
  38498. } else {
  38499. rm();
  38500. }
  38501. } else {
  38502. removeNode(vnode.elm);
  38503. }
  38504. }
  38505. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  38506. var oldStartIdx = 0;
  38507. var newStartIdx = 0;
  38508. var oldEndIdx = oldCh.length - 1;
  38509. var oldStartVnode = oldCh[0];
  38510. var oldEndVnode = oldCh[oldEndIdx];
  38511. var newEndIdx = newCh.length - 1;
  38512. var newStartVnode = newCh[0];
  38513. var newEndVnode = newCh[newEndIdx];
  38514. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  38515. // removeOnly is a special flag used only by <transition-group>
  38516. // to ensure removed elements stay in correct relative positions
  38517. // during leaving transitions
  38518. var canMove = !removeOnly;
  38519. {
  38520. checkDuplicateKeys(newCh);
  38521. }
  38522. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  38523. if (isUndef(oldStartVnode)) {
  38524. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  38525. } else if (isUndef(oldEndVnode)) {
  38526. oldEndVnode = oldCh[--oldEndIdx];
  38527. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  38528. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38529. oldStartVnode = oldCh[++oldStartIdx];
  38530. newStartVnode = newCh[++newStartIdx];
  38531. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  38532. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38533. oldEndVnode = oldCh[--oldEndIdx];
  38534. newEndVnode = newCh[--newEndIdx];
  38535. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  38536. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38537. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  38538. oldStartVnode = oldCh[++oldStartIdx];
  38539. newEndVnode = newCh[--newEndIdx];
  38540. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  38541. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38542. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  38543. oldEndVnode = oldCh[--oldEndIdx];
  38544. newStartVnode = newCh[++newStartIdx];
  38545. } else {
  38546. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  38547. idxInOld = isDef(newStartVnode.key)
  38548. ? oldKeyToIdx[newStartVnode.key]
  38549. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  38550. if (isUndef(idxInOld)) { // New element
  38551. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38552. } else {
  38553. vnodeToMove = oldCh[idxInOld];
  38554. if (sameVnode(vnodeToMove, newStartVnode)) {
  38555. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38556. oldCh[idxInOld] = undefined;
  38557. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  38558. } else {
  38559. // same key but different element. treat as new element
  38560. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38561. }
  38562. }
  38563. newStartVnode = newCh[++newStartIdx];
  38564. }
  38565. }
  38566. if (oldStartIdx > oldEndIdx) {
  38567. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  38568. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  38569. } else if (newStartIdx > newEndIdx) {
  38570. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  38571. }
  38572. }
  38573. function checkDuplicateKeys (children) {
  38574. var seenKeys = {};
  38575. for (var i = 0; i < children.length; i++) {
  38576. var vnode = children[i];
  38577. var key = vnode.key;
  38578. if (isDef(key)) {
  38579. if (seenKeys[key]) {
  38580. warn(
  38581. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  38582. vnode.context
  38583. );
  38584. } else {
  38585. seenKeys[key] = true;
  38586. }
  38587. }
  38588. }
  38589. }
  38590. function findIdxInOld (node, oldCh, start, end) {
  38591. for (var i = start; i < end; i++) {
  38592. var c = oldCh[i];
  38593. if (isDef(c) && sameVnode(node, c)) { return i }
  38594. }
  38595. }
  38596. function patchVnode (
  38597. oldVnode,
  38598. vnode,
  38599. insertedVnodeQueue,
  38600. ownerArray,
  38601. index,
  38602. removeOnly
  38603. ) {
  38604. if (oldVnode === vnode) {
  38605. return
  38606. }
  38607. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38608. // clone reused vnode
  38609. vnode = ownerArray[index] = cloneVNode(vnode);
  38610. }
  38611. var elm = vnode.elm = oldVnode.elm;
  38612. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  38613. if (isDef(vnode.asyncFactory.resolved)) {
  38614. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  38615. } else {
  38616. vnode.isAsyncPlaceholder = true;
  38617. }
  38618. return
  38619. }
  38620. // reuse element for static trees.
  38621. // note we only do this if the vnode is cloned -
  38622. // if the new node is not cloned it means the render functions have been
  38623. // reset by the hot-reload-api and we need to do a proper re-render.
  38624. if (isTrue(vnode.isStatic) &&
  38625. isTrue(oldVnode.isStatic) &&
  38626. vnode.key === oldVnode.key &&
  38627. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  38628. ) {
  38629. vnode.componentInstance = oldVnode.componentInstance;
  38630. return
  38631. }
  38632. var i;
  38633. var data = vnode.data;
  38634. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  38635. i(oldVnode, vnode);
  38636. }
  38637. var oldCh = oldVnode.children;
  38638. var ch = vnode.children;
  38639. if (isDef(data) && isPatchable(vnode)) {
  38640. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  38641. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  38642. }
  38643. if (isUndef(vnode.text)) {
  38644. if (isDef(oldCh) && isDef(ch)) {
  38645. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  38646. } else if (isDef(ch)) {
  38647. {
  38648. checkDuplicateKeys(ch);
  38649. }
  38650. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  38651. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  38652. } else if (isDef(oldCh)) {
  38653. removeVnodes(oldCh, 0, oldCh.length - 1);
  38654. } else if (isDef(oldVnode.text)) {
  38655. nodeOps.setTextContent(elm, '');
  38656. }
  38657. } else if (oldVnode.text !== vnode.text) {
  38658. nodeOps.setTextContent(elm, vnode.text);
  38659. }
  38660. if (isDef(data)) {
  38661. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  38662. }
  38663. }
  38664. function invokeInsertHook (vnode, queue, initial) {
  38665. // delay insert hooks for component root nodes, invoke them after the
  38666. // element is really inserted
  38667. if (isTrue(initial) && isDef(vnode.parent)) {
  38668. vnode.parent.data.pendingInsert = queue;
  38669. } else {
  38670. for (var i = 0; i < queue.length; ++i) {
  38671. queue[i].data.hook.insert(queue[i]);
  38672. }
  38673. }
  38674. }
  38675. var hydrationBailed = false;
  38676. // list of modules that can skip create hook during hydration because they
  38677. // are already rendered on the client or has no need for initialization
  38678. // Note: style is excluded because it relies on initial clone for future
  38679. // deep updates (#7063).
  38680. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  38681. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  38682. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  38683. var i;
  38684. var tag = vnode.tag;
  38685. var data = vnode.data;
  38686. var children = vnode.children;
  38687. inVPre = inVPre || (data && data.pre);
  38688. vnode.elm = elm;
  38689. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  38690. vnode.isAsyncPlaceholder = true;
  38691. return true
  38692. }
  38693. // assert node match
  38694. {
  38695. if (!assertNodeMatch(elm, vnode, inVPre)) {
  38696. return false
  38697. }
  38698. }
  38699. if (isDef(data)) {
  38700. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  38701. if (isDef(i = vnode.componentInstance)) {
  38702. // child component. it should have hydrated its own tree.
  38703. initComponent(vnode, insertedVnodeQueue);
  38704. return true
  38705. }
  38706. }
  38707. if (isDef(tag)) {
  38708. if (isDef(children)) {
  38709. // empty element, allow client to pick up and populate children
  38710. if (!elm.hasChildNodes()) {
  38711. createChildren(vnode, children, insertedVnodeQueue);
  38712. } else {
  38713. // v-html and domProps: innerHTML
  38714. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  38715. if (i !== elm.innerHTML) {
  38716. /* istanbul ignore if */
  38717. if (typeof console !== 'undefined' &&
  38718. !hydrationBailed
  38719. ) {
  38720. hydrationBailed = true;
  38721. console.warn('Parent: ', elm);
  38722. console.warn('server innerHTML: ', i);
  38723. console.warn('client innerHTML: ', elm.innerHTML);
  38724. }
  38725. return false
  38726. }
  38727. } else {
  38728. // iterate and compare children lists
  38729. var childrenMatch = true;
  38730. var childNode = elm.firstChild;
  38731. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38732. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38733. childrenMatch = false;
  38734. break
  38735. }
  38736. childNode = childNode.nextSibling;
  38737. }
  38738. // if childNode is not null, it means the actual childNodes list is
  38739. // longer than the virtual children list.
  38740. if (!childrenMatch || childNode) {
  38741. /* istanbul ignore if */
  38742. if (typeof console !== 'undefined' &&
  38743. !hydrationBailed
  38744. ) {
  38745. hydrationBailed = true;
  38746. console.warn('Parent: ', elm);
  38747. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38748. }
  38749. return false
  38750. }
  38751. }
  38752. }
  38753. }
  38754. if (isDef(data)) {
  38755. var fullInvoke = false;
  38756. for (var key in data) {
  38757. if (!isRenderedModule(key)) {
  38758. fullInvoke = true;
  38759. invokeCreateHooks(vnode, insertedVnodeQueue);
  38760. break
  38761. }
  38762. }
  38763. if (!fullInvoke && data['class']) {
  38764. // ensure collecting deps for deep class bindings for future updates
  38765. traverse(data['class']);
  38766. }
  38767. }
  38768. } else if (elm.data !== vnode.text) {
  38769. elm.data = vnode.text;
  38770. }
  38771. return true
  38772. }
  38773. function assertNodeMatch (node, vnode, inVPre) {
  38774. if (isDef(vnode.tag)) {
  38775. return vnode.tag.indexOf('vue-component') === 0 || (
  38776. !isUnknownElement$$1(vnode, inVPre) &&
  38777. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38778. )
  38779. } else {
  38780. return node.nodeType === (vnode.isComment ? 8 : 3)
  38781. }
  38782. }
  38783. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38784. if (isUndef(vnode)) {
  38785. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38786. return
  38787. }
  38788. var isInitialPatch = false;
  38789. var insertedVnodeQueue = [];
  38790. if (isUndef(oldVnode)) {
  38791. // empty mount (likely as component), create new root element
  38792. isInitialPatch = true;
  38793. createElm(vnode, insertedVnodeQueue);
  38794. } else {
  38795. var isRealElement = isDef(oldVnode.nodeType);
  38796. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38797. // patch existing root node
  38798. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38799. } else {
  38800. if (isRealElement) {
  38801. // mounting to a real element
  38802. // check if this is server-rendered content and if we can perform
  38803. // a successful hydration.
  38804. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38805. oldVnode.removeAttribute(SSR_ATTR);
  38806. hydrating = true;
  38807. }
  38808. if (isTrue(hydrating)) {
  38809. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38810. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38811. return oldVnode
  38812. } else {
  38813. warn(
  38814. 'The client-side rendered virtual DOM tree is not matching ' +
  38815. 'server-rendered content. This is likely caused by incorrect ' +
  38816. 'HTML markup, for example nesting block-level elements inside ' +
  38817. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38818. 'full client-side render.'
  38819. );
  38820. }
  38821. }
  38822. // either not server-rendered, or hydration failed.
  38823. // create an empty node and replace it
  38824. oldVnode = emptyNodeAt(oldVnode);
  38825. }
  38826. // replacing existing element
  38827. var oldElm = oldVnode.elm;
  38828. var parentElm = nodeOps.parentNode(oldElm);
  38829. // create new node
  38830. createElm(
  38831. vnode,
  38832. insertedVnodeQueue,
  38833. // extremely rare edge case: do not insert if old element is in a
  38834. // leaving transition. Only happens when combining transition +
  38835. // keep-alive + HOCs. (#4590)
  38836. oldElm._leaveCb ? null : parentElm,
  38837. nodeOps.nextSibling(oldElm)
  38838. );
  38839. // update parent placeholder node element, recursively
  38840. if (isDef(vnode.parent)) {
  38841. var ancestor = vnode.parent;
  38842. var patchable = isPatchable(vnode);
  38843. while (ancestor) {
  38844. for (var i = 0; i < cbs.destroy.length; ++i) {
  38845. cbs.destroy[i](ancestor);
  38846. }
  38847. ancestor.elm = vnode.elm;
  38848. if (patchable) {
  38849. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38850. cbs.create[i$1](emptyNode, ancestor);
  38851. }
  38852. // #6513
  38853. // invoke insert hooks that may have been merged by create hooks.
  38854. // e.g. for directives that uses the "inserted" hook.
  38855. var insert = ancestor.data.hook.insert;
  38856. if (insert.merged) {
  38857. // start at index 1 to avoid re-invoking component mounted hook
  38858. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38859. insert.fns[i$2]();
  38860. }
  38861. }
  38862. } else {
  38863. registerRef(ancestor);
  38864. }
  38865. ancestor = ancestor.parent;
  38866. }
  38867. }
  38868. // destroy old node
  38869. if (isDef(parentElm)) {
  38870. removeVnodes([oldVnode], 0, 0);
  38871. } else if (isDef(oldVnode.tag)) {
  38872. invokeDestroyHook(oldVnode);
  38873. }
  38874. }
  38875. }
  38876. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38877. return vnode.elm
  38878. }
  38879. }
  38880. /* */
  38881. var directives = {
  38882. create: updateDirectives,
  38883. update: updateDirectives,
  38884. destroy: function unbindDirectives (vnode) {
  38885. updateDirectives(vnode, emptyNode);
  38886. }
  38887. };
  38888. function updateDirectives (oldVnode, vnode) {
  38889. if (oldVnode.data.directives || vnode.data.directives) {
  38890. _update(oldVnode, vnode);
  38891. }
  38892. }
  38893. function _update (oldVnode, vnode) {
  38894. var isCreate = oldVnode === emptyNode;
  38895. var isDestroy = vnode === emptyNode;
  38896. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38897. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38898. var dirsWithInsert = [];
  38899. var dirsWithPostpatch = [];
  38900. var key, oldDir, dir;
  38901. for (key in newDirs) {
  38902. oldDir = oldDirs[key];
  38903. dir = newDirs[key];
  38904. if (!oldDir) {
  38905. // new directive, bind
  38906. callHook$1(dir, 'bind', vnode, oldVnode);
  38907. if (dir.def && dir.def.inserted) {
  38908. dirsWithInsert.push(dir);
  38909. }
  38910. } else {
  38911. // existing directive, update
  38912. dir.oldValue = oldDir.value;
  38913. dir.oldArg = oldDir.arg;
  38914. callHook$1(dir, 'update', vnode, oldVnode);
  38915. if (dir.def && dir.def.componentUpdated) {
  38916. dirsWithPostpatch.push(dir);
  38917. }
  38918. }
  38919. }
  38920. if (dirsWithInsert.length) {
  38921. var callInsert = function () {
  38922. for (var i = 0; i < dirsWithInsert.length; i++) {
  38923. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38924. }
  38925. };
  38926. if (isCreate) {
  38927. mergeVNodeHook(vnode, 'insert', callInsert);
  38928. } else {
  38929. callInsert();
  38930. }
  38931. }
  38932. if (dirsWithPostpatch.length) {
  38933. mergeVNodeHook(vnode, 'postpatch', function () {
  38934. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38935. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38936. }
  38937. });
  38938. }
  38939. if (!isCreate) {
  38940. for (key in oldDirs) {
  38941. if (!newDirs[key]) {
  38942. // no longer present, unbind
  38943. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38944. }
  38945. }
  38946. }
  38947. }
  38948. var emptyModifiers = Object.create(null);
  38949. function normalizeDirectives$1 (
  38950. dirs,
  38951. vm
  38952. ) {
  38953. var res = Object.create(null);
  38954. if (!dirs) {
  38955. // $flow-disable-line
  38956. return res
  38957. }
  38958. var i, dir;
  38959. for (i = 0; i < dirs.length; i++) {
  38960. dir = dirs[i];
  38961. if (!dir.modifiers) {
  38962. // $flow-disable-line
  38963. dir.modifiers = emptyModifiers;
  38964. }
  38965. res[getRawDirName(dir)] = dir;
  38966. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38967. }
  38968. // $flow-disable-line
  38969. return res
  38970. }
  38971. function getRawDirName (dir) {
  38972. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38973. }
  38974. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38975. var fn = dir.def && dir.def[hook];
  38976. if (fn) {
  38977. try {
  38978. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38979. } catch (e) {
  38980. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38981. }
  38982. }
  38983. }
  38984. var baseModules = [
  38985. ref,
  38986. directives
  38987. ];
  38988. /* */
  38989. function updateAttrs (oldVnode, vnode) {
  38990. var opts = vnode.componentOptions;
  38991. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38992. return
  38993. }
  38994. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38995. return
  38996. }
  38997. var key, cur, old;
  38998. var elm = vnode.elm;
  38999. var oldAttrs = oldVnode.data.attrs || {};
  39000. var attrs = vnode.data.attrs || {};
  39001. // clone observed objects, as the user probably wants to mutate it
  39002. if (isDef(attrs.__ob__)) {
  39003. attrs = vnode.data.attrs = extend({}, attrs);
  39004. }
  39005. for (key in attrs) {
  39006. cur = attrs[key];
  39007. old = oldAttrs[key];
  39008. if (old !== cur) {
  39009. setAttr(elm, key, cur);
  39010. }
  39011. }
  39012. // #4391: in IE9, setting type can reset value for input[type=radio]
  39013. // #6666: IE/Edge forces progress value down to 1 before setting a max
  39014. /* istanbul ignore if */
  39015. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  39016. setAttr(elm, 'value', attrs.value);
  39017. }
  39018. for (key in oldAttrs) {
  39019. if (isUndef(attrs[key])) {
  39020. if (isXlink(key)) {
  39021. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39022. } else if (!isEnumeratedAttr(key)) {
  39023. elm.removeAttribute(key);
  39024. }
  39025. }
  39026. }
  39027. }
  39028. function setAttr (el, key, value) {
  39029. if (el.tagName.indexOf('-') > -1) {
  39030. baseSetAttr(el, key, value);
  39031. } else if (isBooleanAttr(key)) {
  39032. // set attribute for blank value
  39033. // e.g. <option disabled>Select one</option>
  39034. if (isFalsyAttrValue(value)) {
  39035. el.removeAttribute(key);
  39036. } else {
  39037. // technically allowfullscreen is a boolean attribute for <iframe>,
  39038. // but Flash expects a value of "true" when used on <embed> tag
  39039. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  39040. ? 'true'
  39041. : key;
  39042. el.setAttribute(key, value);
  39043. }
  39044. } else if (isEnumeratedAttr(key)) {
  39045. el.setAttribute(key, convertEnumeratedValue(key, value));
  39046. } else if (isXlink(key)) {
  39047. if (isFalsyAttrValue(value)) {
  39048. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  39049. } else {
  39050. el.setAttributeNS(xlinkNS, key, value);
  39051. }
  39052. } else {
  39053. baseSetAttr(el, key, value);
  39054. }
  39055. }
  39056. function baseSetAttr (el, key, value) {
  39057. if (isFalsyAttrValue(value)) {
  39058. el.removeAttribute(key);
  39059. } else {
  39060. // #7138: IE10 & 11 fires input event when setting placeholder on
  39061. // <textarea>... block the first input event and remove the blocker
  39062. // immediately.
  39063. /* istanbul ignore if */
  39064. if (
  39065. isIE && !isIE9 &&
  39066. el.tagName === 'TEXTAREA' &&
  39067. key === 'placeholder' && value !== '' && !el.__ieph
  39068. ) {
  39069. var blocker = function (e) {
  39070. e.stopImmediatePropagation();
  39071. el.removeEventListener('input', blocker);
  39072. };
  39073. el.addEventListener('input', blocker);
  39074. // $flow-disable-line
  39075. el.__ieph = true; /* IE placeholder patched */
  39076. }
  39077. el.setAttribute(key, value);
  39078. }
  39079. }
  39080. var attrs = {
  39081. create: updateAttrs,
  39082. update: updateAttrs
  39083. };
  39084. /* */
  39085. function updateClass (oldVnode, vnode) {
  39086. var el = vnode.elm;
  39087. var data = vnode.data;
  39088. var oldData = oldVnode.data;
  39089. if (
  39090. isUndef(data.staticClass) &&
  39091. isUndef(data.class) && (
  39092. isUndef(oldData) || (
  39093. isUndef(oldData.staticClass) &&
  39094. isUndef(oldData.class)
  39095. )
  39096. )
  39097. ) {
  39098. return
  39099. }
  39100. var cls = genClassForVnode(vnode);
  39101. // handle transition classes
  39102. var transitionClass = el._transitionClasses;
  39103. if (isDef(transitionClass)) {
  39104. cls = concat(cls, stringifyClass(transitionClass));
  39105. }
  39106. // set the class
  39107. if (cls !== el._prevClass) {
  39108. el.setAttribute('class', cls);
  39109. el._prevClass = cls;
  39110. }
  39111. }
  39112. var klass = {
  39113. create: updateClass,
  39114. update: updateClass
  39115. };
  39116. /* */
  39117. var validDivisionCharRE = /[\w).+\-_$\]]/;
  39118. function parseFilters (exp) {
  39119. var inSingle = false;
  39120. var inDouble = false;
  39121. var inTemplateString = false;
  39122. var inRegex = false;
  39123. var curly = 0;
  39124. var square = 0;
  39125. var paren = 0;
  39126. var lastFilterIndex = 0;
  39127. var c, prev, i, expression, filters;
  39128. for (i = 0; i < exp.length; i++) {
  39129. prev = c;
  39130. c = exp.charCodeAt(i);
  39131. if (inSingle) {
  39132. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  39133. } else if (inDouble) {
  39134. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  39135. } else if (inTemplateString) {
  39136. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  39137. } else if (inRegex) {
  39138. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  39139. } else if (
  39140. c === 0x7C && // pipe
  39141. exp.charCodeAt(i + 1) !== 0x7C &&
  39142. exp.charCodeAt(i - 1) !== 0x7C &&
  39143. !curly && !square && !paren
  39144. ) {
  39145. if (expression === undefined) {
  39146. // first filter, end of expression
  39147. lastFilterIndex = i + 1;
  39148. expression = exp.slice(0, i).trim();
  39149. } else {
  39150. pushFilter();
  39151. }
  39152. } else {
  39153. switch (c) {
  39154. case 0x22: inDouble = true; break // "
  39155. case 0x27: inSingle = true; break // '
  39156. case 0x60: inTemplateString = true; break // `
  39157. case 0x28: paren++; break // (
  39158. case 0x29: paren--; break // )
  39159. case 0x5B: square++; break // [
  39160. case 0x5D: square--; break // ]
  39161. case 0x7B: curly++; break // {
  39162. case 0x7D: curly--; break // }
  39163. }
  39164. if (c === 0x2f) { // /
  39165. var j = i - 1;
  39166. var p = (void 0);
  39167. // find first non-whitespace prev char
  39168. for (; j >= 0; j--) {
  39169. p = exp.charAt(j);
  39170. if (p !== ' ') { break }
  39171. }
  39172. if (!p || !validDivisionCharRE.test(p)) {
  39173. inRegex = true;
  39174. }
  39175. }
  39176. }
  39177. }
  39178. if (expression === undefined) {
  39179. expression = exp.slice(0, i).trim();
  39180. } else if (lastFilterIndex !== 0) {
  39181. pushFilter();
  39182. }
  39183. function pushFilter () {
  39184. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  39185. lastFilterIndex = i + 1;
  39186. }
  39187. if (filters) {
  39188. for (i = 0; i < filters.length; i++) {
  39189. expression = wrapFilter(expression, filters[i]);
  39190. }
  39191. }
  39192. return expression
  39193. }
  39194. function wrapFilter (exp, filter) {
  39195. var i = filter.indexOf('(');
  39196. if (i < 0) {
  39197. // _f: resolveFilter
  39198. return ("_f(\"" + filter + "\")(" + exp + ")")
  39199. } else {
  39200. var name = filter.slice(0, i);
  39201. var args = filter.slice(i + 1);
  39202. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  39203. }
  39204. }
  39205. /* */
  39206. /* eslint-disable no-unused-vars */
  39207. function baseWarn (msg, range) {
  39208. console.error(("[Vue compiler]: " + msg));
  39209. }
  39210. /* eslint-enable no-unused-vars */
  39211. function pluckModuleFunction (
  39212. modules,
  39213. key
  39214. ) {
  39215. return modules
  39216. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  39217. : []
  39218. }
  39219. function addProp (el, name, value, range, dynamic) {
  39220. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39221. el.plain = false;
  39222. }
  39223. function addAttr (el, name, value, range, dynamic) {
  39224. var attrs = dynamic
  39225. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  39226. : (el.attrs || (el.attrs = []));
  39227. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39228. el.plain = false;
  39229. }
  39230. // add a raw attr (use this in preTransforms)
  39231. function addRawAttr (el, name, value, range) {
  39232. el.attrsMap[name] = value;
  39233. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  39234. }
  39235. function addDirective (
  39236. el,
  39237. name,
  39238. rawName,
  39239. value,
  39240. arg,
  39241. isDynamicArg,
  39242. modifiers,
  39243. range
  39244. ) {
  39245. (el.directives || (el.directives = [])).push(rangeSetItem({
  39246. name: name,
  39247. rawName: rawName,
  39248. value: value,
  39249. arg: arg,
  39250. isDynamicArg: isDynamicArg,
  39251. modifiers: modifiers
  39252. }, range));
  39253. el.plain = false;
  39254. }
  39255. function prependModifierMarker (symbol, name, dynamic) {
  39256. return dynamic
  39257. ? ("_p(" + name + ",\"" + symbol + "\")")
  39258. : symbol + name // mark the event as captured
  39259. }
  39260. function addHandler (
  39261. el,
  39262. name,
  39263. value,
  39264. modifiers,
  39265. important,
  39266. warn,
  39267. range,
  39268. dynamic
  39269. ) {
  39270. modifiers = modifiers || emptyObject;
  39271. // warn prevent and passive modifier
  39272. /* istanbul ignore if */
  39273. if (
  39274. warn &&
  39275. modifiers.prevent && modifiers.passive
  39276. ) {
  39277. warn(
  39278. 'passive and prevent can\'t be used together. ' +
  39279. 'Passive handler can\'t prevent default event.',
  39280. range
  39281. );
  39282. }
  39283. // normalize click.right and click.middle since they don't actually fire
  39284. // this is technically browser-specific, but at least for now browsers are
  39285. // the only target envs that have right/middle clicks.
  39286. if (modifiers.right) {
  39287. if (dynamic) {
  39288. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  39289. } else if (name === 'click') {
  39290. name = 'contextmenu';
  39291. delete modifiers.right;
  39292. }
  39293. } else if (modifiers.middle) {
  39294. if (dynamic) {
  39295. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  39296. } else if (name === 'click') {
  39297. name = 'mouseup';
  39298. }
  39299. }
  39300. // check capture modifier
  39301. if (modifiers.capture) {
  39302. delete modifiers.capture;
  39303. name = prependModifierMarker('!', name, dynamic);
  39304. }
  39305. if (modifiers.once) {
  39306. delete modifiers.once;
  39307. name = prependModifierMarker('~', name, dynamic);
  39308. }
  39309. /* istanbul ignore if */
  39310. if (modifiers.passive) {
  39311. delete modifiers.passive;
  39312. name = prependModifierMarker('&', name, dynamic);
  39313. }
  39314. var events;
  39315. if (modifiers.native) {
  39316. delete modifiers.native;
  39317. events = el.nativeEvents || (el.nativeEvents = {});
  39318. } else {
  39319. events = el.events || (el.events = {});
  39320. }
  39321. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  39322. if (modifiers !== emptyObject) {
  39323. newHandler.modifiers = modifiers;
  39324. }
  39325. var handlers = events[name];
  39326. /* istanbul ignore if */
  39327. if (Array.isArray(handlers)) {
  39328. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  39329. } else if (handlers) {
  39330. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  39331. } else {
  39332. events[name] = newHandler;
  39333. }
  39334. el.plain = false;
  39335. }
  39336. function getRawBindingAttr (
  39337. el,
  39338. name
  39339. ) {
  39340. return el.rawAttrsMap[':' + name] ||
  39341. el.rawAttrsMap['v-bind:' + name] ||
  39342. el.rawAttrsMap[name]
  39343. }
  39344. function getBindingAttr (
  39345. el,
  39346. name,
  39347. getStatic
  39348. ) {
  39349. var dynamicValue =
  39350. getAndRemoveAttr(el, ':' + name) ||
  39351. getAndRemoveAttr(el, 'v-bind:' + name);
  39352. if (dynamicValue != null) {
  39353. return parseFilters(dynamicValue)
  39354. } else if (getStatic !== false) {
  39355. var staticValue = getAndRemoveAttr(el, name);
  39356. if (staticValue != null) {
  39357. return JSON.stringify(staticValue)
  39358. }
  39359. }
  39360. }
  39361. // note: this only removes the attr from the Array (attrsList) so that it
  39362. // doesn't get processed by processAttrs.
  39363. // By default it does NOT remove it from the map (attrsMap) because the map is
  39364. // needed during codegen.
  39365. function getAndRemoveAttr (
  39366. el,
  39367. name,
  39368. removeFromMap
  39369. ) {
  39370. var val;
  39371. if ((val = el.attrsMap[name]) != null) {
  39372. var list = el.attrsList;
  39373. for (var i = 0, l = list.length; i < l; i++) {
  39374. if (list[i].name === name) {
  39375. list.splice(i, 1);
  39376. break
  39377. }
  39378. }
  39379. }
  39380. if (removeFromMap) {
  39381. delete el.attrsMap[name];
  39382. }
  39383. return val
  39384. }
  39385. function getAndRemoveAttrByRegex (
  39386. el,
  39387. name
  39388. ) {
  39389. var list = el.attrsList;
  39390. for (var i = 0, l = list.length; i < l; i++) {
  39391. var attr = list[i];
  39392. if (name.test(attr.name)) {
  39393. list.splice(i, 1);
  39394. return attr
  39395. }
  39396. }
  39397. }
  39398. function rangeSetItem (
  39399. item,
  39400. range
  39401. ) {
  39402. if (range) {
  39403. if (range.start != null) {
  39404. item.start = range.start;
  39405. }
  39406. if (range.end != null) {
  39407. item.end = range.end;
  39408. }
  39409. }
  39410. return item
  39411. }
  39412. /* */
  39413. /**
  39414. * Cross-platform code generation for component v-model
  39415. */
  39416. function genComponentModel (
  39417. el,
  39418. value,
  39419. modifiers
  39420. ) {
  39421. var ref = modifiers || {};
  39422. var number = ref.number;
  39423. var trim = ref.trim;
  39424. var baseValueExpression = '$$v';
  39425. var valueExpression = baseValueExpression;
  39426. if (trim) {
  39427. valueExpression =
  39428. "(typeof " + baseValueExpression + " === 'string'" +
  39429. "? " + baseValueExpression + ".trim()" +
  39430. ": " + baseValueExpression + ")";
  39431. }
  39432. if (number) {
  39433. valueExpression = "_n(" + valueExpression + ")";
  39434. }
  39435. var assignment = genAssignmentCode(value, valueExpression);
  39436. el.model = {
  39437. value: ("(" + value + ")"),
  39438. expression: JSON.stringify(value),
  39439. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  39440. };
  39441. }
  39442. /**
  39443. * Cross-platform codegen helper for generating v-model value assignment code.
  39444. */
  39445. function genAssignmentCode (
  39446. value,
  39447. assignment
  39448. ) {
  39449. var res = parseModel(value);
  39450. if (res.key === null) {
  39451. return (value + "=" + assignment)
  39452. } else {
  39453. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  39454. }
  39455. }
  39456. /**
  39457. * Parse a v-model expression into a base path and a final key segment.
  39458. * Handles both dot-path and possible square brackets.
  39459. *
  39460. * Possible cases:
  39461. *
  39462. * - test
  39463. * - test[key]
  39464. * - test[test1[key]]
  39465. * - test["a"][key]
  39466. * - xxx.test[a[a].test1[key]]
  39467. * - test.xxx.a["asa"][test1[key]]
  39468. *
  39469. */
  39470. var len, str, chr, index$1, expressionPos, expressionEndPos;
  39471. function parseModel (val) {
  39472. // Fix https://github.com/vuejs/vue/pull/7730
  39473. // allow v-model="obj.val " (trailing whitespace)
  39474. val = val.trim();
  39475. len = val.length;
  39476. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  39477. index$1 = val.lastIndexOf('.');
  39478. if (index$1 > -1) {
  39479. return {
  39480. exp: val.slice(0, index$1),
  39481. key: '"' + val.slice(index$1 + 1) + '"'
  39482. }
  39483. } else {
  39484. return {
  39485. exp: val,
  39486. key: null
  39487. }
  39488. }
  39489. }
  39490. str = val;
  39491. index$1 = expressionPos = expressionEndPos = 0;
  39492. while (!eof()) {
  39493. chr = next();
  39494. /* istanbul ignore if */
  39495. if (isStringStart(chr)) {
  39496. parseString(chr);
  39497. } else if (chr === 0x5B) {
  39498. parseBracket(chr);
  39499. }
  39500. }
  39501. return {
  39502. exp: val.slice(0, expressionPos),
  39503. key: val.slice(expressionPos + 1, expressionEndPos)
  39504. }
  39505. }
  39506. function next () {
  39507. return str.charCodeAt(++index$1)
  39508. }
  39509. function eof () {
  39510. return index$1 >= len
  39511. }
  39512. function isStringStart (chr) {
  39513. return chr === 0x22 || chr === 0x27
  39514. }
  39515. function parseBracket (chr) {
  39516. var inBracket = 1;
  39517. expressionPos = index$1;
  39518. while (!eof()) {
  39519. chr = next();
  39520. if (isStringStart(chr)) {
  39521. parseString(chr);
  39522. continue
  39523. }
  39524. if (chr === 0x5B) { inBracket++; }
  39525. if (chr === 0x5D) { inBracket--; }
  39526. if (inBracket === 0) {
  39527. expressionEndPos = index$1;
  39528. break
  39529. }
  39530. }
  39531. }
  39532. function parseString (chr) {
  39533. var stringQuote = chr;
  39534. while (!eof()) {
  39535. chr = next();
  39536. if (chr === stringQuote) {
  39537. break
  39538. }
  39539. }
  39540. }
  39541. /* */
  39542. var warn$1;
  39543. // in some cases, the event used has to be determined at runtime
  39544. // so we used some reserved tokens during compile.
  39545. var RANGE_TOKEN = '__r';
  39546. var CHECKBOX_RADIO_TOKEN = '__c';
  39547. function model (
  39548. el,
  39549. dir,
  39550. _warn
  39551. ) {
  39552. warn$1 = _warn;
  39553. var value = dir.value;
  39554. var modifiers = dir.modifiers;
  39555. var tag = el.tag;
  39556. var type = el.attrsMap.type;
  39557. {
  39558. // inputs with type="file" are read only and setting the input's
  39559. // value will throw an error.
  39560. if (tag === 'input' && type === 'file') {
  39561. warn$1(
  39562. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  39563. "File inputs are read only. Use a v-on:change listener instead.",
  39564. el.rawAttrsMap['v-model']
  39565. );
  39566. }
  39567. }
  39568. if (el.component) {
  39569. genComponentModel(el, value, modifiers);
  39570. // component v-model doesn't need extra runtime
  39571. return false
  39572. } else if (tag === 'select') {
  39573. genSelect(el, value, modifiers);
  39574. } else if (tag === 'input' && type === 'checkbox') {
  39575. genCheckboxModel(el, value, modifiers);
  39576. } else if (tag === 'input' && type === 'radio') {
  39577. genRadioModel(el, value, modifiers);
  39578. } else if (tag === 'input' || tag === 'textarea') {
  39579. genDefaultModel(el, value, modifiers);
  39580. } else if (!config.isReservedTag(tag)) {
  39581. genComponentModel(el, value, modifiers);
  39582. // component v-model doesn't need extra runtime
  39583. return false
  39584. } else {
  39585. warn$1(
  39586. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  39587. "v-model is not supported on this element type. " +
  39588. 'If you are working with contenteditable, it\'s recommended to ' +
  39589. 'wrap a library dedicated for that purpose inside a custom component.',
  39590. el.rawAttrsMap['v-model']
  39591. );
  39592. }
  39593. // ensure runtime directive metadata
  39594. return true
  39595. }
  39596. function genCheckboxModel (
  39597. el,
  39598. value,
  39599. modifiers
  39600. ) {
  39601. var number = modifiers && modifiers.number;
  39602. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39603. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  39604. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  39605. addProp(el, 'checked',
  39606. "Array.isArray(" + value + ")" +
  39607. "?_i(" + value + "," + valueBinding + ")>-1" + (
  39608. trueValueBinding === 'true'
  39609. ? (":(" + value + ")")
  39610. : (":_q(" + value + "," + trueValueBinding + ")")
  39611. )
  39612. );
  39613. addHandler(el, 'change',
  39614. "var $$a=" + value + "," +
  39615. '$$el=$event.target,' +
  39616. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  39617. 'if(Array.isArray($$a)){' +
  39618. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  39619. '$$i=_i($$a,$$v);' +
  39620. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  39621. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  39622. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  39623. null, true
  39624. );
  39625. }
  39626. function genRadioModel (
  39627. el,
  39628. value,
  39629. modifiers
  39630. ) {
  39631. var number = modifiers && modifiers.number;
  39632. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39633. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  39634. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  39635. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  39636. }
  39637. function genSelect (
  39638. el,
  39639. value,
  39640. modifiers
  39641. ) {
  39642. var number = modifiers && modifiers.number;
  39643. var selectedVal = "Array.prototype.filter" +
  39644. ".call($event.target.options,function(o){return o.selected})" +
  39645. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  39646. "return " + (number ? '_n(val)' : 'val') + "})";
  39647. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  39648. var code = "var $$selectedVal = " + selectedVal + ";";
  39649. code = code + " " + (genAssignmentCode(value, assignment));
  39650. addHandler(el, 'change', code, null, true);
  39651. }
  39652. function genDefaultModel (
  39653. el,
  39654. value,
  39655. modifiers
  39656. ) {
  39657. var type = el.attrsMap.type;
  39658. // warn if v-bind:value conflicts with v-model
  39659. // except for inputs with v-bind:type
  39660. {
  39661. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  39662. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  39663. if (value$1 && !typeBinding) {
  39664. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  39665. warn$1(
  39666. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  39667. 'because the latter already expands to a value binding internally',
  39668. el.rawAttrsMap[binding]
  39669. );
  39670. }
  39671. }
  39672. var ref = modifiers || {};
  39673. var lazy = ref.lazy;
  39674. var number = ref.number;
  39675. var trim = ref.trim;
  39676. var needCompositionGuard = !lazy && type !== 'range';
  39677. var event = lazy
  39678. ? 'change'
  39679. : type === 'range'
  39680. ? RANGE_TOKEN
  39681. : 'input';
  39682. var valueExpression = '$event.target.value';
  39683. if (trim) {
  39684. valueExpression = "$event.target.value.trim()";
  39685. }
  39686. if (number) {
  39687. valueExpression = "_n(" + valueExpression + ")";
  39688. }
  39689. var code = genAssignmentCode(value, valueExpression);
  39690. if (needCompositionGuard) {
  39691. code = "if($event.target.composing)return;" + code;
  39692. }
  39693. addProp(el, 'value', ("(" + value + ")"));
  39694. addHandler(el, event, code, null, true);
  39695. if (trim || number) {
  39696. addHandler(el, 'blur', '$forceUpdate()');
  39697. }
  39698. }
  39699. /* */
  39700. // normalize v-model event tokens that can only be determined at runtime.
  39701. // it's important to place the event as the first in the array because
  39702. // the whole point is ensuring the v-model callback gets called before
  39703. // user-attached handlers.
  39704. function normalizeEvents (on) {
  39705. /* istanbul ignore if */
  39706. if (isDef(on[RANGE_TOKEN])) {
  39707. // IE input[type=range] only supports `change` event
  39708. var event = isIE ? 'change' : 'input';
  39709. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  39710. delete on[RANGE_TOKEN];
  39711. }
  39712. // This was originally intended to fix #4521 but no longer necessary
  39713. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  39714. /* istanbul ignore if */
  39715. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  39716. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  39717. delete on[CHECKBOX_RADIO_TOKEN];
  39718. }
  39719. }
  39720. var target$1;
  39721. function createOnceHandler$1 (event, handler, capture) {
  39722. var _target = target$1; // save current target element in closure
  39723. return function onceHandler () {
  39724. var res = handler.apply(null, arguments);
  39725. if (res !== null) {
  39726. remove$2(event, onceHandler, capture, _target);
  39727. }
  39728. }
  39729. }
  39730. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39731. // implementation and does not fire microtasks in between event propagation, so
  39732. // safe to exclude.
  39733. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39734. function add$1 (
  39735. name,
  39736. handler,
  39737. capture,
  39738. passive
  39739. ) {
  39740. // async edge case #6566: inner click event triggers patch, event handler
  39741. // attached to outer element during patch, and triggered again. This
  39742. // happens because browsers fire microtask ticks between event propagation.
  39743. // the solution is simple: we save the timestamp when a handler is attached,
  39744. // and the handler would only fire if the event passed to it was fired
  39745. // AFTER it was attached.
  39746. if (useMicrotaskFix) {
  39747. var attachedTimestamp = currentFlushTimestamp;
  39748. var original = handler;
  39749. handler = original._wrapper = function (e) {
  39750. if (
  39751. // no bubbling, should always fire.
  39752. // this is just a safety net in case event.timeStamp is unreliable in
  39753. // certain weird environments...
  39754. e.target === e.currentTarget ||
  39755. // event is fired after handler attachment
  39756. e.timeStamp >= attachedTimestamp ||
  39757. // bail for environments that have buggy event.timeStamp implementations
  39758. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  39759. // #9681 QtWebEngine event.timeStamp is negative value
  39760. e.timeStamp <= 0 ||
  39761. // #9448 bail if event is fired in another document in a multi-page
  39762. // electron/nw.js app, since event.timeStamp will be using a different
  39763. // starting reference
  39764. e.target.ownerDocument !== document
  39765. ) {
  39766. return original.apply(this, arguments)
  39767. }
  39768. };
  39769. }
  39770. target$1.addEventListener(
  39771. name,
  39772. handler,
  39773. supportsPassive
  39774. ? { capture: capture, passive: passive }
  39775. : capture
  39776. );
  39777. }
  39778. function remove$2 (
  39779. name,
  39780. handler,
  39781. capture,
  39782. _target
  39783. ) {
  39784. (_target || target$1).removeEventListener(
  39785. name,
  39786. handler._wrapper || handler,
  39787. capture
  39788. );
  39789. }
  39790. function updateDOMListeners (oldVnode, vnode) {
  39791. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39792. return
  39793. }
  39794. var on = vnode.data.on || {};
  39795. var oldOn = oldVnode.data.on || {};
  39796. target$1 = vnode.elm;
  39797. normalizeEvents(on);
  39798. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39799. target$1 = undefined;
  39800. }
  39801. var events = {
  39802. create: updateDOMListeners,
  39803. update: updateDOMListeners
  39804. };
  39805. /* */
  39806. var svgContainer;
  39807. function updateDOMProps (oldVnode, vnode) {
  39808. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39809. return
  39810. }
  39811. var key, cur;
  39812. var elm = vnode.elm;
  39813. var oldProps = oldVnode.data.domProps || {};
  39814. var props = vnode.data.domProps || {};
  39815. // clone observed objects, as the user probably wants to mutate it
  39816. if (isDef(props.__ob__)) {
  39817. props = vnode.data.domProps = extend({}, props);
  39818. }
  39819. for (key in oldProps) {
  39820. if (!(key in props)) {
  39821. elm[key] = '';
  39822. }
  39823. }
  39824. for (key in props) {
  39825. cur = props[key];
  39826. // ignore children if the node has textContent or innerHTML,
  39827. // as these will throw away existing DOM nodes and cause removal errors
  39828. // on subsequent patches (#3360)
  39829. if (key === 'textContent' || key === 'innerHTML') {
  39830. if (vnode.children) { vnode.children.length = 0; }
  39831. if (cur === oldProps[key]) { continue }
  39832. // #6601 work around Chrome version <= 55 bug where single textNode
  39833. // replaced by innerHTML/textContent retains its parentNode property
  39834. if (elm.childNodes.length === 1) {
  39835. elm.removeChild(elm.childNodes[0]);
  39836. }
  39837. }
  39838. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39839. // store value as _value as well since
  39840. // non-string values will be stringified
  39841. elm._value = cur;
  39842. // avoid resetting cursor position when value is the same
  39843. var strCur = isUndef(cur) ? '' : String(cur);
  39844. if (shouldUpdateValue(elm, strCur)) {
  39845. elm.value = strCur;
  39846. }
  39847. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39848. // IE doesn't support innerHTML for SVG elements
  39849. svgContainer = svgContainer || document.createElement('div');
  39850. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39851. var svg = svgContainer.firstChild;
  39852. while (elm.firstChild) {
  39853. elm.removeChild(elm.firstChild);
  39854. }
  39855. while (svg.firstChild) {
  39856. elm.appendChild(svg.firstChild);
  39857. }
  39858. } else if (
  39859. // skip the update if old and new VDOM state is the same.
  39860. // `value` is handled separately because the DOM value may be temporarily
  39861. // out of sync with VDOM state due to focus, composition and modifiers.
  39862. // This #4521 by skipping the unnecessary `checked` update.
  39863. cur !== oldProps[key]
  39864. ) {
  39865. // some property updates can throw
  39866. // e.g. `value` on <progress> w/ non-finite value
  39867. try {
  39868. elm[key] = cur;
  39869. } catch (e) {}
  39870. }
  39871. }
  39872. }
  39873. // check platforms/web/util/attrs.js acceptValue
  39874. function shouldUpdateValue (elm, checkVal) {
  39875. return (!elm.composing && (
  39876. elm.tagName === 'OPTION' ||
  39877. isNotInFocusAndDirty(elm, checkVal) ||
  39878. isDirtyWithModifiers(elm, checkVal)
  39879. ))
  39880. }
  39881. function isNotInFocusAndDirty (elm, checkVal) {
  39882. // return true when textbox (.number and .trim) loses focus and its value is
  39883. // not equal to the updated value
  39884. var notInFocus = true;
  39885. // #6157
  39886. // work around IE bug when accessing document.activeElement in an iframe
  39887. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39888. return notInFocus && elm.value !== checkVal
  39889. }
  39890. function isDirtyWithModifiers (elm, newVal) {
  39891. var value = elm.value;
  39892. var modifiers = elm._vModifiers; // injected by v-model runtime
  39893. if (isDef(modifiers)) {
  39894. if (modifiers.number) {
  39895. return toNumber(value) !== toNumber(newVal)
  39896. }
  39897. if (modifiers.trim) {
  39898. return value.trim() !== newVal.trim()
  39899. }
  39900. }
  39901. return value !== newVal
  39902. }
  39903. var domProps = {
  39904. create: updateDOMProps,
  39905. update: updateDOMProps
  39906. };
  39907. /* */
  39908. var parseStyleText = cached(function (cssText) {
  39909. var res = {};
  39910. var listDelimiter = /;(?![^(]*\))/g;
  39911. var propertyDelimiter = /:(.+)/;
  39912. cssText.split(listDelimiter).forEach(function (item) {
  39913. if (item) {
  39914. var tmp = item.split(propertyDelimiter);
  39915. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39916. }
  39917. });
  39918. return res
  39919. });
  39920. // merge static and dynamic style data on the same vnode
  39921. function normalizeStyleData (data) {
  39922. var style = normalizeStyleBinding(data.style);
  39923. // static style is pre-processed into an object during compilation
  39924. // and is always a fresh object, so it's safe to merge into it
  39925. return data.staticStyle
  39926. ? extend(data.staticStyle, style)
  39927. : style
  39928. }
  39929. // normalize possible array / string values into Object
  39930. function normalizeStyleBinding (bindingStyle) {
  39931. if (Array.isArray(bindingStyle)) {
  39932. return toObject(bindingStyle)
  39933. }
  39934. if (typeof bindingStyle === 'string') {
  39935. return parseStyleText(bindingStyle)
  39936. }
  39937. return bindingStyle
  39938. }
  39939. /**
  39940. * parent component style should be after child's
  39941. * so that parent component's style could override it
  39942. */
  39943. function getStyle (vnode, checkChild) {
  39944. var res = {};
  39945. var styleData;
  39946. if (checkChild) {
  39947. var childNode = vnode;
  39948. while (childNode.componentInstance) {
  39949. childNode = childNode.componentInstance._vnode;
  39950. if (
  39951. childNode && childNode.data &&
  39952. (styleData = normalizeStyleData(childNode.data))
  39953. ) {
  39954. extend(res, styleData);
  39955. }
  39956. }
  39957. }
  39958. if ((styleData = normalizeStyleData(vnode.data))) {
  39959. extend(res, styleData);
  39960. }
  39961. var parentNode = vnode;
  39962. while ((parentNode = parentNode.parent)) {
  39963. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39964. extend(res, styleData);
  39965. }
  39966. }
  39967. return res
  39968. }
  39969. /* */
  39970. var cssVarRE = /^--/;
  39971. var importantRE = /\s*!important$/;
  39972. var setProp = function (el, name, val) {
  39973. /* istanbul ignore if */
  39974. if (cssVarRE.test(name)) {
  39975. el.style.setProperty(name, val);
  39976. } else if (importantRE.test(val)) {
  39977. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39978. } else {
  39979. var normalizedName = normalize(name);
  39980. if (Array.isArray(val)) {
  39981. // Support values array created by autoprefixer, e.g.
  39982. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39983. // Set them one by one, and the browser will only set those it can recognize
  39984. for (var i = 0, len = val.length; i < len; i++) {
  39985. el.style[normalizedName] = val[i];
  39986. }
  39987. } else {
  39988. el.style[normalizedName] = val;
  39989. }
  39990. }
  39991. };
  39992. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39993. var emptyStyle;
  39994. var normalize = cached(function (prop) {
  39995. emptyStyle = emptyStyle || document.createElement('div').style;
  39996. prop = camelize(prop);
  39997. if (prop !== 'filter' && (prop in emptyStyle)) {
  39998. return prop
  39999. }
  40000. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  40001. for (var i = 0; i < vendorNames.length; i++) {
  40002. var name = vendorNames[i] + capName;
  40003. if (name in emptyStyle) {
  40004. return name
  40005. }
  40006. }
  40007. });
  40008. function updateStyle (oldVnode, vnode) {
  40009. var data = vnode.data;
  40010. var oldData = oldVnode.data;
  40011. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  40012. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  40013. ) {
  40014. return
  40015. }
  40016. var cur, name;
  40017. var el = vnode.elm;
  40018. var oldStaticStyle = oldData.staticStyle;
  40019. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  40020. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  40021. var oldStyle = oldStaticStyle || oldStyleBinding;
  40022. var style = normalizeStyleBinding(vnode.data.style) || {};
  40023. // store normalized style under a different key for next diff
  40024. // make sure to clone it if it's reactive, since the user likely wants
  40025. // to mutate it.
  40026. vnode.data.normalizedStyle = isDef(style.__ob__)
  40027. ? extend({}, style)
  40028. : style;
  40029. var newStyle = getStyle(vnode, true);
  40030. for (name in oldStyle) {
  40031. if (isUndef(newStyle[name])) {
  40032. setProp(el, name, '');
  40033. }
  40034. }
  40035. for (name in newStyle) {
  40036. cur = newStyle[name];
  40037. if (cur !== oldStyle[name]) {
  40038. // ie9 setting to null has no effect, must use empty string
  40039. setProp(el, name, cur == null ? '' : cur);
  40040. }
  40041. }
  40042. }
  40043. var style = {
  40044. create: updateStyle,
  40045. update: updateStyle
  40046. };
  40047. /* */
  40048. var whitespaceRE = /\s+/;
  40049. /**
  40050. * Add class with compatibility for SVG since classList is not supported on
  40051. * SVG elements in IE
  40052. */
  40053. function addClass (el, cls) {
  40054. /* istanbul ignore if */
  40055. if (!cls || !(cls = cls.trim())) {
  40056. return
  40057. }
  40058. /* istanbul ignore else */
  40059. if (el.classList) {
  40060. if (cls.indexOf(' ') > -1) {
  40061. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  40062. } else {
  40063. el.classList.add(cls);
  40064. }
  40065. } else {
  40066. var cur = " " + (el.getAttribute('class') || '') + " ";
  40067. if (cur.indexOf(' ' + cls + ' ') < 0) {
  40068. el.setAttribute('class', (cur + cls).trim());
  40069. }
  40070. }
  40071. }
  40072. /**
  40073. * Remove class with compatibility for SVG since classList is not supported on
  40074. * SVG elements in IE
  40075. */
  40076. function removeClass (el, cls) {
  40077. /* istanbul ignore if */
  40078. if (!cls || !(cls = cls.trim())) {
  40079. return
  40080. }
  40081. /* istanbul ignore else */
  40082. if (el.classList) {
  40083. if (cls.indexOf(' ') > -1) {
  40084. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  40085. } else {
  40086. el.classList.remove(cls);
  40087. }
  40088. if (!el.classList.length) {
  40089. el.removeAttribute('class');
  40090. }
  40091. } else {
  40092. var cur = " " + (el.getAttribute('class') || '') + " ";
  40093. var tar = ' ' + cls + ' ';
  40094. while (cur.indexOf(tar) >= 0) {
  40095. cur = cur.replace(tar, ' ');
  40096. }
  40097. cur = cur.trim();
  40098. if (cur) {
  40099. el.setAttribute('class', cur);
  40100. } else {
  40101. el.removeAttribute('class');
  40102. }
  40103. }
  40104. }
  40105. /* */
  40106. function resolveTransition (def$$1) {
  40107. if (!def$$1) {
  40108. return
  40109. }
  40110. /* istanbul ignore else */
  40111. if (typeof def$$1 === 'object') {
  40112. var res = {};
  40113. if (def$$1.css !== false) {
  40114. extend(res, autoCssTransition(def$$1.name || 'v'));
  40115. }
  40116. extend(res, def$$1);
  40117. return res
  40118. } else if (typeof def$$1 === 'string') {
  40119. return autoCssTransition(def$$1)
  40120. }
  40121. }
  40122. var autoCssTransition = cached(function (name) {
  40123. return {
  40124. enterClass: (name + "-enter"),
  40125. enterToClass: (name + "-enter-to"),
  40126. enterActiveClass: (name + "-enter-active"),
  40127. leaveClass: (name + "-leave"),
  40128. leaveToClass: (name + "-leave-to"),
  40129. leaveActiveClass: (name + "-leave-active")
  40130. }
  40131. });
  40132. var hasTransition = inBrowser && !isIE9;
  40133. var TRANSITION = 'transition';
  40134. var ANIMATION = 'animation';
  40135. // Transition property/event sniffing
  40136. var transitionProp = 'transition';
  40137. var transitionEndEvent = 'transitionend';
  40138. var animationProp = 'animation';
  40139. var animationEndEvent = 'animationend';
  40140. if (hasTransition) {
  40141. /* istanbul ignore if */
  40142. if (window.ontransitionend === undefined &&
  40143. window.onwebkittransitionend !== undefined
  40144. ) {
  40145. transitionProp = 'WebkitTransition';
  40146. transitionEndEvent = 'webkitTransitionEnd';
  40147. }
  40148. if (window.onanimationend === undefined &&
  40149. window.onwebkitanimationend !== undefined
  40150. ) {
  40151. animationProp = 'WebkitAnimation';
  40152. animationEndEvent = 'webkitAnimationEnd';
  40153. }
  40154. }
  40155. // binding to window is necessary to make hot reload work in IE in strict mode
  40156. var raf = inBrowser
  40157. ? window.requestAnimationFrame
  40158. ? window.requestAnimationFrame.bind(window)
  40159. : setTimeout
  40160. : /* istanbul ignore next */ function (fn) { return fn(); };
  40161. function nextFrame (fn) {
  40162. raf(function () {
  40163. raf(fn);
  40164. });
  40165. }
  40166. function addTransitionClass (el, cls) {
  40167. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  40168. if (transitionClasses.indexOf(cls) < 0) {
  40169. transitionClasses.push(cls);
  40170. addClass(el, cls);
  40171. }
  40172. }
  40173. function removeTransitionClass (el, cls) {
  40174. if (el._transitionClasses) {
  40175. remove(el._transitionClasses, cls);
  40176. }
  40177. removeClass(el, cls);
  40178. }
  40179. function whenTransitionEnds (
  40180. el,
  40181. expectedType,
  40182. cb
  40183. ) {
  40184. var ref = getTransitionInfo(el, expectedType);
  40185. var type = ref.type;
  40186. var timeout = ref.timeout;
  40187. var propCount = ref.propCount;
  40188. if (!type) { return cb() }
  40189. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  40190. var ended = 0;
  40191. var end = function () {
  40192. el.removeEventListener(event, onEnd);
  40193. cb();
  40194. };
  40195. var onEnd = function (e) {
  40196. if (e.target === el) {
  40197. if (++ended >= propCount) {
  40198. end();
  40199. }
  40200. }
  40201. };
  40202. setTimeout(function () {
  40203. if (ended < propCount) {
  40204. end();
  40205. }
  40206. }, timeout + 1);
  40207. el.addEventListener(event, onEnd);
  40208. }
  40209. var transformRE = /\b(transform|all)(,|$)/;
  40210. function getTransitionInfo (el, expectedType) {
  40211. var styles = window.getComputedStyle(el);
  40212. // JSDOM may return undefined for transition properties
  40213. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  40214. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  40215. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  40216. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  40217. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  40218. var animationTimeout = getTimeout(animationDelays, animationDurations);
  40219. var type;
  40220. var timeout = 0;
  40221. var propCount = 0;
  40222. /* istanbul ignore if */
  40223. if (expectedType === TRANSITION) {
  40224. if (transitionTimeout > 0) {
  40225. type = TRANSITION;
  40226. timeout = transitionTimeout;
  40227. propCount = transitionDurations.length;
  40228. }
  40229. } else if (expectedType === ANIMATION) {
  40230. if (animationTimeout > 0) {
  40231. type = ANIMATION;
  40232. timeout = animationTimeout;
  40233. propCount = animationDurations.length;
  40234. }
  40235. } else {
  40236. timeout = Math.max(transitionTimeout, animationTimeout);
  40237. type = timeout > 0
  40238. ? transitionTimeout > animationTimeout
  40239. ? TRANSITION
  40240. : ANIMATION
  40241. : null;
  40242. propCount = type
  40243. ? type === TRANSITION
  40244. ? transitionDurations.length
  40245. : animationDurations.length
  40246. : 0;
  40247. }
  40248. var hasTransform =
  40249. type === TRANSITION &&
  40250. transformRE.test(styles[transitionProp + 'Property']);
  40251. return {
  40252. type: type,
  40253. timeout: timeout,
  40254. propCount: propCount,
  40255. hasTransform: hasTransform
  40256. }
  40257. }
  40258. function getTimeout (delays, durations) {
  40259. /* istanbul ignore next */
  40260. while (delays.length < durations.length) {
  40261. delays = delays.concat(delays);
  40262. }
  40263. return Math.max.apply(null, durations.map(function (d, i) {
  40264. return toMs(d) + toMs(delays[i])
  40265. }))
  40266. }
  40267. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  40268. // in a locale-dependent way, using a comma instead of a dot.
  40269. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  40270. // as a floor function) causing unexpected behaviors
  40271. function toMs (s) {
  40272. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  40273. }
  40274. /* */
  40275. function enter (vnode, toggleDisplay) {
  40276. var el = vnode.elm;
  40277. // call leave callback now
  40278. if (isDef(el._leaveCb)) {
  40279. el._leaveCb.cancelled = true;
  40280. el._leaveCb();
  40281. }
  40282. var data = resolveTransition(vnode.data.transition);
  40283. if (isUndef(data)) {
  40284. return
  40285. }
  40286. /* istanbul ignore if */
  40287. if (isDef(el._enterCb) || el.nodeType !== 1) {
  40288. return
  40289. }
  40290. var css = data.css;
  40291. var type = data.type;
  40292. var enterClass = data.enterClass;
  40293. var enterToClass = data.enterToClass;
  40294. var enterActiveClass = data.enterActiveClass;
  40295. var appearClass = data.appearClass;
  40296. var appearToClass = data.appearToClass;
  40297. var appearActiveClass = data.appearActiveClass;
  40298. var beforeEnter = data.beforeEnter;
  40299. var enter = data.enter;
  40300. var afterEnter = data.afterEnter;
  40301. var enterCancelled = data.enterCancelled;
  40302. var beforeAppear = data.beforeAppear;
  40303. var appear = data.appear;
  40304. var afterAppear = data.afterAppear;
  40305. var appearCancelled = data.appearCancelled;
  40306. var duration = data.duration;
  40307. // activeInstance will always be the <transition> component managing this
  40308. // transition. One edge case to check is when the <transition> is placed
  40309. // as the root node of a child component. In that case we need to check
  40310. // <transition>'s parent for appear check.
  40311. var context = activeInstance;
  40312. var transitionNode = activeInstance.$vnode;
  40313. while (transitionNode && transitionNode.parent) {
  40314. context = transitionNode.context;
  40315. transitionNode = transitionNode.parent;
  40316. }
  40317. var isAppear = !context._isMounted || !vnode.isRootInsert;
  40318. if (isAppear && !appear && appear !== '') {
  40319. return
  40320. }
  40321. var startClass = isAppear && appearClass
  40322. ? appearClass
  40323. : enterClass;
  40324. var activeClass = isAppear && appearActiveClass
  40325. ? appearActiveClass
  40326. : enterActiveClass;
  40327. var toClass = isAppear && appearToClass
  40328. ? appearToClass
  40329. : enterToClass;
  40330. var beforeEnterHook = isAppear
  40331. ? (beforeAppear || beforeEnter)
  40332. : beforeEnter;
  40333. var enterHook = isAppear
  40334. ? (typeof appear === 'function' ? appear : enter)
  40335. : enter;
  40336. var afterEnterHook = isAppear
  40337. ? (afterAppear || afterEnter)
  40338. : afterEnter;
  40339. var enterCancelledHook = isAppear
  40340. ? (appearCancelled || enterCancelled)
  40341. : enterCancelled;
  40342. var explicitEnterDuration = toNumber(
  40343. isObject(duration)
  40344. ? duration.enter
  40345. : duration
  40346. );
  40347. if (explicitEnterDuration != null) {
  40348. checkDuration(explicitEnterDuration, 'enter', vnode);
  40349. }
  40350. var expectsCSS = css !== false && !isIE9;
  40351. var userWantsControl = getHookArgumentsLength(enterHook);
  40352. var cb = el._enterCb = once(function () {
  40353. if (expectsCSS) {
  40354. removeTransitionClass(el, toClass);
  40355. removeTransitionClass(el, activeClass);
  40356. }
  40357. if (cb.cancelled) {
  40358. if (expectsCSS) {
  40359. removeTransitionClass(el, startClass);
  40360. }
  40361. enterCancelledHook && enterCancelledHook(el);
  40362. } else {
  40363. afterEnterHook && afterEnterHook(el);
  40364. }
  40365. el._enterCb = null;
  40366. });
  40367. if (!vnode.data.show) {
  40368. // remove pending leave element on enter by injecting an insert hook
  40369. mergeVNodeHook(vnode, 'insert', function () {
  40370. var parent = el.parentNode;
  40371. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  40372. if (pendingNode &&
  40373. pendingNode.tag === vnode.tag &&
  40374. pendingNode.elm._leaveCb
  40375. ) {
  40376. pendingNode.elm._leaveCb();
  40377. }
  40378. enterHook && enterHook(el, cb);
  40379. });
  40380. }
  40381. // start enter transition
  40382. beforeEnterHook && beforeEnterHook(el);
  40383. if (expectsCSS) {
  40384. addTransitionClass(el, startClass);
  40385. addTransitionClass(el, activeClass);
  40386. nextFrame(function () {
  40387. removeTransitionClass(el, startClass);
  40388. if (!cb.cancelled) {
  40389. addTransitionClass(el, toClass);
  40390. if (!userWantsControl) {
  40391. if (isValidDuration(explicitEnterDuration)) {
  40392. setTimeout(cb, explicitEnterDuration);
  40393. } else {
  40394. whenTransitionEnds(el, type, cb);
  40395. }
  40396. }
  40397. }
  40398. });
  40399. }
  40400. if (vnode.data.show) {
  40401. toggleDisplay && toggleDisplay();
  40402. enterHook && enterHook(el, cb);
  40403. }
  40404. if (!expectsCSS && !userWantsControl) {
  40405. cb();
  40406. }
  40407. }
  40408. function leave (vnode, rm) {
  40409. var el = vnode.elm;
  40410. // call enter callback now
  40411. if (isDef(el._enterCb)) {
  40412. el._enterCb.cancelled = true;
  40413. el._enterCb();
  40414. }
  40415. var data = resolveTransition(vnode.data.transition);
  40416. if (isUndef(data) || el.nodeType !== 1) {
  40417. return rm()
  40418. }
  40419. /* istanbul ignore if */
  40420. if (isDef(el._leaveCb)) {
  40421. return
  40422. }
  40423. var css = data.css;
  40424. var type = data.type;
  40425. var leaveClass = data.leaveClass;
  40426. var leaveToClass = data.leaveToClass;
  40427. var leaveActiveClass = data.leaveActiveClass;
  40428. var beforeLeave = data.beforeLeave;
  40429. var leave = data.leave;
  40430. var afterLeave = data.afterLeave;
  40431. var leaveCancelled = data.leaveCancelled;
  40432. var delayLeave = data.delayLeave;
  40433. var duration = data.duration;
  40434. var expectsCSS = css !== false && !isIE9;
  40435. var userWantsControl = getHookArgumentsLength(leave);
  40436. var explicitLeaveDuration = toNumber(
  40437. isObject(duration)
  40438. ? duration.leave
  40439. : duration
  40440. );
  40441. if (isDef(explicitLeaveDuration)) {
  40442. checkDuration(explicitLeaveDuration, 'leave', vnode);
  40443. }
  40444. var cb = el._leaveCb = once(function () {
  40445. if (el.parentNode && el.parentNode._pending) {
  40446. el.parentNode._pending[vnode.key] = null;
  40447. }
  40448. if (expectsCSS) {
  40449. removeTransitionClass(el, leaveToClass);
  40450. removeTransitionClass(el, leaveActiveClass);
  40451. }
  40452. if (cb.cancelled) {
  40453. if (expectsCSS) {
  40454. removeTransitionClass(el, leaveClass);
  40455. }
  40456. leaveCancelled && leaveCancelled(el);
  40457. } else {
  40458. rm();
  40459. afterLeave && afterLeave(el);
  40460. }
  40461. el._leaveCb = null;
  40462. });
  40463. if (delayLeave) {
  40464. delayLeave(performLeave);
  40465. } else {
  40466. performLeave();
  40467. }
  40468. function performLeave () {
  40469. // the delayed leave may have already been cancelled
  40470. if (cb.cancelled) {
  40471. return
  40472. }
  40473. // record leaving element
  40474. if (!vnode.data.show && el.parentNode) {
  40475. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  40476. }
  40477. beforeLeave && beforeLeave(el);
  40478. if (expectsCSS) {
  40479. addTransitionClass(el, leaveClass);
  40480. addTransitionClass(el, leaveActiveClass);
  40481. nextFrame(function () {
  40482. removeTransitionClass(el, leaveClass);
  40483. if (!cb.cancelled) {
  40484. addTransitionClass(el, leaveToClass);
  40485. if (!userWantsControl) {
  40486. if (isValidDuration(explicitLeaveDuration)) {
  40487. setTimeout(cb, explicitLeaveDuration);
  40488. } else {
  40489. whenTransitionEnds(el, type, cb);
  40490. }
  40491. }
  40492. }
  40493. });
  40494. }
  40495. leave && leave(el, cb);
  40496. if (!expectsCSS && !userWantsControl) {
  40497. cb();
  40498. }
  40499. }
  40500. }
  40501. // only used in dev mode
  40502. function checkDuration (val, name, vnode) {
  40503. if (typeof val !== 'number') {
  40504. warn(
  40505. "<transition> explicit " + name + " duration is not a valid number - " +
  40506. "got " + (JSON.stringify(val)) + ".",
  40507. vnode.context
  40508. );
  40509. } else if (isNaN(val)) {
  40510. warn(
  40511. "<transition> explicit " + name + " duration is NaN - " +
  40512. 'the duration expression might be incorrect.',
  40513. vnode.context
  40514. );
  40515. }
  40516. }
  40517. function isValidDuration (val) {
  40518. return typeof val === 'number' && !isNaN(val)
  40519. }
  40520. /**
  40521. * Normalize a transition hook's argument length. The hook may be:
  40522. * - a merged hook (invoker) with the original in .fns
  40523. * - a wrapped component method (check ._length)
  40524. * - a plain function (.length)
  40525. */
  40526. function getHookArgumentsLength (fn) {
  40527. if (isUndef(fn)) {
  40528. return false
  40529. }
  40530. var invokerFns = fn.fns;
  40531. if (isDef(invokerFns)) {
  40532. // invoker
  40533. return getHookArgumentsLength(
  40534. Array.isArray(invokerFns)
  40535. ? invokerFns[0]
  40536. : invokerFns
  40537. )
  40538. } else {
  40539. return (fn._length || fn.length) > 1
  40540. }
  40541. }
  40542. function _enter (_, vnode) {
  40543. if (vnode.data.show !== true) {
  40544. enter(vnode);
  40545. }
  40546. }
  40547. var transition = inBrowser ? {
  40548. create: _enter,
  40549. activate: _enter,
  40550. remove: function remove$$1 (vnode, rm) {
  40551. /* istanbul ignore else */
  40552. if (vnode.data.show !== true) {
  40553. leave(vnode, rm);
  40554. } else {
  40555. rm();
  40556. }
  40557. }
  40558. } : {};
  40559. var platformModules = [
  40560. attrs,
  40561. klass,
  40562. events,
  40563. domProps,
  40564. style,
  40565. transition
  40566. ];
  40567. /* */
  40568. // the directive module should be applied last, after all
  40569. // built-in modules have been applied.
  40570. var modules = platformModules.concat(baseModules);
  40571. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  40572. /**
  40573. * Not type checking this file because flow doesn't like attaching
  40574. * properties to Elements.
  40575. */
  40576. /* istanbul ignore if */
  40577. if (isIE9) {
  40578. // http://www.matts411.com/post/internet-explorer-9-oninput/
  40579. document.addEventListener('selectionchange', function () {
  40580. var el = document.activeElement;
  40581. if (el && el.vmodel) {
  40582. trigger(el, 'input');
  40583. }
  40584. });
  40585. }
  40586. var directive = {
  40587. inserted: function inserted (el, binding, vnode, oldVnode) {
  40588. if (vnode.tag === 'select') {
  40589. // #6903
  40590. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  40591. mergeVNodeHook(vnode, 'postpatch', function () {
  40592. directive.componentUpdated(el, binding, vnode);
  40593. });
  40594. } else {
  40595. setSelected(el, binding, vnode.context);
  40596. }
  40597. el._vOptions = [].map.call(el.options, getValue);
  40598. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  40599. el._vModifiers = binding.modifiers;
  40600. if (!binding.modifiers.lazy) {
  40601. el.addEventListener('compositionstart', onCompositionStart);
  40602. el.addEventListener('compositionend', onCompositionEnd);
  40603. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  40604. // switching focus before confirming composition choice
  40605. // this also fixes the issue where some browsers e.g. iOS Chrome
  40606. // fires "change" instead of "input" on autocomplete.
  40607. el.addEventListener('change', onCompositionEnd);
  40608. /* istanbul ignore if */
  40609. if (isIE9) {
  40610. el.vmodel = true;
  40611. }
  40612. }
  40613. }
  40614. },
  40615. componentUpdated: function componentUpdated (el, binding, vnode) {
  40616. if (vnode.tag === 'select') {
  40617. setSelected(el, binding, vnode.context);
  40618. // in case the options rendered by v-for have changed,
  40619. // it's possible that the value is out-of-sync with the rendered options.
  40620. // detect such cases and filter out values that no longer has a matching
  40621. // option in the DOM.
  40622. var prevOptions = el._vOptions;
  40623. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  40624. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  40625. // trigger change event if
  40626. // no matching option found for at least one value
  40627. var needReset = el.multiple
  40628. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  40629. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  40630. if (needReset) {
  40631. trigger(el, 'change');
  40632. }
  40633. }
  40634. }
  40635. }
  40636. };
  40637. function setSelected (el, binding, vm) {
  40638. actuallySetSelected(el, binding, vm);
  40639. /* istanbul ignore if */
  40640. if (isIE || isEdge) {
  40641. setTimeout(function () {
  40642. actuallySetSelected(el, binding, vm);
  40643. }, 0);
  40644. }
  40645. }
  40646. function actuallySetSelected (el, binding, vm) {
  40647. var value = binding.value;
  40648. var isMultiple = el.multiple;
  40649. if (isMultiple && !Array.isArray(value)) {
  40650. warn(
  40651. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  40652. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  40653. vm
  40654. );
  40655. return
  40656. }
  40657. var selected, option;
  40658. for (var i = 0, l = el.options.length; i < l; i++) {
  40659. option = el.options[i];
  40660. if (isMultiple) {
  40661. selected = looseIndexOf(value, getValue(option)) > -1;
  40662. if (option.selected !== selected) {
  40663. option.selected = selected;
  40664. }
  40665. } else {
  40666. if (looseEqual(getValue(option), value)) {
  40667. if (el.selectedIndex !== i) {
  40668. el.selectedIndex = i;
  40669. }
  40670. return
  40671. }
  40672. }
  40673. }
  40674. if (!isMultiple) {
  40675. el.selectedIndex = -1;
  40676. }
  40677. }
  40678. function hasNoMatchingOption (value, options) {
  40679. return options.every(function (o) { return !looseEqual(o, value); })
  40680. }
  40681. function getValue (option) {
  40682. return '_value' in option
  40683. ? option._value
  40684. : option.value
  40685. }
  40686. function onCompositionStart (e) {
  40687. e.target.composing = true;
  40688. }
  40689. function onCompositionEnd (e) {
  40690. // prevent triggering an input event for no reason
  40691. if (!e.target.composing) { return }
  40692. e.target.composing = false;
  40693. trigger(e.target, 'input');
  40694. }
  40695. function trigger (el, type) {
  40696. var e = document.createEvent('HTMLEvents');
  40697. e.initEvent(type, true, true);
  40698. el.dispatchEvent(e);
  40699. }
  40700. /* */
  40701. // recursively search for possible transition defined inside the component root
  40702. function locateNode (vnode) {
  40703. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  40704. ? locateNode(vnode.componentInstance._vnode)
  40705. : vnode
  40706. }
  40707. var show = {
  40708. bind: function bind (el, ref, vnode) {
  40709. var value = ref.value;
  40710. vnode = locateNode(vnode);
  40711. var transition$$1 = vnode.data && vnode.data.transition;
  40712. var originalDisplay = el.__vOriginalDisplay =
  40713. el.style.display === 'none' ? '' : el.style.display;
  40714. if (value && transition$$1) {
  40715. vnode.data.show = true;
  40716. enter(vnode, function () {
  40717. el.style.display = originalDisplay;
  40718. });
  40719. } else {
  40720. el.style.display = value ? originalDisplay : 'none';
  40721. }
  40722. },
  40723. update: function update (el, ref, vnode) {
  40724. var value = ref.value;
  40725. var oldValue = ref.oldValue;
  40726. /* istanbul ignore if */
  40727. if (!value === !oldValue) { return }
  40728. vnode = locateNode(vnode);
  40729. var transition$$1 = vnode.data && vnode.data.transition;
  40730. if (transition$$1) {
  40731. vnode.data.show = true;
  40732. if (value) {
  40733. enter(vnode, function () {
  40734. el.style.display = el.__vOriginalDisplay;
  40735. });
  40736. } else {
  40737. leave(vnode, function () {
  40738. el.style.display = 'none';
  40739. });
  40740. }
  40741. } else {
  40742. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40743. }
  40744. },
  40745. unbind: function unbind (
  40746. el,
  40747. binding,
  40748. vnode,
  40749. oldVnode,
  40750. isDestroy
  40751. ) {
  40752. if (!isDestroy) {
  40753. el.style.display = el.__vOriginalDisplay;
  40754. }
  40755. }
  40756. };
  40757. var platformDirectives = {
  40758. model: directive,
  40759. show: show
  40760. };
  40761. /* */
  40762. var transitionProps = {
  40763. name: String,
  40764. appear: Boolean,
  40765. css: Boolean,
  40766. mode: String,
  40767. type: String,
  40768. enterClass: String,
  40769. leaveClass: String,
  40770. enterToClass: String,
  40771. leaveToClass: String,
  40772. enterActiveClass: String,
  40773. leaveActiveClass: String,
  40774. appearClass: String,
  40775. appearActiveClass: String,
  40776. appearToClass: String,
  40777. duration: [Number, String, Object]
  40778. };
  40779. // in case the child is also an abstract component, e.g. <keep-alive>
  40780. // we want to recursively retrieve the real component to be rendered
  40781. function getRealChild (vnode) {
  40782. var compOptions = vnode && vnode.componentOptions;
  40783. if (compOptions && compOptions.Ctor.options.abstract) {
  40784. return getRealChild(getFirstComponentChild(compOptions.children))
  40785. } else {
  40786. return vnode
  40787. }
  40788. }
  40789. function extractTransitionData (comp) {
  40790. var data = {};
  40791. var options = comp.$options;
  40792. // props
  40793. for (var key in options.propsData) {
  40794. data[key] = comp[key];
  40795. }
  40796. // events.
  40797. // extract listeners and pass them directly to the transition methods
  40798. var listeners = options._parentListeners;
  40799. for (var key$1 in listeners) {
  40800. data[camelize(key$1)] = listeners[key$1];
  40801. }
  40802. return data
  40803. }
  40804. function placeholder (h, rawChild) {
  40805. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40806. return h('keep-alive', {
  40807. props: rawChild.componentOptions.propsData
  40808. })
  40809. }
  40810. }
  40811. function hasParentTransition (vnode) {
  40812. while ((vnode = vnode.parent)) {
  40813. if (vnode.data.transition) {
  40814. return true
  40815. }
  40816. }
  40817. }
  40818. function isSameChild (child, oldChild) {
  40819. return oldChild.key === child.key && oldChild.tag === child.tag
  40820. }
  40821. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40822. var isVShowDirective = function (d) { return d.name === 'show'; };
  40823. var Transition = {
  40824. name: 'transition',
  40825. props: transitionProps,
  40826. abstract: true,
  40827. render: function render (h) {
  40828. var this$1 = this;
  40829. var children = this.$slots.default;
  40830. if (!children) {
  40831. return
  40832. }
  40833. // filter out text nodes (possible whitespaces)
  40834. children = children.filter(isNotTextNode);
  40835. /* istanbul ignore if */
  40836. if (!children.length) {
  40837. return
  40838. }
  40839. // warn multiple elements
  40840. if (children.length > 1) {
  40841. warn(
  40842. '<transition> can only be used on a single element. Use ' +
  40843. '<transition-group> for lists.',
  40844. this.$parent
  40845. );
  40846. }
  40847. var mode = this.mode;
  40848. // warn invalid mode
  40849. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40850. ) {
  40851. warn(
  40852. 'invalid <transition> mode: ' + mode,
  40853. this.$parent
  40854. );
  40855. }
  40856. var rawChild = children[0];
  40857. // if this is a component root node and the component's
  40858. // parent container node also has transition, skip.
  40859. if (hasParentTransition(this.$vnode)) {
  40860. return rawChild
  40861. }
  40862. // apply transition data to child
  40863. // use getRealChild() to ignore abstract components e.g. keep-alive
  40864. var child = getRealChild(rawChild);
  40865. /* istanbul ignore if */
  40866. if (!child) {
  40867. return rawChild
  40868. }
  40869. if (this._leaving) {
  40870. return placeholder(h, rawChild)
  40871. }
  40872. // ensure a key that is unique to the vnode type and to this transition
  40873. // component instance. This key will be used to remove pending leaving nodes
  40874. // during entering.
  40875. var id = "__transition-" + (this._uid) + "-";
  40876. child.key = child.key == null
  40877. ? child.isComment
  40878. ? id + 'comment'
  40879. : id + child.tag
  40880. : isPrimitive(child.key)
  40881. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40882. : child.key;
  40883. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40884. var oldRawChild = this._vnode;
  40885. var oldChild = getRealChild(oldRawChild);
  40886. // mark v-show
  40887. // so that the transition module can hand over the control to the directive
  40888. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40889. child.data.show = true;
  40890. }
  40891. if (
  40892. oldChild &&
  40893. oldChild.data &&
  40894. !isSameChild(child, oldChild) &&
  40895. !isAsyncPlaceholder(oldChild) &&
  40896. // #6687 component root is a comment node
  40897. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40898. ) {
  40899. // replace old child transition data with fresh one
  40900. // important for dynamic transitions!
  40901. var oldData = oldChild.data.transition = extend({}, data);
  40902. // handle transition mode
  40903. if (mode === 'out-in') {
  40904. // return placeholder node and queue update when leave finishes
  40905. this._leaving = true;
  40906. mergeVNodeHook(oldData, 'afterLeave', function () {
  40907. this$1._leaving = false;
  40908. this$1.$forceUpdate();
  40909. });
  40910. return placeholder(h, rawChild)
  40911. } else if (mode === 'in-out') {
  40912. if (isAsyncPlaceholder(child)) {
  40913. return oldRawChild
  40914. }
  40915. var delayedLeave;
  40916. var performLeave = function () { delayedLeave(); };
  40917. mergeVNodeHook(data, 'afterEnter', performLeave);
  40918. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40919. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40920. }
  40921. }
  40922. return rawChild
  40923. }
  40924. };
  40925. /* */
  40926. var props = extend({
  40927. tag: String,
  40928. moveClass: String
  40929. }, transitionProps);
  40930. delete props.mode;
  40931. var TransitionGroup = {
  40932. props: props,
  40933. beforeMount: function beforeMount () {
  40934. var this$1 = this;
  40935. var update = this._update;
  40936. this._update = function (vnode, hydrating) {
  40937. var restoreActiveInstance = setActiveInstance(this$1);
  40938. // force removing pass
  40939. this$1.__patch__(
  40940. this$1._vnode,
  40941. this$1.kept,
  40942. false, // hydrating
  40943. true // removeOnly (!important, avoids unnecessary moves)
  40944. );
  40945. this$1._vnode = this$1.kept;
  40946. restoreActiveInstance();
  40947. update.call(this$1, vnode, hydrating);
  40948. };
  40949. },
  40950. render: function render (h) {
  40951. var tag = this.tag || this.$vnode.data.tag || 'span';
  40952. var map = Object.create(null);
  40953. var prevChildren = this.prevChildren = this.children;
  40954. var rawChildren = this.$slots.default || [];
  40955. var children = this.children = [];
  40956. var transitionData = extractTransitionData(this);
  40957. for (var i = 0; i < rawChildren.length; i++) {
  40958. var c = rawChildren[i];
  40959. if (c.tag) {
  40960. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40961. children.push(c);
  40962. map[c.key] = c
  40963. ;(c.data || (c.data = {})).transition = transitionData;
  40964. } else {
  40965. var opts = c.componentOptions;
  40966. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40967. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40968. }
  40969. }
  40970. }
  40971. if (prevChildren) {
  40972. var kept = [];
  40973. var removed = [];
  40974. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40975. var c$1 = prevChildren[i$1];
  40976. c$1.data.transition = transitionData;
  40977. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40978. if (map[c$1.key]) {
  40979. kept.push(c$1);
  40980. } else {
  40981. removed.push(c$1);
  40982. }
  40983. }
  40984. this.kept = h(tag, null, kept);
  40985. this.removed = removed;
  40986. }
  40987. return h(tag, null, children)
  40988. },
  40989. updated: function updated () {
  40990. var children = this.prevChildren;
  40991. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40992. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40993. return
  40994. }
  40995. // we divide the work into three loops to avoid mixing DOM reads and writes
  40996. // in each iteration - which helps prevent layout thrashing.
  40997. children.forEach(callPendingCbs);
  40998. children.forEach(recordPosition);
  40999. children.forEach(applyTranslation);
  41000. // force reflow to put everything in position
  41001. // assign to this to avoid being removed in tree-shaking
  41002. // $flow-disable-line
  41003. this._reflow = document.body.offsetHeight;
  41004. children.forEach(function (c) {
  41005. if (c.data.moved) {
  41006. var el = c.elm;
  41007. var s = el.style;
  41008. addTransitionClass(el, moveClass);
  41009. s.transform = s.WebkitTransform = s.transitionDuration = '';
  41010. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  41011. if (e && e.target !== el) {
  41012. return
  41013. }
  41014. if (!e || /transform$/.test(e.propertyName)) {
  41015. el.removeEventListener(transitionEndEvent, cb);
  41016. el._moveCb = null;
  41017. removeTransitionClass(el, moveClass);
  41018. }
  41019. });
  41020. }
  41021. });
  41022. },
  41023. methods: {
  41024. hasMove: function hasMove (el, moveClass) {
  41025. /* istanbul ignore if */
  41026. if (!hasTransition) {
  41027. return false
  41028. }
  41029. /* istanbul ignore if */
  41030. if (this._hasMove) {
  41031. return this._hasMove
  41032. }
  41033. // Detect whether an element with the move class applied has
  41034. // CSS transitions. Since the element may be inside an entering
  41035. // transition at this very moment, we make a clone of it and remove
  41036. // all other transition classes applied to ensure only the move class
  41037. // is applied.
  41038. var clone = el.cloneNode();
  41039. if (el._transitionClasses) {
  41040. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  41041. }
  41042. addClass(clone, moveClass);
  41043. clone.style.display = 'none';
  41044. this.$el.appendChild(clone);
  41045. var info = getTransitionInfo(clone);
  41046. this.$el.removeChild(clone);
  41047. return (this._hasMove = info.hasTransform)
  41048. }
  41049. }
  41050. };
  41051. function callPendingCbs (c) {
  41052. /* istanbul ignore if */
  41053. if (c.elm._moveCb) {
  41054. c.elm._moveCb();
  41055. }
  41056. /* istanbul ignore if */
  41057. if (c.elm._enterCb) {
  41058. c.elm._enterCb();
  41059. }
  41060. }
  41061. function recordPosition (c) {
  41062. c.data.newPos = c.elm.getBoundingClientRect();
  41063. }
  41064. function applyTranslation (c) {
  41065. var oldPos = c.data.pos;
  41066. var newPos = c.data.newPos;
  41067. var dx = oldPos.left - newPos.left;
  41068. var dy = oldPos.top - newPos.top;
  41069. if (dx || dy) {
  41070. c.data.moved = true;
  41071. var s = c.elm.style;
  41072. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  41073. s.transitionDuration = '0s';
  41074. }
  41075. }
  41076. var platformComponents = {
  41077. Transition: Transition,
  41078. TransitionGroup: TransitionGroup
  41079. };
  41080. /* */
  41081. // install platform specific utils
  41082. Vue.config.mustUseProp = mustUseProp;
  41083. Vue.config.isReservedTag = isReservedTag;
  41084. Vue.config.isReservedAttr = isReservedAttr;
  41085. Vue.config.getTagNamespace = getTagNamespace;
  41086. Vue.config.isUnknownElement = isUnknownElement;
  41087. // install platform runtime directives & components
  41088. extend(Vue.options.directives, platformDirectives);
  41089. extend(Vue.options.components, platformComponents);
  41090. // install platform patch function
  41091. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  41092. // public mount method
  41093. Vue.prototype.$mount = function (
  41094. el,
  41095. hydrating
  41096. ) {
  41097. el = el && inBrowser ? query(el) : undefined;
  41098. return mountComponent(this, el, hydrating)
  41099. };
  41100. // devtools global hook
  41101. /* istanbul ignore next */
  41102. if (inBrowser) {
  41103. setTimeout(function () {
  41104. if (config.devtools) {
  41105. if (devtools) {
  41106. devtools.emit('init', Vue);
  41107. } else {
  41108. console[console.info ? 'info' : 'log'](
  41109. 'Download the Vue Devtools extension for a better development experience:\n' +
  41110. 'https://github.com/vuejs/vue-devtools'
  41111. );
  41112. }
  41113. }
  41114. if (config.productionTip !== false &&
  41115. typeof console !== 'undefined'
  41116. ) {
  41117. console[console.info ? 'info' : 'log'](
  41118. "You are running Vue in development mode.\n" +
  41119. "Make sure to turn on production mode when deploying for production.\n" +
  41120. "See more tips at https://vuejs.org/guide/deployment.html"
  41121. );
  41122. }
  41123. }, 0);
  41124. }
  41125. /* */
  41126. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  41127. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  41128. var buildRegex = cached(function (delimiters) {
  41129. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  41130. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  41131. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  41132. });
  41133. function parseText (
  41134. text,
  41135. delimiters
  41136. ) {
  41137. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  41138. if (!tagRE.test(text)) {
  41139. return
  41140. }
  41141. var tokens = [];
  41142. var rawTokens = [];
  41143. var lastIndex = tagRE.lastIndex = 0;
  41144. var match, index, tokenValue;
  41145. while ((match = tagRE.exec(text))) {
  41146. index = match.index;
  41147. // push text token
  41148. if (index > lastIndex) {
  41149. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  41150. tokens.push(JSON.stringify(tokenValue));
  41151. }
  41152. // tag token
  41153. var exp = parseFilters(match[1].trim());
  41154. tokens.push(("_s(" + exp + ")"));
  41155. rawTokens.push({ '@binding': exp });
  41156. lastIndex = index + match[0].length;
  41157. }
  41158. if (lastIndex < text.length) {
  41159. rawTokens.push(tokenValue = text.slice(lastIndex));
  41160. tokens.push(JSON.stringify(tokenValue));
  41161. }
  41162. return {
  41163. expression: tokens.join('+'),
  41164. tokens: rawTokens
  41165. }
  41166. }
  41167. /* */
  41168. function transformNode (el, options) {
  41169. var warn = options.warn || baseWarn;
  41170. var staticClass = getAndRemoveAttr(el, 'class');
  41171. if (staticClass) {
  41172. var res = parseText(staticClass, options.delimiters);
  41173. if (res) {
  41174. warn(
  41175. "class=\"" + staticClass + "\": " +
  41176. 'Interpolation inside attributes has been removed. ' +
  41177. 'Use v-bind or the colon shorthand instead. For example, ' +
  41178. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  41179. el.rawAttrsMap['class']
  41180. );
  41181. }
  41182. }
  41183. if (staticClass) {
  41184. el.staticClass = JSON.stringify(staticClass);
  41185. }
  41186. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  41187. if (classBinding) {
  41188. el.classBinding = classBinding;
  41189. }
  41190. }
  41191. function genData (el) {
  41192. var data = '';
  41193. if (el.staticClass) {
  41194. data += "staticClass:" + (el.staticClass) + ",";
  41195. }
  41196. if (el.classBinding) {
  41197. data += "class:" + (el.classBinding) + ",";
  41198. }
  41199. return data
  41200. }
  41201. var klass$1 = {
  41202. staticKeys: ['staticClass'],
  41203. transformNode: transformNode,
  41204. genData: genData
  41205. };
  41206. /* */
  41207. function transformNode$1 (el, options) {
  41208. var warn = options.warn || baseWarn;
  41209. var staticStyle = getAndRemoveAttr(el, 'style');
  41210. if (staticStyle) {
  41211. /* istanbul ignore if */
  41212. {
  41213. var res = parseText(staticStyle, options.delimiters);
  41214. if (res) {
  41215. warn(
  41216. "style=\"" + staticStyle + "\": " +
  41217. 'Interpolation inside attributes has been removed. ' +
  41218. 'Use v-bind or the colon shorthand instead. For example, ' +
  41219. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  41220. el.rawAttrsMap['style']
  41221. );
  41222. }
  41223. }
  41224. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  41225. }
  41226. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  41227. if (styleBinding) {
  41228. el.styleBinding = styleBinding;
  41229. }
  41230. }
  41231. function genData$1 (el) {
  41232. var data = '';
  41233. if (el.staticStyle) {
  41234. data += "staticStyle:" + (el.staticStyle) + ",";
  41235. }
  41236. if (el.styleBinding) {
  41237. data += "style:(" + (el.styleBinding) + "),";
  41238. }
  41239. return data
  41240. }
  41241. var style$1 = {
  41242. staticKeys: ['staticStyle'],
  41243. transformNode: transformNode$1,
  41244. genData: genData$1
  41245. };
  41246. /* */
  41247. var decoder;
  41248. var he = {
  41249. decode: function decode (html) {
  41250. decoder = decoder || document.createElement('div');
  41251. decoder.innerHTML = html;
  41252. return decoder.textContent
  41253. }
  41254. };
  41255. /* */
  41256. var isUnaryTag = makeMap(
  41257. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  41258. 'link,meta,param,source,track,wbr'
  41259. );
  41260. // Elements that you can, intentionally, leave open
  41261. // (and which close themselves)
  41262. var canBeLeftOpenTag = makeMap(
  41263. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  41264. );
  41265. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  41266. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  41267. var isNonPhrasingTag = makeMap(
  41268. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  41269. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  41270. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  41271. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  41272. 'title,tr,track'
  41273. );
  41274. /**
  41275. * Not type-checking this file because it's mostly vendor code.
  41276. */
  41277. // Regular Expressions for parsing tags and attributes
  41278. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41279. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41280. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  41281. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  41282. var startTagOpen = new RegExp(("^<" + qnameCapture));
  41283. var startTagClose = /^\s*(\/?)>/;
  41284. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  41285. var doctype = /^<!DOCTYPE [^>]+>/i;
  41286. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  41287. var comment = /^<!\--/;
  41288. var conditionalComment = /^<!\[/;
  41289. // Special Elements (can contain anything)
  41290. var isPlainTextElement = makeMap('script,style,textarea', true);
  41291. var reCache = {};
  41292. var decodingMap = {
  41293. '&lt;': '<',
  41294. '&gt;': '>',
  41295. '&quot;': '"',
  41296. '&amp;': '&',
  41297. '&#10;': '\n',
  41298. '&#9;': '\t',
  41299. '&#39;': "'"
  41300. };
  41301. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  41302. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  41303. // #5992
  41304. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  41305. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  41306. function decodeAttr (value, shouldDecodeNewlines) {
  41307. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  41308. return value.replace(re, function (match) { return decodingMap[match]; })
  41309. }
  41310. function parseHTML (html, options) {
  41311. var stack = [];
  41312. var expectHTML = options.expectHTML;
  41313. var isUnaryTag$$1 = options.isUnaryTag || no;
  41314. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  41315. var index = 0;
  41316. var last, lastTag;
  41317. while (html) {
  41318. last = html;
  41319. // Make sure we're not in a plaintext content element like script/style
  41320. if (!lastTag || !isPlainTextElement(lastTag)) {
  41321. var textEnd = html.indexOf('<');
  41322. if (textEnd === 0) {
  41323. // Comment:
  41324. if (comment.test(html)) {
  41325. var commentEnd = html.indexOf('-->');
  41326. if (commentEnd >= 0) {
  41327. if (options.shouldKeepComment) {
  41328. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  41329. }
  41330. advance(commentEnd + 3);
  41331. continue
  41332. }
  41333. }
  41334. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  41335. if (conditionalComment.test(html)) {
  41336. var conditionalEnd = html.indexOf(']>');
  41337. if (conditionalEnd >= 0) {
  41338. advance(conditionalEnd + 2);
  41339. continue
  41340. }
  41341. }
  41342. // Doctype:
  41343. var doctypeMatch = html.match(doctype);
  41344. if (doctypeMatch) {
  41345. advance(doctypeMatch[0].length);
  41346. continue
  41347. }
  41348. // End tag:
  41349. var endTagMatch = html.match(endTag);
  41350. if (endTagMatch) {
  41351. var curIndex = index;
  41352. advance(endTagMatch[0].length);
  41353. parseEndTag(endTagMatch[1], curIndex, index);
  41354. continue
  41355. }
  41356. // Start tag:
  41357. var startTagMatch = parseStartTag();
  41358. if (startTagMatch) {
  41359. handleStartTag(startTagMatch);
  41360. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  41361. advance(1);
  41362. }
  41363. continue
  41364. }
  41365. }
  41366. var text = (void 0), rest = (void 0), next = (void 0);
  41367. if (textEnd >= 0) {
  41368. rest = html.slice(textEnd);
  41369. while (
  41370. !endTag.test(rest) &&
  41371. !startTagOpen.test(rest) &&
  41372. !comment.test(rest) &&
  41373. !conditionalComment.test(rest)
  41374. ) {
  41375. // < in plain text, be forgiving and treat it as text
  41376. next = rest.indexOf('<', 1);
  41377. if (next < 0) { break }
  41378. textEnd += next;
  41379. rest = html.slice(textEnd);
  41380. }
  41381. text = html.substring(0, textEnd);
  41382. }
  41383. if (textEnd < 0) {
  41384. text = html;
  41385. }
  41386. if (text) {
  41387. advance(text.length);
  41388. }
  41389. if (options.chars && text) {
  41390. options.chars(text, index - text.length, index);
  41391. }
  41392. } else {
  41393. var endTagLength = 0;
  41394. var stackedTag = lastTag.toLowerCase();
  41395. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  41396. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  41397. endTagLength = endTag.length;
  41398. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  41399. text = text
  41400. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  41401. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  41402. }
  41403. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  41404. text = text.slice(1);
  41405. }
  41406. if (options.chars) {
  41407. options.chars(text);
  41408. }
  41409. return ''
  41410. });
  41411. index += html.length - rest$1.length;
  41412. html = rest$1;
  41413. parseEndTag(stackedTag, index - endTagLength, index);
  41414. }
  41415. if (html === last) {
  41416. options.chars && options.chars(html);
  41417. if (!stack.length && options.warn) {
  41418. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  41419. }
  41420. break
  41421. }
  41422. }
  41423. // Clean up any remaining tags
  41424. parseEndTag();
  41425. function advance (n) {
  41426. index += n;
  41427. html = html.substring(n);
  41428. }
  41429. function parseStartTag () {
  41430. var start = html.match(startTagOpen);
  41431. if (start) {
  41432. var match = {
  41433. tagName: start[1],
  41434. attrs: [],
  41435. start: index
  41436. };
  41437. advance(start[0].length);
  41438. var end, attr;
  41439. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  41440. attr.start = index;
  41441. advance(attr[0].length);
  41442. attr.end = index;
  41443. match.attrs.push(attr);
  41444. }
  41445. if (end) {
  41446. match.unarySlash = end[1];
  41447. advance(end[0].length);
  41448. match.end = index;
  41449. return match
  41450. }
  41451. }
  41452. }
  41453. function handleStartTag (match) {
  41454. var tagName = match.tagName;
  41455. var unarySlash = match.unarySlash;
  41456. if (expectHTML) {
  41457. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  41458. parseEndTag(lastTag);
  41459. }
  41460. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  41461. parseEndTag(tagName);
  41462. }
  41463. }
  41464. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  41465. var l = match.attrs.length;
  41466. var attrs = new Array(l);
  41467. for (var i = 0; i < l; i++) {
  41468. var args = match.attrs[i];
  41469. var value = args[3] || args[4] || args[5] || '';
  41470. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  41471. ? options.shouldDecodeNewlinesForHref
  41472. : options.shouldDecodeNewlines;
  41473. attrs[i] = {
  41474. name: args[1],
  41475. value: decodeAttr(value, shouldDecodeNewlines)
  41476. };
  41477. if (options.outputSourceRange) {
  41478. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  41479. attrs[i].end = args.end;
  41480. }
  41481. }
  41482. if (!unary) {
  41483. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  41484. lastTag = tagName;
  41485. }
  41486. if (options.start) {
  41487. options.start(tagName, attrs, unary, match.start, match.end);
  41488. }
  41489. }
  41490. function parseEndTag (tagName, start, end) {
  41491. var pos, lowerCasedTagName;
  41492. if (start == null) { start = index; }
  41493. if (end == null) { end = index; }
  41494. // Find the closest opened tag of the same type
  41495. if (tagName) {
  41496. lowerCasedTagName = tagName.toLowerCase();
  41497. for (pos = stack.length - 1; pos >= 0; pos--) {
  41498. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  41499. break
  41500. }
  41501. }
  41502. } else {
  41503. // If no tag name is provided, clean shop
  41504. pos = 0;
  41505. }
  41506. if (pos >= 0) {
  41507. // Close all the open elements, up the stack
  41508. for (var i = stack.length - 1; i >= pos; i--) {
  41509. if (i > pos || !tagName &&
  41510. options.warn
  41511. ) {
  41512. options.warn(
  41513. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  41514. { start: stack[i].start, end: stack[i].end }
  41515. );
  41516. }
  41517. if (options.end) {
  41518. options.end(stack[i].tag, start, end);
  41519. }
  41520. }
  41521. // Remove the open elements from the stack
  41522. stack.length = pos;
  41523. lastTag = pos && stack[pos - 1].tag;
  41524. } else if (lowerCasedTagName === 'br') {
  41525. if (options.start) {
  41526. options.start(tagName, [], true, start, end);
  41527. }
  41528. } else if (lowerCasedTagName === 'p') {
  41529. if (options.start) {
  41530. options.start(tagName, [], false, start, end);
  41531. }
  41532. if (options.end) {
  41533. options.end(tagName, start, end);
  41534. }
  41535. }
  41536. }
  41537. }
  41538. /* */
  41539. var onRE = /^@|^v-on:/;
  41540. var dirRE = /^v-|^@|^:|^#/;
  41541. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  41542. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  41543. var stripParensRE = /^\(|\)$/g;
  41544. var dynamicArgRE = /^\[.*\]$/;
  41545. var argRE = /:(.*)$/;
  41546. var bindRE = /^:|^\.|^v-bind:/;
  41547. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  41548. var slotRE = /^v-slot(:|$)|^#/;
  41549. var lineBreakRE = /[\r\n]/;
  41550. var whitespaceRE$1 = /\s+/g;
  41551. var invalidAttributeRE = /[\s"'<>\/=]/;
  41552. var decodeHTMLCached = cached(he.decode);
  41553. var emptySlotScopeToken = "_empty_";
  41554. // configurable state
  41555. var warn$2;
  41556. var delimiters;
  41557. var transforms;
  41558. var preTransforms;
  41559. var postTransforms;
  41560. var platformIsPreTag;
  41561. var platformMustUseProp;
  41562. var platformGetTagNamespace;
  41563. var maybeComponent;
  41564. function createASTElement (
  41565. tag,
  41566. attrs,
  41567. parent
  41568. ) {
  41569. return {
  41570. type: 1,
  41571. tag: tag,
  41572. attrsList: attrs,
  41573. attrsMap: makeAttrsMap(attrs),
  41574. rawAttrsMap: {},
  41575. parent: parent,
  41576. children: []
  41577. }
  41578. }
  41579. /**
  41580. * Convert HTML string to AST.
  41581. */
  41582. function parse (
  41583. template,
  41584. options
  41585. ) {
  41586. warn$2 = options.warn || baseWarn;
  41587. platformIsPreTag = options.isPreTag || no;
  41588. platformMustUseProp = options.mustUseProp || no;
  41589. platformGetTagNamespace = options.getTagNamespace || no;
  41590. var isReservedTag = options.isReservedTag || no;
  41591. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  41592. transforms = pluckModuleFunction(options.modules, 'transformNode');
  41593. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  41594. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  41595. delimiters = options.delimiters;
  41596. var stack = [];
  41597. var preserveWhitespace = options.preserveWhitespace !== false;
  41598. var whitespaceOption = options.whitespace;
  41599. var root;
  41600. var currentParent;
  41601. var inVPre = false;
  41602. var inPre = false;
  41603. var warned = false;
  41604. function warnOnce (msg, range) {
  41605. if (!warned) {
  41606. warned = true;
  41607. warn$2(msg, range);
  41608. }
  41609. }
  41610. function closeElement (element) {
  41611. trimEndingWhitespace(element);
  41612. if (!inVPre && !element.processed) {
  41613. element = processElement(element, options);
  41614. }
  41615. // tree management
  41616. if (!stack.length && element !== root) {
  41617. // allow root elements with v-if, v-else-if and v-else
  41618. if (root.if && (element.elseif || element.else)) {
  41619. {
  41620. checkRootConstraints(element);
  41621. }
  41622. addIfCondition(root, {
  41623. exp: element.elseif,
  41624. block: element
  41625. });
  41626. } else {
  41627. warnOnce(
  41628. "Component template should contain exactly one root element. " +
  41629. "If you are using v-if on multiple elements, " +
  41630. "use v-else-if to chain them instead.",
  41631. { start: element.start }
  41632. );
  41633. }
  41634. }
  41635. if (currentParent && !element.forbidden) {
  41636. if (element.elseif || element.else) {
  41637. processIfConditions(element, currentParent);
  41638. } else {
  41639. if (element.slotScope) {
  41640. // scoped slot
  41641. // keep it in the children list so that v-else(-if) conditions can
  41642. // find it as the prev node.
  41643. var name = element.slotTarget || '"default"'
  41644. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  41645. }
  41646. currentParent.children.push(element);
  41647. element.parent = currentParent;
  41648. }
  41649. }
  41650. // final children cleanup
  41651. // filter out scoped slots
  41652. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  41653. // remove trailing whitespace node again
  41654. trimEndingWhitespace(element);
  41655. // check pre state
  41656. if (element.pre) {
  41657. inVPre = false;
  41658. }
  41659. if (platformIsPreTag(element.tag)) {
  41660. inPre = false;
  41661. }
  41662. // apply post-transforms
  41663. for (var i = 0; i < postTransforms.length; i++) {
  41664. postTransforms[i](element, options);
  41665. }
  41666. }
  41667. function trimEndingWhitespace (el) {
  41668. // remove trailing whitespace node
  41669. if (!inPre) {
  41670. var lastNode;
  41671. while (
  41672. (lastNode = el.children[el.children.length - 1]) &&
  41673. lastNode.type === 3 &&
  41674. lastNode.text === ' '
  41675. ) {
  41676. el.children.pop();
  41677. }
  41678. }
  41679. }
  41680. function checkRootConstraints (el) {
  41681. if (el.tag === 'slot' || el.tag === 'template') {
  41682. warnOnce(
  41683. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  41684. 'contain multiple nodes.',
  41685. { start: el.start }
  41686. );
  41687. }
  41688. if (el.attrsMap.hasOwnProperty('v-for')) {
  41689. warnOnce(
  41690. 'Cannot use v-for on stateful component root element because ' +
  41691. 'it renders multiple elements.',
  41692. el.rawAttrsMap['v-for']
  41693. );
  41694. }
  41695. }
  41696. parseHTML(template, {
  41697. warn: warn$2,
  41698. expectHTML: options.expectHTML,
  41699. isUnaryTag: options.isUnaryTag,
  41700. canBeLeftOpenTag: options.canBeLeftOpenTag,
  41701. shouldDecodeNewlines: options.shouldDecodeNewlines,
  41702. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  41703. shouldKeepComment: options.comments,
  41704. outputSourceRange: options.outputSourceRange,
  41705. start: function start (tag, attrs, unary, start$1, end) {
  41706. // check namespace.
  41707. // inherit parent ns if there is one
  41708. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  41709. // handle IE svg bug
  41710. /* istanbul ignore if */
  41711. if (isIE && ns === 'svg') {
  41712. attrs = guardIESVGBug(attrs);
  41713. }
  41714. var element = createASTElement(tag, attrs, currentParent);
  41715. if (ns) {
  41716. element.ns = ns;
  41717. }
  41718. {
  41719. if (options.outputSourceRange) {
  41720. element.start = start$1;
  41721. element.end = end;
  41722. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  41723. cumulated[attr.name] = attr;
  41724. return cumulated
  41725. }, {});
  41726. }
  41727. attrs.forEach(function (attr) {
  41728. if (invalidAttributeRE.test(attr.name)) {
  41729. warn$2(
  41730. "Invalid dynamic argument expression: attribute names cannot contain " +
  41731. "spaces, quotes, <, >, / or =.",
  41732. {
  41733. start: attr.start + attr.name.indexOf("["),
  41734. end: attr.start + attr.name.length
  41735. }
  41736. );
  41737. }
  41738. });
  41739. }
  41740. if (isForbiddenTag(element) && !isServerRendering()) {
  41741. element.forbidden = true;
  41742. warn$2(
  41743. 'Templates should only be responsible for mapping the state to the ' +
  41744. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41745. "<" + tag + ">" + ', as they will not be parsed.',
  41746. { start: element.start }
  41747. );
  41748. }
  41749. // apply pre-transforms
  41750. for (var i = 0; i < preTransforms.length; i++) {
  41751. element = preTransforms[i](element, options) || element;
  41752. }
  41753. if (!inVPre) {
  41754. processPre(element);
  41755. if (element.pre) {
  41756. inVPre = true;
  41757. }
  41758. }
  41759. if (platformIsPreTag(element.tag)) {
  41760. inPre = true;
  41761. }
  41762. if (inVPre) {
  41763. processRawAttrs(element);
  41764. } else if (!element.processed) {
  41765. // structural directives
  41766. processFor(element);
  41767. processIf(element);
  41768. processOnce(element);
  41769. }
  41770. if (!root) {
  41771. root = element;
  41772. {
  41773. checkRootConstraints(root);
  41774. }
  41775. }
  41776. if (!unary) {
  41777. currentParent = element;
  41778. stack.push(element);
  41779. } else {
  41780. closeElement(element);
  41781. }
  41782. },
  41783. end: function end (tag, start, end$1) {
  41784. var element = stack[stack.length - 1];
  41785. // pop stack
  41786. stack.length -= 1;
  41787. currentParent = stack[stack.length - 1];
  41788. if (options.outputSourceRange) {
  41789. element.end = end$1;
  41790. }
  41791. closeElement(element);
  41792. },
  41793. chars: function chars (text, start, end) {
  41794. if (!currentParent) {
  41795. {
  41796. if (text === template) {
  41797. warnOnce(
  41798. 'Component template requires a root element, rather than just text.',
  41799. { start: start }
  41800. );
  41801. } else if ((text = text.trim())) {
  41802. warnOnce(
  41803. ("text \"" + text + "\" outside root element will be ignored."),
  41804. { start: start }
  41805. );
  41806. }
  41807. }
  41808. return
  41809. }
  41810. // IE textarea placeholder bug
  41811. /* istanbul ignore if */
  41812. if (isIE &&
  41813. currentParent.tag === 'textarea' &&
  41814. currentParent.attrsMap.placeholder === text
  41815. ) {
  41816. return
  41817. }
  41818. var children = currentParent.children;
  41819. if (inPre || text.trim()) {
  41820. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41821. } else if (!children.length) {
  41822. // remove the whitespace-only node right after an opening tag
  41823. text = '';
  41824. } else if (whitespaceOption) {
  41825. if (whitespaceOption === 'condense') {
  41826. // in condense mode, remove the whitespace node if it contains
  41827. // line break, otherwise condense to a single space
  41828. text = lineBreakRE.test(text) ? '' : ' ';
  41829. } else {
  41830. text = ' ';
  41831. }
  41832. } else {
  41833. text = preserveWhitespace ? ' ' : '';
  41834. }
  41835. if (text) {
  41836. if (!inPre && whitespaceOption === 'condense') {
  41837. // condense consecutive whitespaces into single space
  41838. text = text.replace(whitespaceRE$1, ' ');
  41839. }
  41840. var res;
  41841. var child;
  41842. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41843. child = {
  41844. type: 2,
  41845. expression: res.expression,
  41846. tokens: res.tokens,
  41847. text: text
  41848. };
  41849. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41850. child = {
  41851. type: 3,
  41852. text: text
  41853. };
  41854. }
  41855. if (child) {
  41856. if (options.outputSourceRange) {
  41857. child.start = start;
  41858. child.end = end;
  41859. }
  41860. children.push(child);
  41861. }
  41862. }
  41863. },
  41864. comment: function comment (text, start, end) {
  41865. // adding anything as a sibling to the root node is forbidden
  41866. // comments should still be allowed, but ignored
  41867. if (currentParent) {
  41868. var child = {
  41869. type: 3,
  41870. text: text,
  41871. isComment: true
  41872. };
  41873. if (options.outputSourceRange) {
  41874. child.start = start;
  41875. child.end = end;
  41876. }
  41877. currentParent.children.push(child);
  41878. }
  41879. }
  41880. });
  41881. return root
  41882. }
  41883. function processPre (el) {
  41884. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41885. el.pre = true;
  41886. }
  41887. }
  41888. function processRawAttrs (el) {
  41889. var list = el.attrsList;
  41890. var len = list.length;
  41891. if (len) {
  41892. var attrs = el.attrs = new Array(len);
  41893. for (var i = 0; i < len; i++) {
  41894. attrs[i] = {
  41895. name: list[i].name,
  41896. value: JSON.stringify(list[i].value)
  41897. };
  41898. if (list[i].start != null) {
  41899. attrs[i].start = list[i].start;
  41900. attrs[i].end = list[i].end;
  41901. }
  41902. }
  41903. } else if (!el.pre) {
  41904. // non root node in pre blocks with no attributes
  41905. el.plain = true;
  41906. }
  41907. }
  41908. function processElement (
  41909. element,
  41910. options
  41911. ) {
  41912. processKey(element);
  41913. // determine whether this is a plain element after
  41914. // removing structural attributes
  41915. element.plain = (
  41916. !element.key &&
  41917. !element.scopedSlots &&
  41918. !element.attrsList.length
  41919. );
  41920. processRef(element);
  41921. processSlotContent(element);
  41922. processSlotOutlet(element);
  41923. processComponent(element);
  41924. for (var i = 0; i < transforms.length; i++) {
  41925. element = transforms[i](element, options) || element;
  41926. }
  41927. processAttrs(element);
  41928. return element
  41929. }
  41930. function processKey (el) {
  41931. var exp = getBindingAttr(el, 'key');
  41932. if (exp) {
  41933. {
  41934. if (el.tag === 'template') {
  41935. warn$2(
  41936. "<template> cannot be keyed. Place the key on real elements instead.",
  41937. getRawBindingAttr(el, 'key')
  41938. );
  41939. }
  41940. if (el.for) {
  41941. var iterator = el.iterator2 || el.iterator1;
  41942. var parent = el.parent;
  41943. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41944. warn$2(
  41945. "Do not use v-for index as key on <transition-group> children, " +
  41946. "this is the same as not using keys.",
  41947. getRawBindingAttr(el, 'key'),
  41948. true /* tip */
  41949. );
  41950. }
  41951. }
  41952. }
  41953. el.key = exp;
  41954. }
  41955. }
  41956. function processRef (el) {
  41957. var ref = getBindingAttr(el, 'ref');
  41958. if (ref) {
  41959. el.ref = ref;
  41960. el.refInFor = checkInFor(el);
  41961. }
  41962. }
  41963. function processFor (el) {
  41964. var exp;
  41965. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41966. var res = parseFor(exp);
  41967. if (res) {
  41968. extend(el, res);
  41969. } else {
  41970. warn$2(
  41971. ("Invalid v-for expression: " + exp),
  41972. el.rawAttrsMap['v-for']
  41973. );
  41974. }
  41975. }
  41976. }
  41977. function parseFor (exp) {
  41978. var inMatch = exp.match(forAliasRE);
  41979. if (!inMatch) { return }
  41980. var res = {};
  41981. res.for = inMatch[2].trim();
  41982. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41983. var iteratorMatch = alias.match(forIteratorRE);
  41984. if (iteratorMatch) {
  41985. res.alias = alias.replace(forIteratorRE, '').trim();
  41986. res.iterator1 = iteratorMatch[1].trim();
  41987. if (iteratorMatch[2]) {
  41988. res.iterator2 = iteratorMatch[2].trim();
  41989. }
  41990. } else {
  41991. res.alias = alias;
  41992. }
  41993. return res
  41994. }
  41995. function processIf (el) {
  41996. var exp = getAndRemoveAttr(el, 'v-if');
  41997. if (exp) {
  41998. el.if = exp;
  41999. addIfCondition(el, {
  42000. exp: exp,
  42001. block: el
  42002. });
  42003. } else {
  42004. if (getAndRemoveAttr(el, 'v-else') != null) {
  42005. el.else = true;
  42006. }
  42007. var elseif = getAndRemoveAttr(el, 'v-else-if');
  42008. if (elseif) {
  42009. el.elseif = elseif;
  42010. }
  42011. }
  42012. }
  42013. function processIfConditions (el, parent) {
  42014. var prev = findPrevElement(parent.children);
  42015. if (prev && prev.if) {
  42016. addIfCondition(prev, {
  42017. exp: el.elseif,
  42018. block: el
  42019. });
  42020. } else {
  42021. warn$2(
  42022. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  42023. "used on element <" + (el.tag) + "> without corresponding v-if.",
  42024. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  42025. );
  42026. }
  42027. }
  42028. function findPrevElement (children) {
  42029. var i = children.length;
  42030. while (i--) {
  42031. if (children[i].type === 1) {
  42032. return children[i]
  42033. } else {
  42034. if (children[i].text !== ' ') {
  42035. warn$2(
  42036. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  42037. "will be ignored.",
  42038. children[i]
  42039. );
  42040. }
  42041. children.pop();
  42042. }
  42043. }
  42044. }
  42045. function addIfCondition (el, condition) {
  42046. if (!el.ifConditions) {
  42047. el.ifConditions = [];
  42048. }
  42049. el.ifConditions.push(condition);
  42050. }
  42051. function processOnce (el) {
  42052. var once$$1 = getAndRemoveAttr(el, 'v-once');
  42053. if (once$$1 != null) {
  42054. el.once = true;
  42055. }
  42056. }
  42057. // handle content being passed to a component as slot,
  42058. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  42059. function processSlotContent (el) {
  42060. var slotScope;
  42061. if (el.tag === 'template') {
  42062. slotScope = getAndRemoveAttr(el, 'scope');
  42063. /* istanbul ignore if */
  42064. if (slotScope) {
  42065. warn$2(
  42066. "the \"scope\" attribute for scoped slots have been deprecated and " +
  42067. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  42068. "can also be used on plain elements in addition to <template> to " +
  42069. "denote scoped slots.",
  42070. el.rawAttrsMap['scope'],
  42071. true
  42072. );
  42073. }
  42074. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  42075. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  42076. /* istanbul ignore if */
  42077. if (el.attrsMap['v-for']) {
  42078. warn$2(
  42079. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  42080. "(v-for takes higher priority). Use a wrapper <template> for the " +
  42081. "scoped slot to make it clearer.",
  42082. el.rawAttrsMap['slot-scope'],
  42083. true
  42084. );
  42085. }
  42086. el.slotScope = slotScope;
  42087. }
  42088. // slot="xxx"
  42089. var slotTarget = getBindingAttr(el, 'slot');
  42090. if (slotTarget) {
  42091. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  42092. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  42093. // preserve slot as an attribute for native shadow DOM compat
  42094. // only for non-scoped slots.
  42095. if (el.tag !== 'template' && !el.slotScope) {
  42096. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  42097. }
  42098. }
  42099. // 2.6 v-slot syntax
  42100. {
  42101. if (el.tag === 'template') {
  42102. // v-slot on <template>
  42103. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  42104. if (slotBinding) {
  42105. {
  42106. if (el.slotTarget || el.slotScope) {
  42107. warn$2(
  42108. "Unexpected mixed usage of different slot syntaxes.",
  42109. el
  42110. );
  42111. }
  42112. if (el.parent && !maybeComponent(el.parent)) {
  42113. warn$2(
  42114. "<template v-slot> can only appear at the root level inside " +
  42115. "the receiving component",
  42116. el
  42117. );
  42118. }
  42119. }
  42120. var ref = getSlotName(slotBinding);
  42121. var name = ref.name;
  42122. var dynamic = ref.dynamic;
  42123. el.slotTarget = name;
  42124. el.slotTargetDynamic = dynamic;
  42125. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  42126. }
  42127. } else {
  42128. // v-slot on component, denotes default slot
  42129. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  42130. if (slotBinding$1) {
  42131. {
  42132. if (!maybeComponent(el)) {
  42133. warn$2(
  42134. "v-slot can only be used on components or <template>.",
  42135. slotBinding$1
  42136. );
  42137. }
  42138. if (el.slotScope || el.slotTarget) {
  42139. warn$2(
  42140. "Unexpected mixed usage of different slot syntaxes.",
  42141. el
  42142. );
  42143. }
  42144. if (el.scopedSlots) {
  42145. warn$2(
  42146. "To avoid scope ambiguity, the default slot should also use " +
  42147. "<template> syntax when there are other named slots.",
  42148. slotBinding$1
  42149. );
  42150. }
  42151. }
  42152. // add the component's children to its default slot
  42153. var slots = el.scopedSlots || (el.scopedSlots = {});
  42154. var ref$1 = getSlotName(slotBinding$1);
  42155. var name$1 = ref$1.name;
  42156. var dynamic$1 = ref$1.dynamic;
  42157. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  42158. slotContainer.slotTarget = name$1;
  42159. slotContainer.slotTargetDynamic = dynamic$1;
  42160. slotContainer.children = el.children.filter(function (c) {
  42161. if (!c.slotScope) {
  42162. c.parent = slotContainer;
  42163. return true
  42164. }
  42165. });
  42166. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  42167. // remove children as they are returned from scopedSlots now
  42168. el.children = [];
  42169. // mark el non-plain so data gets generated
  42170. el.plain = false;
  42171. }
  42172. }
  42173. }
  42174. }
  42175. function getSlotName (binding) {
  42176. var name = binding.name.replace(slotRE, '');
  42177. if (!name) {
  42178. if (binding.name[0] !== '#') {
  42179. name = 'default';
  42180. } else {
  42181. warn$2(
  42182. "v-slot shorthand syntax requires a slot name.",
  42183. binding
  42184. );
  42185. }
  42186. }
  42187. return dynamicArgRE.test(name)
  42188. // dynamic [name]
  42189. ? { name: name.slice(1, -1), dynamic: true }
  42190. // static name
  42191. : { name: ("\"" + name + "\""), dynamic: false }
  42192. }
  42193. // handle <slot/> outlets
  42194. function processSlotOutlet (el) {
  42195. if (el.tag === 'slot') {
  42196. el.slotName = getBindingAttr(el, 'name');
  42197. if (el.key) {
  42198. warn$2(
  42199. "`key` does not work on <slot> because slots are abstract outlets " +
  42200. "and can possibly expand into multiple elements. " +
  42201. "Use the key on a wrapping element instead.",
  42202. getRawBindingAttr(el, 'key')
  42203. );
  42204. }
  42205. }
  42206. }
  42207. function processComponent (el) {
  42208. var binding;
  42209. if ((binding = getBindingAttr(el, 'is'))) {
  42210. el.component = binding;
  42211. }
  42212. if (getAndRemoveAttr(el, 'inline-template') != null) {
  42213. el.inlineTemplate = true;
  42214. }
  42215. }
  42216. function processAttrs (el) {
  42217. var list = el.attrsList;
  42218. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  42219. for (i = 0, l = list.length; i < l; i++) {
  42220. name = rawName = list[i].name;
  42221. value = list[i].value;
  42222. if (dirRE.test(name)) {
  42223. // mark element as dynamic
  42224. el.hasBindings = true;
  42225. // modifiers
  42226. modifiers = parseModifiers(name.replace(dirRE, ''));
  42227. // support .foo shorthand syntax for the .prop modifier
  42228. if (modifiers) {
  42229. name = name.replace(modifierRE, '');
  42230. }
  42231. if (bindRE.test(name)) { // v-bind
  42232. name = name.replace(bindRE, '');
  42233. value = parseFilters(value);
  42234. isDynamic = dynamicArgRE.test(name);
  42235. if (isDynamic) {
  42236. name = name.slice(1, -1);
  42237. }
  42238. if (
  42239. value.trim().length === 0
  42240. ) {
  42241. warn$2(
  42242. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  42243. );
  42244. }
  42245. if (modifiers) {
  42246. if (modifiers.prop && !isDynamic) {
  42247. name = camelize(name);
  42248. if (name === 'innerHtml') { name = 'innerHTML'; }
  42249. }
  42250. if (modifiers.camel && !isDynamic) {
  42251. name = camelize(name);
  42252. }
  42253. if (modifiers.sync) {
  42254. syncGen = genAssignmentCode(value, "$event");
  42255. if (!isDynamic) {
  42256. addHandler(
  42257. el,
  42258. ("update:" + (camelize(name))),
  42259. syncGen,
  42260. null,
  42261. false,
  42262. warn$2,
  42263. list[i]
  42264. );
  42265. if (hyphenate(name) !== camelize(name)) {
  42266. addHandler(
  42267. el,
  42268. ("update:" + (hyphenate(name))),
  42269. syncGen,
  42270. null,
  42271. false,
  42272. warn$2,
  42273. list[i]
  42274. );
  42275. }
  42276. } else {
  42277. // handler w/ dynamic event name
  42278. addHandler(
  42279. el,
  42280. ("\"update:\"+(" + name + ")"),
  42281. syncGen,
  42282. null,
  42283. false,
  42284. warn$2,
  42285. list[i],
  42286. true // dynamic
  42287. );
  42288. }
  42289. }
  42290. }
  42291. if ((modifiers && modifiers.prop) || (
  42292. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  42293. )) {
  42294. addProp(el, name, value, list[i], isDynamic);
  42295. } else {
  42296. addAttr(el, name, value, list[i], isDynamic);
  42297. }
  42298. } else if (onRE.test(name)) { // v-on
  42299. name = name.replace(onRE, '');
  42300. isDynamic = dynamicArgRE.test(name);
  42301. if (isDynamic) {
  42302. name = name.slice(1, -1);
  42303. }
  42304. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  42305. } else { // normal directives
  42306. name = name.replace(dirRE, '');
  42307. // parse arg
  42308. var argMatch = name.match(argRE);
  42309. var arg = argMatch && argMatch[1];
  42310. isDynamic = false;
  42311. if (arg) {
  42312. name = name.slice(0, -(arg.length + 1));
  42313. if (dynamicArgRE.test(arg)) {
  42314. arg = arg.slice(1, -1);
  42315. isDynamic = true;
  42316. }
  42317. }
  42318. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  42319. if (name === 'model') {
  42320. checkForAliasModel(el, value);
  42321. }
  42322. }
  42323. } else {
  42324. // literal attribute
  42325. {
  42326. var res = parseText(value, delimiters);
  42327. if (res) {
  42328. warn$2(
  42329. name + "=\"" + value + "\": " +
  42330. 'Interpolation inside attributes has been removed. ' +
  42331. 'Use v-bind or the colon shorthand instead. For example, ' +
  42332. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  42333. list[i]
  42334. );
  42335. }
  42336. }
  42337. addAttr(el, name, JSON.stringify(value), list[i]);
  42338. // #6887 firefox doesn't update muted state if set via attribute
  42339. // even immediately after element creation
  42340. if (!el.component &&
  42341. name === 'muted' &&
  42342. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  42343. addProp(el, name, 'true', list[i]);
  42344. }
  42345. }
  42346. }
  42347. }
  42348. function checkInFor (el) {
  42349. var parent = el;
  42350. while (parent) {
  42351. if (parent.for !== undefined) {
  42352. return true
  42353. }
  42354. parent = parent.parent;
  42355. }
  42356. return false
  42357. }
  42358. function parseModifiers (name) {
  42359. var match = name.match(modifierRE);
  42360. if (match) {
  42361. var ret = {};
  42362. match.forEach(function (m) { ret[m.slice(1)] = true; });
  42363. return ret
  42364. }
  42365. }
  42366. function makeAttrsMap (attrs) {
  42367. var map = {};
  42368. for (var i = 0, l = attrs.length; i < l; i++) {
  42369. if (
  42370. map[attrs[i].name] && !isIE && !isEdge
  42371. ) {
  42372. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  42373. }
  42374. map[attrs[i].name] = attrs[i].value;
  42375. }
  42376. return map
  42377. }
  42378. // for script (e.g. type="x/template") or style, do not decode content
  42379. function isTextTag (el) {
  42380. return el.tag === 'script' || el.tag === 'style'
  42381. }
  42382. function isForbiddenTag (el) {
  42383. return (
  42384. el.tag === 'style' ||
  42385. (el.tag === 'script' && (
  42386. !el.attrsMap.type ||
  42387. el.attrsMap.type === 'text/javascript'
  42388. ))
  42389. )
  42390. }
  42391. var ieNSBug = /^xmlns:NS\d+/;
  42392. var ieNSPrefix = /^NS\d+:/;
  42393. /* istanbul ignore next */
  42394. function guardIESVGBug (attrs) {
  42395. var res = [];
  42396. for (var i = 0; i < attrs.length; i++) {
  42397. var attr = attrs[i];
  42398. if (!ieNSBug.test(attr.name)) {
  42399. attr.name = attr.name.replace(ieNSPrefix, '');
  42400. res.push(attr);
  42401. }
  42402. }
  42403. return res
  42404. }
  42405. function checkForAliasModel (el, value) {
  42406. var _el = el;
  42407. while (_el) {
  42408. if (_el.for && _el.alias === value) {
  42409. warn$2(
  42410. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  42411. "You are binding v-model directly to a v-for iteration alias. " +
  42412. "This will not be able to modify the v-for source array because " +
  42413. "writing to the alias is like modifying a function local variable. " +
  42414. "Consider using an array of objects and use v-model on an object property instead.",
  42415. el.rawAttrsMap['v-model']
  42416. );
  42417. }
  42418. _el = _el.parent;
  42419. }
  42420. }
  42421. /* */
  42422. function preTransformNode (el, options) {
  42423. if (el.tag === 'input') {
  42424. var map = el.attrsMap;
  42425. if (!map['v-model']) {
  42426. return
  42427. }
  42428. var typeBinding;
  42429. if (map[':type'] || map['v-bind:type']) {
  42430. typeBinding = getBindingAttr(el, 'type');
  42431. }
  42432. if (!map.type && !typeBinding && map['v-bind']) {
  42433. typeBinding = "(" + (map['v-bind']) + ").type";
  42434. }
  42435. if (typeBinding) {
  42436. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  42437. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  42438. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  42439. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  42440. // 1. checkbox
  42441. var branch0 = cloneASTElement(el);
  42442. // process for on the main node
  42443. processFor(branch0);
  42444. addRawAttr(branch0, 'type', 'checkbox');
  42445. processElement(branch0, options);
  42446. branch0.processed = true; // prevent it from double-processed
  42447. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  42448. addIfCondition(branch0, {
  42449. exp: branch0.if,
  42450. block: branch0
  42451. });
  42452. // 2. add radio else-if condition
  42453. var branch1 = cloneASTElement(el);
  42454. getAndRemoveAttr(branch1, 'v-for', true);
  42455. addRawAttr(branch1, 'type', 'radio');
  42456. processElement(branch1, options);
  42457. addIfCondition(branch0, {
  42458. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  42459. block: branch1
  42460. });
  42461. // 3. other
  42462. var branch2 = cloneASTElement(el);
  42463. getAndRemoveAttr(branch2, 'v-for', true);
  42464. addRawAttr(branch2, ':type', typeBinding);
  42465. processElement(branch2, options);
  42466. addIfCondition(branch0, {
  42467. exp: ifCondition,
  42468. block: branch2
  42469. });
  42470. if (hasElse) {
  42471. branch0.else = true;
  42472. } else if (elseIfCondition) {
  42473. branch0.elseif = elseIfCondition;
  42474. }
  42475. return branch0
  42476. }
  42477. }
  42478. }
  42479. function cloneASTElement (el) {
  42480. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  42481. }
  42482. var model$1 = {
  42483. preTransformNode: preTransformNode
  42484. };
  42485. var modules$1 = [
  42486. klass$1,
  42487. style$1,
  42488. model$1
  42489. ];
  42490. /* */
  42491. function text (el, dir) {
  42492. if (dir.value) {
  42493. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  42494. }
  42495. }
  42496. /* */
  42497. function html (el, dir) {
  42498. if (dir.value) {
  42499. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  42500. }
  42501. }
  42502. var directives$1 = {
  42503. model: model,
  42504. text: text,
  42505. html: html
  42506. };
  42507. /* */
  42508. var baseOptions = {
  42509. expectHTML: true,
  42510. modules: modules$1,
  42511. directives: directives$1,
  42512. isPreTag: isPreTag,
  42513. isUnaryTag: isUnaryTag,
  42514. mustUseProp: mustUseProp,
  42515. canBeLeftOpenTag: canBeLeftOpenTag,
  42516. isReservedTag: isReservedTag,
  42517. getTagNamespace: getTagNamespace,
  42518. staticKeys: genStaticKeys(modules$1)
  42519. };
  42520. /* */
  42521. var isStaticKey;
  42522. var isPlatformReservedTag;
  42523. var genStaticKeysCached = cached(genStaticKeys$1);
  42524. /**
  42525. * Goal of the optimizer: walk the generated template AST tree
  42526. * and detect sub-trees that are purely static, i.e. parts of
  42527. * the DOM that never needs to change.
  42528. *
  42529. * Once we detect these sub-trees, we can:
  42530. *
  42531. * 1. Hoist them into constants, so that we no longer need to
  42532. * create fresh nodes for them on each re-render;
  42533. * 2. Completely skip them in the patching process.
  42534. */
  42535. function optimize (root, options) {
  42536. if (!root) { return }
  42537. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  42538. isPlatformReservedTag = options.isReservedTag || no;
  42539. // first pass: mark all non-static nodes.
  42540. markStatic$1(root);
  42541. // second pass: mark static roots.
  42542. markStaticRoots(root, false);
  42543. }
  42544. function genStaticKeys$1 (keys) {
  42545. return makeMap(
  42546. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  42547. (keys ? ',' + keys : '')
  42548. )
  42549. }
  42550. function markStatic$1 (node) {
  42551. node.static = isStatic(node);
  42552. if (node.type === 1) {
  42553. // do not make component slot content static. this avoids
  42554. // 1. components not able to mutate slot nodes
  42555. // 2. static slot content fails for hot-reloading
  42556. if (
  42557. !isPlatformReservedTag(node.tag) &&
  42558. node.tag !== 'slot' &&
  42559. node.attrsMap['inline-template'] == null
  42560. ) {
  42561. return
  42562. }
  42563. for (var i = 0, l = node.children.length; i < l; i++) {
  42564. var child = node.children[i];
  42565. markStatic$1(child);
  42566. if (!child.static) {
  42567. node.static = false;
  42568. }
  42569. }
  42570. if (node.ifConditions) {
  42571. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42572. var block = node.ifConditions[i$1].block;
  42573. markStatic$1(block);
  42574. if (!block.static) {
  42575. node.static = false;
  42576. }
  42577. }
  42578. }
  42579. }
  42580. }
  42581. function markStaticRoots (node, isInFor) {
  42582. if (node.type === 1) {
  42583. if (node.static || node.once) {
  42584. node.staticInFor = isInFor;
  42585. }
  42586. // For a node to qualify as a static root, it should have children that
  42587. // are not just static text. Otherwise the cost of hoisting out will
  42588. // outweigh the benefits and it's better off to just always render it fresh.
  42589. if (node.static && node.children.length && !(
  42590. node.children.length === 1 &&
  42591. node.children[0].type === 3
  42592. )) {
  42593. node.staticRoot = true;
  42594. return
  42595. } else {
  42596. node.staticRoot = false;
  42597. }
  42598. if (node.children) {
  42599. for (var i = 0, l = node.children.length; i < l; i++) {
  42600. markStaticRoots(node.children[i], isInFor || !!node.for);
  42601. }
  42602. }
  42603. if (node.ifConditions) {
  42604. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42605. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  42606. }
  42607. }
  42608. }
  42609. }
  42610. function isStatic (node) {
  42611. if (node.type === 2) { // expression
  42612. return false
  42613. }
  42614. if (node.type === 3) { // text
  42615. return true
  42616. }
  42617. return !!(node.pre || (
  42618. !node.hasBindings && // no dynamic bindings
  42619. !node.if && !node.for && // not v-if or v-for or v-else
  42620. !isBuiltInTag(node.tag) && // not a built-in
  42621. isPlatformReservedTag(node.tag) && // not a component
  42622. !isDirectChildOfTemplateFor(node) &&
  42623. Object.keys(node).every(isStaticKey)
  42624. ))
  42625. }
  42626. function isDirectChildOfTemplateFor (node) {
  42627. while (node.parent) {
  42628. node = node.parent;
  42629. if (node.tag !== 'template') {
  42630. return false
  42631. }
  42632. if (node.for) {
  42633. return true
  42634. }
  42635. }
  42636. return false
  42637. }
  42638. /* */
  42639. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  42640. var fnInvokeRE = /\([^)]*?\);*$/;
  42641. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  42642. // KeyboardEvent.keyCode aliases
  42643. var keyCodes = {
  42644. esc: 27,
  42645. tab: 9,
  42646. enter: 13,
  42647. space: 32,
  42648. up: 38,
  42649. left: 37,
  42650. right: 39,
  42651. down: 40,
  42652. 'delete': [8, 46]
  42653. };
  42654. // KeyboardEvent.key aliases
  42655. var keyNames = {
  42656. // #7880: IE11 and Edge use `Esc` for Escape key name.
  42657. esc: ['Esc', 'Escape'],
  42658. tab: 'Tab',
  42659. enter: 'Enter',
  42660. // #9112: IE11 uses `Spacebar` for Space key name.
  42661. space: [' ', 'Spacebar'],
  42662. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  42663. up: ['Up', 'ArrowUp'],
  42664. left: ['Left', 'ArrowLeft'],
  42665. right: ['Right', 'ArrowRight'],
  42666. down: ['Down', 'ArrowDown'],
  42667. // #9112: IE11 uses `Del` for Delete key name.
  42668. 'delete': ['Backspace', 'Delete', 'Del']
  42669. };
  42670. // #4868: modifiers that prevent the execution of the listener
  42671. // need to explicitly return null so that we can determine whether to remove
  42672. // the listener for .once
  42673. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  42674. var modifierCode = {
  42675. stop: '$event.stopPropagation();',
  42676. prevent: '$event.preventDefault();',
  42677. self: genGuard("$event.target !== $event.currentTarget"),
  42678. ctrl: genGuard("!$event.ctrlKey"),
  42679. shift: genGuard("!$event.shiftKey"),
  42680. alt: genGuard("!$event.altKey"),
  42681. meta: genGuard("!$event.metaKey"),
  42682. left: genGuard("'button' in $event && $event.button !== 0"),
  42683. middle: genGuard("'button' in $event && $event.button !== 1"),
  42684. right: genGuard("'button' in $event && $event.button !== 2")
  42685. };
  42686. function genHandlers (
  42687. events,
  42688. isNative
  42689. ) {
  42690. var prefix = isNative ? 'nativeOn:' : 'on:';
  42691. var staticHandlers = "";
  42692. var dynamicHandlers = "";
  42693. for (var name in events) {
  42694. var handlerCode = genHandler(events[name]);
  42695. if (events[name] && events[name].dynamic) {
  42696. dynamicHandlers += name + "," + handlerCode + ",";
  42697. } else {
  42698. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  42699. }
  42700. }
  42701. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  42702. if (dynamicHandlers) {
  42703. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  42704. } else {
  42705. return prefix + staticHandlers
  42706. }
  42707. }
  42708. function genHandler (handler) {
  42709. if (!handler) {
  42710. return 'function(){}'
  42711. }
  42712. if (Array.isArray(handler)) {
  42713. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  42714. }
  42715. var isMethodPath = simplePathRE.test(handler.value);
  42716. var isFunctionExpression = fnExpRE.test(handler.value);
  42717. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  42718. if (!handler.modifiers) {
  42719. if (isMethodPath || isFunctionExpression) {
  42720. return handler.value
  42721. }
  42722. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  42723. } else {
  42724. var code = '';
  42725. var genModifierCode = '';
  42726. var keys = [];
  42727. for (var key in handler.modifiers) {
  42728. if (modifierCode[key]) {
  42729. genModifierCode += modifierCode[key];
  42730. // left/right
  42731. if (keyCodes[key]) {
  42732. keys.push(key);
  42733. }
  42734. } else if (key === 'exact') {
  42735. var modifiers = (handler.modifiers);
  42736. genModifierCode += genGuard(
  42737. ['ctrl', 'shift', 'alt', 'meta']
  42738. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42739. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42740. .join('||')
  42741. );
  42742. } else {
  42743. keys.push(key);
  42744. }
  42745. }
  42746. if (keys.length) {
  42747. code += genKeyFilter(keys);
  42748. }
  42749. // Make sure modifiers like prevent and stop get executed after key filtering
  42750. if (genModifierCode) {
  42751. code += genModifierCode;
  42752. }
  42753. var handlerCode = isMethodPath
  42754. ? ("return " + (handler.value) + "($event)")
  42755. : isFunctionExpression
  42756. ? ("return (" + (handler.value) + ")($event)")
  42757. : isFunctionInvocation
  42758. ? ("return " + (handler.value))
  42759. : handler.value;
  42760. return ("function($event){" + code + handlerCode + "}")
  42761. }
  42762. }
  42763. function genKeyFilter (keys) {
  42764. return (
  42765. // make sure the key filters only apply to KeyboardEvents
  42766. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42767. // key events that do not have keyCode property...
  42768. "if(!$event.type.indexOf('key')&&" +
  42769. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42770. )
  42771. }
  42772. function genFilterCode (key) {
  42773. var keyVal = parseInt(key, 10);
  42774. if (keyVal) {
  42775. return ("$event.keyCode!==" + keyVal)
  42776. }
  42777. var keyCode = keyCodes[key];
  42778. var keyName = keyNames[key];
  42779. return (
  42780. "_k($event.keyCode," +
  42781. (JSON.stringify(key)) + "," +
  42782. (JSON.stringify(keyCode)) + "," +
  42783. "$event.key," +
  42784. "" + (JSON.stringify(keyName)) +
  42785. ")"
  42786. )
  42787. }
  42788. /* */
  42789. function on (el, dir) {
  42790. if (dir.modifiers) {
  42791. warn("v-on without argument does not support modifiers.");
  42792. }
  42793. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42794. }
  42795. /* */
  42796. function bind$1 (el, dir) {
  42797. el.wrapData = function (code) {
  42798. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42799. };
  42800. }
  42801. /* */
  42802. var baseDirectives = {
  42803. on: on,
  42804. bind: bind$1,
  42805. cloak: noop
  42806. };
  42807. /* */
  42808. var CodegenState = function CodegenState (options) {
  42809. this.options = options;
  42810. this.warn = options.warn || baseWarn;
  42811. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42812. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42813. this.directives = extend(extend({}, baseDirectives), options.directives);
  42814. var isReservedTag = options.isReservedTag || no;
  42815. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42816. this.onceId = 0;
  42817. this.staticRenderFns = [];
  42818. this.pre = false;
  42819. };
  42820. function generate (
  42821. ast,
  42822. options
  42823. ) {
  42824. var state = new CodegenState(options);
  42825. var code = ast ? genElement(ast, state) : '_c("div")';
  42826. return {
  42827. render: ("with(this){return " + code + "}"),
  42828. staticRenderFns: state.staticRenderFns
  42829. }
  42830. }
  42831. function genElement (el, state) {
  42832. if (el.parent) {
  42833. el.pre = el.pre || el.parent.pre;
  42834. }
  42835. if (el.staticRoot && !el.staticProcessed) {
  42836. return genStatic(el, state)
  42837. } else if (el.once && !el.onceProcessed) {
  42838. return genOnce(el, state)
  42839. } else if (el.for && !el.forProcessed) {
  42840. return genFor(el, state)
  42841. } else if (el.if && !el.ifProcessed) {
  42842. return genIf(el, state)
  42843. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42844. return genChildren(el, state) || 'void 0'
  42845. } else if (el.tag === 'slot') {
  42846. return genSlot(el, state)
  42847. } else {
  42848. // component or element
  42849. var code;
  42850. if (el.component) {
  42851. code = genComponent(el.component, el, state);
  42852. } else {
  42853. var data;
  42854. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42855. data = genData$2(el, state);
  42856. }
  42857. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42858. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42859. }
  42860. // module transforms
  42861. for (var i = 0; i < state.transforms.length; i++) {
  42862. code = state.transforms[i](el, code);
  42863. }
  42864. return code
  42865. }
  42866. }
  42867. // hoist static sub-trees out
  42868. function genStatic (el, state) {
  42869. el.staticProcessed = true;
  42870. // Some elements (templates) need to behave differently inside of a v-pre
  42871. // node. All pre nodes are static roots, so we can use this as a location to
  42872. // wrap a state change and reset it upon exiting the pre node.
  42873. var originalPreState = state.pre;
  42874. if (el.pre) {
  42875. state.pre = el.pre;
  42876. }
  42877. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42878. state.pre = originalPreState;
  42879. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42880. }
  42881. // v-once
  42882. function genOnce (el, state) {
  42883. el.onceProcessed = true;
  42884. if (el.if && !el.ifProcessed) {
  42885. return genIf(el, state)
  42886. } else if (el.staticInFor) {
  42887. var key = '';
  42888. var parent = el.parent;
  42889. while (parent) {
  42890. if (parent.for) {
  42891. key = parent.key;
  42892. break
  42893. }
  42894. parent = parent.parent;
  42895. }
  42896. if (!key) {
  42897. state.warn(
  42898. "v-once can only be used inside v-for that is keyed. ",
  42899. el.rawAttrsMap['v-once']
  42900. );
  42901. return genElement(el, state)
  42902. }
  42903. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42904. } else {
  42905. return genStatic(el, state)
  42906. }
  42907. }
  42908. function genIf (
  42909. el,
  42910. state,
  42911. altGen,
  42912. altEmpty
  42913. ) {
  42914. el.ifProcessed = true; // avoid recursion
  42915. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42916. }
  42917. function genIfConditions (
  42918. conditions,
  42919. state,
  42920. altGen,
  42921. altEmpty
  42922. ) {
  42923. if (!conditions.length) {
  42924. return altEmpty || '_e()'
  42925. }
  42926. var condition = conditions.shift();
  42927. if (condition.exp) {
  42928. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42929. } else {
  42930. return ("" + (genTernaryExp(condition.block)))
  42931. }
  42932. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42933. function genTernaryExp (el) {
  42934. return altGen
  42935. ? altGen(el, state)
  42936. : el.once
  42937. ? genOnce(el, state)
  42938. : genElement(el, state)
  42939. }
  42940. }
  42941. function genFor (
  42942. el,
  42943. state,
  42944. altGen,
  42945. altHelper
  42946. ) {
  42947. var exp = el.for;
  42948. var alias = el.alias;
  42949. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42950. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42951. if (state.maybeComponent(el) &&
  42952. el.tag !== 'slot' &&
  42953. el.tag !== 'template' &&
  42954. !el.key
  42955. ) {
  42956. state.warn(
  42957. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42958. "v-for should have explicit keys. " +
  42959. "See https://vuejs.org/guide/list.html#key for more info.",
  42960. el.rawAttrsMap['v-for'],
  42961. true /* tip */
  42962. );
  42963. }
  42964. el.forProcessed = true; // avoid recursion
  42965. return (altHelper || '_l') + "((" + exp + ")," +
  42966. "function(" + alias + iterator1 + iterator2 + "){" +
  42967. "return " + ((altGen || genElement)(el, state)) +
  42968. '})'
  42969. }
  42970. function genData$2 (el, state) {
  42971. var data = '{';
  42972. // directives first.
  42973. // directives may mutate the el's other properties before they are generated.
  42974. var dirs = genDirectives(el, state);
  42975. if (dirs) { data += dirs + ','; }
  42976. // key
  42977. if (el.key) {
  42978. data += "key:" + (el.key) + ",";
  42979. }
  42980. // ref
  42981. if (el.ref) {
  42982. data += "ref:" + (el.ref) + ",";
  42983. }
  42984. if (el.refInFor) {
  42985. data += "refInFor:true,";
  42986. }
  42987. // pre
  42988. if (el.pre) {
  42989. data += "pre:true,";
  42990. }
  42991. // record original tag name for components using "is" attribute
  42992. if (el.component) {
  42993. data += "tag:\"" + (el.tag) + "\",";
  42994. }
  42995. // module data generation functions
  42996. for (var i = 0; i < state.dataGenFns.length; i++) {
  42997. data += state.dataGenFns[i](el);
  42998. }
  42999. // attributes
  43000. if (el.attrs) {
  43001. data += "attrs:" + (genProps(el.attrs)) + ",";
  43002. }
  43003. // DOM props
  43004. if (el.props) {
  43005. data += "domProps:" + (genProps(el.props)) + ",";
  43006. }
  43007. // event handlers
  43008. if (el.events) {
  43009. data += (genHandlers(el.events, false)) + ",";
  43010. }
  43011. if (el.nativeEvents) {
  43012. data += (genHandlers(el.nativeEvents, true)) + ",";
  43013. }
  43014. // slot target
  43015. // only for non-scoped slots
  43016. if (el.slotTarget && !el.slotScope) {
  43017. data += "slot:" + (el.slotTarget) + ",";
  43018. }
  43019. // scoped slots
  43020. if (el.scopedSlots) {
  43021. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  43022. }
  43023. // component v-model
  43024. if (el.model) {
  43025. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  43026. }
  43027. // inline-template
  43028. if (el.inlineTemplate) {
  43029. var inlineTemplate = genInlineTemplate(el, state);
  43030. if (inlineTemplate) {
  43031. data += inlineTemplate + ",";
  43032. }
  43033. }
  43034. data = data.replace(/,$/, '') + '}';
  43035. // v-bind dynamic argument wrap
  43036. // v-bind with dynamic arguments must be applied using the same v-bind object
  43037. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  43038. if (el.dynamicAttrs) {
  43039. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  43040. }
  43041. // v-bind data wrap
  43042. if (el.wrapData) {
  43043. data = el.wrapData(data);
  43044. }
  43045. // v-on data wrap
  43046. if (el.wrapListeners) {
  43047. data = el.wrapListeners(data);
  43048. }
  43049. return data
  43050. }
  43051. function genDirectives (el, state) {
  43052. var dirs = el.directives;
  43053. if (!dirs) { return }
  43054. var res = 'directives:[';
  43055. var hasRuntime = false;
  43056. var i, l, dir, needRuntime;
  43057. for (i = 0, l = dirs.length; i < l; i++) {
  43058. dir = dirs[i];
  43059. needRuntime = true;
  43060. var gen = state.directives[dir.name];
  43061. if (gen) {
  43062. // compile-time directive that manipulates AST.
  43063. // returns true if it also needs a runtime counterpart.
  43064. needRuntime = !!gen(el, dir, state.warn);
  43065. }
  43066. if (needRuntime) {
  43067. hasRuntime = true;
  43068. 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))) : '') + "},";
  43069. }
  43070. }
  43071. if (hasRuntime) {
  43072. return res.slice(0, -1) + ']'
  43073. }
  43074. }
  43075. function genInlineTemplate (el, state) {
  43076. var ast = el.children[0];
  43077. if (el.children.length !== 1 || ast.type !== 1) {
  43078. state.warn(
  43079. 'Inline-template components must have exactly one child element.',
  43080. { start: el.start }
  43081. );
  43082. }
  43083. if (ast && ast.type === 1) {
  43084. var inlineRenderFns = generate(ast, state.options);
  43085. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  43086. }
  43087. }
  43088. function genScopedSlots (
  43089. el,
  43090. slots,
  43091. state
  43092. ) {
  43093. // by default scoped slots are considered "stable", this allows child
  43094. // components with only scoped slots to skip forced updates from parent.
  43095. // but in some cases we have to bail-out of this optimization
  43096. // for example if the slot contains dynamic names, has v-if or v-for on them...
  43097. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  43098. var slot = slots[key];
  43099. return (
  43100. slot.slotTargetDynamic ||
  43101. slot.if ||
  43102. slot.for ||
  43103. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  43104. )
  43105. });
  43106. // #9534: if a component with scoped slots is inside a conditional branch,
  43107. // it's possible for the same component to be reused but with different
  43108. // compiled slot content. To avoid that, we generate a unique key based on
  43109. // the generated code of all the slot contents.
  43110. var needsKey = !!el.if;
  43111. // OR when it is inside another scoped slot or v-for (the reactivity may be
  43112. // disconnected due to the intermediate scope variable)
  43113. // #9438, #9506
  43114. // TODO: this can be further optimized by properly analyzing in-scope bindings
  43115. // and skip force updating ones that do not actually use scope variables.
  43116. if (!needsForceUpdate) {
  43117. var parent = el.parent;
  43118. while (parent) {
  43119. if (
  43120. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  43121. parent.for
  43122. ) {
  43123. needsForceUpdate = true;
  43124. break
  43125. }
  43126. if (parent.if) {
  43127. needsKey = true;
  43128. }
  43129. parent = parent.parent;
  43130. }
  43131. }
  43132. var generatedSlots = Object.keys(slots)
  43133. .map(function (key) { return genScopedSlot(slots[key], state); })
  43134. .join(',');
  43135. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  43136. }
  43137. function hash(str) {
  43138. var hash = 5381;
  43139. var i = str.length;
  43140. while(i) {
  43141. hash = (hash * 33) ^ str.charCodeAt(--i);
  43142. }
  43143. return hash >>> 0
  43144. }
  43145. function containsSlotChild (el) {
  43146. if (el.type === 1) {
  43147. if (el.tag === 'slot') {
  43148. return true
  43149. }
  43150. return el.children.some(containsSlotChild)
  43151. }
  43152. return false
  43153. }
  43154. function genScopedSlot (
  43155. el,
  43156. state
  43157. ) {
  43158. var isLegacySyntax = el.attrsMap['slot-scope'];
  43159. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  43160. return genIf(el, state, genScopedSlot, "null")
  43161. }
  43162. if (el.for && !el.forProcessed) {
  43163. return genFor(el, state, genScopedSlot)
  43164. }
  43165. var slotScope = el.slotScope === emptySlotScopeToken
  43166. ? ""
  43167. : String(el.slotScope);
  43168. var fn = "function(" + slotScope + "){" +
  43169. "return " + (el.tag === 'template'
  43170. ? el.if && isLegacySyntax
  43171. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  43172. : genChildren(el, state) || 'undefined'
  43173. : genElement(el, state)) + "}";
  43174. // reverse proxy v-slot without scope on this.$slots
  43175. var reverseProxy = slotScope ? "" : ",proxy:true";
  43176. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  43177. }
  43178. function genChildren (
  43179. el,
  43180. state,
  43181. checkSkip,
  43182. altGenElement,
  43183. altGenNode
  43184. ) {
  43185. var children = el.children;
  43186. if (children.length) {
  43187. var el$1 = children[0];
  43188. // optimize single v-for
  43189. if (children.length === 1 &&
  43190. el$1.for &&
  43191. el$1.tag !== 'template' &&
  43192. el$1.tag !== 'slot'
  43193. ) {
  43194. var normalizationType = checkSkip
  43195. ? state.maybeComponent(el$1) ? ",1" : ",0"
  43196. : "";
  43197. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  43198. }
  43199. var normalizationType$1 = checkSkip
  43200. ? getNormalizationType(children, state.maybeComponent)
  43201. : 0;
  43202. var gen = altGenNode || genNode;
  43203. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  43204. }
  43205. }
  43206. // determine the normalization needed for the children array.
  43207. // 0: no normalization needed
  43208. // 1: simple normalization needed (possible 1-level deep nested array)
  43209. // 2: full normalization needed
  43210. function getNormalizationType (
  43211. children,
  43212. maybeComponent
  43213. ) {
  43214. var res = 0;
  43215. for (var i = 0; i < children.length; i++) {
  43216. var el = children[i];
  43217. if (el.type !== 1) {
  43218. continue
  43219. }
  43220. if (needsNormalization(el) ||
  43221. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  43222. res = 2;
  43223. break
  43224. }
  43225. if (maybeComponent(el) ||
  43226. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  43227. res = 1;
  43228. }
  43229. }
  43230. return res
  43231. }
  43232. function needsNormalization (el) {
  43233. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  43234. }
  43235. function genNode (node, state) {
  43236. if (node.type === 1) {
  43237. return genElement(node, state)
  43238. } else if (node.type === 3 && node.isComment) {
  43239. return genComment(node)
  43240. } else {
  43241. return genText(node)
  43242. }
  43243. }
  43244. function genText (text) {
  43245. return ("_v(" + (text.type === 2
  43246. ? text.expression // no need for () because already wrapped in _s()
  43247. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  43248. }
  43249. function genComment (comment) {
  43250. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  43251. }
  43252. function genSlot (el, state) {
  43253. var slotName = el.slotName || '"default"';
  43254. var children = genChildren(el, state);
  43255. var res = "_t(" + slotName + (children ? ("," + children) : '');
  43256. var attrs = el.attrs || el.dynamicAttrs
  43257. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  43258. // slot props are camelized
  43259. name: camelize(attr.name),
  43260. value: attr.value,
  43261. dynamic: attr.dynamic
  43262. }); }))
  43263. : null;
  43264. var bind$$1 = el.attrsMap['v-bind'];
  43265. if ((attrs || bind$$1) && !children) {
  43266. res += ",null";
  43267. }
  43268. if (attrs) {
  43269. res += "," + attrs;
  43270. }
  43271. if (bind$$1) {
  43272. res += (attrs ? '' : ',null') + "," + bind$$1;
  43273. }
  43274. return res + ')'
  43275. }
  43276. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  43277. function genComponent (
  43278. componentName,
  43279. el,
  43280. state
  43281. ) {
  43282. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  43283. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  43284. }
  43285. function genProps (props) {
  43286. var staticProps = "";
  43287. var dynamicProps = "";
  43288. for (var i = 0; i < props.length; i++) {
  43289. var prop = props[i];
  43290. var value = transformSpecialNewlines(prop.value);
  43291. if (prop.dynamic) {
  43292. dynamicProps += (prop.name) + "," + value + ",";
  43293. } else {
  43294. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  43295. }
  43296. }
  43297. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  43298. if (dynamicProps) {
  43299. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  43300. } else {
  43301. return staticProps
  43302. }
  43303. }
  43304. // #3895, #4268
  43305. function transformSpecialNewlines (text) {
  43306. return text
  43307. .replace(/\u2028/g, '\\u2028')
  43308. .replace(/\u2029/g, '\\u2029')
  43309. }
  43310. /* */
  43311. // these keywords should not appear inside expressions, but operators like
  43312. // typeof, instanceof and in are allowed
  43313. var prohibitedKeywordRE = new RegExp('\\b' + (
  43314. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  43315. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  43316. 'extends,finally,continue,debugger,function,arguments'
  43317. ).split(',').join('\\b|\\b') + '\\b');
  43318. // these unary operators should not be used as property/method names
  43319. var unaryOperatorsRE = new RegExp('\\b' + (
  43320. 'delete,typeof,void'
  43321. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  43322. // strip strings in expressions
  43323. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  43324. // detect problematic expressions in a template
  43325. function detectErrors (ast, warn) {
  43326. if (ast) {
  43327. checkNode(ast, warn);
  43328. }
  43329. }
  43330. function checkNode (node, warn) {
  43331. if (node.type === 1) {
  43332. for (var name in node.attrsMap) {
  43333. if (dirRE.test(name)) {
  43334. var value = node.attrsMap[name];
  43335. if (value) {
  43336. var range = node.rawAttrsMap[name];
  43337. if (name === 'v-for') {
  43338. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  43339. } else if (name === 'v-slot' || name[0] === '#') {
  43340. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  43341. } else if (onRE.test(name)) {
  43342. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  43343. } else {
  43344. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  43345. }
  43346. }
  43347. }
  43348. }
  43349. if (node.children) {
  43350. for (var i = 0; i < node.children.length; i++) {
  43351. checkNode(node.children[i], warn);
  43352. }
  43353. }
  43354. } else if (node.type === 2) {
  43355. checkExpression(node.expression, node.text, warn, node);
  43356. }
  43357. }
  43358. function checkEvent (exp, text, warn, range) {
  43359. var stripped = exp.replace(stripStringRE, '');
  43360. var keywordMatch = stripped.match(unaryOperatorsRE);
  43361. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  43362. warn(
  43363. "avoid using JavaScript unary operator as property name: " +
  43364. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  43365. range
  43366. );
  43367. }
  43368. checkExpression(exp, text, warn, range);
  43369. }
  43370. function checkFor (node, text, warn, range) {
  43371. checkExpression(node.for || '', text, warn, range);
  43372. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  43373. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  43374. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  43375. }
  43376. function checkIdentifier (
  43377. ident,
  43378. type,
  43379. text,
  43380. warn,
  43381. range
  43382. ) {
  43383. if (typeof ident === 'string') {
  43384. try {
  43385. new Function(("var " + ident + "=_"));
  43386. } catch (e) {
  43387. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  43388. }
  43389. }
  43390. }
  43391. function checkExpression (exp, text, warn, range) {
  43392. try {
  43393. new Function(("return " + exp));
  43394. } catch (e) {
  43395. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  43396. if (keywordMatch) {
  43397. warn(
  43398. "avoid using JavaScript keyword as property name: " +
  43399. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  43400. range
  43401. );
  43402. } else {
  43403. warn(
  43404. "invalid expression: " + (e.message) + " in\n\n" +
  43405. " " + exp + "\n\n" +
  43406. " Raw expression: " + (text.trim()) + "\n",
  43407. range
  43408. );
  43409. }
  43410. }
  43411. }
  43412. function checkFunctionParameterExpression (exp, text, warn, range) {
  43413. try {
  43414. new Function(exp, '');
  43415. } catch (e) {
  43416. warn(
  43417. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  43418. " " + exp + "\n\n" +
  43419. " Raw expression: " + (text.trim()) + "\n",
  43420. range
  43421. );
  43422. }
  43423. }
  43424. /* */
  43425. var range = 2;
  43426. function generateCodeFrame (
  43427. source,
  43428. start,
  43429. end
  43430. ) {
  43431. if ( start === void 0 ) start = 0;
  43432. if ( end === void 0 ) end = source.length;
  43433. var lines = source.split(/\r?\n/);
  43434. var count = 0;
  43435. var res = [];
  43436. for (var i = 0; i < lines.length; i++) {
  43437. count += lines[i].length + 1;
  43438. if (count >= start) {
  43439. for (var j = i - range; j <= i + range || end > count; j++) {
  43440. if (j < 0 || j >= lines.length) { continue }
  43441. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  43442. var lineLength = lines[j].length;
  43443. if (j === i) {
  43444. // push underline
  43445. var pad = start - (count - lineLength) + 1;
  43446. var length = end > count ? lineLength - pad : end - start;
  43447. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  43448. } else if (j > i) {
  43449. if (end > count) {
  43450. var length$1 = Math.min(end - count, lineLength);
  43451. res.push(" | " + repeat$1("^", length$1));
  43452. }
  43453. count += lineLength + 1;
  43454. }
  43455. }
  43456. break
  43457. }
  43458. }
  43459. return res.join('\n')
  43460. }
  43461. function repeat$1 (str, n) {
  43462. var result = '';
  43463. if (n > 0) {
  43464. while (true) { // eslint-disable-line
  43465. if (n & 1) { result += str; }
  43466. n >>>= 1;
  43467. if (n <= 0) { break }
  43468. str += str;
  43469. }
  43470. }
  43471. return result
  43472. }
  43473. /* */
  43474. function createFunction (code, errors) {
  43475. try {
  43476. return new Function(code)
  43477. } catch (err) {
  43478. errors.push({ err: err, code: code });
  43479. return noop
  43480. }
  43481. }
  43482. function createCompileToFunctionFn (compile) {
  43483. var cache = Object.create(null);
  43484. return function compileToFunctions (
  43485. template,
  43486. options,
  43487. vm
  43488. ) {
  43489. options = extend({}, options);
  43490. var warn$$1 = options.warn || warn;
  43491. delete options.warn;
  43492. /* istanbul ignore if */
  43493. {
  43494. // detect possible CSP restriction
  43495. try {
  43496. new Function('return 1');
  43497. } catch (e) {
  43498. if (e.toString().match(/unsafe-eval|CSP/)) {
  43499. warn$$1(
  43500. 'It seems you are using the standalone build of Vue.js in an ' +
  43501. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  43502. 'The template compiler cannot work in this environment. Consider ' +
  43503. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  43504. 'templates into render functions.'
  43505. );
  43506. }
  43507. }
  43508. }
  43509. // check cache
  43510. var key = options.delimiters
  43511. ? String(options.delimiters) + template
  43512. : template;
  43513. if (cache[key]) {
  43514. return cache[key]
  43515. }
  43516. // compile
  43517. var compiled = compile(template, options);
  43518. // check compilation errors/tips
  43519. {
  43520. if (compiled.errors && compiled.errors.length) {
  43521. if (options.outputSourceRange) {
  43522. compiled.errors.forEach(function (e) {
  43523. warn$$1(
  43524. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  43525. generateCodeFrame(template, e.start, e.end),
  43526. vm
  43527. );
  43528. });
  43529. } else {
  43530. warn$$1(
  43531. "Error compiling template:\n\n" + template + "\n\n" +
  43532. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  43533. vm
  43534. );
  43535. }
  43536. }
  43537. if (compiled.tips && compiled.tips.length) {
  43538. if (options.outputSourceRange) {
  43539. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  43540. } else {
  43541. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  43542. }
  43543. }
  43544. }
  43545. // turn code into functions
  43546. var res = {};
  43547. var fnGenErrors = [];
  43548. res.render = createFunction(compiled.render, fnGenErrors);
  43549. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  43550. return createFunction(code, fnGenErrors)
  43551. });
  43552. // check function generation errors.
  43553. // this should only happen if there is a bug in the compiler itself.
  43554. // mostly for codegen development use
  43555. /* istanbul ignore if */
  43556. {
  43557. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  43558. warn$$1(
  43559. "Failed to generate render function:\n\n" +
  43560. fnGenErrors.map(function (ref) {
  43561. var err = ref.err;
  43562. var code = ref.code;
  43563. return ((err.toString()) + " in\n\n" + code + "\n");
  43564. }).join('\n'),
  43565. vm
  43566. );
  43567. }
  43568. }
  43569. return (cache[key] = res)
  43570. }
  43571. }
  43572. /* */
  43573. function createCompilerCreator (baseCompile) {
  43574. return function createCompiler (baseOptions) {
  43575. function compile (
  43576. template,
  43577. options
  43578. ) {
  43579. var finalOptions = Object.create(baseOptions);
  43580. var errors = [];
  43581. var tips = [];
  43582. var warn = function (msg, range, tip) {
  43583. (tip ? tips : errors).push(msg);
  43584. };
  43585. if (options) {
  43586. if (options.outputSourceRange) {
  43587. // $flow-disable-line
  43588. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  43589. warn = function (msg, range, tip) {
  43590. var data = { msg: msg };
  43591. if (range) {
  43592. if (range.start != null) {
  43593. data.start = range.start + leadingSpaceLength;
  43594. }
  43595. if (range.end != null) {
  43596. data.end = range.end + leadingSpaceLength;
  43597. }
  43598. }
  43599. (tip ? tips : errors).push(data);
  43600. };
  43601. }
  43602. // merge custom modules
  43603. if (options.modules) {
  43604. finalOptions.modules =
  43605. (baseOptions.modules || []).concat(options.modules);
  43606. }
  43607. // merge custom directives
  43608. if (options.directives) {
  43609. finalOptions.directives = extend(
  43610. Object.create(baseOptions.directives || null),
  43611. options.directives
  43612. );
  43613. }
  43614. // copy other options
  43615. for (var key in options) {
  43616. if (key !== 'modules' && key !== 'directives') {
  43617. finalOptions[key] = options[key];
  43618. }
  43619. }
  43620. }
  43621. finalOptions.warn = warn;
  43622. var compiled = baseCompile(template.trim(), finalOptions);
  43623. {
  43624. detectErrors(compiled.ast, warn);
  43625. }
  43626. compiled.errors = errors;
  43627. compiled.tips = tips;
  43628. return compiled
  43629. }
  43630. return {
  43631. compile: compile,
  43632. compileToFunctions: createCompileToFunctionFn(compile)
  43633. }
  43634. }
  43635. }
  43636. /* */
  43637. // `createCompilerCreator` allows creating compilers that use alternative
  43638. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  43639. // Here we just export a default compiler using the default parts.
  43640. var createCompiler = createCompilerCreator(function baseCompile (
  43641. template,
  43642. options
  43643. ) {
  43644. var ast = parse(template.trim(), options);
  43645. if (options.optimize !== false) {
  43646. optimize(ast, options);
  43647. }
  43648. var code = generate(ast, options);
  43649. return {
  43650. ast: ast,
  43651. render: code.render,
  43652. staticRenderFns: code.staticRenderFns
  43653. }
  43654. });
  43655. /* */
  43656. var ref$1 = createCompiler(baseOptions);
  43657. var compile = ref$1.compile;
  43658. var compileToFunctions = ref$1.compileToFunctions;
  43659. /* */
  43660. // check whether current browser encodes a char inside attribute values
  43661. var div;
  43662. function getShouldDecode (href) {
  43663. div = div || document.createElement('div');
  43664. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  43665. return div.innerHTML.indexOf('&#10;') > 0
  43666. }
  43667. // #3663: IE encodes newlines inside attribute values while other browsers don't
  43668. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  43669. // #6828: chrome encodes content in a[href]
  43670. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  43671. /* */
  43672. var idToTemplate = cached(function (id) {
  43673. var el = query(id);
  43674. return el && el.innerHTML
  43675. });
  43676. var mount = Vue.prototype.$mount;
  43677. Vue.prototype.$mount = function (
  43678. el,
  43679. hydrating
  43680. ) {
  43681. el = el && query(el);
  43682. /* istanbul ignore if */
  43683. if (el === document.body || el === document.documentElement) {
  43684. warn(
  43685. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  43686. );
  43687. return this
  43688. }
  43689. var options = this.$options;
  43690. // resolve template/el and convert to render function
  43691. if (!options.render) {
  43692. var template = options.template;
  43693. if (template) {
  43694. if (typeof template === 'string') {
  43695. if (template.charAt(0) === '#') {
  43696. template = idToTemplate(template);
  43697. /* istanbul ignore if */
  43698. if (!template) {
  43699. warn(
  43700. ("Template element not found or is empty: " + (options.template)),
  43701. this
  43702. );
  43703. }
  43704. }
  43705. } else if (template.nodeType) {
  43706. template = template.innerHTML;
  43707. } else {
  43708. {
  43709. warn('invalid template option:' + template, this);
  43710. }
  43711. return this
  43712. }
  43713. } else if (el) {
  43714. template = getOuterHTML(el);
  43715. }
  43716. if (template) {
  43717. /* istanbul ignore if */
  43718. if (config.performance && mark) {
  43719. mark('compile');
  43720. }
  43721. var ref = compileToFunctions(template, {
  43722. outputSourceRange: "development" !== 'production',
  43723. shouldDecodeNewlines: shouldDecodeNewlines,
  43724. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  43725. delimiters: options.delimiters,
  43726. comments: options.comments
  43727. }, this);
  43728. var render = ref.render;
  43729. var staticRenderFns = ref.staticRenderFns;
  43730. options.render = render;
  43731. options.staticRenderFns = staticRenderFns;
  43732. /* istanbul ignore if */
  43733. if (config.performance && mark) {
  43734. mark('compile end');
  43735. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  43736. }
  43737. }
  43738. }
  43739. return mount.call(this, el, hydrating)
  43740. };
  43741. /**
  43742. * Get outerHTML of elements, taking care
  43743. * of SVG elements in IE as well.
  43744. */
  43745. function getOuterHTML (el) {
  43746. if (el.outerHTML) {
  43747. return el.outerHTML
  43748. } else {
  43749. var container = document.createElement('div');
  43750. container.appendChild(el.cloneNode(true));
  43751. return container.innerHTML
  43752. }
  43753. }
  43754. Vue.compile = compileToFunctions;
  43755. module.exports = Vue;
  43756. /* 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))
  43757. /***/ }),
  43758. /***/ "./node_modules/vue/dist/vue.common.js":
  43759. /*!*********************************************!*\
  43760. !*** ./node_modules/vue/dist/vue.common.js ***!
  43761. \*********************************************/
  43762. /*! no static exports found */
  43763. /***/ (function(module, exports, __webpack_require__) {
  43764. if (false) {} else {
  43765. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  43766. }
  43767. /***/ }),
  43768. /***/ "./node_modules/webpack/buildin/global.js":
  43769. /*!***********************************!*\
  43770. !*** (webpack)/buildin/global.js ***!
  43771. \***********************************/
  43772. /*! no static exports found */
  43773. /***/ (function(module, exports) {
  43774. var g;
  43775. // This works in non-strict mode
  43776. g = (function() {
  43777. return this;
  43778. })();
  43779. try {
  43780. // This works if eval is allowed (see CSP)
  43781. g = g || new Function("return this")();
  43782. } catch (e) {
  43783. // This works if the window reference is available
  43784. if (typeof window === "object") g = window;
  43785. }
  43786. // g can still be undefined, but nothing to do about it...
  43787. // We return undefined, instead of nothing here, so it's
  43788. // easier to handle this case. if(!global) { ...}
  43789. module.exports = g;
  43790. /***/ }),
  43791. /***/ "./node_modules/webpack/buildin/module.js":
  43792. /*!***********************************!*\
  43793. !*** (webpack)/buildin/module.js ***!
  43794. \***********************************/
  43795. /*! no static exports found */
  43796. /***/ (function(module, exports) {
  43797. module.exports = function(module) {
  43798. if (!module.webpackPolyfill) {
  43799. module.deprecate = function() {};
  43800. module.paths = [];
  43801. // module.parent = undefined by default
  43802. if (!module.children) module.children = [];
  43803. Object.defineProperty(module, "loaded", {
  43804. enumerable: true,
  43805. get: function() {
  43806. return module.l;
  43807. }
  43808. });
  43809. Object.defineProperty(module, "id", {
  43810. enumerable: true,
  43811. get: function() {
  43812. return module.i;
  43813. }
  43814. });
  43815. module.webpackPolyfill = 1;
  43816. }
  43817. return module;
  43818. };
  43819. /***/ }),
  43820. /***/ "./resources/js/app.js":
  43821. /*!*****************************!*\
  43822. !*** ./resources/js/app.js ***!
  43823. \*****************************/
  43824. /*! no static exports found */
  43825. /***/ (function(module, exports, __webpack_require__) {
  43826. /**
  43827. * First we will load all of this project's JavaScript dependencies which
  43828. * includes Vue and other libraries. It is a great starting point when
  43829. * building robust, powerful web applications using Vue and Laravel.
  43830. */
  43831. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  43832. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  43833. /**
  43834. * The following block of code may be used to automatically register your
  43835. * Vue components. It will recursively scan this directory for the Vue
  43836. * components and automatically register them with their "basename".
  43837. *
  43838. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  43839. */
  43840. // const files = require.context('./', true, /\.vue$/i)
  43841. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  43842. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  43843. /**
  43844. * Next, we will create a fresh Vue application instance and attach it to
  43845. * the page. Then, you may begin adding components to this application
  43846. * or customize the JavaScript scaffolding to fit your unique needs.
  43847. */
  43848. var app = new Vue({
  43849. el: '#app'
  43850. });
  43851. /***/ }),
  43852. /***/ "./resources/js/bootstrap.js":
  43853. /*!***********************************!*\
  43854. !*** ./resources/js/bootstrap.js ***!
  43855. \***********************************/
  43856. /*! no static exports found */
  43857. /***/ (function(module, exports, __webpack_require__) {
  43858. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  43859. /**
  43860. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43861. * for JavaScript based Bootstrap features such as modals and tabs. This
  43862. * code may be modified to fit the specific needs of your application.
  43863. */
  43864. try {
  43865. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  43866. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  43867. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  43868. } catch (e) {}
  43869. /**
  43870. * We'll load the axios HTTP library which allows us to easily issue requests
  43871. * to our Laravel back-end. This library automatically handles sending the
  43872. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43873. */
  43874. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  43875. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43876. /**
  43877. * Echo exposes an expressive API for subscribing to channels and listening
  43878. * for events that are broadcast by Laravel. Echo and event broadcasting
  43879. * allows your team to easily build robust real-time web applications.
  43880. */
  43881. // import Echo from 'laravel-echo';
  43882. // window.Pusher = require('pusher-js');
  43883. // window.Echo = new Echo({
  43884. // broadcaster: 'pusher',
  43885. // key: process.env.MIX_PUSHER_APP_KEY,
  43886. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43887. // forceTLS: true
  43888. // });
  43889. /***/ }),
  43890. /***/ "./resources/js/components/ExampleComponent.vue":
  43891. /*!******************************************************!*\
  43892. !*** ./resources/js/components/ExampleComponent.vue ***!
  43893. \******************************************************/
  43894. /*! exports provided: default */
  43895. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43896. "use strict";
  43897. __webpack_require__.r(__webpack_exports__);
  43898. /* 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&");
  43899. /* 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&");
  43900. /* 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");
  43901. /* normalize component */
  43902. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  43903. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  43904. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  43905. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  43906. false,
  43907. null,
  43908. null,
  43909. null
  43910. )
  43911. /* hot reload */
  43912. if (false) { var api; }
  43913. component.options.__file = "resources/js/components/ExampleComponent.vue"
  43914. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  43915. /***/ }),
  43916. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  43917. /*!*******************************************************************************!*\
  43918. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  43919. \*******************************************************************************/
  43920. /*! exports provided: default */
  43921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43922. "use strict";
  43923. __webpack_require__.r(__webpack_exports__);
  43924. /* 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&");
  43925. /* 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"]);
  43926. /***/ }),
  43927. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  43928. /*!*************************************************************************************!*\
  43929. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  43930. \*************************************************************************************/
  43931. /*! exports provided: render, staticRenderFns */
  43932. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43933. "use strict";
  43934. __webpack_require__.r(__webpack_exports__);
  43935. /* 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&");
  43936. /* 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"]; });
  43937. /* 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"]; });
  43938. /***/ }),
  43939. /***/ "./resources/sass/app.scss":
  43940. /*!*********************************!*\
  43941. !*** ./resources/sass/app.scss ***!
  43942. \*********************************/
  43943. /*! no static exports found */
  43944. /***/ (function(module, exports) {
  43945. // removed by extract-text-webpack-plugin
  43946. /***/ }),
  43947. /***/ 0:
  43948. /*!*************************************************************!*\
  43949. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  43950. \*************************************************************/
  43951. /*! no static exports found */
  43952. /***/ (function(module, exports, __webpack_require__) {
  43953. __webpack_require__(/*! /var/www/html/supersite/resources/js/app.js */"./resources/js/app.js");
  43954. module.exports = __webpack_require__(/*! /var/www/html/supersite/resources/sass/app.scss */"./resources/sass/app.scss");
  43955. /***/ })
  43956. /******/ });